Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Musl
提交
aecfb4d5
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看板
未验证
提交
aecfb4d5
编写于
7月 24, 2023
作者:
O
openharmony_ci
提交者:
Gitee
7月 24, 2023
浏览文件
操作
浏览文件
下载
差异文件
!977 补充dlns身份限制范围
Merge pull request !977 from wangchen/0710_m
上级
443148cf
25041f64
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
35 addition
and
3 deletion
+35
-3
porting/linux/user/ldso/dynlink.c
porting/linux/user/ldso/dynlink.c
+35
-3
未找到文件。
porting/linux/user/ldso/dynlink.c
浏览文件 @
aecfb4d5
...
...
@@ -3540,6 +3540,10 @@ int dlns_get(const char *name, Dl_namespace *dlns)
void
*
dlopen_ns
(
Dl_namespace
*
dlns
,
const
char
*
file
,
int
mode
)
{
const
void
*
caller_addr
=
__builtin_return_address
(
0
);
if
(
is_permitted
(
caller_addr
,
dlns
->
name
)
==
false
)
{
return
NULL
;
}
musl_log_reset
();
ld_log_reset
();
LD_LOGI
(
"dlopen_ns file:%{public}s, mode:%{public}x , caller_addr:%{public}p , dlns->name:%{public}s."
,
...
...
@@ -3553,6 +3557,10 @@ void *dlopen_ns(Dl_namespace *dlns, const char *file, int mode)
void
*
dlopen_ns_ext
(
Dl_namespace
*
dlns
,
const
char
*
file
,
int
mode
,
const
dl_extinfo
*
extinfo
)
{
const
void
*
caller_addr
=
__builtin_return_address
(
0
);
if
(
is_permitted
(
caller_addr
,
dlns
->
name
)
==
false
)
{
return
NULL
;
}
musl_log_reset
();
ld_log_reset
();
LD_LOGI
(
"dlopen_ns_ext file:%{public}s, mode:%{public}x , caller_addr:%{public}p , "
...
...
@@ -3577,7 +3585,7 @@ int dlns_create2(Dl_namespace *dlns, const char *lib_path, int flags)
const
void
*
caller_addr
=
__builtin_return_address
(
0
);
if
(
is_permitted
(
caller_addr
,
dlns
->
name
)
==
false
)
{
pthread_rwlock_unlock
(
&
lock
);
return
E
INVAL
;
return
E
PERM
;
}
ns
=
find_ns_by_name
(
dlns
->
name
);
...
...
@@ -3604,7 +3612,7 @@ int dlns_create2(Dl_namespace *dlns, const char *lib_path, int flags)
if
((
flags
&
CREATE_INHERIT_CURRENT
)
!=
0
)
{
struct
dso
*
caller
;
c
onst
void
*
c
aller_addr
=
__builtin_return_address
(
0
);
caller_addr
=
__builtin_return_address
(
0
);
caller
=
(
struct
dso
*
)
addr2dso
((
size_t
)
caller_addr
);
if
(
caller
&&
caller
->
namespace
)
{
ns_add_inherit
(
ns
,
caller
->
namespace
,
NULL
);
...
...
@@ -3638,7 +3646,7 @@ int dlns_inherit(Dl_namespace *dlns, Dl_namespace *inherited, const char *shared
const
void
*
caller_addr
=
__builtin_return_address
(
0
);
if
(
is_permitted
(
caller_addr
,
dlns
->
name
)
==
false
)
{
pthread_rwlock_unlock
(
&
lock
);
return
E
INVAL
;
return
E
PERM
;
}
ns_t
*
ns
=
find_ns_by_name
(
dlns
->
name
);
...
...
@@ -4162,6 +4170,12 @@ int dlns_set_namespace_lib_path(const char * name, const char * lib_path)
}
pthread_rwlock_wrlock
(
&
lock
);
const
void
*
caller_addr
=
__builtin_return_address
(
0
);
if
(
is_permitted
(
caller_addr
,
name
)
==
false
)
{
pthread_rwlock_unlock
(
&
lock
);
return
EPERM
;
}
ns_t
*
ns
=
find_ns_by_name
(
name
);
if
(
!
ns
)
{
pthread_rwlock_unlock
(
&
lock
);
...
...
@@ -4182,6 +4196,12 @@ int dlns_set_namespace_separated(const char * name, const bool separated)
}
pthread_rwlock_wrlock
(
&
lock
);
const
void
*
caller_addr
=
__builtin_return_address
(
0
);
if
(
is_permitted
(
caller_addr
,
name
)
==
false
)
{
pthread_rwlock_unlock
(
&
lock
);
return
EPERM
;
}
ns_t
*
ns
=
find_ns_by_name
(
name
);
if
(
!
ns
)
{
pthread_rwlock_unlock
(
&
lock
);
...
...
@@ -4202,6 +4222,12 @@ int dlns_set_namespace_permitted_paths(const char * name, const char * permitted
}
pthread_rwlock_wrlock
(
&
lock
);
const
void
*
caller_addr
=
__builtin_return_address
(
0
);
if
(
is_permitted
(
caller_addr
,
name
)
==
false
)
{
pthread_rwlock_unlock
(
&
lock
);
return
EPERM
;
}
ns_t
*
ns
=
find_ns_by_name
(
name
);
if
(
!
ns
)
{
pthread_rwlock_unlock
(
&
lock
);
...
...
@@ -4222,6 +4248,12 @@ int dlns_set_namespace_allowed_libs(const char * name, const char * allowed_libs
}
pthread_rwlock_wrlock
(
&
lock
);
const
void
*
caller_addr
=
__builtin_return_address
(
0
);
if
(
is_permitted
(
caller_addr
,
name
)
==
false
)
{
pthread_rwlock_unlock
(
&
lock
);
return
EPERM
;
}
ns_t
*
ns
=
find_ns_by_name
(
name
);
if
(
!
ns
)
{
pthread_rwlock_unlock
(
&
lock
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录