Skip to content

Fix for crash due to overwrite in copy_map_value

Kumar Kartikeya Dwivedi bpf 2 versions Applied

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

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 10 repliesApplied 2/2
  2. v12 patches 0 repliesSuperseded

Changes in v2 from the cover letter

v1: https://lore.kernel.org/bpf/[email protected]

* Fix build error for selftests patch due to missing SYS_PREFIX in bpf tree

Patches in v2 All 2 applied

#Subject and filesSizeRepliesApplied
1/2bpf: Fix crash due to incorrect copy_map_valueinclude/linux/bpf.h+2 -18 repliesApplied
2/2selftests/bpf: Add test for bpf_timer overwriting crashtools/testing/selftests/bpf/prog_tests/timer_crash.c tools/testing/selftests/bpf/progs/timer_crash.c+86 -02 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH bpf v2 0/2] Fix for crash due to overwrite in copy_map_value

A fix for an oversight in copy_map_value that leads to kernel crash.

Also, a question for BPF developers:
It seems in arraymap.c, we always do check_and_free_timer_in_array after we do copy_map_value in map_update_elem callback, but the same is not done for hashtab.c. Is there a specific reason for this difference in behavior, or did I miss that it happens for hashtab.c as well?

Changlog:
---------
v1 -> v2:
v1: https://lore.kernel.org/bpf/[email protected]

* Fix build error for selftests patch due to missing SYS_PREFIX in bpf tree

Kumar Kartikeya Dwivedi (2):
bpf: Fix crash due to incorrect copy_map_value selftests/bpf: Add test for bpf_timer overwriting crash

 include/linux/bpf.h                           |  3 +-
 .../selftests/bpf/prog_tests/timer_crash.c    | 32 +++++++++++
 .../testing/selftests/bpf/progs/timer_crash.c | 54 +++++++++++++++++++
 3 files changed, 88 insertions(+), 1 deletion(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/timer_crash.c
 create mode 100644 tools/testing/selftests/bpf/progs/timer_crash.c
Signature · 1 line
2.35.1