Received: by 2002:ac0:e34a:0:0:0:0:0 with SMTP id g10csp485450imn; Wed, 27 Jul 2022 11:31:14 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tTglMnrkezHOGSIDcuw8QxemjlZx+M9H0vepcmI8nGJWjoCjn8kwUcve9uu4X9lV5gSqh+ X-Received: by 2002:aa7:db9a:0:b0:43a:76bf:5401 with SMTP id u26-20020aa7db9a000000b0043a76bf5401mr24811409edt.244.1658946673801; Wed, 27 Jul 2022 11:31:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658946673; cv=none; d=google.com; s=arc-20160816; b=BgqWZ5XU9ALkTVyZjoNvUnIbA93FZ4WgtNhAsEJ3rzchxBKcGsQO8yULZei1mY6FMO eW+BPVtW3TyurqQA0BrlF7AufUIP6MrVDW1f9T0w4SdHvTyue5VAW3L8dtfOYJG0G1QL vjmykuPz/UvF/Tc0RAqsw9r3MDim42wpw0SGAgqexn/wzSXzUumRiEDW2sJX2ffG9Des 7PbAsv65flbETKL0g5gxdswxr8LxHkqxHAd91/ux1OG3BO0+3f+lUcHuV9tMOICbvIqc w1i1vBADDCaOGXLTtVqvSfydd6qT2X2o48Buaf73SxDKXaJ4iXI8lUJGk4idBIpWiZnw VDvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=12mzLcDtqr0UC/MHO3y3rtBuUSpWkZBRFPtvndur90Q=; b=A+BJtQJ4BGi0sTWUB/+bnPHXxAY//aJznd741yk151AWH7CHbQ+3rpC1UPNKLlqFuE I0j5eJ9xRHlph4i0chuYHlyAD3pFx+C4LcwXV1xCSxRhFz3VtBnlpUNAmfmC06AIdt/o /rW7f6cZZckV9QZl1mT3SrRhwW34vEDAha4VMJabCddmwOOb+ydPRpetbvfPi0W9jYEq +Bk77uaeuhGy2DkyuH6QkGVs+9UeF76IjQM2puN11gz2kqoP8+6BiO5UihPCL/csIF0b TUkGAB8zuoJMNK8K+/CUspD62T6+wLn7B6IJ7KqgdAceO7DCDxa/ArUeTDjFsmpApGQe W+sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vLXBbmnu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dk1-20020a170906f0c100b00711f4c750basi17108118ejb.940.2022.07.27.11.30.48; Wed, 27 Jul 2022 11:31:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=vLXBbmnu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241864AbiG0RWR (ORCPT + 99 others); Wed, 27 Jul 2022 13:22:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242133AbiG0RTu (ORCPT ); Wed, 27 Jul 2022 13:19:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D99F5244F; Wed, 27 Jul 2022 09:45:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3E94860D3B; Wed, 27 Jul 2022 16:45:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46D4AC433C1; Wed, 27 Jul 2022 16:45:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1658940302; bh=gKdiTShjdV4qFP0ikFKCW4jh3SAdJPkniJlckYo/GPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vLXBbmnupgUSEeMSOFFFELWDmipgUZwxBe0ej3kvBczLa/7PcyDMMOf0QozCE7L/K XWfs7glOCjFvuLgKMJ4wixQQspL5vEnIcfKp1UODcbLAY2Ax74nDhilFIlWi4NqKuy lUwdaIC7L/cvJvUsNWi5POkx8RAYSylSPaHEHcnM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Borislav Petkov , Sasha Levin Subject: [PATCH 5.15 145/201] x86/extable: Provide EX_TYPE_DEFAULT_MCE_SAFE and EX_TYPE_FAULT_MCE_SAFE Date: Wed, 27 Jul 2022 18:10:49 +0200 Message-Id: <20220727161033.823638585@linuxfoundation.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220727161026.977588183@linuxfoundation.org> References: <20220727161026.977588183@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Gleixner [ Upstream commit 2cadf5248b9316d3c8af876e795d61c55476f6e9 ] Provide exception fixup types which can be used to identify fixups which allow in kernel #MC recovery and make them invoke the existing handlers. These will be used at places where #MC recovery is handled correctly by the caller. Signed-off-by: Thomas Gleixner Signed-off-by: Borislav Petkov Link: https://lkml.kernel.org/r/20210908132525.269689153@linutronix.de Signed-off-by: Sasha Levin --- arch/x86/include/asm/extable_fixup_types.h | 3 +++ arch/x86/kernel/cpu/mce/severity.c | 2 ++ arch/x86/mm/extable.c | 2 ++ 3 files changed, 7 insertions(+) diff --git a/arch/x86/include/asm/extable_fixup_types.h b/arch/x86/include/asm/extable_fixup_types.h index 0adc117618e6..409524d5d2eb 100644 --- a/arch/x86/include/asm/extable_fixup_types.h +++ b/arch/x86/include/asm/extable_fixup_types.h @@ -16,4 +16,7 @@ #define EX_TYPE_WRMSR_IN_MCE 10 #define EX_TYPE_RDMSR_IN_MCE 11 +#define EX_TYPE_DEFAULT_MCE_SAFE 12 +#define EX_TYPE_FAULT_MCE_SAFE 13 + #endif diff --git a/arch/x86/kernel/cpu/mce/severity.c b/arch/x86/kernel/cpu/mce/severity.c index 74fe763bffda..d9b77a74f8d2 100644 --- a/arch/x86/kernel/cpu/mce/severity.c +++ b/arch/x86/kernel/cpu/mce/severity.c @@ -278,6 +278,8 @@ static int error_context(struct mce *m, struct pt_regs *regs) m->kflags |= MCE_IN_KERNEL_COPYIN; fallthrough; case EX_TYPE_FAULT: + case EX_TYPE_FAULT_MCE_SAFE: + case EX_TYPE_DEFAULT_MCE_SAFE: m->kflags |= MCE_IN_KERNEL_RECOV; return IN_KERNEL_RECOV; default: diff --git a/arch/x86/mm/extable.c b/arch/x86/mm/extable.c index 5db46df409b5..f37e290e6d0a 100644 --- a/arch/x86/mm/extable.c +++ b/arch/x86/mm/extable.c @@ -131,8 +131,10 @@ int fixup_exception(struct pt_regs *regs, int trapnr, unsigned long error_code, switch (e->type) { case EX_TYPE_DEFAULT: + case EX_TYPE_DEFAULT_MCE_SAFE: return ex_handler_default(e, regs); case EX_TYPE_FAULT: + case EX_TYPE_FAULT_MCE_SAFE: return ex_handler_fault(e, regs, trapnr); case EX_TYPE_UACCESS: return ex_handler_uaccess(e, regs, trapnr); -- 2.35.1