From: Barret Rhoden <brho@google.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: bpf@vger.kernel.org, daniel@iogearbox.net, andrii@kernel.org,
martin.lau@kernel.org, memxor@gmail.com, eddyz87@gmail.com
Subject: Re: [PATCH bpf-next] bpf: Fix use-after-free in arena_vm_close on fork
Date: Mon, 13 Apr 2026 18:39:59 -0400 [thread overview]
Message-ID: <6b329a63-14f2-4546-aa4a-82da87f47a6d@google.com> (raw)
In-Reply-To: <20260413194245.21449-1-alexei.starovoitov@gmail.com>
On 4/13/26 3:42 PM, Alexei Starovoitov wrote:
> @@ -486,10 +498,11 @@ static int arena_map_mmap(struct bpf_map *map, struct vm_area_struct *vma)
> arena->user_vm_end = vma->vm_end;
> /*
> * bpf_map_mmap() checks that it's being mmaped as VM_SHARED and
> - * clears VM_MAYEXEC. Set VM_DONTEXPAND as well to avoid
> - * potential change of user_vm_start.
> + * clears VM_MAYEXEC. Set VM_DONTEXPAND to avoid potential change
> + * of user_vm_start. Set VM_DONTCOPY to prevent arena VMA from
> + * being copied into the child process on fork.
> */
> - vm_flags_set(vma, VM_DONTEXPAND);
> + vm_flags_set(vma, VM_DONTEXPAND | VM_DONTCOPY);
i think on older kernels, VM_DONTCOPY alone isn't enough, due to the
whole MADVISE_DOFORK mess. Linus added something to catch this in
https://github.com/torvalds/linux/commit/0b2758f48f22b173963f39e553d0ecd05f3b4433
(Just a note to any backporters out there...) =)
thanks for the fix
barret
> vma->vm_ops = &arena_vm_ops;
> return 0;
> }
next prev parent reply other threads:[~2026-04-13 22:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-13 19:42 [PATCH bpf-next] bpf: Fix use-after-free in arena_vm_close on fork Alexei Starovoitov
2026-04-13 19:55 ` Emil Tsalapatis
2026-04-13 22:39 ` Barret Rhoden [this message]
2026-04-15 19: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=6b329a63-14f2-4546-aa4a-82da87f47a6d@google.com \
--to=brho@google.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=martin.lau@kernel.org \
--cc=memxor@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox