libpfm-4.9.0-2.fc28 was not built with the official Fedora build flags from redhat-rpm-config: make[1]: Entering directory '/builddir/build/BUILD/libpfm-4.9.0/lib' cc -g -Wall -Werror -Wextra -Wno-unused-parameter -I. -I/builddir/build/BUILD/libpfm-4.9.0/lib/../include -DCONFIG_PFMLIB_DEBUG -DCONFIG_PFMLIB_OS_LINUX -D_REENTRANT -I. -fvisibility=hidden -DCONFIG_PFMLIB_ARCH_X86 -DCONFIG_PFMLIB_ARCH_X86_64 -I. -c pfmlib_common.c In the spec file, I do not see any attempt to inject $RPM_OPT_FLAGS or $RPM_LD_FLAGS into the build.
Patched the libpfm.spec to pass in the %{optflags}. However, builds showed that the new compiler checks enabled would flag some snprintf functions as possibly being truncated. Submitted a patch for upstream review to check the snprintf return value to detect truncation during runtime: https://sourceforge.net/p/perfmon2/mailman/message/36210397/ Tried scratch builds with the proposed libpfm patch, but the i686 builds fail due to an internal gcc compiler error (rhbz1538648).
(In reply to William Cohen from comment #1) > Patched the libpfm.spec to pass in the %{optflags}. However, builds showed > that the new compiler checks enabled would flag some snprintf functions as > possibly being truncated. Submitted a patch for upstream review to check > the snprintf return value to detect truncation during runtime: > > https://sourceforge.net/p/perfmon2/mailman/message/36210397/ Thanks! (opendir allocates internally anyway, so you could perhaps use asprintf and do away with the explicit length management.) > Tried scratch builds with the proposed libpfm patch, but the i686 builds > fail due to an internal gcc compiler error (rhbz1538648). Got a link to the scratch build? There should be a workaround for that one in the current rawhide buildroot.
Thanks for the comments about the libpfm upstream patch. I tried another koji scratch build and it still fails as of 5:30pm EST. https://koji.fedoraproject.org/koji/taskinfo?taskID=24578435
(In reply to William Cohen from comment #3) > Thanks for the comments about the libpfm upstream patch. > > I tried another koji scratch build and it still fails as of 5:30pm EST. > > https://koji.fedoraproject.org/koji/taskinfo?taskID=24578435 This is due to the captured build flags for building Python modules. We need to rebuild python2 to pick up the new build flags, but we currently can't due to bug 1540316. (We also have a real fix for GCC upstream now, which will make it into Fedora soon.)
Built libpfm-4.9.0-4.fc28 in rawhide now.
This is partially unfixed. # rpm -qf /lib64/libpfm.so.4.9.0 libpfm-4.9.0-5.fc28.x86_64 # checksec --file /lib64/libpfm.so.4.9.0 RELRO STACK CANARY NX PIE RPATH RUNPATH FORTIFY Fortified Fortifiable FILE Partial RELRO Canary found NX enabled DSO No RPATH No RUNPATH Yes 7 11 /lib64/libpfm.so.4.9.0 Should be “Full RELRO”, not “Partial RELRO”. There are no LDFLAGS on the linker command line: cc -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -mcet -fcf-protection -g -Wall -Werror -Wextra -Wno-unused-parameter -I. -I/builddir/build/BUILD/libpfm-4.9.0/lib/../include -DCONFIG_PFMLIB_DEBUG -DCONFIG_PFMLIB_OS_LINUX -D_REENTRANT -I. -fvisibility=hidden -DCONFIG_PFMLIB_ARCH_X86 -DCONFIG_PFMLIB_ARCH_X86_64 -I. -shared -Wl,-soname -Wl,libpfm.so.4 -o libpfm.so.4.9.0 pfmlib_common.lo […] See https://src.fedoraproject.org/rpms/redhat-rpm-config/blob/master/f/buildflags.md for information on RPM macros and environment variables provided by the build environment.
Should be fixed in libpfm-4.9.0-6.fc29 also merged the libpfm.spec fix into f28 branch. Now have the following in the library: $ checksec --file /lib64/libpfm.so.4.9.0 RELRO STACK CANARY NX PIE RPATH RUNPATH FORTIFY Fortified Fortifiable FILE Full RELRO Canary found NX enabled DSO No RPATH No RUNPATH Yes 7 11 /lib64/libpfm.so.4.9.0