Skip to content

Commit 7a82f89

Browse files
committed
audit: don't deref the syscall args when checking the openat2 open_how::flags
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(). Independent of this patch, Richard Guy Briggs posted a similar patch to the audit mailing list roughly 40 minutes after this patch was posted. Cc: stable@vger.kernel.org Fixes: 1c30e3a ("audit: add support for the openat2 syscall") Reported-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
1 parent f26d043 commit 7a82f89

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/auditsc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ static int audit_match_perm(struct audit_context *ctx, int mask)
185185
case AUDITSC_EXECVE:
186186
return mask & AUDIT_PERM_EXEC;
187187
case AUDITSC_OPENAT2:
188-
return mask & ACC_MODE((u32)((struct open_how *)ctx->argv[2])->flags);
188+
return mask & ACC_MODE((u32)ctx->openat2.flags);
189189
default:
190190
return 0;
191191
}

0 commit comments

Comments
 (0)