From: Paul F. <pa...@so...> - 2024-11-23 17:05:41
|
https://sourceware.org/git/gitweb.cgi?p=valgrind.git;h=75ca7437c97a703b7a729d8694743ddde3762713 commit 75ca7437c97a703b7a729d8694743ddde3762713 Author: Ryan Mack <rm...@up...> Date: Sat Nov 23 18:02:21 2024 +0100 Bug 496571 - False positive for null key passed to bpf_map_get_next_key syscall. No regtest added because BPF requires privileges. See the bugzilla item for example usage. Diff: --- NEWS | 1 + coregrind/m_syswrap/syswrap-linux.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index eb853a0bd3..ad5fa1a417 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 494327 Crash when running Helgrind built with #define TRACE_PTH_FNS 1 494337 All threaded applications cause still holding lock errors 495488 Add FreeBSD getrlimitusage syscall wrapper +496571 False positive for null key passed to bpf_map_get_next_key syscall. To see details of a given bug, visit https://bugs.kde.org/show_bug.cgi?id=XXXXXX diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 177712117c..775fae75b2 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -12993,7 +12993,11 @@ PRE(sys_bpf) } /* Get size of key for this map. */ if (bpf_map_get_sizes(attr->map_fd, &key_size, &value_size)) { - PRE_MEM_READ("bpf(attr->key)", attr->key, key_size); + /* see https://bugs.kde.org/show_bug.cgi?id=496571 */ + /* Key is null when getting first entry in map. */ + if (attr->key) { + PRE_MEM_READ("bpf(attr->key)", attr->key, key_size); + } PRE_MEM_WRITE("bpf(attr->next_key)", attr->next_key, key_size); } } |