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)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 28 Jul 2017 05:56:06 +0000 (15:56 +1000)
commitcd63f3cf1d59b7ad8419eba1cac8f9126e79cc43
treea654af0dfd9be1b77674292f8fa94471275440e2
parentc9c98bc5cc2ab4e0d5c9ad58286fa7e1670dfded
powerpc/tm: Fix saving of TM SPRs in core dump

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")
Cc: stable@vger.kernel.org # v4.8+
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>
arch/powerpc/kernel/ptrace.c