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

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