Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2329855imm; Fri, 7 Sep 2018 14:47:06 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaRjaHiP9welTUcQPRL+GBcjJ4lVPetlnjqN5MAy5kQL2icSrwIlABLO4ygQLOhxj9aSHhE X-Received: by 2002:a63:6385:: with SMTP id x127-v6mr10438357pgb.413.1536356825988; Fri, 07 Sep 2018 14:47:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536356825; cv=none; d=google.com; s=arc-20160816; b=L4/HzufggZMCbGSuFD6mKAgaLTeyOzLpWMAKoixD1M7l7vPtFSUUQKpnxjEv5CO87O PMsqwqKRTcy0J0XIqDhi/+s9ZzV+oCXDaxYH+VK61Xf5KfEOT0PZJyfxvyq4puWoMD9q 0SClWrK3fYkDC30HrrVJszHpWDdVJm6WoW55aQkGaE0IaS4Or7BqRU6RYi+IbVijL5be MKmPNBOs04mLntqZbh5q24JOSQnEZi46DyfMEufgTi1kdFRUo/zMm/NhD5S2652kndAI 013ijSwmqU7ReY6VyHkPRrUoKpUHi+gPk5QF6RPhBGAYAMsmwQ/SduKWRGkgmOXLAW4N sENg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from; bh=bjxJMG1KEKOF1SPjHmFPzq8/ShOe+skLhIzfsupdJrE=; b=gaVlwcJHuoVoDq41hDeh+eZK7jm0mN+eO6JOIldglGmOTTrRvH9kG1qw8UOlGhx1b/ u1Vva4IoY7/eMzip3ZyQ84Oea6NAr7mWBtEBOcDjvrR6j9V/8Rn0/CpAf/s59IsKVoOf JQQSmA4aZ8o5GKfXaH9CHcALzN4mIokYlfP4zifwbe9Z1CZt07GXFSinKU7sOgU/JGjj HmzOt8AnNsWuTzrJ2GJMLdKVL99MNCEryqRwgHH8ox5AM2uAWzhs72yHbSp9h8UBxeLr gW6TGvWTHKUR82YueWfNseMqpmhMArdcg67BOSnhKYKDUy/rkMmmq1mGdH+87MIEZDSH fpvw== 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 e7-v6si9354098pgc.233.2018.09.07.14.46.50; Fri, 07 Sep 2018 14:47:05 -0700 (PDT) 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 S1731036AbeIHC16 (ORCPT + 99 others); Fri, 7 Sep 2018 22:27:58 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:57970 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728233AbeIHC15 (ORCPT ); Fri, 7 Sep 2018 22:27:57 -0400 Received: from localhost (ip-213-127-74-90.ip.prioritytelecom.net [213.127.74.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 83F13F36; Fri, 7 Sep 2018 21:45:01 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Piggin , Mahesh Salgaonkar , Michael Ellerman Subject: [PATCH 3.18 03/29] powerpc/pseries: Fix endianness while restoring of r3 in MCE handler. Date: Fri, 7 Sep 2018 23:10:24 +0200 Message-Id: <20180907210909.802057166@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180907210909.523240901@linuxfoundation.org> References: <20180907210909.523240901@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable 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") Cc: stable@vger.kernel.org # v3.15+ Reviewed-by: Nicholas Piggin Signed-off-by: Mahesh Salgaonkar Signed-off-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- 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];