Re: general protection fault in io_uring_show_cred

From: Jens Axboe
Date: Thu Nov 05 2020 - 11:49:35 EST


On 11/5/20 9:14 AM, syzbot wrote:
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 4ef8451b Merge tag 'perf-tools-for-v5.10-2020-11-03' of gi..
> git tree: upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=12bf23a8500000
> kernel config: https://syzkaller.appspot.com/x/.config?x=61033507391c77ff
> dashboard link: https://syzkaller.appspot.com/bug?extid=a6d494688cdb797bdfce
> compiler: gcc (GCC) 10.1.0-syz 20200507
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=11022732500000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13649314500000
>
> The issue was bisected to:
>
> commit 1e6fa5216a0e59ef02e8b6b40d553238a3b81d49
> Author: Jens Axboe <axboe@xxxxxxxxx>
> Date: Thu Oct 15 14:46:24 2020 +0000
>
> io_uring: COW io_identity on mismatch

Gah, stupid braino in that patch. Below should fix it.

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 3d489cf31926..29f1417690d5 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -8974,7 +8974,8 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,
#ifdef CONFIG_PROC_FS
static int io_uring_show_cred(int id, void *p, void *data)
{
- const struct cred *cred = p;
+ struct io_identity *iod = p;
+ const struct cred *cred = iod->creds;
struct seq_file *m = data;
struct user_namespace *uns = seq_user_ns(m);
struct group_info *gi;

--
Jens Axboe