From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A502CC433EF for ; Tue, 17 May 2022 19:22:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243116AbiEQTWJ (ORCPT ); Tue, 17 May 2022 15:22:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241252AbiEQTWJ (ORCPT ); Tue, 17 May 2022 15:22:09 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8619C42ED0; Tue, 17 May 2022 12:22:07 -0700 (PDT) Received: from zn.tnic (p200300ea97465748329c23fffea6a903.dip0.t-ipconnect.de [IPv6:2003:ea:9746:5748: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 E99E11EC0494; Tue, 17 May 2022 21:22:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1652815322; 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=IULBMfEGpOw9HxNHCKRwR6+0MRbfXrGSt3zlfqBRSkQ=; b=M5sfRUAfnZRyTytNX27nGdm7GTOJdPyCh2go8W+YApmL/RwEnT7JuzgZz+P7LU8Ghf8Oj6 2frl1NRX0fbyU3Ozt2FC1ji4QXPIPIbEQHi55dO2f1d2u/oJTqcXx9lRat8zJ6q3rKU/5Y 11ksitcfYivI/VNweYM4nMnGcMS40eQ= Date: Tue, 17 May 2022 21:21:57 +0200 From: Borislav Petkov To: Vit Kabele Cc: platform-driver-x86@vger.kernel.org, r.marek@assembler.cz, x86@kernel.org, linux-kernel@vger.kernel.org, rafael@kernel.org, mingo@redhat.com Subject: Re: [PATCH v2] arch/x86: Check validity of EBDA pointer in mpparse.c Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org On Mon, May 16, 2022 at 11:43:48AM +0200, Vit Kabele wrote: > And the valid upper bound of the EBDA pointer is also different > for these two use-cases. (The mpparse.c usage is interested in EBDA > pointer only if it ends 1KiB before the end of low memory, while the > ebda.c accepts even the values in the last KiB below 640KiB). And I still don't know why this difference in the upper bounds is really relevant and why you can't simply use the code in reserve_bios_regions() after carving it out in a helper? The latter considers ebda_start valid when it is between BIOS_START_MIN and bios_start, after having sanitized that bios_start to 640K if "out of bounds". Why can't default_find_smp_config() simply scan the last KiB below 640KiB twice for the sake of simpler code? I.e., there needs to be a single get_bios_ebda() - the current one can be renamed to __get_bios_ebda() - and that get_bios_ebda() should give either a sane EBDA address or 0 if the checks don't pass. And all code should use that. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette