Received: by 10.192.165.148 with SMTP id m20csp350027imm; Fri, 20 Apr 2018 07:47:44 -0700 (PDT) X-Google-Smtp-Source: AIpwx48/wRNIYFP0JerHkCKJQnuYzYWtYJOHWU4Fc7+Gvn451+gqGczsiz9zuyCtUXZK6uvRnL40 X-Received: by 2002:a17:902:145:: with SMTP id 63-v6mr10518239plb.332.1524235664494; Fri, 20 Apr 2018 07:47:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524235664; cv=none; d=google.com; s=arc-20160816; b=qMO43jn2F3LjUZZyHMnBz0DKwY1y1465/lB5G2kDNjrwikPuS3qLhZoOedxRMTar2V ESa4+DDlmTA79s/4icQu/BKci1jn/SsVhaeS1neBneY+O03+/oDF6b72DvOCPsY407zC B7wfpYP8qrow5h7MyQyKV7k8TOvi/ZS0MH9mva4jcUWbVZVMsT6rBH5/N6CE6DUBTrkf yThG5kZ++oM4pW2oTQ6ZBlFzsOYxDWOBt443Va2ombPl6MawBM1AmUI0nHulfE5tAWTH hiU+5PM9YgvayFv0wGnzkg+MSzBnxgf5MqSVrfYcTIRrMRbjyAgxgSrWQcWZKELplXoU CoIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:references:in-reply-to:message-id :date:cc:to:from:arc-authentication-results; bh=3XVWQ5gnaQWoouyBjNK4/Aem0HpCbX3cw26FpnEYQXo=; b=mpVGmOW1wbd8wj4JNAqUwFIwUS+V7CFqOjiMm5YofqPlxEIG2pV+jPLj/Amp/YHCY1 idUtp30WUsj5oFVlRQDjo++DlHmdO3FJFtGRkXVs0C2adHd5+QFKs4r/MI0Ec+WFDDMR 6dp85XTn8MXhzuhhv/6n40Wwg+okl7T3CMDOUkygl2bqucv/7xyXDs0dg5xyz+TXbx4A rn7dH2g86DnxqjL4mGJmau5TPR46CUV7dH+yfs4MYoQmhS4bu7sneEf4tRr7RiXQLLC6 85tptrnKdeoG3xbaoF+HsIHjZ/BAC18PK2vmJkd7kmXkILkout5fQjdxqNf/HcQGcjUg M0hQ== 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 204si5451092pfu.274.2018.04.20.07.47.29; Fri, 20 Apr 2018 07:47:44 -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 S1755389AbeDTOqN (ORCPT + 99 others); Fri, 20 Apr 2018 10:46:13 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:46792 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755171AbeDTOqD (ORCPT ); Fri, 20 Apr 2018 10:46:03 -0400 Received: from in02.mta.xmission.com ([166.70.13.52]) by out03.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1f9XIY-00086a-0h; Fri, 20 Apr 2018 08:46:02 -0600 Received: from [97.119.174.25] (helo=x220.int.ebiederm.org) by in02.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1f9XE5-0006Ha-0n; Fri, 20 Apr 2018 08:41:25 -0600 From: "Eric W. Biederman" To: linux-arch@vger.kernel.org Cc: linux-kernel@vger.kernel.org, "Eric W. Biederman" , James Bottomley , Helge Deller , linux-parisc@vger.kernel.org Date: Fri, 20 Apr 2018 09:38:01 -0500 Message-Id: <20180420143811.9994-12-ebiederm@xmission.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <87604mhrnb.fsf@xmission.com> References: <87604mhrnb.fsf@xmission.com> X-XM-SPF: eid=1f9XE5-0006Ha-0n;;;mid=<20180420143811.9994-12-ebiederm@xmission.com>;;;hst=in02.mta.xmission.com;;;ip=97.119.174.25;;;frm=ebiederm@xmission.com;;;spf=neutral X-XM-AID: U2FsdGVkX19+7aR8UAOPisVR28mcInADRn2AZb7oPkk= X-SA-Exim-Connect-IP: 97.119.174.25 X-SA-Exim-Mail-From: ebiederm@xmission.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on sa05.xmission.com X-Spam-Level: **** X-Spam-Status: No, score=4.5 required=8.0 tests=ALL_TRUSTED,BAYES_50, DCC_CHECK_NEGATIVE,TR_Symld_Words,T_TM2_M_HEADER_IN_MSG,T_TooManySym_01, XMNoVowels,XMSubLong,XMSubMetaSx_00 autolearn=disabled version=3.4.1 X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP * 1.5 TR_Symld_Words too many words that have symbols inside * 0.7 XMSubLong Long Subject * 1.5 XMNoVowels Alpha-numberic number with no vowels * 0.0 T_TM2_M_HEADER_IN_MSG BODY: No description available. * 0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60% * [score: 0.5000] * -0.0 DCC_CHECK_NEGATIVE Not listed in DCC * [sa05 1397; Body=1 Fuz1=1 Fuz2=1] * 0.0 T_TooManySym_01 4+ unique symbols in subject * 1.0 XMSubMetaSx_00 1+ Sexy Words X-Spam-DCC: XMission; sa05 1397; Body=1 Fuz1=1 Fuz2=1 X-Spam-Combo: ****;linux-arch@vger.kernel.org X-Spam-Relay-Country: X-Spam-Timing: total 261 ms - load_scoreonly_sql: 0.05 (0.0%), signal_user_changed: 2.7 (1.0%), b_tie_ro: 1.90 (0.7%), parse: 1.33 (0.5%), extract_message_metadata: 26 (9.8%), get_uri_detail_list: 3.2 (1.2%), tests_pri_-1000: 14 (5.3%), tests_pri_-950: 1.60 (0.6%), tests_pri_-900: 1.32 (0.5%), tests_pri_-400: 24 (9.3%), check_bayes: 23 (8.8%), b_tokenize: 7 (2.8%), b_tok_get_all: 6 (2.4%), b_comp_prob: 2.9 (1.1%), b_tok_touch_all: 3.6 (1.4%), b_finish: 0.83 (0.3%), tests_pri_0: 182 (69.8%), check_dkim_signature: 0.56 (0.2%), check_dkim_adsp: 4.7 (1.8%), tests_pri_500: 4.3 (1.6%), rewrite_mail: 0.00 (0.0%) Subject: [REVIEW][PATCH 12/22] signal/parisc: Use force_sig_mceerr where appropriate X-Spam-Flag: No X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in02.mta.xmission.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In do_page_fault where an mceerr is generated stop and call force_sig_mceerr. Keeping the mcerr handling logic out of the force_sig_info call below. This ensures that only and always in the mcerr case is lsb interesting. This ensures setting set si_lsb in the future won't accidentally stomp another siginfo field in the non mcerr case. Cc: James Bottomley Cc: Helge Deller Cc: linux-parisc@vger.kernel.org Signed-off-by: "Eric W. Biederman" --- arch/parisc/mm/fault.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/arch/parisc/mm/fault.c b/arch/parisc/mm/fault.c index 657b35096bd8..51215b0048ef 100644 --- a/arch/parisc/mm/fault.c +++ b/arch/parisc/mm/fault.c @@ -354,7 +354,6 @@ void do_page_fault(struct pt_regs *regs, unsigned long code, if (user_mode(regs)) { struct siginfo si; - unsigned int lsb = 0; clear_siginfo(&si); switch (code) { @@ -391,26 +390,27 @@ void do_page_fault(struct pt_regs *regs, unsigned long code, #ifdef CONFIG_MEMORY_FAILURE if (fault & (VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE)) { + unsigned int lsb = 0; printk(KERN_ERR "MCE: Killing %s:%d due to hardware memory corruption fault at %08lx\n", tsk->comm, tsk->pid, address); - si.si_signo = SIGBUS; - si.si_code = BUS_MCEERR_AR; + /* + * Either small page or large page may be poisoned. + * In other words, VM_FAULT_HWPOISON_LARGE and + * VM_FAULT_HWPOISON are mutually exclusive. + */ + if (fault & VM_FAULT_HWPOISON_LARGE) + lsb = hstate_index_to_shift(VM_FAULT_GET_HINDEX(fault)); + else if (fault & VM_FAULT_HWPOISON) + lsb = PAGE_SHIFT; + + force_sig_mceerr(BUS_MCEERR_AR, (void __user *) address, + lsb, current); + return; } #endif - /* - * Either small page or large page may be poisoned. - * In other words, VM_FAULT_HWPOISON_LARGE and - * VM_FAULT_HWPOISON are mutually exclusive. - */ - if (fault & VM_FAULT_HWPOISON_LARGE) - lsb = hstate_index_to_shift(VM_FAULT_GET_HINDEX(fault)); - else if (fault & VM_FAULT_HWPOISON) - lsb = PAGE_SHIFT; - else - show_signal_msg(regs, code, address, tsk, vma); - si.si_addr_lsb = lsb; + show_signal_msg(regs, code, address, tsk, vma); si.si_errno = 0; si.si_addr = (void __user *) address; -- 2.14.1