commit 14098cb51634c8678bf1548d6d1f19895edde914
Author: Diego Nieto Cid <dnietoc@gmail.com>
Date:   Mon Jun 16 23:58:08 2025 +0100

    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>

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)
     {
