The patch below allows netdev_precondition() to be called safely from
interrupt context.
This can occur, for example, in the IP networking input path, which runs under a softirq. Under these conditions, kernel memory needs to be allocated with the GFP_ATOMIC flag. If anyone has seen an oops upon network traffic immedately after booting, this may have been the cause.
diff -urN -X /tmp/xmdiff module.orig/selinux_plug/hooks.c module/selinux_plug/hooks.c
--- module.orig/selinux_plug/hooks.c Thu Aug 23 14:20:50 2001
+++ module/selinux_plug/hooks.c Thu Sep 6 21:57:33 2001
@@ -308,7 +308,7 @@
{
struct netdev_security_struct *nsec = dev->security;
#define CUR_SID current->sid
+#ifdef __KERNEL__ +/* + * Use this for memory allocation flags (e.g. for kmalloc()) when the interrupt + * state is unknown. + */ +#include <linux/interrupt.h> + +#define SAFE_ALLOC (in_interrupt () ? GFP_ATOMIC : GFP_KERNEL) +#endif +
diff -urN -X /tmp/xmdiff module.orig/selinux_plug/ss/global.h module/selinux_plug/ss/global.h
--- module.orig/selinux_plug/ss/global.h Thu Jul 19 06:38:07 2001
+++ module/selinux_plug/ss/global.h Thu Sep 6 22:19:22 2001
@@ -77,7 +77,7 @@
#include <asm/uaccess.h>
#include "selinux_plug.h"
-#define malloc(size) kmalloc(size, GFP_ATOMIC) +#define malloc(size) kmalloc(size, SAFE_ALLOC) #define free(ptr) kfree(ptr)
typedef struct file FILE;
-- You have received this message because you are subscribed to the selinux list. If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with the words "unsubscribe selinux" without quotes as the message.
This archive was generated by hypermail 2.2.0 on Wed 11 Jun 2008 - 08:10:54 EDT