]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
audit: print empty EXECVE args
authorRichard Guy Briggs <rgb@redhat.com>
Wed, 10 Oct 2018 20:22:57 +0000 (16:22 -0400)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:21:02 +0000 (14:21 -0300)
BugLink: https://bugs.launchpad.net/bugs/1854975
[ Upstream commit ea956d8be91edc702a98b7fe1f9463e7ca8c42ab ]

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
https://github.com/linux-audit/audit-kernel/issues/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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
kernel/auditsc.c

index 52738ca92016b5e8f6d4fa677218855f517bcc06..990c9e4d601382522ae493e6eb3be13cfce49b4b 100644 (file)
@@ -1102,7 +1102,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