[linux-audio-user] So, no dice on the PAM RLimits patch?

Fernando Lopez-Lezcano nando at ccrma.Stanford.EDU
Wed Aug 17 20:19:01 EDT 2005


On Wed, 2005-08-17 at 17:01, thewade wrote:
> I tried the steamboat site but was unable to download the patch; for 
> fedora core or as a general patch.
> Can someone point me to a mirror? (or send me the patch?)
> Is the patch just thoes additions to /etc/security/limits.conf described 
> at http://www.steamballoon.com/wiki/Rlimits ?

If this is for fedora core then I have a patched pam in Planet CCRMA...
I'm including the patches as attachments (you may want to change the
default settings). 

Beware that if you change the maximum rtpriority allowed to less than
100 you need a patch for 2.6.12, if has a bug in that code section (I
don't have a patch, I just use 100 as the max which was the behavior of
the previous lsm kernel module).

-- Fernando

-------------- next part --------------
This one allows you to place nice values in the limits.conf


--- Linux-PAM-0.77/modules/pam_limits/pam_limits.c.prio	2005-01-14 10:47:03.000000000 -0800
+++ Linux-PAM-0.77/modules/pam_limits/pam_limits.c	2005-01-14 10:55:13.000000000 -0800
@@ -39,6 +39,11 @@
 #include <grp.h>
 #include <pwd.h>
 
+/* Hack to test new rlimit values */
+#define RLIMIT_NICE	13
+#define RLIMIT_RTPRIO	14
+#define RLIM_NLIMITS	15
+
 /* Module defines */
 #define LINE_LENGTH 1024
 
@@ -293,6 +298,10 @@ static void process_limit(int source, co
     else if (strcmp(lim_item, "locks") == 0)
 	limit_item = RLIMIT_LOCKS;
 #endif
+    else if (strcmp(lim_item, "rt_priority") == 0)
+	limit_item = RLIMIT_RTPRIO;
+    else if (strcmp(lim_item, "nice") == 0)
+	limit_item = RLIMIT_NICE;
     else if (strcmp(lim_item, "maxlogins") == 0) {
 	limit_item = LIMIT_LOGIN;
 	pl->flag_numsyslogins = 0;
@@ -360,6 +369,19 @@ static void process_limit(int source, co
         case RLIMIT_AS:
             limit_value *= 1024;
             break;
+        case RLIMIT_NICE:
+            limit_value = 19 - limit_value;
+            if (limit_value > 39)
+		limit_value = 39;
+	    if (limit_value < 0)
+		limit_value = 0;
+            break;
+        case RLIMIT_RTPRIO:
+            if (limit_value > 99)
+		limit_value = 99;
+	    if (limit_value < 0)
+		limit_value = 0;
+            break;
     }
 
     if ( (limit_item != LIMIT_LOGIN)
-------------- next part --------------
--- Linux-PAM-0.77/modules/pam_limits/limits.skel~	2002-05-09 05:03:57.000000000 -0700
+++ Linux-PAM-0.77/modules/pam_limits/limits.skel	2005-05-09 15:12:42.000000000 -0700
@@ -31,6 +31,10 @@
 #        - priority - the priority to run user process with
 #        - locks - max number of file locks the user can hold
 #
+# realtime priority access:
+#        - rt_priority - max realtime priority a process can use
+#        - nice - max nice priority a process can be set to
+#
 #<domain>      <type>  <item>         <value>
 #
 
@@ -42,4 +46,19 @@
 #ftp             hard    nproc           0
 #@student        -       maxlogins       4
 
+# limit realtime and memory locking access to users in the group audio
+# there is no way to say "allow locking all memory", 4G should be enough
+#
+#*		-	rt_priority	0
+#*		-	nice		0
+#
+#@audio		-	rt_priority	100
+#@audio		-	nice		-10
+#@audio		-	memlock		4000000
+
+# or (default) allow everyone access
+*		-	rt_priority	100
+*		-	nice		-10
+*		-	memlock		4000000
+
 # End of file


More information about the Linux-audio-user mailing list