Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5504463pxj; Wed, 26 May 2021 12:06:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyDXCJGRPKDHtt77cFRNhPRCHmNYlQ7cPdcdRBvPmiLsP7zlDFH1Kq/kYSfNdO1rwypiPWZ X-Received: by 2002:a17:906:5914:: with SMTP id h20mr35886158ejq.252.1622056005607; Wed, 26 May 2021 12:06:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622056005; cv=none; d=google.com; s=arc-20160816; b=ww57q8ip4Id6BccEtOjUtZE9vk5/OpwDRUN1cFFCzYw3toOxDG8m0YeeJep6XhRK3T jyJOpoevc2Eyl1o3btfeU0GgnbxFAxlOzcRE4VCgAPUophI2hM8+lDUKPTZpgyogPYAt /51Px9ntx9GEvtDbZZ9k0/7IGEp5NlUyW8fUcPUXjt+auHfDTQ0EiHxjicvk3aeCB4AA cDjD7qV+EppcXmAUxG8Wg7HGTI1OmQ3bdzQ+mWFmZQyDi2HWOtJEYYRenXWQEkjCjBKi 5/rZTa4xDRS7g0804QN6msdQyJ71MA0IgXI+qcvbyJ/Rl07DZ0/P3BQlX8h+Mzon+qof HbSw== 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=kDTBjApv+wymKRd+zqLkK54wnsuec1FVge9jhfXzILY=; b=poH1D1ftlgsnFzX2FzH9r5wo9XORtAttmPmKZ78G1X/dGb8GYPcyN9dDNip4Ahd1F+ poa9lkFN+jhUEIm2jDQ7HTNLfa1QjqpH2z/4EdKPmmKOG/iNXowPJhwAXRadI78TYAUi F8m694wlBx+TPTZ1MkQ/HrRq5r4gOn/zNXpryO1AHM039Rh94cA05dGgOGGQfzLs3/3m TfwXk31Ebd2rVXunGje29RYvC4u3U2em0zzNBgVaXbJa8Faq0uigs+bE6052Wa3qZeVp PRSsSwGWSnD0oSJzba8YiUR/zxM5ZYQavhFuJufMFtRLF0iK8i2AfP0bVZw2/SOTFWTW tGzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jhC4cjoV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z25si180402edq.31.2021.05.26.12.06.17; Wed, 26 May 2021 12:06:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jhC4cjoV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232982AbhEZQbx (ORCPT + 99 others); Wed, 26 May 2021 12:31:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:39122 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234544AbhEZQbs (ORCPT ); Wed, 26 May 2021 12:31:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6D8D8613CE; Wed, 26 May 2021 16:30:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622046616; bh=K2m+rOb2f5WbHdz8pamr+WIQ2N26pRLHMfuwQxJHfRc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jhC4cjoVWCu6lSiiL7n4CJy8Ikr7zv8QwzE4SuU9kh/vXEJNpGroSZ+/An5/5Q4Xu j/7s5x/MeU2UllKWl30Ze5nDPJR61nSny+59D5CA4DN3RVOGUN7t4X2/d6hQAWPNfW m+ZIbdk14b+IRidC/kV+eEkG6wXYGcJAioi8/i2EVibXtBy+oitp6xc1eZDIHGsfQb +VSRYHpgX9BYreoUIxRTlB+RbTRCLPwSnw9sFY6ZKXPXs5EKh03Q/uUKRwTWdiOvey dslvDCRl08RxnTkYx1u4Sv1kMDFQZgy7dArO0+77lYOCEsbG0d17t2ErWzLqZ4CnMu STGbT5UzBOX1A== Date: Wed, 26 May 2021 19:30:09 +0300 From: Mike Rapoport To: Borislav Petkov Cc: Ingo Molnar , "H. Peter Anvin" , Thomas Gleixner , Mike Rapoport , untaintableangel@hotmail.co.uk, x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/Kconfig: decrease maximum of X86_RESERVE_LOW to 512K Message-ID: References: <20210526081100.12239-1-rppt@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 26, 2021 at 10:47:21AM +0200, Borislav Petkov wrote: > On Wed, May 26, 2021 at 11:11:00AM +0300, Mike Rapoport wrote: > > From: Mike Rapoport > > > > After the consolidation of early memory reservations introduced by the > > commit a799c2bd29d1 ("x86/setup: Consolidate early memory reservations") > > the kernel fails to boot if X86_RESERVE_LOW is set to 640K. > > > > The boot fails because real-time trampoline must be allocated under 1M (or > > essentially under 640K) but with X86_RESERVE_LOW set to 640K the memory is > > already reserved by the time reserve_real_mode() is called. > > > > Before the reordering of the early memory reservations it was possible to > > allocate from low memory even despite user's request to avoid using that > > memory. This lack of consistency could potentially lead to memory > > corruptions by BIOS in the areas allocated by kernel. > > Hmm, so this sounds weird to me: real-time trampoline clearly has > precedence over X86_RESERVE_LOW because you need former to boot the > machine, right? > > In that case, real-time trampoline should allocate first and *then* the > rest of low range requested to be reserved should be reserved, no? We can restore that behaviour, but it feels like cheating to me. We let user say "Hey, don't touch low memory at all", even though we know we must use at least some of it. And then we sneak in an allocation under 640K despite user's request not to use it. -- Sincerely yours, Mike.