All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Weixie Cui <523516579@qq.com>
Cc: ast@kernel.org, daniel@iogearbox.net, john.fastabend@gmail.com,
	andrii@kernel.org, martin.lau@linux.dev, eddyz87@gmail.com,
	song@kernel.org, yonghong.song@linux.dev, kpsingh@kernel.org,
	sdf@fomichev.me, haoluo@google.com, bpf@vger.kernel.org,
	linux-kernel@vger.kernel.org, Weixie Cui <cuiweixie@gmail.com>
Subject: Re: [PATCH bpf] bpf: propagate kvmemdup_bpfptr errors from bpf_prog_verify_signature
Date: Sat, 21 Mar 2026 10:11:26 +0100	[thread overview]
Message-ID: <ab5gvtCzRBcIHeI5@krava> (raw)
In-Reply-To: <tencent_C9C5B2B28413D6303D505CD02BFEA4708C07@qq.com>

On Sat, Mar 21, 2026 at 02:08:00PM +0800, Weixie Cui wrote:
> From: Weixie Cui <cuiweixie@gmail.com>
> 
> kvmemdup_bpfptr() returns -EFAULT when the user pointer cannot be
> copied, and -ENOMEM on allocation failure. The error path always
> returned -ENOMEM, misreporting bad addresses as out-of-memory.
> 
> Return PTR_ERR(sig) so user space gets the correct errno.
> 
> Signed-off-by: Weixie Cui <cuiweixie@gmail.com>

Acked-by: Jiri Olsa <jolsa@kernel.org>

jirka

> ---
>  kernel/bpf/syscall.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
> index 274039e36465..51ade3cde8bb 100644
> --- a/kernel/bpf/syscall.c
> +++ b/kernel/bpf/syscall.c
> @@ -2832,7 +2832,7 @@ static int bpf_prog_verify_signature(struct bpf_prog *prog, union bpf_attr *attr
>  	sig = kvmemdup_bpfptr(usig, attr->signature_size);
>  	if (IS_ERR(sig)) {
>  		bpf_key_put(key);
> -		return -ENOMEM;
> +		return PTR_ERR(sig);
>  	}
>  
>  	bpf_dynptr_init(&sig_ptr, sig, BPF_DYNPTR_TYPE_LOCAL, 0,
> -- 
> 2.39.5 (Apple Git-154)
> 
> 

  reply	other threads:[~2026-03-21  9:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-21  6:08 [PATCH bpf] bpf: propagate kvmemdup_bpfptr errors from bpf_prog_verify_signature Weixie Cui
2026-03-21  9:11 ` Jiri Olsa [this message]
2026-03-24 16:24 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ab5gvtCzRBcIHeI5@krava \
    --to=olsajiri@gmail.com \
    --cc=523516579@qq.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=cuiweixie@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.