From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 7D705D804EA for ; Mon, 5 Feb 2024 00:44:31 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=siuF5uiFxEAklaoiPYPrfsrEesg6l64ETpoR/V+hO9w=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1707093870; v=1; b=v6D34TOich6MUF6LMp8log5yTsHsM5M5iMPKEBt3eRjMJI7XOPDY2Q5i7VlkOqISiMMsY9Uw CTzFWyoIWJ9DJGPUP59ReG/NtnfjZDuKJMBYUDRRr4xF5N+fzgZ09JfT34KCBwETmr7MDINGj80 ocdVqD4djH4LlF8708TAoRBg= X-Received: by 127.0.0.2 with SMTP id UgfQYY7687511xUyXYhjhKs2; Sun, 04 Feb 2024 16:44:30 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web11.52565.1707093869404799710 for ; Sun, 04 Feb 2024 16:44:29 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-251-kV2L1fdDML-4ptI9sdR6qg-1; Sun, 04 Feb 2024 19:44:24 -0500 X-MC-Unique: kV2L1fdDML-4ptI9sdR6qg-1 X-Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CE81B8350E1; Mon, 5 Feb 2024 00:44:23 +0000 (UTC) X-Received: from [10.39.192.18] (unknown [10.39.192.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 33FC21121312; Mon, 5 Feb 2024 00:44:22 +0000 (UTC) Message-ID: <1278eb3e-9194-1f39-db24-87cef500f042@redhat.com> Date: Mon, 5 Feb 2024 01:44:20 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH] OvmfPkg/Sec: Use correct prototype of ProcessLibraryConstructorList() To: Ard Biesheuvel , devel@edk2.groups.io Cc: kraxel@redhat.com, gaoliming@byosoft.com.cn, Ard Biesheuvel References: <20240202182455.1535328-1-ardb+git@google.com> From: "Laszlo Ersek" In-Reply-To: <20240202182455.1535328-1-ardb+git@google.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 5Qbj6QFHWTdf03wErQi6Vsxlx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=v6D34TOi; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none) Hello Ard, On 2/2/24 19:24, Ard Biesheuvel wrote: > From: Ard Biesheuvel >=20 > The prototype of ProcessLibraryConstructorList(), which is generated by > the build tools, depends on the boot phase, and SEC and PEI differ in > this regard. However, OVMF's SEC implemention includes PeimEntryPoint.h > and calls the PEI version of the protoype (passing NULL arguments), > whereas the actual implementation observed by the compiler follows the > SEC version, which takes VOID. >=20 > The compiler usually doesn't spot the difference, but the LTO linker > does, and throws an error: >=20 > MdePkg/Include/Library/PeimEntryPoint.h:74:1: error: type of 'ProcessLibr= aryConstructorList' does not match original declaration [-Werror=3Dlto-type= -mismatch] > 74 | ProcessLibraryConstructorList ( > | ^ > Build/OvmfX64/RELEASE_GCC5/X64/OvmfPkg/Sec/SecMain/DEBUG/AutoGen.c:310:1:= note: type mismatch in parameter 1 > 310 | ProcessLibraryConstructorList ( > | ^ > Build/OvmfX64/RELEASE_GCC5/X64/OvmfPkg/Sec/SecMain/DEBUG/AutoGen.c:310:1:= note: type 'void' should match type 'void *' > Build/OvmfX64/RELEASE_GCC5/X64/OvmfPkg/Sec/SecMain/DEBUG/AutoGen.c:310:1:= note: 'ProcessLibraryConstructorList' was previously declared here >=20 > Fix this by dropping the #include, and providing a declaration of > ProcessLibraryConstructorList() in SecMain.c >=20 > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4643 > Signed-off-by: Ard Biesheuvel > --- > OvmfPkg/Sec/SecMain.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) This issue was reported 5+ years ago: https://bugzilla.tianocore.org/show_bug.cgi?id=3D990 I asked for a general solution in BaseTools: https://bugzilla.tianocore.org/show_bug.cgi?id=3D991 Liming recommended that BaseTools should generate a proper declaration in "AutoGen.h": https://bugzilla.tianocore.org/show_bug.cgi?id=3D991#c2 But nothing happened. >=20 > diff --git a/OvmfPkg/Sec/SecMain.c b/OvmfPkg/Sec/SecMain.c > index 31da5d0ace51..7b7d4793984c 100644 > --- a/OvmfPkg/Sec/SecMain.c > +++ b/OvmfPkg/Sec/SecMain.c > @@ -11,7 +11,6 @@ > =20 > #include > =20 > -#include > #include > #include > #include > @@ -39,6 +38,12 @@ typedef struct _SEC_IDT_TABLE { > IA32_IDT_GATE_DESCRIPTOR IdtTable[SEC_IDT_ENTRY_COUNT]; > } SEC_IDT_TABLE; > =20 > +VOID > +EFIAPI > +ProcessLibraryConstructorList ( > + VOID > + ); > + This is my problem right here. Why do 10+ files have to do this individually? See the above BZs for details. Well, whatever. What a terrible project. *shrug* Reviewed-by: Laszlo Ersek > VOID > EFIAPI > SecStartupPhase2 ( > @@ -844,7 +849,7 @@ SecCoreStartupWithStack ( > InitializeCpuExceptionHandlers (NULL); > } > =20 > - ProcessLibraryConstructorList (NULL, NULL); > + ProcessLibraryConstructorList (); > =20 > if (!SevEsIsEnabled ()) { > // -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#115089): https://edk2.groups.io/g/devel/message/115089 Mute This Topic: https://groups.io/mt/104167522/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-