| 1 |
# set_robust_list ____________________________________________ |
| 2 |
# SYSCALL_DEFINE2(set_robust_list, struct robust_list_head __user *, head, |
| 3 |
# size_t, len) |
| 4 |
# COMPAT_SYSCALL_DEFINE2(set_robust_list, |
| 5 |
# struct compat_robust_list_head __user *, head, |
| 6 |
# compat_size_t, len) |
| 7 |
|
| 8 |
@define _SYSCALL_SET_ROBUST_LIST_NAME |
| 9 |
%( |
| 10 |
name = "set_robust_list" |
| 11 |
%) |
| 12 |
|
| 13 |
@define _SYSCALL_SET_ROBUST_LIST_ARGSTR |
| 14 |
%( |
| 15 |
argstr = sprintf("%p, %u", list_head_uaddr, len) |
| 16 |
%) |
| 17 |
|
| 18 |
@define _SYSCALL_SET_ROBUST_LIST_REGARGS |
| 19 |
%( |
| 20 |
list_head_uaddr = pointer_arg(1) |
| 21 |
len = ulong_arg(2) |
| 22 |
%) |
| 23 |
|
| 24 |
@define _SYSCALL_SET_ROBUST_LIST_REGARGS_STORE |
| 25 |
%( |
| 26 |
if (@probewrite(list_head_uaddr)) |
| 27 |
set_pointer_arg(1, list_head_uaddr) |
| 28 |
|
| 29 |
if (@probewrite(len)) |
| 30 |
set_ulong_arg(2, len) |
| 31 |
%) |
| 32 |
|
| 33 |
probe syscall.set_robust_list = dw_syscall.set_robust_list !, |
| 34 |
nd_syscall.set_robust_list ? {} |
| 35 |
probe syscall.set_robust_list.return = dw_syscall.set_robust_list.return !, |
| 36 |
nd_syscall.set_robust_list.return ? {} |
| 37 |
|
| 38 |
# dw_set_robust_list _____________________________________________________ |
| 39 |
|
| 40 |
probe dw_syscall.set_robust_list = __syscall.set_robust_list ?, |
| 41 |
kernel.function("compat_sys_set_robust_list") ? |
| 42 |
{ |
| 43 |
@_SYSCALL_SET_ROBUST_LIST_NAME |
| 44 |
list_head_uaddr = @__pointer($head) |
| 45 |
len = @__compat_ulong($len) |
| 46 |
@_SYSCALL_SET_ROBUST_LIST_ARGSTR |
| 47 |
} |
| 48 |
probe __syscall.set_robust_list = kernel.function("sys_set_robust_list") |
| 49 |
{ |
| 50 |
@__syscall_gate_compat_simple |
| 51 |
} |
| 52 |
probe dw_syscall.set_robust_list.return = __syscall.set_robust_list.return ?, |
| 53 |
kernel.function("compat_sys_set_robust_list").return ? |
| 54 |
{ |
| 55 |
@_SYSCALL_SET_ROBUST_LIST_NAME |
| 56 |
@SYSC_RETVALSTR($return) |
| 57 |
} |
| 58 |
probe __syscall.set_robust_list.return = |
| 59 |
kernel.function("sys_set_robust_list").return |
| 60 |
{ |
| 61 |
@__syscall_gate_compat_simple |
| 62 |
} |
| 63 |
|
| 64 |
# nd_set_robust_list _____________________________________________________ |
| 65 |
|
| 66 |
probe nd_syscall.set_robust_list = nd1_syscall.set_robust_list!, nd2_syscall.set_robust_list!, tp_syscall.set_robust_list |
| 67 |
{ } |
| 68 |
|
| 69 |
probe nd1_syscall.set_robust_list = |
| 70 |
__nd1_syscall.set_robust_list ?, |
| 71 |
kprobe.function("compat_sys_set_robust_list") ? |
| 72 |
{ |
| 73 |
@_SYSCALL_SET_ROBUST_LIST_NAME |
| 74 |
asmlinkage() |
| 75 |
@_SYSCALL_SET_ROBUST_LIST_REGARGS |
| 76 |
@_SYSCALL_SET_ROBUST_LIST_ARGSTR |
| 77 |
} |
| 78 |
probe __nd1_syscall.set_robust_list = kprobe.function("sys_set_robust_list") |
| 79 |
{ |
| 80 |
@__syscall_gate_compat_simple |
| 81 |
} |
| 82 |
|
| 83 |
/* kernel 4.17+ */ |
| 84 |
probe nd2_syscall.set_robust_list = |
| 85 |
kprobe.function(@arch_syscall_prefix "sys_set_robust_list") ?, |
| 86 |
kprobe.function(@arch_syscall_prefix "compat_sys_set_robust_list") ? |
| 87 |
{ |
| 88 |
__set_syscall_pt_regs(pointer_arg(1)) |
| 89 |
@_SYSCALL_SET_ROBUST_LIST_NAME |
| 90 |
@_SYSCALL_SET_ROBUST_LIST_REGARGS |
| 91 |
@_SYSCALL_SET_ROBUST_LIST_ARGSTR |
| 92 |
}, |
| 93 |
{ |
| 94 |
%( @_IS_SREG_KERNEL %? @_SYSCALL_SET_ROBUST_LIST_REGARGS_STORE %) |
| 95 |
} |
| 96 |
|
| 97 |
/* kernel 3.5+, but undesirable because it affects all syscalls */ |
| 98 |
probe tp_syscall.set_robust_list = kernel.trace("sys_enter") |
| 99 |
{ |
| 100 |
__set_syscall_pt_regs($regs) |
| 101 |
@__syscall_compat_gate(@const("__NR_set_robust_list"), @const("__NR_compat_set_robust_list")) |
| 102 |
@_SYSCALL_SET_ROBUST_LIST_NAME |
| 103 |
@_SYSCALL_SET_ROBUST_LIST_REGARGS |
| 104 |
@_SYSCALL_SET_ROBUST_LIST_ARGSTR |
| 105 |
}, |
| 106 |
{ |
| 107 |
%( @_IS_SREG_KERNEL %? @_SYSCALL_SET_ROBUST_LIST_REGARGS_STORE %) |
| 108 |
} |
| 109 |
|
| 110 |
probe nd_syscall.set_robust_list.return = nd1_syscall.set_robust_list.return!, nd2_syscall.set_robust_list.return!, tp_syscall.set_robust_list.return |
| 111 |
{ } |
| 112 |
|
| 113 |
probe nd1_syscall.set_robust_list.return = |
| 114 |
__nd1_syscall.set_robust_list.return ?, |
| 115 |
kprobe.function("compat_sys_set_robust_list").return ? |
| 116 |
{ |
| 117 |
@_SYSCALL_SET_ROBUST_LIST_NAME |
| 118 |
@SYSC_RETVALSTR(returnval()) |
| 119 |
} |
| 120 |
probe __nd1_syscall.set_robust_list.return = |
| 121 |
kprobe.function("sys_set_robust_list").return |
| 122 |
{ |
| 123 |
@__syscall_gate_compat_simple |
| 124 |
} |
| 125 |
|
| 126 |
/* kernel 4.17+ */ |
| 127 |
probe nd2_syscall.set_robust_list.return = |
| 128 |
kprobe.function(@arch_syscall_prefix "sys_set_robust_list").return ?, |
| 129 |
kprobe.function(@arch_syscall_prefix "compat_sys_set_robust_list").return ? |
| 130 |
{ |
| 131 |
@_SYSCALL_SET_ROBUST_LIST_NAME |
| 132 |
@SYSC_RETVALSTR(returnval()) |
| 133 |
} |
| 134 |
|
| 135 |
/* kernel 3.5+, but undesirable because it affects all syscalls */ |
| 136 |
probe tp_syscall.set_robust_list.return = kernel.trace("sys_exit") |
| 137 |
{ |
| 138 |
__set_syscall_pt_regs($regs) |
| 139 |
@__syscall_compat_gate(@const("__NR_set_robust_list"), @const("__NR_compat_set_robust_list")) |
| 140 |
@_SYSCALL_SET_ROBUST_LIST_NAME |
| 141 |
@SYSC_RETVALSTR($ret) |
| 142 |
} |