Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(userspace/libsinsp): keep event thread after execve #2212

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion userspace/libsinsp/parsers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2255,8 +2255,18 @@ void sinsp_parser::parse_execve_exit(sinsp_evt *evt) {
auto thread_ptr = thread.lock().get();
/* we don't want to remove the main thread since it is the one
* running in this parser!
*
* Also make sure the thread to be removed is not the one
* associated with the event. Under normal conditions this
* should not happen, since the kernel will reassign tid before
* returning from the exec syscall. But there are crash reports,
* indicating possibility the original tid is kept in place, but
* the syscall still returns a success.
*
* To handle such cases gracefully, keep the event thread.
*/
if(thread_ptr == nullptr || thread_ptr->is_main_thread()) {
if(thread_ptr == nullptr || thread_ptr->is_main_thread() ||
thread_ptr->m_tid == evt->get_tinfo()->m_tid) {
continue;
}
m_inspector->remove_thread(thread_ptr->m_tid);
Expand Down
Loading