1#!/bin/sh 2# SPDX-License-Identifier: GPL-2.0 3# description: Kretprobe dynamic event with maxactive 4 5[ -f kprobe_events ] || exit_unsupported # this is configurable 6grep -q 'r\[maxactive\]' README || exit_unsupported # this is older version 7 8echo > kprobe_events 9 10# Test if we successfully reject unknown messages 11if echo 'a:myprobeaccept inet_csk_accept' > kprobe_events; then false; else true; fi 12 13# Test if we successfully reject too big maxactive 14if echo 'r1000000:myprobeaccept inet_csk_accept' > kprobe_events; then false; else true; fi 15 16# Test if we successfully reject unparsable numbers for maxactive 17if echo 'r10fuzz:myprobeaccept inet_csk_accept' > kprobe_events; then false; else true; fi 18 19# Test for kretprobe with event name without maxactive 20echo 'r:myprobeaccept inet_csk_accept' > kprobe_events 21grep myprobeaccept kprobe_events 22test -d events/kprobes/myprobeaccept 23echo '-:myprobeaccept' >> kprobe_events 24 25# Test for kretprobe with event name with a small maxactive 26echo 'r10:myprobeaccept inet_csk_accept' > kprobe_events 27grep myprobeaccept kprobe_events 28test -d events/kprobes/myprobeaccept 29echo '-:myprobeaccept' >> kprobe_events 30 31# Test for kretprobe without event name without maxactive 32echo 'r inet_csk_accept' > kprobe_events 33grep inet_csk_accept kprobe_events 34echo > kprobe_events 35 36# Test for kretprobe without event name with a small maxactive 37echo 'r10 inet_csk_accept' > kprobe_events 38grep inet_csk_accept kprobe_events 39echo > kprobe_events 40 41clear_trace 42