For ptrace intercept mode, do not do a policy check for the initial command.

We can skip the policy check for the execve(2) of the initial command
since it has already been check.  Otherwise, we would log the command
twice.  When using fexecve(2) due to a digest check, there should
be no need to skip the initial command since it will be executed
via execveat(2) not execve(2).  However, on older kernels without
execveat(2), glibc will emulate fexecve(2) using /proc which will
result in the extra log entry.
This commit is contained in:
Todd C. Miller
2022-04-29 13:09:03 -06:00
parent 5d385b3c58
commit 52cacfc302
5 changed files with 21 additions and 1 deletions

View File

@@ -720,6 +720,7 @@ command_info_to_details(char * const info[], struct command_details *details)
#ifdef HAVE_FEXECVE
/* Must keep fd open during exec. */
add_preserved_fd(&details->preserved_fds, details->execfd);
SET(details->flags, CD_FEXECVE);
#else
/* Plugin thinks we support fexecve() but we don't. */
(void)fcntl(details->execfd, F_SETFD, FD_CLOEXEC);