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

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