lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210414080145.17378-1-zhe.he@windriver.com>
Date:   Wed, 14 Apr 2021 16:01:45 +0800
From:   He Zhe <zhe.he@...driver.com>
To:     paul@...l-moore.com, eparis@...hat.com, linux-audit@...hat.com,
        linux-kernel@...r.kernel.org, zhe.he@...driver.com
Subject: [PATCH 1/2] audit: Add syscall return code handling for compat task

When 32-bit userspace application is running on 64-bit kernel, the 32-bit
syscall return code would be changed from u32 to u64 in regs_return_value
and then changed to s64. Hence the negative return code recorded by audit
would end up being a big positive number like below.

type=SYSCALL msg=audit(1611110715.887:582): arch=40000028 syscall=322
success=yes exit=4294967283

This patch forces the u32->s32->s64 for compat tasks.

Signed-off-by: He Zhe <zhe.he@...driver.com>
---
 include/linux/audit.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/linux/audit.h b/include/linux/audit.h
index 82b7c1116a85..32cb853f3029 100644
--- a/include/linux/audit.h
+++ b/include/linux/audit.h
@@ -334,7 +334,9 @@ static inline void audit_syscall_exit(void *pt_regs)
 {
 	if (unlikely(audit_context())) {
 		int success = is_syscall_success(pt_regs);
-		long return_code = regs_return_value(pt_regs);
+		long return_code = is_compat_task() ?
+			(s64)(s32)regs_return_value(pt_regs) :
+			regs_return_value(pt_regs);
 
 		__audit_syscall_exit(success, return_code);
 	}
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ