aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Neuling <mikey@neuling.org>2013-06-09 07:23:19 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-25 17:07:21 -0400
commit81bcd526fea6383be0361b1827fcac656d276d57 (patch)
treea3d8ea1a27dffd215e05afc3769241abd02e4445
parentf6ff89fc47b05a061017200128ce154ae7165469 (diff)
powerpc/tm: Fix return of active 64bit signals
commit 87b4e5393af77f5cba124638f19f6c426e210aec upstream. Currently we only restore signals which are transactionally suspended but it's possible that the transaction can be restored even when it's active. Most likely this will result in a transactional rollback by the hardware as the transaction will have been doomed by an earlier treclaim. The current code is a legacy of earlier kernel implementations which did software rollback of active transactions in the kernel. That code has now gone but we didn't correctly fix up this part of the signals code which still makes assumptions based on having software rollback. This changes the signal return code to always restore both contexts on 64 bit signal return. It also ensures that the MSR TM bits are properly restored from the signal context which they are not currently. Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--arch/powerpc/kernel/signal_64.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 345947367ec0..887e99d85bc2 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -410,6 +410,10 @@ static long restore_tm_sigcontexts(struct pt_regs *regs,
410 410
411 /* get MSR separately, transfer the LE bit if doing signal return */ 411 /* get MSR separately, transfer the LE bit if doing signal return */
412 err |= __get_user(msr, &sc->gp_regs[PT_MSR]); 412 err |= __get_user(msr, &sc->gp_regs[PT_MSR]);
413 /* pull in MSR TM from user context */
414 regs->msr = (regs->msr & ~MSR_TS_MASK) | (msr & MSR_TS_MASK);
415
416 /* pull in MSR LE from user context */
413 regs->msr = (regs->msr & ~MSR_LE) | (msr & MSR_LE); 417 regs->msr = (regs->msr & ~MSR_LE) | (msr & MSR_LE);
414 418
415 /* The following non-GPR non-FPR non-VR state is also checkpointed: */ 419 /* The following non-GPR non-FPR non-VR state is also checkpointed: */
@@ -505,8 +509,6 @@ static long restore_tm_sigcontexts(struct pt_regs *regs,
505 tm_enable(); 509 tm_enable();
506 /* This loads the checkpointed FP/VEC state, if used */ 510 /* This loads the checkpointed FP/VEC state, if used */
507 tm_recheckpoint(&current->thread, msr); 511 tm_recheckpoint(&current->thread, msr);
508 /* The task has moved into TM state S, so ensure MSR reflects this: */
509 regs->msr = (regs->msr & ~MSR_TS_MASK) | __MASK(33);
510 512
511 /* This loads the speculative FP/VEC state, if used */ 513 /* This loads the speculative FP/VEC state, if used */
512 if (msr & MSR_FP) { 514 if (msr & MSR_FP) {
@@ -654,7 +656,7 @@ int sys_rt_sigreturn(unsigned long r3, unsigned long r4, unsigned long r5,
654#ifdef CONFIG_PPC_TRANSACTIONAL_MEM 656#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
655 if (__get_user(msr, &uc->uc_mcontext.gp_regs[PT_MSR])) 657 if (__get_user(msr, &uc->uc_mcontext.gp_regs[PT_MSR]))
656 goto badframe; 658 goto badframe;
657 if (MSR_TM_SUSPENDED(msr)) { 659 if (MSR_TM_ACTIVE(msr)) {
658 /* We recheckpoint on return. */ 660 /* We recheckpoint on return. */
659 struct ucontext __user *uc_transact; 661 struct ucontext __user *uc_transact;
660 if (__get_user(uc_transact, &uc->uc_link)) 662 if (__get_user(uc_transact, &uc->uc_link))