mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 14:58:30 +00:00
Explicitly disable Linux capabilities
This commit is contained in:
parent
ffedbfe14d
commit
16fc83f9ce
12 changed files with 269 additions and 20 deletions
|
@ -7295,6 +7295,13 @@ static void GetOpts(int argc, char *argv[]) {
|
|||
|
||||
void RedBean(int argc, char *argv[]) {
|
||||
if (IsLinux()) {
|
||||
// disable weird linux capabilities
|
||||
for (int e = errno, i = 0;; ++i) {
|
||||
if (prctl(PR_CAPBSET_DROP, i) == -1) {
|
||||
errno = e;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// disable sneak privilege since we don't use them
|
||||
// seccomp will fail later if this fails
|
||||
prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue