------- Comment From azane...@br.ibm.com 2015-01-26 16:02 EDT-------
This is a comment from Alan Modra:

COMMONPAGESIZE in the linker should match kernel page size for two reasons:
- The linker optimisation that trades disk pages for memory pages is most
effective when they match.  If you're running a kernel that, say, uses 64k
pages, but your linker commonpagesize is 4k then your executables and
shared libraries will use up to 4k extra on disk but be ineffective in
saving memory pages.  Only 1 in 16 binaries will save a memory page.
Conversely, if your kernel used 4k pages but commonpagesize was 16k, then
you'd waste up to 16k on disk to make only a 4k saving in memory, ie. you'd
be wasting 12k of disk to no purpose.
- The linker -z relro layout also uses commonpagesize.  Some might say this
is a bug..  -z relro also increases executable size, both in memory and on
disk, in order to reduce the potential for an evil attacker to subvert a
binary, by making more of the binary read-only at startup.  Like the
disk/memory tradeoff, -z relro is ineffective if commonpagesize is
*smaller* than the actual kernel page size.  (The same 1 in n binaries,
where n is commonpagesize/kernelpagesize, will properly protect the last
page in the relro area.)  If commonpagesize is larger than the kernel page
size then -z relro works but wastes memory.

So that's the WHY.  Sorry it isn't complete as I don't know off the top of
my head what page size the Ubuntu kernels use.

Note that from the -z relro view, we have other things that need fixing in
the linker but I wouldn't recommend backporting just yet.  The patches I've
committed upstream 3e2b0f31, 23283c1b, 5ad18f16, aren't too well tested and
are known to break some xlc compiled binaries.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1412553

Title:
  RELRO not working on Ubuntu 14.04

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/binutils/+bug/1412553/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to