[SRU][R][PATCH 1/1] UBUNTU: SAUCE: Revert "bpf: Verifier support for sleepable tracepoint programs"

Alice C. Munduruca alice.munduruca at canonical.com
Tue Sep 1 16:18:27 UTC 2026


BugLink: https://bugs.launchpad.net/bugs/2165872

This reverts commit 2946e2f49e86d17c3b2fc8ba57de4b39dd5b58f4.

This commit was picked up by upstream stable linux-7.1.y in order to
simplify the cherry-pick for commit 5b038319be44 ("bpf: Reject sleepable
BPF_LSM_CGROUP programs at load time"), however the other patches in the
series, which are required for a non-regressing bpf subsystem, were not
also added. As a result, remove this superfluous breaking change and
simply retain the changes for rejetcting sleepable BPF_LSM_CGROUP
programs.

Signed-off-by: Alice C. Munduruca <alice.munduruca at canonical.com>
---
 kernel/bpf/syscall.c  |  5 -----
 kernel/bpf/verifier.c | 13 ++-----------
 2 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index c531555cc2d9..4f4a61cbd813 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -4311,11 +4311,6 @@ static int bpf_raw_tp_link_attach(struct bpf_prog *prog,
 	if (!btp)
 		return -ENOENT;
 
-	if (prog->sleepable && !tracepoint_is_faultable(btp->tp)) {
-		bpf_put_raw_tracepoint(btp);
-		return -EINVAL;
-	}
-
 	link = kzalloc_obj(*link, GFP_USER);
 	if (!link) {
 		err = -ENOMEM;
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index d4e38697a704..22ea58b98a8c 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -25205,12 +25205,6 @@ int bpf_check_attach_target(struct bpf_verifier_log *log,
 		btp = bpf_get_raw_tracepoint(tname);
 		if (!btp)
 			return -EINVAL;
-		if (prog->sleepable && !tracepoint_is_faultable(btp->tp)) {
-			bpf_log(log, "Sleepable program cannot attach to non-faultable tracepoint %s\n",
-				tname);
-			bpf_put_raw_tracepoint(btp);
-			return -EINVAL;
-		}
 		fname = kallsyms_lookup((unsigned long)btp->bpf_func, NULL, NULL, NULL,
 					trace_symbol);
 		bpf_put_raw_tracepoint(btp);
@@ -25432,7 +25426,6 @@ static bool can_be_sleepable(struct bpf_prog *prog)
 		case BPF_MODIFY_RETURN:
 		case BPF_TRACE_ITER:
 		case BPF_TRACE_FSESSION:
-		case BPF_TRACE_RAW_TP:
 			return true;
 		default:
 			return false;
@@ -25442,9 +25435,7 @@ static bool can_be_sleepable(struct bpf_prog *prog)
 		return prog->expected_attach_type != BPF_LSM_CGROUP;
 
 	return prog->type == BPF_PROG_TYPE_KPROBE /* only for uprobes */ ||
-	       prog->type == BPF_PROG_TYPE_STRUCT_OPS ||
-	       prog->type == BPF_PROG_TYPE_RAW_TRACEPOINT ||
-	       prog->type == BPF_PROG_TYPE_TRACEPOINT;
+	       prog->type == BPF_PROG_TYPE_STRUCT_OPS;
 }
 
 static int check_attach_btf_id(struct bpf_verifier_env *env)
@@ -25466,7 +25457,7 @@ static int check_attach_btf_id(struct bpf_verifier_env *env)
 	}
 
 	if (prog->sleepable && !can_be_sleepable(prog)) {
-		verbose(env, "Program of this type cannot be sleepable\n");
+		verbose(env, "Only fentry/fexit/fmod_ret, lsm, iter, uprobe, and struct_ops programs can be sleepable\n");
 		return -EINVAL;
 	}
 
-- 
2.53.0




More information about the kernel-team mailing list