1. 13 Feb, 2021 3 commits
    • Sven Schnelle's avatar
      s390: add stack for machine check handler · b61b1595
      Sven Schnelle authored
      The previous code used the normal kernel stack for machine checks.
      This is problematic when a machine check interrupts a system call
      or interrupt handler right at the beginning where registers are set up.
      
      Assume system_call is interrupted at the first instruction and a machine
      check is triggered. The machine check handler is called, checks the PSW
      to see whether it is coming from user space, notices that it is already
      in kernel mode but %r15 still contains the user space stack. This would
      lead to a kernel crash.
      
      There are basically two ways of fixing that: Either using the 'critical
      cleanup' approach which compares the address in the PSW to see whether
      it is already at a point where the stack has been set up, or use an extra
      stack for the machine check handler.
      
      For simplicity, we will go with the second approach and allocate an extra
      stack. This adds some memory overhead for large systems, but usually large
      system have plenty of memory so this isn't really a concern. But it keeps
      the mchk stack setup simple and less error prone.
      
      Fixes: 0b0ed657 ("s390: remove critical section cleanup from entry.S")
      Signed-off-by: default avatarSven Schnelle <svens@linux.ibm.com>
      Cc: <stable@kernel.org> # v5.8+
      Reviewed-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      b61b1595
    • Sven Schnelle's avatar
      s390: use WRITE_ONCE when re-allocating async stack · 64985c3a
      Sven Schnelle authored
      The code does:
      
      S390_lowcore.async_stack = new + STACK_INIT_OFFSET;
      
      But the compiler is free to first assign one value and
      add the other value later. If a IRQ would be coming in
      between these two operations, it would run with an invalid
      stack. Prevent this by using WRITE_ONCE.
      Signed-off-by: default avatarSven Schnelle <svens@linux.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      64985c3a
    • Sven Schnelle's avatar
      s390: open code SWITCH_KERNEL macro · b0d31159
      Sven Schnelle authored
      This is a preparation patch for two later bugfixes. In the past both
      int_handler and machine check handler used SWITCH_KERNEL to switch to
      the kernel stack. However, SWITCH_KERNEL doesn't work properly in machine
      check context. So instead of adding more complexity to this macro, just
      remove it.
      Signed-off-by: default avatarSven Schnelle <svens@linux.ibm.com>
      Cc: <stable@kernel.org> # v5.8+
      Reviewed-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
      b0d31159
  2. 09 Feb, 2021 34 commits
  3. 27 Jan, 2021 3 commits