Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1707741

[PATCH 4.9 20/93] powerpc/tm: Fix saving of TM SPRs in core dump

From Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Newsgroups linux.kernel
Subject [PATCH 4.9 20/93] powerpc/tm: Fix saving of TM SPRs in core dump
Date 2017-08-09 20:40 +0200
Message-ID <ucE3G-2ye-53@gated-at.bofh.it> (permalink)
References <ucDKh-2qd-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


4.9-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Gustavo Romero <gromero@linux.vnet.ibm.com>

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 |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -127,12 +127,19 @@ static void flush_tmregs_to_thread(struc
 	 * If task is not current, it will have been flushed already to
 	 * it's thread_struct during __switch_to().
 	 *
-	 * A reclaim flushes ALL the state.
+	 * A reclaim flushes ALL the state or if not in TM save TM SPRs
+	 * in the appropriate thread structures from live.
 	 */
 
-	if (tsk == current && MSR_TM_SUSPENDED(mfmsr()))
-		tm_reclaim_current(TM_CAUSE_SIGNAL);
+	if (tsk != current)
+		return;
 
+	if (MSR_TM_SUSPENDED(mfmsr())) {
+		tm_reclaim_current(TM_CAUSE_SIGNAL);
+	} else {
+		tm_enable();
+		tm_save_sprs(&(tsk->thread));
+	}
 }
 #else
 static inline void flush_tmregs_to_thread(struct task_struct *tsk) { }

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 4.9 00/93] 4.9.42-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 20:40 +0200
  [PATCH 4.9 23/93] gpiolib: skip unwanted events, dont convert them to opposite edge Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 20:40 +0200
  [PATCH 4.9 19/93] timers: Fix overflow in get_next_timer_interrupt Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 20:40 +0200
  [PATCH 4.9 26/93] ARM: dts: armada-38x: Fix irq type for pca955 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 20:40 +0200
  [PATCH 4.9 06/93] iwlwifi: dvm: prevent an out of bounds access Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 20:40 +0200
  [PATCH 4.9 41/93] ipv4: ipv6: initialize treq->txhash in cookie_v[46]_check() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 20:40 +0200
  [PATCH 4.9 37/93] tcp_bbr: introduce bbr_bw_to_pacing_rate() helper Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 20:40 +0200
  [PATCH 4.9 10/93] device property: Make dev_fwnode() public Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 20:40 +0200
  [PATCH 4.9 40/93] tcp_bbr: init pacing rate on first RTT sample Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 20:40 +0200
  [PATCH 4.9 11/93] mmc: core: Fix access to HS400-ES devices Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 20:40 +0200
  [PATCH 4.9 21/93] powerpc/64: Fix __check_irq_replay missing decrementer interrupt Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 20:40 +0200
  [PATCH 4.9 36/93] tcp_bbr: cut pacing rate only if filled pipe Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 20:40 +0200
  [PATCH 4.9 12/93] mm, mprotect: flush TLB if potentially racing with a parallel reclaim leaving stale TLB entries Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 20:40 +0200
  [PATCH 4.9 24/93] ext4: fix SEEK_HOLE/SEEK_DATA for blocksize < pagesize Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 20:40 +0200
  [PATCH 4.9 20/93] powerpc/tm: Fix saving of TM SPRs in core dump Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 20:40 +0200
  [PATCH 4.9 33/93] f2fs: sanity check checkpoint segno and blkoff Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 20:40 +0200
  [PATCH 4.9 29/93] iscsi-target: Fix initial login PDU asynchronous socket close OOPs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 20:40 +0200
  [PATCH 4.9 35/93] [media] saa7164: fix double fetch PCIe access condition Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 20:40 +0200
  [PATCH 4.9 32/93] media: lirc: LIRC_GET_REC_RESOLUTION should return microseconds Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 20:40 +0200
  [PATCH 4.9 01/93] parisc: Handle vmas whose context is not current in flush_cache_range Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 20:40 +0200
  [PATCH 4.9 44/93] net: dsa: b53: Add missing ARL entries for BCM53125 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 20:40 +0200
  [PATCH 4.9 08/93] NFSv4: Fix EXCHANGE_ID corrupt verifier issue Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 20:40 +0200
  [PATCH 4.9 43/93] ipv6: avoid overflow of offset in ip6_find_1stfragopt Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-09 20:40 +0200
  Re: [PATCH 4.9 00/93] 4.9.42-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2017-08-10 02:20 +0200
  Re: [PATCH 4.9 00/93] 4.9.42-stable review Guenter Roeck <linux@roeck-us.net> - 2017-08-10 02:50 +0200
  Re: [PATCH 4.9 00/93] 4.9.42-stable review Sumit Semwal <sumit.semwal@linaro.org> - 2017-08-10 05:10 +0200

csiph-web