| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
| |
filepath.Walk calls os.Lstat for every file or directory to retrieve os.FileInfo.
filepath.WalkDir avoids unnecessary system calls since it provides a fs.DirEntry,
which includes file type information without requiring a stat call.
This improves performance by reducing redundant system calls.
|
| |
|
|
|
|
|
| |
we use offset to symbolize pc for module,
while use absolute pc for core kernel.
Fix by removing base address from module only.
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
Module size from /proc/modules is bigger than that from .text size in elf.
|
| | |
|
| | |
|
| |
|
|
|
|
| |
In preparation for pkg/host removal.
Nothing in pkg/host uses KernelModule, and pkg/cover
is effectively the only user of KernelModule.
|
| |
|
|
|
|
| |
Since commit 971a0f14c5cf6 ("pkg/host: get module .text address from
/sys/module") getModuleOffset() is not used by anyone, so it should be
safe to delete it.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The address from /proc/modules is not necessarily the address of .text,
e.g., can be the address of .plt.
If available, fix up the module address using the address from
/sys/module/<module-name>/sections/.text
This patch was originally uploaded to
https://github.com/google/syzkaller/pull/4025.
Additions to the original patch:
- fix lint warnings
- adjust the module size to account for the diff between the module
address and .text address
Signed-off-by: Alexander Potapenko <glider@google.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Modules' .text sections are not necessarily loaded at the address shown
in /proc/modules. If there are other non-init code sections preceding them
in the ELF binary, .text is loaded at non-zero address.
For example, for a module with the following sections:
Idx Name Size VMA LMA File off Algn
...
5 .plt 00000001 0000000000000000 0000000000000000 00000500 2**4
CONTENTS, ALLOC, LOAD, READONLY, CODE
6 .init.ddplt 00000001 0000000000000000 0000000000000000 00000501 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
7 .text.ftrace_trampoline 00000001 0000000000000000 0000000000000000 00000502 2**0
CONTENTS, ALLOC, LOAD, READONLY, CODE
8 .hyp.text 00002000 0000000000000000 0000000000000000 00001000 2**12
CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
...
13 .text 00001aac 0000000000000000 0000000000000000 00005048 2**2
CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
the base address displayed in /proc/modules points to the beginning of
.plt, and other sections have the following offsets:
.init.plt - ignored
.text.ftrace_trampoline - 0x1
.hyp.text - 0x1000
.text - 0x3000
This patch calculates the offset of the .text section and uses it to
adjust the address obtained from /proc/modules.
|
| | |
|
| |
|
|
|
|
| |
I have invested time deduplicating code between the two formats. As the
go modules for Mach-O and ELF don't share types, I had to re-wrap some
information or move code to format specific functions though.
|
| |
|
|
|
| |
Restructure discovery code that it can be tested and add a manual test.
Also remove some code duplication for module creation.
|
| |
|
|
|
|
|
| |
Make module discovery convert host.KernelModule to backend.Module.
Also error if we have modules on non-Linux
and make it possible to return errors from module discovery.
|
|
|
elf.go is already quite large and messy.
Module discovery is a well separatable chunk of logic,
move it to a dedicated file.
No code changes.
|