From 417289248769cb9f788d82322410ee8eb72cdef7 Mon Sep 17 00:00:00 2001 From: Andrea Terzolo Date: Thu, 20 Jun 2024 11:07:05 +0200 Subject: [PATCH] fix(sinsp): invalid threads shoudln't be in a pid namespace Signed-off-by: Andrea Terzolo --- userspace/libsinsp/threadinfo.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/userspace/libsinsp/threadinfo.h b/userspace/libsinsp/threadinfo.h index 4da7e655ad..47fd5d46a1 100644 --- a/userspace/libsinsp/threadinfo.h +++ b/userspace/libsinsp/threadinfo.h @@ -198,7 +198,8 @@ class SINSP_PUBLIC sinsp_threadinfo : public libsinsp::state::table_entry */ inline bool is_in_pid_namespace() const { - return (m_flags & PPM_CL_CHILD_IN_PIDNS || m_tid != m_vtid); + // m_tid should be always valid because we read it from the scap event header + return (m_flags & PPM_CL_CHILD_IN_PIDNS || (m_tid != m_vtid && m_vtid >= 0)); } /*!