imperfectism / rpms / kernel

Forked from rpms/kernel 4 years ago
Clone
e293be
diff -up ./kernel/bpf/verifier.c.jit ./kernel/bpf/verifier.c
e293be
--- ./kernel/bpf/verifier.c.jit	2018-10-05 05:18:19.000000000 +0900
e293be
+++ ./kernel/bpf/verifier.c	2018-10-30 23:32:29.000000000 +0900
e293be
@@ -5312,7 +5312,9 @@ static int jit_subprogs(struct bpf_verif
e293be
 		func[i]->aux->name[0] = 'F';
e293be
 		func[i]->aux->stack_depth = env->subprog_stack_depth[i];
e293be
 		func[i]->jit_requested = 1;
e293be
+#ifdef CONFIG_BPF_JIT
e293be
 		func[i] = trace_bpf_int_jit_compile(func[i]);
e293be
+#endif
e293be
 		if (!func[i]->jited) {
e293be
 			err = -ENOTSUPP;
e293be
 			goto out_free;
e293be
@@ -5338,7 +5340,11 @@ static int jit_subprogs(struct bpf_verif
e293be
 	}
e293be
 	for (i = 0; i <= env->subprog_cnt; i++) {
e293be
 		old_bpf_func = func[i]->bpf_func;
e293be
+#ifdef CONFIG_BPF_JIT
e293be
 		tmp = trace_bpf_int_jit_compile(func[i]);
e293be
+#else
e293be
+		tmp = func[i];
e293be
+#endif
e293be
 		if (tmp != func[i] || func[i]->bpf_func != old_bpf_func) {
e293be
 			verbose(env, "JIT doesn't support bpf-to-bpf calls\n");
e293be
 			err = -EFAULT;
e293be
@@ -5379,8 +5385,11 @@ static int jit_subprogs(struct bpf_verif
e293be
 	return 0;
e293be
 out_free:
e293be
 	for (i = 0; i <= env->subprog_cnt; i++)
e293be
-		if (func[i])
e293be
+		if (func[i]) {
e293be
+#ifdef CONFIG_BPF_JIT
e293be
 			trace_bpf_jit_free(func[i]);
e293be
+#endif
e293be
+		}
e293be
 	kfree(func);
e293be
 	/* cleanup main prog to be interpreted */
e293be
 	prog->jit_requested = 0;