summaryrefslogtreecommitdiff
path: root/test-uderef.sh
blob: 19df2ede89aba7d219820afa45160fc92483bc18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#! /bin/bash

# Test for uderef.  Since a successful test will kill the shell, we
# need to communicate via the filesystem whether the test worked or
# not.
echo 'Directory for test-uderef.sh'
pwd

# If the feature is not compiled into the kernel, fail right away.
if [ ! -f /sys/kernel/debug/provoke-crash/DIRECT ]; then
	echo "Kernel was not compiled with CONFIG_LKDTM"
	echo "Not possible to test for UDEREF, failing"
	echo "test: uderef: fail"
fi

# Put a marker file that we can check later.
touch /tmp/uderef-6256ff7e

cat /sys/kernel/debug/provoke-crash/DIRECT

# If we got this far, we were not killed by the UDEREF blocks in the
# kernel, which means we should go ahead and fail.
rm /tmp/uderef-6256ff7e
echo "Shell was not killed by uderef"
echo "test: uderef: fail"