Implement more security stuff

- Support deterministic stacks on OpenBSD
- Support OpenBSD system call origin verification
- Fix overrun by one in chibicc string token allocator
- Get all chibicc tests passing under Address Sanitizer
This commit is contained in:
Justine Tunney 2021-02-02 20:21:06 -08:00
parent cbfd4ccd1e
commit c843243322
56 changed files with 376 additions and 245 deletions

View file

@ -17,6 +17,7 @@
│ PERFORMANCE OF THIS SOFTWARE. │
╚─────────────────────────────────────────────────────────────────────────────*/
#include "ape/relocations.h"
#include "libc/macros.h"
/**
* @fileoverview Cosmopolitan ELF-Normative Linker Script.
@ -66,6 +67,9 @@ SECTIONS {
.text : {
*(SORT_BY_ALIGNMENT(.text.hot))
KEEP(*(.keep.text))
HIDDEN(__text_syscall_start = .);
*(.text.syscall .text.syscall.*)
HIDDEN(__text_syscall_end = .);
*(.text .text.*)
KEEP(*(SORT_BY_NAME(.sort.text.*)))
}
@ -207,3 +211,7 @@ SECTIONS {
*(.*)
}
}
HIDDEN(__text_syscall_addr = ROUNDDOWN(__text_syscall_start, PAGESIZE));
HIDDEN(__text_syscall_size = (ROUNDUP(__text_syscall_end, PAGESIZE) -
ROUNDDOWN(__text_syscall_start, PAGESIZE)));