From a5436ade11545ec8b62879d2b9a46a5238dd6722 Mon Sep 17 00:00:00 2001 From: Sapan Bhatia Date: Mon, 19 Aug 2013 12:02:10 -0400 Subject: [PATCH] Packaging up recent changes to work around kernel bug --- Makefile | 3 +++ procprotect.c | 11 ++++++----- procprotect.init | 8 ++++++++ procprotect.service | 2 +- 4 files changed, 18 insertions(+), 6 deletions(-) create mode 100755 procprotect.init diff --git a/Makefile b/Makefile index 9703598..97aa044 100644 --- 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 diff --git a/procprotect.c b/procprotect.c index 42166f5..f8ab6e6 100644 --- a/procprotect.c +++ b/procprotect.c @@ -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 index 0000000..06119ca --- /dev/null +++ b/procprotect.init @@ -0,0 +1,8 @@ +#!/bin/sh + +if [ ! -f /proc/procprotect ]; then + echo "Transforward kernel module not loaded" +else + echo "sysrq-trigger" > /proc/procprotect +fi + diff --git a/procprotect.service b/procprotect.service index b5e410e..54fa73d 100644 --- a/procprotect.service +++ b/procprotect.service @@ -4,7 +4,7 @@ After=syslog.target network.target [Service] Type=forking -ExecStart=/sbin/modprobe procprotect +ExecStart=/usr/sbin/procprotect.init ControlGroup=cpu:/ [Install] -- 2.43.0