mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 20:15:07 +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
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