title: x86/fpu: Stop relying on userspace for info to fault in xsave buffer
description: In the Linux kernel, the following vulnerability has been resolved:
x86/fpu: Stop relying on userspace for info to fault in xsave buffer
Before this change, the expected size of the user space buffer was
taken from fx_sw->xstate_size. fx_sw->xstate_size can be changed
from user-space, so it is possible construct a sigreturn frame where:
* fx_sw->xstate_size is smaller than the size required by valid bits in
fx_sw->xfeatures.
* user-space unmaps parts of the sigrame fpu buffer so that not all of
the buffer required by xrstor is accessible.
In this case, xrstor tries to restore and accesses the unmapped area
which results in a fault. But fault_in_readable succeeds because buf +
fx_sw->xstate_size is within the still mapped area, so it goes back and
tries xrstor again. It will spin in this loop forever.
Instead, fault in the maximum size which can be touched by XRSTOR (taken
from fpstate->user_size).
[ dhansen: tweak subject / changelog ]
affected:
{
product: Linux
vendor: Linux
defaultStatus: unaffected
repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
versions:
version: fcb3635f5018, lessThan: 8bd3eee7720c, status: affected, versionType: git
version: fcb3635f5018, lessThan: 627339cccdc9, status: affected, versionType: git
version: fcb3635f5018, lessThan: b2479ab426ce, status: affected, versionType: git
version: fcb3635f5018, lessThan: 627e28cbb655, status: affected, versionType: git
version: fcb3635f5018, lessThan: d877550eaf2d, status: affected, versionType: git
}
{
product: Linux
vendor: Linux
defaultStatus: affected
repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
versions:
version: 5.14, status: affected
version: 0, lessThan: 5.14, status: unaffected, versionType: custom
version: 5.15.150, lessThanOrEqual: 5.15.*, status: unaffected, versionType: custom
version: 6.1.79, lessThanOrEqual: 6.1.*, status: unaffected, versionType: custom
version: 6.6.18, lessThanOrEqual: 6.6.*, status: unaffected, versionType: custom
version: 6.7.6, lessThanOrEqual: 6.7.*, status: unaffected, versionType: custom
version: 6.8, lessThanOrEqual: *, status: unaffected, versionType: original_commit_for_fix
}
