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

@ -28,7 +28,7 @@
#define WasImported(SLOT) \
((void *)*SLOT && *SLOT != (void *)&missingno /* see libc/crt/crt.S */)
static privileged void __print$nt(const void *data, size_t len) {
static void __print$nt(const void *data, size_t len) {
int64_t hand;
char xmm[256];
uint32_t wrote;
@ -49,7 +49,7 @@ static privileged void __print$nt(const void *data, size_t len) {
* @param len can be computed w/ tinystrlen()
* @clob nothing except flags
*/
privileged void __print(const void *data, size_t len) {
textsyscall void __print(const void *data, size_t len) {
int64_t ax, ordinal;
if (WasImported(__imp_WriteFile)) {
__print$nt(data, len);
@ -68,7 +68,7 @@ privileged void __print(const void *data, size_t len) {
}
}
privileged void __print_string(const char *s) {
void __print_string(const char *s) {
size_t n = 0;
while (s[n]) ++n;
__print(s, n);