Debian Codegraph @

tapset/linux/sysc_fstatfs64.stp

raw
1 # fstatfs64 __________________________________________________
2 # long sys_fstatfs64(unsigned int fd, size_t sz, struct statfs64 __user *buf)
3 # long compat_sys_fstatfs64(unsigned int fd, compat_size_t sz, struct compat_statfs64 __user *buf)
4 #
5
6 @define _SYSCALL_FSTATFS64_NAME
7 %(
8 name = "fstatfs64"
9 %)
10
11 @define _SYSCALL_FSTATFS64_ARGSTR
12 %(
13 argstr = sprintf("%d, %u, %p", fd, sz, buf_uaddr)
14 %)
15
16 @define _SYSCALL_FSTATFS64_REGARGS
17 %(
18 fd = int_arg(1)
19 sz = ulong_arg(2)
20 buf_uaddr = pointer_arg(3)
21 %)
22
23 @define _SYSCALL_FSTATFS64_REGARGS_STORE
24 %(
25 if (@probewrite(fd))
26 set_int_arg(1, fd)
27
28 if (@probewrite(sz))
29 set_ulong_arg(2, sz)
30
31 if (@probewrite(buf_uaddr))
32 set_pointer_arg(3, buf_uaddr)
33 %)
34
35 probe syscall.fstatfs64 = dw_syscall.fstatfs64 !, nd_syscall.fstatfs64 ? {}
36 probe syscall.fstatfs64.return = dw_syscall.fstatfs64.return !, nd_syscall.fstatfs64.return ? {}
37
38 # dw_fstatfs64 _____________________________________________________
39
40 probe dw_syscall.fstatfs64 = kernel.function("sys_fstatfs64").call ?,
41 kernel.function("compat_sys_fstatfs64").call ?
42 {
43 @_SYSCALL_FSTATFS64_NAME
44 fd = __int32($fd)
45 sz = __ulong($sz)
46 buf_uaddr = @__pointer($buf)
47 @_SYSCALL_FSTATFS64_ARGSTR
48 }
49 probe dw_syscall.fstatfs64.return = kernel.function("sys_fstatfs64").return ?,
50 kernel.function("compat_sys_fstatfs64").return ?
51 {
52 @_SYSCALL_FSTATFS64_NAME
53 @SYSC_RETVALSTR($return)
54 }
55
56 # nd_fstatfs64 _____________________________________________________
57
58 probe nd_syscall.fstatfs64 = nd1_syscall.fstatfs64!, nd2_syscall.fstatfs64!, tp_syscall.fstatfs64
59 { }
60
61 probe nd1_syscall.fstatfs64 = kprobe.function("sys_fstatfs64") ?,
62 kprobe.function("compat_sys_fstatfs64") ?
63 {
64 @_SYSCALL_FSTATFS64_NAME
65 asmlinkage()
66 @_SYSCALL_FSTATFS64_REGARGS
67 @_SYSCALL_FSTATFS64_ARGSTR
68 }
69
70 /* kernel 4.17+ */
71 probe nd2_syscall.fstatfs64 =
72 kprobe.function(@arch_syscall_prefix "compat_sys_fstatfs64") ?
73 {
74 __set_syscall_pt_regs(pointer_arg(1))
75 @_SYSCALL_FSTATFS64_NAME
76 @_SYSCALL_FSTATFS64_REGARGS
77 @_SYSCALL_FSTATFS64_ARGSTR
78 },
79 {
80 @_SYSCALL_FSTATFS64_REGARGS_STORE
81 }
82
83 /* kernel 3.5+, but undesirable because it affects all syscalls */
84 probe tp_syscall.fstatfs64 = kernel.trace("sys_enter")
85 {
86 __set_syscall_pt_regs($regs)
87 @__syscall_compat_gate(@const("__NR_fstatfs64"), @const("__NR_compat_fstatfs64"))
88 @_SYSCALL_FSTATFS64_NAME
89 @_SYSCALL_FSTATFS64_REGARGS
90 @_SYSCALL_FSTATFS64_ARGSTR
91 },
92 {
93 @_SYSCALL_FSTATFS64_REGARGS_STORE
94 }
95
96 probe nd_syscall.fstatfs64.return = nd1_syscall.fstatfs64.return!, nd2_syscall.fstatfs64.return!, tp_syscall.fstatfs64.return
97 { }
98
99 probe nd1_syscall.fstatfs64.return =
100 kprobe.function("sys_fstatfs64").return ?,
101 kprobe.function("compat_sys_fstatfs64").return ?
102 {
103 @_SYSCALL_FSTATFS64_NAME
104 @SYSC_RETVALSTR(returnval())
105 }
106
107 /* kernel 4.17+ */
108 probe nd2_syscall.fstatfs64.return =
109 kprobe.function(@arch_syscall_prefix "compat_sys_fstatfs64").return ?
110 {
111 @_SYSCALL_FSTATFS64_NAME
112 @SYSC_RETVALSTR(returnval())
113 }
114
115 /* kernel 3.5+, but undesirable because it affects all syscalls */
116 probe tp_syscall.fstatfs64.return = kernel.trace("sys_exit")
117 {
118 __set_syscall_pt_regs($regs)
119 @__syscall_compat_gate(@const("__NR_fstatfs64"), @const("__NR_compat_fstatfs64"))
120 @_SYSCALL_FSTATFS64_NAME
121 @SYSC_RETVALSTR($ret)
122 }