Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5356851rwl; Tue, 21 Mar 2023 17:53:19 -0700 (PDT) X-Google-Smtp-Source: AK7set8MUW+6RvBO4AqFzx+lmA2MmAeYeo81qac0BZm/ipJMqLF0bXNVF8ZB+4JgJu9kZnfsMb/g X-Received: by 2002:a05:6a00:3010:b0:628:630:a374 with SMTP id ay16-20020a056a00301000b006280630a374mr4573567pfb.2.1679446399571; Tue, 21 Mar 2023 17:53:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679446399; cv=none; d=google.com; s=arc-20160816; b=Yj12CfcHK8crBIX6Ob1RwE8t4H4t+FiP7f9qV896PKR8q+VVeOG2SnJIl7w8+0K+mR 4D3xd7/BJmO12rLGrGUQZU/eMB71l9C4P+s9KnN14rRPNgdwvbn8rxvC+WmvCGR+BpZ1 PH5enTpbkNn3YFjI1Az7qPDe7nFKXZTdfzz75LSZUxIDyl7tDZlvc0iX+zVtriJgc8Q6 iDiMTTAZRgUnc8V+8e/2+QyYH7r9kQvMvc8VMW1hOd0+7LSCjDIfzbjv8ouB3j4PLdhk XfWuimaFCF7xlfUJ30G2uTmXMxNgTdK7QlQVpGJEflD+PnLr5UdcapxwJtvEfNiOsJrt 3rHw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=+2uhdH+bOaN/rI5u9zC8ldCS7mMX2v/OnxAgBu5n1JA=; b=yASU5yVfDSPcS4+I9trmB6Fz2HK2dS1AUqh10zUR6de+j0U0TNMgh1Tpn1cle9ZOuA I6Ssru9NU0X1T3aBzoMCM7G3GtjtH3K8AOPuTG+3BIPi1Mu8IMDL+hn/yKlEiIxgCT1M h8XXDu4CbQFJQzsO4lb/mDXPIKQScSP5btUBy8uU00sTjblL1JFGrpXOls6Sw59HWO56 QTNCefJGrFkmbI1SyrutJEDQ3diU4pC73AYFQklQ52Bx6mxnbPP6T2np7C6nPLx9qVSR 9A6tF9AmBXpk56YgJnwGh6YPZZCoLthHGD7j3ArbVRBZCBMgV677idJy4HXZfQUrwYcG 1AGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gf7Baxq7; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x5-20020a636305000000b004ff7002e3f9si15108260pgb.164.2023.03.21.17.53.07; Tue, 21 Mar 2023 17:53:19 -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=@intel.com header.s=Intel header.b=gf7Baxq7; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229872AbjCVAvt (ORCPT + 99 others); Tue, 21 Mar 2023 20:51:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229642AbjCVAvr (ORCPT ); Tue, 21 Mar 2023 20:51:47 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0ECB591CF; Tue, 21 Mar 2023 17:51:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679446303; x=1710982303; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=B9PpiLYBjsH8WiDosu/yBXR5Y3A1fdmmZghUTR96/7g=; b=gf7Baxq7u4q4TtX0d+PTk8M05FMh6kUXSGBnZl9CcTlcdlku9h7EdG9U byCUF913qc3N/AdsQkfliKCThp3hDrPQgw3Z0AzDmd1sODWGOwAZwYmNi VVYLX4kaoBR1LVTYDIw5wiJmj/yyM87nGdYkVBYpJCxQBBWuRLa1urC5n HoOSMjIW5y2Q2zwIyBdB5kl3T/2Vj0ULCr/mZBYK+Esho2kmmIW4zZYRG mfsOCOoIcCeG85F3zbCbiiJXEvDbLMGJxNCPSEFDaugZDy1qEKP16AS4k AGnmLyPWbUDUenZdbKIh8Nu5G4yj03MA/xLQFYPeiJemLgRo7yomDJ+oK g==; X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="336602269" X-IronPort-AV: E=Sophos;i="5.98,280,1673942400"; d="scan'208";a="336602269" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 17:51:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10656"; a="681711889" X-IronPort-AV: E=Sophos;i="5.98,280,1673942400"; d="scan'208";a="681711889" Received: from agluck-desk3.sc.intel.com ([172.25.222.78]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Mar 2023 17:51:41 -0700 From: Tony Luck To: Borislav Petkov Cc: x86@kernel.org, linux-kernel@vger.kernel.org, linux-edac@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH] x86/mce: Check that memory address is usable for recovery Date: Tue, 21 Mar 2023 17:51:31 -0700 Message-Id: <20230322005131.174499-1-tony.luck@intel.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,URIBL_BLOCKED autolearn=unavailable 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 uc_decode_notifier() includes a check that "struct mce" contains a valid address for recovery. But the machine check recovery code does not include a similar check. Use mce_usable_address() to check that there is a valid address. Signed-off-by: Tony Luck --- arch/x86/kernel/cpu/mce/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 2eec60f50057..fa28b3f7d945 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -1533,7 +1533,7 @@ noinstr void do_machine_check(struct pt_regs *regs) /* If this triggers there is no way to recover. Die hard. */ BUG_ON(!on_thread_stack() || !user_mode(regs)); - if (kill_current_task) + if (kill_current_task || !mce_usable_address(&m)) queue_task_work(&m, msg, kill_me_now); else queue_task_work(&m, msg, kill_me_maybe); -- 2.39.2