访问执行过程中.eh_frame数据 [英] Accessing .eh_frame data during execution
问题描述
我试图从内部访问它 .eh_frame
正在运行的程序的部分内容(具体程序是Linux内核2.6.34.8)。在 .eh_frame
包含用于异常处理有用的数据,我想内核code内内部使用它。本节已经被写了 GCC
( readelf -a vmlinux.o
包含 .eh_frame
),问题是从code阅读。我是pretty确保ELF格式文档说 .eh_frame
为code执行期间访问。
I'm trying to access the contents of .eh_frame
section of a running program from within it (specifically, the program is Linux kernel 2.6.34.8). The .eh_frame
contains useful data used for exception handling and I'd like to use it internally from within kernel code. The section is already being written by gcc
(readelf -a vmlinux.o
contains .eh_frame
), the problem is reading it from the code. I'm pretty sure the elf format docs say that .eh_frame
is accessible during code execution.
我看着的glibc
在大多数CFA搜索 .eh_frame
的使用,发现宏之源在 sysdeps /通用/ sysdep.h中说明
,但不是加载 .eh_frame
数据的实际code
I've looked into the source of glibc
in search of .eh_frame
usage and found macros for most CFA instructions in sysdeps/generic/sysdep.h
, but not the actual code that loads the .eh_frame
data.
是修改加载内核从文件加载数据的过程中,它需要的,或者说是 .eh_frame
信息/ .eh_frame_hdr
部分指针存储在某个地方作为宏/汇编的名称(这样就可以提取到C变量)?
Is it required to modify the process of loading the kernel to load the data from the file, or is the .eh_frame
info/.eh_frame_hdr
section pointer stored somewhere as a macro/assembler name (so it can be extracted into a C variable)?
推荐答案
vmlinux.o
不是被加载实际的内核。
vmlinux.o
is not the actual kernel that gets loaded.
实际的内核映像(典型值的bzImage
)不是一个ELF文件,只包含需要运行的内核中的数据。
The actual kernel image (typically bzImage
) is not an ELF file and contains only the data needed for running the kernel.
此外,大多数的内核不与异常处理的信息进行编译。
Furthermore, most of the kernel is not compiled with exception handling information.
这篇关于访问执行过程中.eh_frame数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!