提交 bb2b2922 编写于 作者: M Mupceet

Merge branch 'master' of gitee.com:openharmony/startup_init_lite into init526_1

Signed-off-by: NMupceet <laiguizhong@huawei.com>
......@@ -20,6 +20,9 @@ config("exported_header_files") {
}
ohos_shared_library("libsandbox") {
if (target_cpu == "arm64") {
defines = [ "SUPPORT_64BIT" ]
}
sources = [
"sandbox.c",
"sandbox_namespace.c",
......
{
"sandbox-root" : "/mnt/sandbox/app",
"mount-bind-paths" : [{
"src-path" : "/mnt",
"sandbox-path" : "/mnt",
"sandbox-flags" : [ "bind", "rec", "private" ]
}, {
"src-path" : "/system/bin",
"sandbox-path" : "/system/bin",
"sandbox-flags" : [ "bind", "rec", "private" ]
}, {
"src-path" : "/system/lib",
"sandbox-path" : "/system/lib",
"sandbox-flags" : [ "bind", "rec", "private" ]
}, {
"src-path" : "/system/lib/module",
"sandbox-path" : "/system/lib/module",
"sandbox-flags" : [ "bind", "rec", "private" ]
}, {
"src-path" : "/system/etc",
"sandbox-path" : "/system/etc",
"sandbox-flags" : [ "bind", "rec", "private" ]
}, {
"src-path" : "/sys/kernel/debug/tracing",
"sandbox-path" : "/sys/kernel/debug/tracing",
"sandbox-flags" : [ "bind", "private" ]
}, {
"src-path" : "/sys/kernel/debug",
"sandbox-path" : "/sys/kernel/debug",
"sandbox-flags" : [ "bind", "private" ]
}, {
"src-path" : "/sys",
"sandbox-path" : "/sys",
"sandbox-flags" : [ "bind", "private" ]
}, {
"src-path" : "/proc",
"sandbox-path" : "/proc",
"sandbox-flags" : [ "bind", "rec" ]
}, {
"src-path" : "/dev",
"sandbox-path" : "/dev",
"sandbox-flags" : [ "bind", "rec", "private" ]
}, {
"src-path" : "/data",
"sandbox-path" : "/data",
"sandbox-flags" : [ "bind", "rec", "private" ]
}, {
"src-path" : "/system/fonts",
"sandbox-path" : "/system/fonts",
"sandbox-flags" : [ "bind", "rec", "private" ]
}, {
"src-path" : "/config",
"sandbox-path" : "/config",
"sandbox-flags" : [ "bind", "rec" ]
}, {
"src-path" : "/sys_prod",
"sandbox-path" : "/sys_prod",
"sandbox-flags" : [ "bind", "rec" ]
}, {
"src-path" : "/storage",
"sandbox-path" : "/storage",
"sandbox-flags" : [ "bind", "rec", "private" ]
}
],
"mount-bind-files" : [{
}],
"symbol-links" : [{
"target-name" : "/system/bin",
"link-name" : "/bin"
}, {
"target-name" : "/system/lib",
"link-name" : "/lib"
}, {
"target-name" : "/system/etc",
"link-name" : "/etc"
}
]
}
{
"sandbox-root" : "/mnt/sandbox/app",
"mount-bind-paths" : [{
"src-path" : "/mnt",
"sandbox-path" : "/mnt",
"sandbox-flags" : [ "bind", "rec", "private" ]
}, {
"src-path" : "/system/bin",
"sandbox-path" : "/system/bin",
"sandbox-flags" : [ "bind", "rec", "private" ]
}, {
"src-path" : "/system/lib64",
"sandbox-path" : "/system/lib64",
"sandbox-flags" : [ "bind", "rec", "private" ]
}, {
"src-path" : "/system/lib64/module",
"sandbox-path" : "/system/lib64/module",
"sandbox-flags" : [ "bind", "rec", "private" ]
}, {
"src-path" : "/system/etc",
"sandbox-path" : "/system/etc",
"sandbox-flags" : [ "bind", "rec", "private" ]
}, {
"src-path" : "/sys/kernel/debug/tracing",
"sandbox-path" : "/sys/kernel/debug/tracing",
"sandbox-flags" : [ "bind", "private" ]
}, {
"src-path" : "/sys/kernel/debug",
"sandbox-path" : "/sys/kernel/debug",
"sandbox-flags" : [ "bind", "private" ]
}, {
"src-path" : "/sys",
"sandbox-path" : "/sys",
"sandbox-flags" : [ "bind", "private" ]
}, {
"src-path" : "/proc",
"sandbox-path" : "/proc",
"sandbox-flags" : [ "bind", "rec" ]
}, {
"src-path" : "/dev",
"sandbox-path" : "/dev",
"sandbox-flags" : [ "bind", "rec", "private" ]
}, {
"src-path" : "/data",
"sandbox-path" : "/data",
"sandbox-flags" : [ "bind", "rec", "private" ]
}, {
"src-path" : "/system/fonts",
"sandbox-path" : "/system/fonts",
"sandbox-flags" : [ "bind", "rec", "private" ]
}, {
"src-path" : "/config",
"sandbox-path" : "/config",
"sandbox-flags" : [ "bind", "rec" ]
}, {
"src-path" : "/sys_prod",
"sandbox-path" : "/sys_prod",
"sandbox-flags" : [ "bind", "rec" ]
}, {
"src-path" : "/storage",
"sandbox-path" : "/storage",
"sandbox-flags" : [ "bind", "rec", "private" ]
}
],
"mount-bind-files" : [{
}],
"symbol-links" : [{
"target-name" : "/system/bin",
"link-name" : "/bin"
}, {
"target-name" : "/system/lib64",
"link-name" : "/lib64"
}, {
"target-name" : "/system/etc",
"link-name" : "/etc"
}
]
}
......@@ -33,4 +33,5 @@ void CloseDefaultNamespace(void);
}
#endif
#endif
#endif
\ No newline at end of file
#endif
{
"sandbox-root" : "/mnt/sandbox/priv-app",
"mount-bind-paths" : [{
"src-path" : "/mnt",
"sandbox-path" : "/mnt",
"sandbox-flags" : [ "bind", "rec" ]
}, {
"src-path" : "/system/bin",
"sandbox-path" : "/system/bin",
"sandbox-flags" : [ "bind", "rec" ]
}, {
"src-path" : "/system/bin",
"sandbox-path" : "/system/common/bin",
"sandbox-flags" : [ "bind", "rec" ]
}, {
"src-path" : "/system/lib",
"sandbox-path" : "/system/lib",
"sandbox-flags" : [ "bind", "rec" ]
}, {
"src-path" : "/system/lib/module",
"sandbox-path" : "/system/lib/module",
"sandbox-flags" : [ "bind", "rec" ]
}, {
"src-path" : "/system/etc",
"sandbox-path" : "/system/etc",
"sandbox-flags" : [ "bind", "rec" ]
}, {
"src-path" : "/sys/kernel/debug/tracing",
"sandbox-path" : "/sys/kernel/debug/tracing",
"sandbox-flags" : [ "bind", "private" ]
}, {
"src-path" : "/sys/kernel/debug",
"sandbox-path" : "/sys/kernel/debug",
"sandbox-flags" : [ "bind", "private" ]
}, {
"src-path" : "/sys",
"sandbox-path" : "/sys",
"sandbox-flags" : [ "bind", "private" ]
}, {
"src-path" : "/proc",
"sandbox-path" : "/proc",
"sandbox-flags" : [ "bind", "rec" ]
}, {
"src-path" : "/dev",
"sandbox-path" : "/dev",
"sandbox-flags" : [ "bind", "rec" ]
}, {
"src-path" : "/data",
"sandbox-path" : "/data",
"sandbox-flags" : [ "bind", "rec" ]
}, {
"src-path" : "/system/fonts",
"sandbox-path" : "/system/fonts",
"sandbox-flags" : [ "bind", "rec", "private" ]
}, {
"src-path" : "/config",
"sandbox-path" : "/config",
"sandbox-flags" : [ "bind", "rec" ]
}, {
"src-path" : "/sys_prod",
"sandbox-path" : "/sys_prod",
"sandbox-flags" : [ "bind", "rec" ]
}, {
"src-path" : "/storage",
"sandbox-path" : "/storage",
"sandbox-flags" : [ "bind", "rec", "private" ]
}
],
"mount-bind-files": [{
}],
"symbol-links": [{
"target-name" : "/system/bin",
"link-name" : "/bin"
}, {
"target-name" : "/system/lib",
"link-name" : "/lib"
}, {
"target-name" : "/system/etc",
"link-name" : "/etc"
}
]
}
{
"sandbox-root" : "/mnt/sandbox/priv-app",
"mount-bind-paths" : [{
"src-path" : "/mnt",
"sandbox-path" : "/mnt",
"sandbox-flags" : [ "bind", "rec" ]
}, {
"src-path" : "/system/bin",
"sandbox-path" : "/system/bin",
"sandbox-flags" : [ "bind", "rec" ]
}, {
"src-path" : "/system/bin",
"sandbox-path" : "/system/common/bin",
"sandbox-flags" : [ "bind", "rec" ]
}, {
"src-path" : "/system/lib64",
"sandbox-path" : "/system/lib64",
"sandbox-flags" : [ "bind", "rec" ]
}, {
"src-path" : "/system/lib64/module",
"sandbox-path" : "/system/lib64/module",
"sandbox-flags" : [ "bind", "rec" ]
}, {
"src-path" : "/system/etc",
"sandbox-path" : "/system/etc",
"sandbox-flags" : [ "bind", "rec" ]
}, {
"src-path" : "/sys/kernel/debug/tracing",
"sandbox-path" : "/sys/kernel/debug/tracing",
"sandbox-flags" : [ "bind", "private" ]
}, {
"src-path" : "/sys/kernel/debug",
"sandbox-path" : "/sys/kernel/debug",
"sandbox-flags" : [ "bind", "private" ]
}, {
"src-path" : "/sys",
"sandbox-path" : "/sys",
"sandbox-flags" : [ "bind", "private" ]
}, {
"src-path" : "/proc",
"sandbox-path" : "/proc",
"sandbox-flags" : [ "bind", "rec" ]
}, {
"src-path" : "/dev",
"sandbox-path" : "/dev",
"sandbox-flags" : [ "bind", "rec" ]
}, {
"src-path" : "/data",
"sandbox-path" : "/data",
"sandbox-flags" : [ "bind", "rec" ]
},{
"src-path" : "/storage",
"sandbox-path" : "/storage",
"sandbox-flags" : [ "bind", "rec", "private" ]
}, {
"src-path" : "/system/fonts",
"sandbox-path" : "/system/fonts",
"sandbox-flags" : [ "bind", "rec", "private" ]
}
],
"mount-bind-files": [{
}],
"symbol-links": [{
"target-name" : "/system/bin",
"link-name" : "/bin"
}, {
"target-name" : "/system/lib64",
"link-name" : "/lib64"
}, {
"target-name" : "/system/etc",
"link-name" : "/etc"
}
]
}
......@@ -38,10 +38,13 @@
#define SANDBOX_SYMLINK_TARGET "target-name"
#define SANDBOX_SYMLINK_NAME "link-name"
#ifndef SUPPORT_64BIT
#define SANDBOX_SYSTEM_CONFIG_FILE "/system/etc/sandbox/system-sandbox.json"
#define SANDBOX_CHIPSET_CONFIG_FILE "/system/etc/sandbox/chipset-sandbox.json"
#define SANDBOX_PRIVAPP_CONFIG_FILE "/system/etc/sandbox/privapp-sandbox.json"
#define SANDBOX_APP_CONFIG_FILE "/system/etc/sandbox/app-sandbox.json"
#else
#define SANDBOX_SYSTEM_CONFIG_FILE "/system/etc/sandbox/system-sandbox64.json"
#define SANDBOX_CHIPSET_CONFIG_FILE "/system/etc/sandbox/chipset-sandbox64.json"
#endif
#define SANDBOX_MOUNT_FLAGS_MS_BIND "bind"
#define SANDBOX_MOUNT_FLAGS_MS_PRIVATE "private"
......@@ -72,11 +75,8 @@ static const struct SandboxMountFlags g_flags[] = {
}
};
static sandbox_t g_systemSandbox;
static sandbox_t g_chipsetSandbox;
static sandbox_t g_privAppSandbox;
static sandbox_t g_appSandbox;
struct SandboxMap {
const char *name;
......@@ -94,16 +94,6 @@ static const struct SandboxMap g_map[] = {
.name = "chipset",
.sandbox = &g_chipsetSandbox,
.configfile = SANDBOX_CHIPSET_CONFIG_FILE,
},
{
.name = "priv-app",
.sandbox = &g_privAppSandbox,
.configfile = SANDBOX_PRIVAPP_CONFIG_FILE,
},
{
.name = "app",
.sandbox = &g_appSandbox,
.configfile = SANDBOX_APP_CONFIG_FILE,
}
};
......
......@@ -12,6 +12,10 @@
"src-path" : "/system/lib64",
"sandbox-path" : "/system/lib64",
"sandbox-flags" : [ "bind", "rec", "private" ]
}, {
"src-path" : "/system/lib",
"sandbox-path" : "/system/lib",
"sandbox-flags" : [ "bind", "rec", "private" ]
}, {
"src-path" : "/system/profile",
"sandbox-path" : "/system/profile",
......@@ -79,6 +83,9 @@
"symbol-links" : [{
"target-name" : "/system/lib64",
"link-name" : "/lib64"
}, {
"target-name" : "/system/lib",
"link-name" : "/lib"
}, {
"target-name" : "/system/bin",
"link-name" : "/bin"
......
......@@ -132,7 +132,6 @@ typedef struct cmdLineInfo {
#endif
char *GetServiceCtrlName(const char *name, const char *value);
void CheckAndCreateDir(const char *fileName);
int SpliteString(char *line, const char *exclude[], uint32_t count,
int (*result)(const uint32_t *context, const char *name, const char *value), const uint32_t *context);
#ifdef __cplusplus
......
......@@ -28,25 +28,6 @@
#include "init_utils.h"
void CheckAndCreateDir(const char *fileName)
{
#ifndef __LITEOS_M__
if (fileName == NULL || *fileName == '\0') {
return;
}
char *path = strndup(fileName, strrchr(fileName, '/') - fileName);
if (path == NULL) {
return;
}
if (access(path, F_OK) == 0) {
free(path);
return;
}
MakeDirRecursive(path, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
free(path);
#endif
}
int SpliteString(char *line, const char *exclude[], uint32_t count,
int (*result)(const uint32_t *context, const char *name, const char *value), const uint32_t *context)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册