From b95cc0fce8d9b90eb6da48f523441b320445567d Mon Sep 17 00:00:00 2001 From: jinlun Date: Mon, 18 Sep 2023 20:35:20 +0800 Subject: [PATCH] Fix the concurrent issues with removing module and accessing interfaces. --- Add-the-owner-of-file-operations.patch | 50 ++++++++++++++++++++++++++ dim.spec | 6 +++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 Add-the-owner-of-file-operations.patch diff --git a/Add-the-owner-of-file-operations.patch b/Add-the-owner-of-file-operations.patch new file mode 100644 index 0000000..c3f2510 --- /dev/null +++ b/Add-the-owner-of-file-operations.patch @@ -0,0 +1,50 @@ +From 76d06390a9adf3ae70aaa87e9243c42d848975a4 Mon Sep 17 00:00:00 2001 +From: Huaxin Lu +Date: Mon, 18 Sep 2023 20:19:05 +0800 +Subject: [PATCH] Add the owner of file operations + +Fix the concurrent issues with removing module and +accessing interfaces. +--- + src/common/dim_entry.h | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/common/dim_entry.h b/src/common/dim_entry.h +index 17e6420..acfc3a0 100644 +--- a/src/common/dim_entry.h ++++ b/src/common/dim_entry.h +@@ -49,6 +49,7 @@ static ssize_t sname##_trigger(struct file *file, \ + } \ + \ + static const struct file_operations sname##_ops = { \ ++ .owner = THIS_MODULE, \ + .write = sname##_trigger, \ + .llseek = generic_file_llseek, \ + }; \ +@@ -99,6 +100,7 @@ static int sname##_open(struct inode *inode, struct file *file) \ + } \ + \ + static const struct file_operations sname##_ops = { \ ++ .owner = THIS_MODULE, \ + .open = sname##_open, \ + .read = seq_read, \ + .llseek = seq_lseek, \ +@@ -129,6 +131,7 @@ static ssize_t sname##_read(struct file *file, \ + } \ + \ + static const struct file_operations sname##_ops = { \ ++ .owner = THIS_MODULE, \ + .read = sname##_read, \ + .llseek = generic_file_llseek, \ + }; \ +@@ -173,6 +176,7 @@ static ssize_t sname##_write(struct file *file, \ + } \ + \ + static const struct file_operations sname##_ops = { \ ++ .owner = THIS_MODULE, \ + .read = sname##_read, \ + .write = sname##_write, \ + .llseek = generic_file_llseek, \ +-- +2.27.0 + diff --git a/dim.spec b/dim.spec index 3108592..a515a33 100644 --- a/dim.spec +++ b/dim.spec @@ -4,7 +4,7 @@ Name : dim Summary : Dynamic Integrity Measurement Version : 1.0.2 -Release : 3 +Release : 4 License : GPL-2.0 Source0 : %{name}-v%{version}.tar.gz BuildRequires: kernel-devel kernel-headers @@ -12,6 +12,7 @@ Requires : kernel Patch0001: Limit-the-max-line-number-of-policy-and-baseline-par.patch Patch0002: Use-jiffies64-interface-to-set-measure-interval.patch +Patch0003: Add-the-owner-of-file-operations.patch %description Dynamic Integrity Measurement @@ -50,6 +51,9 @@ rm -rf %{buildroot} %attr(0400,root,root) /lib/modules/%{kernel_version}/extra/dim/dim_monitor.ko %changelog +* Mon Sep 18 2023 jinlun 1.0.2-4 +- Fix the concurrent issues with removing module and accessing interfaces. + * Fri Sep 15 2023 luhuaxin 1.0.2-3 - Use jiffies64 interface to set measure interval