1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 18:37:36 +00:00

LibELF: Map .text segment with MAP_ANONYMOUS for shared objects

We need to workaround the fact that MAP_PRIVATE when passed a file
descriptor doesn't work the way we expect. We can't change the
permissions on our mmap to PROT_WRITE if the original executable doesn't
have PROT_WRITE.

Because of this, we need to construct our ELFDynamicObject using the
actual virtual address of the .dynamic section, instead of using the
offset into the ELFImage that was actually getting modified by accident
...somehow. Not clear what was going on.
This commit is contained in:
Andrew Kaster 2020-01-08 21:38:05 -07:00 committed by Andreas Kling
parent e594724b01
commit 2e349337d3
4 changed files with 26 additions and 18 deletions

View file

@ -86,4 +86,5 @@ private:
size_t m_text_segment_size;
VirtualAddress m_tls_segment_address;
VirtualAddress m_dynamic_section_address;
};