CVE-2025-38100
Severity CVSS v4.0:
Pending analysis
Type:
Unavailable / Other
Publication date:
03/07/2025
Last modified:
03/07/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
x86/iopl: Cure TIF_IO_BITMAP inconsistencies<br />
<br />
io_bitmap_exit() is invoked from exit_thread() when a task exists or<br />
when a fork fails. In the latter case the exit_thread() cleans up<br />
resources which were allocated during fork().<br />
<br />
io_bitmap_exit() invokes task_update_io_bitmap(), which in turn ends up<br />
in tss_update_io_bitmap(). tss_update_io_bitmap() operates on the<br />
current task. If current has TIF_IO_BITMAP set, but no bitmap installed,<br />
tss_update_io_bitmap() crashes with a NULL pointer dereference.<br />
<br />
There are two issues, which lead to that problem:<br />
<br />
1) io_bitmap_exit() should not invoke task_update_io_bitmap() when<br />
the task, which is cleaned up, is not the current task. That&#39;s a<br />
clear indicator for a cleanup after a failed fork().<br />
<br />
2) A task should not have TIF_IO_BITMAP set and neither a bitmap<br />
installed nor IOPL emulation level 3 activated.<br />
<br />
This happens when a kernel thread is created in the context of<br />
a user space thread, which has TIF_IO_BITMAP set as the thread<br />
flags are copied and the IO bitmap pointer is cleared.<br />
<br />
Other than in the failed fork() case this has no impact because<br />
kernel threads including IO workers never return to user space and<br />
therefore never invoke tss_update_io_bitmap().<br />
<br />
Cure this by adding the missing cleanups and checks:<br />
<br />
1) Prevent io_bitmap_exit() to invoke task_update_io_bitmap() if<br />
the to be cleaned up task is not the current task.<br />
<br />
2) Clear TIF_IO_BITMAP in copy_thread() unconditionally. For user<br />
space forks it is set later, when the IO bitmap is inherited in<br />
io_bitmap_share().<br />
<br />
For paranoia sake, add a warning into tss_update_io_bitmap() to catch<br />
the case, when that code is invoked with inconsistent state.
Impact
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/2cfcbe1554c119402e7382de974c26b0549899fe
- https://git.kernel.org/stable/c/2dace5e016c991424a3dc6e83b1ae5dca8992d08
- https://git.kernel.org/stable/c/73cfcc8445585b8af7e18be3c9246b851fdf336c
- https://git.kernel.org/stable/c/8b68e978718f14fdcb080c2a7791c52a0d09bc6d
- https://git.kernel.org/stable/c/aa5ce1485562f20235b4c759eee5ab0c41d2c220
- https://git.kernel.org/stable/c/b3b3b6366dc8eb5b22edba9adc4bff3cdacfd64c
- https://git.kernel.org/stable/c/d64b7b05a827f98d068f412969eef65489b0cf03