diff options
author | Jason <otherjason@nodomain.com> | 2022-12-28 23:47:36 -0500 |
---|---|---|
committer | Jason <otherjason@nodomain.com> | 2022-12-28 23:47:36 -0500 |
commit | 3a6d77112780e6cf072ecd5abbbab61db8ab0266 (patch) | |
tree | b53421b01ee73d091005106ac56bc00fe912e7a7 /src | |
parent | 8d2cb4f9ab8d564904c292099a022ffb3cccd52d (diff) | |
download | patchelf-3a6d77112780e6cf072ecd5abbbab61db8ab0266.tar.gz |
Revert "shiftFile: when splitting a segment into two pieces, preserve the original flags in both"
This reverts commit f4f1848e42b68adca04019bcf0d47132d1530bf2.
Diffstat (limited to 'src')
-rw-r--r-- | src/patchelf.cc | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/patchelf.cc b/src/patchelf.cc index 03bb3d3..da4e30b 100644 --- a/src/patchelf.cc +++ b/src/patchelf.cc @@ -463,9 +463,6 @@ void ElfFile<ElfFileParamNames>::shiftFile(unsigned int extraPages, size_t start int splitIndex = -1; size_t splitShift = 0; - /* Save off the flags from the segment that we are splitting so we can apply the same value - to both of the resulting segments. */ - decltype(phdrs.at(0).p_flags) splitFlags = 0; /* Update the offsets in the program headers. */ for (int i = 0; i < rdi(hdr()->e_phnum); ++i) { @@ -476,7 +473,6 @@ void ElfFile<ElfFileParamNames>::shiftFile(unsigned int extraPages, size_t start splitIndex = i; splitShift = startOffset - p_start; - splitFlags = rdi(phdrs.at(i).p_flags); /* This is the load segment we're currently extending within, so we split it. */ wri(phdrs.at(i).p_offset, startOffset); @@ -517,7 +513,7 @@ void ElfFile<ElfFileParamNames>::shiftFile(unsigned int extraPages, size_t start wri(phdr.p_paddr, phdrs.at(splitIndex).p_paddr - splitShift - shift); wri(phdr.p_vaddr, phdrs.at(splitIndex).p_vaddr - splitShift - shift); wri(phdr.p_filesz, wri(phdr.p_memsz, splitShift + extraBytes)); - wri(phdr.p_flags, splitFlags); + wri(phdr.p_flags, PF_R | PF_W); wri(phdr.p_align, getPageSize()); } |