Debian Codegraph @

tapset/linux/sysc_sched_setparam.stp

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