summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibELF
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-02-20 19:02:15 +0100
committerAndreas Kling <kling@serenityos.org>2021-02-20 19:02:48 +0100
commit08476e7fe7b5265e87fd594f9e9b96c644d86434 (patch)
tree984aa72d63cecc706cb3e3b9deb6f25d8a26e209 /Userland/Libraries/LibELF
parent81c6d8e98ee240874ea36a85be6e7f4c05e15ff4 (diff)
downloadserenity-08476e7fe7b5265e87fd594f9e9b96c644d86434.zip
DynamicLoader: Always make .data segment read+write
Let's just ignore the program header and always go with read+write. Nothing else makes sense anyway.
Diffstat (limited to 'Userland/Libraries/LibELF')
-rw-r--r--Userland/Libraries/LibELF/DynamicLoader.cpp11
-rw-r--r--Userland/Libraries/LibELF/DynamicLoader.h1
2 files changed, 1 insertions, 11 deletions
diff --git a/Userland/Libraries/LibELF/DynamicLoader.cpp b/Userland/Libraries/LibELF/DynamicLoader.cpp
index af0c945fa0..6e577ad522 100644
--- a/Userland/Libraries/LibELF/DynamicLoader.cpp
+++ b/Userland/Libraries/LibELF/DynamicLoader.cpp
@@ -372,7 +372,7 @@ void DynamicLoader::load_program_headers()
auto* data_segment = (u8*)mmap_with_name(
data_segment_address,
data_segment_size,
- data_region.value().mmap_prot(),
+ PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED,
0,
0,
@@ -575,15 +575,6 @@ void DynamicLoader::call_object_init_functions()
}
}
-u32 DynamicLoader::ProgramHeaderRegion::mmap_prot() const
-{
- int prot = 0;
- prot |= is_executable() ? PROT_EXEC : 0;
- prot |= is_readable() ? PROT_READ : 0;
- prot |= is_writable() ? PROT_WRITE : 0;
- return prot;
-}
-
Optional<DynamicObject::SymbolLookupResult> DynamicLoader::lookup_symbol(const ELF::DynamicObject::Symbol& symbol) const
{
return m_dynamic_object->lookup_symbol(symbol);
diff --git a/Userland/Libraries/LibELF/DynamicLoader.h b/Userland/Libraries/LibELF/DynamicLoader.h
index 33f179d23a..708c844dba 100644
--- a/Userland/Libraries/LibELF/DynamicLoader.h
+++ b/Userland/Libraries/LibELF/DynamicLoader.h
@@ -95,7 +95,6 @@ private:
u32 size_in_memory() const { return m_program_header.p_memsz; }
u32 size_in_image() const { return m_program_header.p_filesz; }
u32 alignment() const { return m_program_header.p_align; }
- u32 mmap_prot() const;
bool is_readable() const { return flags() & PF_R; }
bool is_writable() const { return flags() & PF_W; }
bool is_executable() const { return flags() & PF_X; }