1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:58:11 +00:00

Kernel: Expose maximum argument limit in sysconf

Move the definitions for maximum argument and environment size to
Process.h from execve.cpp. This allows sysconf(_SC_ARG_MAX) to return
the actual argument maximum of 128 KiB to userspace.
This commit is contained in:
Andrew Kaster 2022-02-13 12:07:51 -07:00 committed by Idan Horowitz
parent b0df096298
commit b4a7d148b1
4 changed files with 8 additions and 5 deletions

View file

@ -58,13 +58,10 @@ static bool validate_stack_size(NonnullOwnPtrVector<KString> const& arguments, N
total_arguments_size += sizeof(char*) * (arguments.size() + 1);
total_environment_size += sizeof(char*) * (environment.size() + 1);
constexpr size_t max_arguments_size = Thread::default_userspace_stack_size / 8;
constexpr size_t max_environment_size = Thread::default_userspace_stack_size / 8;
if (total_arguments_size > max_arguments_size)
if (total_arguments_size > Process::max_arguments_size)
return false;
if (total_environment_size > max_environment_size)
if (total_environment_size > Process::max_environment_size)
return false;
// FIXME: This doesn't account for the size of the auxiliary vector