Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Musl
提交
e8ece904
T
Third Party Musl
项目概览
OpenHarmony
/
Third Party Musl
1 年多 前同步成功
通知
37
Star
125
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Musl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e8ece904
编写于
7月 12, 2022
作者:
W
wangjiahui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify namespace asan pathopen
Signed-off-by:
N
wangjiahui
<
wangjiahui27@huawei.com
>
上级
62ba4c30
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
18 addition
and
18 deletion
+18
-18
porting/linux/user/config/ld-musl-namespace-aarch64-test.ini
porting/linux/user/config/ld-musl-namespace-aarch64-test.ini
+2
-2
porting/linux/user/config/ld-musl-namespace-aarch64.ini
porting/linux/user/config/ld-musl-namespace-aarch64.ini
+2
-2
porting/linux/user/config/ld-musl-namespace-arm-test.ini
porting/linux/user/config/ld-musl-namespace-arm-test.ini
+2
-2
porting/linux/user/config/ld-musl-namespace-arm.ini
porting/linux/user/config/ld-musl-namespace-arm.ini
+2
-2
porting/linux/user/ldso/dynlink.c
porting/linux/user/ldso/dynlink.c
+10
-10
未找到文件。
porting/linux/user/config/ld-musl-namespace-aarch64-test.ini
浏览文件 @
e8ece904
...
...
@@ -3,8 +3,8 @@
test
=
/data/tests/libc-test/src/functionalext:/data/tests/libc-test/src/functionalext/dlns
[acquiescence]
namespace.default.lib.paths
=
/system/lib64:/vendor/lib64:/vendor/lib64/chipsetsdk:/system/lib64/ndk:/system/lib64/chipset-pub-sdk:/system/lib64/chipset-sdk:/system/lib64/platformsdk:/system/lib64/priv-platformsdk:/system/lib64/priv-module:/system/lib64/module:/system/lib64/module/data:/system/lib64/module/multimedia:/system/lib:/vendor/lib:/system/lib/ndk:/system/lib/chipset-pub-sdk:/system/lib/chipset-sdk:/system/lib/platformsdk:/system/lib/priv-platformsdk:/system/lib/priv-module:/system/lib/module:/system/lib/module/data:/system/lib/module/multimedia:/lib64:/lib:/usr/local/lib:/usr/lib
namespace.default.asan.lib.paths
=
/system/lib64:/system/lib64/module:/vendor/lib64:/vendor/lib64/chipsetsdk:/system/lib64/module/data:/system/lib64/module/multimedia:/system/lib:/system/lib/module:/system/lib/module/data:/system/lib/module/multimedia:/lib64:/lib:/usr/local/lib:/usr/lib
namespace.default.lib.paths
=
/system/lib64:/vendor/lib64:/vendor/lib64/chipsetsdk:/system/lib64/ndk:/system/lib64/chipset-pub-sdk:/system/lib64/chipset-sdk:/system/lib64/platformsdk:/system/lib64/priv-platformsdk:/system/lib64/priv-module:/system/lib64/module:/system/lib64/module/data:/system/lib64/module/multimedia:/system/lib:/vendor/lib:/system/lib/ndk:/system/lib/chipset-pub-sdk:/system/lib/chipset-sdk:/system/lib/platformsdk:/system/lib/priv-platformsdk:/system/lib/priv-module:/system/lib/module:/system/lib/module/data:/system/lib/module/multimedia:/lib64:/lib:/usr/local/lib:/usr/lib
:/data/lib:/data/lib64
namespace.default.asan.lib.paths
=
/system/lib64:/system/lib64/module:/vendor/lib64:/vendor/lib64/chipsetsdk:/system/lib64/module/data:/system/lib64/module/multimedia:/system/lib:/system/lib/module:/system/lib/module/data:/system/lib/module/multimedia:/lib64:/lib:/usr/local/lib:/usr/lib
:/data/lib:/data/lib64
[test]
added.nslist
=
ns_no_allowed_libs,ns_normal,ns_wrong_lib_path,ns_wrong_allowed_path,for_inherit_A,for_inherit_AA,inherited_class,ns_separated_flase,ns_asan_lib_path,ns_asan_permit_path
...
...
porting/linux/user/config/ld-musl-namespace-aarch64.ini
浏览文件 @
e8ece904
...
...
@@ -2,5 +2,5 @@
acquiescence
=
/
[acquiescence]
namespace.default.lib.paths
=
/system/lib64:/vendor/lib64:/vendor/lib64/chipsetsdk:/system/lib64/ndk:/system/lib64/chipset-pub-sdk:/system/lib64/chipset-sdk:/system/lib64/platformsdk:/system/lib64/priv-platformsdk:/system/lib64/priv-module:/system/lib64/module:/system/lib64/module/data:/system/lib64/module/multimedia:/system/lib:/vendor/lib:/system/lib/ndk:/system/lib/chipset-pub-sdk:/system/lib/chipset-sdk:/system/lib/platformsdk:/system/lib/priv-platformsdk:/system/lib/priv-module:/system/lib/module:/system/lib/module/data:/system/lib/module/multimedia:/lib64:/lib:/usr/local/lib:/usr/lib
namespace.default.asan.lib.paths
=
/system/lib64:/system/lib64/module:/vendor/lib64:/vendor/lib64/chipsetsdk:/system/lib64/module/data:/system/lib64/module/multimedia:/system/lib:/system/lib/module:/system/lib/module/data:/system/lib/module/multimedia:/lib64:/lib:/usr/local/lib:/usr/lib
namespace.default.lib.paths
=
/system/lib64:/vendor/lib64:/vendor/lib64/chipsetsdk:/system/lib64/ndk:/system/lib64/chipset-pub-sdk:/system/lib64/chipset-sdk:/system/lib64/platformsdk:/system/lib64/priv-platformsdk:/system/lib64/priv-module:/system/lib64/module:/system/lib64/module/data:/system/lib64/module/multimedia:/system/lib:/vendor/lib:/system/lib/ndk:/system/lib/chipset-pub-sdk:/system/lib/chipset-sdk:/system/lib/platformsdk:/system/lib/priv-platformsdk:/system/lib/priv-module:/system/lib/module:/system/lib/module/data:/system/lib/module/multimedia:/lib64:/lib:/usr/local/lib:/usr/lib
:/data/lib:/data/lib64
namespace.default.asan.lib.paths
=
/system/lib64:/system/lib64/module:/vendor/lib64:/vendor/lib64/chipsetsdk:/system/lib64/module/data:/system/lib64/module/multimedia:/system/lib:/system/lib/module:/system/lib/module/data:/system/lib/module/multimedia:/lib64:/lib:/usr/local/lib:/usr/lib
:/data/lib:/data/lib64
porting/linux/user/config/ld-musl-namespace-arm-test.ini
浏览文件 @
e8ece904
...
...
@@ -3,8 +3,8 @@
test
=
/data/tests/libc-test/src/functionalext:/data/tests/libc-test/src/functionalext/dlns
[acquiescence]
namespace.default.lib.paths
=
/system/lib:/vendor/lib:/vendor/lib/chipsetsdk:/system/lib/ndk:/system/lib/chipset-pub-sdk:/system/lib/chipset-sdk:/system/lib/platformsdk:/system/lib/priv-platformsdk:/system/lib/priv-module:/system/lib/module:/system/lib/module/data:/system/lib/module/multimedia:/lib:/usr/local/lib:/usr/lib
namespace.default.asan.lib.paths
=
/system/lib:/system/lib/module:/vendor/lib:/vendor/lib/chipsetsdk:/system/lib/module/data:/system/lib/module/multimedia:/lib:/usr/local/lib:/usr/lib
namespace.default.lib.paths
=
/system/lib:/vendor/lib:/vendor/lib/chipsetsdk:/system/lib/ndk:/system/lib/chipset-pub-sdk:/system/lib/chipset-sdk:/system/lib/platformsdk:/system/lib/priv-platformsdk:/system/lib/priv-module:/system/lib/module:/system/lib/module/data:/system/lib/module/multimedia:/lib:/usr/local/lib:/usr/lib
:/data/lib
namespace.default.asan.lib.paths
=
/system/lib:/system/lib/module:/vendor/lib:/vendor/lib/chipsetsdk:/system/lib/module/data:/system/lib/module/multimedia:/lib:/usr/local/lib:/usr/lib
:/data/lib
[test]
added.nslist
=
ns_no_allowed_libs,ns_normal,ns_wrong_lib_path,ns_wrong_allowed_path,for_inherit_A,for_inherit_AA,inherited_class,ns_separated_flase,ns_asan_lib_path,ns_asan_permit_path
...
...
porting/linux/user/config/ld-musl-namespace-arm.ini
浏览文件 @
e8ece904
...
...
@@ -2,5 +2,5 @@
acquiescence
=
/
[acquiescence]
namespace.default.lib.paths
=
/system/lib:/vendor/lib:/vendor/lib/chipsetsdk:/system/lib/ndk:/system/lib/chipset-pub-sdk:/system/lib/chipset-sdk:/system/lib/platformsdk:/system/lib/priv-platformsdk:/system/lib/priv-module:/system/lib/module:/system/lib/module/data:/system/lib/module/multimedia:/lib:/usr/local/lib:/usr/lib
namespace.default.asan.lib.paths
=
/system/lib:/system/lib/module:/vendor/lib:/vendor/lib/chipsetsdk:/system/lib/module/data:/system/lib/module/multimedia:/lib:/usr/local/lib:/usr/lib
namespace.default.lib.paths
=
/system/lib:/vendor/lib:/vendor/lib/chipsetsdk:/system/lib/ndk:/system/lib/chipset-pub-sdk:/system/lib/chipset-sdk:/system/lib/platformsdk:/system/lib/priv-platformsdk:/system/lib/priv-module:/system/lib/module:/system/lib/module/data:/system/lib/module/multimedia:/lib:/usr/local/lib:/usr/lib
:/data/lib
namespace.default.asan.lib.paths
=
/system/lib:/system/lib/module:/vendor/lib:/vendor/lib/chipsetsdk:/system/lib/module/data:/system/lib/module/multimedia:/lib:/usr/local/lib:/usr/lib
:/data/lib
porting/linux/user/ldso/dynlink.c
浏览文件 @
e8ece904
...
...
@@ -206,7 +206,7 @@ static void load_preload(char *s, ns_t *ns, struct loadtasks *tasks);
static
void
handle_relro_sharing
(
struct
dso
*
p
,
const
dl_extinfo
*
extinfo
,
ssize_t
*
relro_fd_offset
);
/* asan path open */
int
handle_asan_path_open
(
int
fd
,
const
char
*
name
,
ns_t
*
namespace
,
char
*
buf
);
int
handle_asan_path_open
(
int
fd
,
const
char
*
name
,
ns_t
*
namespace
,
char
*
buf
,
size_t
buf_size
);
/* add namespace function */
static
void
*
addr2dso
(
size_t
a
);
...
...
@@ -333,7 +333,7 @@ static void init_namespace(struct dso *app)
nslist
*
nsl
=
nslist_init
();
ns_configor
*
conf
=
configor_init
();
char
file_path
[
sizeof
"/etc/ld-musl-namespace-"
+
sizeof
(
LDSO_ARCH
)
+
sizeof
".ini"
+
1
];
char
file_path
[
sizeof
"/etc/ld-musl-namespace-"
+
sizeof
(
LDSO_ARCH
)
+
sizeof
".ini"
+
1
]
=
{
0
}
;
(
void
)
snprintf
(
file_path
,
sizeof
file_path
,
"/etc/ld-musl-namespace-%s.ini"
,
LDSO_ARCH
);
LD_LOGI
(
"init_namespace file_path:%s"
,
file_path
);
int
ret
=
conf
->
parse
(
file_path
,
app_path
);
...
...
@@ -1262,7 +1262,8 @@ static struct dso *find_library_by_name(const char *name, const ns_t *ns, bool c
}
/* Find loaded so by file stat */
static
struct
dso
*
find_library_by_fstat
(
const
struct
stat
*
st
,
const
ns_t
*
ns
,
bool
check_inherited
)
{
LD_LOGD
(
"find_library_by_fstat st->st_dev:%lu, st->st_ino:%lu, ns:%p, check_inherited:%d
\n
"
,
st
->
st_dev
,
st
->
st_ino
,
ns
,
check_inherited
);
LD_LOGD
(
"find_library_by_fstat st->st_dev:%lu, st->st_ino:%lu, ns:%p, check_inherited:%d
\n
"
,
st
->
st_dev
,
st
->
st_ino
,
ns
,
check_inherited
);
struct
dso
*
p
=
search_dso_by_fstat
(
st
,
ns
);
if
(
p
)
return
p
;
if
(
check_inherited
&&
ns
->
ns_inherits
)
{
...
...
@@ -1373,7 +1374,7 @@ struct dso *load_library(
}
if
(
g_is_asan
)
{
fd
=
handle_asan_path_open
(
fd
,
name
,
namespace
,
buf
);
fd
=
handle_asan_path_open
(
fd
,
name
,
namespace
,
buf
,
sizeof
buf
);
LD_LOGD
(
"load_library handle_asan_path_open fd:%d.
\n
"
,
fd
);
}
else
{
if
(
fd
==
-
1
&&
namespace
->
lib_paths
)
{
...
...
@@ -2538,7 +2539,6 @@ static void *dlopen_impl(
do_dlclose
(
p
);
p
=
0
;
}
LD_LOGD
(
"dlopen %s: realpath=%s, handle=%p"
,
name
,
p
->
rpath
,
handle
);
#endif
end:
#ifdef LOAD_ORDER_RANDOMIZATION
...
...
@@ -3085,7 +3085,7 @@ int dlns_set_namespace_allowed_libs(const char * name, const char * allowed_libs
return
0
;
}
int
handle_asan_path_open
(
int
fd
,
const
char
*
name
,
ns_t
*
namespace
,
char
*
buf
)
int
handle_asan_path_open
(
int
fd
,
const
char
*
name
,
ns_t
*
namespace
,
char
*
buf
,
size_t
buf_size
)
{
LD_LOGD
(
"handle_asan_path_open fd:%d, name:%s , namespace:%p , buf:%s.
\n
"
,
fd
,
name
,
namespace
,
buf
);
int
fd_tmp
=
fd
;
...
...
@@ -3097,14 +3097,14 @@ int handle_asan_path_open(int fd, const char *name, ns_t *namespace, char *buf)
strcpy
(
new_lib_paths
,
namespace
->
asan_lib_paths
);
strcat
(
new_lib_paths
,
":"
);
strcat
(
new_lib_paths
,
namespace
->
lib_paths
);
fd_tmp
=
path_open
(
name
,
new_lib_paths
,
buf
,
sizeof
buf
);
fd_tmp
=
path_open
(
name
,
new_lib_paths
,
buf
,
buf_size
);
LD_LOGD
(
"handle_asan_path_open path_open new_lib_paths:%s ,fd: %d.
\n
"
,
new_lib_paths
,
fd_tmp
);
free
(
new_lib_paths
);
}
else
if
(
namespace
->
asan_lib_paths
)
{
fd_tmp
=
path_open
(
name
,
namespace
->
asan_lib_paths
,
buf
,
sizeof
buf
);
fd_tmp
=
path_open
(
name
,
namespace
->
asan_lib_paths
,
buf
,
buf_size
);
LD_LOGD
(
"handle_asan_path_open path_open asan_lib_paths:%s ,fd: %d.
\n
"
,
namespace
->
asan_lib_paths
,
fd_tmp
);
}
else
{
fd_tmp
=
path_open
(
name
,
namespace
->
lib_paths
,
buf
,
sizeof
buf
);
fd_tmp
=
path_open
(
name
,
namespace
->
lib_paths
,
buf
,
buf_size
);
LD_LOGD
(
"handle_asan_path_open path_open lib_paths:%s ,fd: %d.
\n
"
,
namespace
->
lib_paths
,
fd_tmp
);
}
}
...
...
@@ -3509,7 +3509,7 @@ static bool load_library_header(struct loadtask *task)
}
}
if
(
g_is_asan
)
{
task
->
fd
=
handle_asan_path_open
(
task
->
fd
,
name
,
namespace
,
task
->
buf
);
task
->
fd
=
handle_asan_path_open
(
task
->
fd
,
name
,
namespace
,
task
->
buf
,
sizeof
task
->
buf
);
LD_LOGD
(
"load_library handle_asan_path_open fd:%d.
\n
"
,
task
->
fd
);
}
else
{
if
(
task
->
fd
==
-
1
&&
namespace
->
lib_paths
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录