Skip to content

Commit 1179f17

Browse files
svens-s390hcahca
authored andcommitted
s390: fix fpu restore in entry.S
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: 0b0ed65 ("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]>
1 parent 78d732e commit 1179f17

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

arch/s390/kernel/asm-offsets.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ int main(void)
5353
/* stack_frame offsets */
5454
OFFSET(__SF_BACKCHAIN, stack_frame, back_chain);
5555
OFFSET(__SF_GPRS, stack_frame, gprs);
56-
OFFSET(__SF_EMPTY, stack_frame, empty1);
57-
OFFSET(__SF_SIE_CONTROL, stack_frame, empty1[0]);
58-
OFFSET(__SF_SIE_SAVEAREA, stack_frame, empty1[1]);
59-
OFFSET(__SF_SIE_REASON, stack_frame, empty1[2]);
60-
OFFSET(__SF_SIE_FLAGS, stack_frame, empty1[3]);
56+
OFFSET(__SF_EMPTY, stack_frame, empty1[0]);
57+
OFFSET(__SF_SIE_CONTROL, stack_frame, empty1[1]);
58+
OFFSET(__SF_SIE_SAVEAREA, stack_frame, empty1[2]);
59+
OFFSET(__SF_SIE_REASON, stack_frame, empty1[3]);
60+
OFFSET(__SF_SIE_FLAGS, stack_frame, empty1[4]);
6161
BLANK();
6262
OFFSET(__VDSO_GETCPU_VAL, vdso_per_cpu_data, getcpu_val);
6363
BLANK();

arch/s390/kernel/entry.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,7 @@ EXPORT_SYMBOL(save_fpu_regs)
10681068
* %r4
10691069
*/
10701070
load_fpu_regs:
1071+
stnsm __SF_EMPTY(%r15),0xfc
10711072
lg %r4,__LC_CURRENT
10721073
aghi %r4,__TASK_thread
10731074
TSTMSK __LC_CPU_FLAGS,_CIF_FPU
@@ -1099,6 +1100,7 @@ load_fpu_regs:
10991100
.Lload_fpu_regs_done:
11001101
ni __LC_CPU_FLAGS+7,255-_CIF_FPU
11011102
.Lload_fpu_regs_exit:
1103+
ssm __SF_EMPTY(%r15)
11021104
BR_EX %r14
11031105
.Lload_fpu_regs_end:
11041106
ENDPROC(load_fpu_regs)

0 commit comments

Comments
 (0)