Packaging up recent changes to work around kernel bug
Sapan Bhatia [Mon, 19 Aug 2013 16:02:10 +0000 (12:02 -0400)]
Makefile
procprotect.c
procprotect.init [new file with mode: 0755]
procprotect.service

index 9703598..97aa044 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -18,4 +18,7 @@ clean:
 
 install:
        install -D -m 755 procprotect.ko /lib/modules/$(KVER)/net/procprotect/procprotect.ko
+       mkdir -p /etc/modules-load.d
+       install -m 644 procprotect.conf /etc/modules-load.d/procprotect.conf
        install -m 644 procprotect.service /usr/lib/systemd/system/procprotect.service
+       install -m 755 procprotect.init /usr/sbin/procprotect.init
index 42166f5..f8ab6e6 100644 (file)
@@ -293,11 +293,6 @@ static void add_entry(char *pathname) {
         }
     }
 
-       if (!once_only) {
-               once_only=1;
-               if (init_probes()==-1)
-                       printk(KERN_CRIT "Could not install procprotect probes. Reload module to retry.");
-       }
 }
 
 
@@ -339,6 +334,12 @@ int procfile_write(struct file *file, const char *buffer, unsigned long count, v
         pathname[count]='\0';
 
     add_entry(pathname);       
+               
+       if (!once_only) {
+               once_only=1;
+               if (init_probes()==-1)
+                       printk(KERN_CRIT "Could not install procprotect probes. Reload module to retry.");
+       }
     printk(KERN_CRIT "Length of buffer=%d",strlen(pathname));
     return count;
 }
diff --git a/procprotect.init b/procprotect.init
new file mode 100755 (executable)
index 0000000..06119ca
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+if [ ! -f /proc/procprotect ]; then 
+       echo "Transforward kernel module not loaded"
+else
+       echo "sysrq-trigger" > /proc/procprotect
+fi
+
index b5e410e..54fa73d 100644 (file)
@@ -4,7 +4,7 @@ After=syslog.target network.target
 
 [Service]
 Type=forking
-ExecStart=/sbin/modprobe procprotect
+ExecStart=/usr/sbin/procprotect.init
 ControlGroup=cpu:/
 
 [Install]