diff options
author | Diego Nieto Cid <dnietoc@gmail.com> | 2025-06-16 23:58:08 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2025-06-22 23:51:11 +0200 |
commit | 14098cb51634c8678bf1548d6d1f19895edde914 (patch) | |
tree | db99c1b4b3640cfd47bca2fb7ff88a870cfa02df | |
parent | f2eb25f27b7224cbf964ff59d68656ae9a5ff2d3 (diff) |
libpager: raise RLIMIT_AS if permissions allow us
* libpager/demuxer.c(pager_start_workers): set current and max RLIMIT_AS
to RLIM_INFINITY when the current user has access to the privileged host
port.
Message-ID: <20250616225815.844-2-dnietoc@gmail.com>
-rw-r--r-- | libpager/demuxer.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libpager/demuxer.c b/libpager/demuxer.c index 4c406602..4e3f5d1e 100644 --- a/libpager/demuxer.c +++ b/libpager/demuxer.c @@ -20,6 +20,9 @@ #include <mach/mig_errors.h> #include <pthread.h> #include <string.h> +#include <sys/resource.h> +#include <errno.h> +#include <stdio.h> #include "priv.h" #include "memory_object_S.h" @@ -316,9 +319,14 @@ pager_start_workers (struct port_bucket *pager_bucket, int i; pthread_t t; struct pager_requests *requests; + struct rlimit limits = { RLIM_INFINITY, RLIM_INFINITY }; assert_backtrace (out_requests != NULL); + /* Lift default address space limits if we are allowed */ + if (setrlimit (RLIMIT_AS, &limits) == -1 && errno != EPERM) + perror ("error lifting address space limits"); + requests = malloc (sizeof *requests); if (requests == NULL) { |