Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp858569rdg; Fri, 13 Oct 2023 03:28:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHwRFxq7TBB2wF0VkXR9Fnprt/1Lf4LxiNqQORGMjW3sotCrSYQKZ4YMaOGcYoIZfKzsKvv X-Received: by 2002:a9d:5e96:0:b0:6bc:c542:6f75 with SMTP id f22-20020a9d5e96000000b006bcc5426f75mr25933522otl.0.1697192924835; Fri, 13 Oct 2023 03:28:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697192924; cv=none; d=google.com; s=arc-20160816; b=pXOC2Ur/VTeKr9Ja+evTFM5njUtWHTb5Ko5mYK5RZMoFw9tdEUwj7XrNoQnq+Ub0di 8wgzRsc7v5moIWGmVslnvrUzNeq3GBjuk60Yfc8Hf5ZRzdoNcKkb211BqJgd3mAtNTKW IJS/U+EsJ1OYudxDNUJ4JJhAhXyAGgqHqqL3FIk7dU/uReZF2eUFdZ8Qdb7KaClkWEGG umMMT/vWXma6Tg26Nd1d8JGXJVNgeWnn21gv4BEff5DqsjaN8Qf8GVPReIyePCTJAP+6 IfD9w6wXwgd+oqwHPUNe/qFwqLBK24dnhtqLCnj0h6BLesot/9njRX3Bew3UJmQo8++O s1cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=TamAF/3gz8OQZjXDLeplel5QUpRkF/BcthTp9hyB2O8=; fh=/rUkaQHXbQ6zL7q+5JrMl+fpLyESiM3Z7Gfhk2Vauvw=; b=dQiEdijr2Mafwi+FzSIq+3QJas7ye/MI6xKVQ94qB7ltqVg/MR9Adul7B4qvz5XLA8 HyVsIC/cYhFqy1oSdu1u/6Ui94zQzLzjDymx/1IRkkuN8G4YDF5JYKd3tgzj4bs8MA9N d224zz+CpbUqXi6E2WpNXFBsiU3okH9JhUWfxNz20Xd5Rl6Z/8F4f3Fd4/9zHoO1Uazy uIw9Mh5l+4/xJTaIKu5GXItiO2iAwipwjV6+uKM0H3uS54SVTju6ulVHPYIAyi3QoYLy a0Q3fOqNUvNFr/XGSmlRdoUD2QHQBWkqII78b7eUwst67BGkOo9QpaRqo+HBVpCR0nGo rVMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=grXjQALA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id fa13-20020a056a002d0d00b006b2b53de986si1092668pfb.194.2023.10.13.03.28.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 03:28:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=grXjQALA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 60AB782F924E; Fri, 13 Oct 2023 03:28:43 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230011AbjJMK2k (ORCPT + 99 others); Fri, 13 Oct 2023 06:28:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229794AbjJMK2i (ORCPT ); Fri, 13 Oct 2023 06:28:38 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06ADCBB; Fri, 13 Oct 2023 03:28:37 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2EF6C433C9; Fri, 13 Oct 2023 10:28:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697192916; bh=0+boUY0MoHNzdsmeaJJyHT3/EXHdNTCpFhWoTBDCG/w=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=grXjQALA5aPs764pJYGsubpxwgHVSNA7xNJEgbyVbsF31jWihGJ9wEJSXmrZAmCa9 2TXJhBp7LGVEVCbh4H6ROegZsgFM8tsqPVlr4fC4r1ZPghUnNz+EcyEAALWPWnYNuu P4sR7W1Vx9KPHR576dVWs3M9f/tdcMK9u7ld4io4iXn8JQRpcJfEOp1hHQNYRUcOMq gjk91T/rmFrCbGfk9gr34UcvJPV3ntLWmTXT0f4x7z1z+GnoiTWndA9G5ZxMdZPpeM jQGph8NJdmYNXkcEse6JTVpHq70Gg216gV8ZTRc5Ii3hWsornFn5x2WXUmHcreE2Oa Mru8Po4SEreIA== Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2c5028e5b88so11881961fa.3; Fri, 13 Oct 2023 03:28:36 -0700 (PDT) X-Gm-Message-State: AOJu0YziiEEjh9pgveNuhzWyymw2cu69RKOAi4q0FOrO3AHvI9if/nq3 8iYSypA+TJcqf7KM+nSISQgq62Un9Twi1MAGEpk= X-Received: by 2002:a2e:3c16:0:b0:2c0:167e:dd8c with SMTP id j22-20020a2e3c16000000b002c0167edd8cmr22497370lja.10.1697192914886; Fri, 13 Oct 2023 03:28:34 -0700 (PDT) MIME-Version: 1.0 References: <20231011192528.262425-1-nik.borisov@suse.com> <20231012101456.goamenepqlte65jv@box.shutemov.name> In-Reply-To: <20231012101456.goamenepqlte65jv@box.shutemov.name> From: Ard Biesheuvel Date: Fri, 13 Oct 2023 12:28:23 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] x86/efistub: Don't try to print after ExitBootService() To: kirill.shutemov@linux.intel.com Cc: Nikolay Borisov , linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 13 Oct 2023 03:28:43 -0700 (PDT) On Thu, 12 Oct 2023 at 12:15, wrote: > > On Wed, Oct 11, 2023 at 10:25:28PM +0300, Nikolay Borisov wrote: > > setup_e820() is executed after UEFI's ExitBootService has been called. > > This causes the firmware to throw an exception because Console IO > > protocol handler is supposed to work only during boot service > > environment. As per UEFI 2.9, section 12.1: > > > > "This protocol isused to handle input and output of text-based > > information intended for the system user during the operation of code > > in the boot services environment." > > Thanks. I've queued this up as a fix. > > Running a TDX guest with TDVF with unaccepted memory disabled results in > > the following output: > > Oh. My bad. > > But there's other codepath that does the same. If setup_e820() fails with > EFI_BUFFER_TOO_SMALL, efi_stub_entry() would try to print "exit_boot() > failed\n". > > I wouldner if it is feasible to hook up earlyprintk console into > efi_printk() machinery for after ExitBootService() case? Silent boot > failure is not the best UX. > I don't disagree with that in principle, but wiring this up seems non-trivial, and will be x86-only. The EFI output is not recorded in the kernel log, and this particular issue is something we can warn about later on, when it is much more likely that someone will notice. So if we want to keep this functionality, I'd prefer it if we could add something to the generic EFI memmap code that warns_once about unaccepted memory being present and CONFIG_UNACCEPTED_MEMORY being disabled.