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