diff options
| author | Alexander Potapenko <glider@google.com> | 2023-11-27 17:46:34 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2024-01-17 09:28:44 +0000 |
| commit | c9a1c95bf02421042abda563e4ec488384157409 (patch) | |
| tree | 3cfbeacc8843daa4db9e6d711d2aa9bbfeeeada7 /syz-ci | |
| parent | edd756a5fa6390fb08e2b515e507253a59b22d70 (diff) | |
pkg/cover/backend: adjust module base address by .text offset
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.
Diffstat (limited to 'syz-ci')
0 files changed, 0 insertions, 0 deletions
