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

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