Compare commits
10 Commits
53e3519bde
...
22d8f8aff9
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22d8f8aff9 | ||
|
|
49807afff5 | ||
|
|
882cdf972e | ||
|
|
58cfc63bef | ||
|
|
4eae46fd88 | ||
|
|
58ef623567 | ||
|
|
7a781ba60f | ||
|
|
b0b21b4b17 | ||
|
|
4657ec5a0e | ||
|
|
f1015b61a7 |
48
bugfix-fix-fd-path-failed-to-open.patch
Normal file
48
bugfix-fix-fd-path-failed-to-open.patch
Normal file
@ -0,0 +1,48 @@
|
||||
From 9241d98bc5803d18b1e17bd3ba1b84e97207fab4 Mon Sep 17 00:00:00 2001
|
||||
From: tenglei <tenglei@kylinos.cn>
|
||||
Date: Thu, 11 Apr 2024 17:55:13 +0800
|
||||
Subject: [PATCH] bugfix fix fd path failed to open
|
||||
|
||||
---
|
||||
src/sys_event.c | 22 ++++++++++++++++------
|
||||
1 file changed, 16 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/sys_event.c b/src/sys_event.c
|
||||
index 61701ec..dbdb9d0 100644
|
||||
--- a/src/sys_event.c
|
||||
+++ b/src/sys_event.c
|
||||
@@ -544,15 +544,25 @@ static int chang_kernel_interface_value(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
- ret = set_value_to_file(buf, PROC_FDTHRESHOLD);
|
||||
- if (ret == -1) {
|
||||
- log_printf(LOG_ERR, "chang_kernel_interface_value: set_value_to_file failed");
|
||||
+ if (access(PROC_FDTHRESHOLD, F_OK) == 0) {
|
||||
+ ret = set_value_to_file(buf, PROC_FDTHRESHOLD);
|
||||
+ if (ret == -1) {
|
||||
+ log_printf(LOG_ERR, "chang_kernel_interface_value: set_value_to_file failed");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ } else {
|
||||
+ log_printf(LOG_ERR, "fdthreshold function is not supported in the current system environment");
|
||||
return -1;
|
||||
}
|
||||
|
||||
- ret = set_value_to_file("1", RROC_FDENABLE);
|
||||
- if (ret == -1) {
|
||||
- log_printf(LOG_ERR, "chang_kernel_interface_value: set_value_to_file failed");
|
||||
+ if (access(RROC_FDENABLE, F_OK) == 0) {
|
||||
+ ret = set_value_to_file("1", RROC_FDENABLE);
|
||||
+ if (ret == -1) {
|
||||
+ log_printf(LOG_ERR, "chang_kernel_interface_value: set_value_to_file failed");
|
||||
+ return -1;
|
||||
+ }
|
||||
+ } else {
|
||||
+ log_printf(LOG_ERR, "fdenable function is not supported in the current system environment");
|
||||
return -1;
|
||||
}
|
||||
|
||||
--
|
||||
2.27.0
|
||||
|
||||
207
bugfix-fix-signal-monitor-err.patch
Normal file
207
bugfix-fix-signal-monitor-err.patch
Normal file
@ -0,0 +1,207 @@
|
||||
From 619aaa241ec852ea44aa3edbd59aa9c08b8adc9f Mon Sep 17 00:00:00 2001
|
||||
From: xietangxin <xietangxin@huawei.com>
|
||||
Date: Wed, 22 Nov 2023 14:26:13 +0800
|
||||
Subject: [PATCH] bugfix: fix signal monitor err
|
||||
|
||||
---
|
||||
module/signo_catch.c | 68 ++++++++++++++++-----------
|
||||
module/signo_catch.h | 6 +++
|
||||
src/sys_event.c | 1 +
|
||||
3 files changed, 48 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/module/signo_catch.c b/module/signo_catch.c
|
||||
index 5273f29..c038e16 100644
|
||||
--- a/module/signo_catch.c
|
||||
+++ b/module/signo_catch.c
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <linux/netlink.h>
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/proc_fs.h>
|
||||
+#include <linux/kprobes.h>
|
||||
|
||||
#include "sysmonitor_main.h"
|
||||
|
||||
@@ -28,6 +29,10 @@ static ulong g_qemu_buf_seq; /* index for reader */
|
||||
static qemu_signo_msg g_qemu_buf[SIG_BUFSIZE];
|
||||
struct proc_dir_entry *g_proc_qemu;
|
||||
|
||||
+static struct kprobe kp = {
|
||||
+ .symbol_name = "do_send_sig_info"
|
||||
+};
|
||||
+
|
||||
static ssize_t qemu_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
|
||||
{
|
||||
int error, index;
|
||||
@@ -91,7 +96,6 @@ static const struct proc_ops g_proc_qemu_operations = {
|
||||
};
|
||||
#endif
|
||||
|
||||
-#ifdef CONFIG_EULEROS_SYSMONITOR_SIGNAL
|
||||
/* Here introduce euler_get_mm_exe_file and euler_get_task_exe_file
|
||||
* to solve the build and insmod error.
|
||||
*/
|
||||
@@ -132,16 +136,16 @@ static struct file *euler_get_task_exe_file(struct task_struct *task)
|
||||
static int save_exe_info(char *exe, int exe_size, struct task_struct *task)
|
||||
{
|
||||
struct file *exe_file = NULL;
|
||||
- int ret;
|
||||
+ void *ret;
|
||||
|
||||
exe_file = euler_get_task_exe_file(task);
|
||||
if (exe_file != NULL) {
|
||||
ret = memcpy(exe,
|
||||
exe_file->f_path.dentry->d_name.name,
|
||||
exe_file->f_path.dentry->d_name.len);
|
||||
- if (ret != 0) {
|
||||
+ if (ret == NULL) {
|
||||
fput(exe_file);
|
||||
- return ret;
|
||||
+ return -1;
|
||||
}
|
||||
fput(exe_file);
|
||||
}
|
||||
@@ -200,8 +204,6 @@ static int save_msg_info(ce_signo_msg *msg, const send_sig_info_data_t *notifier
|
||||
|
||||
static int save_qemu_msg_info(qemu_signo_msg *qemu_msg, const send_sig_info_data_t *notifier_call_data)
|
||||
{
|
||||
- int ret;
|
||||
-
|
||||
(void)memset(qemu_msg, 0, sizeof(qemu_signo_msg));
|
||||
qemu_msg->send_pid = current->pid;
|
||||
(void)memcpy(qemu_msg->send_comm, current->comm, TASK_COMM_LEN);
|
||||
@@ -213,18 +215,17 @@ static int save_qemu_msg_info(qemu_signo_msg *qemu_msg, const send_sig_info_data
|
||||
return 0;
|
||||
}
|
||||
|
||||
-static int do_store_sig_info(struct notifier_block *self, unsigned long val, void *data)
|
||||
+static int do_store_sig_info(send_sig_info_data_t *data)
|
||||
{
|
||||
- send_sig_info_data_t *notifier_call_data = (send_sig_info_data_t *)data;
|
||||
ce_signo_msg msg;
|
||||
ulong index;
|
||||
qemu_signo_msg *qemu_msg = NULL;
|
||||
unsigned long sigcatchmask = get_sigcatchmask();
|
||||
int ret;
|
||||
|
||||
- if ((notifier_call_data->sig <= SIGNAL_COUNT) &&
|
||||
- (sigcatchmask & (1ul << (unsigned int)(notifier_call_data->sig - 1)))) {
|
||||
- ret = save_msg_info(&msg, notifier_call_data);
|
||||
+ if ((data->sig <= SIGNAL_COUNT) &&
|
||||
+ (sigcatchmask & (1ul << (unsigned int)(data->sig - 1)))) {
|
||||
+ ret = save_msg_info(&msg, data);
|
||||
if (ret != 0) {
|
||||
goto out;
|
||||
}
|
||||
@@ -233,12 +234,12 @@ static int do_store_sig_info(struct notifier_block *self, unsigned long val, voi
|
||||
}
|
||||
|
||||
#ifdef QEMU_SIG
|
||||
- if ((notifier_call_data->sig == SIGKILL) &&
|
||||
- !strcmp(notifier_call_data->p->comm, "qemu-kvm")) {
|
||||
+ if ((data->sig == SIGKILL) &&
|
||||
+ !strcmp(data->p->comm, "qemu-kvm")) {
|
||||
index = g_qemu_buf_seq & SIG_BUFMASK;
|
||||
qemu_msg = g_qemu_buf + index;
|
||||
|
||||
- ret = save_qemu_msg_info(qemu_msg, notifier_call_data);
|
||||
+ ret = save_qemu_msg_info(qemu_msg, data);
|
||||
if (ret) {
|
||||
goto out;
|
||||
}
|
||||
@@ -251,15 +252,30 @@ static int do_store_sig_info(struct notifier_block *self, unsigned long val, voi
|
||||
}
|
||||
#endif
|
||||
out:
|
||||
- return NOTIFY_DONE;
|
||||
+ return 0;
|
||||
}
|
||||
|
||||
-static struct notifier_block g_signo_catch_nb = {
|
||||
- .notifier_call = do_store_sig_info,
|
||||
- .priority = NOTIFY_CALL_PRIORITY,
|
||||
-};
|
||||
+static int pre_handler(struct kprobe *p, struct pt_regs *regs)
|
||||
+{
|
||||
+#ifdef CONFIG_ARM64
|
||||
+ send_sig_info_data_t data;
|
||||
+ data.sig = regs->regs[0];
|
||||
+ data.info = (struct kernel_siginfo *)((unsigned long *)regs->regs[1]);
|
||||
+ data.p = (struct task_struct *)((unsigned long *)regs->regs[2]);
|
||||
+ do_store_sig_info(&data);
|
||||
#endif
|
||||
|
||||
+#ifdef CONFIG_X86_64
|
||||
+ send_sig_info_data_t data;
|
||||
+ data.sig = regs->di;
|
||||
+ data.info = (struct kernel_siginfo *)((unsigned long *)regs->si);
|
||||
+ data.p = (struct task_struct *)((unsigned long *)regs->dx);
|
||||
+ do_store_sig_info(&data);
|
||||
+#endif
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
void signo_catch_init(void)
|
||||
{
|
||||
#ifdef QEMU_SIG
|
||||
@@ -268,22 +284,20 @@ void signo_catch_init(void)
|
||||
printk(KERN_ERR "signo_catch: create /proc/sig_catch failed.\n");
|
||||
}
|
||||
#endif
|
||||
-#ifdef CONFIG_EULEROS_SYSMONITOR_SIGNAL
|
||||
- (void)register_signo_catch_notifier(&g_signo_catch_nb);
|
||||
-#endif
|
||||
- printk(KERN_INFO "signo_catch: Planted send_sig_info_notifier_list register\n");
|
||||
+ kp.pre_handler = pre_handler;
|
||||
+ register_kprobe(&kp);
|
||||
+
|
||||
+ printk(KERN_INFO "signo_catch: register signal kprobe\n");
|
||||
}
|
||||
|
||||
void signo_catch_exit(void)
|
||||
{
|
||||
-#ifdef CONFIG_EULEROS_SYSMONITOR_SIGNAL
|
||||
- (void)unregister_signo_catch_notifier(&g_signo_catch_nb);
|
||||
-#endif
|
||||
+ unregister_kprobe(&kp);
|
||||
#ifdef QEMU_SIG
|
||||
if (g_proc_qemu != NULL) {
|
||||
proc_remove(g_proc_qemu);
|
||||
}
|
||||
#endif
|
||||
- printk(KERN_INFO "signo_catch: send_sig_info_notifier_list unregistered\n");
|
||||
+ printk(KERN_INFO "signo_catch: unregister signal kprobe\n");
|
||||
}
|
||||
|
||||
diff --git a/module/signo_catch.h b/module/signo_catch.h
|
||||
index 0c2b9f7..b2ce684 100644
|
||||
--- a/module/signo_catch.h
|
||||
+++ b/module/signo_catch.h
|
||||
@@ -38,6 +38,12 @@ typedef struct __signo_msg {
|
||||
char recv_comm[TASK_COMM_LEN];
|
||||
} qemu_signo_msg;
|
||||
|
||||
+typedef struct send_sig_info_data {
|
||||
+ int sig;
|
||||
+ struct kernel_siginfo *info;
|
||||
+ struct task_struct *p;
|
||||
+} send_sig_info_data_t;
|
||||
+
|
||||
void signo_catch_init(void);
|
||||
void signo_catch_exit(void);
|
||||
|
||||
diff --git a/src/sys_event.c b/src/sys_event.c
|
||||
index 61701ec..9674b98 100644
|
||||
--- a/src/sys_event.c
|
||||
+++ b/src/sys_event.c
|
||||
@@ -681,6 +681,7 @@ static int handle_signo_msg(const sysmonitor_event_msg *event_msg)
|
||||
log_printf(LOG_ERR, "sig_monitor_start: snprintf_s alarm_msg failed.");
|
||||
return -1;
|
||||
}
|
||||
+ log_printf(LOG_INFO, "%s", alarm_msg);
|
||||
}
|
||||
|
||||
return 0;
|
||||
--
|
||||
2.20.1.windows.1
|
||||
|
||||
@ -6,15 +6,15 @@
|
||||
#
|
||||
|
||||
%define kmod_name sysmonitor
|
||||
%define rpmversion 1.3.2
|
||||
%define releaseversion 1.0
|
||||
%define version 1.3.2
|
||||
%define releaseversion 1.5
|
||||
Summary: System Monitor Daemon
|
||||
Name: %{kmod_name}-kmod
|
||||
Version: %{rpmversion}
|
||||
Version: %{version}
|
||||
Release: %{releaseversion}
|
||||
License: GPLv2 and Mulan PSL v2
|
||||
Group: System Environment/Daemons
|
||||
Source0: %{kmod_name}-%{rpmversion}.tar.bz2
|
||||
Source0: %{kmod_name}-%{version}.tar.bz2
|
||||
BuildRoot: %{_builddir}/%{kmod_name}-root
|
||||
BuildRequires: libboundscheck
|
||||
Requires: systemd
|
||||
@ -22,7 +22,7 @@ BuildRequires: module-init-tools
|
||||
BuildRequires: kernel-devel
|
||||
BuildRequires: dos2unix
|
||||
BuildRequires: elfutils-libelf-devel
|
||||
BuildRequires: cmake gcc-c++
|
||||
BuildRequires: systemd cmake gcc-c++
|
||||
BuildRequires: libcap-devel
|
||||
BuildRequires: uname-build-checks
|
||||
Requires: bash dhcp gawk kmod logrotate
|
||||
@ -35,11 +35,15 @@ Requires: iotop
|
||||
Requires: python3
|
||||
Provides: sysmonitor
|
||||
|
||||
Patch1: bugfix-fix-signal-monitor-err.patch
|
||||
Patch2: bugfix-fix-fd-path-failed-to-open.patch
|
||||
Patch3: update-support-loongarch-fix-compilation-errors.patch
|
||||
|
||||
%description
|
||||
System Monitor Daemon
|
||||
|
||||
%prep
|
||||
%setup -n %{kmod_name}-%{rpmversion}
|
||||
%autosetup -n %{kmod_name}-%{version} -p1
|
||||
|
||||
%build
|
||||
cmake .
|
||||
@ -51,8 +55,8 @@ strip -g sysmonitor.ko
|
||||
%install
|
||||
#export BRP_PESIGN_FILES="*.ko"
|
||||
|
||||
dos2unix %_builddir/%{kmod_name}-%{rpmversion}/script/iomonitor_daemon
|
||||
dos2unix %_builddir/%{kmod_name}-%{rpmversion}/conf/io_monitor
|
||||
dos2unix %_builddir/%{kmod_name}-%{version}/script/iomonitor_daemon
|
||||
dos2unix %_builddir/%{kmod_name}-%{version}/conf/io_monitor
|
||||
|
||||
mkdir -p %{buildroot}/usr/sbin/
|
||||
mkdir -p %{buildroot}/etc/sysmonitor.d/
|
||||
@ -168,6 +172,34 @@ systemctl daemon-reload 2>/dev/null 1>/dev/null
|
||||
/usr/lib/systemd/system/multi-user.target.wants/sysmonitor.service
|
||||
|
||||
%changelog
|
||||
* Mon Jun 03 2024 yueyuankun <yueyuankun@kylinos.cn> - 1.3.2-1.5
|
||||
- Type:update
|
||||
- CVE:NA
|
||||
- SUG:NA
|
||||
- DESC: support loongarch, fix compilation errors
|
||||
|
||||
* Thu Apr 11 2024 tenglei <tenglei@kylinos.cn> - 1.3.2-1.4
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
- DESC:fix bug fd interface failed to open
|
||||
|
||||
* Sun Feb 04 2024 ChenYanpan <chenyanpan@xfusion.com> - 1.3.2-1.3
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
- DESC:rename %rpmversion to %version, to fix build failure
|
||||
|
||||
* Tue Nov 28 2023 xietangxin<xietangxin@huawei.com> - 1.3.2-1.2
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
- SUG:restart
|
||||
- DESC: fix signal monitor err
|
||||
|
||||
* Mon Jul 24 2023 zhang_chunjing<zhang_chunjing@hoperun.com> - 1.3.2-1.1
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
- SUG:restart
|
||||
- DESC: add systemd to BuildRequires to fix install/uninstall errors
|
||||
|
||||
* Sat May 27 2023 xietangxin<xietangxin@huawei.com> - 1.3.2-1.0
|
||||
- Type:bugfix
|
||||
- CVE:NA
|
||||
|
||||
25
update-support-loongarch-fix-compilation-errors.patch
Normal file
25
update-support-loongarch-fix-compilation-errors.patch
Normal file
@ -0,0 +1,25 @@
|
||||
From fb19b25f3723c6274bf0225c0cbd33180e726707 Mon Sep 17 00:00:00 2001
|
||||
From: yueyuankun <yueyuankun@kylinos.cn>
|
||||
Date: Mon, 3 Jun 2024 14:54:20 +0800
|
||||
Subject: [PATCH] support loongarch, fix compilation errors
|
||||
|
||||
---
|
||||
module/signo_catch.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/module/signo_catch.c b/module/signo_catch.c
|
||||
index c038e16..a9270e0 100644
|
||||
--- a/module/signo_catch.c
|
||||
+++ b/module/signo_catch.c
|
||||
@@ -257,7 +257,7 @@ out:
|
||||
|
||||
static int pre_handler(struct kprobe *p, struct pt_regs *regs)
|
||||
{
|
||||
-#ifdef CONFIG_ARM64
|
||||
+#if (defined(CONFIG_ARM64) || defined(CONFIG_LOONGARCH))
|
||||
send_sig_info_data_t data;
|
||||
data.sig = regs->regs[0];
|
||||
data.info = (struct kernel_siginfo *)((unsigned long *)regs->regs[1]);
|
||||
--
|
||||
2.43.0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user