chengshan / rpms / kernel

Forked from rpms/kernel 2 years ago
Clone
Blob Blame History Raw
--- a/kernel/bpf/verifier.c	2019-07-18 12:58:03.000000000 -0700
+++ b/kernel/bpf/verifier.c	2019-08-08 00:02:32.950185142 -0700
@@ -5555,7 +5555,9 @@ static int jit_subprogs(struct bpf_verif
 		func[i]->aux->name[0] = 'F';
 		func[i]->aux->stack_depth = env->subprog_info[i].stack_depth;
 		func[i]->jit_requested = 1;
+#ifdef CONFIG_BPF_JIT
 		func[i] = trace_bpf_int_jit_compile(func[i]);
+#endif
 		if (!func[i]->jited) {
 			err = -ENOTSUPP;
 			goto out_free;
@@ -5594,7 +5596,11 @@ static int jit_subprogs(struct bpf_verif
 	}
 	for (i = 0; i < env->subprog_cnt; i++) {
 		old_bpf_func = func[i]->bpf_func;
+#ifdef CONFIG_BPF_JIT
 		tmp = trace_bpf_int_jit_compile(func[i]);
+#else
+		tmp = func[i];
+#endif
 		if (tmp != func[i] || func[i]->bpf_func != old_bpf_func) {
 			verbose(env, "JIT doesn't support bpf-to-bpf calls\n");
 			err = -ENOTSUPP;
@@ -5632,7 +5638,9 @@ static int jit_subprogs(struct bpf_verif
 out_free:
 	for (i = 0; i < env->subprog_cnt; i++)
 		if (func[i])
+#ifdef CONFIG_BPF_JIT
 			trace_bpf_jit_free(func[i]);
+#endif
 	kfree(func);
 out_undo_insn:
 	/* cleanup main prog to be interpreted */