[syzbot] kernel BUG in commit_creds

From: syzbot
Date: Thu Apr 14 2022 - 21:30:31 EST


Hello,

syzbot found the following issue on:

HEAD commit: 40354149f4d7 Add linux-next specific files for 20220414
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=1778a95cf00000
kernel config: https://syzkaller.appspot.com/x/.config?x=a44d62051576f6f5
dashboard link: https://syzkaller.appspot.com/bug?extid=60c52ca98513a8760a91
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1102d2e0f00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15e22af4f00000

The issue was bisected to:

commit 6bf9c47a398911e0ab920e362115153596c80432
Author: Jens Axboe <axboe@xxxxxxxxx>
Date: Tue Mar 29 16:10:08 2022 +0000

io_uring: defer file assignment

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=14f6da04f00000
final oops: https://syzkaller.appspot.com/x/report.txt?x=16f6da04f00000
console output: https://syzkaller.appspot.com/x/log.txt?x=12f6da04f00000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+60c52ca98513a8760a91@xxxxxxxxxxxxxxxxxxxxxxxxx
Fixes: 6bf9c47a3989 ("io_uring: defer file assignment")

------------[ cut here ]------------
kernel BUG at kernel/cred.c:456!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 3596 Comm: syz-executor409 Not tainted 5.18.0-rc2-next-20220414-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:commit_creds+0xf33/0x1360 kernel/cred.c:456
Code: 84 d2 0f 85 94 03 00 00 45 8b 74 24 2c 89 de 44 89 f7 e8 80 d8 29 00 41 39 de 0f 85 03 f8 ff ff e9 10 f8 ff ff e8 6d d5 29 00 <0f> 0b e8 66 d5 29 00 0f 0b e8 5f d5 29 00 0f 0b 48 89 cf e8 15 68
RSP: 0018:ffffc900039dfc58 EFLAGS: 00010293
RAX: 0000000000000000 RBX: dffffc0000000000 RCX: 0000000000000000
RDX: ffff8880186457c0 RSI: ffffffff81502c83 RDI: ffff888022af9700
RBP: ffff888022af9700 R08: 0000000000000000 R09: 0000000020a96400
R10: ffffffff83b21be5 R11: 0000000000000000 R12: ffff888022af9500
R13: ffff8880186457c0 R14: ffff8880186457c0 R15: ffffed10030c8bfc
FS: 00005555558b03c0(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005624d8428d20 CR3: 000000001e73f000 CR4: 00000000003506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
install_process_keyring security/keys/process_keys.c:306 [inline]
lookup_user_key+0x534/0x1270 security/keys/process_keys.c:653
__do_sys_add_key+0x1d3/0x430 security/keys/keyctl.c:126
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7fd586be1a69
Code: 28 c3 e8 2a 14 00 00 66 2e 0f 1f 84 00 00 00 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffe9ed85078 EFLAGS: 00000246 ORIG_RAX: 00000000000000f8
RAX: ffffffffffffffda RBX: 00007ffe9ed85098 RCX: 00007fd586be1a69
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00000000200000c0
RBP: 00007ffe9ed85090 R08: 00000000ffffffff R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:commit_creds+0xf33/0x1360 kernel/cred.c:456
Code: 84 d2 0f 85 94 03 00 00 45 8b 74 24 2c 89 de 44 89 f7 e8 80 d8 29 00 41 39 de 0f 85 03 f8 ff ff e9 10 f8 ff ff e8 6d d5 29 00 <0f> 0b e8 66 d5 29 00 0f 0b e8 5f d5 29 00 0f 0b 48 89 cf e8 15 68
RSP: 0018:ffffc900039dfc58 EFLAGS: 00010293
RAX: 0000000000000000 RBX: dffffc0000000000 RCX: 0000000000000000
RDX: ffff8880186457c0 RSI: ffffffff81502c83 RDI: ffff888022af9700
RBP: ffff888022af9700 R08: 0000000000000000 R09: 0000000020a96400
R10: ffffffff83b21be5 R11: 0000000000000000 R12: ffff888022af9500
R13: ffff8880186457c0 R14: ffff8880186457c0 R15: ffffed10030c8bfc
FS: 00005555558b03c0(0000) GS:ffff8880b9c00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005624d841fd90 CR3: 000000001e73f000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@xxxxxxxxxxxxxxxx.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches