Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_hotspot
提交
b4506855
D
dragonwell8_hotspot
项目概览
openanolis
/
dragonwell8_hotspot
通知
2
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_hotspot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
b4506855
编写于
6月 19, 2019
作者:
Y
ysuenaga
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8225636: SA can't handle prelinked libraries
Reviewed-by: sspitsyn, cjplummer
上级
6a828813
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
51 addition
and
0 deletion
+51
-0
agent/src/os/linux/ps_core.c
agent/src/os/linux/ps_core.c
+51
-0
未找到文件。
agent/src/os/linux/ps_core.c
浏览文件 @
b4506855
...
...
@@ -865,8 +865,51 @@ err:
#define LD_BASE_OFFSET offsetof(struct r_debug, r_ldbase)
#define LINK_MAP_ADDR_OFFSET offsetof(struct link_map, l_addr)
#define LINK_MAP_NAME_OFFSET offsetof(struct link_map, l_name)
#define LINK_MAP_LD_OFFSET offsetof(struct link_map, l_ld)
#define LINK_MAP_NEXT_OFFSET offsetof(struct link_map, l_next)
// Calculate the load address of shared library
// on prelink-enabled environment.
//
// In case of GDB, it would be calculated by offset of link_map.l_ld
// and the address of .dynamic section.
// See GDB implementation: lm_addr_check @ solib-svr4.c
static
uintptr_t
calc_prelinked_load_address
(
struct
ps_prochandle
*
ph
,
int
lib_fd
,
ELF_EHDR
*
elf_ehdr
,
uintptr_t
link_map_addr
)
{
ELF_PHDR
*
phbuf
;
uintptr_t
lib_ld
;
uintptr_t
lib_dyn_addr
=
0L
;
uintptr_t
load_addr
;
int
i
;
phbuf
=
read_program_header_table
(
lib_fd
,
elf_ehdr
);
if
(
phbuf
==
NULL
)
{
print_debug
(
"can't read program header of shared object
\n
"
);
return
0L
;
}
// Get the address of .dynamic section from shared library.
for
(
i
=
0
;
i
<
elf_ehdr
->
e_phnum
;
i
++
)
{
if
(
phbuf
[
i
].
p_type
==
PT_DYNAMIC
)
{
lib_dyn_addr
=
phbuf
[
i
].
p_vaddr
;
break
;
}
}
free
(
phbuf
);
if
(
ps_pdread
(
ph
,
(
psaddr_t
)
link_map_addr
+
LINK_MAP_LD_OFFSET
,
&
lib_ld
,
sizeof
(
uintptr_t
))
!=
PS_OK
)
{
print_debug
(
"can't read address of dynamic section in shared object
\n
"
);
return
0L
;
}
// Return the load address which is calculated by the address of .dynamic
// and link_map.l_ld .
load_addr
=
lib_ld
-
lib_dyn_addr
;
print_debug
(
"lib_ld = 0x%lx, lib_dyn_addr = 0x%lx -> lib_base_diff = 0x%lx
\n
"
,
lib_ld
,
lib_dyn_addr
,
load_addr
);
return
load_addr
;
}
// read shared library info from runtime linker's data structures.
// This work is done by librtlb_db in Solaris
static
bool
read_shared_lib_info
(
struct
ps_prochandle
*
ph
)
{
...
...
@@ -968,6 +1011,14 @@ static bool read_shared_lib_info(struct ps_prochandle* ph) {
// continue with other libraries...
}
else
{
if
(
read_elf_header
(
lib_fd
,
&
elf_ehdr
))
{
if
(
lib_base_diff
==
0x0L
)
{
lib_base_diff
=
calc_prelinked_load_address
(
ph
,
lib_fd
,
&
elf_ehdr
,
link_map_addr
);
if
(
lib_base_diff
==
0x0L
)
{
close
(
lib_fd
);
return
false
;
}
}
lib_base
=
lib_base_diff
+
find_base_address
(
lib_fd
,
&
elf_ehdr
);
print_debug
(
"reading library %s @ 0x%lx [ 0x%lx ]
\n
"
,
lib_name
,
lib_base
,
lib_base_diff
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录