diff --git a/modules/common/appspawn_adapter.cpp b/modules/common/appspawn_adapter.cpp index ab2e5e5e035b3f1e6e44775ae08b2a8ea68a9593..bd075cb1956f4747e4e58917be0b02dc535d49d1 100644 --- a/modules/common/appspawn_adapter.cpp +++ b/modules/common/appspawn_adapter.cpp @@ -127,51 +127,51 @@ 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 { - 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 { +// 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; - - 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 (CheckAppSpawnMsgFlag(property->message, TLV_MSG_FLAGS, APP_FLAGS_ISOLATED_SANDBOX) != 0) { - appName = IMF_EXTENTOIN_NAME; - } - - if (!SetSeccompPolicyWithName(type, appName)) { - APPSPAWN_LOGE("Failed to set %{public}s seccomp filter and exit %{public}d", appName, errno); - return -EINVAL; - } - APPSPAWN_LOGV("SetSeccompFilter success for %{public}s", GetProcessName(property)); -#endif +// #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 (CheckAppSpawnMsgFlag(property->message, TLV_MSG_FLAGS, APP_FLAGS_ISOLATED_SANDBOX) != 0) { +// appName = IMF_EXTENTOIN_NAME; +// } + +// if (!SetSeccompPolicyWithName(type, appName)) { +// APPSPAWN_LOGE("Failed to set %{public}s seccomp filter and exit %{public}d", appName, errno); +// return -EINVAL; +// } +// APPSPAWN_LOGV("SetSeccompFilter success for %{public}s", GetProcessName(property)); +// #endif return 0; } diff --git a/modules/nweb_adapter/nwebspawn_adapter.cpp b/modules/nweb_adapter/nwebspawn_adapter.cpp index 84c44f7cc01774f54b3422d4b83c382a72f9d451..31e8163d2a4b1155041c5249b0df30c8aa2bac4d 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; }