Skip to content

Commit d3941e1

Browse files
committed
fix(userspace/libsinsp): avoid setting evt fdinfo in fch* parsers
Setting the event's fdinfo by leveraging the event's fd parameter is already done in `sinsp_parser::reset()` and can be avoided the `fchmod/fchown` exit event parsers. This means completely remove this parsers. Signed-off-by: Leonardo Di Giovanna <[email protected]>
1 parent 8d4ee06 commit d3941e1

File tree

2 files changed

+0
-19
lines changed

2 files changed

+0
-19
lines changed

userspace/libsinsp/parsers.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,6 @@ void sinsp_parser::process_event(sinsp_evt &evt, sinsp_parser_verdict &verdict)
140140
case PPME_SYSCALL_OPEN_BY_HANDLE_AT_X:
141141
parse_open_openat_creat_exit(evt);
142142
break;
143-
case PPME_SYSCALL_FCHMOD_X:
144-
case PPME_SYSCALL_FCHOWN_X:
145-
parse_fchmod_fchown_exit(evt);
146-
break;
147143
case PPME_SYSCALL_UNSHARE_X:
148144
case PPME_SYSCALL_SETNS_X:
149145
parse_unshare_setns_exit(evt);
@@ -2050,20 +2046,6 @@ void sinsp_parser::parse_open_openat_creat_exit(sinsp_evt &evt) const {
20502046
}
20512047
}
20522048

2053-
void sinsp_parser::parse_fchmod_fchown_exit(sinsp_evt &evt) {
2054-
// Both of these syscalls act on fds although they do not
2055-
// create them. Take the fd argument and attempt to look up
2056-
// the fd from the thread.
2057-
if(evt.get_tinfo() == nullptr) {
2058-
return;
2059-
}
2060-
2061-
ASSERT(evt.get_param_info(1)->type == PT_FD);
2062-
const int64_t fd = evt.get_param(1)->as<int64_t>();
2063-
evt.get_tinfo()->m_lastevent_fd = fd;
2064-
evt.set_fd_info(evt.get_tinfo()->get_fd(fd));
2065-
}
2066-
20672049
//
20682050
// Helper function to allocate a socket fd, initialize it by parsing its parameters and add it to
20692051
// the fd table of the given thread.

userspace/libsinsp/parsers.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ class sinsp_parser {
9191
void parse_clone_exit(sinsp_evt& evt, sinsp_parser_verdict& verdict) const;
9292
void parse_execve_exit(sinsp_evt& evt, sinsp_parser_verdict& verdict) const;
9393
void parse_open_openat_creat_exit(sinsp_evt& evt) const;
94-
static void parse_fchmod_fchown_exit(sinsp_evt& evt);
9594
void parse_pipe_exit(sinsp_evt& evt) const;
9695
void parse_socketpair_exit(sinsp_evt& evt) const;
9796
void parse_socket_exit(sinsp_evt& evt) const;

0 commit comments

Comments
 (0)