adding pam_limits support for RLIMIT_SIGPENDING and RLIMIT_MSGQUEUE

toby cabot toby at caboteria.org
Wed Dec 22 03:39:05 UTC 2004


Hi Folks,

I work on an application that uses POSIX message queues pretty
intensively.  It works on Fedora Core 2 but not Fedora Core 3.  The
problem is that Linux 2.6 adds some new limits that the pam_limits
module doesn't yet (as of version 0.77) know how to set.  I added a
patch to the Red Hat bug report (see
https://bugzilla.redhat.com/beta/show_bug.cgi?id=131190 ) but the Red
Hat folks pointed out that you should vet it since it changes the
config file format.  Basically it adds two new "items" to limits.conf:
"sigpending" which corresponds to RLIMIT_SIGPENDING, and "mqueue"
which corresponds to RLIMIT_MSGQUEUE.

Here's the patch:

diff -ur Linux-PAM-0.77-rh/modules/pam_limits/limits.skel Linux-PAM-0.77/modules/pam_limits/limits.skel
--- Linux-PAM-0.77-rh/modules/pam_limits/limits.skel	2004-12-21 17:24:59.683477077 -0500
+++ Linux-PAM-0.77/modules/pam_limits/limits.skel	2004-12-21 17:28:00.573877370 -0500
@@ -30,6 +30,8 @@
 #        - maxlogins - max number of logins for this user
 #        - priority - the priority to run user process with
 #        - locks - max number of file locks the user can hold
+#        - sigpending - max number of pending signals
+#        - mqueue - max memory used by POSIX message queues (bytes)
 #
 #<domain>      <type>  <item>         <value>
 #
Only in Linux-PAM-0.77/modules/pam_limits: limits.skel~
diff -ur Linux-PAM-0.77-rh/modules/pam_limits/pam_limits.c Linux-PAM-0.77/modules/pam_limits/pam_limits.c
--- Linux-PAM-0.77-rh/modules/pam_limits/pam_limits.c	2004-12-21 17:24:59.682477182 -0500
+++ Linux-PAM-0.77/modules/pam_limits/pam_limits.c	2004-12-21 17:25:20.188319968 -0500
@@ -289,6 +289,10 @@
 	limit_item = RLIMIT_MEMLOCK;
     else if (strcmp(lim_item, "as") == 0)
 	limit_item = RLIMIT_AS;
+    else if (strcmp(lim_item, "sigpending") == 0)
+	limit_item = RLIMIT_SIGPENDING;
+    else if (strcmp(lim_item, "mqueue") == 0)
+	limit_item = RLIMIT_MSGQUEUE;
 #ifdef RLIMIT_LOCKS
     else if (strcmp(lim_item, "locks") == 0)
 	limit_item = RLIMIT_LOCKS;

Please let me know what you think, especially if I need to wrap the
new parameters in ifdef's.

Cheers,
Toby




More information about the Pam-list mailing list