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

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