Subject: Re: Importing PaX features to NetBSD
To: Matt Thomas <matt@3am-software.com>
From: None <pageexec@freemail.hu>
List: tech-security
Date: 12/19/2005 02:18:54
On 18 Dec 2005 at 16:50, Matt Thomas wrote:
> Things like 'const char * const foo[] = { "a", "b" };' will be placed
> entirely in .rodata since of the text PT_LOAD for a normal executable
> which means that it can be shared.  In a PIE executable, foo will need
> to relocated and so can not be shared.  So PIE not only have a CPU cost
> for the relocations, but also a memory cost since fewer pages can be shared.

ok, i see what you meant and the answer is 'yes and no'. you're correct
that constructs like that will need relocations in PIEs but they won't
be text relocations (and hence relocation processing won't be any more
complex) as gcc will put such pointers into .data instead. and yes, you'd
normally lose the 'const' property on this data were it not for a new
binutils (and glibc) feature called RELRO [1].

[1] http://sources.redhat.com/ml/binutils/2004-01/msg00070.html