bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH hurd v2] libpager: raise RLIMIT_AS if permissions allow us


From: dnietoc
Subject: [PATCH hurd v2] libpager: raise RLIMIT_AS if permissions allow us
Date: Mon, 16 Jun 2025 23:58:08 +0100

From: Diego Nieto Cid <dnietoc@gmail.com>

  * 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.
---
 libpager/demuxer.c | 8 ++++++++
 1 file changed, 8 insertions(+)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]