fanghuilin / rpms / kernel

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