Debian Codegraph @

tapset/linux/sysc_fchown16.stp

raw
1 # fchown16 ___________________________________________________
2 # long sys_fchown16(unsigned int fd, old_uid_t user, old_gid_t group)
3
4 @define _SYSCALL_FCHOWN16_NAME
5 %(
6 name = "fchown16"
7 %)
8
9 @define _SYSCALL_FCHOWN16_ARGSTR
10 %(
11 argstr = sprintf("%d, %d, %d", fd, owner, group)
12 %)
13
14 @define _SYSCALL_FCHOWN16_REGARGS
15 %(
16 fd = int_arg(1)
17 owner = __short(uint_arg(2))
18 group = __short(uint_arg(3))
19 %)
20
21 @define _SYSCALL_FCHOWN16_REGARGS_STORE
22 %(
23 if (@probewrite(fd))
24 set_int_arg(1, fd)
25
26 if (@probewrite(owner))
27 set_uint_arg(2, __short(owner))
28
29 if (@probewrite(group))
30 set_uint_arg(3, __short(group))
31 %)
32
33 probe syscall.fchown16 = dw_syscall.fchown16 !, nd_syscall.fchown16 ? {}
34 probe syscall.fchown16.return = dw_syscall.fchown16.return !, nd_syscall.fchown16.return ? {}
35
36 # dw_fchown16 _____________________________________________________
37
38 probe dw_syscall.fchown16 = kernel.function("sys_fchown16").call ?
39 {
40 @_SYSCALL_FCHOWN16_NAME
41 fd = $fd
42 owner = __short($user)
43 group = __short($group)
44 @_SYSCALL_FCHOWN16_ARGSTR
45 }
46 probe dw_syscall.fchown16.return = kernel.function("sys_fchown16").return ?
47 {
48 @_SYSCALL_FCHOWN16_NAME
49 @SYSC_RETVALSTR($return)
50 }
51
52 # nd_fchown16 _____________________________________________________
53
54 probe nd_syscall.fchown16 = nd1_syscall.fchown16!, nd2_syscall.fchown16!, tp_syscall.fchown16
55 { }
56
57 probe nd1_syscall.fchown16 = kprobe.function("sys_fchown16") ?
58 {
59 @_SYSCALL_FCHOWN16_NAME
60 asmlinkage()
61 @_SYSCALL_FCHOWN16_REGARGS
62 @_SYSCALL_FCHOWN16_ARGSTR
63 }
64
65 /* kernel 4.17+ */
66 probe nd2_syscall.fchown16 = kprobe.function(@arch_syscall_prefix "sys_fchown16") ?
67 {
68 __set_syscall_pt_regs(pointer_arg(1))
69 @_SYSCALL_FCHOWN16_NAME
70 @_SYSCALL_FCHOWN16_REGARGS
71 @_SYSCALL_FCHOWN16_ARGSTR
72 },
73 {
74 %( @_IS_SREG_KERNEL %? @_SYSCALL_FCHOWN16_REGARGS_STORE %)
75 }
76
77 /* kernel 3.5+, but undesirable because it affects all syscalls */
78 probe tp_syscall.fchown16 = kernel.trace("sys_enter")
79 {
80 __set_syscall_pt_regs($regs)
81 %( CONFIG_64BIT == "y" %?
82 @__compat_syscall_gate(@const("__NR_compat_fchown"))
83 %:
84 @__syscall_gate(@const("__NR_fchown"))
85 %)
86 @_SYSCALL_FCHOWN16_NAME
87 @_SYSCALL_FCHOWN16_REGARGS
88 @_SYSCALL_FCHOWN16_ARGSTR
89 },
90 {
91 %( @_IS_SREG_KERNEL %? @_SYSCALL_FCHOWN16_REGARGS_STORE %)
92 }
93
94 probe nd_syscall.fchown16.return = nd1_syscall.fchown16.return!, nd2_syscall.fchown16.return!, tp_syscall.fchown16.return
95 { }
96
97 probe nd1_syscall.fchown16.return = kprobe.function("sys_fchown16").return ?
98 {
99 @_SYSCALL_FCHOWN16_NAME
100 @SYSC_RETVALSTR(returnval())
101 }
102
103 /* kernel 4.17+ */
104 probe nd2_syscall.fchown16.return = kprobe.function(@arch_syscall_prefix "sys_fchown16").return ?
105 {
106 @_SYSCALL_FCHOWN16_NAME
107 @SYSC_RETVALSTR(returnval())
108 }
109
110 /* kernel 3.5+, but undesirable because it affects all syscalls */
111 probe tp_syscall.fchown16.return = kernel.trace("sys_exit")
112 {
113 __set_syscall_pt_regs($regs)
114 %( CONFIG_64BIT == "y" %?
115 @__compat_syscall_gate(@const("__NR_compat_fchown"))
116 %:
117 @__syscall_gate(@const("__NR_fchown"))
118 %)
119 @_SYSCALL_FCHOWN16_NAME
120 @SYSC_RETVALSTR($ret)
121 }