Received: by 2002:a05:7208:70d5:b0:7f:5597:fa5c with SMTP id q21csp1305275rba; Fri, 22 Mar 2024 09:53:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUH9ZcQA66FZrkF3wFFBW7EzzXBqV2oPkkuYN90R/HebUeI+a426IW3FNz0bhHrBd1hMD2dS5Z/iEZ1vEAl5v2LNbvZ82FXpCbbNEQV2A== X-Google-Smtp-Source: AGHT+IFH6eeyiuk0h3qfxuIUW7k5nTxMij4fWqsgetHJEz/mGipQmQglqUMzctg4Gq570ziY1MgB X-Received: by 2002:a05:6358:71c:b0:17f:5982:c7bf with SMTP id e28-20020a056358071c00b0017f5982c7bfmr1691126rwj.21.1711126418827; Fri, 22 Mar 2024 09:53:38 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711126418; cv=pass; d=google.com; s=arc-20160816; b=VipAYrdvhhM+sTViojH1nwi6aR9OymFn+ECKFhl7l9gBbdC288fr5ALMCZD6yJf5Dv uhVnQx9CSks5JIMeAPnv7+QvXzgnT6Jdi1p6lChLGz1eDoor0xlcXFtjtoL4QOpVFmrD MbhoiiiV8uxGIuJ44L5bVEz2/xrnqK7yTvBuoUNIqKlpUSKroRAzJymKbKhsSZQtlL8M sWy5VID44SZIgtJSBweb0z1/9YBedTfrekeDhi98rhmWkFVS7uBybGXYtmhP7CNoIrJH 8lzoz8J5x7LdpATC1G3X/L3x8C5Hzl3HMCKsofcdyNYhAJtKOwSlZ/ooIvX6eev8WWoN euYg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=heSLxLDAgCylSd6+BJCd51rHbv5Ft6awEz52pCXxJTE=; fh=sNPzZNO02XZUNvkYYy4VjmZekEnlJpofRMubI/ws3ws=; b=xT+UiUduoTaBQaWKrAu2XntU85RPSZpETPRzIevTXKkuQmt9eTqMk6lgPTyW3gPZQX Msfw3Cnn0/hWE4lgvvF8dLjRJNzY+TmTbCHRGYBnkFuRlICHNoA1HVUckPWGl1pj8G5G fU9yteF03kmWqgv3rJ21bWiIm7eSE3vboCiWF/QB7ZzRFWOtDDbeLnhWcRcEbsBgs3aO WX6WKz9v931oGfurO3BPRB/Czh6zqHe8zkqvNn77DN1Uvuv2seljE1Sfeyq5AyGF73AZ 41LlsQBa1lS10klfD93rFL/HGVDMFWAhd//VwQkYz9NZ204Omq0tUR3nnNKDyflQQ4xV BDJA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NxlmZODE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-111807-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111807-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id t2-20020a63b702000000b005dc34da7200si2381110pgf.722.2024.03.22.09.53.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 09:53:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-111807-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NxlmZODE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-111807-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111807-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 0FC77B239CD for ; Fri, 22 Mar 2024 16:52:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 659DA5FBA6; Fri, 22 Mar 2024 16:52:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NxlmZODE" 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 88C525FB86; Fri, 22 Mar 2024 16:51:59 +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=1711126319; cv=none; b=D7kIaEeCpyePlpejLxo3xXIXXgVTqwJnNYi8rOfL1V+L1GZCvrL+/PDAwOVOnKniOTahppl+V/w14DjEZLg4KoQ/KabIwuPTlwAAZ4FVHY3yPwhRnQCuYECW46zlEtlpcDDUHEBTroH/cz9ML36H0pB4ozPhl4ogDw3sjUsmLJ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711126319; c=relaxed/simple; bh=lE+j9KmSnjltzBjQCfhK7TmKOK+5AHSKNREDslpxLpU=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=OZV4nkhVeVMThkGm0HCdJ/mHb7gBN9N+iOkZIWWVjltE1I9MAFaE+zw8gAXxrL3EOLFIP/kJP8LtxaHXIHvcjDwR1+Id/wo81GTccV4Ql7GT2NHu3iozbCnS/FXsvWIVC3fjsHMj9q49y+2g359S/tYVYBkKKb/nhck0IVjh9YM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NxlmZODE; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B04AC433B1; Fri, 22 Mar 2024 16:51:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711126319; bh=lE+j9KmSnjltzBjQCfhK7TmKOK+5AHSKNREDslpxLpU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=NxlmZODEEA0ISb7ievayKFW0t96UaeZconP+faJmHR9A0TeQjfHBdohc5UI5rtjW8 87eAbnW8X+9elu9p+o/j/Og0NeeqdBEJuc8ijaWzoXAvKGqy9MlMpUeHTg8dMVQH+p wod7/zlDWxJEBNLVgYjMoMGbHHyKY1DBX3H+HveCzZ7q8JOiIf8bW+7EvOSMwfLdg+ lPz+LesocOyBQPZhrlV2tXvwc4jeUHlZkhC7QB6S3ujQQVz/jhzoVcEkFFVCLPR+nC wagd+8ZW6e1RNcvf4WFOe0C1uzf7cQPUUDSn8BOxwkgf6asx7/XL22YDjfVczey5Zf BOaXs+/pdcZGg== Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-51588f70d2dso2725202e87.3; Fri, 22 Mar 2024 09:51:59 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCWUv9d60lO/+jsoYDCXMutjYw7vKmbNcZlkG6Mg+gAtA89CbYYjohXbK659WnbG0m11uWfHRx7qAT+PL+2UPjdcErfNn2m5DR13//Ev6k/KTIrAIVG2ghaEFXuEe1K1Lz8FjlKy2B/x X-Gm-Message-State: AOJu0Yx4xoTmEHndvEfRJaPEg8aLaIGMTZ9+oSYIHgSPx0Svc1Edz434 9ATxAnUIqYcbEIdrRNhVl9jWqBoyQM6Z4lZflMW48TzGs4O1hVackySYrv4H5F6ZPuoiPSX3CA6 jnx31KtmXdwv7YuG37kzLFhrbwzY= X-Received: by 2002:ac2:5bc5:0:b0:513:c28e:8215 with SMTP id u5-20020ac25bc5000000b00513c28e8215mr1985077lfn.64.1711126317477; Fri, 22 Mar 2024 09:51:57 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240321150510.GI8211@craftyguy.net> <20240321170641.GK8211@craftyguy.net> <20240322091857.GM8211@craftyguy.net> In-Reply-To: <20240322091857.GM8211@craftyguy.net> From: Ard Biesheuvel Date: Fri, 22 Mar 2024 18:51:46 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: x86_64 32-bit EFI mixed mode boot broken To: Clayton Craft Cc: Hans de Goede , x86@kernel.org, linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , regressions@lists.linux.dev Content-Type: text/plain; charset="UTF-8" On Fri, 22 Mar 2024 at 18:19, Clayton Craft wrote: > > On Fri, 22 Mar 2024 13:52:05 +0100 Ard Biesheuvel wrote: > > That depends on the bootloader. One of the changes around that time is > > the introduction of this Kconfig symbol: before that, the EFI handover > > protocol was always supported but now it can be compiled out. So the > > safe choice is to enable it. > > I am using systemd-boot, and based on my understanding of its source it seems to > only use handover on old kernels that don't support LINUX_INITRD_MEDIA_GUID. That does ring a bell. So that means you must be using the .compat entry point, which is what 32-bit OVMF uses too. > > > > However, while looking more deeply into this, I noticed that we are > > running quite low own stack space. Mixed mode is different because it > > calls into the boot services using the decompressor's boot stack, > > rather than using the one that was provided by firmware at entry. > > (Note that the UEFI spec mandates 128k of stack space) > > > > In my case, I bisected the regression to > > > > commit 5c4feadb0011983bbc4587bc61056c7b379d9969 (HEAD) > > Author: Ard Biesheuvel > > Date: Mon Aug 7 18:27:16 2023 +0200 > > > > x86/decompressor: Move global symbol references to C code > > > > which moves the boot stack into a different memory region. Formerly, > > we'd end up at the far end of the heap when overrunning the stack but > > now, we end up crashing. Of course, overwriting the heap can cause > > problems of its own, so we'll need to bump this in any case. > > > > Could you give this a try please? > > > > > > --- a/arch/x86/include/asm/boot.h > > +++ b/arch/x86/include/asm/boot.h > > @@ -38,7 +38,7 @@ > > #endif > > > > #ifdef CONFIG_X86_64 > > -# define BOOT_STACK_SIZE 0x4000 > > +# define BOOT_STACK_SIZE 0x10000 > > > > /* > > * Used by decompressor's startup_32() to allocate page tables for identity > > Just gave this a try, on 6.1.82, and the system still reboots after selecting > the kernel in the bootloader. So it seems like my problem is different. > Yeah, it was a long shot. > As I mentioned initially, I bisected my failure to e2ab9eab32. Does that give > any hint about what might be the problem? > Not at all, unfortunately. What we might try is to back out the changes step by step. I can prepare a branch for you if you like.