Linux: sched_ext: Fix use-after-free of a destroyed user DSQ by a deferred reenqueue
What fixes it
- 633f586329bfd9843bf8acf86c95353f4c16e22dLinuxCVE List
- 069403dff337feb192bfc70fb28ddc8a171e20c1LinuxCVE List
A fixed version on one release line is not the upgrade target for every line. Check your exact version and any vendor backports.
Description
In the Linux kernel, the following vulnerability has been resolved:
sched_ext: Fix use-after-free of a destroyed user DSQ by a deferred reenqueue
A deferred reenqueue can read a freed user DSQ. The request stays on its CPU's deferred list until run_deferred() takes it, and the RCU callback that frees the DSQ assumes that the grace period has flushed it, so exit_dsq() checks the per-CPU node without the deferred list lock. A grace period waits for readers in flight, not for a pending run_deferred(). A run_deferred() which starts after the grace period began can detach the request right before the callback looks and then read the freed DSQ's id.
Cancel the pending requests before the grace period instead. The irq work that frees the DSQ unlinks every CPU's request under the per-CPU deferred list lock, and schedule_dsq_reenq() ignores a new request under the same lock once the id is invalid. Only a run_deferred() that started before the grace period can hold a request, and it runs with IRQs disabled, so the grace period waits for it and nothing touches the DSQ after the callback.
Text from CVE List
Affected versions 6
- Linuxaffected: 84b1a0ea0b7c23dec240783a592e480780efe459 before 633f586329bfd9843bf8acf86c95353f4c16e22dCVE List
- Linuxaffected: 84b1a0ea0b7c23dec240783a592e480780efe459 before 069403dff337feb192bfc70fb28ddc8a171e20c1CVE List
- Linuxaffected: 7.1CVE List
- Linuxunaffected: all versions before 7.1CVE List
- Linuxunaffected: 7.2.13 through 7.2.*CVE List
- Linuxunaffected: 7.3CVE List