Debian Codegraph @

tapset/linux/sysc_lremovexattr.stp

raw
1 # lremovexattr _______________________________________________
2 # long sys_lremovexattr(char __user *path, char __user *name)
3 #
4
5 @define _SYSCALL_LREMOVEXATTR_NAME
6 %(
7 name = "lremovexattr"
8 %)
9
10 @define _SYSCALL_LREMOVEXATTR_ARGSTR
11 %(
12 argstr = sprintf("%s, %s", path, name_str)
13 %)
14
15 @define _SYSCALL_LREMOVEXATTR_REGARGS
16 %(
17 path_uaddr = pointer_arg(1)
18 path = user_string_quoted(path_uaddr)
19 path_unquoted = user_string_nofault(pointer_arg(1))
20 name_uaddr = pointer_arg(2)
21 # 'name2' should have been 'name_str'. Deprecate the old name.
22 %(systemtap_v <= "1.4" %?
23 name2 = user_string_quoted(name_uaddr)
24 name2_unquoted = user_string_nofault(pointer_arg(2))
25 %)
26 name_str = user_string_quoted(name_uaddr)
27 name_str_unquoted = user_string_nofault(pointer_arg(2))
28 %)
29
30 @define _SYSCALL_LREMOVEXATTR_REGARGS_STORE
31 %(
32 if (@probewrite(path_uaddr))
33 set_pointer_arg(1, path_uaddr)
34
35 if (@probewrite(path_unquoted))
36 set_user_string_arg(pointer_arg(1), path_unquoted)
37
38 if (@probewrite(name_uaddr))
39 set_pointer_arg(2, name_uaddr)
40
41 %(systemtap_v <= "1.4" %?
42 if (@probewrite(name2_unquoted))
43 set_user_string_arg(pointer_arg(2), name2_unquoted)
44 %)
45 if (@probewrite(name_str_unquoted))
46 set_user_string_arg(pointer_arg(2), name_str_unquoted)
47 %)
48
49 probe syscall.lremovexattr = dw_syscall.lremovexattr !, nd_syscall.lremovexattr ? {}
50 probe syscall.lremovexattr.return = dw_syscall.lremovexattr.return !, nd_syscall.lremovexattr.return ? {}
51
52 # dw_lremovexattr _____________________________________________________
53
54 probe dw_syscall.lremovexattr = kernel.function("sys_lremovexattr").call
55 {
56 @_SYSCALL_LREMOVEXATTR_NAME
57 name_uaddr = $name
58 # 'name2' should have been 'name_str'. Deprecate the old name.
59 %(systemtap_v <= "1.4" %?
60 name2 = user_string_quoted($name)
61 %)
62 name_str = user_string_quoted($name)
63 path_uaddr = @choose_defined($pathname, $path)
64 path = user_string_quoted(@choose_defined($pathname, $path))
65 @_SYSCALL_LREMOVEXATTR_ARGSTR
66 }
67 probe dw_syscall.lremovexattr.return = kernel.function("sys_lremovexattr").return
68 {
69 @_SYSCALL_LREMOVEXATTR_NAME
70 @SYSC_RETVALSTR($return)
71 }
72
73 # nd_lremovexattr _____________________________________________________
74
75 probe nd_syscall.lremovexattr = nd1_syscall.lremovexattr!, nd2_syscall.lremovexattr!, tp_syscall.lremovexattr
76 { }
77
78 probe nd1_syscall.lremovexattr = kprobe.function("sys_lremovexattr") ?
79 {
80 @_SYSCALL_LREMOVEXATTR_NAME
81 asmlinkage()
82 @_SYSCALL_LREMOVEXATTR_REGARGS
83 @_SYSCALL_LREMOVEXATTR_ARGSTR
84 }
85
86 /* kernel 4.17+ */
87 probe nd2_syscall.lremovexattr = kprobe.function(@arch_syscall_prefix "sys_lremovexattr") ?
88 {
89 __set_syscall_pt_regs(pointer_arg(1))
90 @_SYSCALL_LREMOVEXATTR_NAME
91 @_SYSCALL_LREMOVEXATTR_REGARGS
92 @_SYSCALL_LREMOVEXATTR_ARGSTR
93 },
94 {
95 %( @_IS_SREG_KERNEL %? @_SYSCALL_LREMOVEXATTR_REGARGS_STORE %)
96 }
97
98 /* kernel 3.5+, but undesirable because it affects all syscalls */
99 probe tp_syscall.lremovexattr = kernel.trace("sys_enter")
100 {
101 __set_syscall_pt_regs($regs)
102 @__syscall_compat_gate(@const("__NR_lremovexattr"), @const("__NR_compat_lremovexattr"))
103 @_SYSCALL_LREMOVEXATTR_NAME
104 @_SYSCALL_LREMOVEXATTR_REGARGS
105 @_SYSCALL_LREMOVEXATTR_ARGSTR
106 },
107 {
108 %( @_IS_SREG_KERNEL %? @_SYSCALL_LREMOVEXATTR_REGARGS_STORE %)
109 }
110
111 probe nd_syscall.lremovexattr.return = nd1_syscall.lremovexattr.return!, nd2_syscall.lremovexattr.return!, tp_syscall.lremovexattr.return
112 { }
113
114 probe nd1_syscall.lremovexattr.return = kprobe.function("sys_lremovexattr").return ?
115 {
116 @_SYSCALL_LREMOVEXATTR_NAME
117 @SYSC_RETVALSTR(returnval())
118 }
119
120 /* kernel 4.17+ */
121 probe nd2_syscall.lremovexattr.return = kprobe.function(@arch_syscall_prefix "sys_lremovexattr").return ?
122 {
123 @_SYSCALL_LREMOVEXATTR_NAME
124 @SYSC_RETVALSTR(returnval())
125 }
126
127 /* kernel 3.5+, but undesirable because it affects all syscalls */
128 probe tp_syscall.lremovexattr.return = kernel.trace("sys_exit")
129 {
130 __set_syscall_pt_regs($regs)
131 @__syscall_compat_gate(@const("__NR_lremovexattr"), @const("__NR_compat_lremovexattr"))
132 @_SYSCALL_LREMOVEXATTR_NAME
133 @SYSC_RETVALSTR($ret)
134 }