|
|
cab4ad |
commit aacee6563b7fd835b9a21e4ae5a0b4f7f743c7ef
|
|
|
cab4ad |
Author: Martin Cermak <mcermak@redhat.com>
|
|
|
cab4ad |
Date: Thu Dec 6 13:52:20 2018 +0100
|
|
|
cab4ad |
|
|
|
cab4ad |
Make sysc_bdflush.stp compatible with 4.17+ kernels.
|
|
|
cab4ad |
|
|
|
cab4ad |
The bdflush syscall itself appears to be obsolete since 2.6,
|
|
|
cab4ad |
but this way we at least won't end up with pass 1 "resolution
|
|
|
cab4ad |
failed in alias expansion builder" when randomly probing for it.
|
|
|
cab4ad |
There is an old customer rh bz 544960 related to bdflush.
|
|
|
cab4ad |
|
|
|
cab4ad |
diff --git a/tapset/linux/sysc_bdflush.stp b/tapset/linux/sysc_bdflush.stp
|
|
|
cab4ad |
index 0798964..48a04b9 100644
|
|
|
cab4ad |
--- a/tapset/linux/sysc_bdflush.stp
|
|
|
cab4ad |
+++ b/tapset/linux/sysc_bdflush.stp
|
|
|
cab4ad |
@@ -11,6 +11,12 @@
|
|
|
cab4ad |
argstr = sprintf("%d, %s", func, data_str)
|
|
|
cab4ad |
%)
|
|
|
cab4ad |
|
|
|
cab4ad |
+@define _SYSCALL_BDFLUSH_REGARGS
|
|
|
cab4ad |
+%(
|
|
|
cab4ad |
+ func = int_arg(1)
|
|
|
cab4ad |
+ data = long_arg(2)
|
|
|
cab4ad |
+%)
|
|
|
cab4ad |
+
|
|
|
cab4ad |
probe syscall.bdflush = dw_syscall.bdflush !, nd_syscall.bdflush ? {}
|
|
|
cab4ad |
probe syscall.bdflush.return = dw_syscall.bdflush.return !, nd_syscall.bdflush.return ? {}
|
|
|
cab4ad |
|
|
|
cab4ad |
@@ -35,20 +41,72 @@ probe dw_syscall.bdflush.return = kernel.function("sys_bdflush").return ?
|
|
|
cab4ad |
|
|
|
cab4ad |
# nd_bdflush _____________________________________________________
|
|
|
cab4ad |
|
|
|
cab4ad |
-probe nd_syscall.bdflush = kprobe.function("sys_bdflush") ?
|
|
|
cab4ad |
+
|
|
|
cab4ad |
+probe nd_syscall.bdflush = nd1_syscall.bdflush!, nd2_syscall.bdflush!, tp_syscall.bdflush
|
|
|
cab4ad |
+{
|
|
|
cab4ad |
+}
|
|
|
cab4ad |
+
|
|
|
cab4ad |
+probe nd1_syscall.bdflush = kprobe.function("sys_bdflush") ?
|
|
|
cab4ad |
{
|
|
|
cab4ad |
@_SYSCALL_BDFLUSH_NAME
|
|
|
cab4ad |
asmlinkage()
|
|
|
cab4ad |
- func = int_arg(1)
|
|
|
cab4ad |
- data = long_arg(2)
|
|
|
cab4ad |
+ @_SYSCALL_BDFLUSH_REGARGS
|
|
|
cab4ad |
if ((func >= 2) && (func % 2 == 0))
|
|
|
cab4ad |
data_str = sprintf("%p", data)
|
|
|
cab4ad |
else
|
|
|
cab4ad |
data_str = sprintf("%d", data)
|
|
|
cab4ad |
@_SYSCALL_BDFLUSH_ARGSTR
|
|
|
cab4ad |
}
|
|
|
cab4ad |
-probe nd_syscall.bdflush.return = kprobe.function("sys_bdflush").return ?
|
|
|
cab4ad |
+
|
|
|
cab4ad |
+/* kernel 4.17+ */
|
|
|
cab4ad |
+probe nd2_syscall.bdflush = kprobe.function(@arch_syscall_prefix "sys_bdflush") ?
|
|
|
cab4ad |
+{
|
|
|
cab4ad |
+ @_SYSCALL_BDFLUSH_NAME
|
|
|
cab4ad |
+ asmlinkage()
|
|
|
cab4ad |
+ @_SYSCALL_BDFLUSH_REGARGS
|
|
|
cab4ad |
+ if ((func >= 2) && (func % 2 == 0))
|
|
|
cab4ad |
+ data_str = sprintf("%p", data)
|
|
|
cab4ad |
+ else
|
|
|
cab4ad |
+ data_str = sprintf("%d", data)
|
|
|
cab4ad |
+ @_SYSCALL_BDFLUSH_ARGSTR
|
|
|
cab4ad |
+}
|
|
|
cab4ad |
+
|
|
|
cab4ad |
+/* kernel 3.5+, but undesirable because it affects all syscalls */
|
|
|
cab4ad |
+probe tp_syscall.bdflush = kernel.trace("sys_enter")
|
|
|
cab4ad |
+{
|
|
|
cab4ad |
+ __set_syscall_pt_regs($regs)
|
|
|
cab4ad |
+ @__syscall_compat_gate(@const("__NR_bdflush"), @const("__NR_compat_bdflush"))
|
|
|
cab4ad |
+ @_SYSCALL_BDFLUSH_NAME
|
|
|
cab4ad |
+ @_SYSCALL_BDFLUSH_REGARGS
|
|
|
cab4ad |
+ if ((func >= 2) && (func % 2 == 0))
|
|
|
cab4ad |
+ data_str = sprintf("%p", data)
|
|
|
cab4ad |
+ else
|
|
|
cab4ad |
+ data_str = sprintf("%d", data)
|
|
|
cab4ad |
+ @_SYSCALL_BDFLUSH_ARGSTR
|
|
|
cab4ad |
+}
|
|
|
cab4ad |
+
|
|
|
cab4ad |
+probe nd_syscall.bdflush.return = nd1_syscall.bdflush.return!, nd2_syscall.bdflush.return!, tp_syscall.bdflush.return
|
|
|
cab4ad |
+{
|
|
|
cab4ad |
+}
|
|
|
cab4ad |
+
|
|
|
cab4ad |
+probe nd1_syscall.bdflush.return = kprobe.function("sys_bdflush").return ?
|
|
|
cab4ad |
+{
|
|
|
cab4ad |
+ @_SYSCALL_BDFLUSH_NAME
|
|
|
cab4ad |
+ @SYSC_RETVALSTR(returnval())
|
|
|
cab4ad |
+}
|
|
|
cab4ad |
+
|
|
|
cab4ad |
+/* kernel 4.17+ */
|
|
|
cab4ad |
+probe nd2_syscall.bdflush.return = kprobe.function(@arch_syscall_prefix "sys_bdflush").return ?
|
|
|
cab4ad |
{
|
|
|
cab4ad |
@_SYSCALL_BDFLUSH_NAME
|
|
|
cab4ad |
@SYSC_RETVALSTR(returnval())
|
|
|
cab4ad |
}
|
|
|
cab4ad |
+
|
|
|
cab4ad |
+/* kernel 3.5+, but undesirable because it affects all syscalls */
|
|
|
cab4ad |
+probe tp_syscall.bdflush.return = kernel.trace("sys_exit")
|
|
|
cab4ad |
+{
|
|
|
cab4ad |
+ __set_syscall_pt_regs($regs)
|
|
|
cab4ad |
+ @__syscall_compat_gate(@const("__NR_bdflush"), @const("__NR_compat_bdflush"))
|
|
|
cab4ad |
+ @_SYSCALL_BDFLUSH_NAME
|
|
|
cab4ad |
+ @SYSC_RETVALSTR($ret)
|
|
|
cab4ad |
+}
|