diff mbox series

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

Message ID 20260901161827.410004-2-alice.munduruca@canonical.com
State New
Headers show
Series Revert mistakenly-picked bpf commit from upstream | expand

Commit Message

Alice C. Munduruca Sept. 1, 2026, 4:18 p.m. UTC
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@canonical.com>
---
 kernel/bpf/syscall.c  |  5 -----
 kernel/bpf/verifier.c | 13 ++-----------
 2 files changed, 2 insertions(+), 16 deletions(-)

Comments

Edoardo Canepa Sept. 1, 2026, 4:44 p.m. UTC | #1
Acked-by: Edoardo Canepa <edoardo.canepa@canonical.com>

On 9/1/26 19:18, Alice C. Munduruca via kernel-team wrote:
> 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@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;
>   	}
>
Vinicius Peixoto Sept. 1, 2026, 5:19 p.m. UTC | #2
On Tue Sep 1, 2026 at 1:18 PM -03, Alice C. Munduruca via kernel-team wrote:
> 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@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;
>  	}
>  

Acked-by: Vinicius Peixoto <vinicius.peixoto@canonical.com>
Andrei Gherzan Sept. 1, 2026, 5:33 p.m. UTC | #3
On 26/09/01 12:18PM, Alice C. Munduruca via kernel-team wrote:
> 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@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;
>  	}

Acked-by: Andrei Gherzan <andrei.gherzan@canonical.com>
diff mbox series

Patch

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;
 	}