Skip to content

Commit d3f4689

Browse files
borntraegerMartin Schwidefsky
authored andcommitted
s390/entry.S: fix spurious zeroing of r0
when a system call is interrupted we might call the critical section cleanup handler that re-does some of the operations. When we are between .Lsysc_vtime and .Lsysc_do_svc we might also redo the saving of the problem state registers r0-r7: .Lcleanup_system_call: [...] 0: # update accounting time stamp mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER # set up saved register r11 lg %r15,__LC_KERNEL_STACK la %r9,STACK_FRAME_OVERHEAD(%r15) stg %r9,24(%r11) # r11 pt_regs pointer # fill pt_regs mvc __PT_R8(64,%r9),__LC_SAVE_AREA_SYNC ---> stmg %r0,%r7,__PT_R0(%r9) The problem is now, that we might have already zeroed out r0. The fix is to move the zeroing of r0 after sysc_do_svc. Reported-by: Farhan Ali <[email protected]> Fixes: 7041d28 ("s390: scrub registers on kernel entry and KVM exit") Signed-off-by: Christian Borntraeger <[email protected]> Signed-off-by: Martin Schwidefsky <[email protected]>
1 parent 61e1827 commit d3f4689

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/s390/kernel/entry.S

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,13 +427,13 @@ ENTRY(system_call)
427427
UPDATE_VTIME %r8,%r9,__LC_SYNC_ENTER_TIMER
428428
BPENTER __TI_flags(%r12),_TIF_ISOLATE_BP
429429
stmg %r0,%r7,__PT_R0(%r11)
430-
# clear user controlled register to prevent speculative use
431-
xgr %r0,%r0
432430
mvc __PT_R8(64,%r11),__LC_SAVE_AREA_SYNC
433431
mvc __PT_PSW(16,%r11),__LC_SVC_OLD_PSW
434432
mvc __PT_INT_CODE(4,%r11),__LC_SVC_ILC
435433
stg %r14,__PT_FLAGS(%r11)
436434
.Lsysc_do_svc:
435+
# clear user controlled register to prevent speculative use
436+
xgr %r0,%r0
437437
# load address of system call table
438438
lg %r10,__THREAD_sysc_table(%r13,%r12)
439439
llgh %r8,__PT_INT_CODE+2(%r11)

0 commit comments

Comments
 (0)