From e9205c616c17361967722f941e20fd387b6aba2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E5=B9=BF=E7=94=9F?= Date: Sat, 19 Apr 2025 00:45:26 +0000 Subject: [PATCH] ptach for arm64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 马广生 --- modules/common/appspawn_adapter.cpp | 66 +++++++++++----------- modules/nweb_adapter/nwebspawn_adapter.cpp | 24 ++++---- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/modules/common/appspawn_adapter.cpp b/modules/common/appspawn_adapter.cpp index 67bc381a..170bd47a 100644 --- a/modules/common/appspawn_adapter.cpp +++ b/modules/common/appspawn_adapter.cpp @@ -155,45 +155,45 @@ int SetSelinuxCon(const AppSpawnMgr *content, const AppSpawningCtx *property) int SetUidGidFilter(const AppSpawnMgr *content) { -#ifdef WITH_SECCOMP - bool ret = false; - if (IsNWebSpawnMode(content)) { - if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) { - APPSPAWN_LOGE("Failed to set no new privs"); - } - ret = SetSeccompPolicyWithName(INDIVIDUAL, NWEBSPAWN_NAME); - } else { -#ifdef SECCOMP_PRIVILEGE - if (IsDeveloperModeOpen()) { - return 0; - } -#endif - ret = SetSeccompPolicyWithName(INDIVIDUAL, APPSPAWN_NAME); - } - if (!ret) { - APPSPAWN_LOGE("Failed to set APPSPAWN seccomp filter and exit"); - _exit(0x7f); - } - APPSPAWN_LOGV("SetUidGidFilter success"); -#endif +// #ifdef WITH_SECCOMP +// bool ret = false; +// if (IsNWebSpawnMode(content)) { +// if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) { +// APPSPAWN_LOGE("Failed to set no new privs"); +// } +// ret = SetSeccompPolicyWithName(INDIVIDUAL, NWEBSPAWN_NAME); +// } else { +// #ifdef SECCOMP_PRIVILEGE +// if (IsDeveloperModeOpen()) { +// return 0; +// } +// #endif +// ret = SetSeccompPolicyWithName(INDIVIDUAL, APPSPAWN_NAME); +// } +// if (!ret) { +// APPSPAWN_LOGE("Failed to set APPSPAWN seccomp filter and exit"); +// _exit(0x7f); +// } +// APPSPAWN_LOGV("SetUidGidFilter success"); +// #endif return 0; } int SetSeccompFilter(const AppSpawnMgr *content, const AppSpawningCtx *property) { -#ifdef WITH_SECCOMP - APPSPAWN_CHECK(property != nullptr, return 0, "property is NULL"); - const char *appName = APP_NAME; - SeccompFilterType type = APP; +// #ifdef WITH_SECCOMP +// APPSPAWN_CHECK(property != nullptr, return 0, "property is NULL"); +// const char *appName = APP_NAME; +// SeccompFilterType type = APP; - if (IsNWebSpawnMode(content)) { - uint32_t len = 0; - std::string processType = - reinterpret_cast(GetAppPropertyExt(property, MSG_EXT_NAME_PROCESS_TYPE, &len)); - if (processType == "render") { - return 0; - } - } +// if (IsNWebSpawnMode(content)) { +// uint32_t len = 0; +// std::string processType = +// reinterpret_cast(GetAppPropertyExt(property, MSG_EXT_NAME_PROCESS_TYPE, &len)); +// if (processType == "render") { +// return 0; +// } +// } #ifdef SECCOMP_PRIVILEGE if (IsDeveloperModeOpen()) { diff --git a/modules/nweb_adapter/nwebspawn_adapter.cpp b/modules/nweb_adapter/nwebspawn_adapter.cpp index 6a54d3d0..349a838e 100644 --- a/modules/nweb_adapter/nwebspawn_adapter.cpp +++ b/modules/nweb_adapter/nwebspawn_adapter.cpp @@ -53,18 +53,18 @@ namespace { static bool SetSeccompPolicyForRenderer(void *nwebRenderHandle) { -#ifdef WITH_SECCOMP - if (IsEnableSeccomp()) { - using SeccompFuncType = bool (*)(void); - SeccompFuncType funcSetRendererSeccompPolicy = - reinterpret_cast(dlsym(nwebRenderHandle, "SetRendererSeccompPolicy")); - if (funcSetRendererSeccompPolicy != nullptr && funcSetRendererSeccompPolicy()) { - return true; - } - APPSPAWN_LOGE("SetRendererSeccompPolicy dlsym errno: %{public}d", errno); - return false; - } -#endif +// #ifdef WITH_SECCOMP +// if (IsEnableSeccomp()) { +// using SeccompFuncType = bool (*)(void); +// SeccompFuncType funcSetRendererSeccompPolicy = +// reinterpret_cast(dlsym(nwebRenderHandle, "SetRendererSeccompPolicy")); +// if (funcSetRendererSeccompPolicy != nullptr && funcSetRendererSeccompPolicy()) { +// return true; +// } +// APPSPAWN_LOGE("SetRendererSeccompPolicy dlsym errno: %{public}d", errno); +// return false; +// } +// #endif return true; } -- Gitee