From: Kumar Kartikeya Dwivedi <memxor@gmail.com>
To: bpf@vger.kernel.org
Cc: Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <martin.lau@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>,
Mykyta Yatsenko <yatsenko@meta.com>,
kkd@meta.com, kernel-team@meta.com
Subject: [PATCH bpf-next v1 0/4] Close race in freeing special fields and map value
Date: Wed, 25 Feb 2026 10:51:17 -0800 [thread overview]
Message-ID: <20260225185121.2057388-1-memxor@gmail.com> (raw)
There exists a race across various map types where the freeing of
special fields (tw, timer, wq, kptr, etc.) can be done eagerly when a
logical delete operation is done on a map value, such that the program
which continues to have access to such a map value can recreate the
fields and cause them to leak.
The set contains fixes for this case. It is a continuation of Mykyta's
previous attempt in [0], but applies to all fields. A test is included
which reproduces the bug reliably in absence of the fixes.
[0]: https://lore.kernel.org/bpf/20260216131341.1285427-1-mykyta.yatsenko5@gmail.com
Kumar Kartikeya Dwivedi (4):
bpf: Register dtor for freeing special fields
bpf: Delay freeing fields in local storage
bpf: Retire rcu_trace_implies_rcu_gp() from local storage
selftests/bpf: Add tests for special fields races
include/linux/bpf_mem_alloc.h | 4 +
kernel/bpf/bpf_local_storage.c | 65 ++++----
kernel/bpf/hashtab.c | 37 +++++
kernel/bpf/memalloc.c | 42 +++--
.../selftests/bpf/prog_tests/map_kptr_race.c | 155 ++++++++++++++++++
.../selftests/bpf/progs/map_kptr_race.c | 145 ++++++++++++++++
6 files changed, 403 insertions(+), 45 deletions(-)
create mode 100644 tools/testing/selftests/bpf/prog_tests/map_kptr_race.c
create mode 100644 tools/testing/selftests/bpf/progs/map_kptr_race.c
base-commit: f620af11c27b8ec9994a39fe968aa778112d1566
--
2.47.3
next reply other threads:[~2026-02-25 18:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 18:51 Kumar Kartikeya Dwivedi [this message]
2026-02-25 18:51 ` [PATCH bpf-next v1 1/4] bpf: Register dtor for freeing special fields Kumar Kartikeya Dwivedi
2026-02-25 18:51 ` [PATCH bpf-next v1 2/4] bpf: Delay freeing fields in local storage Kumar Kartikeya Dwivedi
2026-02-25 19:31 ` bot+bpf-ci
2026-02-25 18:51 ` [PATCH bpf-next v1 3/4] bpf: Retire rcu_trace_implies_rcu_gp() from " Kumar Kartikeya Dwivedi
2026-02-25 18:55 ` Paul E. McKenney
2026-02-25 18:51 ` [PATCH bpf-next v1 4/4] selftests/bpf: Add tests for special fields races Kumar Kartikeya Dwivedi
2026-02-26 9:31 ` [syzbot ci] Re: Close race in freeing special fields and map value syzbot ci
2026-02-26 15:05 ` Kumar Kartikeya Dwivedi
2026-02-26 17:36 ` Kumar Kartikeya Dwivedi
2026-02-26 17:38 ` syzbot ci
2026-02-26 18:28 ` Kumar Kartikeya Dwivedi
2026-02-26 18:30 ` syzbot ci
2026-02-26 18:36 ` [PATCH] please work syzbot Kumar Kartikeya Dwivedi
2026-02-26 18:42 ` syzbot ci
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=20260225185121.2057388-1-memxor@gmail.com \
--to=memxor@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=kernel-team@meta.com \
--cc=kkd@meta.com \
--cc=martin.lau@kernel.org \
--cc=yatsenko@meta.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 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.