1. 21 10月, 2021 4 次提交
  2. 20 10月, 2021 6 次提交
  3. 16 10月, 2021 1 次提交
  4. 08 10月, 2021 1 次提交
    • B
      x86/fpu: Restore the masking out of reserved MXCSR bits · d298b035
      Borislav Petkov 提交于
      Ser Olmy reported a boot failure:
      
        init[1] bad frame in sigreturn frame:(ptrval) ip:b7c9fbe6 sp:bf933310 orax:ffffffff \
      	  in libc-2.33.so[b7bed000+156000]
        Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
        CPU: 0 PID: 1 Comm: init Tainted: G        W         5.14.9 #1
        Hardware name: Hewlett-Packard HP PC/HP Board, BIOS  JD.00.06 12/06/2001
        Call Trace:
         dump_stack_lvl
         dump_stack
         panic
         do_exit.cold
         do_group_exit
         get_signal
         arch_do_signal_or_restart
         ? force_sig_info_to_task
         ? force_sig
         exit_to_user_mode_prepare
         syscall_exit_to_user_mode
         do_int80_syscall_32
         entry_INT80_32
      
      on an old 32-bit Intel CPU:
      
        vendor_id       : GenuineIntel
        cpu family      : 6
        model           : 6
        model name      : Celeron (Mendocino)
        stepping        : 5
        microcode       : 0x3
      
      Ser bisected the problem to the commit in Fixes.
      
      tglx suggested reverting the rejection of invalid MXCSR values which
      this commit introduced and replacing it with what the old code did -
      simply masking them out to zero.
      
      Further debugging confirmed his suggestion:
      
        fpu->state.fxsave.mxcsr: 0xb7be13b4, mxcsr_feature_mask: 0xffbf
        WARNING: CPU: 0 PID: 1 at arch/x86/kernel/fpu/signal.c:384 __fpu_restore_sig+0x51f/0x540
      
      so restore the original behavior only for 32-bit kernels where you have
      ancient machines with buggy hardware. For 32-bit programs on 64-bit
      kernels, user space which supplies wrong MXCSR values is considered
      malicious so fail the sigframe restoration there.
      
      Fixes: 6f9866a1 ("x86/fpu/signal: Let xrstor handle the features to init")
      Reported-by: NSer Olmy <ser.olmy@protonmail.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Tested-by: NSer Olmy <ser.olmy@protonmail.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lkml.kernel.org/r/YVtA67jImg3KlBTw@zn.tnic
      d298b035
  5. 23 9月, 2021 1 次提交
  6. 15 9月, 2021 8 次提交
  7. 14 9月, 2021 1 次提交
  8. 24 6月, 2021 13 次提交
  9. 23 6月, 2021 2 次提交
  10. 22 6月, 2021 1 次提交
  11. 10 6月, 2021 1 次提交
  12. 09 6月, 2021 1 次提交
    • A
      x86/fpu: Invalidate FPU state after a failed XRSTOR from a user buffer · d8778e39
      Andy Lutomirski 提交于
      Both Intel and AMD consider it to be architecturally valid for XRSTOR to
      fail with #PF but nonetheless change the register state.  The actual
      conditions under which this might occur are unclear [1], but it seems
      plausible that this might be triggered if one sibling thread unmaps a page
      and invalidates the shared TLB while another sibling thread is executing
      XRSTOR on the page in question.
      
      __fpu__restore_sig() can execute XRSTOR while the hardware registers
      are preserved on behalf of a different victim task (using the
      fpu_fpregs_owner_ctx mechanism), and, in theory, XRSTOR could fail but
      modify the registers.
      
      If this happens, then there is a window in which __fpu__restore_sig()
      could schedule out and the victim task could schedule back in without
      reloading its own FPU registers. This would result in part of the FPU
      state that __fpu__restore_sig() was attempting to load leaking into the
      victim task's user-visible state.
      
      Invalidate preserved FPU registers on XRSTOR failure to prevent this
      situation from corrupting any state.
      
      [1] Frequent readers of the errata lists might imagine "complex
          microarchitectural conditions".
      
      Fixes: 1d731e73 ("x86/fpu: Add a fastpath to __fpu__restore_sig()")
      Signed-off-by: NAndy Lutomirski <luto@kernel.org>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Acked-by: NDave Hansen <dave.hansen@linux.intel.com>
      Acked-by: NRik van Riel <riel@surriel.com>
      Cc: stable@vger.kernel.org
      Link: https://lkml.kernel.org/r/20210608144345.758116583@linutronix.de
      d8778e39