Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Musl
提交
6bfc5fef
T
Third Party Musl
项目概览
OpenHarmony
/
Third Party Musl
9 个月 前同步成功
通知
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看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
6bfc5fef
编写于
8月 26, 2022
作者:
G
ganlan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix linker logs
Signed-off-by:
N
ganlan
<
tony.gan@huawei.com
>
上级
b82ff235
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
21 addition
and
18 deletion
+21
-18
porting/linux/user/ldso/dynlink.c
porting/linux/user/ldso/dynlink.c
+21
-18
未找到文件。
porting/linux/user/ldso/dynlink.c
浏览文件 @
6bfc5fef
...
@@ -296,7 +296,6 @@ static void set_ns_attrs(ns_t *ns, ns_configor *conf)
...
@@ -296,7 +296,6 @@ static void set_ns_attrs(ns_t *ns, ns_configor *conf)
if
(
allowed_libs
)
ns_set_allowed_libs
(
ns
,
allowed_libs
);
if
(
allowed_libs
)
ns_set_allowed_libs
(
ns
,
allowed_libs
);
LD_LOGD
(
"set_ns_attrs :"
LD_LOGD
(
"set_ns_attrs :"
"ns: %{public}p ,"
"ns_name: %{public}s ,"
"ns_name: %{public}s ,"
"separated:%{public}d ,"
"separated:%{public}d ,"
"lib_paths:%{public}s ,"
"lib_paths:%{public}s ,"
...
@@ -304,7 +303,7 @@ static void set_ns_attrs(ns_t *ns, ns_configor *conf)
...
@@ -304,7 +303,7 @@ static void set_ns_attrs(ns_t *ns, ns_configor *conf)
"permitted_paths:%{public}s ,"
"permitted_paths:%{public}s ,"
"asan_permitted_paths:%{public}s ,"
"asan_permitted_paths:%{public}s ,"
"allowed_libs: %{public}s ."
,
"allowed_libs: %{public}s ."
,
ns
,
ns
->
ns_name
,
ns
->
separated
,
ns
->
lib_paths
,
ns
->
asan_lib_paths
,
permitted_paths
,
ns
->
ns_name
,
ns
->
separated
,
ns
->
lib_paths
,
ns
->
asan_lib_paths
,
permitted_paths
,
asan_permitted_paths
,
allowed_libs
);
asan_permitted_paths
,
allowed_libs
);
}
}
...
@@ -322,12 +321,11 @@ static void set_ns_inherits(ns_t *ns, ns_configor *conf)
...
@@ -322,12 +321,11 @@ static void set_ns_inherits(ns_t *ns, ns_configor *conf)
char
*
shared_libs
=
conf
->
get_inherit_shared_libs
(
ns
->
ns_name
,
inherited_ns
->
ns_name
);
char
*
shared_libs
=
conf
->
get_inherit_shared_libs
(
ns
->
ns_name
,
inherited_ns
->
ns_name
);
ns_add_inherit
(
ns
,
inherited_ns
,
shared_libs
);
ns_add_inherit
(
ns
,
inherited_ns
,
shared_libs
);
LD_LOGD
(
"set_ns_inherits :"
LD_LOGD
(
"set_ns_inherits :"
"inherited_ns: %{public}p ,"
"ns_name: %{public}s ,"
"ns_name: %{public}s ,"
"separated:%{public}d ,"
"separated:%{public}d ,"
"lib_paths:%{public}s ,"
"lib_paths:%{public}s ,"
"asan_lib_paths:%{public}s ,"
,
"asan_lib_paths:%{public}s ,"
,
inherited_ns
,
inherited_ns
->
ns_name
,
inherited_ns
->
separated
,
inherited_ns
->
lib_paths
,
inherited_ns
->
ns_name
,
inherited_ns
->
separated
,
inherited_ns
->
lib_paths
,
inherited_ns
->
asan_lib_paths
);
inherited_ns
->
asan_lib_paths
);
}
}
}
}
...
@@ -1444,10 +1442,11 @@ static void get_sys_path(ns_configor *conf)
...
@@ -1444,10 +1442,11 @@ static void get_sys_path(ns_configor *conf)
}
}
static
struct
dso
*
search_dso_by_name
(
const
char
*
name
,
const
ns_t
*
ns
)
{
static
struct
dso
*
search_dso_by_name
(
const
char
*
name
,
const
ns_t
*
ns
)
{
LD_LOGD
(
"search_dso_by_name name:%{public}s, ns
:%{public}p"
,
name
,
ns
);
LD_LOGD
(
"search_dso_by_name name:%{public}s, ns
_name:%{public}s"
,
name
,
ns
?
ns
->
ns_name
:
"NULL"
);
for
(
size_t
i
=
0
;
i
<
ns
->
ns_dsos
->
num
;
i
++
){
for
(
size_t
i
=
0
;
i
<
ns
->
ns_dsos
->
num
;
i
++
){
struct
dso
*
p
=
ns
->
ns_dsos
->
dsos
[
i
];
struct
dso
*
p
=
ns
->
ns_dsos
->
dsos
[
i
];
if
(
p
->
shortname
&&
!
strcmp
(
p
->
shortname
,
name
))
{
if
(
p
->
shortname
&&
!
strcmp
(
p
->
shortname
,
name
))
{
LD_LOGD
(
"search_dso_by_name found name:%{public}s, ns_name:%{public}s"
,
name
,
ns
?
ns
->
ns_name
:
"NULL"
);
return
p
;
return
p
;
}
}
}
}
...
@@ -1455,11 +1454,12 @@ static struct dso *search_dso_by_name(const char *name, const ns_t *ns) {
...
@@ -1455,11 +1454,12 @@ static struct dso *search_dso_by_name(const char *name, const ns_t *ns) {
}
}
static
struct
dso
*
search_dso_by_fstat
(
const
struct
stat
*
st
,
const
ns_t
*
ns
)
{
static
struct
dso
*
search_dso_by_fstat
(
const
struct
stat
*
st
,
const
ns_t
*
ns
)
{
LD_LOGD
(
"search_dso_by_fstat st->st_dev:%{public}lu, st->st_ino:%{public}lu, ns:%{public}p"
,
LD_LOGD
(
"search_dso_by_fstat ns_name:%{public}s"
,
ns
?
ns
->
ns_name
:
"NULL"
);
st
->
st_dev
,
st
->
st_ino
,
ns
);
for
(
size_t
i
=
0
;
i
<
ns
->
ns_dsos
->
num
;
i
++
){
for
(
size_t
i
=
0
;
i
<
ns
->
ns_dsos
->
num
;
i
++
){
struct
dso
*
p
=
ns
->
ns_dsos
->
dsos
[
i
];
struct
dso
*
p
=
ns
->
ns_dsos
->
dsos
[
i
];
if
(
p
->
dev
==
st
->
st_dev
&&
p
->
ino
==
st
->
st_ino
)
{
if
(
p
->
dev
==
st
->
st_dev
&&
p
->
ino
==
st
->
st_ino
)
{
LD_LOGD
(
"search_dso_by_fstat found dev:%{public}lu, ino:%{public}lu, ns_name:%{public}s"
,
st
->
st_dev
,
st
->
st_ino
,
ns
?
ns
->
ns_name
:
"NULL"
);
return
p
;
return
p
;
}
}
}
}
...
@@ -1467,8 +1467,11 @@ static struct dso *search_dso_by_fstat(const struct stat *st, const ns_t *ns) {
...
@@ -1467,8 +1467,11 @@ static struct dso *search_dso_by_fstat(const struct stat *st, const ns_t *ns) {
}
}
/* Find loaded so by name */
/* Find loaded so by name */
static
struct
dso
*
find_library_by_name
(
const
char
*
name
,
const
ns_t
*
ns
,
bool
check_inherited
)
static
struct
dso
*
find_library_by_name
(
const
char
*
name
,
const
ns_t
*
ns
,
bool
check_inherited
)
{
{
LD_LOGD
(
"find_library_by_name name:%{public}s, ns:%{public}p, check_inherited:%{public}d"
,
name
,
ns
,
check_inherited
);
LD_LOGD
(
"find_library_by_name name:%{public}s, ns_name:%{public}s, check_inherited:%{public}d"
,
name
,
ns
?
ns
->
ns_name
:
"NULL"
,
!!
check_inherited
);
struct
dso
*
p
=
search_dso_by_name
(
name
,
ns
);
struct
dso
*
p
=
search_dso_by_name
(
name
,
ns
);
if
(
p
)
return
p
;
if
(
p
)
return
p
;
if
(
check_inherited
&&
ns
->
ns_inherits
)
{
if
(
check_inherited
&&
ns
->
ns_inherits
)
{
...
@@ -1482,9 +1485,9 @@ static struct dso *find_library_by_name(const char *name, const ns_t *ns, bool c
...
@@ -1482,9 +1485,9 @@ static struct dso *find_library_by_name(const char *name, const ns_t *ns, bool c
}
}
/* Find loaded so by file stat */
/* Find loaded so by file stat */
static
struct
dso
*
find_library_by_fstat
(
const
struct
stat
*
st
,
const
ns_t
*
ns
,
bool
check_inherited
)
{
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:%{public}lu, st->st_ino:%{public}lu, "
LD_LOGD
(
"find_library_by_fstat
ns_name:%{public}s, check_inherited :%{public}d"
,
"ns:%{public}p, check_inherited:%{public}d
"
,
ns
?
ns
->
ns_name
:
"NULL
"
,
st
->
st_dev
,
st
->
st_ino
,
ns
,
check_inherited
);
!!
check_inherited
);
struct
dso
*
p
=
search_dso_by_fstat
(
st
,
ns
);
struct
dso
*
p
=
search_dso_by_fstat
(
st
,
ns
);
if
(
p
)
return
p
;
if
(
p
)
return
p
;
if
(
check_inherited
&&
ns
->
ns_inherits
)
{
if
(
check_inherited
&&
ns
->
ns_inherits
)
{
...
@@ -1749,6 +1752,7 @@ static void load_direct_deps(struct dso *p, ns_t *namespace, struct reserved_add
...
@@ -1749,6 +1752,7 @@ static void load_direct_deps(struct dso *p, ns_t *namespace, struct reserved_add
for
(
i
=
0
;
p
->
dynv
[
i
];
i
+=
2
)
{
for
(
i
=
0
;
p
->
dynv
[
i
];
i
+=
2
)
{
if
(
p
->
dynv
[
i
]
!=
DT_NEEDED
)
continue
;
if
(
p
->
dynv
[
i
]
!=
DT_NEEDED
)
continue
;
struct
dso
*
dep
=
load_library
(
p
->
strings
+
p
->
dynv
[
i
+
1
],
p
,
namespace
,
true
,
reserved_params
);
struct
dso
*
dep
=
load_library
(
p
->
strings
+
p
->
dynv
[
i
+
1
],
p
,
namespace
,
true
,
reserved_params
);
LD_LOGD
(
"loading shared library %{public}s: (needed by %{public}s)"
,
p
->
strings
+
p
->
dynv
[
i
+
1
],
p
->
name
);
if
(
!
dep
)
{
if
(
!
dep
)
{
error
(
"Error loading shared library %s: %m (needed by %s)"
,
error
(
"Error loading shared library %s: %m (needed by %s)"
,
p
->
strings
+
p
->
dynv
[
i
+
1
],
p
->
name
);
p
->
strings
+
p
->
dynv
[
i
+
1
],
p
->
name
);
...
@@ -2925,11 +2929,10 @@ int dlns_create2(Dl_namespace *dlns, const char *lib_path, int flags)
...
@@ -2925,11 +2929,10 @@ int dlns_create2(Dl_namespace *dlns, const char *lib_path, int flags)
}
}
LD_LOGI
(
"dlns_create2:"
LD_LOGI
(
"dlns_create2:"
"ns: %{public}p ,"
"ns_name: %{public}s ,"
"ns_name: %{public}s ,"
"separated:%{public}d ,"
"separated:%{public}d ,"
"lib_paths:%{public}s "
,
"lib_paths:%{public}s "
,
ns
,
ns
->
ns_name
,
ns
->
separated
,
ns
->
lib_paths
);
ns
->
ns_name
,
ns
->
separated
,
ns
->
lib_paths
);
pthread_rwlock_unlock
(
&
lock
);
pthread_rwlock_unlock
(
&
lock
);
return
0
;
return
0
;
...
@@ -2937,7 +2940,7 @@ int dlns_create2(Dl_namespace *dlns, const char *lib_path, int flags)
...
@@ -2937,7 +2940,7 @@ int dlns_create2(Dl_namespace *dlns, const char *lib_path, int flags)
int
dlns_create
(
Dl_namespace
*
dlns
,
const
char
*
lib_path
)
int
dlns_create
(
Dl_namespace
*
dlns
,
const
char
*
lib_path
)
{
{
LD_LOGI
(
"dlns_create
dlns:%{public}s, lib_paths:%{public}s"
,
dlns
?
dlns
->
name
:
"NULL
"
,
lib_path
);
LD_LOGI
(
"dlns_create
lib_paths:%{public}s
"
,
lib_path
);
return
dlns_create2
(
dlns
,
lib_path
,
CREATE_INHERIT_DEFAULT
);
return
dlns_create2
(
dlns
,
lib_path
,
CREATE_INHERIT_DEFAULT
);
}
}
...
@@ -3457,11 +3460,10 @@ int dlns_set_namespace_allowed_libs(const char * name, const char * allowed_libs
...
@@ -3457,11 +3460,10 @@ int dlns_set_namespace_allowed_libs(const char * name, const char * allowed_libs
int
handle_asan_path_open
(
int
fd
,
const
char
*
name
,
ns_t
*
namespace
,
char
*
buf
,
size_t
buf_size
)
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:%{public}d, name:%{public}s , namespace:%{public}
p , buf:%{public}s
."
,
LD_LOGD
(
"handle_asan_path_open fd:%{public}d, name:%{public}s , namespace:%{public}
s
."
,
fd
,
fd
,
name
,
name
,
namespace
,
namespace
?
namespace
->
ns_name
:
"NULL"
);
buf
);
int
fd_tmp
=
fd
;
int
fd_tmp
=
fd
;
if
(
fd
==
-
1
&&
(
namespace
->
asan_lib_paths
||
namespace
->
lib_paths
))
{
if
(
fd
==
-
1
&&
(
namespace
->
asan_lib_paths
||
namespace
->
lib_paths
))
{
if
(
namespace
->
lib_paths
&&
namespace
->
asan_lib_paths
)
{
if
(
namespace
->
lib_paths
&&
namespace
->
asan_lib_paths
)
{
...
@@ -4129,6 +4131,7 @@ static void preload_direct_deps(struct dso *p, ns_t *namespace, struct loadtasks
...
@@ -4129,6 +4131,7 @@ static void preload_direct_deps(struct dso *p, ns_t *namespace, struct loadtasks
}
}
continue
;
continue
;
}
}
LD_LOGD
(
"loading shared library %{public}s: (needed by %{public}s)"
,
p
->
strings
+
p
->
dynv
[
i
+
1
],
p
->
name
);
if
(
!
load_library_header
(
task
))
{
if
(
!
load_library_header
(
task
))
{
free_task
(
task
);
free_task
(
task
);
task
=
NULL
;
task
=
NULL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录