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

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