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 90273740035 for ; Tue, 6 Feb 2024 22:52:47 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=VYaK0vOjvkFQ/uWCLMz6wsTL7WfWh3yFp6kINq57tTE=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:From:To:Cc:Reply-To:References:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1707259966; v=1; b=bT7XlGmG+9beJceNSfu0VZ3PLIUrw3vvwhk1AmVKolxIPwElMIVEssUc2nSifZ1roUvs1DxM +xMxnbCkrtSGGzxJarmMxgBd0aRkVnyma8mxGkTvDeN1v0ev+kISuSaAc5EuipKaqs9bUXJxI+/ 2pvDUk2FSDsAZW/mVoXRwfkk= X-Received: by 127.0.0.2 with SMTP id mrF4YY7687511xR3I1Rc7LMc; Tue, 06 Feb 2024 14:52:46 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.7246.1707259965446468293 for ; Tue, 06 Feb 2024 14:52:45 -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-90-dPiTHMuZO3CeXgSa9FTF2A-1; Tue, 06 Feb 2024 17:52:40 -0500 X-MC-Unique: dPiTHMuZO3CeXgSa9FTF2A-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 8CE2F101FA2F; Tue, 6 Feb 2024 22:52:40 +0000 (UTC) X-Received: from [10.39.195.129] (unknown [10.39.195.129]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4721B1121312; Tue, 6 Feb 2024 22:52:38 +0000 (UTC) Message-ID: <857c46b1-fba5-ef3c-5c54-86e142db9085@redhat.com> Date: Tue, 6 Feb 2024 23:52:37 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH] OvmfPkg/Sec: Use correct prototype of ProcessLibraryConstructorList() From: "Laszlo Ersek" To: Ard Biesheuvel , devel@edk2.groups.io Cc: kraxel@redhat.com, gaoliming@byosoft.com.cn, Ard Biesheuvel Reply-To: devel@edk2.groups.io,lersek@redhat.com References: <20240202182455.1535328-1-ardb+git@google.com> <1278eb3e-9194-1f39-db24-87cef500f042@redhat.com> In-Reply-To: <1278eb3e-9194-1f39-db24-87cef500f042@redhat.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 List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: F9oET89jveKBlwjvB8hQafLIx7686176AA= 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=bT7XlGmG; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On 2/5/24 01:44, Laszlo Ersek wrote: > Hello Ard, >=20 > On 2/2/24 19:24, Ard Biesheuvel wrote: >> From: Ard Biesheuvel >> >> 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. >> >> The compiler usually doesn't spot the difference, but the LTO linker >> does, and throws an error: >> >> MdePkg/Include/Library/PeimEntryPoint.h:74:1: error: type of 'ProcessLib= raryConstructorList' does not match original declaration [-Werror=3Dlto-typ= e-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 >> >> Fix this by dropping the #include, and providing a declaration of >> ProcessLibraryConstructorList() in SecMain.c >> >> 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(-) >=20 > This issue was reported 5+ years ago: >=20 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D990 >=20 > I asked for a general solution in BaseTools: >=20 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D991 >=20 > Liming recommended that BaseTools should generate a proper declaration > in "AutoGen.h": >=20 > https://bugzilla.tianocore.org/show_bug.cgi?id=3D991#c2 >=20 > 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 >> + ); >> + >=20 > This is my problem right here. >=20 > Why do 10+ files have to do this individually? See the above BZs for > details. I'm working on patches that will solve this problem centrally; I'm including this patch at the front of that series. Thanks Laszlo >=20 > Well, whatever. >=20 > What a terrible project. >=20 > *shrug* >=20 > Reviewed-by: Laszlo Ersek >=20 >> VOID >> EFIAPI >> SecStartupPhase2 ( >> @@ -844,7 +849,7 @@ SecCoreStartupWithStack ( >> InitializeCpuExceptionHandlers (NULL); >> } >> =20 >> - ProcessLibraryConstructorList (NULL, NULL); >> + ProcessLibraryConstructorList (); >> =20 >> if (!SevEsIsEnabled ()) { >> // >=20 >=20 >=20 >=20 >=20 >=20 -=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 (#115191): https://edk2.groups.io/g/devel/message/115191 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-