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

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