]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Bug 496571 - False positive for null key passed to bpf_map_get_next_key syscall.
authorRyan Mack <rmack@uptycs.com>
Sat, 23 Nov 2024 17:02:21 +0000 (18:02 +0100)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Sat, 23 Nov 2024 17:02:21 +0000 (18:02 +0100)
No regtest added because BPF requires privileges. See the bugzilla item
for example usage.

NEWS
coregrind/m_syswrap/syswrap-linux.c

diff --git a/NEWS b/NEWS
index eb853a0bd3b1be090eb3234702add01327858b03..ad5fa1a417effa773f1e7e3bc55aa071141c529f 100644 (file)
--- 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
index 177712117c5689f1d507038b4a1fc4f8c36edc6e..775fae75b220aa319cdbc03fbe2e298e329fd18f 100644 (file)
@@ -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);
             }
          }