Skip to content

Commit f28adb7

Browse files
deepskyblue86poiana
authored andcommitted
fix(plugins/container): parse_exit_process_event
Apply the same logic of libs ~user_group_updater Signed-off-by: Angelo Puglisi <angelopuglisi86@gmail.com>
1 parent a97e226 commit f28adb7

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

plugins/container/src/caps/parse/parse.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,19 +173,19 @@ bool my_plugin::parse_exit_process_event(
173173
auto thread_id = in.get_event_reader().get_tid();
174174
auto& tr = in.get_table_reader();
175175

176-
int64_t vpid;
177-
std::string container_id;
178-
179176
// retrieve the thread entry associated with this thread id,
180177
// check if vpid is 1, so if this is an init process,
181178
// then, fetch the container_id and if not empty,
182179
// remove its associated entry from the container cache.
183180
try
184181
{
185182
auto thread_entry = m_threads_table.get_entry(tr, thread_id);
183+
int64_t vpid, vtid;
186184
m_threads_field_vpid.read_value(tr, thread_entry, vpid);
187-
if(vpid == 1)
185+
m_threads_field_vtid.read_value(tr, thread_entry, vtid);
186+
if(vtid == vpid && vpid == 1)
188187
{
188+
std::string container_id;
189189
m_container_id_field.read_value(tr, thread_entry, container_id);
190190
if(!container_id.empty())
191191
{

plugins/container/src/macros.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ limitations under the License.
7878
#define PIDNS_INIT_START_TS_FIELD_NAME "pidns_init_start_ts"
7979
#define CATEGORY_FIELD_NAME "category"
8080
#define VPID_FIELD_NAME "vpid"
81+
#define VTID_FIELD_NAME "vtid"
8182
#define PTID_FIELD_NAME "ptid"
8283

8384
/////////////////////////

plugins/container/src/plugin.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ bool my_plugin::init(falcosecurity::init_input& in)
103103
// entry
104104
m_threads_field_vpid = m_threads_table.get_field(
105105
t.fields(), VPID_FIELD_NAME, st::SS_PLUGIN_ST_INT64);
106+
m_threads_field_vtid = m_threads_table.get_field(
107+
t.fields(), VTID_FIELD_NAME, st::SS_PLUGIN_ST_INT64);
106108
m_threads_field_ptid = m_threads_table.get_field(
107109
t.fields(), PTID_FIELD_NAME, st::SS_PLUGIN_ST_INT64);
108110

plugins/container/src/plugin.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ class my_plugin
148148
falcosecurity::table_field m_threads_field_category;
149149
// Accessors to the thread table "vpid" field
150150
falcosecurity::table_field m_threads_field_vpid;
151+
// Accessors to the thread table "vtid" field
152+
falcosecurity::table_field m_threads_field_vtid;
151153
// Accessors to the thread table "ptid" field
152154
falcosecurity::table_field m_threads_field_ptid;
153155
// Accessors to the thread table "args" sub table

0 commit comments

Comments
 (0)