powerpc/tm: Fix saving of TM SPRs in core dump
authorGustavo Romero <gromero@linux.vnet.ibm.com>
Wed, 19 Jul 2017 05:44:13 +0000 (01:44 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Aug 2017 15:49:30 +0000 (08:49 -0700)
commit8164692a2f66ecc08bcdc42955b6ce62d47637ec
treeaa24860402111ecf2aa263940449db9f7f276cf5
parent9ef8b23b94b98ec9b270e6fca5eadb97c96d809a
powerpc/tm: Fix saving of TM SPRs in core dump

commit cd63f3cf1d59b7ad8419eba1cac8f9126e79cc43 upstream.

Currently flush_tmregs_to_thread() does not save the TM SPRs (TFHAR,
TFIAR, TEXASR) to the thread struct, unless the process is currently
inside a suspended transaction.

If the process is core dumping, and the TM SPRs have changed since the
last time the process was context switched, then we will save stale
values of the TM SPRs to the core dump.

Fix it by saving the live register state to the thread struct in that
case.

Fixes: 08e1c01d6aed ("powerpc/ptrace: Enable support for TM SPR state")
Signed-off-by: Gustavo Romero <gromero@linux.vnet.ibm.com>
Reviewed-by: Cyril Bur <cyrilbur@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/kernel/ptrace.c