2 # SPDX-License-Identifier: GPL-2.0
3 # description: Kprobe event parser error log check
5 [ -f kprobe_events
] || exit_unsupported
# this is configurable
7 [ -f error_log
] || exit_unsupported
9 check_error
() { # command-with-error-pos-by-^
10 ftrace_errlog_check
'trace_kprobe' "$1" 'kprobe_events'
13 if grep -q 'r\[maxactive\]' README
; then
14 check_error
'p^100 vfs_read' # MAXACT_NO_KPROBE
15 check_error
'r^1a111 vfs_read' # BAD_MAXACT
16 check_error
'r^100000 vfs_read' # MAXACT_TOO_BIG
19 check_error
'p ^non_exist_func' # BAD_PROBE_ADDR (enoent)
20 check_error
'p ^hoge-fuga' # BAD_PROBE_ADDR (bad syntax)
21 check_error
'p ^hoge+1000-1000' # BAD_PROBE_ADDR (bad syntax)
22 check_error
'r ^vfs_read+10' # BAD_RETPROBE
23 check_error
'p:^/bar vfs_read' # NO_GROUP_NAME
24 check_error
'p:^12345678901234567890123456789012345678901234567890123456789012345/bar vfs_read' # GROUP_TOO_LONG
26 check_error
'p:^foo.1/bar vfs_read' # BAD_GROUP_NAME
27 check_error
'p:foo/^ vfs_read' # NO_EVENT_NAME
28 check_error
'p:foo/^12345678901234567890123456789012345678901234567890123456789012345 vfs_read' # EVENT_TOO_LONG
29 check_error
'p:foo/^bar.1 vfs_read' # BAD_EVENT_NAME
31 check_error
'p vfs_read ^$retval' # RETVAL_ON_PROBE
32 check_error
'p vfs_read ^$stack10000' # BAD_STACK_NUM
34 if grep -q '$arg<N>' README
; then
35 check_error
'p vfs_read ^$arg10000' # BAD_ARG_NUM
38 check_error
'p vfs_read ^$none_var' # BAD_VAR
40 check_error
'p vfs_read ^%none_reg' # BAD_REG_NAME
41 check_error
'p vfs_read ^@12345678abcde' # BAD_MEM_ADDR
42 check_error
'p vfs_read ^@+10' # FILE_ON_KPROBE
44 check_error
'p vfs_read ^+0@0)' # DEREF_NEED_BRACE
45 check_error
'p vfs_read ^+0ab1(@0)' # BAD_DEREF_OFFS
46 check_error
'p vfs_read +0(+0(@0^)' # DEREF_OPEN_BRACE
48 if grep -A1 "fetcharg:" README |
grep -q '\$comm' ; then
49 check_error
'p vfs_read +0(^$comm)' # COMM_CANT_DEREF
52 check_error
'p vfs_read ^&1' # BAD_FETCH_ARG
55 # We've introduced this limitation with array support
56 if grep -q ' <type>\\\[<array-size>\\\]' README
; then
57 check_error
'p vfs_read +0(^+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(@0))))))))))))))' # TOO_MANY_OPS?
58 check_error
'p vfs_read +0(@11):u8[10^' # ARRAY_NO_CLOSE
59 check_error
'p vfs_read +0(@11):u8[10]^a' # BAD_ARRAY_SUFFIX
60 check_error
'p vfs_read +0(@11):u8[^10a]' # BAD_ARRAY_NUM
61 check_error
'p vfs_read +0(@11):u8[^256]' # ARRAY_TOO_BIG
64 check_error
'p vfs_read @11:^unknown_type' # BAD_TYPE
65 check_error
'p vfs_read $stack0:^string' # BAD_STRING
66 check_error
'p vfs_read @11:^b10@a/16' # BAD_BITFIELD
68 check_error
'p vfs_read ^arg123456789012345678901234567890=@11' # ARG_NAME_TOO_LOG
69 check_error
'p vfs_read ^=@11' # NO_ARG_NAME
70 check_error
'p vfs_read ^var.1=@11' # BAD_ARG_NAME
71 check_error
'p vfs_read var1=@11 ^var1=@12' # USED_ARG_NAME
72 check_error
'p vfs_read ^+1234567(+1234567(+1234567(+1234567(+1234567(+1234567(@1234))))))' # ARG_TOO_LONG
73 check_error
'p vfs_read arg1=^' # NO_ARG_BODY
75 # instruction boundary check is valid on x86 (at this moment)
78 echo 'p vfs_read' > kprobe_events
79 if grep -q FTRACE ..
/kprobes
/list
; then
80 check_error
'p ^vfs_read+3' # BAD_INSN_BNDRY (only if function-tracer is enabled)