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

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