1 #!/bin/sh 2 3 SRC_TREE=../../../../ 4 5 test_run() 6 { 7 sysctl -w net.core.bpf_jit_enable=$1 2>&1 > /dev/null 8 sysctl -w net.core.bpf_jit_harden=$2 2>&1 > /dev/null 9 10 echo "[ JIT enabled:$1 hardened:$2 ]" 11 dmesg -C 12 insmod $SRC_TREE/lib/test_bpf.ko 2> /dev/null 13 if [ $? -ne 0 ]; then 14 rc=1 15 fi 16 rmmod test_bpf 2> /dev/null 17 dmesg | grep FAIL 18 } 19 20 test_save() 21 { 22 JE=`sysctl -n net.core.bpf_jit_enable` 23 JH=`sysctl -n net.core.bpf_jit_harden` 24 } 25 26 test_restore() 27 { 28 sysctl -w net.core.bpf_jit_enable=$JE 2>&1 > /dev/null 29 sysctl -w net.core.bpf_jit_harden=$JH 2>&1 > /dev/null 30 } 31 32 rc=0 33 test_save 34 test_run 0 0 35 test_run 1 0 36 test_run 1 1 37 test_run 1 2 38 test_restore 39 exit $rc 40