]> www.infradead.org Git - users/jedix/linux-maple.git/commit
*INCOMPLETE* x86/syscall: Clear unused extra registers on syscall entrance
authorKonrad Rzeszutek Wilk <konrad@kernel.org>
Thu, 4 Jan 2018 15:31:15 +0000 (10:31 -0500)
committerKirtikar Kashyap <kirtikar.kashyap@oracle.com>
Fri, 12 Jan 2018 18:19:56 +0000 (10:19 -0800)
commit44e762fdf5b98347deb80afefff131f1dda164d0
tree218c75a4ec66317cf1c32be4e0db8bc29cee43ef
parent589c20c50d8a1c83184accbce79ea075921bb13d
*INCOMPLETE* x86/syscall: Clear unused extra registers on syscall entrance

To prevent the unused registers %r12-%r15, %rbp and %rbx from
being used speculatively, we clear them upon syscall entrance
for code hygiene.

Orabug: 27344012
CVE: CVE-2017-5715

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
 Backport: We don't have the ORC stack which means our calling.h
 has the CTF code. And that has RESTORE_EXTRA_ARGS and ZERO_EXTRA_ARGS
 so there was no need to port that in. See
 commit 76f5df43cab5e765c0bd42289103e8f625813ae1
 x86/asm/entry/64: Always allocate a complete "struct pt_regs" on the kernel stack
 which added them.

 The ZERO_EXTRA_REGS (aka CLEAR_EXTRA_REGS) is not part of it.
 It ends up crashing the user-space.  Not sure why not.

 Which means this patch is pretty much useless - we don't clear
 any of the %r12-%r15, nor %rbp, nor %rbx at all.

 In other words we just save now more registers on the %esp
 and restore them.

 But somewhere we depend on these and need to fix that.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Reviewed-by: John Haxby <john.haxby@oracle.com>
Signed-off-by: Kirtikar Kashyap <kirtikar.kashyap@oracle.com>
arch/x86/kernel/entry_64.S