2 # SPDX-License-Identifier: GPL-2.0
4 # Kselftest framework requirement - SKIP code is 4.
8 if [ "$(id -u)" != "0" ]; then
9 echo $msg please run this as root
>&2
13 if [ "$building_out_of_srctree" ]; then
14 # We are in linux-build/kselftest/bpf
17 # We are in linux/tools/testing/selftests/bpf
23 sysctl
-w net.core.bpf_jit_enable
=$1 2>&1 > /dev
/null
24 sysctl
-w net.core.bpf_jit_harden
=$2 2>&1 > /dev
/null
26 echo "[ JIT enabled:$1 hardened:$2 ]"
28 if [ -f ${OUTPUT}/lib
/test_bpf.ko
]; then
29 insmod
${OUTPUT}/lib
/test_bpf.ko
2> /dev
/null
34 # Use modprobe dry run to check for missing test_bpf module
35 if ! /sbin
/modprobe
-q -n test_bpf
; then
36 echo "test_bpf: [SKIP]"
37 elif /sbin
/modprobe
-q test_bpf
; then
40 echo "test_bpf: [FAIL]"
44 rmmod test_bpf
2> /dev
/null
50 JE
=`sysctl -n net.core.bpf_jit_enable`
51 JH
=`sysctl -n net.core.bpf_jit_harden`
56 sysctl
-w net.core.bpf_jit_enable
=$JE 2>&1 > /dev
/null
57 sysctl
-w net.core.bpf_jit_harden
=$JH 2>&1 > /dev
/null