]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
bpf: Remove gfp_flags plumbing from bpf_local_storage_update()
authorAmery Hung <ameryhung@gmail.com>
Sat, 11 Apr 2026 01:54:18 +0000 (18:54 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 11 Apr 2026 04:22:32 +0000 (21:22 -0700)
commit136deea435dc83d7fe2304303bb9bccb54f69bb0
treeb3366ddffd45d0d817355f50bc2df98844a79f79
parent5063e775889948c0475ccdf21c74a6191b7b6482
bpf: Remove gfp_flags plumbing from bpf_local_storage_update()

Remove the check that rejects sleepable BPF programs from doing
BPF_ANY/BPF_EXIST updates on local storage. This restriction was added
in commit b00fa38a9c1c ("bpf: Enable non-atomic allocations in local
storage") because kzalloc(GFP_KERNEL) could sleep inside
local_storage->lock. This is no longer a concern: all local storage
allocations now use kmalloc_nolock() which never sleeps.

In addition, since kmalloc_nolock() only accepts __GFP_ACCOUNT,
__GFP_ZERO and __GFP_NO_OBJ_EXT, the gfp_flags parameter plumbing from
bpf_*_storage_get() to bpf_local_storage_update() becomes dead code.
Remove gfp_flags from bpf_selem_alloc(), bpf_local_storage_alloc() and
bpf_local_storage_update(). Drop the hidden 5th argument from
bpf_*_storage_get helpers, and remove the verifier patching that
injected GFP_KERNEL/GFP_ATOMIC into the fifth argument.

Signed-off-by: Amery Hung <ameryhung@gmail.com>
Link: https://lore.kernel.org/r/20260411015419.114016-4-ameryhung@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/bpf_local_storage.h
kernel/bpf/bpf_cgrp_storage.c
kernel/bpf/bpf_inode_storage.c
kernel/bpf/bpf_local_storage.c
kernel/bpf/bpf_task_storage.c
kernel/bpf/verifier.c
net/core/bpf_sk_storage.c