From ff8f7fe675a3bb61797a803737555533d23c975c Mon Sep 17 00:00:00 2001 From: renoseven Date: Fri, 1 Aug 2025 10:25:09 +0800 Subject: [PATCH 1/2] upatch-manage: fix do_mprotect_pkey resolve failure Signed-off-by: renoseven --- upatch-manage/kernel_compat.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/upatch-manage/kernel_compat.c b/upatch-manage/kernel_compat.c index beecd95a..56214b82 100644 --- a/upatch-manage/kernel_compat.c +++ b/upatch-manage/kernel_compat.c @@ -120,9 +120,10 @@ typedef long (*do_mprotect_pkey_fn)( ); static const char *mprotect_symbol_names[] = { - "do_mprotect_pkey.constprop.0", "do_mprotect_pkey", - "do_mprotect", + "do_mprotect_pkey.constprop.0", + "do_mprotect_pkey.constprop.1", + "do_mprotect_pkey.constprop.2", NULL }; static do_mprotect_pkey_fn do_mprotect_pkey = NULL; -- Gitee From 1fd71f22129fa10b4d6f0d5d5706c41ff6cb583b Mon Sep 17 00:00:00 2001 From: renoseven Date: Fri, 1 Aug 2025 13:18:53 +0800 Subject: [PATCH 2/2] syscare: return error if external command is an invalid executable Signed-off-by: renoseven --- syscare/src/main.rs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/syscare/src/main.rs b/syscare/src/main.rs index 38416f26..ff7a4ecf 100644 --- a/syscare/src/main.rs +++ b/syscare/src/main.rs @@ -12,9 +12,9 @@ * See the Mulan PSL v2 for more details. */ -use std::{env, ffi::OsString, os::unix::process::CommandExt, process::Command}; +use std::{env, ffi::OsString, process::Command}; -use anyhow::{bail, Context, Result}; +use anyhow::{anyhow, Context, Result}; use args::SubCommand; use flexi_logger::{LogSpecification, Logger, WriteMode}; use log::{debug, LevelFilter}; @@ -41,22 +41,22 @@ const EXTERNAL_CMD_PREFIX: &str = "syscare-"; fn exec_external_cmd(mut args: Vec) -> Result<()> { let program = concat_os!(EXTERNAL_CMD_PREFIX, args.remove(0).trim()); - let error = Command::new(&program).args(&args).exec(); - match error.kind() { - std::io::ErrorKind::NotFound => { - bail!( + let _ = Command::new(&program) + .args(&args) + .status() + .map_err(|e| match e.kind() { + std::io::ErrorKind::NotFound => anyhow!( "External command '{}' is not installed", program.to_string_lossy() - ); - } - _ => { - bail!( - "Failed to execute '{}', {}", + ), + _ => anyhow!( + "Failed to execute '{}': {}", program.to_string_lossy(), - error - ); - } - } + e.to_string().to_lowercase() + ), + })?; + + Ok(()) } fn main() -> Result<()> { -- Gitee