All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Emil Tsalapatis" <emil@etsalapatis.com>
To: "Junyoung Jang" <graypanda.inzag@gmail.com>, <ast@kernel.org>,
	<daniel@iogearbox.net>, <andrii@kernel.org>, <eddyz87@gmail.com>,
	<memxor@gmail.com>
Cc: <martin.lau@linux.dev>, <song@kernel.org>,
	<yonghong.song@linux.dev>, <jolsa@kernel.org>,
	<bpf@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<greg@kroah.com>, <security@kernel.org>
Subject: Re: [PATCH bpf v2] bpf: Fix off-by-one boundary validation in arena direct-value access
Date: Sun, 26 Apr 2026 15:17:08 -0400	[thread overview]
Message-ID: <DI3BTJ61RUDC.8DB0IJ6YME4J@etsalapatis.com> (raw)
In-Reply-To: <20260426172505.1947915-1-graypanda.inzag@gmail.com>

On Sun Apr 26, 2026 at 1:25 PM EDT, Junyoung Jang wrote:
> BPF_MAP_TYPE_ARENA accepts BPF_PSEUDO_MAP_VALUE offsets at exactly
> the end of the arena mapping (off == arena_size). The boundary check
> in arena_map_direct_value_addr() uses `>` instead of `>=`, which
> incorrectly allows a one-past-end pointer to be accepted.
>
> Change the condition to `>=` to correctly reject offsets that fall
> outside the valid arena user_vm range.
>
> Fixes: 317460317a02 ("bpf: Introduce bpf_arena.")
> Signed-off-by: Junyoung Jang <graypanda.inzag@gmail.com>
> ---

Reviewed-by: Emil Tsalapatis <emil@etsalapatis.com>

>  kernel/bpf/arena.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/bpf/arena.c b/kernel/bpf/arena.c
> index 802656c6fd3c..49a8f7b1beef 100644
> --- a/kernel/bpf/arena.c
> +++ b/kernel/bpf/arena.c
> @@ -511,7 +511,7 @@ static int arena_map_direct_value_addr(const struct bpf_map *map, u64 *imm, u32
>  {
>  	struct bpf_arena *arena = container_of(map, struct bpf_arena, map);
>  
> -	if ((u64)off > arena->user_vm_end - arena->user_vm_start)
> +	if ((u64)off >= arena->user_vm_end - arena->user_vm_start)
>  		return -ERANGE;
>  	*imm = (unsigned long)arena->user_vm_start;
>  	return 0;


  parent reply	other threads:[~2026-04-26 19:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2026042614-scowling-hankie-f84b@gregkh>
2026-04-26 15:27 ` [PATCH bpf] bpf: Fix off-by-one boundary validation in arena direct-value access Junyoung Jang
2026-04-26 16:11   ` bot+bpf-ci
2026-04-26 17:25 ` [PATCH bpf v2] " Junyoung Jang
2026-04-26 18:17   ` sashiko-bot
2026-04-26 19:16     ` Emil Tsalapatis
2026-04-26 19:58       ` Alexei Starovoitov
2026-04-26 19:17   ` Emil Tsalapatis [this message]
2026-05-09 23:20   ` 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=DI3BTJ61RUDC.8DB0IJ6YME4J@etsalapatis.com \
    --to=emil@etsalapatis.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=graypanda.inzag@gmail.com \
    --cc=greg@kroah.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=security@kernel.org \
    --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.