mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-10 05:02:06 +00:00
Fix bugs and add security features to redbean
- Fix a regression with the previous change that broke redbean - Add chroot(), resource limit, seccomp, and other stuff to redbean - Write lots and lots of documentation - Iron out more system call issues
This commit is contained in:
parent
f1dfa4bdfa
commit
7166679620
182 changed files with 1855 additions and 918 deletions
|
@ -21,6 +21,7 @@
|
|||
#include "libc/calls/strace.internal.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/intrin/asan.internal.h"
|
||||
#include "libc/sysv/consts/rlimit.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
|
||||
/**
|
||||
|
@ -36,10 +37,16 @@ int getrlimit(int resource, struct rlimit *rlim) {
|
|||
char buf[64];
|
||||
if (resource == 127) {
|
||||
rc = einval();
|
||||
} else if (IsAsan() && !__asan_is_valid(rlim, sizeof(*rlim))) {
|
||||
} else if (!rlim || (IsAsan() && !__asan_is_valid(rlim, sizeof(*rlim)))) {
|
||||
rc = efault();
|
||||
} else {
|
||||
} else if (!IsWindows()) {
|
||||
rc = sys_getrlimit(resource, rlim);
|
||||
} else if (resource == RLIMIT_AS) {
|
||||
rlim->rlim_cur = __virtualmax;
|
||||
rlim->rlim_max = __virtualmax;
|
||||
rc = 0;
|
||||
} else {
|
||||
rc = einval();
|
||||
}
|
||||
STRACE("getrlimit(%s, [%s]) → %d% m", __strace_rlimit_name(resource),
|
||||
__strace_rlimit(buf, sizeof(buf), rc, rlim), rc);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue