Debian Codegraph @

tapset/linux/sysc_fremovexattr.stp

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