Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp555263rwa; Sat, 20 Aug 2022 08:55:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR5/7ppQJ1zzuQlpsv+UK7OpgSGTp0Hsn//QtYZ3t9NqWHSsmVPiOoY6bfUYD0mEjxZkyhlB X-Received: by 2002:a05:6402:289e:b0:445:f327:1c14 with SMTP id eg30-20020a056402289e00b00445f3271c14mr10011369edb.394.1661010908881; Sat, 20 Aug 2022 08:55:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661010908; cv=none; d=google.com; s=arc-20160816; b=kS99O2rJ76Tozgly0rky7P3LU/58RU2R7YCVmhTsD5ZSTQNJOO8FBJOAIQY2BsXJgm aG/XZLkS+9iCNCw1Wj1pz40U3Qvv1tiW8RJQYqJzQGd8fr3FuBGv6sGvc0ZTOLHhYNQq hOkaMzihJYWQXBso85QifJb+SJKo3uIxWeIzkZfQS7NsOqM3SwfZ1TFy9Us0Fyj+VJeL cDMoCj2DGekdhDC0yYex0m/4uahtFVPC1WgXDQiu+LysQBz4DT8w63zPp9UOvgjkrurr aVrkLO5+V4vja//SvRK6jNFeiZDiDR74ZnZtimp2MQuYUF5wpURQicTnLe+7xEutMZ8t H05w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=G3IJhwDiyGx/Q6TP7rSZkT6XzxALCoB5GDPvScV6Xxc=; b=Y7SO1YUTC8fWKjIXG8Ur+GAburzpregqpzfmsYc5iYKzgjCVzio4nmOapTwZt57Fb4 nviNykDVbGwS+jYQYZYTP0onPwtWyrVYcDbxRyDpFmd20OjsFVqBByj1wbRI0gu4ot9e ZuNwfKjoNY7KSlpEIsoXhEPgGymBK2KH67hQC6NV4eBy7nEsF1X/APg6VHzxDHj43ZSV oC/k6UR6XRQJemPWiIYqyvaRPlmB3OA0xHBtjZpgyKNPxv9+V6eaMOfd1z5Zfz9rDSHe SN7bdXvvztdrfzycybxUtqtaTbWzsYedt5/4v8KuHKowt59ddZvBZ8GZ5TBysmxkgwyT 8ilQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=gnc57b2x; 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=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw19-20020a170906479300b0073c5a78ac0fsi5123033ejc.495.2022.08.20.08.54.43; Sat, 20 Aug 2022 08:55:08 -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=@alien8.de header.s=dkim header.b=gnc57b2x; 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=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345553AbiHTPdV (ORCPT + 99 others); Sat, 20 Aug 2022 11:33:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229605AbiHTPdS (ORCPT ); Sat, 20 Aug 2022 11:33:18 -0400 Received: from mail.skyhub.de (mail.skyhub.de [5.9.137.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29F4BD82 for ; Sat, 20 Aug 2022 08:33:13 -0700 (PDT) Received: from zn.tnic (p200300ea971b98e0329c23fffea6a903.dip0.t-ipconnect.de [IPv6:2003:ea:971b:98e0:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 697471EC026E; Sat, 20 Aug 2022 17:33:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1661009587; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=G3IJhwDiyGx/Q6TP7rSZkT6XzxALCoB5GDPvScV6Xxc=; b=gnc57b2xfK1sYH0TxE+ABfVo3ri5AT8BQuM099vt8JnFzerGLM6AWfQPHk/wLJEj10aShN mtnRK0uATfH+rKvJSNXCRfNQi+ODG+hoY9sHIIddwlLeK53CVJKd2TpZNt6bvVcMfugLBb KkOZkz5X+G15C4BYkIVFy6EcbyZCAiY= Date: Sat, 20 Aug 2022 17:33:01 +0200 From: Borislav Petkov To: Russ Dill Cc: linux-kernel@vger.kernel.org, Tom Lendacky , Ingo Molnar , Thomas Gleixner , Yinghai Lu , Dave Hansen , "H . Peter Anvin" , x86@kernel.org Subject: Re: [PATCH] x86/boot: Fail gracefully if SMP MP-table early_memremap fails Message-ID: References: <20220819224400.2667654-1-Russ.Dill@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220819224400.2667654-1-Russ.Dill@gmail.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 On Fri, Aug 19, 2022 at 03:44:00PM -0700, Russ Dill wrote: > At least one older motherboard (Micronics W6-LI Pentium Pro) has been > observed to fill in the physptr but not actually populate the mpc when > only one CPU is present. In this specific case, this leads to the size > field being zero which causes early_memremap to fail. This then > causes a NULL pointer exception in smp_read_mpc. > > Add a simple return check. Returning -1 here will cause the MP-table to > be ignored and the system to boot in nosmp mode. > > Signed-off-by: Russ Dill > Cc: Tom Lendacky > Cc: Ingo Molnar > Cc: Thomas Gleixner > Cc: Yinghai Lu > Cc: Dave Hansen > Cc: H. Peter Anvin > Cc: x86@kernel.org > --- > arch/x86/kernel/mpparse.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c > index fed721f90116..ca2af4f42cb8 100644 > --- a/arch/x86/kernel/mpparse.c > +++ b/arch/x86/kernel/mpparse.c > @@ -438,6 +438,10 @@ static int __init check_physptr(struct mpf_intel *mpf, unsigned int early) > > size = get_mpc_size(mpf->physptr); If the size is 0, why aren't you checking size and returning early here instead of the early_memremap() result which gets called with size=0? -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette