Debian Codegraph @

tapset/linux/sysc_fstatfs.stp

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