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: <20220328054641.2372974-1-yang.yang29@zte.com.cn>
Date:   Mon, 28 Mar 2022 05:46:42 +0000
From:   cgel.zte@...il.com
To:     rth@...ddle.net, ink@...assic.park.msu.ru, mattst88@...il.com,
        paul@...l-moore.com, eparis@...hat.com, linux-audit@...hat.com
Cc:     linux-kernel@...r.kernel.org, Yang Yang <yang.yang29@....com.cn>,
        Zeal Robot <zealci@....com.cn>
Subject: [PATCH v2] audit: do a quick exit when syscall number is invalid

From: Yang Yang <yang.yang29@....com.cn>

Userspace may use syscall with invalid syscall number by calling
syscall(syscall_num,..). For example we found openSSH may use
syscall with syscall number is -1 in some case. When that happens
we better do a quick handle no need to gohead.

Signed-off-by: Yang Yang <yang.yang29@....com.cn>
Reported-by: Zeal Robot <zealci@....com.cn>
---
v2:
- fix compile error of arch/alpha, I have no alpha compile environment, so this fix
- is done by code review.
---
 arch/alpha/include/uapi/asm/unistd.h | 1 +
 kernel/auditsc.c                     | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/alpha/include/uapi/asm/unistd.h b/arch/alpha/include/uapi/asm/unistd.h
index 71fd5db06866..8115062216e4 100644
--- a/arch/alpha/include/uapi/asm/unistd.h
+++ b/arch/alpha/include/uapi/asm/unistd.h
@@ -13,5 +13,6 @@
 #define __NR_getgid	__NR_getxgid
 
 #include <asm/unistd_32.h>
+#include <asm-generic/unistd.h>
 
 #endif /* _UAPI_ALPHA_UNISTD_H */
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index ea2ee1181921..ea4915999e01 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -2077,7 +2077,8 @@ void __audit_syscall_exit(int success, long return_code)
 	struct audit_context *context = audit_context();
 
 	if (!context || context->dummy ||
-	    context->context != AUDIT_CTX_SYSCALL)
+	    context->context != AUDIT_CTX_SYSCALL ||
+	    unlikely(context->major < 0 || context->major >= NR_syscalls))
 		goto out;
 
 	/* this may generate CONFIG_CHANGE records */
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ