* [PATCH] audit: don't deref the syscall args when checking the openat2 open_how::flags
@ 2022-02-09 21:11 Paul Moore
2022-02-09 23:45 ` Paul Moore
0 siblings, 1 reply; 2+ messages in thread
From: Paul Moore @ 2022-02-09 21:11 UTC (permalink / raw)
To: linux-audit, Jeff Mahoney
As reported by Jeff, dereferencing the openat2 syscall argument in
audit_match_perm() to obtain the open_how::flags can result in an
oops/page-fault. This patch fixes this by using the open_how struct
that we store in the audit_context with audit_openat2_how().
Cc: stable@vger.kernel.org
Fixes: 1c30e3af8a79 ("audit: add support for the openat2 syscall")
Reported-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
---
kernel/auditsc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index fce5d43a933f..a83928cbdcb7 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -185,7 +185,7 @@ static int audit_match_perm(struct audit_context *ctx, int mask)
case AUDITSC_EXECVE:
return mask & AUDIT_PERM_EXEC;
case AUDITSC_OPENAT2:
- return mask & ACC_MODE((u32)((struct open_how *)ctx->argv[2])->flags);
+ return mask & ACC_MODE((u32)ctx->openat2.flags);
default:
return 0;
}
--
Linux-audit mailing list
Linux-audit@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-audit
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] audit: don't deref the syscall args when checking the openat2 open_how::flags
2022-02-09 21:11 [PATCH] audit: don't deref the syscall args when checking the openat2 open_how::flags Paul Moore
@ 2022-02-09 23:45 ` Paul Moore
0 siblings, 0 replies; 2+ messages in thread
From: Paul Moore @ 2022-02-09 23:45 UTC (permalink / raw)
To: linux-audit, Jeff Mahoney
On Wed, Feb 9, 2022 at 4:11 PM Paul Moore <paul@paul-moore.com> wrote:
>
> As reported by Jeff, dereferencing the openat2 syscall argument in
> audit_match_perm() to obtain the open_how::flags can result in an
> oops/page-fault. This patch fixes this by using the open_how struct
> that we store in the audit_context with audit_openat2_how().
>
> Cc: stable@vger.kernel.org
> Fixes: 1c30e3af8a79 ("audit: add support for the openat2 syscall")
> Reported-by: Jeff Mahoney <jeffm@suse.com>
> Signed-off-by: Paul Moore <paul@paul-moore.com>
> ---
> kernel/auditsc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Merged to audit/stable-5.17 with a note that Richard posted a similar
patch. Assuming this passes the automated testing (it should, manual
testing was fine), this will be sent up to Linus soon.
--
paul-moore.com
--
Linux-audit mailing list
Linux-audit@redhat.com
https://listman.redhat.com/mailman/listinfo/linux-audit
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-09 23:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-09 21:11 [PATCH] audit: don't deref the syscall args when checking the openat2 open_how::flags Paul Moore
2022-02-09 23:45 ` Paul Moore
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).