leahneukirchen / extrace

trace exec() calls system-wide
Other
122 stars 9 forks source link

extrace: Segfault by PROC_EVENT_NONE (Kubuntu 16.04) #6

Closed tbetker-rs closed 5 years ago

tbetker-rs commented 5 years ago

On my Kubuntu 16.04 PC (kernel 4.4.0-137-generic), extrace receives, at its start, a PROC_EVENT_NONE message with cproc->cpu = 0xffffffff. When trying to access last_seq[cproc->cpu], it crashes (segmentation fault).

Except for cproc->cpu and cproc->timestamp_ns, the message is all zeros (in particular, cmsg->seq = 0), so I just ignore it:

@@ -588,6 +588,9 @@ 
                if (from_nla.nl_pid != 0 || recv_len < 1)
                        continue;

+               if (cproc->what == PROC_EVENT_NONE)
+                       continue;
+
                if (last_seq[cproc->cpu] &&
                    cmsg->seq != last_seq[cproc->cpu] + 1)
                        fprintf(stderr,