bpf: fix end-of-list detection in cgroup_storage_get_next_key()
Status from this message: This series was applied to bpf/bpf-next.git (master)
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v2 Latest2 patches 1 replyApplied 2/2
- v11 patch 3 repliesSuperseded
Changes in v2 from the cover letter
- Added selftest (Paul Chaignon)
- Collected Reviewed-by and Acked-by tags
Patches in v2 All 2 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | bpf: fix end-of-list detection in cgroup_storage_get_next_key()kernel/ | +1 | 0 replies | Applied |
| 2/2 | selftests/bpf: add get_next_key boundary test for cgroup_storagetools/ | +5 | 1 reply | Applied |
Reviews trailers per patch
All 2 patches have a Reviewed-by or Acked-by.
| Patch | Sun Jian | Paul Chaignon |
|---|---|---|
| 1/2 | R-b | A-b |
| 2/2 | A-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH bpf v2 0/2] bpf: fix end-of-list detection in cgroup_storage_get_next_key()
list_next_entry() never returns NULL, so the NULL check in cgroup_storage_get_next_key() is dead code. When iterating past the last element, the function reads storage->key from a bogus pointer that aliases internal map fields and copies the result to userspace.
Patch 1 replaces the NULL check with list_entry_is_head() so the function correctly returns -ENOENT when there are no more entries.
Patch 2 adds a selftest to cover this corner case, as suggested by Sun Jian and Paul Chaignon.
v2:
- Added selftest (Paul Chaignon)
- Collected Reviewed-by and Acked-by tags
Weiming Shi (2):
bpf: fix end-of-list detection in cgroup_storage_get_next_key() selftests/bpf: add get_next_key boundary test for cgroup_storage
kernel/bpf/local_storage.c | 2 +- tools/testing/selftests/bpf/prog_tests/cgroup_storage.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-)
Signature · 1 line
2.43.0