Fix the concurrent issues with removing module and accessing interfaces.

This commit is contained in:
jinlun 2023-09-18 20:35:20 +08:00
parent 2bdbf5b754
commit b95cc0fce8
2 changed files with 55 additions and 1 deletions

View File

@ -0,0 +1,50 @@
From 76d06390a9adf3ae70aaa87e9243c42d848975a4 Mon Sep 17 00:00:00 2001
From: Huaxin Lu <luhuaxin1@huawei.com>
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

View File

@ -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 <jinlun@huawei.com> 1.0.2-4
- Fix the concurrent issues with removing module and accessing interfaces.
* Fri Sep 15 2023 luhuaxin <luhuaxin1@huawei.com> 1.0.2-3
- Use jiffies64 interface to set measure interval