Debian Codegraph @

tapset/linux/sysc_setpriority.stp

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