2 # SPDX-License-Identifier: GPL-2.0
3 # description: Kprobe event argument syntax
4 # requires: kprobe_events "x8/16/32/64":README
10 if ! grep -qw ${GOODSYM} /proc
/kallsyms
; then
14 SYMADDR
=0x
`grep -w ${GOODSYM} /proc/kallsyms | cut -f 1 -d " "`
36 echo "Please implement other architecture here"
40 test_goodarg
() # Good-args
43 echo "p ${PROBEFUNC} $1" > kprobe_events
48 test_badarg
() # Bad-args
51 ! echo "p ${PROBEFUNC} $1" > kprobe_events
59 test_goodarg
${GOODREG}
63 test_goodarg
"@${GOODSYM}" "@${SYMADDR}" "@${GOODSYM}+10" "@${GOODSYM}-10"
64 test_badarg
"@" "@${BADSYM}" "@${GOODSYM}*10" "@${GOODSYM}/10" \
65 "@${GOODSYM}%10" "@${GOODSYM}&10" "@${GOODSYM}|10"
68 test_goodarg
"\$stack" "\$stack0" "\$stack1"
69 test_badarg
"\$stackp" "\$stack0+10" "\$stack1-10"
72 echo "r ${PROBEFUNC} \$retval" > kprobe_events
73 ! echo "p ${PROBEFUNC} \$retval" > kprobe_events
75 # $comm was introduced in 4.8, older kernels reject it.
76 if grep -A1 "fetcharg:" README |
grep -q '\$comm' ; then
81 : "Indirect memory access"
82 test_goodarg
"+0(${GOODREG})" "-0(${GOODREG})" "+10(\$stack)" \
83 "+0(\$stack1)" "+10(@${GOODSYM}-10)" "+0(+10(+20(\$stack)))"
84 test_badarg
"+(${GOODREG})" "(${GOODREG}+10)" "-(${GOODREG})" "(${GOODREG})" \
85 "+10(\$comm)" "+0(${GOODREG})+10"
88 test_goodarg
"varname=${GOODREG}"
89 test_badarg
"varname=varname2=${GOODREG}"
92 test_goodarg
"${GOODREG}:${GOODTYPE}"
93 test_badarg
"${GOODREG}::${GOODTYPE}" "${GOODREG}:${BADTYPE}" \
94 "${GOODTYPE}:${GOODREG}"
98 test_goodarg
"\$comm:string" "+0(\$stack):string"
99 test_badarg
"\$comm:x64" "\$stack:string" "${GOODREG}:string"