From 99edef7bff6462ba4d370d83d335af9adce908ea Mon Sep 17 00:00:00 2001 From: David Smith Date: Thu, 19 Dec 2013 13:05:15 -0600 Subject: [PATCH] PR16207 partial fix: Fix the 'mount' [nd_]syscall.exp tests on rawhide. * tapset/linux/syscalls2.stp: Add 'sys_oldumount' support to the syscall.umount probe. Don't allow syscall nesting in syscall.umount. * tapset/linux/nd_syscalls2.stp: Ditto. --- tapset/linux/nd_syscalls2.stp | 26 ++++++++++++++++++++++++-- tapset/linux/syscalls2.stp | 22 ++++++++++++++++++++-- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/tapset/linux/nd_syscalls2.stp b/tapset/linux/nd_syscalls2.stp index 6ef348824..e9ed66831 100644 --- a/tapset/linux/nd_syscalls2.stp +++ b/tapset/linux/nd_syscalls2.stp @@ -4147,10 +4147,15 @@ probe nd_syscall.umask.return = kprobe.function("sys_umask").return ? # umount _____________________________________________________ # long sys_umount(char __user * name, int flags) +# SYSCALL_DEFINE1(oldumount, char __user *, name) # -probe nd_syscall.umount = kprobe.function("sys_umount") ? +probe nd_syscall.umount = __nd_syscall.umount, __nd_syscall.oldumount ? { name = "umount" +} +probe __nd_syscall.umount = kprobe.function("sys_umount") +{ + @__syscall_compat_gate(%{ __NR_umount2 %}, %{ __NR_compat_umount2 %}) // target = user_string($name) // flags = $flags // flags_str = _umountflags_str($flags) @@ -4161,11 +4166,28 @@ probe nd_syscall.umount = kprobe.function("sys_umount") ? flags_str = _umountflags_str(flags) argstr = sprintf("%s, %s", user_string_quoted(pointer_arg(1)), flags_str) } -probe nd_syscall.umount.return = kprobe.function("sys_umount").return ? +probe __nd_syscall.oldumount = kprobe.function("sys_oldumount") ? +{ + // target = user_string_quoted($name) + // flags = 0 + // flags_str = "0" + // argstr = sprintf("%s, 0", user_string_quoted($name)) + asmlinkage() + target = user_string_quoted(pointer_arg(1)) + flags = 0 + flags_str = "0" + argstr = sprintf("%s, 0", user_string_quoted(pointer_arg(1))) +} +probe nd_syscall.umount.return = __nd_syscall.umount.return, + kprobe.function("sys_oldumount").return ? { name = "umount" retstr = returnstr(1) } +probe __nd_syscall.umount.return = kprobe.function("sys_umount").return +{ + @__syscall_compat_gate(%{ __NR_umount2 %}, %{ __NR_compat_umount2 %}) +} # uname ______________________________________________________ # diff --git a/tapset/linux/syscalls2.stp b/tapset/linux/syscalls2.stp index 2c72e1fa4..72a090909 100644 --- a/tapset/linux/syscalls2.stp +++ b/tapset/linux/syscalls2.stp @@ -3417,20 +3417,38 @@ probe syscall.umask.return = kernel.function("sys_umask").return # umount _____________________________________________________ # long sys_umount(char __user * name, int flags) +# SYSCALL_DEFINE1(oldumount, char __user *, name) # -probe syscall.umount = kernel.function("sys_umount").call +probe syscall.umount = __syscall.umount, __syscall.oldumount ? { name = "umount" +} +probe __syscall.umount = kernel.function("sys_umount").call +{ + @__syscall_compat_gate(%{ __NR_umount2 %}, %{ __NR_compat_umount2 %}) target = user_string_quoted($name) flags = $flags flags_str = _umountflags_str($flags) argstr = sprintf("%s, %s", user_string_quoted($name), flags_str) } -probe syscall.umount.return = kernel.function("sys_umount").return +probe __syscall.oldumount = kernel.function("sys_oldumount").call ? +{ + target = user_string_quoted($name) + flags = 0 + flags_str = "0" + argstr = sprintf("%s, 0", user_string_quoted($name)) +} +probe syscall.umount.return = __syscall.umount.return, + kernel.function("sys_oldumount").return ? { name = "umount" retstr = return_str(1, $return) } +probe __syscall.umount.return = kernel.function("sys_umount").return +{ + @__syscall_compat_gate(%{ __NR_umount2 %}, %{ __NR_compat_umount2 %}) +} + # uname ______________________________________________________ # # int sys_uname(struct old_utsname __user *name) -- 2.43.5