This small series makes the memory_driver kernel module compatible with
a recent change to the grsecurity Linux kernel patch as well as allowing
to override the kernel's build directory.
Please apply!
Thanks,
Mathias
Mathias Krause (2):
memory_driver: Use designated initializer for 'crash_dev'
memory_driver: Support overriding kernel directory
memory_driver/Makefile | 9 +++++++--
memory_driver/crash.c | 6 +++---
2 files changed, 10 insertions(+), 5 deletions(-)
--
2.30.2
Show replies by date
Instead of using positional initialization, use the more modern
designated initializer style, as already used for 'crash_fops'.
This makes the member initialization not only less ambiguous but also
allows structure layout randomization of the underlying type (as done in
grsecurity).
Signed-off-by: Mathias Krause <minipli(a)grsecurity.net>
---
memory_driver/crash.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/memory_driver/crash.c b/memory_driver/crash.c
index 81bd0e5c1aec..4999ed4113b7 100644
--- a/memory_driver/crash.c
+++ b/memory_driver/crash.c
@@ -324,9 +324,9 @@ static struct file_operations crash_fops = {
};
static struct miscdevice crash_dev = {
- MISC_DYNAMIC_MINOR,
- "crash",
- &crash_fops
+ .minor = MISC_DYNAMIC_MINOR,
+ .name = "crash",
+ .fops = &crash_fops
};
static int __init
--
2.30.2
Support compiling the module against a different kernel version than the
currently running one by allowing to set either KVER or KDIR variables
on the make commandline.
Also modernize the makefile slightly and make use of the kernel's
'clean' target to ensure to remove all generated files.
Signed-off-by: Mathias Krause <minipli(a)grsecurity.net>
---
memory_driver/Makefile | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/memory_driver/Makefile b/memory_driver/Makefile
index b494aa3cd184..b720661fa75f 100644
--- a/memory_driver/Makefile
+++ b/memory_driver/Makefile
@@ -8,8 +8,13 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
+ifneq ($(KERNELRELEASE),)
obj-m := crash.o
+else
+KVER ?= $(shell uname -r)
+KDIR ?= /lib/modules/${KVER}/build
all:
- make -C /lib/modules/`uname -r`/build M=${PWD} SUBDIRS=${PWD} modules
+ ${MAKE} -C ${KDIR} M=${PWD} SUBDIRS=${PWD} modules
clean:
- rm -f *.mod.c *.ko *.o Module.*
+ ${MAKE} -C ${KDIR} M=${PWD} SUBDIRS=${PWD} clean || ${RM} *.mod.c *.ko *.o Module.*
+endif
--
2.30.2