Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 427fb64

Browse files
committedFeb 11, 2024
Added handling for calls to open and openat wth write access when read-only mode is enforced
1 parent 3dbded8 commit 427fb64

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
 

‎src/seccomp/policy/DefaultPolicy.cc

+8
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,14 @@ void DefaultPolicy::addFileSystemAccessRules(bool readOnly) {
188188
"openat",
189189
action::ActionAllow(),
190190
(filter::SyscallArg(2) & (O_RDWR | O_WRONLY)) == 0));
191+
rules_.emplace_back(SeccompRule(
192+
"open",
193+
action::ActionErrno(EROFS),
194+
(filter::SyscallArg(1) & (O_RDONLY | O_PATH)) == 0));
195+
rules_.emplace_back(SeccompRule(
196+
"openat",
197+
action::ActionErrno(EROFS),
198+
(filter::SyscallArg(2) & (O_RDONLY | O_PATH)) == 0));
191199

192200
for (const auto& syscall: {
193201
"unlink",

0 commit comments

Comments
 (0)
Please sign in to comment.