Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/limits/ThreadsLimitListener.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "seccomp/SeccompRule.h"
#include "seccomp/action/ActionAllow.h"
#include "seccomp/action/ActionKill.h"
#include "seccomp/action/ActionErrno.h"
#include "seccomp/filter/LibSeccompFilter.h"

#include <cstdint>
Expand All @@ -25,6 +26,8 @@ ThreadsLimitListener::ThreadsLimitListener(int32_t threadsLimit)
// Disable threads support
syscallRules_.emplace_back(
seccomp::SeccompRule("clone", seccomp::action::ActionKill{}));
syscallRules_.emplace_back(
seccomp::SeccompRule("clone3", seccomp::action::ActionKill{}));
}
else {
// Enable threads support
Expand All @@ -38,6 +41,10 @@ ThreadsLimitListener::ThreadsLimitListener(int32_t threadsLimit)
seccomp::action::ActionKill(),
(Arg(2) & CLONE_VM) == 0));

syscallRules_.emplace_back(seccomp::SeccompRule(
"clone3",
seccomp::action::ActionErrno(ENOSYS)));

// And various thread related
syscallRules_.emplace_back(seccomp::SeccompRule(
// TODO: allow sleep up to time limit
Expand Down
2 changes: 2 additions & 0 deletions src/seccomp/policy/DefaultPolicy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ void DefaultPolicy::addFileSystemAccessRules(bool readOnly) {
"stat64",
"fstat",
"fstat64",
"fstatat64",
"newfstatat",
"lstat",
"lstat64",
Expand All @@ -176,6 +177,7 @@ void DefaultPolicy::addFileSystemAccessRules(bool readOnly) {
"statfs64",
"fstatfs",
"fstatfs64",
"statx",
}) {
rules_.emplace_back(SeccompRule(syscall, action::ActionErrno(ENOSYS)));
}
Expand Down