BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next 0/2] Limit local storage value size to max kmalloc_nolock() allocation
@ 2026-11-04 11:37 Jonathan Bastari Thamrin via B4 Relay
  2026-11-04 11:37 ` [PATCH bpf-next 1/2] bpf: " Jonathan Bastari Thamrin via B4 Relay
  2026-11-04 11:37 ` [PATCH bpf-next 2/2] selftests/bpf: Test local storage max value size Jonathan Bastari Thamrin via B4 Relay
  0 siblings, 2 replies; 5+ messages in thread
From: Jonathan Bastari Thamrin via B4 Relay @ 2026-11-04 11:37 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Eduard Zingerman, Kumar Kartikeya Dwivedi, Martin KaFai Lau,
	Song Liu, Yonghong Song, Jiri Olsa, Emil Tsalapatis,
	Ihor Solodrai, John Fastabend, Amery Hung, Shuah Khan,
	Christian Brauner
  Cc: bpf, linux-kernel, linux-kselftest, Amery Hung, Slava Imameev,
	Jonathan Bastari Thamrin

BPF local storage elements are allocated using kmalloc_nolock()
but map creation is still allowed with values up to kmalloc()'s
larger limit. BPF_LOCAL_STORAGE_MAX_VALUE_SIZE is changed to be
based on KMALLOC_MAX_CACHE_SIZE instead and maps with larger
values fail on creation with E2BIG. Cgroup storage
(BPF_MAP_TYPE_CGROUP_STORAGE) uses the previous limit since it
allocates with kmalloc().

A selftest is also added to both find the largest task storage
size and test that this value can be stored. It also checks
that the size is at least 4096 to check that the limit isn't too
low.

---
Jonathan Bastari Thamrin (2):
      bpf: Limit local storage value size to max kmalloc_nolock() allocation
      selftests/bpf: Test local storage max value size

 include/linux/bpf_local_storage.h                  | 10 +--
 kernel/bpf/local_storage.c                         | 13 +++-
 .../selftests/bpf/prog_tests/task_local_storage.c  | 87 ++++++++++++++++++++++
 3 files changed, 103 insertions(+), 7 deletions(-)
---
base-commit: d346f59069676eda84b3313cbd2c2ab21045d3ee
change-id: 20261104-local-storage-max-c3709fcd6fbc

Best regards,
-- 
Jonathan Bastari Thamrin <thamrinjonathan@gmail.com>



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-11-04 11:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-04 11:37 [PATCH bpf-next 0/2] Limit local storage value size to max kmalloc_nolock() allocation Jonathan Bastari Thamrin via B4 Relay
2026-11-04 11:37 ` [PATCH bpf-next 1/2] bpf: " Jonathan Bastari Thamrin via B4 Relay
2026-11-04 11:44   ` sashiko-bot
2026-11-04 11:37 ` [PATCH bpf-next 2/2] selftests/bpf: Test local storage max value size Jonathan Bastari Thamrin via B4 Relay
2026-11-04 11:42   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox