All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] audit: do a quick exit when syscall number is invalid
@ 2022-03-26  9:46 ` cgel.zte
  0 siblings, 0 replies; 58+ messages in thread
From: cgel.zte @ 2022-03-26  9:46 UTC (permalink / raw)
  To: paul, eparis, linux-audit; +Cc: linux-kernel, Yang Yang, Zeal Robot

From: Yang Yang <yang.yang29@zte.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@zte.com.cn>
Reported-by: Zeal Robot <zealci@zte.com.cn>
---
 kernel/auditsc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index ea2ee1181921..806cd57d7f20 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


^ permalink raw reply related	[flat|nested] 58+ messages in thread

end of thread, other threads:[~2022-04-07 13:00 UTC | newest]

Thread overview: 58+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-26  9:46 [PATCH] audit: do a quick exit when syscall number is invalid cgel.zte
2022-03-26  9:46 ` cgel.zte
2022-03-26 20:55 ` kernel test robot
2022-03-26 20:55   ` kernel test robot
2022-03-29  1:48   ` CGEL
2022-03-29  1:48     ` CGEL
2022-03-29  1:48     ` CGEL
2022-03-29  2:19     ` Enzo Matsumiya
2022-03-29  2:19       ` Enzo Matsumiya
2022-03-29  2:19       ` Enzo Matsumiya
2022-03-29  3:06     ` Paul Moore
2022-03-29  3:06       ` Paul Moore
2022-03-29  3:06       ` Paul Moore
2022-03-29  3:22       ` CGEL
2022-03-29  3:22         ` CGEL
2022-03-29  3:22         ` CGEL
2022-03-29 13:11         ` Paul Moore
2022-03-29 13:11           ` Paul Moore
2022-03-29 13:11           ` Paul Moore
2022-03-30  5:59           ` CGEL
2022-03-30  5:59             ` CGEL
2022-03-30  5:59             ` CGEL
2022-03-30 14:48             ` Paul Moore
2022-03-30 14:48               ` Paul Moore
2022-03-30 14:48               ` Paul Moore
2022-03-31  2:29               ` CGEL
2022-03-31  2:29                 ` CGEL
2022-03-31  2:29                 ` CGEL
2022-03-31 14:16                 ` Paul Moore
2022-03-31 14:16                   ` Paul Moore
2022-03-31 14:16                   ` Paul Moore
2022-04-01  1:57                   ` CGEL
2022-04-01  1:57                     ` CGEL
2022-04-01  1:57                     ` CGEL
2022-04-01 13:39                     ` Steve Grubb
2022-04-01 13:39                       ` Steve Grubb
2022-04-01 13:39                       ` Steve Grubb
2022-04-01 14:16                       ` Paul Moore
2022-04-01 14:16                         ` Paul Moore
2022-04-01 14:16                         ` Paul Moore
2022-04-02  8:06                         ` CGEL
2022-04-02  8:06                           ` CGEL
2022-04-02  8:06                           ` CGEL
2022-04-02 15:07                           ` Paul Moore
2022-04-02 15:07                             ` Paul Moore
2022-04-02 15:07                             ` Paul Moore
2022-04-04 15:58                           ` Richard Guy Briggs
2022-04-04 15:58                             ` Richard Guy Briggs
2022-04-04 15:58                             ` Richard Guy Briggs
2022-04-06  1:19                             ` CGEL
2022-04-06  1:19                               ` CGEL
2022-04-06  1:19                               ` CGEL
2022-04-06 16:49                               ` Richard Guy Briggs
2022-04-06 16:49                                 ` Richard Guy Briggs
2022-04-06 16:49                                 ` Richard Guy Briggs
2022-04-07  2:36                                 ` CGEL
2022-04-07  2:36                                   ` CGEL
2022-04-07  2:36                                   ` CGEL

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.