Skip to content
Snippets Groups Projects
Select Git revision
21 results Searching

binutils-gdb

user avatar
Matthieu Longo authored
The bti-far.ld and bti-plt.ld scripts don't provide information enough to the
linker to assess the right set of permisssions on segments (i.e. Read/Write/Execute).
This insufficiency caused the linker to bundle all the sections in a same segment
with the union of all the required permissions, i.e. RWX.
A segment with such lax permissions constitutes a security hole, so the linker
emits the following warning message:
    <ELF file> has a LOAD segment with RWX permissions.
This warning message is noisy in the tests, and has no reason to exist.

This issue can be addressed in two ways:
- either by providing the right set of permissions on a section so that the
  linker assigns them to a segment with compatible permissions.
- or by providing alignment constraints so that the linker can move the sections
  automatically to a new segment and set the right permission for non-executable
  data.

The second option seems to be the preferred approach, even if not explicitly
recommended. Examples of linker scripts for AArch64 are available at [1].
The fixes in bti-far.ld and bti-plt.ld are the same, except that bti-far.ld also
contains a ".far" section, to make sure that it generates the trampolines correctly.

[1]: https://developer.arm.com/documentation/dui0474/m/gnu-ld-script-support-in
     -armlink/default-gnu-ld-scripts-used-by-armlink/default-ld-script-when
     -building-an-executable?lang=en
1905f685
History
Name Last commit Last update