-
Notifications
You must be signed in to change notification settings - Fork 202
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[LibOS] Move checkpoint special sections to RELRO segment
Currently, `.cp_name.*` and other checkpoint sections are included in the `.rodata` section in the output. However, these sections require relocation, and are thus marked writable. This causes the entire text segment of `libsysdb.so` to become RWX. This change adds `.data.rel.ro` section to the linker script and moves these sections there. Additionally, other `.data.rel.ro.*` sections in input files are also moved there, improving RELRO coverage. Signed-off-by: Marcelina Kościelnicka <mwk@invisiblethingslab.com>
- Loading branch information
Showing
5 changed files
with
39 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import argparse | ||
import sys | ||
from elftools.elf.elffile import ELFFile | ||
from elftools.elf.constants import P_FLAGS | ||
|
||
argparser = argparse.ArgumentParser() | ||
argparser.add_argument('infile', type=argparse.FileType('rb')) | ||
|
||
args = argparser.parse_args() | ||
|
||
elf = ELFFile(args.infile) | ||
for i, segment in enumerate(elf.iter_segments()): | ||
if segment.header.p_flags & P_FLAGS.PF_X and segment.header.p_flags & P_FLAGS.PF_W: | ||
print(f"error: segment {i} is both writable and executable") | ||
sys.exit(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters