Aleksey Cheusov | 5 Dec 2011 21:15
Picon
Favicon

ASLR and PIE

Address Space Layout Randomization was implemented in NetBSD
years ago but all userspace utilities including daemons
are still built without PIC (Position Independend Code).

Was this made by intention?  If yes, can anybody please expain this
decision?

If no, can we build everything (or daemons) with PAE by default?

--

-- 
Best regards, Aleksey Cheusov.

Thor Lancelot Simon | 5 Dec 2011 21:41
Picon
Favicon

Re: ASLR and PIE

On Mon, Dec 05, 2011 at 11:15:26PM +0300, Aleksey Cheusov wrote:
> Address Space Layout Randomization was implemented in NetBSD
> years ago but all userspace utilities including daemons
> are still built without PIC (Position Independend Code).
> 
> Was this made by intention?  If yes, can anybody please expain this
> decision?

On some platforms, ASLR in particular has a very large runtime cost
which is hard to avoid (it's not free anywhere).  Similarly, on
platforms which are register-poor, PIC is not always the best choice.

However, I have considerable experience with a NetBSD-based embedded
system which built as much as possible with PIE and ASLR.  This
revealed a number of issues which would, even if we decided to do so
immediately, make it impossible to build the whole system PIE and
run it with ASLR.  Among these are:

	1) Incompatibility of our thread library with ASLR.

	2) Incompatibility of crunchgen with object files built
	   for PIE, causing /rescue to be unbuildable.

	3) Incompatibility of our debugger with PIE executables and
	   with ASLR.

	4) Existence of various "private" libraries in the system
	   which are built using our library build framework but
	   not installed, thus making it hard to be sure you've
	   caught all the libraries and made them build PIC.
(Continue reading)

Joerg Sonnenberger | 5 Dec 2011 22:13
Picon

Re: ASLR and PIE

On Mon, Dec 05, 2011 at 03:41:35PM -0500, Thor Lancelot Simon wrote:
> 	1) Incompatibility of our thread library with ASLR.

Except VAX, this is no longer a problem.

Joerg


Gmane