avtab: out of memory
Hi!
Today the loading (make load) of my policy file failed with follow log message
May 14 17:27:43 cvs kernel: ss: loading policy configuration from /etc/security/selinux/policy.9 May 14 17:27:43 cvs kernel: security: avtab: out of memory .... May 14 17:37:47 cvs kernel: security: 5 users, 8 roles, 542 types May 14 17:37:47 cvs kernel: security: 29 classes, 65787 rules
The load faild without the rules of cups und courier too. Now my policy file has only a size of 1.6 mb. I added only a few rules for cvs and amanda and I think its not to great.
MS-like: After the reboot it works fine without problems.
I don't know whats my misstake. Could anyone help me?
Thanks
Carsten
--
You have received this message because you are subscribed to the selinux list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 7 lines · Carsten Grohmann
May 14 17:27:43 cvs kernel: ss: loading policy configuration from /etc/security/selinux/policy.9 May 14 17:27:43 cvs kernel: security: avtab: out of memory .... May 14 17:37:47 cvs kernel: security: 5 users, 8 roles, 542 types May 14 17:37:47 cvs kernel: security: 29 classes, 65787 rules
Quoted 6 lines
The load faild without the rules of cups und courier too. Now my policy file has only a size of 1.6 mb. I added only a few rules for cvs and amanda and I think its not to great.
MS-like: After the reboot it works fine without problems.I don't know whats my misstake. Could anyone help me?
The security server uses atomic allocation, so it will fail if the allocation would sleep. We could permit blocking allocation in the case of a policy reload by a userspace process, which might help. Was your machine under heavy load?
I've loaded policies twice that size via make load without any problem, and switched back and forth repeatedly. If you can reproduce the problem reliably and you're willing to send me the policy that triggers the behavior, I can also try it here.
--
Stephen D. Smalley, NAI Labs
[email protected]
--
You have received this message because you are subscribed to the selinux list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 4 lines · Stephen Smalley
The security server uses atomic allocation, so it will fail if the allocation would sleep. We could permit blocking allocation in the case of a policy reload by a userspace process, which might help. Was your machine under heavy load?
No. It's only a small cvs server, without load at this time.
Quoted 4 lines
I've loaded policies twice that size via make load without any problem, and switched back and forth repeatedly. If you can reproduce the problem reliably and you're willing to send me the policy that triggers the behavior, I can also try it here.
Today I can not reproduce this error. It was not the first time and all other times the problem disappeared after the second or third repeat. I will send you the policy if I get this problem next time. OK?
Carsten
PS: I use the actuell package 2002050211.
--
You have received this message because you are subscribed to the selinux list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 5 lines · Carsten Grohmann
Today I can not reproduce this error. It was not the first time and all other times the problem disappeared after the second or third repeat. I will send you the policy if I get this problem next time. OK?
PS: I use the actuell package 2002050211.
The attached patch (also committed to the sourceforge CVS) allows blocking (sleeping) allocation during a policy load, which should be safe as it only occurs in process context without holding any spinlocks. To apply, save it to ~/avtab.patch and cd lsm-2.4 && patch -p0 < ~/avtab.patch. Then, rebuild your kernel.
--
Stephen D. Smalley, NAI Labs
[email protected]
Index: security/selinux/ss/avtab.c
===================================================================
RCS file: /cvsroot/selinux/nsa/lsm-2.4/security/selinux/ss/avtab.c,v retrieving revision 1.1.1.2
selinux/ss/avtab.c +2 -2
@@ -50,7 +50,7 @@break ; } - newnode = (avtab_ptr_t )malloc (sizeof (struct avtab_node )); + newnode = (avtab_ptr_t )malloc_sleep (sizeof (struct avtab_node ));if (newnode ==NULL )return -ENOMEM ;memset (newnode,0 ,sizeof (struct avtab_node ));
@@ -154,7 +154,7 @@ {int i; - h->htable =malloc (sizeof (avtab_ptr_t)*AVTAB_SIZE ); + h->htable =malloc_sleep (sizeof (avtab_ptr_t)*AVTAB_SIZE );if (!h->htable)return -1 ;for (i =0 ; i <AVTAB_SIZE ; i++)
Index: security/selinux/ss/ebitmap.c
===================================================================
RCS file: /cvsroot/selinux/nsa/lsm-2.4/security/selinux/ss/ebitmap.c,v retrieving revision 1.1.1.1
selinux/ss/ebitmap.c +1 -1
@@ -285,7 +285,7 @@printf ("security: ebitmap: truncated map\n" ); goto bad; } - n = (ebitmap_node_t *)malloc (sizeof (ebitmap_node_t)); + n = (ebitmap_node_t *)malloc_sleep (sizeof (ebitmap_node_t));if (!n) {printf ("security: ebitmap: out of memory\n" ); goto bad;
Index: security/selinux/ss/global.h
===================================================================
RCS file: /cvsroot/selinux/nsa/lsm-2.4/security/selinux/ss/global.h,v retrieving revision 1.1.1.3
selinux/ss/global.h +3 -0
@@ -64,6 +64,8 @@#define wmb () +#define malloc_sleep(size) malloc(size) +#else #include <linux/kernel.h> /* printk */
@@ -84,6 +86,7 @@#include "selinux_plug.h" #define malloc (size) kmalloc(size, GFP_ATOMIC) +#define malloc_sleep (size) kmalloc(size, GFP_KERNEL)#define free (ptr) kfree(ptr)typedef struct file FILE ;
Index: security/selinux/ss/policydb.c
===================================================================
RCS file: /cvsroot/selinux/nsa/lsm-2.4/security/selinux/ss/policydb.c,v retrieving revision 1.1.1.2
selinux/ss/policydb.c +29 -29
227 lines not on this page · raw message
boot.msg
In reply to Stephen SmalleyHi !
I found in my boot.msg follow lines:
Security Scaffold v1.0.0 initialized
AVC: allocated 14760 bytes during initialization. SELinux: module inserted SELinux: Starting in permissive mode
There is already a security framework initialized, register_security failed.
Failure registering capabilities with the kernelselinux_register_security: Registering secondary module capability Capability LSM initialized
Is it OK with the "failed" in line 5?
Thanks for your comments.
Carsten
--
You have received this message because you are subscribed to the selinux list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Re: boot.msg
Quoted 8 lines · Carsten Grohmann
Hi !
I found in my boot.msg follow lines:
Security Scaffold v1.0.0 initialized
AVC: allocated 14760 bytes during initialization. SELinux: module inserted SELinux: Starting in permissive mode
Quoted 8 lines
There is already a security framework initialized,
register_securityfailed.
Failure registering capabilities with the kernelselinux_register_security: Registering secondary module capability Capability LSM initializedIs it OK with the "failed" in line 5?
Yes, this is normal, as the SELinux module is already loaded. The capabilities module is then stacked explicitly by SELinux.
- James
Signature · 9 lines
James Morris <[email protected]> -- You have received this message because you are subscribed to the selinux list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.