Debian Codegraph @

tapset/linux/sysc_flistxattr.stp

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