mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-06 03:08:31 +00:00
Elevate .text.syscall to .privileged
It turns out adding OpenBSD msyscall() origin verification broke the --ftrace flag. The executable needs to issue raw syscalls while it's rewriting itself. So they need to be in the same section, and that's just plain simpler too.
This commit is contained in:
parent
d7733579d3
commit
9f149e1de3
19 changed files with 30 additions and 38 deletions
|
@ -21,7 +21,7 @@
|
|||
#include "libc/sysv/consts/sig.h"
|
||||
#include "libc/sysv/consts/nr.h"
|
||||
#include "libc/macros.h"
|
||||
.text.syscall
|
||||
.privileged
|
||||
.source __FILE__
|
||||
|
||||
/ Terminates program abnormally.
|
||||
|
|
|
@ -111,7 +111,7 @@ static int arch_prctl_freebsd(int code, int64_t addr) {
|
|||
}
|
||||
}
|
||||
|
||||
static textsyscall int arch_prctl_xnu(int code, int64_t addr) {
|
||||
static privileged noinline int arch_prctl_xnu(int code, int64_t addr) {
|
||||
int ax;
|
||||
switch (code) {
|
||||
case ARCH_SET_GS:
|
||||
|
@ -129,7 +129,7 @@ static textsyscall int arch_prctl_xnu(int code, int64_t addr) {
|
|||
}
|
||||
}
|
||||
|
||||
static textsyscall int arch_prctl_openbsd(int code, int64_t addr) {
|
||||
static privileged noinline int arch_prctl_openbsd(int code, int64_t addr) {
|
||||
int64_t rax;
|
||||
switch (code) {
|
||||
case ARCH_GET_FS:
|
||||
|
|
|
@ -41,7 +41,7 @@ static noasan char *__assert_stpcpy(char *d, const char *s) {
|
|||
}
|
||||
}
|
||||
|
||||
static textsyscall noasan wontreturn void __assert_exit(int rc) {
|
||||
static privileged noinline noasan wontreturn void __assert_exit(int rc) {
|
||||
if (!IsWindows()) {
|
||||
asm volatile("syscall"
|
||||
: /* no outputs */
|
||||
|
@ -53,8 +53,8 @@ static textsyscall noasan wontreturn void __assert_exit(int rc) {
|
|||
}
|
||||
}
|
||||
|
||||
static textsyscall noasan ssize_t __assert_write(const void *data,
|
||||
size_t size) {
|
||||
static privileged noinline noasan ssize_t __assert_write(const void *data,
|
||||
size_t size) {
|
||||
ssize_t rc;
|
||||
uint32_t wrote;
|
||||
if (!IsWindows()) {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "libc/dce.h"
|
||||
#include "libc/runtime/internal.h"
|
||||
#include "libc/macros.h"
|
||||
.text.syscall
|
||||
.privileged
|
||||
.source __FILE__
|
||||
|
||||
/ Terminates process, ignoring destructors and atexit() handlers.
|
||||
|
|
|
@ -48,7 +48,7 @@ static void __sys_print_nt(const void *data, size_t len) {
|
|||
* @param len can be computed w/ tinystrlen()
|
||||
* @clob nothing except flags
|
||||
*/
|
||||
textsyscall void __print(const void *data, size_t len) {
|
||||
privileged noinline void __print(const void *data, size_t len) {
|
||||
int64_t ax, ordinal;
|
||||
if (WasImported(__imp_WriteFile)) {
|
||||
__sys_print_nt(data, len);
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
/**
|
||||
* Aborts program under enemy fire to avoid being taken alive.
|
||||
*/
|
||||
textsyscall noasan void __stack_chk_fail(void) {
|
||||
privileged noasan void __stack_chk_fail(void) {
|
||||
size_t len;
|
||||
const char *msg;
|
||||
int64_t ax, cx, si;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/dce.h"
|
||||
#include "libc/macros.h"
|
||||
.text.syscall
|
||||
.privileged
|
||||
|
||||
/ Forks process without copying page tables.
|
||||
/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue