Debian Codegraph @

tapset/linux/s390/sysc_compat_fallocate.stp

raw
1 # fallocate __________________________________________________
2 #
3 # SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len)
4 # asmlinkage long sys32_fallocate(int fd, int mode, unsigned offset_lo,
5 # unsigned offset_hi, unsigned len_lo,
6 # unsigned len_hi)
7 #
8 # We've got a problem here on RHEL6 (2.6.32-504.el6.s390x) and RHEL7
9 # (3.10.0-229.el7.s390x). Normally we'd probe the "compat" version of
10 # the function here. However, on those kernels, the compat wrapper
11 # for fallocate (sys_fallocate_wrapper) is in assembly language, which
12 # stap can't find.
13 #
14 # So, we'll probe the "real" syscall here.
15
16 @define _SYSCALL_COMPAT_FALLOCATE_NAME
17 %(
18 name = "fallocate"
19 %)
20
21 @define _SYSCALL_COMPAT_FALLOCATE_ARGSTR
22 %(
23 argstr = sprintf("%d, %s, %#x, %u", fd, mode_str, offset, len)
24 %)
25
26 @define _SYSCALL_COMPAT_FALLOCATE_REGARGS
27 %(
28 fd = int_arg(1)
29 mode = int_arg(2)
30 # This logic is stolen from _stp_arg (in
31 # tapset/s390/registers.stp).
32 mode_str = _stp_fallocate_mode_str(mode)
33 offset = u_register("r4")
34 len = u_register("r5")
35 %)
36
37 probe syscall.compat_fallocate = dw_syscall.compat_fallocate !,
38 nd_syscall.compat_fallocate ? {}
39 probe syscall.compat_fallocate.return = dw_syscall.compat_fallocate.return !,
40 nd_syscall.compat_fallocate.return ? {}
41
42 # dw_compat_fallocate _____________________________________________________
43
44 probe dw_syscall.compat_fallocate = kernel.function("sys_fallocate").call ?
45 {
46 @__syscall_gate_noncompat_simple
47 @_SYSCALL_COMPAT_FALLOCATE_NAME
48 fd = __int32($fd)
49 mode = __uint32($mode)
50 mode_str = _stp_fallocate_mode_str(mode)
51 offset = $offset
52 len = $len
53 @_SYSCALL_COMPAT_FALLOCATE_ARGSTR
54 }
55 probe dw_syscall.compat_fallocate.return =
56 kernel.function("sys_fallocate").return ?
57 {
58 @__syscall_gate_noncompat_simple
59 @_SYSCALL_COMPAT_FALLOCATE_NAME
60 @SYSC_RETVALSTR(returnval())
61 }
62
63 # nd_compat_fallocate _____________________________________________________
64
65 probe nd_syscall.compat_fallocate = nd1_syscall.compat_fallocate!, tp_syscall.compat_fallocate
66 { }
67
68 probe nd1_syscall.compat_fallocate = kprobe.function("sys_fallocate") ?
69 {
70 @__syscall_gate_noncompat_simple
71 asmlinkage()
72 @_SYSCALL_COMPAT_FALLOCATE_NAME
73 @_SYSCALL_COMPAT_FALLOCATE_REGARGS
74 @_SYSCALL_COMPAT_FALLOCATE_ARGSTR
75 }
76
77 /* kernel 3.5+, but undesirable because it affects all syscalls */
78 probe tp_syscall.compat_fallocate = kernel.trace("sys_enter")
79 {
80 __set_syscall_pt_regs($regs)
81 @__compat_syscall_gate(@const("__NR_fallocate"))
82 @_SYSCALL_COMPAT_FALLOCATE_NAME
83 @_SYSCALL_COMPAT_FALLOCATE_REGARGS
84 @_SYSCALL_COMPAT_FALLOCATE_ARGSTR
85 }
86
87 probe nd_syscall.compat_fallocate.return = nd1_syscall.compat_fallocate.return!, tp_syscall.compat_fallocate.return
88 { }
89
90 probe nd1_syscall.compat_fallocate.return =
91 kprobe.function("sys_fallocate").return ?
92 {
93 @__syscall_gate_noncompat_simple
94 @_SYSCALL_COMPAT_FALLOCATE_NAME
95 @SYSC_RETVALSTR(returnval())
96 }
97
98 /* kernel 3.5+, but undesirable because it affects all syscalls */
99 probe tp_syscall.compat_fallocate.return = kernel.trace("sys_exit")
100 {
101 __set_syscall_pt_regs($regs)
102 @__compat_syscall_gate(@const("__NR_fallocate"))
103 @_SYSCALL_COMPAT_FALLOCATE_NAME
104 @SYSC_RETVALSTR($ret)
105 }