From patchwork Mon Jul 25 04:26:51 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 652162 X-Patchwork-Delegate: benh@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3ryStD3G8pz9t1K for ; Mon, 25 Jul 2016 14:28:20 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=nCTxxyJ6; dkim-atps=neutral Received: from ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3ryStD2GmYzDrF8 for ; Mon, 25 Jul 2016 14:28:20 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=nCTxxyJ6; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-pf0-x241.google.com (mail-pf0-x241.google.com [IPv6:2607:f8b0:400e:c00::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3rySrk6fsNzDqdr for ; Mon, 25 Jul 2016 14:27:02 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=nCTxxyJ6; dkim-atps=neutral Received: by mail-pf0-x241.google.com with SMTP id y134so11146170pfg.3 for ; Sun, 24 Jul 2016 21:27:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id; bh=nssKXuR4zg3JN3PhN3a01D0w0dD+HXF7Or0whEkxz/I=; b=nCTxxyJ611JKF+sUxTbCRz9OHwMaa5ZbT6qPPzRUdB7zme9Pz66jEyMTPrLVCElP/g rQbpmr1jKo77E+PEq0AYXWZrV/poN4USdyf8OECxvySLTDpKuZeGURsYJEiXGLVSQvhS Fg1sCsu4iotio9CGmlXTDCgg0cgZrJ9p3ErGJcMkyt3h2Qw7rxh4iEtDXotAhmcNiTcS QcfKlMypxSdVLoAnVHDMPfcFnXWH03Sv6ACAgz/4ZlpgaFTeMboVzris24ogTXWtxFr1 1ytRum6MQ7z+mRUsVYDlrfEaBCzfH7Kkhu5x/VmcXnOiBA3Psd1GGWpO8avae3UtZdYk D0MQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=nssKXuR4zg3JN3PhN3a01D0w0dD+HXF7Or0whEkxz/I=; b=mFB7AL2+JW2atWjwrm5EXLUITxtZn8vsL9MfhxZTLY4tR5Miyq+g9PR5jWgXtpxu5A KoFJYM5hSxLhor2GSiubrCy+8Sscg6d27ckAiPFWw6B4vVeZ/A8xrzZQYmDvSSF0b8q5 TaK04YAsetzKN6K205lt9OJkxg5EEtm3S4QsiDo4CPCirY9oQP3vi+eFcO+Dgm1Uhoev B9kUys7NRDteSOHUlWyxwYN1U3iuymKd/xPVZfAMzCz/Xz82VEiGvt9eMeqN73WfHyW2 wOhMStvtsARCXmD1z48Ak2MlIzzpxZFj8XCj0sRBSpYAbKb1A/nQoidG/NYXY2Ca8sWN pyfA== X-Gm-Message-State: AEkoousLZ26wWSzOTOd//VOwpzAA5Pphchf2OgeUwCUbaSqGFt3SR2QCfwuWIgCb6QyCAA== X-Received: by 10.98.84.65 with SMTP id i62mr25832726pfb.72.1469420820967; Sun, 24 Jul 2016 21:27:00 -0700 (PDT) Received: from roar.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id u7sm32810144paz.45.2016.07.24.21.26.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 24 Jul 2016 21:27:00 -0700 (PDT) From: Nicholas Piggin To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH] powerpc/tm: do not use r13 for tabort_syscall Date: Mon, 25 Jul 2016 14:26:51 +1000 Message-Id: <1469420811-10951-1-git-send-email-npiggin@gmail.com> X-Mailer: git-send-email 2.8.1 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" tabort_syscall runs with RI=1, so a nested recoverable machine check will load the paca into r13 and overwrite what we loaded it with, because exceptions returning to privileged mode do not restore r13. Fixes: b4b56f9ecab4 (powerpc/tm: Abort syscalls in active transactions) Cc: stable@vger.kernel.org Signed-off-by: Nick Piggin --- arch/powerpc/kernel/entry_64.S | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S index 73e461a..96fd031 100644 --- a/arch/powerpc/kernel/entry_64.S +++ b/arch/powerpc/kernel/entry_64.S @@ -368,13 +368,13 @@ END_FTR_SECTION_IFSET(CPU_FTR_HAS_PPR) tabort_syscall: /* Firstly we need to enable TM in the kernel */ mfmsr r10 - li r13, 1 - rldimi r10, r13, MSR_TM_LG, 63-MSR_TM_LG + li r9, 1 + rldimi r10, r9, MSR_TM_LG, 63-MSR_TM_LG mtmsrd r10, 0 /* tabort, this dooms the transaction, nothing else */ - li r13, (TM_CAUSE_SYSCALL|TM_CAUSE_PERSISTENT) - TABORT(R13) + li r9, (TM_CAUSE_SYSCALL|TM_CAUSE_PERSISTENT) + TABORT(R9) /* * Return directly to userspace. We have corrupted user register state, @@ -382,8 +382,8 @@ tabort_syscall: * resume after the tbegin of the aborted transaction with the * checkpointed register state. */ - li r13, MSR_RI - andc r10, r10, r13 + li r9, MSR_RI + andc r10, r10, r9 mtmsrd r10, 1 mtspr SPRN_SRR0, r11 mtspr SPRN_SRR1, r12