From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from walk.intel-email.com (walk.intel-email.com [101.227.64.242]) by mx.groups.io with SMTP id smtpd.web11.59559.1680483160730756286 for ; Sun, 02 Apr 2023 17:52:41 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@byosoft.com.cn header.s=cloud-union header.b=KaI9Cb5K; spf=pass (domain: byosoft.com.cn, ip: 101.227.64.242, mailfrom: gaoliming@byosoft.com.cn) Received: from walk.intel-email.com (localhost [127.0.0.1]) by walk.intel-email.com (Postfix) with ESMTP id 6B964CD1F72A for ; Mon, 3 Apr 2023 08:52:37 +0800 (CST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=byosoft.com.cn; s=cloud-union; t=1680483157; bh=lAud0wOiqTYbzjw2zUyPdx1KhDzgV+Lx2N9XTPhrymU=; h=From:To:Cc:References:In-Reply-To:Subject:Date; b=KaI9Cb5KU8HnUgWkqKzXgtFHv98Oc8W8ikXhBX6vogcNSzi0doVJcaZLMWkoPTthH gU25G7hwwNT37/NqGQJH924h+NAyDoB1DtXBIk4s/wVzpQbvlQea6+N1e+qMe0pn7S Xj3+FnvvtFZ3X01Jvgl/vHilxtcqvVBAG8BUFvVE= Received: from localhost (localhost [127.0.0.1]) by walk.intel-email.com (Postfix) with ESMTP id 67622CD1F729 for ; Mon, 3 Apr 2023 08:52:37 +0800 (CST) Received: from walk.intel-email.com (localhost [127.0.0.1]) by walk.intel-email.com (Postfix) with ESMTP id 34740CD1F64D for ; Mon, 3 Apr 2023 08:52:37 +0800 (CST) Authentication-Results: walk.intel-email.com; none Received: from mail.byosoft.com.cn (mail.byosoft.com.cn [58.240.74.242]) by walk.intel-email.com (Postfix) with SMTP id B9059CD1F64A for ; Mon, 3 Apr 2023 08:52:34 +0800 (CST) Received: from DESKTOPS6D0PVI ([58.246.60.130]) (envelope-sender ) by 192.168.6.13 with ESMTP for ; Mon, 03 Apr 2023 08:52:29 +0800 X-WM-Sender: gaoliming@byosoft.com.cn X-Originating-IP: 58.246.60.130 X-WM-AuthFlag: YES X-WM-AuthUser: gaoliming@byosoft.com.cn From: "gaoliming" To: , , Cc: , , , , References: <024401d9638c$b73deb40$25b9c1c0$@byosoft.com.cn> <7C7DD6B9-D0E7-44B4-A4B3-19D4FAC1FF34@posteo.de> In-Reply-To: <7C7DD6B9-D0E7-44B4-A4B3-19D4FAC1FF34@posteo.de> Subject: =?UTF-8?B?5Zue5aSNOiBbZWRrMi1kZXZlbF0gW1BBVENIIDIvM10gQmFzZVRvb2xzL0NvbmYvdG9vbHNfZGVmOiBGaXggQ0xBTkdEV0FSRl9JQTMyX1g2NA==?= Date: Mon, 3 Apr 2023 08:52:29 +0800 Message-ID: <049801d965c6$916eada0$b44c08e0$@byosoft.com.cn> MIME-Version: 1.0 X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQJOaxiNc4R7FeyT+A7XZ+qXDkntSgDfWiOLrie7jaA= Sender: "gaoliming" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Content-Language: zh-cn Patrick: Can you give the reproduce step to generate ELF image that doesn't work w= ith the option max-page-size? > -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > =E5=8F=91=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io = =E4=BB=A3=E8=A1=A8 Marvin > H?user > =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2023=E5=B9=B43=E6=9C=8831=E6=97=A5 = 18:58 > =E6=94=B6=E4=BB=B6=E4=BA=BA: gaoliming > =E6=8A=84=E9=80=81: devel@edk2.groups.io; patrick.rudolph@9elements.com; > guo.dong@intel.com; gua.guo@intel.com; james.lu@intel.com; > ray.ni@intel.com; ardb@kernel.org > =E4=B8=BB=E9=A2=98: Re: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_def= : Fix > CLANGDWARF_IA32_X64 >=20 > Liming, >=20 > Platform maintainers can decide whether or not they want to combat *binar= y > corruption*? Excuse me, but what the bloody hell? This needs a root cause > analysis for which part of the stack silently borks us and not an =E2=80= =9Coh, if > something fails, well, copy and paste this workaround=E2=80=A6 maybe=E2= =80=9D. If you give > me an efficient way to reproduce it, I=E2=80=99ll do it. >=20 > Best regards, > Marvin >=20 > > On 31. Mar 2023, at 06:54, gaoliming wrote: > > > > =EF=BB=BFMarvin: > > Platform developer can decide how to configure this option in their DSC= file > to resolve their problem. This is one option for the platform developer. > > > > Thanks > > Liming > >> -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > >> =E5=8F=91=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io =E4=BB=A3=E8=A1=A8 Marvin > >> H?user > >> =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2023=E5=B9=B43=E6=9C=8828=E6=97= =A5 19:26 > >> =E6=94=B6=E4=BB=B6=E4=BA=BA: gaoliming > >> =E6=8A=84=E9=80=81: devel@edk2.groups.io; patrick.rudolph@9elements.co= m; > >> guo.dong@intel.com; gua.guo@intel.com; james.lu@intel.com; > >> ray.ni@intel.com; ardb@kernel.org > >> =E4=B8=BB=E9=A2=98: Re: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_= def: Fix > >> CLANGDWARF_IA32_X64 > >> > >> Hi all, > >> > >>>> On 28. Mar 2023, at 07:38, gaoliming > wrote: > >>> =EF=BB=BFPatrick: > >>> I prefer to override this option in DSC instead of the change in > >>> tools_def.txt. > >> > >> A DSC override to fix *binary corruption* of an unknown cause? It is > ridiculous > >> this can even happen silently, even though it=E2=80=99s unclear which = component > is at > >> fault. > >> > >>> Normal EFI image needs to set its page size for the smaller > >>> image size. > >>> > >>> You can see GCC DLINK option. It also sets page-size as 0x40. > >>> > >>> DEFINE GCC49_IA32_X64_DLINK_COMMON =3D -nostdlib > >> -Wl,-n,-q,--gc-sections -z > >>> common-page-size=3D0x40 > >> > >> Side note, the correct way to do this is setting max-page-size, not > >> common-page-size. > >> > >>> > >>> Thanks > >>> Liming > >>>> -----=E9=82=AE=E4=BB=B6=E5=8E=9F=E4=BB=B6----- > >>>> =E5=8F=91=E4=BB=B6=E4=BA=BA: devel@edk2.groups.io =E4=BB=A3=E8=A1=A8 Patrick > >>>> Rudolph > >>>> =E5=8F=91=E9=80=81=E6=97=B6=E9=97=B4: 2023=E5=B9=B43=E6=9C=8817=E6= =97=A5 22:06 > >>>> =E6=8A=84=E9=80=81: devel@edk2.groups.io; guo.dong@intel.com; > gua.guo@intel.com; > >>>> james.lu@intel.com; ray.ni@intel.com; mhaeuser@posteo.de; > >>>> ardb@kernel.org > >>>> =E4=B8=BB=E9=A2=98: [edk2-devel] [PATCH 2/3] BaseTools/Conf/tools_de= f: Fix > >>>> CLANGDWARF_IA32_X64 > >>>> > >>>> Drop the "-z max-page-size=3D0x40" option as it causes the ELF > >>>> header to overflow into the .text section, causing undefined > >>>> behaviour. > >> > >> That *definitely* is not a fix. Not only does this regress binary size= for > >> platforms that have tight SPI space constraints, it also only masks th= e issue. > In > >> the (frankly near-impossible) case the ELF header dramatically grows i= n > size, > >> who knows whether it can overflow again? > >> > >> Sorry, but the overall description is pretty vague. Which OS / compile= r > version > >> are you using? Do you have any trivial way to detect the corruption? I > never > >> really touched UefiPayloadPkg and have nothing set up to boot it to > reproduce > >> the issue. > >> > >> Best regards, > >> Marvin > >> > >>>> > >>>> With high optimization level it corrupts essential code and > >>>> the binary would crash. It might work with low optimization > >>>> level though. As the default is to use Oz and LTO, it always > >>>> crashes. > >>>> > >>>> Test: > >>>> The ELF generated by > >>>> 'python UefiPayloadPkg/UniversalPayloadBuild.py -a IA32' boots. > >>>> > >>>> Signed-off-by: Patrick Rudolph > >>>> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4357 > >>>> --- > >>>> BaseTools/Conf/tools_def.template | 2 +- > >>>> 1 file changed, 1 insertion(+), 1 deletion(-) > >>>> > >>>> diff --git a/BaseTools/Conf/tools_def.template > >>>> b/BaseTools/Conf/tools_def.template > >>>> index 9b59bd75c3..0c584ab390 100755 > >>>> --- a/BaseTools/Conf/tools_def.template > >>>> +++ b/BaseTools/Conf/tools_def.template > >>>> @@ -2866,7 +2866,7 @@ DEFINE CLANGDWARF_X64_PREFIX > =3D > >>>> ENV(CLANG_BIN) > >>>> > >>>> > >>>> # LLVM/CLANG doesn't support -n link option. So, it can't share the > same > >>>> IA32_X64_DLINK_COMMON flag. > >>>> > >>>> # LLVM/CLANG doesn't support common page size. So, it can't share th= e > >>>> same GccBase.lds script. > >>>> > >>>> -DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON =3D -nostdlib > >>>> -Wl,-q,--gc-sections -z max-page-size=3D0x40 > >>>> > >>>> +DEFINE CLANGDWARF_IA32_X64_DLINK_COMMON =3D -nostdlib > >>>> -Wl,-q,--gc-sections > >>>> > >>>> DEFINE CLANGDWARF_DLINK2_FLAGS_COMMON =3D > >>>> -Wl,--script=3D$(EDK_TOOLS_PATH)/Scripts/ClangBase.lds > >>>> > >>>> DEFINE CLANGDWARF_IA32_X64_ASLDLINK_FLAGS =3D > >>>> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) > >>>> -Wl,--defsym=3DPECOFF_HEADER_SIZE=3D0 > >>>> DEF(CLANGDWARF_DLINK2_FLAGS_COMMON) > >>>> -Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable > >>>> > >>>> DEFINE CLANGDWARF_IA32_X64_DLINK_FLAGS =3D > >>>> DEF(CLANGDWARF_IA32_X64_DLINK_COMMON) > >>>> -Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) > >>>> -Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive > >>>> > >>>> -- > >>>> 2.39.1 > >>>> > >>>> > >>>> > >>>> -=3D-=3D-=3D-=3D-=3D-=3D > >>>> Groups.io Links: You receive all messages sent to this group. > >>>> View/Reply Online (#101341): > >>>> https://edk2.groups.io/g/devel/message/101341 > >>>> Mute This Topic: https://groups.io/mt/97673649/4905953 > >>>> Group Owner: devel+owner@edk2.groups.io > >>>> Unsubscribe: https://edk2.groups.io/g/devel/unsub > >>>> [gaoliming@byosoft.com.cn] > >>>> -=3D-=3D-=3D-=3D-=3D-=3D > >> > >> > >> > >> > >> > > > > > > >=20 >=20 >=20 >=20 >=20