/base/startup/init/services/sandbox/ |
H A D | sandbox.c | 16 #include "sandbox.h" 34 #define SANDBOX_ROOT_TAG "sandbox-root" 38 #define SANDBOX_TARGET "sandbox-path" 39 #define SANDBOX_FLAGS "sandbox-flags" 45 #define SANDBOX_SYSTEM_CONFIG_FILE "etc/sandbox/system-sandbox.json" 46 #define SANDBOX_CHIPSET_CONFIG_FILE "etc/sandbox/chipset-sandbox.json" 49 #define SANDBOX_TEST_CONFIG_FILE "/data/init_ut/test-sandbox.json" 89 sandbox_t *sandbox; member 224 AddMountInfoToSandbox(sandbox_t *sandbox, cJSON *item, const char *type) AddMountInfoToSandbox() argument 267 AddSymbolLinksToSandbox(sandbox_t *sandbox, cJSON *item, const char *type) AddSymbolLinksToSandbox() argument 287 GetSandboxInfo(sandbox_t *sandbox, cJSON *root, const char *itemName) GetSandboxInfo() argument 316 ParseSandboxConfig(cJSON *root, sandbox_t *sandbox) ParseSandboxConfig() argument 353 ParseInitSandboxConfigFile(sandbox_t *sandbox, const char *sandboxConfigFile, const char *name) ParseInitSandboxConfigFile() argument 371 ParseInitSandboxConfigPath(sandbox_t *sandbox, const char *sandboxConfig, const char *name) ParseInitSandboxConfigPath() argument 385 InitSandbox(sandbox_t *sandbox, const char *sandboxConfig, const char *name) InitSandbox() argument 463 IsValidSandbox(sandbox_t *sandbox) IsValidSandbox() argument 540 sandbox_t *sandbox = map->sandbox; PrepareSandbox() local 600 sandbox_t *sandbox = map->sandbox; DestroySandbox() local 630 sandbox_t *sandbox = map->sandbox; EnterSandbox() local [all...] |
/base/startup/appspawn/test/unittest/app_spawn_standard_test/ |
H A D | app_spawn_sandbox_new_test.cpp | 44 \"sandbox-root\": \"/mnt/sandbox/<currentUserId>/app-root\", \ 45 \"sandbox-ns-flags\": [ \"pid\", \"net\" ], \ 46 \"top-sandbox-switch\": \"ON\" \ 52 \"sandbox-path\" : \"/lib\", \ 59 \"sandbox-path\" : \"/lib1\", \ 66 \"sandbox-path\" : \"/storage/cloud/epfs\", \ 73 \"sandbox-path\" : \"/storage/Users/<currentUserId>/appdata/el1\", \ 80 \"sandbox-path\" : \"/mnt/data/fuse\", \ 90 \"sandbox 340 TestParseAppSandboxConfig(AppSpawnSandboxCfg *sandbox, const char *buffer) TestParseAppSandboxConfig() argument 679 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 727 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 767 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 809 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 851 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 910 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 931 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 980 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 1028 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 1077 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 1118 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 1157 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 1210 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 1262 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 1322 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 1373 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 1425 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 1483 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 1540 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 1593 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 1646 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 1699 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 1751 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 1803 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 1854 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 1906 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 1958 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 2010 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 2046 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 2083 AppSpawnSandboxCfg *sandbox = nullptr; HWTEST_F() local 2346 AppSpawnSandboxCfg *sandbox = CreateAppSpawnSandbox(EXT_DATA_SANDBOX); HWTEST_F() local [all...] |
H A D | app_spawn_sandboxmgr_test.cpp | 56 AppSpawnSandboxCfg *sandbox = GetAppSpawnSandbox(mgr, EXT_DATA_SANDBOX); in HWTEST_F() local 57 EXPECT_EQ(sandbox == nullptr, 1); in HWTEST_F() 59 sandbox = CreateAppSpawnSandbox(EXT_DATA_SANDBOX); in HWTEST_F() 60 EXPECT_EQ(sandbox != nullptr, 1); in HWTEST_F() 61 OH_ListAddTail(&sandbox->extData.node, &mgr->extData); in HWTEST_F() 63 sandbox = GetAppSpawnSandbox(mgr, EXT_DATA_SANDBOX); in HWTEST_F() 64 EXPECT_EQ(sandbox != nullptr, 1); in HWTEST_F() 67 DumpAppSpawnSandboxCfg(sandbox); in HWTEST_F() 70 DeleteAppSpawnSandbox(sandbox); in HWTEST_F() 72 sandbox in HWTEST_F() 86 AppSpawnSandboxCfg *sandbox = CreateAppSpawnSandbox(EXT_DATA_SANDBOX); HWTEST_F() local 108 AppSpawnSandboxCfg *sandbox = CreateAppSpawnSandbox(EXT_DATA_SANDBOX); HWTEST_F() local 139 AppSpawnSandboxCfg *sandbox = CreateAppSpawnSandbox(EXT_DATA_SANDBOX); HWTEST_F() local 186 AppSpawnSandboxCfg *sandbox = CreateAppSpawnSandbox(EXT_DATA_SANDBOX); HWTEST_F() local 223 AppSpawnSandboxCfg *sandbox = CreateAppSpawnSandbox(EXT_DATA_SANDBOX); HWTEST_F() local 249 AppSpawnSandboxCfg *sandbox = CreateAppSpawnSandbox(EXT_DATA_SANDBOX); HWTEST_F() local 291 AppSpawnSandboxCfg *sandbox = CreateAppSpawnSandbox(EXT_DATA_SANDBOX); HWTEST_F() local 326 AppSpawnSandboxCfg *sandbox = CreateAppSpawnSandbox(EXT_DATA_SANDBOX); HWTEST_F() local 357 AppSpawnSandboxCfg *sandbox = CreateAppSpawnSandbox(EXT_DATA_SANDBOX); HWTEST_F() local 405 AppSpawnSandboxCfg *sandbox = CreateAppSpawnSandbox(EXT_DATA_SANDBOX); HWTEST_F() local 480 AppSpawnSandboxCfg *sandbox = CreateAppSpawnSandbox(EXT_DATA_SANDBOX); HWTEST_F() local 520 AppSpawnSandboxCfg *sandbox = CreateAppSpawnSandbox(EXT_DATA_SANDBOX); HWTEST_F() local 553 AppSpawnSandboxCfg *sandbox = CreateAppSpawnSandbox(EXT_DATA_SANDBOX); HWTEST_F() local [all...] |
/base/startup/appspawn/modules/sandbox/ |
H A D | sandbox_manager.c | 169 APPSPAPWN_DUMP(" sandbox node source: %{public}s", pathNode->source ? pathNode->source : "null"); in DumpSandboxMountNode() 170 APPSPAPWN_DUMP(" sandbox node target: %{public}s", pathNode->target ? pathNode->target : "null"); in DumpSandboxMountNode() 172 APPSPAPWN_DUMP(" sandbox node apl: %{public}s", in DumpSandboxMountNode() 174 APPSPAPWN_DUMP(" sandbox node checkErrorFlag: %{public}s", in DumpSandboxMountNode() 181 APPSPAPWN_DUMP(" sandbox node target: %{public}s", linkNode->target ? linkNode->target : "null"); in DumpSandboxMountNode() 182 APPSPAPWN_DUMP(" sandbox node linkName: %{public}s", in DumpSandboxMountNode() 184 APPSPAPWN_DUMP(" sandbox node destMode: %{public}x", linkNode->destMode); in DumpSandboxMountNode() 185 APPSPAPWN_DUMP(" sandbox node checkErrorFlag: %{public}s", in DumpSandboxMountNode() 363 void DeleteAppSpawnSandbox(AppSpawnSandboxCfg *sandbox) in DeleteAppSpawnSandbox() argument 365 APPSPAWN_CHECK_ONLY_EXPER(sandbox ! in DeleteAppSpawnSandbox() 419 AppSpawnSandboxCfg *sandbox = (AppSpawnSandboxCfg *)data; DumpSandbox() local 431 AppSpawnSandboxCfg *sandbox = ListEntry(data, AppSpawnSandboxCfg, extData); FreeAppSpawnSandbox() local 439 AppSpawnSandboxCfg *sandbox = (AppSpawnSandboxCfg *)calloc(1, sizeof(AppSpawnSandboxCfg)); CreateAppSpawnSandbox() local 469 DumpAppSpawnSandboxCfg(AppSpawnSandboxCfg *sandbox) DumpAppSpawnSandboxCfg() argument 491 AppSpawnSandboxCfg *sandbox = GetAppSpawnSandbox(content, EXT_DATA_ISOLATED_SANDBOX); PreLoadIsoLatedSandboxCfg() local 511 AppSpawnSandboxCfg *sandbox = GetAppSpawnSandbox(content, EXT_DATA_SANDBOX); PreLoadSandboxCfg() local 531 AppSpawnSandboxCfg *sandbox = GetAppSpawnSandbox(content, EXT_DATA_ISOLATED_SANDBOX); IsolatedSandboxHandleServerExit() local 539 AppSpawnSandboxCfg *sandbox = GetAppSpawnSandbox(content, EXT_DATA_SANDBOX); SandboxHandleServerExit() local 573 AppendPermissionGid(const AppSpawnSandboxCfg *sandbox, AppSpawningCtx *property) AppendPermissionGid() argument 614 AppendPackageNameGids(const AppSpawnSandboxCfg *sandbox, AppSpawningCtx *property) AppendPackageNameGids() argument 653 AppSpawnSandboxCfg *sandbox = GetAppSpawnSandbox(content, type); SpawnPrepareSandboxCfg() local 683 AppSpawnSandboxCfg *sandbox = NULL; SandboxUnmountPath() local [all...] |
H A D | sandbox_load.c | 114 return GetBoolParameter("const.sandbox.pidns.support", true); in AppSandboxPidNsIsSupport() 151 cJSON *obj = cJSON_GetObjectItemCaseSensitive(appConfig, "sandbox-ns-flags"); in GetSandboxNsFlags() 208 char *dstPath = GetStringFromJsonObj(config, "sandbox-path"); in DecodeMountPathConfig() 245 APPSPAWN_STATIC int ParseMountPathsConfig(AppSpawnSandboxCfg *sandbox, in ParseMountPathsConfig() argument 291 APPSPAWN_STATIC int ParseSymbolLinksConfig(AppSpawnSandboxCfg *sandbox, const cJSON *symbolLinkConfigs, in ParseSymbolLinksConfig() argument 308 APPSPAWN_STATIC int ParseGidTableConfig(AppSpawnSandboxCfg *sandbox, const cJSON *configs, SandboxSection *section) in ParseGidTableConfig() argument 341 static int ParseMountGroupsConfig(AppSpawnSandboxCfg *sandbox, const cJSON *groupConfig, SandboxSection *section) in ParseMountGroupsConfig() argument 368 mountNode = (SandboxNameGroupNode *)GetSandboxSection(&sandbox->nameGroupsQueue, name); in ParseMountGroupsConfig() 400 static int ParseBaseConfig(AppSpawnSandboxCfg *sandbox, SandboxSection *section, const cJSON *configs) in ParseBaseConfig() argument 405 APPSPAWN_LOGV("Parse sandbox in ParseBaseConfig() 445 ParsePackageNameConfig(AppSpawnSandboxCfg *sandbox, const char *name, const cJSON *packageNameConfigs) ParsePackageNameConfig() argument 464 ParseSpawnFlagsConfig(AppSpawnSandboxCfg *sandbox, const char *name, const cJSON *flagsConfig) ParseSpawnFlagsConfig() argument 485 ParsePermissionConfig(AppSpawnSandboxCfg *sandbox, const char *name, const cJSON *permissionConfig) ParsePermissionConfig() argument 504 ParseNameGroup(AppSpawnSandboxCfg *sandbox, const cJSON *groupConfig) ParseNameGroup() argument 543 ParseNameGroupsConfig(AppSpawnSandboxCfg *sandbox, const cJSON *root) ParseNameGroupsConfig() argument 568 ParseConditionalConfig(AppSpawnSandboxCfg *sandbox, const cJSON *configs, const char *configName, int (*parseConfig)(AppSpawnSandboxCfg *sandbox, const char *name, const cJSON *configs)) ParseConditionalConfig() argument 592 ParseGlobalSandboxConfig(AppSpawnSandboxCfg *sandbox, const cJSON *root) ParseGlobalSandboxConfig() argument 617 AppSpawnSandboxCfg *sandbox = context->sandboxCfg; ParseAppSandboxConfig() local 676 LoadAppSandboxConfig(AppSpawnSandboxCfg *sandbox, RunMode mode) LoadAppSandboxConfig() argument [all...] |
H A D | appspawn_sandbox.c | 121 static int BuildRootPath(char *buffer, uint32_t bufferLen, const AppSpawnSandboxCfg *sandbox, uid_t uid) in BuildRootPath() argument 127 uint32_t rootLen = strlen(sandbox->rootPath); in BuildRootPath() 128 char *rootPath = strstr(sandbox->rootPath, PARAMETER_USER_ID); in BuildRootPath() 130 len = sprintf_s(buffer, bufferLen, "%s/%d", sandbox->rootPath, uid); in BuildRootPath() 132 ret = memcpy_s(buffer, bufferLen, sandbox->rootPath, rootPath - sandbox->rootPath); in BuildRootPath() 133 APPSPAWN_CHECK(ret == 0, return ret, "Failed to copy root path %{public}s", sandbox->rootPath); in BuildRootPath() 134 currLen = rootPath - sandbox->rootPath; in BuildRootPath() 138 uid, sandbox->rootPath + currLen + userIdLen); in BuildRootPath() 143 "Failed to format root path %{public}s", sandbox in BuildRootPath() 189 InitSandboxContext(SandboxContext *context, const AppSpawnSandboxCfg *sandbox, const AppSpawningCtx *property, int nwebspawn) InitSandboxContext() argument 612 MountDirToShared(const SandboxContext *context, AppSpawnSandboxCfg *sandbox) MountDirToShared() argument 709 MountSandboxConfig(const SandboxContext *context, const AppSpawnSandboxCfg *sandbox, const SandboxSection *section, uint32_t op) MountSandboxConfig() argument 743 SetExpandSandboxConfig(const SandboxContext *context, const AppSpawnSandboxCfg *sandbox) SetExpandSandboxConfig() argument 770 SetSandboxPackageNameConfig(const SandboxContext *context, const AppSpawnSandboxCfg *sandbox) SetSandboxPackageNameConfig() argument 781 SetSandboxSpawnFlagsConfig(const SandboxContext *context, const AppSpawnSandboxCfg *sandbox) SetSandboxSpawnFlagsConfig() argument 799 SetSandboxPermissionConfig(const SandboxContext *context, const AppSpawnSandboxCfg *sandbox) SetSandboxPermissionConfig() argument 819 SetOverlayAppSandboxConfig(const SandboxContext *context, const AppSpawnSandboxCfg *sandbox) SetOverlayAppSandboxConfig() argument 829 SetBundleResourceSandboxConfig(const SandboxContext *context, const AppSpawnSandboxCfg *sandbox) SetBundleResourceSandboxConfig() argument 868 SandboxRootFolderCreateNoShare( const SandboxContext *context, const AppSpawnSandboxCfg *sandbox, bool remountProc) SandboxRootFolderCreateNoShare() argument 883 SandboxRootFolderCreate(const SandboxContext *context, const AppSpawnSandboxCfg *sandbox) SandboxRootFolderCreate() argument 905 IsSandboxMounted(const AppSpawnSandboxCfg *sandbox, const char *name, const char *rootPath) IsSandboxMounted() argument 921 SetSandboxMounted(const AppSpawnSandboxCfg *sandbox, const char *name, char *rootPath) SetSandboxMounted() argument 947 UnmountDepPaths(const AppSpawnSandboxCfg *sandbox, uid_t uid) UnmountDepPaths() argument 967 UnmountSandboxConfigs(const AppSpawnSandboxCfg *sandbox, uid_t uid, const char *name) UnmountSandboxConfigs() argument 1003 IsADFPermission(AppSpawnSandboxCfg *sandbox, const AppSpawningCtx *property) IsADFPermission() argument 1016 StagedMountSystemConst(AppSpawnSandboxCfg *sandbox, const AppSpawningCtx *property, int nwebspawn) StagedMountSystemConst() argument 1093 SetSystemConstDepGroups(const SandboxContext *context, AppSpawnSandboxCfg *sandbox) SetSystemConstDepGroups() argument 1112 SetAppVariableDepGroups(const SandboxContext *context, AppSpawnSandboxCfg *sandbox) SetAppVariableDepGroups() argument 1131 SetSpawnFlagsDepGroups(const SandboxContext *context, AppSpawnSandboxCfg *sandbox) SetSpawnFlagsDepGroups() argument 1161 SetPackageNameDepGroups(const SandboxContext *context, AppSpawnSandboxCfg *sandbox) SetPackageNameDepGroups() argument 1181 SetPermissionDepGroups(const SandboxContext *context, AppSpawnSandboxCfg *sandbox) SetPermissionDepGroups() argument 1212 StagedDepGroupMounts(const SandboxContext *context, AppSpawnSandboxCfg *sandbox) StagedDepGroupMounts() argument 1232 StagedMountPreUnShare(const SandboxContext *context, AppSpawnSandboxCfg *sandbox) StagedMountPreUnShare() argument 1243 SetAppVariableConfig(const SandboxContext *context, const AppSpawnSandboxCfg *sandbox) SetAppVariableConfig() argument 1272 StagedMountPostUnshare(const SandboxContext *context, const AppSpawnSandboxCfg *sandbox) StagedMountPostUnshare() argument 1310 MountSandboxConfigs(AppSpawnSandboxCfg *sandbox, const AppSpawningCtx *property, int nwebspawn) MountSandboxConfigs() argument [all...] |
H A D | appspawn_sandbox.h | 31 #define SANDBOX_NWEBSPAWN_ROOT_PATH APPSPAWN_BASE_DIR "/mnt/sandbox/com.ohos.render/" 37 #define DEFAULT_NWEB_SANDBOX_SEC_PATH "/data/app/el1/bundle/public/com.ohos.nweb" // persist.nweb.sandbox.src_path 149 uint32_t sandboxSwitch : 1; // "sandbox-switch": "ON", 150 uint32_t sandboxShared : 1; // "sandbox-switch": "ON", 186 uint32_t sandboxNsFlags; // "sandbox-ns-flags": [ "pid", "net" ], // for appspawn and newspawn 188 uint32_t topSandboxSwitch : 1; // "top-sandbox-switch": "ON", 234 void DeleteAppSpawnSandbox(AppSpawnSandboxCfg *sandbox); 235 int LoadAppSandboxConfig(AppSpawnSandboxCfg *sandbox, RunMode mode); 236 void DumpAppSpawnSandboxCfg(AppSpawnSandboxCfg *sandbox); 263 * @brief sandbox moun [all...] |
/base/startup/init/test/unittest/init/ |
H A D | sandbox_unittest.cpp | 20 #include "sandbox.h" 35 const char *SANDBOX_JSON_NAME = "test-sandbox.json"; 37 const char *SANDBOX_CONFIG[] = {"sandbox-root", "mount-bind-paths", "mount-bind-files", "symbol-links"}; 38 const char *SANDBOX_ROOT[] = { "/mnt/sandbox/test", "/mnt/sandbox/chipset", "/mnt/error"}; 40 const char *MOUNT_BIND_PATHS[] = {"src-path", "sandbox-path", "sandbox-flags"}; 45 int RestartSandbox(const char *sandbox) in RestartSandbox() argument 47 if (sandbox == nullptr) { in RestartSandbox() 53 if (!InitSandboxWithName(sandbox)) { in RestartSandbox() [all...] |
/base/startup/appspawn/test/mock/ |
H A D | app_spawn_stub.h | 79 int ParseMountPathsConfig(AppSpawnSandboxCfg *sandbox,
81 int ParseSymbolLinksConfig(AppSpawnSandboxCfg *sandbox, const cJSON *symbolLinkConfigs,
83 int ParseGidTableConfig(AppSpawnSandboxCfg *sandbox, const cJSON *configs, SandboxSection *section);
89 int ParseAppSandboxConfig(const cJSON *appSandboxConfig, AppSpawnSandboxCfg *sandbox);
|
/base/startup/init/services/init/standard/ |
H A D | init_cmds.c | 42 #include "sandbox.h"
557 INIT_LOGV("Do make sandbox start");
in DoMkSandbox() 558 const char *sandbox = ctx->argv[0];
in DoMkSandbox() local 560 if (!InitSandboxWithName(sandbox)) {
in DoMkSandbox() 561 INIT_LOGE("Failed to init sandbox with name %s.", sandbox);
in DoMkSandbox() 564 if (PrepareSandbox(sandbox) != 0) {
in DoMkSandbox() 565 INIT_LOGE("Failed to prepare sandbox %s.", sandbox);
in DoMkSandbox() 566 DestroySandbox(sandbox);
in DoMkSandbox() [all...] |
/base/hiviewdfx/hiview/adapter/plugins/eventservice/service/test/unittest/common/ |
H A D | data_share_test.cpp | 150 std::string sandbox = DataShareUtil::GetSandBoxPathByUid(uid); in HWTEST_F() local
|