]> Git Repo - linux.git/commitdiff
s390: fix fpu restore in entry.S
authorSven Schnelle <[email protected]>
Fri, 20 Nov 2020 13:17:52 +0000 (14:17 +0100)
committerHeiko Carstens <[email protected]>
Mon, 23 Nov 2020 10:52:13 +0000 (11:52 +0100)
We need to disable interrupts in load_fpu_regs(). Otherwise an
interrupt might come in after the registers are loaded, but before
CIF_FPU is cleared in load_fpu_regs(). When the interrupt returns,
CIF_FPU will be cleared and the registers will never be restored.

The entry.S code usually saves the interrupt state in __SF_EMPTY on the
stack when disabling/restoring interrupts. sie64a however saves the pointer
to the sie control block in __SF_SIE_CONTROL, which references the same
location.  This is non-obvious to the reader. To avoid thrashing the sie
control block pointer in load_fpu_regs(), move the __SIE_* offsets eight
bytes after __SF_EMPTY on the stack.

Cc: <[email protected]> # 5.8
Fixes: 0b0ed657fe00 ("s390: remove critical section cleanup from entry.S")
Reported-by: Pierre Morel <[email protected]>
Signed-off-by: Sven Schnelle <[email protected]>
Acked-by: Christian Borntraeger <[email protected]>
Reviewed-by: Heiko Carstens <[email protected]>
Signed-off-by: Heiko Carstens <[email protected]>
arch/s390/kernel/asm-offsets.c
arch/s390/kernel/entry.S

index 2012c1cf0853aff23a7778afb0fbbb5315883efb..483051e10db3890cb2ca58a9fe12ee5344438495 100644 (file)
@@ -53,11 +53,11 @@ int main(void)
        /* stack_frame offsets */
        OFFSET(__SF_BACKCHAIN, stack_frame, back_chain);
        OFFSET(__SF_GPRS, stack_frame, gprs);
-       OFFSET(__SF_EMPTY, stack_frame, empty1);
-       OFFSET(__SF_SIE_CONTROL, stack_frame, empty1[0]);
-       OFFSET(__SF_SIE_SAVEAREA, stack_frame, empty1[1]);
-       OFFSET(__SF_SIE_REASON, stack_frame, empty1[2]);
-       OFFSET(__SF_SIE_FLAGS, stack_frame, empty1[3]);
+       OFFSET(__SF_EMPTY, stack_frame, empty1[0]);
+       OFFSET(__SF_SIE_CONTROL, stack_frame, empty1[1]);
+       OFFSET(__SF_SIE_SAVEAREA, stack_frame, empty1[2]);
+       OFFSET(__SF_SIE_REASON, stack_frame, empty1[3]);
+       OFFSET(__SF_SIE_FLAGS, stack_frame, empty1[4]);
        BLANK();
        OFFSET(__VDSO_GETCPU_VAL, vdso_per_cpu_data, getcpu_val);
        BLANK();
index 5346545b9860ba65f9b92c61e0e524d500fec94d..26bb0603c5a18e5b2db18849af938f803cebd50a 100644 (file)
@@ -1068,6 +1068,7 @@ EXPORT_SYMBOL(save_fpu_regs)
  *     %r4
  */
 load_fpu_regs:
+       stnsm   __SF_EMPTY(%r15),0xfc
        lg      %r4,__LC_CURRENT
        aghi    %r4,__TASK_thread
        TSTMSK  __LC_CPU_FLAGS,_CIF_FPU
@@ -1099,6 +1100,7 @@ load_fpu_regs:
 .Lload_fpu_regs_done:
        ni      __LC_CPU_FLAGS+7,255-_CIF_FPU
 .Lload_fpu_regs_exit:
+       ssm     __SF_EMPTY(%r15)
        BR_EX   %r14
 .Lload_fpu_regs_end:
 ENDPROC(load_fpu_regs)
This page took 0.057244 seconds and 4 git commands to generate.