summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2023-01-06 10:08:22 +0200
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2023-01-07 03:44:59 +0330
commit04221a753394cf87213551c69c7cd9a7d4a899cd (patch)
treee4f6ea1dac9f9b86502fb68eb2267e15e9a74e9e /Kernel/Syscalls
parenta03d42b098e3bd8fb1149231b449996ecad3047c (diff)
downloadserenity-04221a753394cf87213551c69c7cd9a7d4a899cd.zip
Kernel: Mark Process::jail() method as const
We really don't want callers of this function to accidentally change the jail, or even worse - remove the Process from an attached jail. To ensure this never happens, we can just declare this method as const so nobody can mutate it this way.
Diffstat (limited to 'Kernel/Syscalls')
-rw-r--r--Kernel/Syscalls/execve.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/Syscalls/execve.cpp b/Kernel/Syscalls/execve.cpp
index 43218c1134..ba78e70fd6 100644
--- a/Kernel/Syscalls/execve.cpp
+++ b/Kernel/Syscalls/execve.cpp
@@ -474,7 +474,7 @@ ErrorOr<void> Process::do_exec(NonnullLockRefPtr<OpenFileDescription> main_progr
VERIFY(!Processor::in_critical());
auto main_program_metadata = main_program_description->metadata();
// NOTE: Don't allow running SUID binaries at all if we are in a jail.
- TRY(Process::current().jail().with([&](auto& my_jail) -> ErrorOr<void> {
+ TRY(Process::current().jail().with([&](auto const& my_jail) -> ErrorOr<void> {
if (my_jail && (main_program_metadata.is_setuid() || main_program_metadata.is_setgid())) {
return Error::from_errno(EPERM);
}