[PATCH 0/1] audit,io_uring,io-wq: call __audit_uring_exit for dummy contexts

From: Julian Orth
Date: Tue May 17 2022 - 06:35:54 EST


After porting my wayland compositor to io_uring, I noticed that my logs
were getting spammed with the following messages (tested with 5.17.7 and
5.18.0-rc7):

WARNING: CPU: 10 PID: 983 at kernel/auditsc.c:2041 __audit_syscall_entry+0x1>
Modules linked in: vrf wireguard curve25519_x86_64 libchacha20poly1305 chach>
ipmi_msghandler crypto_user ip_tables x_tables ext4 crc32c_generic crc16 mb>
CPU: 10 PID: 983 Comm: jay Tainted: G W 5.18.0-rc7-dirty #5 1>
Hardware name: Gigabyte Technology Co., Ltd. B450M DS3H/B450M DS3H-CF, BIOS >
RIP: 0010:__audit_syscall_entry+0x111/0x140
Code: e8 24 69 ff ff 48 8b 34 24 48 8b 54 24 08 85 c0 48 8b 4c 24 10 4c 8b 4>
RSP: 0018:ffffa6e480887de8 EFLAGS: 00010202
RAX: 0000000000000000 RBX: ffff969c92f22400 RCX: 0000000000000001
RDX: 0000000000000001 RSI: 0000000000000007 RDI: ffff969c8fa4c080
RBP: 00000000000001aa R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000002 R11: 0000000000000001 R12: 00000000000001aa
R13: ffffa6e480887f58 R14: 00000000000001aa R15: 0000000000000000
FS: 00007fefe020f040(0000) GS:ffff96a39ea80000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fefac429000 CR3: 0000000103674000 CR4: 00000000003506e0
Call Trace:
<TASK>
? get_signal+0x8d/0x990
syscall_trace_enter.constprop.0+0x121/0x1a0
do_syscall_64+0x36/0x80
? arch_do_signal_or_restart+0x44/0x750
? syscall_exit_to_user_mode+0x22/0x40
? exit_to_user_mode_prepare+0xd3/0x140
entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7fefe0d0b67d
Code: 5d c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 48 89 f8 48 89 f7 4>
RSP: 002b:00007fff383a6c58 EFLAGS: 00000246 ORIG_RAX: 00000000000001aa
RAX: ffffffffffffffda RBX: 00005595f1c25e00 RCX: 00007fefe0d0b67d
RDX: 0000000000000001 RSI: 0000000000000001 RDI: 0000000000000007
RBP: 00005595f1c1b700 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000246 R12: 0000000000000001
R13: 0000000000000005 R14: 00005595f1c21f60 R15: 0000000000000001
</TASK>
---[ end trace 0000000000000000 ]---
audit: unrecoverable error in audit_syscall_entry()

I traced this to the context not being reset after audit_uring_entry if
the created context was a dummy context. I am surprised that I would be
the first one to find this problem but maybe io_uring is rarely used on
systems where auditing is enabled or a recent kernel change elsewhere
caused this problem to surface.

Julian Orth (1):
audit,io_uring,io-wq: call __audit_uring_exit for dummy contexts

include/linux/audit.h | 2 +-
kernel/auditsc.c | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)

--
2.36.1