Blame SOURCES/ltrace-0.7.91-ppc64-fork.patch

e7106e
From 35742523e3daa0e59de0c1c3fdd8e5ff52891967 Mon Sep 17 00:00:00 2001
e7106e
From: Petr Machata <pmachata@redhat.com>
e7106e
Date: Thu, 9 Jan 2014 23:41:50 +0100
e7106e
Subject: [PATCH] Fix a problem in tracing across fork on PPC64
e7106e
e7106e
In order to avoid single-stepping through large portions of the
e7106e
dynamic linker, ltrace remembers at which address the instruction that
e7106e
resolved a PLT slot is.  It then puts a breakpoint to this address so
e7106e
that it can fast-forward to that address next time it needs to catch a
e7106e
PLT slot being resolved.
e7106e
e7106e
When a process is cloned, the pointer to this breakpoint is simply
e7106e
copied over to the new process, instead of being looked up in the new
e7106e
process structures.  This patches fixes this.
e7106e
---
e7106e
 sysdeps/linux-gnu/ppc/plt.c |   14 +++++++++++++-
e7106e
 1 files changed, 13 insertions(+), 1 deletions(-)
e7106e
e7106e
diff --git a/sysdeps/linux-gnu/ppc/plt.c b/sysdeps/linux-gnu/ppc/plt.c
e7106e
index 3ec1397..8715da6 100644
e7106e
--- a/sysdeps/linux-gnu/ppc/plt.c
e7106e
+++ b/sysdeps/linux-gnu/ppc/plt.c
e7106e
@@ -1,6 +1,6 @@
e7106e
 /*
e7106e
  * This file is part of ltrace.
e7106e
- * Copyright (C) 2012,2013 Petr Machata, Red Hat Inc.
e7106e
+ * Copyright (C) 2012,2013,2014 Petr Machata, Red Hat Inc.
e7106e
  * Copyright (C) 2004,2008,2009 Juan Cespedes
e7106e
  * Copyright (C) 2006 Paul Gilliam
e7106e
  *
e7106e
@@ -1157,6 +1157,18 @@ int
e7106e
 arch_process_clone(struct process *retp, struct process *proc)
e7106e
 {
e7106e
 	retp->arch = proc->arch;
e7106e
+
e7106e
+	if (retp->arch.dl_plt_update_bp != NULL) {
e7106e
+		/* Point it to the corresponding breakpoint in RETP.
e7106e
+		 * It must be there, this part of PROC has already
e7106e
+		 * been cloned to RETP.  */
e7106e
+		retp->arch.dl_plt_update_bp
e7106e
+			= address2bpstruct(retp,
e7106e
+					   retp->arch.dl_plt_update_bp->addr);
e7106e
+
e7106e
+		assert(retp->arch.dl_plt_update_bp != NULL);
e7106e
+	}
e7106e
+
e7106e
 	return 0;
e7106e
 }
e7106e
 
e7106e
-- 
e7106e
1.7.6.5
e7106e