]> git.ipfire.org Git - people/arne_f/kernel.git/commit
powerpc/tm: Fix userspace r13 corruption
authorMichael Neuling <mikey@neuling.org>
Mon, 24 Sep 2018 07:27:04 +0000 (17:27 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 20 Oct 2018 07:47:09 +0000 (09:47 +0200)
commit8725b910e72defbd96f068589f7eec560bb6c707
tree3e47e3d9273dbf11ec208223d912c679ef4ae530
parentb0b9016005506446128e68db4df6ee8d4aef6544
powerpc/tm: Fix userspace r13 corruption

[ Upstream commit cf13435b730a502e814c63c84d93db131e563f5f ]

When we treclaim we store the userspace checkpointed r13 to a scratch
SPR and then later save the scratch SPR to the user thread struct.

Unfortunately, this doesn't work as accessing the user thread struct
can take an SLB fault and the SLB fault handler will write the same
scratch SPRG that now contains the userspace r13.

To fix this, we store r13 to the kernel stack (which can't fault)
before we access the user thread struct.

Found by running P8 guest + powervm + disable_1tb_segments + TM. Seen
as a random userspace segfault with r13 looking like a kernel address.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Reviewed-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/kernel/tm.S