From: Ryan Mack Date: Sat, 23 Nov 2024 17:02:21 +0000 (+0100) Subject: Bug 496571 - False positive for null key passed to bpf_map_get_next_key syscall. X-Git-Tag: VALGRIND_3_25_0~226 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75ca7437c97a703b7a729d8694743ddde3762713;p=thirdparty%2Fvalgrind.git 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 --git a/NEWS b/NEWS index eb853a0bd..ad5fa1a41 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 177712117..775fae75b 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); } }