Skip to content

Commit

Permalink
new(libsinsp): set is_open_create to true if temp file is created
Browse files Browse the repository at this point in the history
Co-authored-by: Andrea Terzolo <andrea.terzolo@polito.it>
Signed-off-by: Gianmatteo Palmieri <mail@gian.im>
  • Loading branch information
mrgian and Andreagit97 committed Aug 24, 2023
1 parent 1de6336 commit 1a68fbd
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions userspace/libsinsp/filterchecks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5925,10 +5925,26 @@ uint8_t* sinsp_filter_check_event::extract(sinsp_evt *evt, OUT uint32_t* len, bo
m_u32val = 1;
}

if(m_field_id == TYPE_ISOPEN_CREATE &&
flags & PPM_O_F_CREATED)
if(m_field_id == TYPE_ISOPEN_CREATE)
{
m_u32val = 1;
// If PPM_O_F_CREATED is set the file is created
if(flags & PPM_O_F_CREATED)
{
m_u32val = 1;
}

// If PPM_O_TMPFILE is set and syscall is successful the file is created
if(flags & PPM_O_TMPFILE)
{
parinfo = evt->get_param(0);
ASSERT(parinfo->m_len == sizeof(int64_t));
int64_t retval = *(int64_t *)parinfo->m_val;

if(retval >= 0)
{
m_u32val = 1;
}
}
}

/* `open_by_handle_at` exit event has no `mode` parameter. */
Expand Down

0 comments on commit 1a68fbd

Please sign in to comment.