]> git.baikalelectronics.ru Git - 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)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 25 Sep 2018 12:51:08 +0000 (22:51 +1000)
commit67bc5f67727e7d82821631e424ca69a2b5178de4
tree46d7d088182d0ca86b7f5b7b45ecbf5dfa82e66f
parentb1ec3df9497e01cf2e09c827a5c435846add1c01
powerpc/tm: Fix userspace r13 corruption

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>
arch/powerpc/kernel/tm.S