Actions
Bug #163
openPIE binaries cannot allocate memory
Status:
New
Priority:
Low
Assignee:
-
Start date:
2013-12-01
Due date:
% Done:
0%
Estimated time:
Description
After this commit illumos-packaging:0e39b90eab160820ae938fcb3ea27f056c482ef5 it is allowed to build PIE binaries, but such binaries cannot allocate memory. It probably because of wrong address of _END.
$ cat malloc-pie.c
#include <stdlib.h>
int
main (int argc, char *argv[])
{
return malloc (1024) == NULL;
}
$ gcc -pie -fpie malloc-pie.c -o malloc-pie
$ ./malloc-pie ; echo $?
1
$ gcc malloc-pie.c -o malloc-no-pie
$ ./malloc-no-pie ; echo $?
0
$ truss -o pie.log ./malloc-pie
$ grep brk pie.log
brk(0xFFFFFD7FFF400E30) Err#12 ENOMEM
$ truss -o no-pie.log ./malloc-no-pie
$ grep brk no-pie.log
brk(0x00600D50) = 0
brk(0x00604D50) = 0
Actions