Bug 2111196

Summary: FTBFS with -Wp,-D_FORTIFY_SOURCE=3
Product: [Fedora] Fedora Reporter: Siddhesh Poyarekar <sipoyare>
Component: nvmlAssignee: Krzysztof Czurylo <krzysztof.czurylo>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 37CC: kilobyte, krzysztof.czurylo, lamm, marcin.slusarz
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Siddhesh Poyarekar 2022-07-26 16:50:34 UTC
Description of problem:
Building with _FORTIFY_SOURCE=3 does not work with nvml because it does not seem to clear the previous _FORTIFY_SOURCE definition correctly.  Ideally, it should clear and redefine only if _FORTIFY_SOURCE has been defined to a lower level because otherwise it ends up lowering the level of protection.

How reproducible:
Always

Steps to Reproduce:
1. Change _FORTIFY_SOURCE value in %_preprocessor_defines in /usr/lib/rpm/redhat/macros to 3.

2. Build the nvml package

Actual results:
Full log here:

https://download.copr.fedorainfracloud.org/results/siddhesh/mpb.1/fedora-rawhide-x86_64/04659390-nvml/builder-live.log.gz

gcc -MD -O2  -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -DUSE_RPMEM -std=gnu99 -Wall -Werror -Wmissing-prototypes -Wpointer-arith -Wsign-conversion -Wsign-compare -Wconversion -fno-common -DSRCVERSION='"1.12.0"' -DSDS_ENABLED -Wunused-macros -Wmissing-field-initializers -Wfloat-equal -Wswitch-default -Wcast-function-type -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2   -I../../../src/../src/common -I../../../src/../src/core  -I../../../src/../src/core -I../../../src/../src/common -I../../../src/../src/libpmemlog -I../../../src/../src/libpmemblk -I../../../src/../src/libpmemobj -I../../../src/../src/tools/pmempool -D__USE_UNIX98 -I../../../src/../src/common -I../../../src/../src/rpmem_common -I../../../src/../src/libpmem2 -I../../../src/../src/librpmem -I../../../src/../src/libpmemlog -I../../../src/../src/libpmemblk -I../../../src/../src/libpmemobj -I. -I../../../src/../src/include  -c -o pmempool.o  pmempool.c
<command-line>: error: "_FORTIFY_SOURCE" redefined [-Werror]
<command-line>: note: this is the location of the previous definition
cc1: all warnings being treated as errors

Comment 1 Ben Cotton 2022-08-09 13:23:08 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 37 development cycle.
Changing version to 37.