Skip to content

Commit

Permalink
audit: print empty EXECVE args
Browse files Browse the repository at this point in the history
[ Upstream commit ea956d8 ]

Empty executable arguments were being skipped when printing out the list
of arguments in an EXECVE record, making it appear they were somehow
lost.  Include empty arguments as an itemized empty string.

Reproducer:
	autrace /bin/ls "" "/etc"
	ausearch --start recent -m execve -i | grep EXECVE
	type=EXECVE msg=audit(10/03/2018 13:04:03.208:1391) : argc=3 a0=/bin/ls a2=/etc

With fix:
	type=EXECVE msg=audit(10/03/2018 21:51:38.290:194) : argc=3 a0=/bin/ls a1= a2=/etc
	type=EXECVE msg=audit(1538617898.290:194): argc=3 a0="/bin/ls" a1="" a2="/etc"

Passes audit-testsuite.  GH issue tracker at
linux-audit/audit-kernel#99

Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
[PM: cleaned up the commit metadata]
Signed-off-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
rgbriggs authored and gregkh committed Nov 27, 2019
1 parent cab1f2b commit e240968
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/auditsc.c
Expand Up @@ -1107,7 +1107,7 @@ static void audit_log_execve_info(struct audit_context *context,
}

/* write as much as we can to the audit log */
if (len_buf > 0) {
if (len_buf >= 0) {
/* NOTE: some magic numbers here - basically if we
* can't fit a reasonable amount of data into the
* existing audit buffer, flush it and start with
Expand Down

0 comments on commit e240968

Please sign in to comment.