From 0a5aacfd877fede37df5e4d180ca381604930da9 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Tue, 3 Dec 2024 16:17:34 +0200 Subject: [PATCH] Kernel: Allow open with O_CREAT bypass file permission checks call to open(path, O_CREAT|O_EXCL|O_RDWR, 0444) should open file as read-write although file is created as read-only on filesystem. --- kernel/kernel/Process.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/kernel/Process.cpp b/kernel/kernel/Process.cpp index e984fe77..5a81c795 100644 --- a/kernel/kernel/Process.cpp +++ b/kernel/kernel/Process.cpp @@ -963,7 +963,7 @@ namespace Kernel // FIXME: There is a race condition between next two lines TRY(create_file_or_dir(parent_file, path, (mode & 0777) | Inode::Mode::IFREG)); - file = TRY(VirtualFileSystem::get().file_from_relative_path(parent_file, m_credentials, path, flags)); + file = TRY(VirtualFileSystem::get().file_from_relative_path(parent_file, m_credentials, path, flags & ~O_RDWR)); } else {