diff options
author | Russ Cox <rsc@golang.org> | 2010-04-20 20:39:55 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2010-04-20 20:39:55 -0700 |
commit | 35c183cd73760f82f534b657a8a87c520abd4b28 (patch) | |
tree | 418f8b65da3bd38bb9943f969c923546ac198188 /src | |
parent | 46914854ff711a1dd6f46ab7c62f78acade05a72 (diff) | |
download | golang-35c183cd73760f82f534b657a8a87c520abd4b28.tar.gz |
6l, 8l: include ELF header in PT_LOAD mapping for text segment
Due to page boundary rounding, the header would have
been loaded as part of the text segment already, but this
change placates the "paxctl" tool on so-called hardened
Linux distributions (as if normal distributions weren't already
hard enough to use).
R=r
CC=golang-dev
http://codereview.appspot.com/954041
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd/6l/asm.c | 10 | ||||
-rw-r--r-- | src/cmd/8l/asm.c | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/cmd/6l/asm.c b/src/cmd/6l/asm.c index af00f5594..b83cec68f 100644 --- a/src/cmd/6l/asm.c +++ b/src/cmd/6l/asm.c @@ -713,11 +713,11 @@ asmb(void) ph = newElfPhdr(); ph->type = PT_LOAD; ph->flags = PF_X+PF_R; - ph->vaddr = va; - ph->paddr = va; - ph->off = fo; - ph->filesz = w; - ph->memsz = w; + ph->vaddr = va - fo; + ph->paddr = va - fo; + ph->off = 0; + ph->filesz = w + fo; + ph->memsz = w + fo; ph->align = INITRND; fo = rnd(fo+w, INITRND); diff --git a/src/cmd/8l/asm.c b/src/cmd/8l/asm.c index eddf6617b..4e8c0560d 100644 --- a/src/cmd/8l/asm.c +++ b/src/cmd/8l/asm.c @@ -829,11 +829,11 @@ asmb(void) ph = newElfPhdr(); ph->type = PT_LOAD; ph->flags = PF_X+PF_R; - ph->vaddr = va; - ph->paddr = va; - ph->off = fo; - ph->filesz = w; - ph->memsz = w; + ph->vaddr = va - fo; + ph->paddr = va - fo; + ph->off = 0; + ph->filesz = w + fo; + ph->memsz = w + fo; ph->align = INITRND; fo = rnd(fo+w, INITRND); |