1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:48:11 +00:00

DynamicLoader: Some ELF data segments were allocated too small

For a data segment that starts at a non-zero offset into a 4KB page and
crosses a 4KB page boundary, we were failing to pad the VM allocation,
which would cause the memcpy() to fail.

Make sure we round the segment bases down, and segment ends up, and the
issue goes away.
This commit is contained in:
Andreas Kling 2021-02-18 18:11:52 +01:00
parent eb92ec3149
commit 0d3866e84c
2 changed files with 18 additions and 12 deletions

View file

@ -103,8 +103,6 @@ private:
bool is_load() const { return type() == PT_LOAD; }
bool is_dynamic() const { return type() == PT_DYNAMIC; }
u32 required_load_size() { return ALIGN_ROUND_UP(m_program_header.p_memsz, m_program_header.p_align); }
private:
Elf32_Phdr m_program_header; // Explicitly a copy of the PHDR in the image
};