mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 10:08:10 +00:00
Kernel+LibCore+LibC: Implement support for forcing unveil on exec
To accomplish this, we add another VeilState which is called LockedInherited. The idea is to apply exec unveil data, similar to execpromises of the pledge syscall, on the current exec'ed program during the execve sequence. When applying the forced unveil data, the veil state is set to be locked but the special state of LockedInherited ensures that if the new program tries to unveil paths, the request will silently be ignored, so the program will continue running without receiving an error, but is still can only use the paths that were unveiled before the exec syscall. This in turn, allows us to use the unveil syscall with a special utility to sandbox other userland programs in terms of what is visible to them on the filesystem, and is usable on both programs that use or don't use the unveil syscall in their code.
This commit is contained in:
parent
35efdb17f9
commit
718ae68621
11 changed files with 161 additions and 48 deletions
|
@ -433,6 +433,7 @@ struct SC_pledge_params {
|
|||
};
|
||||
|
||||
struct SC_unveil_params {
|
||||
int flags;
|
||||
StringArgument path;
|
||||
StringArgument permissions;
|
||||
};
|
||||
|
|
22
Kernel/API/Unveil.h
Normal file
22
Kernel/API/Unveil.h
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Liav A. <liavalb@hotmail.co.il>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/EnumBits.h>
|
||||
#include <AK/Types.h>
|
||||
|
||||
namespace Kernel {
|
||||
|
||||
enum class UnveilFlags : u32 {
|
||||
None = 0,
|
||||
CurrentProgram = 1 << 0,
|
||||
AfterExec = 1 << 1,
|
||||
};
|
||||
|
||||
AK_ENUM_BITWISE_OPERATORS(UnveilFlags);
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue