Realtime LSM
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 Realtime LSM
The realtime-lsm Linux Security Module, written by Torben Hohn and Jack O'Quin with significant help from Chris Wright and Jody McIntyre, selectively grants realtime capabilities to specific user groups or applications. One typical use is low latency audio, and the patch has been extensively field tested by Linux audio users.
We developed this LSM in response to a serious need. Audio developers have been struggling for years with having to apply specialized kernel patches to get reliable realtime operation. Audio is very intolerant of scheduling glitches. They cause nasty pops in the output. Also, large audio applications should not run as `root'. The 2.4 "capabilities patch" was never a satisfactory solution for this problem, but it was the best we could do at the time.
Now, thanks to the good work being done on 2.6, we are now close to being able to do serious realtime work with standard kernels available everywhere. The LSM framework is an important element of that solution with the realtime LSM a small but essential component, because it makes these features available without excessive administrative burden. Many musicians have a Mac or Windows background, systems which grant realtime privileges to all tasks indiscriminantly. The realtime LSM allows us to grant similar privileges while maintaining better control over who gets them.
This version was originally applied against linux-2.6.10-rc1-mm2, and retested with linux-2.6.10-rc1-mm4.
Documentation/realtime-lsm.txt +39 -0
@@ -0,0 +1,39 @@ + + Realtime Linux Security Module + + +This Linux Security Module (LSM) enables realtime capabilities. It +was written by Torben Hohn and Jack O'Quin, under the provisions of +the GPL (see the COPYING file). We make no warranty concerning the +safety, security or even stability of your system when using it. But, +we will fix problems if you report them. + +Once the LSM has been installed and the kernel for which it was built +is running, the root user can load it and pass parameters as follows: + + # modprobe realtime any=1 + + Any program can request realtime privileges. This allows any local + user to crash the system by hogging the CPU in a tight loop or + locking down too much memory. But, it is simple to administer. :-) + + # modprobe realtime gid=29 + + All users belonging to group 29 and programs that are setgid to that + group have realtime privileges. Use any group number you like. A + `gid' of -1 disables group access. + + # modprobe realtime mlock=0 + + Grants realtime scheduling privileges without the ability to lock + memory using mlock() or mlockall() system calls. This option can be + used in conjunction with any of the other options. + +After the module is loaded, its parameters can be changed dynamically +via sysfs. + + # echo 1 > /sys/module/realtime/parameters/any + # echo 29 > /sys/module/realtime/parameters/gid + # echo 1 > /sys/module/realtime/parameters/mlock + +Jack O'Quin, [email protected]
security/Kconfig +11 -0
@@ -84,6 +84,17 @@ If you are unsure how to answer this question, answer N. +config SECURITY_REALTIME + tristate "Realtime Capabilities" + depends on SECURITY && SECURITY_CAPABILITIES!=y + default n + help + This module selectively grants realtime privileges + controlled by parameters set at load time or via files in + /sys/module/realtime/parameters. + + If you are unsure how to answer this question, answer N. + source security/selinux/Kconfig endmenu
security/Makefile +1 -0
@@ -17,3 +17,4 @@ obj-$(CONFIG_SECURITY_CAPABILITIES) += commoncap.o capability.o obj-$(CONFIG_SECURITY_ROOTPLUG) += commoncap.o root_plug.o obj-$(CONFIG_SECURITY_SECLVL) += seclvl.o +obj-$(CONFIG_SECURITY_REALTIME) += commoncap.o realtime.o
security/realtime.c +161 -0
161 lines not on this page · raw message
Signature · 1 line
joq
Quoted 4 lines · Jack O'Quin
The realtime-lsm Linux Security Module, written by Torben Hohn and Jack O'Quin with significant help from Chris Wright and Jody McIntyre, selectively grants realtime capabilities to specific user groups or applications.
Hmm, are all these includes necessary for this small patch?
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/security.h>
+#include <linux/file.h>
+#include <linux/mm.h>
+#include <linux/mman.h>
+#include <linux/pagemap.h>
+#include <linux/swap.h>
+#include <linux/smp_lock.h>
+#include <linux/skbuff.h>
+#include <linux/netlink.h>
+#include <linux/ptrace.h>
+#include <linux/sysctl.h>
+#include <linux/moduleparam.h>
Lee
security/realtime.c line 18
Quoted 2 lines · Jack O'Quin
security/realtime.c +2
-0+#include <linux/module.h> +#include <linux/security.h>
These seem to be the only two includes that are needed.
Any other objections to the patch?
Lee
Quoted 7 lines · Lee Revell
security/realtime.c line 18
Quoted 2 lines · Jack O'Quin
security/realtime.c +2
-0+#include <linux/module.h> +#include <linux/security.h> These seem to be the only two includes that are needed.
Any other objections to the patch?
Fine with me, as long as you're certain. I'll be away for a few days, so I can't make that change and test it right now, myself.
Signature · 1 line
joq
Quoted 9 lines · Jack O'Quin
Quoted 6 lines
security/realtime.c line 18
Quoted 2 lines
security/realtime.c +2
-0+#include <linux/module.h> +#include <linux/security.h> These seem to be the only two includes that are needed.
Any other objections to the patch?
Fine with me, as long as you're certain. I'll be away for a few days, so I can't make that change and test it right now, myself.
Well I am certain it works with the current kernel.
The change could break older kernels, so I did not commit anything.
Lee
Re: [PATCH] Realtime LSM updated patch 2.6.10-rc2-mm3-rt2
In reply to Lee RevellTo save time, here is the original announcement...
http://lkml.org/lkml/2004/11/9/288
Quoted 5 lines · Lee Revell
Review
Quoted 2 lines · Jack O'Quin
(quoted diff) +2
-0+#include <linux/module.h> +#include <linux/security.h>These seem to be the only two includes that are needed.
This updated patch removes the unnecessary includes. There are no other changes. It was applied against 2.6.10-rc2-mm3.
Documentation/realtime-lsm.txt +39 -0
@@ -0,0 +1,39 @@ + + Realtime Linux Security Module + + +This Linux Security Module (LSM) enables realtime capabilities. It +was written by Torben Hohn and Jack O'Quin, under the provisions of +the GPL (see the COPYING file). We make no warranty concerning the +safety, security or even stability of your system when using it. But, +we will fix problems if you report them. + +Once the LSM has been installed and the kernel for which it was built +is running, the root user can load it and pass parameters as follows: + + # modprobe realtime any=1 + + Any program can request realtime privileges. This allows any local + user to crash the system by hogging the CPU in a tight loop or + locking down too much memory. But, it is simple to administer. :-) + + # modprobe realtime gid=29 + + All users belonging to group 29 and programs that are setgid to that + group have realtime privileges. Use any group number you like. A + `gid' of -1 disables group access. + + # modprobe realtime mlock=0 + + Grants realtime scheduling privileges without the ability to lock + memory using mlock() or mlockall() system calls. This option can be + used in conjunction with any of the other options. + +After the module is loaded, its parameters can be changed dynamically +via sysfs. + + # echo 1 > /sys/module/realtime/parameters/any + # echo 29 > /sys/module/realtime/parameters/gid + # echo 1 > /sys/module/realtime/parameters/mlock + +Jack O'Quin, [email protected]
security/Kconfig +11 -0
@@ -84,6 +84,17 @@ If you are unsure how to answer this question, answer N. +config SECURITY_REALTIME + tristate "Realtime Capabilities" + depends on SECURITY && SECURITY_CAPABILITIES!=y + default n + help + This module selectively grants realtime privileges + controlled by parameters set at load time or via files in + /sys/module/realtime/parameters. + + If you are unsure how to answer this question, answer N. + source security/selinux/Kconfig endmenu
security/Makefile +1 -0
@@ -17,3 +17,4 @@ obj-$(CONFIG_SECURITY_CAPABILITIES) += commoncap.o capability.o obj-$(CONFIG_SECURITY_ROOTPLUG) += commoncap.o root_plug.o obj-$(CONFIG_SECURITY_SECLVL) += seclvl.o +obj-$(CONFIG_SECURITY_REALTIME) += commoncap.o realtime.o
security/realtime.c +147 -0
147 lines not on this page · raw message
Signature · 1 line
joq