Skip to content

Fix local storage helper OOPs

KP Singh bpf 2 versions – Applied

Status from this message: This series was applied to bpf/bpf.git (refs/heads/master):

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 4 repliesApplied 3/3
  2. v23 patches 4 repliesSuperseded

Patches in v3 All 3 applied

#Subject and filesSizeRepliesApplied
1/3bpf: update local storage test to check handling of null ptrstools/testing/selftests/bpf/prog_tests/test_local_storage.c tools/testing/selftests/bpf/progs/local_storage.c+61 -974 repliesApplied
2/3bpf: local storage helpers should check nullness of owner ptr passedkernel/bpf/bpf_inode_storage.c kernel/bpf/bpf_task_storage.c+8 -20 repliesApplied
3/3bpf: Fix typo in bpf_inode_storage.ckernel/bpf/bpf_inode_storage.c+2 -20 repliesApplied

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchYonghong SongMartin KaFai Lau
1/3A-b
2/3A-b A-b
3/3A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH bpf v3 0/3] Fix local storage helper OOPs
# v2 -> v3

* Checking the return value of mkdtemp intead of errno
* Added Yonghong's Acks

It was noted in
https://lore.kernel.org/bpf/CACYkzJ55X8Tp2q4+EFf2hOM_Lysoim1xJY1YdA3k=T3woMW6mg@mail.gmail.com/T/#t
that the local storage helpers do not handle null owner pointers correctly. This patch fixes the task and inode storage helpers with a null check. In order to keep the check explicit, it's kept in the body of the helpers similar to sk_storage and also fixes a minor typo in bpf_inode_storage.c [I did not add a fixes and reported tag to the patch that fixes the typo since it's a non-functional change].

The series also incorporates the example posted by Gilad into the selftest. The selftest, without the fix reproduces the oops and the subsequent patch fixes it.

KP Singh (3):
bpf: update local storage test to check handling of null ptrs
bpf: local storage helpers should check nullness of owner ptr passed
bpf: Fix typo in bpf_inode_storage.c

 kernel/bpf/bpf_inode_storage.c                |  9 +-
 kernel/bpf/bpf_task_storage.c                 |  5 +-
 .../bpf/prog_tests/test_local_storage.c       | 96 +++++--------------
 .../selftests/bpf/progs/local_storage.c       | 62 ++++++------
 4 files changed, 71 insertions(+), 101 deletions(-)
Signature · 1 line
2.30.0.284.gd98b1dd5eaa7-goog