Skip to content

Commit

Permalink
Added handling for calls to open and openat wth write access when rea…
Browse files Browse the repository at this point in the history
…d-only mode is enforced
  • Loading branch information
mikimasn committed Feb 11, 2024
1 parent 3dbded8 commit 427fb64
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/seccomp/policy/DefaultPolicy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,14 @@ void DefaultPolicy::addFileSystemAccessRules(bool readOnly) {
"openat",
action::ActionAllow(),
(filter::SyscallArg(2) & (O_RDWR | O_WRONLY)) == 0));
rules_.emplace_back(SeccompRule(
"open",
action::ActionErrno(EROFS),
(filter::SyscallArg(1) & (O_RDONLY | O_PATH)) == 0));
rules_.emplace_back(SeccompRule(
"openat",
action::ActionErrno(EROFS),
(filter::SyscallArg(2) & (O_RDONLY | O_PATH)) == 0));

for (const auto& syscall: {
"unlink",
Expand Down

0 comments on commit 427fb64

Please sign in to comment.