mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-09-06 21:14:18 +00:00

Commitcad6967ac1
("fork: introduce kernel_clone()") replaced "_do_fork()" with "kernel_clone()". The ftrace selftests reference the fork function in several of the tests. The rename will make the tests break, but if those names are changed in the tests, they would then break on older kernels. The same set of tests should pass older kernels if they have previously passed. Obviously, a new test may not work on older kernels if the test was added due to a bug or a new feature. The setup of ftracetest will now create a $FUNCTION_FORK bash variable that will contain "_do_fork" for older kernels and "kernel_clone" for newer ones. It figures out the proper name by examining /proc/kallsyms. Note, available_filter_functions could also be used, but because some tests should be able to pass without function tracing enabled, it could not be used. Fixes:eea11285da
("tracing: switch to kernel_clone()") Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Acked-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
33 lines
882 B
Bash
33 lines
882 B
Bash
#!/bin/sh
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
# description: Create/delete multiprobe on kprobe event
|
|
# requires: kprobe_events "Create/append/":README
|
|
|
|
# Choose 2 symbols for target
|
|
SYM1=$FUNCTION_FORK
|
|
SYM2=do_exit
|
|
EVENT_NAME=kprobes/testevent
|
|
|
|
DEF1="p:$EVENT_NAME $SYM1"
|
|
DEF2="p:$EVENT_NAME $SYM2"
|
|
|
|
:;: "Define an event which has 2 probes" ;:
|
|
echo $DEF1 >> kprobe_events
|
|
echo $DEF2 >> kprobe_events
|
|
cat kprobe_events | grep "$DEF1"
|
|
cat kprobe_events | grep "$DEF2"
|
|
|
|
:;: "Remove the event by name (should remove both)" ;:
|
|
echo "-:$EVENT_NAME" >> kprobe_events
|
|
test `cat kprobe_events | wc -l` -eq 0
|
|
|
|
:;: "Remove just 1 event" ;:
|
|
echo $DEF1 >> kprobe_events
|
|
echo $DEF2 >> kprobe_events
|
|
echo "-:$EVENT_NAME $SYM1" >> kprobe_events
|
|
! cat kprobe_events | grep "$DEF1"
|
|
cat kprobe_events | grep "$DEF2"
|
|
|
|
:;: "Appending different type must fail" ;:
|
|
! echo "$DEF1 \$stack" >> kprobe_events
|