Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Musl
提交
60544be4
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看板
未验证
提交
60544be4
编写于
11月 26, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 26, 2022
浏览文件
操作
浏览文件
下载
差异文件
!709 调整dlopen流程中锁保护流程
Merge pull request !709 from dhy308/gl-fix_dlopen_lock
上级
57543919
1129a091
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
38 addition
and
43 deletion
+38
-43
porting/linux/user/ldso/dynlink.c
porting/linux/user/ldso/dynlink.c
+38
-43
未找到文件。
porting/linux/user/ldso/dynlink.c
浏览文件 @
60544be4
...
...
@@ -2910,8 +2910,37 @@ static void prepare_lazy(struct dso *p)
lazy_head
=
p
;
}
static
void
*
dlopen_post
(
struct
dso
*
p
,
int
mode
)
{
if
(
p
==
NULL
)
{
return
p
;
}
p
->
nr_dlopen
++
;
if
(
p
->
bfs_built
)
{
for
(
int
i
=
0
;
p
->
deps
[
i
];
i
++
)
{
p
->
deps
[
i
]
->
nr_dlopen
++
;
if
(
mode
&
RTLD_NODELETE
)
{
p
->
deps
[
i
]
->
flags
|=
DSO_FLAGS_NODELETE
;
}
}
}
#ifdef HANDLE_RANDOMIZATION
void
*
handle
=
assign_valid_handle
(
p
);
if
(
handle
==
NULL
)
{
LD_LOGE
(
"dlopen_post: generate random handle failed"
);
do_dlclose
(
p
);
}
return
handle
;
#endif
return
p
;
}
/* add namespace function */
static
void
*
dlopen_impl
_orig
(
static
void
*
dlopen_impl
(
const
char
*
file
,
int
mode
,
const
char
*
namespace
,
const
void
*
caller_addr
,
const
dl_extinfo
*
extinfo
)
{
struct
dso
*
volatile
p
,
*
orig_tail
,
*
orig_syms_tail
,
*
orig_lazy_head
,
*
next
;
...
...
@@ -2933,8 +2962,8 @@ static void *dlopen_impl_orig(
#endif
if
(
!
file
)
{
LD_LOGD
(
"dlopen_impl
_orig
file is null, return head."
);
return
head
;
LD_LOGD
(
"dlopen_impl file is null, return head."
);
return
dlopen_post
(
head
,
mode
)
;
}
if
(
extinfo
)
{
...
...
@@ -3025,16 +3054,16 @@ static void *dlopen_impl_orig(
#ifdef LOAD_ORDER_RANDOMIZATION
tasks
=
create_loadtasks
();
if
(
!
tasks
)
{
LD_LOGE
(
"dlopen_impl
_orig
create loadtasks failed"
);
LD_LOGE
(
"dlopen_impl create loadtasks failed"
);
goto
end
;
}
task
=
create_loadtask
(
file
,
head
,
ns
,
true
);
if
(
!
task
)
{
LD_LOGE
(
"dlopen_impl
_orig
create loadtask failed"
);
LD_LOGE
(
"dlopen_impl create loadtask failed"
);
goto
end
;
}
if
(
!
load_library_header
(
task
))
{
LD_LOGE
(
"dlopen_impl
_orig
load library header failed for %{public}s"
,
task
->
name
);
LD_LOGE
(
"dlopen_impl load library header failed for %{public}s"
,
task
->
name
);
goto
end
;
}
if
(
reserved_address
)
{
...
...
@@ -3042,7 +3071,7 @@ static void *dlopen_impl_orig(
}
}
if
(
!
task
->
p
)
{
LD_LOGE
(
"dlopen_impl
_orig
load library failed for %{public}s"
,
task
->
name
);
LD_LOGE
(
"dlopen_impl load library failed for %{public}s"
,
task
->
name
);
error
(
noload
?
"Library %s is not already loaded"
:
"Error loading shared library %s: %m"
,
...
...
@@ -3122,6 +3151,8 @@ static void *dlopen_impl_orig(
if
(
tls_cnt
!=
orig_tls_cnt
)
install_new_tls
();
orig_tail
=
tail
;
p
=
dlopen_post
(
p
,
mode
);
end
:
debug
.
state
=
RT_CONSISTENT
;
_dl_debug_state
();
...
...
@@ -3142,42 +3173,6 @@ end:
return
p
;
}
static
void
*
dlopen_impl
(
const
char
*
file
,
int
mode
,
const
char
*
namespace
,
const
void
*
caller_addr
,
const
dl_extinfo
*
extinfo
){
struct
dso
*
p
=
(
struct
dso
*
)
dlopen_impl_orig
(
file
,
mode
,
namespace
,
caller_addr
,
extinfo
);
if
(
p
==
NULL
)
{
return
p
;
}
pthread_rwlock_wrlock
(
&
lock
);
p
->
nr_dlopen
++
;
if
(
p
->
bfs_built
)
{
for
(
int
i
=
0
;
p
->
deps
[
i
];
i
++
)
{
p
->
deps
[
i
]
->
nr_dlopen
++
;
if
(
mode
&
RTLD_NODELETE
)
{
p
->
deps
[
i
]
->
flags
|=
DSO_FLAGS_NODELETE
;
}
}
}
#ifdef HANDLE_RANDOMIZATION
void
*
handle
=
assign_valid_handle
(
p
);
if
(
handle
==
NULL
)
{
LD_LOGE
(
"dlopen_impl: generate random handle failed"
);
do_dlclose
(
p
);
}
pthread_rwlock_unlock
(
&
lock
);
return
handle
;
#endif
pthread_rwlock_unlock
(
&
lock
);
return
p
;
}
void
*
dlopen
(
const
char
*
file
,
int
mode
)
{
const
void
*
caller_addr
=
__builtin_return_address
(
0
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录