From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42D17361669 for ; Fri, 13 Feb 2026 14:24:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770992650; cv=none; b=EwGKj8IbRZ/UaDqLHJe8yjF4xvNPvg1rnnNAVeLyGdxAoAQPlGm9bfWvxPyNNjPbW2nZ5K0vMTJGy405+uFzNncMeL0loa5c4RT1tdrVOgpX2yoEvD/8McX6W2OSzn1xR4hD6Ab5l1qhyzNmjrbzpNKjJJ/6ulJesGZyyLEHe7k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770992650; c=relaxed/simple; bh=NyQ/+9Jpp+qd7shQlKvJyvr4xXmgReJwlq27O0lDVK8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=m6rAl2UETf+fZLQr8+mRJLPTnxZzUoBSBa9ZRwjh8oaFBq2RvYg8tDUjY/VGiAj1i9r2YSIApZ9ABv20io2GyDR7UV+CaqYMN2LSJ65rYR4RM0OP4rXTC6pUitBAEsFTvJchpkyr2qHrxOpyuP/rLSxDwhNdnup0ajasYkUR0Y4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Gmt6Lrsm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Gmt6Lrsm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F0E0C16AAE; Fri, 13 Feb 2026 14:24:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1770992649; bh=NyQ/+9Jpp+qd7shQlKvJyvr4xXmgReJwlq27O0lDVK8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Gmt6Lrsmo0XccZKYm1HlEOkdqjgzgvWKAvCqjmPUetkfPgguzULmVU4TOuku0RjDD iU170gkYDAlsOaNkz81so5hEN5325QRa9lGPi4kIj18R4z30zp4FWy/+nhlrc0b3tL /EOrwPMKO0Bo89nXP2oEtF9n4NAGe1wh2/lBDExjFwqlEoFukkQbolQfT5u7dTsE7b pIZ9irF9Se0AMHNKIItavXRzMmQAoWSbeZhhMWwCcE4gVbdcTUqjRQOmv8TqJ+OdC8 rMqrP5U6tAeW791/JZGJV/pTJyehrqlBIzDOp6q38bMmp6j7IS/bodVXb4y8BoLFZL BBickLXnP0AmQ== Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfauth.phl.internal (Postfix) with ESMTP id BB515F40069; Fri, 13 Feb 2026 09:24:08 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Fri, 13 Feb 2026 09:24:08 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvtdekgeekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepmfhirhihlhcu ufhhuhhtshgvmhgruhcuoehkrghssehkvghrnhgvlhdrohhrgheqnecuggftrfgrthhtvg hrnhepueeijeeiffekheeffffftdekleefleehhfefhfduheejhedvffeluedvudefgfek necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepkhhirh hilhhlodhmvghsmhhtphgruhhthhhpvghrshhonhgrlhhithihqdduieduudeivdeiheeh qddvkeeggeegjedvkedqkhgrsheppehkvghrnhgvlhdrohhrghesshhhuhhtvghmohhvrd hnrghmvgdpnhgspghrtghpthhtohepudeipdhmohguvgepshhmthhpohhuthdprhgtphht thhopehmshesvggughgvlhgvshhsrdhshihsthgvmhhspdhrtghpthhtohepuggrvhgvrd hhrghnshgvnhesihhnthgvlhdrtghomhdprhgtphhtthhopegrrhgusgeskhgvrhhnvghl rdhorhhgpdhrtghpthhtoheprhhitghkrdhprdgvughgvggtohhmsggvsehinhhtvghlrd gtohhmpdhrtghpthhtohepihhrrgdrfigvihhnhiesihhnthgvlhdrtghomhdprhgtphht thhopehluhhkrghsrdifuhhnnhgvrhesihhnthgvlhdrtghomhdprhgtphhtthhopehlih hnuhigqdgvfhhisehvghgvrhdrkhgvrhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhu gidqkhgvrhhnvghlsehvghgvrhdrkhgvrhhnvghlrdhorhhg X-ME-Proxy: Feedback-ID: i10464835:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 13 Feb 2026 09:24:07 -0500 (EST) Date: Fri, 13 Feb 2026 14:24:03 +0000 From: Kiryl Shutsemau To: Moritz Sanft Cc: Dave Hansen , ardb@kernel.org, "Edgecombe, Rick P" , "Weiny, Ira" , "Wunner, Lukas" , linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [BUG] Fault during memory acceptance for TDX VMs with certain memory sizes Message-ID: References: <5a0fa6d2-f138-4360-bf02-5478eda4b495@edgeless.systems> Precedence: bulk X-Mailing-List: linux-efi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5a0fa6d2-f138-4360-bf02-5478eda4b495@edgeless.systems> On Fri, Feb 13, 2026 at 01:33:56PM +0100, Moritz Sanft wrote: > > Could you check it this patch makes a difference: > > > > diff --git a/drivers/firmware/efi/unaccepted_memory.c b/drivers/firmware/efi/unaccepted_memory.c > > index c2c067eff634..f2a00cd429f2 100644 > > --- a/drivers/firmware/efi/unaccepted_memory.c > > +++ b/drivers/firmware/efi/unaccepted_memory.c > > @@ -35,7 +35,7 @@ void accept_memory(phys_addr_t start, unsigned long size) > > struct efi_unaccepted_memory *unaccepted; > > unsigned long range_start, range_end; > > struct accept_range range, *entry; > > - phys_addr_t end = start + size; > > + phys_addr_t end = start + PAGE_ALIGN(size); > > unsigned long flags; > > u64 unit_size; > > Thanks, I tried this on the `-m 67000M` VM and the crash still occurs. I > extended the previously-added logging to also log the values for `start + > size` and `start + PAGE_ALIGN(size)`. Please find the full patch including > the logging and your change in [1]. What about the patch below. It seems we under-reserve memory for the table if it is unaligned. I still think that we need align start/size/end to the PAGE_SIZE in accept_memory()/range_contains_unaccepted_memory() before doing anything else. Otherwise (end % unit_size) check is broken. But it seems to be unrelated to the problem you see. diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index 111e87a618e5..56e9d73412fa 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -692,13 +692,13 @@ static __init int match_config_table(const efi_guid_t *guid, static __init void reserve_unaccepted(struct efi_unaccepted_memory *unaccepted) { - phys_addr_t start, size; + phys_addr_t start, end; start = PAGE_ALIGN_DOWN(efi.unaccepted); - size = PAGE_ALIGN(sizeof(*unaccepted) + unaccepted->size); + end = PAGE_ALIGN(efi.unaccepted + sizeof(*unaccepted) + unaccepted->size); - memblock_add(start, size); - memblock_reserve(start, size); + memblock_add(start, end - start); + memblock_reserve(start, end - start); } int __init efi_config_parse_tables(const efi_config_table_t *config_tables, -- Kiryl Shutsemau / Kirill A. Shutemov