Skip to content

Loading ELF with no program headers and first section at non-zero address has segments/sections at wrong address #6723

Open
@negasora

Description

@negasora

In the attached binary, there are no program headers and the first section has address 0x13000 and size 0x13cc0.
When we load this file we create this section at whatever load base was requested (0x400000 by default) instead of the load base plus 0x13000

This is the section table entry:

0000b270      [0x1] = 
0000b270      {
0000b270          uint32_t name = 0x1
0000b274          enum sh_type type = SHT_NOBITS
0000b278          enum sh_flags flags = SHF_ALLOC | SHF_EXECINSTR
0000b280          uint64_t address = 0x13000
0000b288          uint64_t offset = 0x0
0000b290          uint64_t size = 0x13cc0
0000b298          uint32_t link = 0x0
0000b29c          uint32_t info = 0x0
0000b2a0          uint64_t align = 0x1000
0000b2a8          uint64_t entry_size = 0x0
0000b2b0      }

And the resulting section/segments:

Image

We should create the section/segment at 0x413000 instead of 0x400000

wrong_load_base.zip

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions