-
-
Save eddyz87/e888ad70c947f28f94146a47e33cd378 to your computer and use it in GitHub Desktop.
test + dead code removal disabled
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c | |
index 1863826a4ac3..7c06e28c1e2f 100644 | |
--- a/kernel/bpf/verifier.c | |
+++ b/kernel/bpf/verifier.c | |
@@ -18337,6 +18337,8 @@ static int opt_remove_dead_code(struct bpf_verifier_env *env) | |
int insn_cnt = env->prog->len; | |
int i, err; | |
+ return 0; | |
+ | |
for (i = 0; i < insn_cnt; i++) { | |
int j; | |
diff --git a/tools/testing/selftests/bpf/progs/verifier_and.c b/tools/testing/selftests/bpf/progs/verifier_and.c | |
index e97e518516b6..3b258fc94d3c 100644 | |
--- a/tools/testing/selftests/bpf/progs/verifier_and.c | |
+++ b/tools/testing/selftests/bpf/progs/verifier_and.c | |
@@ -2,6 +2,7 @@ | |
/* Converted from tools/testing/selftests/bpf/verifier/and.c */ | |
#include <linux/bpf.h> | |
+#include "../../../include/linux/filter.h" | |
#include <bpf/bpf_helpers.h> | |
#include "bpf_misc.h" | |
@@ -104,4 +105,45 @@ l0_%=: r0 = 0; \ | |
: __clobber_all); | |
} | |
+SEC("socket") | |
+__success | |
+__retval(4) | |
+__naked void pruning_test(void) | |
+{ | |
+ asm volatile ( | |
+ /* 0 */ "r2 = 0x1a000000be ll;\n" | |
+ /* 2 */ "r5 = r1;\n" | |
+ /* 3 */ "r8 = r2;\n" | |
+ /* 4 */ "w4 = w5;\n" | |
+ /* 5 */ "call %[bpf_get_prandom_u32];\n" | |
+ /* 6 */ "if w8 >= 0x69 goto +1;\n" | |
+ /* 7 */ "exit;\n" | |
+ /* 8 */ "r4 = 0x52 ll;\n" | |
+ /* 10 */ "w4 = -w4;\n" | |
+ /* 11 */ ".8byte %[r0_jset];\n" /* if r0 & 0xfffffffe goto pc+3; */ | |
+ /* 12 */ "r8 -= r4;\n" | |
+ /* 13 */ "r0 += r0;\n" | |
+ /* 14 */ "r4 *= r4;\n" | |
+ /* 15 */ "r3 = 0x1f00000034 ll;\n" | |
+ /* 17 */ "w4 s>>= 29;\n" | |
+ /* 18 */ "if w8 != 0xf goto +3;\n" | |
+ /* 19 */ ".8byte %[bswap32_r3];\n" /* bswap32 r3; */ | |
+ /* 20 */ "r2 = 0x1c ll;\n" | |
+ /* 22 */ "r4 <<= 2;\n" | |
+ /* 23 */ "r5 = r8;\n" | |
+ /* 24 */ "r2 = 0x4 ll;\n" | |
+ /* 26 */ "if w8 s>= w0 goto +5;\n" | |
+ /* 27 */ "r8 |= r8;\n" | |
+ /* 28 */ "r8 += r8;\n" | |
+ /* 29 */ "if w5 s<= 0x1d goto +2;\n" | |
+ /* 30 */ "r0 = 0x4 ll;\n" | |
+ /* 32 */ "exit;\n" | |
+ : | |
+ : __imm(bpf_get_prandom_u32), | |
+ __imm_insn(r0_jset, BPF_JMP_IMM(BPF_JSET, BPF_REG_0, 0xfffffffe, 3)), | |
+ __imm_insn(bswap32_r3, BPF_RAW_INSN(BPF_ALU64 | BPF_TO_LE | BPF_END, | |
+ BPF_REG_3, 0, 0, 32)) | |
+ : __clobber_all); | |
+} | |
+ | |
char _license[] SEC("license") = "GPL"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment