Skip to content

Commit

Permalink
fix(userspace/libsinsp): consistent thread info filtering while dumping
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Dellaluce <[email protected]>
  • Loading branch information
jasondellaluce authored and poiana committed Jan 8, 2024
1 parent 934a639 commit ee9bccf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
22 changes: 20 additions & 2 deletions userspace/libsinsp/sinsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -974,8 +974,26 @@ void sinsp::on_new_entry_from_proc(void* context,
{
if(m_filter != nullptr && is_capture())
{
// we'll run the filter when we see the fds and possibly clear the filtered_out flag
newti->m_filtered_out = true;
scap_evt tscapevt;
tscapevt.tid = tid;
tscapevt.ts = 0;
tscapevt.type = PPME_SYSCALL_READ_X;
tscapevt.len = 0;
tscapevt.nparams = 0;

auto tinfo = find_thread(tid, true);
sinsp_evt tevt;
tevt.m_pevt = &tscapevt;
tevt.m_inspector = this;
tevt.m_info = &(g_infotables.m_event_info[PPME_SYSCALL_READ_X]);
tevt.m_cpuid = 0;
tevt.m_evtnum = 0;
tevt.m_tinfo = tinfo.get();
tevt.m_fdinfo = NULL;
tinfo->m_lastevent_fd = -1;
tinfo->m_lastevent_data = NULL;

tinfo->m_filtered_out = !m_filter->run(&tevt);
}

// we shouldn't see any fds yet
Expand Down
1 change: 1 addition & 0 deletions userspace/libsinsp/threadinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ void sinsp_threadinfo::init()
m_exe_ino_mtime = 0;
m_exe_ino_ctime_duration_clone_ts = 0;
m_exe_ino_ctime_duration_pidns_start = 0;
m_filtered_out = false;

memset(&m_user, 0, sizeof(scap_userinfo));
memset(&m_group, 0, sizeof(scap_groupinfo));
Expand Down

0 comments on commit ee9bccf

Please sign in to comment.