Debian Codegraph @

tapset/linux/sysc_inotify_rm_watch.stp

raw
1 # inotify_rm_watch ___________________________________________
2 #
3 # long sys_inotify_rm_watch(int fd, u32 wd)
4 #
5
6 @define _SYSCALL_INOTIFY_RM_WATCH_NAME
7 %(
8 name = "inotify_rm_watch"
9 %)
10
11 @define _SYSCALL_INOTIFY_RM_WATCH_ARGSTR
12 %(
13 argstr = sprintf("%d, %d", fd, wd)
14 %)
15
16 @define _SYSCALL_INOTIFY_RM_WATCH_REGARGS
17 %(
18 fd = int_arg(1)
19 wd = int_arg(2)
20 %)
21
22 @define _SYSCALL_INOTIFY_RM_WATCH_REGARGS_STORE
23 %(
24 if (@probewrite(fd))
25 set_int_arg(1, fd)
26
27 if (@probewrite(wd))
28 set_int_arg(2, wd)
29 %)
30
31 probe syscall.inotify_rm_watch = dw_syscall.inotify_rm_watch !,
32 nd_syscall.inotify_rm_watch ? {}
33 probe syscall.inotify_rm_watch.return = dw_syscall.inotify_rm_watch.return !,
34 nd_syscall.inotify_rm_watch.return ? {}
35
36 # dw_inotify_rm_watch _____________________________________________________
37
38 probe dw_syscall.inotify_rm_watch = kernel.function("sys_inotify_rm_watch").call ?
39 {
40 @_SYSCALL_INOTIFY_RM_WATCH_NAME
41 fd = __int32($fd)
42 wd = __int32($wd)
43 @_SYSCALL_INOTIFY_RM_WATCH_ARGSTR
44 }
45 probe dw_syscall.inotify_rm_watch.return = kernel.function("sys_inotify_rm_watch").return ?
46 {
47 @_SYSCALL_INOTIFY_RM_WATCH_NAME
48 @SYSC_RETVALSTR($return)
49 }
50
51 # nd_inotify_rm_watch _____________________________________________________
52
53 probe nd_syscall.inotify_rm_watch = nd1_syscall.inotify_rm_watch!, nd2_syscall.inotify_rm_watch!, tp_syscall.inotify_rm_watch
54 { }
55
56 probe nd1_syscall.inotify_rm_watch = kprobe.function("sys_inotify_rm_watch") ?
57 {
58 @_SYSCALL_INOTIFY_RM_WATCH_NAME
59 asmlinkage()
60 @_SYSCALL_INOTIFY_RM_WATCH_REGARGS
61 @_SYSCALL_INOTIFY_RM_WATCH_ARGSTR
62 }
63
64 /* kernel 4.17+ */
65 probe nd2_syscall.inotify_rm_watch = kprobe.function(@arch_syscall_prefix "sys_inotify_rm_watch") ?
66 {
67 __set_syscall_pt_regs(pointer_arg(1))
68 @_SYSCALL_INOTIFY_RM_WATCH_NAME
69 @_SYSCALL_INOTIFY_RM_WATCH_REGARGS
70 @_SYSCALL_INOTIFY_RM_WATCH_ARGSTR
71 },
72 {
73 %( @_IS_SREG_KERNEL %? @_SYSCALL_INOTIFY_RM_WATCH_REGARGS_STORE %)
74 }
75
76 /* kernel 3.5+, but undesirable because it affects all syscalls */
77 probe tp_syscall.inotify_rm_watch = kernel.trace("sys_enter")
78 {
79 __set_syscall_pt_regs($regs)
80 @__syscall_compat_gate(@const("__NR_inotify_rm_watch"), @const("__NR_compat_inotify_rm_watch"))
81 @_SYSCALL_INOTIFY_RM_WATCH_NAME
82 @_SYSCALL_INOTIFY_RM_WATCH_REGARGS
83 @_SYSCALL_INOTIFY_RM_WATCH_ARGSTR
84 },
85 {
86 %( @_IS_SREG_KERNEL %? @_SYSCALL_INOTIFY_RM_WATCH_REGARGS_STORE %)
87 }
88
89 probe nd_syscall.inotify_rm_watch.return = nd1_syscall.inotify_rm_watch.return!, nd2_syscall.inotify_rm_watch.return!, tp_syscall.inotify_rm_watch.return
90 { }
91
92 probe nd1_syscall.inotify_rm_watch.return = kprobe.function("sys_inotify_rm_watch").return ?
93 {
94 @_SYSCALL_INOTIFY_RM_WATCH_NAME
95 @SYSC_RETVALSTR(returnval())
96 }
97
98 /* kernel 4.17+ */
99 probe nd2_syscall.inotify_rm_watch.return = kprobe.function(@arch_syscall_prefix "sys_inotify_rm_watch").return ?
100 {
101 @_SYSCALL_INOTIFY_RM_WATCH_NAME
102 @SYSC_RETVALSTR(returnval())
103 }
104
105 /* kernel 3.5+, but undesirable because it affects all syscalls */
106 probe tp_syscall.inotify_rm_watch.return = kernel.trace("sys_exit")
107 {
108 __set_syscall_pt_regs($regs)
109 @__syscall_compat_gate(@const("__NR_inotify_rm_watch"), @const("__NR_compat_inotify_rm_watch"))
110 @_SYSCALL_INOTIFY_RM_WATCH_NAME
111 @SYSC_RETVALSTR($ret)
112 }