Description of problem: http://fedoraproject.org/wiki/Packaging:Guidelines#PIE says that "you MUST enable the PIE compiler flags if your package is long running ...". However, currently varnish is not being built with PIE flags. This is a clear violation of the packaging guidelines. This issue (in its wider scope) is being discussed at, https://fedorahosted.org/fesco/ticket/1104 https://lists.fedoraproject.org/pipermail/devel/2013-March/180827.html Version-Release number of selected component (if applicable): varnish-3.0.3-4.fc19.x86_64.rpm How reproducible: You can use following programs to check if a package is hardened: http://people.redhat.com/sgrubb/files/rpm-chksec OR https://github.com/kholia/checksec Steps to Reproduce: Get scanner.py from https://github.com/kholia/checksec $ ./scanner.py varnish-3.0.3-4.fc19.x86_64.rpm varnish,varnish-3.0.3-4.fc19.x86_64.rpm,/usr/bin/varnishadm,NX=Enabled,CANARY=Enabled,RELRO=Partial,PIE=Disabled,RPATH=Disabled,RUNPATH=Disabled,FORTIFY=Enabled,CATEGORY=network-ip varnish,varnish-3.0.3-4.fc19.x86_64.rpm,/usr/bin/varnishhist,NX=Enabled,CANARY=Disabled,RELRO=Partial,PIE=Disabled,RPATH=Disabled,RUNPATH=Disabled,FORTIFY=NA,CATEGORY=None varnish,varnish-3.0.3-4.fc19.x86_64.rpm,/usr/bin/varnishlog,NX=Enabled,CANARY=Enabled,RELRO=Partial,PIE=Disabled,RPATH=Disabled,RUNPATH=Disabled,FORTIFY=Enabled,CATEGORY=None varnish,varnish-3.0.3-4.fc19.x86_64.rpm,/usr/bin/varnishncsa,NX=Enabled,CANARY=Enabled,RELRO=Partial,PIE=Disabled,RPATH=Disabled,RUNPATH=Disabled,FORTIFY=Enabled,CATEGORY=None varnish,varnish-3.0.3-4.fc19.x86_64.rpm,/usr/bin/varnishreplay,NX=Enabled,CANARY=Enabled,RELRO=Partial,PIE=Disabled,RPATH=Disabled,RUNPATH=Disabled,FORTIFY=Enabled,CATEGORY=network-ip varnish,varnish-3.0.3-4.fc19.x86_64.rpm,/usr/bin/varnishsizes,NX=Enabled,CANARY=Disabled,RELRO=Partial,PIE=Disabled,RPATH=Disabled,RUNPATH=Disabled,FORTIFY=NA,CATEGORY=None varnish,varnish-3.0.3-4.fc19.x86_64.rpm,/usr/bin/varnishstat,NX=Enabled,CANARY=Enabled,RELRO=Partial,PIE=Disabled,RPATH=Disabled,RUNPATH=Disabled,FORTIFY=NA,CATEGORY=None varnish,varnish-3.0.3-4.fc19.x86_64.rpm,/usr/bin/varnishtest,NX=Enabled,CANARY=Enabled,RELRO=Partial,PIE=Disabled,RPATH=Disabled,RUNPATH=Disabled,FORTIFY=Enabled,CATEGORY=network-local varnish,varnish-3.0.3-4.fc19.x86_64.rpm,/usr/bin/varnishtop,NX=Enabled,CANARY=Disabled,RELRO=Partial,PIE=Disabled,RPATH=Disabled,RUNPATH=Disabled,FORTIFY=Enabled,CATEGORY=None varnish,varnish-3.0.3-4.fc19.x86_64.rpm,/usr/sbin/varnishd,NX=Enabled,CANARY=Enabled,RELRO=Partial,PIE=Disabled,RPATH=Disabled,RUNPATH=Disabled,FORTIFY=Enabled,CATEGORY=network-ip
Created attachment 748047 [details] this should enable PIE
Ingvar, Can you please try the attached patch which fixes the reported problem?
I'm a bit confused about this. About PIE: Varnish does not have built-in support for pie, like eg. Apache httpd has (ie. no --enable-pie). The package guidelines says I MUST enable the PIE compiler flags, but using the proposed macro _hardened_build only adds -fPIC to the library builds. -fPIE is not added anywhere. Do I have to do this by hand? How? About PIC: I thought Fedora/autotools would add -fPIC by itself when available, if the configure script looks for it. While it seems it does in varnish' case, not all gcc calls get it added. Adding _hardened_build adds -fPIC to all libtool-called gcc library builds, so I guess that's allright. Right? How does this differ from just calling configure with --with-pic? I built packages for f19 with _hardened_build, see http://users.linpro.no/ingvar/varnish/3.0.3/3.0.3-5 See attachement for result after adding _hardened_build. Is this sufficient? Ingvar
Created attachment 748246 [details] Ouput of rpm-chksec on varnish packages with enabled _hardened_build
(In reply to comment #3) > Varnish does not have built-in support for pie, like eg. Apache httpd has > (ie. no --enable-pie). The package guidelines says I MUST enable the PIE > compiler flags, but using the proposed macro _hardened_build only adds -fPIC > to the library builds. -fPIE is not added anywhere. Do I have to do this by > hand? How? See the output of the following commands, ✗ rpm --define '_hardened_build 1' -E '%{?__global_cflags}' -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 ✗ rpm --define '_hardened_build 1' -E '%{?__global_ldflags}' -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld $ cat /usr/lib/rpm/redhat/redhat-hardened-cc1 *cc1_options: + %{!fpie:%{!fPIE:%{!fpic:%{!fPIC:%{!fno-pic:-fPIE}}}}} Notice that the "-fPIE" flag is automatically added once you include "%global _hardened_build 1" in your .spec file. Please see my attachment for a patched .spec file (in case of problems). > I built packages for f19 with _hardened_build, see > http://users.linpro.no/ingvar/varnish/3.0.3/3.0.3-5 > > See attachement for result after adding _hardened_build. Is this sufficient? Yes, it is sufficient. Thanks!
Okay, I have built packages, and would like to add an update. Should I tag it as bugfix or security? Ingvar
Tagging it as "bugfix" is OK I think.
varnish-3.0.3-5.fc17 has been submitted as an update for Fedora 17. https://admin.fedoraproject.org/updates/varnish-3.0.3-5.fc17
varnish-3.0.3-5.fc18 has been submitted as an update for Fedora 18. https://admin.fedoraproject.org/updates/varnish-3.0.3-5.fc18
varnish-3.0.3-5.fc19 has been submitted as an update for Fedora 19. https://admin.fedoraproject.org/updates/varnish-3.0.3-5.fc19
Package varnish-3.0.3-5.fc19: * should fix your issue, * was pushed to the Fedora 19 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing varnish-3.0.3-5.fc19' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2013-8338/varnish-3.0.3-5.fc19 then log in and leave karma (feedback).
varnish-3.0.3-5.fc17 has been pushed to the Fedora 17 stable repository. If problems still persist, please make note of it in this bug report.
varnish-3.0.3-5.fc19 has been pushed to the Fedora 19 stable repository. If problems still persist, please make note of it in this bug report.
varnish-3.0.3-5.fc18 has been pushed to the Fedora 18 stable repository. If problems still persist, please make note of it in this bug report.