From 3ea601fc4af070f69ea5240cb51ac84a4baa9088 Mon Sep 17 00:00:00 2001 From: Kris Van Hees Date: Thu, 7 Feb 2013 16:36:26 -0500 Subject: [PATCH] dtrace: update execve() syscall probe support The execve syscall stub and entry syscall function changed from 3.6 to 3.7 to no longer pass a pointer to the registers from the stub to the entry syscall function. Instead, the entry syscall function now retrieves the registers using current_pt_regs(), and passes it to the do_execve() function. The DTrace stub and override function have been updated to use the same mechanism. Signed-off-by: Kris Van Hees --- kernel/dtrace/dtrace_os.c | 17 ++++++++--------- kernel/dtrace/dtrace_stubs_x86_64.S | 1 - 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/kernel/dtrace/dtrace_os.c b/kernel/dtrace/dtrace_os.c index ce13292d57fd..f58e669db409 100644 --- a/kernel/dtrace/dtrace_os.c +++ b/kernel/dtrace/dtrace_os.c @@ -784,12 +784,13 @@ long dtrace_vfork(struct pt_regs *regs) long dtrace_execve(const char __user *name, const char __user *const __user *argv, - const char __user *const __user *envp, struct pt_regs *regs) + const char __user *const __user *envp) { long rc = 0; dtrace_id_t id; dtrace_syscalls_t *sc; - char *filename; + struct filename *path; + struct pt_regs *regs = current_pt_regs(); sc = &systrace_info.sysent[__NR_execve]; @@ -801,14 +802,12 @@ long dtrace_execve(const char __user *name, * FIXME: Add stop functionality for DTrace. */ - filename = getname(name); - rc = PTR_ERR(filename); - if (IS_ERR(filename)) + path = getname(name); + rc = PTR_ERR(path); + if (IS_ERR(path)) goto out; - - rc = do_execve(filename, argv, envp, regs); - - putname(filename); + rc = do_execve(path->name, argv, envp, regs); + putname(path); out: if ((id = sc->stsy_return) != DTRACE_IDNONE) diff --git a/kernel/dtrace/dtrace_stubs_x86_64.S b/kernel/dtrace/dtrace_stubs_x86_64.S index dde72e3d959c..39620b2ef1e2 100644 --- a/kernel/dtrace/dtrace_stubs_x86_64.S +++ b/kernel/dtrace/dtrace_stubs_x86_64.S @@ -170,7 +170,6 @@ ENTRY(dtrace_stub_execve) PARTIAL_FRAME 0 SAVE_REST FIXUP_TOP_OF_STACK %r11 - movq %rsp, %rcx call dtrace_execve RESTORE_TOP_OF_STACK %r11 movq %rax,RAX(%rsp) -- 2.50.1