Kernel: Enforce file system veil on file creation

Fixes #1621.
This commit is contained in:
Andreas Kling 2020-04-04 16:40:36 +02:00
parent 2944039d6b
commit 54cb1e36b6
Notes: sideshowbarker 2024-07-19 07:56:17 +09:00

View File

@ -305,6 +305,10 @@ KResult VFS::mknod(StringView path, mode_t mode, dev_t dev, Custody& base)
KResultOr<NonnullRefPtr<FileDescription>> VFS::create(StringView path, int options, mode_t mode, Custody& parent_custody, Optional<UidAndGid> owner)
{
auto result = validate_path_against_process_veil(path, options);
if (result.is_error())
return result;
if (!is_socket(mode) && !is_fifo(mode) && !is_block_device(mode) && !is_character_device(mode)) {
// Turn it into a regular file. (This feels rather hackish.)
mode |= 0100000;