mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
Kernel+LibC: Add O_EXEC, move exec permission checking to VFS::open()
O_EXEC is mentioned by POSIX, so let's have it. Currently, it is only used inside the kernel to ensure the process has the right permissions when opening an executable.
This commit is contained in:
parent
4566c2d811
commit
2fcbb846fb
Notes:
sideshowbarker
2024-07-19 10:11:50 +09:00
Author: https://github.com/bugaevc
Commit: 2fcbb846fb
Pull-request: https://github.com/SerenityOS/serenity/pull/1053
4 changed files with 7 additions and 4 deletions
|
@ -215,6 +215,10 @@ KResultOr<NonnullRefPtr<FileDescription>> VFS::open(StringView path, int options
|
|||
return KResult(-EISDIR);
|
||||
should_truncate_file = options & O_TRUNC;
|
||||
}
|
||||
if (options & O_EXEC) {
|
||||
if (!metadata.may_execute(current->process()))
|
||||
return KResult(-EACCES);
|
||||
}
|
||||
|
||||
if (metadata.is_device()) {
|
||||
auto device = Device::get_device(metadata.major_device, metadata.minor_device);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue