mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-05 10:48:29 +00:00
Fix bugs and regressions in the pledge command
This change gets the pledge (formerly pledge.com) command back in tip top shape for a 3.0.1 cosmos release. It now runs on all platforms, even though it's mostly a no-op on ones that lack the kernel security stuff. The binary footprint is now smaller, since it no longer needs to link malloc. It's also now able to be built as a fat binary.
This commit is contained in:
parent
b0e3d89942
commit
7b284f6bda
18 changed files with 493 additions and 272 deletions
|
@ -430,6 +430,9 @@ privileged void klog(const char *b, size_t n) {
|
|||
: "=a"(rax), "=D"(rdi), "=S"(rsi), "=d"(rdx)
|
||||
: "0"(__NR_write), "1"(h), "2"(b), "3"(n)
|
||||
: "rcx", "r8", "r9", "r10", "r11", "memory", "cc");
|
||||
if (rax < 0) {
|
||||
__klog_handle = 0;
|
||||
}
|
||||
}
|
||||
#elif defined(__aarch64__)
|
||||
// this isn't a cancelation point because we don't acknowledge eintr
|
||||
|
@ -444,6 +447,9 @@ privileged void klog(const char *b, size_t n) {
|
|||
: "=r"(res_x0)
|
||||
: "r"(r0), "r"(r1), "r"(r2), "r"(r8), "r"(r16)
|
||||
: "memory");
|
||||
if (res_x0 < 0) {
|
||||
__klog_handle = 0;
|
||||
}
|
||||
#else
|
||||
#error "unsupported architecture"
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue