Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp196498pxb; Tue, 15 Feb 2022 11:13:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJzkJzloKyCNA712/eyFKrLwlG8s9LqyOTes4LskGRoJ+Ym2/nQWZ+U65ieHoFUpAi5iznAF X-Received: by 2002:a17:90b:4b52:b0:1b8:c554:3bdd with SMTP id mi18-20020a17090b4b5200b001b8c5543bddmr5979350pjb.5.1644952424905; Tue, 15 Feb 2022 11:13:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644952424; cv=none; d=google.com; s=arc-20160816; b=q95B/LEfkfRnMI6yw5LlJKm7OFiAbEmA3Oq7EzQvvUWpsJkrzibY58tt98s4CZgUEY x7kO0OSkVGsuyMwDfWoTIiWlldHs/xMrH3USRoIo6sogvgNifO9EKKc0f6L9Kfhwc2eU 18eNixRm4QAZJ8pb5JiejVf2MRMIMVPL3etQtAM+PZR914t2xGIdmApmWmVg/RSBDse7 A/sPn13eNFaeCfwGeL7+09lm7amRfNYkacTtzvh2wj3kTzDacNztg2PhYPkgdegsiMmc AfqZxM98fhnVkTC5wFNf8GyC80dn2xHWAPxIu6DDrnuoob9RBEXmASI/b0sWQcMdRV/1 ooZA== 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=eiZd7abZTRheawir5Eg8sRvKVeTjedCspWOLi0oO0Q8=; b=QGtQkVcTXz4G7I3fs7sWHGTobxBxkwhStD885JkEcNSmDu/5VBJ7I80dQ7QvCA/b71 +qpSXVzPPQFUPCVphu8+EvZCe0hLRqwgrl5HW5N5uLGGEMebs0rsDOc05+eFsT3SD6vg 1DpDt/xJEsqw3NIvn4jnMfBRf4P+sJGeAQKN3qlVAYHYIf++gXO1IFBBuoCUJMcLCZ12 WSbEHS4UpPOmVtaLgCusbBYR6efVHZj35xK25o7D94wSr6VHv5K6SBci/golyD7AHCj1 tqZl/KUh8aq38yJKcCFagIzdEKfQc/lt3s26+O8N1xQPbbWFYR5bg7wHtWINZ27RLMmk KSKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=ZASfpJnO; 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 f5si3336747pgc.372.2022.02.15.11.13.28; Tue, 15 Feb 2022 11:13:44 -0800 (PST) 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=ZASfpJnO; 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 S243115AbiBOSh4 (ORCPT + 99 others); Tue, 15 Feb 2022 13:37:56 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:35502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235305AbiBOShy (ORCPT ); Tue, 15 Feb 2022 13:37:54 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A33414024 for ; Tue, 15 Feb 2022 10:37:43 -0800 (PST) Received: from zn.tnic (dslb-088-067-221-104.088.067.pools.vodafone-ip.de [88.67.221.104]) (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 998CC1EC054C; Tue, 15 Feb 2022 19:37:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1644950257; 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=eiZd7abZTRheawir5Eg8sRvKVeTjedCspWOLi0oO0Q8=; b=ZASfpJnOyyx9GrybIozgD8hHdpUS3Xz1NbNDelvsopu9Ax6a2AUExdHxr7JYDTqmIbOA+J 6jZnpRW0oj8IqXPoCk/6Oey3g0bgCGs+vkog26gKFyf5AB08LhLFlJwAkn3PXINPeSPbqz EnjKIWbDpIice0X1kA9B+7kYIP8BQPE= Date: Tue, 15 Feb 2022 19:37:38 +0100 From: Borislav Petkov To: Ross Philipson Cc: linux-kernel@vger.kernel.org, x86@kernel.org, daniel.kiper@oracle.com, dpsmith@apertussolutions.com, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, luto@amacapital.net, kanth.ghatraju@oracle.com, trenchboot-devel@googlegroups.com Subject: Re: [PATCH 1/2] x86/boot: Fix memremap of setup_indirect structures Message-ID: References: <1643303056-22272-1-git-send-email-ross.philipson@oracle.com> <1643303056-22272-2-git-send-email-ross.philipson@oracle.com> <2e584fc4-163a-0af4-abe0-9c14996918f2@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <2e584fc4-163a-0af4-abe0-9c14996918f2@oracle.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 Tue, Feb 15, 2022 at 06:34:43AM -0500, Ross Philipson wrote: > It can if you run out of slots in the fixed map. Right. Or if any of the checks in __early_ioremap() fail. But those would at least warn. > The only reason I did not check it for NULL was because it was not > checked elsewhere for NULL. Elsewhere in the tree or elsewhere in this file or in the setup_indirect adding code? > I guess there are two questions: > > 1. Should I also fix it elsewhere in the code I am touching? Yes pls. > 2. What should I do on an allocation failure? In a routine like this it > seems to be a critical early boot failure. How so? I'd expect in the case of e820__reserve_setup_data(), for example, to not call e820__range_update* and not have those indirect ranges present in the e820 map. What the user intended might not work but it'll at least boot instead of floating dead in the water. And similar approach in the other places you're touching. You could even issue a warning or so so that users at least know what's going on. I'd say... > I guess the original intention might have been to let it just blow up > since there is no recovery but that is just conjecture... The original intention? Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette