aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2012-11-29 19:07:53 +0000
committerRoland McGrath <roland@gnu.org>2012-11-29 19:07:53 +0000
commita0c82a2bce5a71582e21f9f47fbaa253e1d65dff (patch)
tree93612c02b7ef5ebddfcda7cdc32c167f7973616f /bfd
parentea5e6b0efed02c5f934df7420aa9fa55aa84b635 (diff)
downloadfsf-binutils-gdb-a0c82a2bce5a71582e21f9f47fbaa253e1d65dff.zip
fsf-binutils-gdb-a0c82a2bce5a71582e21f9f47fbaa253e1d65dff.tar.gz
fsf-binutils-gdb-a0c82a2bce5a71582e21f9f47fbaa253e1d65dff.tar.bz2
bfd/
* elf-nacl.c (segment_eligible_for_headers): Disallow writable segments.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog4
-rw-r--r--bfd/elf-nacl.c8
2 files changed, 8 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 5d033a6..199e111 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,7 @@
+2012-11-29 Roland McGrath <mcgrathr@google.com>
+
+ * elf-nacl.c (segment_eligible_for_headers): Disallow writable segments.
+
2012-11-26 Roland McGrath <mcgrathr@google.com>
* elf-nacl.c (nacl_modify_segment_map): Don't crash when INFO is null.
diff --git a/bfd/elf-nacl.c b/bfd/elf-nacl.c
index ce401fa..6753c7c 100644
--- a/bfd/elf-nacl.c
+++ b/bfd/elf-nacl.c
@@ -43,9 +43,9 @@ segment_executable (struct elf_segment_map *seg)
}
/* Determine if this segment is eligible to receive the file and program
- headers. It must be non-executable and have contents. Its first
- section must start far enough past the page boundary to allow space
- for the headers. */
+ headers. It must be read-only, non-executable, and have contents.
+ Its first section must start far enough past the page boundary to
+ allow space for the headers. */
static bfd_boolean
segment_eligible_for_headers (struct elf_segment_map *seg,
bfd_vma maxpagesize, bfd_vma sizeof_headers)
@@ -56,7 +56,7 @@ segment_eligible_for_headers (struct elf_segment_map *seg,
return FALSE;
for (i = 0; i < seg->count; ++i)
{
- if (seg->sections[i]->flags & SEC_CODE)
+ if ((seg->sections[i]->flags & (SEC_CODE|SEC_READONLY)) != SEC_READONLY)
return FALSE;
if (seg->sections[i]->flags & SEC_HAS_CONTENTS)
any_contents = TRUE;