diff --git a/modules/common/appspawn_silk.c b/modules/common/appspawn_silk.c index 2f8d9141062478031e78286e85cd0aede4c30a75..c5e61d37d03582d75a58f30797b2dd0eb746e66f 100644 --- a/modules/common/appspawn_silk.c +++ b/modules/common/appspawn_silk.c @@ -110,7 +110,7 @@ APPSPAWN_STATIC bool ParseSilkConfig(const cJSON *root, struct SilkConfig *confi void LoadSilkConfig(void) { cJSON *root = GetJsonObjFromFile(SILK_JSON_CONFIG_PATH); - APPSPAWN_CHECK(root != NULL, return, "Failed to load silk config"); + APPSPAWN_CHECK_LOGV(root != NULL, return, "Failed to load silk config"); (void)ParseSilkConfig(root, &g_silkConfig); cJSON_Delete(root); } diff --git a/modules/sandbox/normal/sandbox_common.cpp b/modules/sandbox/normal/sandbox_common.cpp index 9eca40fcceac87c6e97377e583ce1b45db680cfa..df0cedf393282fbf6b41a455fca4c1f5a9af31bf 100644 --- a/modules/sandbox/normal/sandbox_common.cpp +++ b/modules/sandbox/normal/sandbox_common.cpp @@ -160,7 +160,7 @@ int SandboxCommon::LoadAppSandboxConfigCJson(AppSpawnMgr *content) std::string isolatedPath = path + SandboxCommonDef::APP_ISOLATED_JSON_CONFIG; APPSPAWN_LOGI("LoadAppSandboxConfig %{public}s", isolatedPath.c_str()); sandboxCJsonRoot = GetJsonObjFromFile(isolatedPath.c_str()); - APPSPAWN_CHECK((sandboxCJsonRoot != nullptr && cJSON_IsObject(sandboxCJsonRoot)), continue, + APPSPAWN_CHECK_LOGW((sandboxCJsonRoot != nullptr && cJSON_IsObject(sandboxCJsonRoot)), continue, "Failed to load app data sandbox config %{public}s", isolatedPath.c_str()); StoreCJsonConfig(sandboxCJsonRoot, SandboxCommonDef::SANDBOX_ISOLATED_JSON_CONFIG); } @@ -507,8 +507,13 @@ bool SandboxCommon::IsCreateSandboxPathEnabled(cJSON *json, std::string srcPath) bool SandboxCommon::IsTotalSandboxEnabled(const AppSpawningCtx *appProperty) // CheckTotalSandboxSwitchStatus { - SandboxCommonDef::SandboxConfigType type = CheckAppMsgFlagsSet(appProperty, APP_FLAGS_ISOLATED_SANDBOX_TYPE) ? - SandboxCommonDef::SANDBOX_ISOLATED_JSON_CONFIG : SandboxCommonDef::SANDBOX_APP_JSON_CONFIG; + SandboxCommonDef::SandboxConfigType type; + if (appProperty == nullptr) { + type = SandboxCommonDef::SANDBOX_APP_JSON_CONFIG; + } else { + type = CheckAppMsgFlagsSet(appProperty, APP_FLAGS_ISOLATED_SANDBOX_TYPE) ? + SandboxCommonDef::SANDBOX_ISOLATED_JSON_CONFIG : SandboxCommonDef::SANDBOX_APP_JSON_CONFIG; + } for (auto& wholeConfig : GetCJsonConfig(type)) { // 获取 "common" 数组 diff --git a/modules/sandbox/sandbox_dec.c b/modules/sandbox/sandbox_dec.c index 8e36ea2e4113757d97e0ab797eb7b2e865b14136..72c0d4f8ecc49ec8ae99545226d0338456ce4c48 100644 --- a/modules/sandbox/sandbox_dec.c +++ b/modules/sandbox/sandbox_dec.c @@ -21,6 +21,7 @@ #include #include "appspawn_utils.h" #include "appspawn_hook.h" +#include "appspawn_manager.h" static const char *g_decConstraintDir[] = { "/storage/Users", @@ -106,7 +107,7 @@ static int SetDenyConstraintDirs(AppSpawnMgr *content) const char *decFilename = "/dev/dec"; int fd = open(decFilename, O_RDWR); if (fd < 0) { - APPSPAWN_LOGE("open dec file fail."); + APPSPAWN_CHECK_ONLY_LOG(IsNativeSpawnMode(content) != 0, "open dec file fail."); return 0; } @@ -140,7 +141,7 @@ static int SetForcedPrefixDirs(AppSpawnMgr *content) const char *decFilename = "/dev/dec"; int fd = open(decFilename, O_RDWR); if (fd < 0) { - APPSPAWN_LOGE("open dec file fail."); + APPSPAWN_CHECK_ONLY_LOG(IsNativeSpawnMode(content) != 0, "open dec file fail."); return 0; } diff --git a/standard/appspawn_kickdog.c b/standard/appspawn_kickdog.c index ef01677b8802e50df7c776abfa727d1e3bfed14c..600ac39590372ddba31bd5e6345abaf03479cacb 100644 --- a/standard/appspawn_kickdog.c +++ b/standard/appspawn_kickdog.c @@ -127,6 +127,7 @@ static int CheckKernelType(bool *isLinux) APPSPAWN_STATIC int SpawnKickDogStart(AppSpawnMgr *mgrContent) { APPSPAWN_CHECK(mgrContent != NULL, return 0, "content is null"); + APPSPAWN_CHECK_ONLY_EXPER(mgrContent->content.mode != MODE_FOR_NATIVE_SPAWN, return 0); APPSPAWN_CHECK((mgrContent->content.mode == MODE_FOR_APP_SPAWN) || (mgrContent->content.mode == MODE_FOR_NWEB_SPAWN) || (mgrContent->content.mode == MODE_FOR_HYBRID_SPAWN), return 0, "Mode %{public}u no need enable watchdog", mgrContent->content.mode); diff --git a/standard/appspawn_main.c b/standard/appspawn_main.c index ac4f7da8a7256a09e657bb61035d9222a2f825c1..bed93f4d47b12ee2e0017711ebee1234571addf8 100644 --- a/standard/appspawn_main.c +++ b/standard/appspawn_main.c @@ -73,8 +73,11 @@ static void CheckPreload(char *const argv[]) ssize_t nread = readlink("/proc/self/exe", buf, sizeof(buf) - 1); APPSPAWN_CHECK(nread != -1, return, "readlink fail: /proc/self/exe: %{public}d", errno); buf[nread] = 0; - ret = execv(buf, argv); - APPSPAWN_LOGE("execv fail: %{public}s: %{public}d: %{public}d", buf, errno, ret); + int result = strcmp(buf, "/system/bin/nativespawn"); + if (result != 0) { + ret = execv(buf, argv); + APPSPAWN_LOGE("execv fail: %{public}s: %{public}d: %{public}d", buf, errno, ret); + } } #ifndef NATIVE_SPAWN