1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0 3# description: Tracepoint probe event parser error log check 4# requires: dynamic_events "t[:[<group>/][<event>]] <tracepoint> [<args>]":README 5 6check_error() { # command-with-error-pos-by-^ 7 ftrace_errlog_check 'trace_fprobe' "$1" 'dynamic_events' 8} 9 10check_error 't^100 kfree' # BAD_MAXACT_TYPE 11 12check_error 't:^/bar kfree' # NO_GROUP_NAME 13check_error 't:^12345678901234567890123456789012345678901234567890123456789012345/bar kfree' # GROUP_TOO_LONG 14 15check_error 't:^foo.1/bar kfree' # BAD_GROUP_NAME 16check_error 't:^ kfree' # NO_EVENT_NAME 17check_error 't:foo/^12345678901234567890123456789012345678901234567890123456789012345 kfree' # EVENT_TOO_LONG 18check_error 't:foo/^bar.1 kfree' # BAD_EVENT_NAME 19 20check_error 't kfree ^$retval' # RETVAL_ON_PROBE 21check_error 't kfree ^$stack10000' # BAD_STACK_NUM 22 23check_error 't kfree ^$arg10000' # BAD_ARG_NUM 24 25check_error 't kfree ^$none_var' # BAD_VAR 26check_error 't kfree ^%rax' # BAD_VAR 27 28check_error 't kfree ^@12345678abcde' # BAD_MEM_ADDR 29check_error 't kfree ^@+10' # FILE_ON_KPROBE 30 31grep -q "imm-value" README && \ 32check_error 't kfree arg1=\^x' # BAD_IMM 33grep -q "imm-string" README && \ 34check_error 't kfree arg1=\"abcd^' # IMMSTR_NO_CLOSE 35 36check_error 't kfree ^+0@0)' # DEREF_NEED_BRACE 37check_error 't kfree ^+0ab1(@0)' # BAD_DEREF_OFFS 38check_error 't kfree +0(+0(@0^)' # DEREF_OPEN_BRACE 39 40if grep -A1 "fetcharg:" README | grep -q '\$comm' ; then 41check_error 't kfree +0(^$comm)' # COMM_CANT_DEREF 42fi 43 44check_error 't kfree ^&1' # BAD_FETCH_ARG 45 46 47# We've introduced this limitation with array support 48if grep -q ' <type>\\\[<array-size>\\\]' README; then 49check_error 't kfree +0(^+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(+0(@0))))))))))))))' # TOO_MANY_OPS? 50check_error 't kfree +0(@11):u8[10^' # ARRAY_NO_CLOSE 51check_error 't kfree +0(@11):u8[10]^a' # BAD_ARRAY_SUFFIX 52check_error 't kfree +0(@11):u8[^10a]' # BAD_ARRAY_NUM 53check_error 't kfree +0(@11):u8[^256]' # ARRAY_TOO_BIG 54fi 55 56check_error 't kfree @11:^unknown_type' # BAD_TYPE 57check_error 't kfree $stack0:^string' # BAD_STRING 58check_error 't kfree @11:^b10@a/16' # BAD_BITFIELD 59 60check_error 't kfree ^arg123456789012345678901234567890=@11' # ARG_NAME_TOO_LOG 61check_error 't kfree ^=@11' # NO_ARG_NAME 62check_error 't kfree ^var.1=@11' # BAD_ARG_NAME 63check_error 't kfree var1=@11 ^var1=@12' # USED_ARG_NAME 64check_error 't kfree ^+1234567(+1234567(+1234567(+1234567(+1234567(+1234567(@1234))))))' # ARG_TOO_LONG 65check_error 't kfree arg1=^' # NO_ARG_BODY 66 67 68# multiprobe errors 69if grep -q "Create/append/" README && grep -q "imm-value" README; then 70echo "t:tracepoint/testevent kfree" > dynamic_events 71check_error '^f:tracepoint/testevent kfree' # DIFF_PROBE_TYPE 72 73# Explicitly use printf "%s" to not interpret \1 74printf "%s" "t:tracepoints/testevent kfree abcd=\\1" > dynamic_events 75check_error "t:tracepoints/testevent kfree ^bcd=\\1" # DIFF_ARG_TYPE 76check_error "t:tracepoints/testevent kfree ^abcd=\\1:u8" # DIFF_ARG_TYPE 77check_error "t:tracepoints/testevent kfree ^abcd=\\\"foo\"" # DIFF_ARG_TYPE 78check_error "^t:tracepoints/testevent kfree abcd=\\1" # SAME_PROBE 79fi 80 81exit 0 82