Debian Codegraph @

tapset/linux/sysc_getpriority.stp

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