CVE-2022-48983

Severity CVSS v4.0:
Pending analysis
Type:
CWE-476 NULL Pointer Dereference
Publication date:
21/10/2024
Last modified:
25/10/2024

Description

In the Linux kernel, the following vulnerability has been resolved:<br /> <br /> io_uring: Fix a null-ptr-deref in io_tctx_exit_cb()<br /> <br /> Syzkaller reports a NULL deref bug as follows:<br /> <br /> BUG: KASAN: null-ptr-deref in io_tctx_exit_cb+0x53/0xd3<br /> Read of size 4 at addr 0000000000000138 by task file1/1955<br /> <br /> CPU: 1 PID: 1955 Comm: file1 Not tainted 6.1.0-rc7-00103-gef4d3ea40565 #75<br /> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2.el7 04/01/2014<br /> Call Trace:<br /> <br /> dump_stack_lvl+0xcd/0x134<br /> ? io_tctx_exit_cb+0x53/0xd3<br /> kasan_report+0xbb/0x1f0<br /> ? io_tctx_exit_cb+0x53/0xd3<br /> kasan_check_range+0x140/0x190<br /> io_tctx_exit_cb+0x53/0xd3<br /> task_work_run+0x164/0x250<br /> ? task_work_cancel+0x30/0x30<br /> get_signal+0x1c3/0x2440<br /> ? lock_downgrade+0x6e0/0x6e0<br /> ? lock_downgrade+0x6e0/0x6e0<br /> ? exit_signals+0x8b0/0x8b0<br /> ? do_raw_read_unlock+0x3b/0x70<br /> ? do_raw_spin_unlock+0x50/0x230<br /> arch_do_signal_or_restart+0x82/0x2470<br /> ? kmem_cache_free+0x260/0x4b0<br /> ? putname+0xfe/0x140<br /> ? get_sigframe_size+0x10/0x10<br /> ? do_execveat_common.isra.0+0x226/0x710<br /> ? lockdep_hardirqs_on+0x79/0x100<br /> ? putname+0xfe/0x140<br /> ? do_execveat_common.isra.0+0x238/0x710<br /> exit_to_user_mode_prepare+0x15f/0x250<br /> syscall_exit_to_user_mode+0x19/0x50<br /> do_syscall_64+0x42/0xb0<br /> entry_SYSCALL_64_after_hwframe+0x63/0xcd<br /> RIP: 0023:0x0<br /> Code: Unable to access opcode bytes at 0xffffffffffffffd6.<br /> RSP: 002b:00000000fffb7790 EFLAGS: 00000200 ORIG_RAX: 000000000000000b<br /> RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000<br /> RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000<br /> RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000<br /> R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000<br /> R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000<br /> <br /> Kernel panic - not syncing: panic_on_warn set ...<br /> <br /> This happens because the adding of task_work from io_ring_exit_work()<br /> isn&amp;#39;t synchronized with canceling all work items from eg exec. The<br /> execution of the two are ordered in that they are both run by the task<br /> itself, but if io_tctx_exit_cb() is queued while we&amp;#39;re canceling all<br /> work items off exec AND gets executed when the task exits to userspace<br /> rather than in the main loop in io_uring_cancel_generic(), then we can<br /> find current-&gt;io_uring == NULL and hit the above crash.<br /> <br /> It&amp;#39;s safe to add this NULL check here, because the execution of the two<br /> paths are done by the task itself.<br /> <br /> [axboe: add code comment and also put an explanation in the commit msg]

Vulnerable products and versions

CPE From Up to
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 5.12 (including) 5.15.83 (excluding)
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* 5.16 (including) 6.0.13 (excluding)
cpe:2.3:o:linux:linux_kernel:6.1:rc1:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.1:rc2:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.1:rc3:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.1:rc4:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.1:rc5:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.1:rc6:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.1:rc7:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.1:rc8:*:*:*:*:*:*