From: cgel.zte@gmail.com
To: paul@paul-moore.com, eparis@redhat.com, linux-audit@redhat.com,
rth@twiddle.net, sgrubb@redhat.com
Cc: linux-kernel@vger.kernel.org, ink@jurassic.park.msu.ru,
mattst88@gmail.com, Yang Yang <yang.yang29@zte.com.cn>,
Zeal Robot <zealci@zte.com.cn>
Subject: [PATCH v2] audit: do a quick exit when syscall number is less than 0
Date: Mon, 4 Apr 2022 02:23:18 +0000 [thread overview]
Message-ID: <20220404022317.2449865-1-yang.yang29@zte.com.cn> (raw)
From: Yang Yang <yang.yang29@zte.com.cn>
Userspace may use syscall with syscall number less than 0 by calling
syscall(syscall_num,..). This kind of syscall could never be audited,
because auditctl requires rule with syscall number >=0. Therefore we
better do a quick handle no need to gohead with this situation.
Note that auditctl may set rules auditing invalid syscall with syscall
number bigger than NR_syscalls, to keep this mechanism working, we do
no more check(context->major bigger than NR_syscalls or not).
Signed-off-by: Yang Yang <yang.yang29@zte.com.cn>
Reported-by: Zeal Robot <zealci@zte.com.cn>
---
v2:
- cancel checking against NR_syscalls
---
kernel/auditsc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index ea2ee1181921..79118c811853 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))
goto out;
/* this may generate CONFIG_CHANGE records */
--
2.25.1
next reply other threads:[~2022-04-04 2:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-04 2:23 cgel.zte [this message]
2022-04-04 13:12 ` Paul Moore
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220404022317.2449865-1-yang.yang29@zte.com.cn \
--to=cgel.zte@gmail.com \
--cc=eparis@redhat.com \
--cc=ink@jurassic.park.msu.ru \
--cc=linux-audit@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mattst88@gmail.com \
--cc=paul@paul-moore.com \
--cc=rth@twiddle.net \
--cc=sgrubb@redhat.com \
--cc=yang.yang29@zte.com.cn \
--cc=zealci@zte.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®