diff mbox series

Fix powerpc/64: system call zero volatile registers when returning

Message ID 1583542224.q2gru1acfu.astroid@bobo.none (mailing list archive)
State Superseded
Headers show
Series Fix powerpc/64: system call zero volatile registers when returning | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/merge (ab326587bb5fb91cc97df9b9f48e9e1469f04621)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/next (247257b03b04398ca07da4bce3d17bee25d623cb)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch linus/master (63849c8f410717eb2e6662f3953ff674727303e7)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch powerpc/fixes (59bee45b9712c759ea4d3dcc4eff1752f3a66558)
snowpatch_ozlabs/apply_patch warning Failed to apply on branch linux-next (b86a6a241b7c60ca7a6ca4fb3c0d2aedbbf2c1b6)
snowpatch_ozlabs/apply_patch fail Failed to apply to any branch

Commit Message

Nicholas Piggin March 7, 2020, 12:54 a.m. UTC
Here's an incremental fix that can be folded into the patch.

Segher Boessenkool's on February 26, 2020 7:20 am:
> Hi!
> 
> On Wed, Feb 26, 2020 at 03:35:35AM +1000, Nicholas Piggin wrote:
>> Kernel addresses and potentially other sensitive data could be leaked
>> in volatile registers after a syscall.
> 
>>  	cmpdi	r3,0
>>  	bne	.Lsyscall_restore_regs
>> +	li	r0,0
>> +	li	r4,0
>> +	li	r5,0
>> +	li	r6,0
>> +	li	r7,0
>> +	li	r8,0
>> +	li	r9,0
>> +	li	r10,0
>> +	li	r11,0
>> +	li	r12,0
>> +	mtctr	r0
>> +	mtspr	SPRN_XER,r0
>>  .Lsyscall_restore_regs_cont:
> 
> What about LR?  Is that taken care of later?
> 
> This also deserves a big fat comment imo, it is very important after
> all, and not so obvious.
> 
> 
> Segher
> 

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 arch/powerpc/kernel/entry_64.S | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 0e2c56573a41..ea534375250b 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -135,6 +135,7 @@  END_FTR_SECTION_IFCLR(CPU_FTR_STCX_CHECKS_ADDRESS)
 
 	cmpdi	r3,0
 	bne	.Lsyscall_restore_regs
+	/* Zero volatile regs that may contain sensitive kernel data */
 	li	r0,0
 	li	r4,0
 	li	r5,0