Alexey Gladkov
bbb6d0f3e1
ucounts: Increase ucounts reference counter before the security hook
We need to increment the ucounts reference counter befor security_prepare_creds()
because this function may fail and abort_creds() will try to decrement
this reference.
[ 96.465056][ T8641] FAULT_INJECTION: forcing a failure.
[ 96.465056][ T8641] name fail_page_alloc, interval 1, probability 0, space 0, times 0
[ 96.478453][ T8641] CPU: 1 PID: 8641 Comm: syz-executor668 Not tainted 5.14.0-rc6-syzkaller #0
[ 96.487215][ T8641] Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
[ 96.497254][ T8641] Call Trace:
[ 96.500517][ T8641] dump_stack_lvl+0x1d3/0x29f
[ 96.505758][ T8641] ? show_regs_print_info+0x12/0x12
[ 96.510944][ T8641] ? log_buf_vmcoreinfo_setup+0x498/0x498
[ 96.516652][ T8641] should_fail+0x384/0x4b0
[ 96.521141][ T8641] prepare_alloc_pages+0x1d1/0x5a0
[ 96.526236][ T8641] __alloc_pages+0x14d/0x5f0
[ 96.530808][ T8641] ? __rmqueue_pcplist+0x2030/0x2030
[ 96.536073][ T8641] ? lockdep_hardirqs_on_prepare+0x3e2/0x750
[ 96.542056][ T8641] ? alloc_pages+0x3f3/0x500
[ 96.546635][ T8641] allocate_slab+0xf1/0x540
[ 96.551120][ T8641] ___slab_alloc+0x1cf/0x350
[ 96.555689][ T8641] ? kzalloc+0x1d/0x30
[ 96.559740][ T8641] __kmalloc+0x2e7/0x390
[ 96.563980][ T8641] ? kzalloc+0x1d/0x30
[ 96.568029][ T8641] kzalloc+0x1d/0x30
[ 96.571903][ T8641] security_prepare_creds+0x46/0x220
[ 96.577174][ T8641] prepare_creds+0x411/0x640
[ 96.581747][ T8641] __sys_setfsuid+0xe2/0x3a0
[ 96.586333][ T8641] do_syscall_64+0x3d/0xb0
[ 96.590739][ T8641] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 96.596611][ T8641] RIP: 0033:0x445a69
[ 96.600483][ T8641] Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 15 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48
[ 96.620152][ T8641] RSP: 002b:00007f1054173318 EFLAGS: 00000246 ORIG_RAX: 000000000000007a
[ 96.628543][ T8641] RAX: ffffffffffffffda RBX: 00000000004ca4c8 RCX: 0000000000445a69
[ 96.636600][ T8641] RDX: 0000000000000010 RSI: 00007f10541732f0 RDI: 0000000000000000
[ 96.644550][ T8641] RBP: 00000000004ca4c0 R08: 0000000000000001 R09: 0000000000000000
[ 96.652500][ T8641] R10: 0000000000000000 R11: 0000000000000246 R12: 00000000004ca4cc
[ 96.660631][ T8641] R13: 00007fffffe0b62f R14: 00007f1054173400 R15: 0000000000022000
Fixes: 905ae01c4a ("Add a reference to ucounts for each cred")
Reported-by: syzbot+01985d7909f9468f013c@syzkaller.appspotmail.com
Signed-off-by: Alexey Gladkov <legion@kernel.org>
Link: https://lkml.kernel.org/r/97433b1742c3331f02ad92de5a4f07d673c90613.1629735352.git.legion@kernel.org
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
2021-08-23 16:13:04 -05:00
..
2021-07-13 08:19:13 -07:00
2021-07-14 09:19:06 -07:00
2021-05-07 00:26:34 -07:00
2021-07-12 11:03:35 -05:00
2021-07-16 11:30:26 +02:00
2021-05-31 10:14:49 +02:00
2021-06-29 17:29:11 -07:00
2021-06-22 11:07:18 -07:00
2021-07-09 15:35:13 +02:00
2021-07-04 12:29:16 -07:00
2021-04-27 18:14:38 -07:00
2021-07-11 11:06:09 -07:00
2021-07-08 11:48:21 -07:00
2021-06-29 12:07:18 -07:00
2021-07-06 15:53:12 -07:00
2021-07-11 11:13:57 -07:00
2021-07-15 01:23:54 +02:00
2021-07-23 08:46:02 -04:00
2021-05-02 00:43:35 +09:00
2020-12-15 22:46:15 -08:00
2021-05-07 00:26:33 -07:00
2021-02-23 10:25:27 -05:00
2021-06-08 22:18:35 -04:00
2020-12-03 14:58:35 +01:00
2021-03-22 15:23:32 -04:00
2021-06-10 20:59:05 -04:00
2021-03-22 15:23:32 -04:00
2021-06-10 20:59:05 -04:00
2021-01-24 14:27:16 +01:00
2021-04-08 16:04:20 -07:00
2021-06-29 12:23:02 -07:00
2021-07-08 11:48:22 -07:00
2021-08-23 16:13:04 -05:00
2021-05-12 11:43:25 +02:00
2021-06-28 20:39:26 -07:00
2020-12-15 22:46:19 -08:00
2021-08-23 16:10:42 -05:00
2021-06-18 11:43:08 +02:00
2021-06-28 11:45:29 -07:00
2021-05-27 04:01:50 +09:00
2021-02-26 09:41:03 -08:00
2021-07-02 12:08:10 -07:00
2021-06-10 10:00:08 +02:00
2021-07-05 10:46:20 +02:00
2021-07-08 11:48:22 -07:00
2020-12-15 19:36:48 -08:00
2021-06-28 22:43:05 +02:00
2020-11-02 18:00:20 -08:00
2021-07-01 11:06:04 -07:00
2021-05-07 00:26:32 -07:00
2021-02-22 12:33:26 +00:00
2021-05-07 00:26:33 -07:00
2021-07-11 11:06:09 -07:00
2021-06-29 17:29:11 -07:00
2021-05-02 00:43:35 +09:00
2021-01-19 10:24:45 +01:00
2021-01-19 10:24:45 +01:00
2021-07-08 11:48:22 -07:00
2020-12-14 16:40:27 -08:00
2021-07-01 11:06:04 -07:00
2020-12-17 13:01:31 -08:00
2020-12-14 16:40:27 -08:00
2020-12-15 19:36:48 -08:00
2021-04-10 13:35:54 +02:00
2021-06-18 11:43:09 +02:00
2021-06-21 13:08:36 +01:00
2020-12-15 22:46:18 -08:00
2020-11-25 18:52:35 +01:00
2021-05-14 19:41:32 -07:00
2021-04-14 18:04:09 +02:00
2021-07-06 12:37:55 -07:00
2020-12-01 10:30:28 +00:00
2021-06-28 12:49:52 -07:00
2021-07-08 11:43:24 -07:00
2021-05-06 15:33:49 +02:00
2021-07-25 11:06:37 -07:00
2021-06-18 11:43:07 +02:00
2021-07-05 10:46:33 +02:00
2021-03-23 16:01:58 +01:00
2021-07-08 11:48:21 -07:00
2021-06-28 20:39:26 -07:00
2021-06-23 16:41:24 -06:00
2021-07-02 12:08:10 -07:00
2021-04-30 11:20:42 -07:00
2020-11-16 08:08:54 -08:00
2021-03-08 14:22:28 -08:00
2021-07-23 08:46:22 -04:00
2021-08-09 15:45:02 -05:00
2021-05-07 00:26:34 -07:00
2021-05-09 13:07:03 -07:00
2021-06-28 20:39:26 -07:00
2021-04-30 14:14:02 -05:00
2021-07-03 11:41:14 -07:00
2021-01-26 11:16:34 +00:00
2021-06-29 10:53:46 -07:00
2021-05-20 12:58:30 -04:00