[llvm-bugs] [Bug 35478] New: Sections with linker-script added contents are treated as zero-size for RELRO processing
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Nov 30 03:23:14 PST 2017
https://bugs.llvm.org/show_bug.cgi?id=35478
Bug ID: 35478
Summary: Sections with linker-script added contents are treated
as zero-size for RELRO processing
Product: lld
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: ELF
Assignee: unassignedbugs at nondot.org
Reporter: jh7370.2008 at my.bristol.ac.uk
CC: llvm-bugs at lists.llvm.org
This is a problem with r318924, which I discovered when I was trying to rebase
https://reviews.llvm.org/D38361.
The change added isOutputSectionZeroSize(), which is called during the loop for
assigning segments to relro. By this point, the section Size (both for regular
and synthetic sections) field is not final. They are only final once
assignAddresses() has been called. If a linker script contains a section
assignment with BYTE-style commands, or Dot assignments, such as either of the
two below, it will still be treated as empty, and consequently could end up
being allocated to the relro segment.
Example directives:
.foo : { . += 1; *(.foo) }
.bar : { BYTE(1); *(.bar) }
To reproduce, modify the test in ELF/relro-non-contiguous-zerosize.s such that
the ".zero_size" section in the linker script has one of the above, then
observe that it is still in the RELRO segment in the output.
This does not affect all SyntheticSections, because some do not use Size in
their empty() function, but some do. It does affect all other sections.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171130/48dc1f73/attachment.html>
More information about the llvm-bugs
mailing list