diff -ruN linux-2.6.3.orig/grsecurity/Makefile linux-2.6.3/grsecurity/Makefile
--- linux-2.6.3.orig/grsecurity/Makefile	2004-03-11 09:39:25.000000000 +0800
+++ linux-2.6.3/grsecurity/Makefile	2004-03-11 09:37:58.000000000 +0800
@@ -8,7 +8,7 @@
 
 obj-y = grsec_chdir.o grsec_chroot.o grsec_exec.o grsec_fifo.o grsec_fork.o \
 	grsec_mount.o grsec_rand.o grsec_sig.o grsec_sock.o grsec_sysctl.o \
-	grsec_time.o grsec_tpe.o grsec_ipc.o grsec_link.o
+	grsec_time.o grsec_tpe.o grsec_ipc.o grsec_link.o grsec_printk.o
 
 obj-$(CONFIG_GRKERNSEC) += grsec_init.o grsum.o gracl.o gracl_ip.o gracl_segv.o obsd_rand.o \
 	gracl_cap.o gracl_alloc.o gracl_shm.o grsec_mem.o gracl_fs.o \
diff -ruN linux-2.6.3.orig/grsecurity/grsec_printk.c linux-2.6.3/grsecurity/grsec_printk.c
--- linux-2.6.3.orig/grsecurity/grsec_printk.c	1970-01-01 08:00:00.000000000 +0800
+++ linux-2.6.3/grsecurity/grsec_printk.c	2004-03-11 09:37:58.000000000 +0800
@@ -0,0 +1,33 @@
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/fs.h>
+#include <linux/file.h>
+#include <linux/grinternal.h>
+
+asmlinkage int grprintk(const char* log_level, const char* fmt, ...) {
+    va_list args;
+    static char printk_buf[2048];
+    char *p, *q;
+    unsigned int printed_len;
+
+    va_start(args, fmt);
+    printed_len = vsnprintf(printk_buf, sizeof(printk_buf), fmt, args);
+    va_end(args);
+
+    printk_buf[sizeof(printk_buf)-1] = '\0'; /* to ensure we don't overrun */
+    p = q = printk_buf;
+    while (1) {
+        if (*q == '\0') {
+            if (p != q)
+                printk("%sgrsec: %s\n", log_level, p);
+            return printed_len;
+        }
+        if (*q == '\n') {
+            *q = '\0';
+            printk("%sgrsec: %s\n", log_level, p);
+            q++;
+            p = q;
+        } else
+            q++;
+    }
+}
diff -ruN linux-2.6.3.orig/include/linux/grinternal.h linux-2.6.3/include/linux/grinternal.h
--- linux-2.6.3.orig/include/linux/grinternal.h	2004-03-11 09:39:25.000000000 +0800
+++ linux-2.6.3/include/linux/grinternal.h	2004-03-11 09:38:20.000000000 +0800
@@ -26,6 +26,8 @@
 			    const struct vfsmount *mnt);
 extern char *gr_to_filename3(const struct dentry *dentry,
 			    const struct vfsmount *mnt);
+asmlinkage int grprintk(const char* log_level, const char * fmt, ...)
+    __attribute__ ((format (printf, 2, 3)));
 
 extern int grsec_enable_link;
 extern int grsec_enable_fifo;
@@ -133,18 +135,18 @@
 	if (!grsec_alertgood_wtime || get_seconds() - grsec_alertgood_wtime > CONFIG_GRKERNSEC_FLOODTIME) { \
 	    grsec_alertgood_wtime = get_seconds(); grsec_alertgood_fyet = 0; \
 	    if (current->curr_ip) \
-		printk(KERN_ALERT "grsec: From %u.%u.%u.%u: " normal_msg "\n", NIPQUAD(current->curr_ip) , ## args); \
+		grprintk(KERN_ALERT, "From %u.%u.%u.%u: " normal_msg "\n", NIPQUAD(current->curr_ip) , ## args); \
 	    else \
-	    	printk(KERN_ALERT "grsec: " normal_msg "\n" , ## args); \
+	    	grprintk(KERN_ALERT, normal_msg "\n" , ## args); \
 	} else if((get_seconds() - grsec_alertgood_wtime < CONFIG_GRKERNSEC_FLOODTIME) && (grsec_alertgood_fyet < CONFIG_GRKERNSEC_FLOODBURST)) { \
 	    grsec_alertgood_fyet++; \
 	    if (current->curr_ip) \
-		printk(KERN_ALERT "grsec: From %u.%u.%u.%u: " normal_msg "\n", NIPQUAD(current->curr_ip) , ## args); \
+		grprintk(KERN_ALERT, "From %u.%u.%u.%u: " normal_msg "\n", NIPQUAD(current->curr_ip) , ## args); \
 	    else \
-	    	printk(KERN_ALERT "grsec: " normal_msg "\n" , ## args); \
+	    	grprintk(KERN_ALERT, normal_msg "\n" , ## args); \
 	} else if (grsec_alertgood_fyet == CONFIG_GRKERNSEC_FLOODBURST) { \
 	    grsec_alertgood_wtime = get_seconds(); grsec_alertgood_fyet++; \
-	    printk(KERN_ALERT "grsec: more alerts, logging disabled for " \
+	    grprintk(KERN_ALERT, "more alerts, logging disabled for " \
 		    "%d seconds\n", CONFIG_GRKERNSEC_FLOODTIME); \
 	} \
 	\
@@ -158,18 +160,18 @@
 	if (!grsec_alert_wtime || get_seconds() - grsec_alert_wtime > CONFIG_GRKERNSEC_FLOODTIME) { \
 	    grsec_alert_wtime = get_seconds(); grsec_alert_fyet = 0; \
 	    if (current->curr_ip) \
-		printk(KERN_ALERT "grsec: From %u.%u.%u.%u: " normal_msg "\n", NIPQUAD(current->curr_ip) , ## args); \
+		grprintk(KERN_ALERT, "From %u.%u.%u.%u: " normal_msg "\n", NIPQUAD(current->curr_ip) , ## args); \
 	    else \
-	    	printk(KERN_ALERT "grsec: " normal_msg "\n" , ## args); \
+	    	grprintk(KERN_ALERT, normal_msg "\n" , ## args); \
 	} else if((get_seconds() - grsec_alert_wtime < CONFIG_GRKERNSEC_FLOODTIME) && (grsec_alert_fyet < CONFIG_GRKERNSEC_FLOODBURST)) { \
 	    grsec_alert_fyet++; \
 	    if (current->curr_ip) \
-		printk(KERN_ALERT "grsec: From %u.%u.%u.%u: " normal_msg "\n", NIPQUAD(current->curr_ip) , ## args); \
+		grprintk(KERN_ALERT, "From %u.%u.%u.%u: " normal_msg "\n", NIPQUAD(current->curr_ip) , ## args); \
 	    else \
-	    	printk(KERN_ALERT "grsec: " normal_msg "\n" , ## args); \
+	    	grprintk(KERN_ALERT, normal_msg "\n" , ## args); \
 	} else if (grsec_alert_fyet == CONFIG_GRKERNSEC_FLOODBURST) { \
 	    grsec_alert_wtime = get_seconds(); grsec_alert_fyet++; \
-	    printk(KERN_ALERT "grsec: more alerts, logging disabled for " \
+	    grprintk(KERN_ALERT, "more alerts, logging disabled for " \
 		    "%d seconds\n", CONFIG_GRKERNSEC_FLOODTIME); \
 	} \
 	\
@@ -181,10 +183,10 @@
 ({ \
 	spin_lock(&grsec_audit_lock); \
 	if (current->curr_ip) \
-		printk(KERN_INFO "grsec: From %u.%u.%u.%u: " normal_msg "\n", \
+		grprintk(KERN_INFO, "From %u.%u.%u.%u: " normal_msg "\n", \
 		       NIPQUAD(current->curr_ip) , ## args); \
 	else \
-		printk(KERN_INFO "grsec: " normal_msg "\n", ## args); \
+		grprintk(KERN_INFO, normal_msg "\n", ## args); \
 	spin_unlock(&grsec_audit_lock); \
 })
 

