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

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