Bug 947022 - postgresql package should be built with PIE flags
Summary: postgresql package should be built with PIE flags
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: postgresql
Version: rawhide
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Pavel Raiskup
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 1092552 1211541 (view as bug list)
Depends On: 952946
Blocks: harden-failure 1092574
TreeView+ depends on / blocked
 
Reported: 2013-04-01 09:16 UTC by Dhiru Kholia
Modified: 2015-10-15 16:50 UTC (History)
8 users (show)

Fixed In Version: postgresql-9.4.4-5.fc24
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-09-17 11:13:07 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1242817 0 unspecified CLOSED postgresql-9.4.4-2.fc23 FTBFS: configure: error: libperl library is required for Perl 2021-02-22 00:41:40 UTC

Internal Links: 1242817

Description Dhiru Kholia 2013-04-01 09:16:36 UTC
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 postgresql 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):

postgresql-server-9.2.3-1.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 postgresql-server-9.2.3-1.fc19.x86_64.rpm                         
...
postgresql-server,postgresql-server-9.2.3-1.fc19.x86_64.rpm,/usr/bin/postgres,NX=Enabled,CANARY=Enabled,RELRO=Partial,PIE=Disabled,RPATH=Disabled,RUNPATH=Disabled

 
Actual results:

/usr/bin/postgres has PIE disabled.

Expected results:

/usr/bin/postgres should have PIE enabled.

Comment 1 Dhiru Kholia 2013-04-01 09:19:35 UTC
Fixing the problem:

"_hardened_build" rpm spec macro can be used to harden a package.

For an example, see
http://pkgs.fedoraproject.org/cgit/clamav.git/tree/clamav.spec

Comment 2 Dhiru Kholia 2013-04-06 07:32:42 UTC
FWIW, other distributions ship PIE enabled postgresql 

https://bugs.launchpad.net/ubuntu/+source/postgresql-9.1/+bug/1039618

Comment 3 Tom Lane 2013-04-17 04:01:35 UTC
I'm concerned about the possible effects of this on the available address space in 32-bit mode: people tend to run Postgres with shared memory segments that are large enough that there's not huge amounts of address space available for ASLR to waste.  However, on my way to try to investigate how bad that issue might be in practice, I found out that there's significantly worse breakage that would have to be dealt with before we can even think about this: see bug #952946.

Comment 4 Fedora Admin XMLRPC Client 2013-05-09 14:06:44 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 5 Fedora Admin XMLRPC Client 2013-05-16 09:59:06 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 7 Pavel Raiskup 2014-04-30 05:30:27 UTC
*** Bug 1092552 has been marked as a duplicate of this bug. ***

Comment 8 Fedora End Of Life 2015-01-09 17:50:15 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 9 Pavel Raiskup 2015-01-09 18:22:05 UTC
Adding keyword to keep this filled against Rawhide.

Comment 10 Pavel Raiskup 2015-09-17 09:11:45 UTC
(In reply to Tom Lane from comment #3)
> I'm concerned about the possible effects of this on the available address
> space in 32-bit mode: people tend to run Postgres with shared memory
> segments that are large enough that there's not huge amounts of address
> space available for ASLR to waste.

As PostgreSQL now uses shm_open() & mmap(), it seems to be OK even with ASLR.
From my testing, [heap] segment always grows against mmap()'ed segments, and
it may jump over segments with mmap'ed libraries, etc.. as shown in example
mapping in bug #1263974.  So the address space may be almost ideally
allocated ..

> However, on my way to try to investigate
> how bad that issue might be in practice, I found out that there's
> significantly worse breakage that would have to be dealt with before we can
> even think about this: see bug #952946.

As mentioned in cited bug #952946, this seems to be fixed in Kernel 4.1+, so
we should be OK to finally enable hardening -- I'll do so now.

Readers, please stop me if I missed something important.

Comment 12 Pavel Raiskup 2015-10-15 16:50:27 UTC
*** Bug 1211541 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.