Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2982936imu; Sun, 9 Dec 2018 14:15:34 -0800 (PST) X-Google-Smtp-Source: AFSGD/XJmjdIxZ4hcipZJIA1eDbvJ4/cDozfn4eOlUKW7Xc+G0AAkmcx8lbWA6voOieLnjtoMT5D X-Received: by 2002:a17:902:8bc6:: with SMTP id r6mr9818992plo.67.1544393734348; Sun, 09 Dec 2018 14:15:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544393734; cv=none; d=google.com; s=arc-20160816; b=fNfGy2CD4iD16d9bfwU0Jk0Z5awTTrboJ5DyRFEF3wzA51DWwyByvPcuqYHtu/cUfg VFx4BjtgSSxjwfFRrIPE74krheZgS1e3oyWe69odo7EhrF/kCyiD8VpOf9E7dzZQk3oX l8GN5nVnB/4TA7aa0/FuwLXHxFXKJbsIpLVsTwbgB5ovCSshlg077dR4dxURFmHshQr0 1RxA7MJXnQTcP4PQ3LKTlyWRimKY6lOxyh7XQge4OzkeEU9b4IAk8g1eogBY60+Sr2Cc D5Gd2UfPkLDp1TmILIK9TkyDwzFazJRNOMOXqeNeYZFvXp41cMf5t1eqbOu8AUIBgROY nGAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=ZzFjS3mz2rzDwii9HyBXddmFj2lNkI92Iv8GjnaI8F8=; b=LqSbZ5EFYdJb1nZnIvFOEshk0jlllFgDtfxxLgMBWFuKzOQNtaU2Hf8JXkzFWtwbWW eDNfV/zO32R/IdAfCs7AEzONGMfjHt5LIWJ5zTweARe0GwFmATTjJUV0JyNrjtwY4hxi prWI99012mq+eu8gDyCZy3NlmC3FwmsOB0ATSKpzk3E20bSgm8AGDTeu7lC1+tbAxn/J BrFtb9AyeFLLGu3Val7PZxGoHFtdiQ2ckcdNpO257Ckqwff4Wlw7IuG2Fy0vFUl439MC /sK+3UvJl9xgC8yGKqGIVPXfwpZv6tkjhY/9nGY33MdxFjnp7ht1zlhGOR8nWT2AMMEx 8cuQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 9si9199561pfq.129.2018.12.09.14.15.19; Sun, 09 Dec 2018 14:15:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727225AbeLIWMz (ORCPT + 99 others); Sun, 9 Dec 2018 17:12:55 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:37830 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726320AbeLIWMw (ORCPT ); Sun, 9 Dec 2018 17:12:52 -0500 Received: from pub.yeoldevic.com ([81.174.156.145] helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gW73F-0002im-Lq; Sun, 09 Dec 2018 21:55:49 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gW72d-0003NE-1j; Sun, 09 Dec 2018 21:55:11 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Nicholas Piggin" , "Mahesh Salgaonkar" , "Michael Ellerman" Date: Sun, 09 Dec 2018 21:50:33 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 125/328] powerpc/pseries: Fix endianness while restoring of r3 in MCE handler. In-Reply-To: X-SA-Exim-Connect-IP: 81.174.156.145 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.62-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Mahesh Salgaonkar commit cd813e1cd7122f2c261dce5b54d1e0c97f80e1a5 upstream. During Machine Check interrupt on pseries platform, register r3 points RTAS extended event log passed by hypervisor. Since hypervisor uses r3 to pass pointer to rtas log, it stores the original r3 value at the start of the memory (first 8 bytes) pointed by r3. Since hypervisor stores this info and rtas log is in BE format, linux should make sure to restore r3 value in correct endian format. Without this patch when MCE handler, after recovery, returns to code that that caused the MCE may end up with Data SLB access interrupt for invalid address followed by kernel panic or hang. Severe Machine check interrupt [Recovered] NIP [d00000000ca301b8]: init_module+0x1b8/0x338 [bork_kernel] Initiator: CPU Error type: SLB [Multihit] Effective address: d00000000ca70000 cpu 0xa: Vector: 380 (Data SLB Access) at [c0000000fc7775b0] pc: c0000000009694c0: vsnprintf+0x80/0x480 lr: c0000000009698e0: vscnprintf+0x20/0x60 sp: c0000000fc777830 msr: 8000000002009033 dar: a803a30c000000d0 current = 0xc00000000bc9ef00 paca = 0xc00000001eca5c00 softe: 3 irq_happened: 0x01 pid = 8860, comm = insmod vscnprintf+0x20/0x60 vprintk_emit+0xb4/0x4b0 vprintk_func+0x5c/0xd0 printk+0x38/0x4c init_module+0x1c0/0x338 [bork_kernel] do_one_initcall+0x54/0x230 do_init_module+0x8c/0x248 load_module+0x12b8/0x15b0 sys_finit_module+0xa8/0x110 system_call+0x58/0x6c --- Exception: c00 (System Call) at 00007fff8bda0644 SP (7fffdfbfe980) is in userspace This patch fixes this issue. Fixes: a08a53ea4c97 ("powerpc/le: Enable RTAS events support") Reviewed-by: Nicholas Piggin Signed-off-by: Mahesh Salgaonkar Signed-off-by: Michael Ellerman Signed-off-by: Ben Hutchings --- arch/powerpc/platforms/pseries/ras.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/powerpc/platforms/pseries/ras.c +++ b/arch/powerpc/platforms/pseries/ras.c @@ -298,7 +298,7 @@ static struct rtas_error_log *fwnmi_get_ } savep = __va(regs->gpr[3]); - regs->gpr[3] = savep[0]; /* restore original r3 */ + regs->gpr[3] = be64_to_cpu(savep[0]); /* restore original r3 */ /* If it isn't an extended log we can use the per cpu 64bit buffer */ h = (struct rtas_error_log *)&savep[1];