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 " "`
52 echo "Please implement other architecture here"
56 test_goodarg
() # Good-args
59 echo "p ${PROBEFUNC} $1" > kprobe_events
64 test_badarg
() # Bad-args
67 ! echo "p ${PROBEFUNC} $1" > kprobe_events
75 test_goodarg
${GOODREG}
79 test_goodarg
"@${GOODSYM}" "@${SYMADDR}" "@${GOODSYM}+10" "@${GOODSYM}-10"
80 test_badarg
"@" "@${BADSYM}" "@${GOODSYM}*10" "@${GOODSYM}/10" \
81 "@${GOODSYM}%10" "@${GOODSYM}&10" "@${GOODSYM}|10"
84 test_goodarg
"\$stack" "\$stack0" "\$stack1"
85 test_badarg
"\$stackp" "\$stack0+10" "\$stack1-10"
88 echo "r ${PROBEFUNC} \$retval" > kprobe_events
89 ! echo "p ${PROBEFUNC} \$retval" > kprobe_events
91 # $comm was introduced in 4.8, older kernels reject it.
92 if grep -A1 "fetcharg:" README |
grep -q '\$comm' ; then
97 : "Indirect memory access"
98 test_goodarg
"+0(${GOODREG})" "-0(${GOODREG})" "+10(\$stack)" \
99 "+0(\$stack1)" "+10(@${GOODSYM}-10)" "+0(+10(+20(\$stack)))"
100 test_badarg
"+(${GOODREG})" "(${GOODREG}+10)" "-(${GOODREG})" "(${GOODREG})" \
101 "+10(\$comm)" "+0(${GOODREG})+10"
104 test_goodarg
"varname=${GOODREG}"
105 test_badarg
"varname=varname2=${GOODREG}"
108 test_goodarg
"${GOODREG}:${GOODTYPE}"
109 test_badarg
"${GOODREG}::${GOODTYPE}" "${GOODREG}:${BADTYPE}" \
110 "${GOODTYPE}:${GOODREG}"
112 : "Combination check"
114 test_goodarg
"\$comm:string" "+0(\$stack):string"
115 test_badarg
"\$comm:x64" "\$stack:string" "${GOODREG}:string"