HomeFreeBSD

MFC 356840,357344: Add stricter checks on user changes to SSTATUS.

Description

MFC 356840,357344: Add stricter checks on user changes to SSTATUS.

356840:
Check for invalid sstatus values in set_mcontext().

Previously, this check was only in sys_sigreturn() which meant that
user applications could write invalid values to the register via
setcontext() or swapcontext().

357344:
Add stricter checks on user changes to SSTATUS.

Rather than trying to blacklist which bits userland can't write to via
sigreturn() or setcontext(), only permit changes to whitelisted bits.

  • Permit arbitrary writes to bits in the user-writable USTATUS register that shadows SSTATUS.
  • Ignore changes in write-only bits maintained by the CPU.
  • Ignore the user-supplied value of the FS field used to track floating point state and instead set it to a value matching the actions taken by set_fpcontext().

Details

Provenance
jhbAuthored on
Parents
rS360900: vfs_exports: Tighten bounds and assert consistency of numsecflavors
Branches
Unknown
Tags
Unknown