On Saturday, 19 November 2016 at 21:26:28 UTC, Chris Wright wrote:
On Sat, 19 Nov 2016 16:43:40 +0000, thedeemon wrote:
On Friday, 18 November 2016 at 11:02:20 UTC, Daniel Kozak
wrote:
Ubuntu 12.04 to 16.04 which has PIE enabled now, and there
are problems with D on it.
Where can I learn more about it?
It has been typo, it should not be 16.04 but 16.10.
Err.. I mean, what is PIE and what kind of problems with D are
there?
Position-Independent Executable, which is a binary that works
with Address Space Layout Randomization.
ASLR is a speedbump for attackers -- it puts the stack, heap,
and text of your program in random locations on each execution,
so an attacker has a lot more work to access globals or
specific functions.
I don't know what issues D has with them, but I'd guess it has
hard-coded locations for global variables or static data or
something.
As I understand it (I actually use Ubuntu 16.10 and D on it), the
only problem is that to produce PIE executables you need the
compiler to emit PIC object code (Position Independent Code). DMD
can produce it with the flag -fPIC, but the standard library is
compiled without this flag, so the linker rejects it. The current
workaround is to dynamically link to the shared version of
Phobos, because shared libraries are position independent by
default. The other alternative should be to recompile Phobos with
-fPIC, but I'm too lazy to investigate this.