mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:47:34 +00:00
LibELF: Validate the mapped file in DynamicLoader constructor
ELF::DynamicLoader now validates the ELF header and the program headers in its constructor. The requested program interpreter from the PT_INTERP program header is now avaiable via a getter. The dynamic loader program will want to check that this matches its name, for extra shenanigans checking.
This commit is contained in:
parent
61acca223f
commit
827e375297
2 changed files with 20 additions and 2 deletions
|
@ -64,6 +64,9 @@ public:
|
|||
// Will be called from _fixup_plt_entry, as part of the PLT trampoline
|
||||
Elf32_Addr patch_plt_entry(u32 relocation_offset);
|
||||
|
||||
// Requested program interpreter from program headers. May be empty string
|
||||
StringView program_interpreter() const { return m_program_interpreter; }
|
||||
|
||||
private:
|
||||
class ProgramHeaderRegion {
|
||||
public:
|
||||
|
@ -103,9 +106,10 @@ private:
|
|||
void call_object_init_functions();
|
||||
|
||||
String m_filename;
|
||||
String m_program_interpreter;
|
||||
size_t m_file_size { 0 };
|
||||
int m_image_fd { -1 };
|
||||
void* m_file_mapping { nullptr };
|
||||
void* m_file_mapping { MAP_FAILED };
|
||||
bool m_valid { true };
|
||||
|
||||
OwnPtr<DynamicObject> m_dynamic_object;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue