Jens Axboe
d1b69aabcd
io_uring: use current task creds instead of allocating a new one
...
commit 0b8c0ec7eedcd8f9f1a1f238d87f9b512b09e71a upstream.
syzbot reports:
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1 ] PREEMPT SMP KASAN
CPU: 0 PID: 9217 Comm: io_uring-sq Not tainted 5.4.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
RIP: 0010:creds_are_invalid kernel/cred.c:792 [inline]
RIP: 0010:__validate_creds include/linux/cred.h:187 [inline]
RIP: 0010:override_creds+0x9f/0x170 kernel/cred.c:550
Code: ac 25 00 81 fb 64 65 73 43 0f 85 a3 37 00 00 e8 17 ab 25 00 49 8d 7c
24 10 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84
c0 74 08 3c 03 0f 8e 96 00 00 00 41 8b 5c 24 10 bf
RSP: 0018:ffff88809c45fda0 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: 0000000043736564 RCX: ffffffff814f3318
RDX: 0000000000000002 RSI: ffffffff814f3329 RDI: 0000000000000010
RBP: ffff88809c45fdb8 R08: ffff8880a3aac240 R09: ffffed1014755849
R10: ffffed1014755848 R11: ffff8880a3aac247 R12: 0000000000000000
R13: ffff888098ab1600 R14: 0000000000000000 R15: 0000000000000000
FS: 0000000000000000(0000) GS:ffff8880ae800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffd51c40664 CR3: 0000000092641000 CR4: 00000000001406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
io_sq_thread+0x1c7/0xa20 fs/io_uring.c:3274
kthread+0x361/0x430 kernel/kthread.c:255
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
Modules linked in:
---[ end trace f2e1a4307fbe2245 ]---
RIP: 0010:creds_are_invalid kernel/cred.c:792 [inline]
RIP: 0010:__validate_creds include/linux/cred.h:187 [inline]
RIP: 0010:override_creds+0x9f/0x170 kernel/cred.c:550
Code: ac 25 00 81 fb 64 65 73 43 0f 85 a3 37 00 00 e8 17 ab 25 00 49 8d 7c
24 10 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84
c0 74 08 3c 03 0f 8e 96 00 00 00 41 8b 5c 24 10 bf
RSP: 0018:ffff88809c45fda0 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: 0000000043736564 RCX: ffffffff814f3318
RDX: 0000000000000002 RSI: ffffffff814f3329 RDI: 0000000000000010
RBP: ffff88809c45fdb8 R08: ffff8880a3aac240 R09: ffffed1014755849
R10: ffffed1014755848 R11: ffff8880a3aac247 R12: 0000000000000000
R13: ffff888098ab1600 R14: 0000000000000000 R15: 0000000000000000
FS: 0000000000000000(0000) GS:ffff8880ae800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffd51c40664 CR3: 0000000092641000 CR4: 00000000001406f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
which is caused by slab fault injection triggering a failure in
prepare_creds(). We don't actually need to create a copy of the creds
as we're not modifying it, we just need a reference on the current task
creds. This avoids the failure case as well, and propagates the const
throughout the stack.
Fixes: 181e448d8709 ("io_uring: async workers should inherit the user creds")
Reported-by: syzbot+5320383e16029ba057ff@syzkaller.appspotmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[ only use the io_uring.c portion of the patch - gregkh]
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-09 10:20:00 +01:00
..
2019-09-27 15:10:34 -07:00
2019-07-19 11:33:22 -07:00
2019-08-30 07:27:18 -07:00
2020-01-09 10:19:48 +01:00
2019-10-25 00:03:11 -04:00
2019-08-30 07:27:17 -07:00
2019-08-30 07:27:17 -07:00
2020-01-09 10:19:58 +01:00
2019-05-24 17:27:11 +02:00
2019-12-17 19:55:31 +01:00
2020-01-04 19:18:26 +01:00
2019-09-19 09:42:37 -07:00
2019-11-06 18:36:01 +01:00
2019-11-23 21:44:49 -05:00
2019-08-12 19:18:50 -07:00
2019-09-28 08:14:15 -07:00
2019-09-03 09:30:56 -04:00
2019-07-12 17:37:53 -07:00
2019-11-10 11:57:45 -05:00
2019-07-19 10:42:02 -07:00
2019-08-30 07:27:17 -07:00
2019-12-17 19:56:23 +01:00
2019-11-10 11:56:05 -05:00
2019-12-17 19:56:43 +01:00
2020-01-04 19:17:13 +01:00
2020-01-04 19:18:18 +01:00
2019-09-25 17:51:40 -07:00
2019-08-30 07:27:17 -07:00
2019-07-10 18:43:43 -07:00
2019-12-13 08:42:31 +01:00
2019-12-21 11:04:34 +01:00
2019-05-21 10:50:46 +02:00
2019-07-16 19:23:23 -07:00
2019-05-12 17:52:13 -04:00
2019-08-30 08:11:25 -07:00
2020-01-04 19:19:19 +01:00
2020-01-04 19:17:31 +01:00
2019-09-19 09:42:37 -07:00
2020-01-04 19:17:14 +01:00
2019-12-04 22:31:06 +01:00
2019-09-19 09:42:37 -07:00
2019-12-13 08:42:53 +01:00
2019-07-03 17:52:09 -04:00
2019-08-30 07:27:17 -07:00
2019-11-01 11:03:56 -04:00
2019-05-21 10:50:46 +02:00
2019-12-13 08:42:52 +01:00
2019-07-01 08:25:34 -07:00
2019-05-21 10:50:46 +02:00
2019-09-27 17:00:27 -07:00
2019-09-26 10:10:44 -07:00
2020-01-09 10:19:57 +01:00
2019-08-30 08:11:25 -07:00
2019-07-19 10:42:02 -07:00
2019-09-19 10:21:35 -07:00
2019-12-17 19:56:11 +01:00
2019-10-19 06:32:32 -04:00
2020-01-09 10:19:57 +01:00
2019-08-30 07:27:17 -07:00
2019-08-30 07:27:17 -07:00
2020-01-04 19:17:25 +01:00
2019-09-12 21:05:34 -04:00
2019-12-17 19:56:44 +01:00
2019-09-19 10:06:57 -07:00
2019-09-19 10:06:57 -07:00
2019-07-19 10:42:02 -07:00
2019-08-30 07:27:18 -07:00
2019-10-12 20:49:07 -04:00
2019-09-21 11:10:16 -07:00
2019-09-04 18:19:43 +02:00
2019-09-19 09:42:37 -07:00
2019-09-17 11:48:24 -04:00
2019-08-12 19:33:50 -07:00
2020-01-04 19:18:43 +01:00
2019-10-21 19:12:19 -04:00
2019-07-19 10:42:02 -07:00
2019-08-30 07:27:17 -07:00
2019-05-21 10:50:45 +02:00
2019-05-30 11:26:32 -07:00
2019-10-06 13:53:27 -07:00
2019-05-21 10:50:45 +02:00
2019-07-16 19:23:22 -07:00
2019-07-19 10:42:02 -07:00
2019-05-21 10:50:45 +02:00
2019-12-13 08:43:19 +01:00
2020-01-09 10:19:54 +01:00
2019-05-24 20:50:36 +02:00
2019-05-30 11:29:21 -07:00
2019-07-30 14:42:13 -07:00
2019-06-19 17:09:55 +02:00
2019-08-03 07:02:01 -07:00
2019-08-30 19:31:09 -04:00
2019-10-22 22:53:02 -07:00
2019-07-20 09:15:51 -07:00
2019-05-21 10:50:45 +02:00
2019-10-14 15:04:01 -07:00
2019-05-21 10:50:45 +02:00
2019-08-21 00:20:40 +02:00
2019-11-29 10:10:10 +01:00
2019-04-08 18:21:02 -05:00
2019-08-07 21:51:47 -04:00
2019-08-19 11:00:39 -04:00
2019-09-06 21:28:49 +02:00
2019-09-12 21:06:14 -04:00
2019-07-16 22:52:37 -04:00
2019-05-21 10:50:45 +02:00
2019-11-08 13:37:24 -07:00
2019-07-19 10:42:02 -07:00
2019-09-24 15:54:11 -07:00
2019-07-20 09:15:51 -07:00
2020-01-09 10:20:00 +01:00
2019-12-17 19:55:30 +01:00
2019-09-18 16:59:14 -07:00
2019-06-24 09:16:47 +10:00
2019-10-14 15:04:01 -07:00
2020-01-09 10:19:57 +01:00
2019-09-18 16:59:14 -07:00
2019-05-21 10:50:45 +02:00
2019-07-16 22:52:37 -04:00
2019-07-10 09:00:57 -06:00
2019-09-03 09:30:45 -04:00
2019-10-16 23:15:09 -04:00
2019-05-30 11:26:32 -07:00
2019-05-25 18:00:06 -04:00
2019-09-26 10:10:30 -07:00
2019-05-25 18:00:07 -04:00
2019-06-17 17:36:09 -04:00
2019-05-30 11:29:53 -07:00
2019-05-21 10:50:45 +02:00
2019-09-06 21:28:49 +02:00
2019-08-16 18:43:24 -07:00
2019-10-18 18:41:16 -04:00
2019-07-16 19:23:25 -07:00
2019-08-13 16:06:52 -07:00
2019-04-08 18:21:02 -05:00
2019-12-17 19:56:52 +01:00
2019-05-21 10:50:45 +02:00
2019-10-03 14:21:35 -07:00
2019-10-10 08:16:44 -07:00
2019-05-14 09:47:50 -07:00
2019-08-01 20:51:23 +02:00
2020-01-04 19:18:32 +01:00
2019-08-30 07:27:17 -07:00
2019-05-21 10:50:45 +02:00