From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web12.10173.1616079488984304880 for ; Thu, 18 Mar 2021 07:58:09 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fh2WoBwC; spf=pass (domain: redhat.com, ip: 216.205.24.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616079488; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vWqn0fpA7uyFRdDtlUmnuyAkpClf4FPi4CQyx6LkZA0=; b=fh2WoBwCTx0s3psLie0GSu/TmA2smKR6Nz+xqnAsKqPcIa/neRSd86q10jNtGDbwgmqso4 YcEiggJgeKd0emRdwSEuz67xgvDQlO2gCTbKE3iqdpBmuEKmEV+jYpruaH6AO8z03ZIQGj 4zLNpKxqyfKFvJBYaQEQTFiirEPgXE4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-545-Xell1nAMMA2GaMgDnTPK3A-1; Thu, 18 Mar 2021 10:58:04 -0400 X-MC-Unique: Xell1nAMMA2GaMgDnTPK3A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 72407911E4; Thu, 18 Mar 2021 14:58:03 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-115-176.ams2.redhat.com [10.36.115.176]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9BD611992D; Thu, 18 Mar 2021 14:58:02 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH] OvmfPkg: strip build paths in release builds To: devel@edk2.groups.io, ross@burtonini.com References: <20210317153918.591140-1-ross.burton@arm.com> From: "Laszlo Ersek" Message-ID: <0196707e-7d7d-e8ad-c40c-dce6f9883ff3@redhat.com> Date: Thu, 18 Mar 2021 15:58:01 +0100 MIME-Version: 1.0 In-Reply-To: <20210317153918.591140-1-ross.burton@arm.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 03/17/21 16:39, Ross Burton wrote: > GenFw will embed a NM10 section which contains the path to the input file, (1) typo: should be NB10. > which means the output files have build paths embedded in them. To reduce > information leakage and ensure reproducible builds, pass --zero in release > builds to remove this information. > > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3256 > Change-Id: Ie607893b979674e237cf04ead5c7690d7b1aedaf (2) "Change-Id" is useless upstream, please drop it. > Signed-off-by: Ross Burton > --- > OvmfPkg/AmdSev/AmdSevX64.dsc | 1 + > OvmfPkg/Bhyve/BhyveX64.dsc | 1 + > OvmfPkg/OvmfPkgIa32.dsc | 2 ++ > OvmfPkg/OvmfPkgIa32X64.dsc | 1 + > OvmfPkg/OvmfPkgX64.dsc | 1 + > OvmfPkg/OvmfXen.dsc | 1 + > 6 files changed, 7 insertions(+) > > diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc > index 65c42284d9..69a05feea9 100644 > --- a/OvmfPkg/AmdSev/AmdSevX64.dsc > +++ b/OvmfPkg/AmdSev/AmdSevX64.dsc > @@ -78,6 +78,7 @@ > GCC:*_*_X64_GENFW_FLAGS = --keepexceptiontable > INTEL:*_*_X64_GENFW_FLAGS = --keepexceptiontable > !endif > + RELEASE_*_*_GENFW_FLAGS = --zero > > # > # Disable deprecated APIs. > diff --git a/OvmfPkg/Bhyve/BhyveX64.dsc b/OvmfPkg/Bhyve/BhyveX64.dsc > index 4a1cdf5aca..132f55cf69 100644 > --- a/OvmfPkg/Bhyve/BhyveX64.dsc > +++ b/OvmfPkg/Bhyve/BhyveX64.dsc > @@ -76,6 +76,7 @@ > GCC:*_*_X64_GENFW_FLAGS = --keepexceptiontable > INTEL:*_*_X64_GENFW_FLAGS = --keepexceptiontable > !endif > + RELEASE_*_*_GENFW_FLAGS = --zero > > # > # Disable deprecated APIs. > diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc > index 1eaf3e99c6..ce20f09df8 100644 > --- a/OvmfPkg/OvmfPkgIa32.dsc > +++ b/OvmfPkg/OvmfPkgIa32.dsc > @@ -90,6 +90,8 @@ > > !include NetworkPkg/NetworkBuildOptions.dsc.inc > > + RELEASE_*_*_GENFW_FLAGS = --zero > + > [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER] > GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000 > XCODE:*_*_*_DLINK_FLAGS = -seg1addr 0x1000 -segalign 0x1000 (3) The placement of this build option hampers the diffability between OvmfPkgIa32.dsc and {OvmfPkgIa32X64.dsc, OvmfPkgX64.dsc}. For example, if we diff OvmfPkgIa32.dsc and OvmfPkgIa32X64.dsc right now, we get a nice hunk like: > @@ -80,6 +79,11 @@ > !if $(TOOL_CHAIN_TAG) != "XCODE5" && $(TOOL_CHAIN_TAG) != "CLANGPDB" > GCC:*_*_*_CC_FLAGS = -mno-mmx -mno-sse > !endif > +!if $(SOURCE_DEBUG_ENABLE) == TRUE > + MSFT:*_*_X64_GENFW_FLAGS = --keepexceptiontable > + GCC:*_*_X64_GENFW_FLAGS = --keepexceptiontable > + INTEL:*_*_X64_GENFW_FLAGS = --keepexceptiontable > +!endif > > # > # Disable deprecated APIs. Therefore, in the "OvmfPkgIa32.dsc" file, please add the GENFW flags immediately after the "!endif" that's visible in the quoted context, like this: > diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc > index 1eaf3e99c6c5..93c209950c7b 100644 > --- a/OvmfPkg/OvmfPkgIa32.dsc > +++ b/OvmfPkg/OvmfPkgIa32.dsc > @@ -80,6 +80,7 @@ [BuildOptions] > !if $(TOOL_CHAIN_TAG) != "XCODE5" && $(TOOL_CHAIN_TAG) != "CLANGPDB" > GCC:*_*_*_CC_FLAGS = -mno-mmx -mno-sse > !endif > + RELEASE_*_*_GENFW_FLAGS = --zero > > # > # Disable deprecated APIs. Because that should allow for the following difference between Ia32 and Ia32X64: > @@ -80,6 +79,11 @@ > !if $(TOOL_CHAIN_TAG) != "XCODE5" && $(TOOL_CHAIN_TAG) != "CLANGPDB" > GCC:*_*_*_CC_FLAGS = -mno-mmx -mno-sse > !endif > +!if $(SOURCE_DEBUG_ENABLE) == TRUE > + MSFT:*_*_X64_GENFW_FLAGS = --keepexceptiontable > + GCC:*_*_X64_GENFW_FLAGS = --keepexceptiontable > + INTEL:*_*_X64_GENFW_FLAGS = --keepexceptiontable > +!endif > RELEASE_*_*_GENFW_FLAGS = --zero > > # The rest of the patch looks good to me. Thanks! Laszlo > diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc > index 4a5a430147..97cc438250 100644 > --- a/OvmfPkg/OvmfPkgIa32X64.dsc > +++ b/OvmfPkg/OvmfPkgIa32X64.dsc > @@ -84,6 +84,7 @@ > GCC:*_*_X64_GENFW_FLAGS = --keepexceptiontable > INTEL:*_*_X64_GENFW_FLAGS = --keepexceptiontable > !endif > + RELEASE_*_*_GENFW_FLAGS = --zero > > # > # Disable deprecated APIs. > diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc > index d4d601b444..f544fb04bf 100644 > --- a/OvmfPkg/OvmfPkgX64.dsc > +++ b/OvmfPkg/OvmfPkgX64.dsc > @@ -84,6 +84,7 @@ > GCC:*_*_X64_GENFW_FLAGS = --keepexceptiontable > INTEL:*_*_X64_GENFW_FLAGS = --keepexceptiontable > !endif > + RELEASE_*_*_GENFW_FLAGS = --zero > > # > # Disable deprecated APIs. > diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc > index 507029404f..fcaa35acf1 100644 > --- a/OvmfPkg/OvmfXen.dsc > +++ b/OvmfPkg/OvmfXen.dsc > @@ -74,6 +74,7 @@ > GCC:*_*_X64_GENFW_FLAGS = --keepexceptiontable > INTEL:*_*_X64_GENFW_FLAGS = --keepexceptiontable > !endif > + RELEASE_*_*_GENFW_FLAGS = --zero > > # > # Disable deprecated APIs. >