[Devel] [PATCH] ptrace: don't change the upstream logic which affects criu

Andrew Vagin avagin at openvz.org
Mon Dec 14 06:31:06 PST 2015


We changed logic of getting registers via ptrace to get PID from
the current namespace for clone, fork and vfork system calls.
It was done in rhel5 and then this patch was backported into rhel6
and rhel7.
https://jira.sw.ru/browse/PCLIN-27522

It was done to be able to trace container's processes via strace.
Now strace works without this patch, so we can drop it.

https://jira.sw.ru/browse/PSBM-42216

Signed-off-by: Andrew Vagin <avagin at openvz.org>
---
 arch/x86/kernel/ptrace.c    |   22 ----------------------
 2 files changed, 0 insertions(+), 26 deletions(-)

diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 1c551af..b7cc6a0 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -37,7 +37,6 @@
 #include <asm/proto.h>
 #include <asm/hw_breakpoint.h>
 #include <asm/traps.h>
-#include <asm/unistd.h>
 
 #include "tls.h"
 
@@ -504,27 +503,6 @@ static unsigned long getreg(struct task_struct *task, unsigned long offset)
 		return get_desc_base(&task->thread.tls_array[GS_TLS]);
 	}
 #endif
-#ifdef CONFIG_VE
-	case offsetof(struct user_regs_struct, ax): {
-		struct pt_regs *regs;
-		unsigned long ret;
-
-		regs = task_pt_regs(task);
-		ret = *pt_regs_access(regs, offset);
-
-		if ((regs->orig_ax == __NR_vfork) ||
-		    (regs->orig_ax == __NR_clone) ||
-		    (regs->orig_ax == __NR_fork)) {
-			rcu_read_lock();
-			/* get tracee pid in tracer's pid-namespace */
-			if (task->nsproxy->pid_ns != current->nsproxy->pid_ns)
-				ret = pid_vnr(find_pid_ns(ret,
-						task->nsproxy->pid_ns));
-			rcu_read_unlock();
-		}
-		return ret;
-	}
-#endif
 	}
 
 	return *pt_regs_access(task_pt_regs(task), offset);
-- 
1.7.1



More information about the Devel mailing list