mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-10 05:02:54 +00:00
Kernel+LibC: Implement a few mount flags
We now support these mount flags: * MS_NODEV: disallow opening any devices from this file system * MS_NOEXEC: disallow executing any executables from this file system * MS_NOSUID: ignore set-user-id bits on executables from this file system The fourth flag, MS_BIND, is defined, but currently ignored.
This commit is contained in:
parent
2fcbb846fb
commit
61c1106d9f
Notes:
sideshowbarker
2024-07-19 10:11:43 +09:00
Author: https://github.com/bugaevc
Commit: 61c1106d9f
Pull-request: https://github.com/SerenityOS/serenity/pull/1053
4 changed files with 19 additions and 5 deletions
Kernel/FileSystem
|
@ -216,11 +216,13 @@ KResultOr<NonnullRefPtr<FileDescription>> VFS::open(StringView path, int options
|
|||
should_truncate_file = options & O_TRUNC;
|
||||
}
|
||||
if (options & O_EXEC) {
|
||||
if (!metadata.may_execute(current->process()))
|
||||
if (!metadata.may_execute(current->process()) || (custody.mount_flags() & MS_NOEXEC))
|
||||
return KResult(-EACCES);
|
||||
}
|
||||
|
||||
if (metadata.is_device()) {
|
||||
if (custody.mount_flags() & MS_NODEV)
|
||||
return KResult(-EACCES);
|
||||
auto device = Device::get_device(metadata.major_device, metadata.minor_device);
|
||||
if (device == nullptr) {
|
||||
return KResult(-ENODEV);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue