diff --git a/0001-fix-kernel-patch-ACCEPTED-change-to-DEACTIVED-after-.patch b/0001-fix-kernel-patch-ACCEPTED-change-to-DEACTIVED-after-.patch new file mode 100644 index 0000000000000000000000000000000000000000..026dde4cb60b436d0f78800fd1bad48c56129b29 --- /dev/null +++ b/0001-fix-kernel-patch-ACCEPTED-change-to-DEACTIVED-after-.patch @@ -0,0 +1,26 @@ +From e7ea4a32db656a1419fe60e4eaca7ce74cc4c0b6 Mon Sep 17 00:00:00 2001 +From: liqiang +Date: Wed, 28 Aug 2024 02:24:59 +0800 +Subject: [PATCH] fix kernel patch ACCEPTED change to DEACTIVED after reboot + +Signed-off-by: liqiang +--- + syscared/src/patch/driver/kpatch/sys.rs | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/syscared/src/patch/driver/kpatch/sys.rs b/syscared/src/patch/driver/kpatch/sys.rs +index 22efa93..fd5160c 100644 +--- a/syscared/src/patch/driver/kpatch/sys.rs ++++ b/syscared/src/patch/driver/kpatch/sys.rs +@@ -90,7 +90,7 @@ pub fn apply_patch(patch: &KernelPatch) -> Result<()> { + kmod::finit_module( + &patch_module, + CString::new("")?.as_c_str(), +- kmod::ModuleInitFlags::MODULE_INIT_IGNORE_VERMAGIC, ++ kmod::ModuleInitFlags::empty(), + ) + .map_err(|e| anyhow!("Kpatch: {}", std::io::Error::from(e))) + } +-- +2.34.1 + diff --git a/0002-fix-some-clean-code-problem.patch b/0002-fix-some-clean-code-problem.patch new file mode 100644 index 0000000000000000000000000000000000000000..036a72138576971f9886cd28ca24ec6193cea23a --- /dev/null +++ b/0002-fix-some-clean-code-problem.patch @@ -0,0 +1,97 @@ +From 2f41eb92cb97ba980ac4d9d7b6b39d001687c111 Mon Sep 17 00:00:00 2001 +From: liqiang +Date: Thu, 29 Aug 2024 03:56:58 +0800 +Subject: [PATCH] fix some clean code problem + +Signed-off-by: liqiang +--- + upatch-diff/insn/asm/inat.h | 8 ++++---- + upatch-diff/insn/inat.c | 6 +++--- + upatch-diff/insn/insn.c | 6 +++--- + 3 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/upatch-diff/insn/asm/inat.h b/upatch-diff/insn/asm/inat.h +index f446ad8..4ab84d6 100644 +--- a/upatch-diff/insn/asm/inat.h ++++ b/upatch-diff/insn/asm/inat.h +@@ -156,7 +156,7 @@ static inline int inat_is_escape(insn_attr_t attr) + return attr & INAT_ESC_MASK; + } + +-static inline int inat_escape_id(insn_attr_t attr) ++static inline unsigned int inat_escape_id(insn_attr_t attr) + { + return (attr & INAT_ESC_MASK) >> INAT_ESC_OFFS; + } +@@ -166,7 +166,7 @@ static inline int inat_is_group(insn_attr_t attr) + return attr & INAT_GRP_MASK; + } + +-static inline int inat_group_id(insn_attr_t attr) ++static inline unsigned int inat_group_id(insn_attr_t attr) + { + return (attr & INAT_GRP_MASK) >> INAT_GRP_OFFS; + } +@@ -181,7 +181,7 @@ static inline int inat_has_immediate(insn_attr_t attr) + return attr & INAT_IMM_MASK; + } + +-static inline int inat_immediate_size(insn_attr_t attr) ++static inline unsigned int inat_immediate_size(insn_attr_t attr) + { + return (attr & INAT_IMM_MASK) >> INAT_IMM_OFFS; + } +@@ -220,4 +220,4 @@ static inline int inat_must_vex(insn_attr_t attr) + { + return attr & INAT_VEXONLY; + } +-#endif +\ No newline at end of file ++#endif +diff --git a/upatch-diff/insn/inat.c b/upatch-diff/insn/inat.c +index 193583f..cb5aec6 100644 +--- a/upatch-diff/insn/inat.c ++++ b/upatch-diff/insn/inat.c +@@ -43,7 +43,7 @@ insn_attr_t inat_get_escape_attribute(insn_byte_t opcode, int lpfx_id, + insn_attr_t esc_attr) + { + const insn_attr_t *table; +- int n; ++ unsigned int n; + + n = inat_escape_id(esc_attr); + +@@ -62,7 +62,7 @@ insn_attr_t inat_get_group_attribute(insn_byte_t modrm, int lpfx_id, + insn_attr_t grp_attr) + { + const insn_attr_t *table; +- int n; ++ unsigned int n; + + n = inat_group_id(grp_attr); + +@@ -95,4 +95,4 @@ insn_attr_t inat_get_avx_attribute(insn_byte_t opcode, insn_byte_t vex_m, + return 0; + } + return table[opcode]; +-} +\ No newline at end of file ++} +diff --git a/upatch-diff/insn/insn.c b/upatch-diff/insn/insn.c +index d9a356b..7880eed 100644 +--- a/upatch-diff/insn/insn.c ++++ b/upatch-diff/insn/insn.c +@@ -574,6 +574,6 @@ void insn_get_length(struct insn *insn) + return; + if (!insn->immediate.got) + insn_get_immediate(insn); +- insn->length = (unsigned char)((unsigned long)insn->next_byte +- - (unsigned long)insn->kaddr); +-} +\ No newline at end of file ++ insn->length = (unsigned char)((unsigned long)insn->next_byte - ++ (unsigned long)insn->kaddr); ++} +-- +2.34.1 + diff --git a/0003-upatch-helper-fix-object-upatch-id-duplicated-issue.patch b/0003-upatch-helper-fix-object-upatch-id-duplicated-issue.patch new file mode 100644 index 0000000000000000000000000000000000000000..2ff01616d77364d8863d4a0247ed166c570ed5d6 --- /dev/null +++ b/0003-upatch-helper-fix-object-upatch-id-duplicated-issue.patch @@ -0,0 +1,50 @@ +From 4efb5455073c23a6a90845eb541910eba6dc76f3 Mon Sep 17 00:00:00 2001 +From: renoseven +Date: Fri, 6 Sep 2024 22:14:11 +0800 +Subject: [PATCH] upatch-helper: fix object upatch id duplicated issue + +Signed-off-by: renoseven +--- + upatch-helper/Cargo.toml | 2 +- + upatch-helper/src/main.rs | 6 +++--- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/upatch-helper/Cargo.toml b/upatch-helper/Cargo.toml +index 42f3548..b131b66 100644 +--- a/upatch-helper/Cargo.toml ++++ b/upatch-helper/Cargo.toml +@@ -9,5 +9,5 @@ rust-version = "1.60" + build = "build.rs" + + [dependencies] +-syscare-common = { package = "syscare-common", path = "../syscare-common" } + anyhow = { version = "1.0" } ++uuid = { version = "0.8", features = ["v4"] } +diff --git a/upatch-helper/src/main.rs b/upatch-helper/src/main.rs +index d98b167..303088c 100644 +--- a/upatch-helper/src/main.rs ++++ b/upatch-helper/src/main.rs +@@ -15,7 +15,7 @@ + use std::{os::unix::process::CommandExt, path::Path, process::Command}; + + use anyhow::{bail, Context}; +-use syscare_common::os; ++use uuid::Uuid; + + const UPATCH_CC_ENV: &str = "UPATCH_HELPER_CC"; + const UPATCH_CXX_ENV: &str = "UPATCH_HELPER_CXX"; +@@ -50,9 +50,9 @@ fn main() -> anyhow::Result<()> { + if exec_args.iter().any(|arg| arg == OUTPUT_FLAG) { + command.args(APPEND_ARGS); + command.arg(format!( +- "-Wa,--defsym,{}0x{:04x}=0", ++ "-Wa,--defsym,{}{}=0", + UPATCH_ID_PREFIX, +- os::process::id() ++ Uuid::new_v4(), + )); + } + +-- +2.34.1 + diff --git a/syscare.spec b/syscare.spec index cf437ca6616f434ece07f322f82bfbb8c55fa140..199220dbaf0ef68502e8ff21b1032b3f374782eb 100644 --- a/syscare.spec +++ b/syscare.spec @@ -5,7 +5,7 @@ ############################################ Name: syscare Version: 1.2.2 -Release: 1 +Release: 2 Summary: System hot-fix service License: MulanPSL-2.0 and GPL-2.0-only URL: https://gitee.com/openeuler/syscare @@ -19,6 +19,10 @@ Requires: kpatch-runtime Excludearch: loongarch64 +Patch0001: 0001-fix-kernel-patch-ACCEPTED-change-to-DEACTIVED-after-.patch +Patch0002: 0002-fix-some-clean-code-problem.patch +Patch0003: 0003-upatch-helper-fix-object-upatch-id-duplicated-issue.patch + ############### Description ################ %description SysCare is a system-level hot-fix service that provides security patches and system error hot-fixes for the operating system. @@ -124,5 +128,9 @@ Syscare patch building toolset. ################ Change log ################ ############################################ %changelog +* Wed Sep 18 2024 renoseven - 1.2.2-2 +- syscared: fix kernel patch apply failure issue +- upatch-helper: fix object upatch id duplicated issue + * Fri Aug 16 2024 renoseven - 1.2.2-1 - Release version 1.2.2-1.