File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
tools/testing/selftests/lkdtm Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 4
4
# Measure kernel stack entropy by sampling via LKDTM's REPORT_STACK test.
5
5
set -e
6
6
samples=" ${1:- 1000} "
7
+ TRIGGER=/sys/kernel/debug/provoke-crash/DIRECT
8
+ KSELFTEST_SKIP_TEST=4
9
+
10
+ # Verify we have LKDTM available in the kernel.
11
+ if [ ! -r $TRIGGER ] ; then
12
+ /sbin/modprobe -q lkdtm || true
13
+ if [ ! -r $TRIGGER ] ; then
14
+ echo " Cannot find $TRIGGER (missing CONFIG_LKDTM?)"
15
+ else
16
+ echo " Cannot write $TRIGGER (need to run as root?)"
17
+ fi
18
+ # Skip this test
19
+ exit $KSELFTEST_SKIP_TEST
20
+ fi
7
21
8
22
# Capture dmesg continuously since it may fill up depending on sample size.
9
23
log=$( mktemp -t stack-entropy-XXXXXX)
10
24
dmesg --follow > " $log " & pid=$!
11
25
report=-1
12
26
for i in $( seq 1 $samples ) ; do
13
- echo " REPORT_STACK" > /sys/kernel/debug/provoke-crash/DIRECT
27
+ echo " REPORT_STACK" > $TRIGGER
14
28
if [ -t 1 ]; then
15
29
percent=$(( 100 * $i / $samples ))
16
30
if [ " $percent " -ne " $report " ]; then
You can’t perform that action at this time.
0 commit comments