appspawn支持加载overlay应用到沙箱

Signed-off-by: huaqingsimeng <qiukaiqing@huawei.com>
This commit is contained in:
huaqingsimeng 2023-06-13 10:43:11 +08:00
parent a5b242cf24
commit 2358dc1775
9 changed files with 272 additions and 40 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -74,6 +74,11 @@ int32_t SetAppSandboxProperty(struct AppSpawnContent_ *content, AppSpawnClient *
free(clientExt->property.hspList.data);
clientExt->property.hspList = {};
}
// free OverlayInfo
if (clientExt->property.overlayInfo.data != nullptr) {
free(clientExt->property.overlayInfo.data);
clientExt->property.overlayInfo = {};
}
// for module test do not create sandbox
if (strncmp(clientExt->property.bundleName,
MODULE_TEST_BUNDLE_NAME.c_str(), MODULE_TEST_BUNDLE_NAME.size()) == 0) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -69,6 +69,7 @@ typedef enum AppOperateType_ {
#define APP_ACCESS_BUNDLE_DIR 0x20
#define APP_NATIVEDEBUG 0X40
#define APP_NO_SANDBOX 0x80 // Do not enter sandbox
#define APP_OVERLAY 0x100
#define BITLEN32 32
#define FDLEN2 2
@ -80,6 +81,11 @@ typedef struct HspList_ {
char* data;
} HspList;
typedef struct OverlayInfo_ {
uint32_t totalLength;
char* data;
} OverlayInfo;
typedef struct AppParameter_ {
AppOperateType code;
uint32_t flags;
@ -104,6 +110,7 @@ typedef struct AppParameter_ {
uint8_t reserved2;
#endif
HspList hspList; // list of cross-app hsp (Harmony Shared Package) to mount onto app sandbox
OverlayInfo overlayInfo; // overlay info
} AppParameter;
#ifdef __cplusplus

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -371,7 +371,7 @@ static int32_t WaitForDebugger(AppSpawnClient *client)
return 0;
}
static void Free(char **argv, HspList *hspList)
static void Free(char **argv, HspList *hspList, OverlayInfo *overlayInfo)
{
argv[0] = NULL;
for (int i = 0; i < NULL_INDEX; i++) {
@ -387,6 +387,11 @@ static void Free(char **argv, HspList *hspList)
hspList->savedLength = 0;
hspList->data = NULL;
}
if (overlayInfo != NULL) {
overlayInfo->totalLength = 0;
overlayInfo->data = NULL;
}
}
#ifdef ASAN_DETECTOR
@ -471,6 +476,15 @@ static int ColdStartApp(struct AppSpawnContent_ *content, AppSpawnClient *client
APPSPAWN_CHECK(len > 0 && len < (int)sizeof(buffer), break, "Invalid hspList.totalLength");
argv[HSP_LIST_LEN_INDEX] = strdup(buffer);
argv[HSP_LIST_INDEX] = appProperty->hspList.data;
if (appProperty->hspList.totalLength == 0) {
argv[HSP_LIST_INDEX] = strdup("0");
} else {
argv[HSP_LIST_INDEX] = appProperty->hspList.data;
}
len = sprintf_s(buffer, sizeof(buffer), "%u", appProperty->overlayInfo.totalLength);
APPSPAWN_CHECK(len > 0 && len < (int)sizeof(buffer), break, "Invalid overlayInfo.totalLength");
argv[OVERLAY_LEN_INDEX] = strdup(buffer);
argv[OVERLAY_INDEX] = appProperty->overlayInfo.data;
ret = 0;
} while (0);
@ -486,7 +500,7 @@ static int ColdStartApp(struct AppSpawnContent_ *content, AppSpawnClient *client
}
}
argv[0] = NULL;
Free(argv, &appProperty->hspList);
Free(argv, &appProperty->hspList, &appProperty->overlayInfo);
return ret;
}
@ -565,12 +579,28 @@ int GetAppSpawnClientFromArg(int argc, char *const argv[], AppSpawnClientExt *cl
ret = -1;
if (argc > HSP_LIST_LEN_INDEX && argv[HSP_LIST_LEN_INDEX] != NULL) {
client->property.hspList.totalLength = atoi(argv[HSP_LIST_LEN_INDEX]);
APPSPAWN_CHECK_ONLY_EXPER(client->property.hspList.totalLength != 0, return 0);
APPSPAWN_CHECK(argc > HSP_LIST_INDEX && argv[HSP_LIST_INDEX] != NULL, return -1, "Invalid hspList.data");
client->property.hspList.data = malloc(client->property.hspList.totalLength);
APPSPAWN_CHECK(client->property.hspList.data != NULL, return -1, "Failed to malloc hspList.data");
ret = strcpy_s(client->property.hspList.data, client->property.hspList.totalLength, argv[HSP_LIST_INDEX]);
APPSPAWN_CHECK(ret == 0, return -1, "Failed to strcpy hspList.data");
if (client->property.hspList.totalLength) {
APPSPAWN_CHECK_ONLY_EXPER(client->property.hspList.totalLength != 0, return 0);
APPSPAWN_CHECK(argc > HSP_LIST_INDEX && argv[HSP_LIST_INDEX] != NULL, return -1, "Invalid hspList.data");
client->property.hspList.data = malloc(client->property.hspList.totalLength);
APPSPAWN_CHECK(client->property.hspList.data != NULL, return -1, "Failed to malloc hspList.data");
ret = strcpy_s(client->property.hspList.data, client->property.hspList.totalLength, argv[HSP_LIST_INDEX]);
APPSPAWN_CHECK(ret == 0, return -1, "Failed to strcpy hspList.data");
}
}
client->property.overlayInfo.totalLength = 0;
client->property.overlayInfo.data = NULL;
ret = 0;
if (argc > OVERLAY_LEN_INDEX && argv[OVERLAY_LEN_INDEX] != NULL) {
client->property.overlayInfo.totalLength = atoi(argv[OVERLAY_LEN_INDEX]);
APPSPAWN_CHECK_ONLY_EXPER(client->property.overlayInfo.totalLength != 0, return 0);
APPSPAWN_CHECK(argc > OVERLAY_INDEX && argv[OVERLAY_INDEX] != NULL, return -1, "Invalid overlayInfo.data");
client->property.overlayInfo.data = malloc(client->property.overlayInfo.totalLength);
APPSPAWN_CHECK(client->property.overlayInfo.data != NULL, return -1, "Failed to malloc overlayInfo.data");
ret = strcpy_s(client->property.overlayInfo.data,
client->property.overlayInfo.totalLength,
argv[OVERLAY_INDEX]);
APPSPAWN_CHECK(ret == 0, return -1, "Failed to strcpy overlayInfo.data");
}
return ret;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -144,6 +144,11 @@ static void OnClose(const TaskHandle taskHandle)
client->property.hspList.savedLength = 0;
client->property.hspList.data = NULL;
}
if (client->property.overlayInfo.data != NULL) {
free(client->property.overlayInfo.data);
client->property.overlayInfo.totalLength = 0;
client->property.overlayInfo.data = NULL;
}
}
static void SendMessageComplete(const TaskHandle taskHandle, BufferHandle handle)
@ -308,7 +313,7 @@ APPSPAWN_STATIC bool ReceiveRequestData(const TaskHandle taskHandle, AppSpawnCli
}
// 2. check whether hspList exist
if (client->property.hspList.totalLength == 0) { // no hspList
if (client->property.hspList.totalLength == 0 && client->property.overlayInfo.totalLength == 0) { // no hspList
APPSPAWN_LOGV("ReceiveRequestData: no hspList");
return true;
} else if (buffLen == 0) {
@ -317,32 +322,53 @@ APPSPAWN_STATIC bool ReceiveRequestData(const TaskHandle taskHandle, AppSpawnCli
}
// 3. save HspList
HspList *hspList = &client->property.hspList;
if (hspList->savedLength == 0) {
hspList->data = (char *)malloc(hspList->totalLength);
APPSPAWN_CHECK(hspList->data != NULL, LE_CloseTask(LE_GetDefaultLoop(), taskHandle);
return false, "ReceiveRequestData: malloc hspList failed %{public}u", hspList->totalLength);
if (client->property.hspList.totalLength) {
HspList *hspList = &client->property.hspList;
if (hspList->savedLength == 0) {
hspList->data = (char *)malloc(hspList->totalLength);
APPSPAWN_CHECK(hspList->data != NULL, LE_CloseTask(LE_GetDefaultLoop(), taskHandle);
return false, "ReceiveRequestData: malloc hspList failed %{public}u", hspList->totalLength);
}
uint32_t saved = hspList->savedLength;
uint32_t total = hspList->totalLength;
char *data = hspList->data;
uint32_t overlayTotal = client->property.overlayInfo.totalLength;
APPSPAWN_LOGV("Receiving hspList: (%{public}u saved + %{public}u incoming) / %{public}u total",
saved, buffLen, total);
APPSPAWN_CHECK((total - saved) >= (buffLen - overlayTotal), LE_CloseTask(LE_GetDefaultLoop(), taskHandle);
return false, "ReceiveRequestData: too many data for hspList %{public}u ", buffLen);
int ret = memcpy_s(data + saved, (buffLen - overlayTotal), buffer, (buffLen - overlayTotal));
APPSPAWN_CHECK(ret == 0, LE_CloseTask(LE_GetDefaultLoop(), taskHandle);
return false, "ReceiveRequestData: memcpy hspList failed");
hspList->savedLength += (buffLen - overlayTotal);
if (hspList->savedLength < hspList->totalLength) {
return false;
}
hspList->data[hspList->totalLength - 1] = 0;
buffer += hspList->totalLength;
buffLen -= hspList->totalLength;
}
uint32_t saved = hspList->savedLength;
uint32_t total = hspList->totalLength;
char *data = hspList->data;
APPSPAWN_LOGV("Receiving hspList: (%{public}u saved + %{public}u incoming) / %{public}u total",
saved, buffLen, total);
if (client->property.overlayInfo.totalLength) {
OverlayInfo *overlayInfo = &client->property.overlayInfo;
overlayInfo->data = (char *)malloc(overlayInfo->totalLength);
APPSPAWN_CHECK(overlayInfo->data != NULL, LE_CloseTask(LE_GetDefaultLoop(), taskHandle);
return false, "ReceiveRequestData: malloc overlay failed %{public}u", overlayInfo->totalLength);
char *data = overlayInfo->data;
APPSPAWN_CHECK((total - saved) >= buffLen, LE_CloseTask(LE_GetDefaultLoop(), taskHandle);
return false, "ReceiveRequestData: too many data for hspList %{public}u ", buffLen);
APPSPAWN_CHECK(overlayInfo->totalLength >= buffLen, LE_CloseTask(LE_GetDefaultLoop(), taskHandle);
return false, "ReceiveRequestData: too many data for overlay %{public}u ", buffLen);
int ret = memcpy_s(data + saved, buffLen, buffer, buffLen);
APPSPAWN_CHECK(ret == 0, LE_CloseTask(LE_GetDefaultLoop(), taskHandle);
return false, "ReceiveRequestData: memcpy hspList failed");
hspList->savedLength += buffLen;
if (hspList->savedLength < hspList->totalLength) {
return false;
int ret = memcpy_s(data, buffLen, buffer, buffLen);
APPSPAWN_CHECK(ret == 0, LE_CloseTask(LE_GetDefaultLoop(), taskHandle);
return false, "ReceiveRequestData: memcpy overlay failed");
overlayInfo->data[overlayInfo->totalLength - 1] = 0;
}
hspList->data[hspList->totalLength - 1] = 0;
return true;
}
@ -450,6 +476,8 @@ APPSPAWN_STATIC TaskHandle AcceptClient(const LoopHandle loopHandle, const TaskH
client->property.hspList.totalLength = 0;
client->property.hspList.savedLength = 0;
client->property.hspList.data = NULL;
client->property.overlayInfo.totalLength = 0;
client->property.overlayInfo.data = NULL;
APPSPAWN_LOGI("OnConnection client fd %{public}d Id %{public}d", LE_GetSocketFd(stream), client->client.id);
return stream;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Copyright (c) 2021-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -43,7 +43,9 @@ extern "C" {
#define PARAM_INDEX 3
#define HSP_LIST_LEN_INDEX 4
#define HSP_LIST_INDEX 5
#define NULL_INDEX 6
#define OVERLAY_LEN_INDEX 6
#define OVERLAY_INDEX 7
#define NULL_INDEX 8
#define PARAM_BUFFER_LEN 128
typedef struct {
AppSpawnClient client;

View File

@ -1359,4 +1359,55 @@ HWTEST(AppSpawnSandboxTest, App_Spawn_Sandbox_38, TestSize.Level0)
EXPECT_EQ(0, ret);
APPSPAWN_LOGI("App_Spawn_Sandbox_38 end");
}
/**
* @tc.name: App_Spawn_Sandbox_39
* @tc.desc: load overlay config SetAppSandboxProperty by App com.ohos.demo.
* @tc.type: FUNC
* @tc.require:issueI7D0H9
* @tc.author:
*/
HWTEST(AppSpawnSandboxTest, App_Spawn_Sandbox_39, TestSize.Level0)
{
APPSPAWN_LOGI("App_Spawn_Sandbox_39 start");
ClientSocket::AppProperty *m_appProperty = GetAppProperty();
m_appProperty->uid = 1000;
m_appProperty->gid = 1000;
m_appProperty->gidCount = 1;
m_appProperty->flags |= 0x100;
m_appProperty->overlayInfo.totalLength = 55;
string overlayInfo = "/data/app/el1/bundle/public/com.ohos.demo/feature.hsp|/data/app/el1/bundle/public/com.ohos.demo/feature.hsp|";
m_appProperty->overlayInfo.data = new char[overlayInfo.length() + 1];
if (strcpy_s(m_appProperty->overlayInfo.data, overlayInfo.length() + 1, overlayInfo.c_str()) != 0) {
GTEST_LOG_(INFO) << "SetAppSandboxProperty start 1" << std::endl;
}
std::string sandBoxRootDir = "/mnt/sandbox/com.ohos.demo";
if (strcpy_s(m_appProperty->processName, APP_LEN_PROC_NAME, "com.ohos.demo") != 0) {
GTEST_LOG_(INFO) << "SetAppSandboxProperty start 2" << std::endl;
}
if (strcpy_s(m_appProperty->bundleName, APP_LEN_BUNDLE_NAME, "com.ohos.demo") != 0) {
GTEST_LOG_(INFO) << "SetAppSandboxProperty start 3" << std::endl;
}
if (strcpy_s(m_appProperty->apl, APP_APL_MAX_LEN, "normal") != 0) {
GTEST_LOG_(INFO) << "SetAppSandboxProperty start 4" << std::endl;
}
GTEST_LOG_(INFO) << "SetAppSandboxProperty section 2" << std::endl;
m_appProperty->accessTokenId = 671201800; // 671201800 is accessTokenId
m_appProperty->pid = 354; // query render process exited status by render process pid
int32_t ret = OHOS::AppSpawn::SandboxUtils::SetOverlayAppSandboxProperty(m_appProperty, sandBoxRootDir);
EXPECT_EQ(0, ret);
m_appProperty->flags &= ~0x100;
m_appProperty->overlayInfo.totalLength = 0;
if (m_appProperty->overlayInfo.data != nullptr) {
delete [] m_appProperty->overlayInfo.data;
}
m_appProperty->overlayInfo = {};
GTEST_LOG_(INFO) << "App_Spawn_Sandbox_39 end";
}
} // namespace OHOS

View File

@ -307,7 +307,7 @@ HWTEST(AppSpawnStandardTest, App_Spawn_Standard_003_1, TestSize.Level0)
char arg6[] = "0123456789";
char* argv[] = {arg1, arg2, arg3, arg4, nullptr, arg6};
int argc = sizeof(argv)/sizeof(argv[0]);
EXPECT_EQ(-1, GetAppSpawnClientFromArg(argc, argv, &client));
EXPECT_EQ(0, GetAppSpawnClientFromArg(argc, argv, &client));
}
{ // hsp length is non-zero, but argc is 5
char arg4[] = "1:1:1:1:1:1:1:1:1:2:1000:1000:ohos.samples:ohos.samples.ecg:"
@ -367,6 +367,58 @@ HWTEST(AppSpawnStandardTest, App_Spawn_Standard_003_2, TestSize.Level0)
APPSPAWN_LOGI("App_Spawn_Standard_003_2 end");
}
/**
* @tc.name: App_Spawn_Standard_003_3
* @tc.desc: Verify set Arg if GetAppSpawnClient succeed, with overlay
* @tc.type: FUNC
* @tc.require:issueI7D0H9
* @tc.author:
*/
HWTEST(AppSpawnStandardTest, App_Spawn_Standard_003_3, TestSize.Level0)
{
APPSPAWN_LOGI("App_Spawn_Standard_003_3 start");
AppSpawnClientExt client = {};
char arg1[] = "/system/bin/appspawn";
char arg2[] = "cold-start";
char arg3[] = "1";
char arg4[] = "1:1:1:1:1:1:1:1:1:2:1000:1000:ohos.samples:ohos.samples.ecg:"
"default:671201800:system_core:default:0:671201800";
char arg5[] = "0";
char arg6[] = "0";
{
char arg7[] = "10";
char arg8[] = "012345678";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8};
int argc = sizeof(argv)/sizeof(argv[0]);
EXPECT_EQ(0, GetAppSpawnClientFromArg(argc, argv, &client));
FreeHspList(client.property.hspList);
}
{ // overlay length is 0
char arg7[] = "0";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, nullptr};
int argc = sizeof(argv)/sizeof(argv[0]);
EXPECT_EQ(-1, GetAppSpawnClientFromArg(argc, argv, &client));
}
{ // overlay length is nullptr
char arg8[] = "0123456789";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, nullptr, arg8};
int argc = sizeof(argv)/sizeof(argv[0]);
EXPECT_EQ(-1, GetAppSpawnClientFromArg(argc, argv, &client));
}
{ // overlay length is non-zero, but argc is 5
char arg7[] = "10";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7};
int argc = sizeof(argv)/sizeof(argv[0]);
EXPECT_EQ(-1, GetAppSpawnClientFromArg(argc, argv, &client));
}
{ // overlay length is non-zero, but content is nullptr
char arg7[] = "10";
char* argv[] = {arg1, arg2, arg3, arg4, arg5, arg6, arg7, nullptr};
int argc = sizeof(argv)/sizeof(argv[0]);
EXPECT_EQ(-1, GetAppSpawnClientFromArg(argc, argv, &client));
}
APPSPAWN_LOGI("App_Spawn_Standard_003_3 en");
}
/**
* @tc.name: App_Spawn_Standard_004
* @tc.desc: App cold start.

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Copyright (C) 2022-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -75,7 +75,15 @@ private:
nlohmann::json &config);
static int32_t SetRenderSandboxProperty(const ClientSocket::AppProperty *appProperty,
std::string &sandboxPackagePath);
static int32_t SetOverlayAppSandboxProperty(const ClientSocket::AppProperty *appProperty,
std::string &sandboxPackagePath);
static int32_t DoSandboxFilePermissionBind(ClientSocket::AppProperty *appProperty,
nlohmann::json &wholeConfig);
static int32_t SetPermissionAppSandboxProperty_(ClientSocket::AppProperty *appProperty,
nlohmann::json &config);
static int32_t SetPermissionAppSandboxProperty(ClientSocket::AppProperty *appProperty);
static int32_t DoAddGid(ClientSocket::AppProperty *appProperty,
nlohmann::json &appConfig, const char* permissionName, const std::string &section);
private:
static nlohmann::json appNamespaceConfig_;
static std::vector<nlohmann::json> appSandboxConfig_;

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Copyright (C) 2022-2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@ -15,8 +15,11 @@
#include "sandbox_utils.h"
#include <algorithm>
#include <fcntl.h>
#include <set>
#include <unistd.h>
#include <vector>
#include <sys/mount.h>
#include <sys/stat.h>
@ -65,6 +68,7 @@ namespace {
const std::string g_hspList_key_bundles = "bundles";
const std::string g_hspList_key_modules = "modules";
const std::string g_hspList_key_versions = "versions";
const std::string g_overlayPath = "/data/storage/ovl/";
const char *g_actionStatuc = "check-action-status";
const char *g_accountPrefix = "/account/data/";
const char *g_accountNonPrefix = "/non_account/data/";
@ -93,6 +97,7 @@ namespace {
const char *g_flags = "flags";
const char *g_sandBoxNameSpace = "sandbox-namespace";
const char *g_sandBoxCloneFlags = "clone-flags";
const char* g_fileSeparator = "/";
#ifndef NWEB_SPAWN
const std::string g_sandBoxRootDir = "/mnt/sandbox/";
#else
@ -921,6 +926,46 @@ static int CheckBundleName(const std::string &bundleName)
return 0;
}
int32_t SandboxUtils::SetOverlayAppSandboxProperty(const ClientSocket::AppProperty *appProperty,
string &sandboxPackagePath)
{
int ret = 0;
if ((appProperty->flags & APP_OVERLAY) != APP_OVERLAY) {
return ret;
}
if (appProperty->overlayInfo.totalLength == 0 || appProperty->overlayInfo.data == nullptr) {
return ret;
}
string overlayInfo = string(appProperty->overlayInfo.data, appProperty->overlayInfo.totalLength);
set<string> mountedSrcSet;
vector<string> splits = split(overlayInfo, "|");
string sandboxOverlayPath = sandboxPackagePath + g_overlayPath;
for (auto hapPath : splits) {
int32_t pathIndex = hapPath.find_last_of(g_fileSeparator);
if (pathIndex < 0) {
continue;
}
std::string srcPath = hapPath.substr(0, pathIndex);
if (!mountedSrcSet.empty() && mountedSrcSet.find(srcPath) != mountedSrcSet.end()) {
APPSPAWN_LOGI("%{public}s have mounted before, no need to mount twice.", srcPath.c_str());
continue;
}
int32_t bundleNameIndex = srcPath.find_last_of(g_fileSeparator);
string destPath = sandboxOverlayPath + srcPath.substr(bundleNameIndex + 1, srcPath.length());
int32_t retMount = DoAppSandboxMountOnce(srcPath.c_str(), destPath.c_str(),
nullptr, BASIC_MOUNT_FLAGS, nullptr);
if (retMount != 0) {
APPSPAWN_LOGE("fail to mount overlay path, src is %s.", hapPath.c_str());
ret = retMount;
}
mountedSrcSet.emplace(srcPath);
}
return ret;
}
int32_t SandboxUtils::SetAppSandboxProperty(AppSpawnClient *client)
{
APPSPAWN_CHECK(client != NULL, return -1, "Invalid appspwn client");
@ -969,6 +1014,10 @@ int32_t SandboxUtils::SetAppSandboxProperty(AppSpawnClient *client)
sandboxPackagePath.c_str());
#endif
rc = SetOverlayAppSandboxProperty(appProperty, sandboxPackagePath);
APPSPAWN_CHECK(rc == 0, return rc, "SetOverlayAppSandboxProperty failed, packagename is %s",
bundleName.c_str());
#ifndef APPSPAWN_TEST
rc = chdir(sandboxPackagePath.c_str());
APPSPAWN_CHECK(rc == 0, return rc, "chdir failed, packagename is %{public}s, path is %{public}s",