https://bugs.kde.org/show_bug.cgi?id=496571
Bug ID: 496571 Summary: False positive for null key passed to bpf_map_get_next_key syscall. Classification: Developer tools Product: valgrind Version: 3.22.0 Platform: Ubuntu OS: Linux Status: REPORTED Severity: minor Priority: NOR Component: memcheck Assignee: jsew...@acm.org Reporter: rm...@uptycs.com Target Milestone: --- The BPF function bpf_map_get_next_key takes a null key parameter to get the first key in a map. Valgrind should not warn of an invalid pointer in this case. Locally tested fix: diff --git a/coregrind/m_syswrap/syswrap-linux.c b/coregrind/m_syswrap/syswrap-linux.c index 177712117..9be77992c 100644 --- a/coregrind/m_syswrap/syswrap-linux.c +++ b/coregrind/m_syswrap/syswrap-linux.c @@ -12993,7 +12993,10 @@ 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); + /* 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); } } -- You are receiving this mail because: You are watching all bug changes.