From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by mx.groups.io with SMTP id smtpd.web11.2433.1676415522435704838 for ; Tue, 14 Feb 2023 14:58:42 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=D1TW/MQ9; spf=pass (domain: kernel.org, ip: 139.178.84.217, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C7CCE618FB for ; Tue, 14 Feb 2023 22:58:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB983C433A1 for ; Tue, 14 Feb 2023 22:58:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1676415520; bh=8uKJcvva5hoRwS8nF5+5UcinCiwWD312uZt0zAslcJw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=D1TW/MQ9aSr9SYI/rjP8Tx2EE09PuGdDz+0vVlMcRXqTIwb5zEf1LS8f5R2abNDk3 c9B2cTI5MpCEknLmYlIwlyAaXJ6s69SIMjJwc+P8mxY5HdyhJu3nHAwMOpZyjEiFxb 78hqvsWL0fDadfCchhtpU212b3DLDS0iHEO9MJl+RambcLB1ft5lbOWsdsoCxB/ddA 458CpG++/ndXa4NnX6LuTseg81l2shK0dFZPl/AreRMiyz8KJUEUeb2zLZKWxCiwUp 5P5Pyax/pNJvCwb3ajF0+1N1SeLRafO1MUV/u2Je59NNWRToz6b+xCVc4xvI8Yvc4s 1I6klCbxdKdMQ== Received: by mail-lj1-f169.google.com with SMTP id h17so20173677ljq.4 for ; Tue, 14 Feb 2023 14:58:40 -0800 (PST) X-Gm-Message-State: AO0yUKXJAScKK/oJ1oDf8RAsj6RQBqPWoVPvVEZ33NrbfWIJj8dKd8ph 05atRMFHeoSyGtWz7evKP2U6XmQCUxMwqu6cAGY= X-Google-Smtp-Source: AK7set/DbtkW8sN2yBJXTwgVjTSMD3gA/EJoL1SlBmyJQG4195lXjcV6LGmIxVtqv2wgFPsCCzg6Rl9ptcYt2iro7ns= X-Received: by 2002:a05:651c:207:b0:293:4fd2:9a59 with SMTP id y7-20020a05651c020700b002934fd29a59mr767048ljn.2.1676415518687; Tue, 14 Feb 2023 14:58:38 -0800 (PST) MIME-Version: 1.0 References: <20230214221534.3912898-1-pankaj.gupta@amd.com> In-Reply-To: From: "Ard Biesheuvel" Date: Tue, 14 Feb 2023 23:58:27 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] OvmfPkg: Remove gbs FreePool in AcceptAllMemory() To: Pankaj Gupta Cc: devel@edk2.groups.io, kraxel@redhat.com, dionnaglaze@google.com, jejb@linux.ibm.com, thomas.lendacky@amd.com, min.m.xu@intel.com, afish@apple.com, michael.d.kinney@intel.com Content-Type: text/plain; charset="UTF-8" On Tue, 14 Feb 2023 at 23:35, Ard Biesheuvel wrote: > > On Tue, 14 Feb 2023 at 23:15, Pankaj Gupta wrote: > > > > System Memory map is changed when a memory range is Accepted. > > While returning from AcceptAllMemory(), "gBS->FreePool" is wrongly > > used which results in changing memory map and hence return an error. > > Fix this by removing the "gBs->FreePool" call altogether. > > > > Before this patch, KVM guest throws an error and control goes to the > > boat loader menu every time we select an OS: > > > > EFI stub: ERROR: exit_boot() failed! > > EFI stub: ERROR: efi_main() failed! > > StartImage failed: Invalid Parameter > > > > Fixes: a00e2e5513 ("OvmfPkg: Add memory acceptance event in AmdSevDxe") > > Signed-off-by: Pankaj Gupta > > Queued as #4040 - thanks! > I've dropped it again - it seems AcceptAllMemory() should never be called a second time (and it is debatable whether the gEfiEventBeforeExitBootServicesGuid event should be signaled the second time), so it would be better to address that instead. > > --- > > OvmfPkg/AmdSevDxe/AmdSevDxe.c | 1 - > > 1 file changed, 1 deletion(-) > > > > diff --git a/OvmfPkg/AmdSevDxe/AmdSevDxe.c b/OvmfPkg/AmdSevDxe/AmdSevDxe.c > > index 6391d1f775..f52dbfe597 100644 > > --- a/OvmfPkg/AmdSevDxe/AmdSevDxe.c > > +++ b/OvmfPkg/AmdSevDxe/AmdSevDxe.c > > @@ -123,7 +123,6 @@ AcceptAllMemory ( > > } > > } > > > > - gBS->FreePool (AllDescMap); > > return Status; > > } > > > > -- > > 2.34.1 > >