Bug 1385537 - Check for writable segments correctly. r=glandium
authorCameron McCormack <cam@mcc.id.au>
Sat, 29 Jul 2017 13:56:25 +0800
changeset 420647 799a8785eab17f7049c6042706b6e0e3a082970a
parent 420646 9c4690da59fabb5edbd20b63649ba119bb72b9e2
child 420648 f76639bd1c36351ad856a3ee8fce4c2f3c3dcfca
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1385537
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1385537 - Check for writable segments correctly. r=glandium MozReview-Commit-ID: FItpvVeiMJM
build/unix/elfhack/elfhack.cpp
--- a/build/unix/elfhack/elfhack.cpp
+++ b/build/unix/elfhack/elfhack.cpp
@@ -725,17 +725,17 @@ int do_relocation_section(Elf *elf, unsi
         Rel_Type &rel = new_rels.back();
         memset(&rel, 0, sizeof(rel));
         rel.r_info = ELF32_R_INFO(std::distance(symtab->syms.begin(), std::vector<Elf_SymValue>::iterator(mprotect)), rel_type2);
 
         // Find the beginning of the bss section, and use an aligned location in there
         // for the relocation.
         for (ElfSegment *segment = elf->getSegmentByType(PT_LOAD); segment;
              segment = elf->getSegmentByType(PT_LOAD, segment)) {
-            if (segment->getFlags() & PF_W == 0)
+            if ((segment->getFlags() & PF_W) == 0)
                 continue;
             size_t ptr_size = Elf_Addr::size(elf->getClass());
             size_t aligned_mem_end = (segment->getAddr() + segment->getMemSize() + ptr_size - 1) & ~(ptr_size - 1);
             size_t aligned_file_end = (segment->getAddr() + segment->getFileSize() + ptr_size - 1) & ~(ptr_size - 1);
             if (aligned_mem_end - aligned_file_end >= Elf_Addr::size(elf->getClass())) {
                 mprotect_cb = rel.r_offset = aligned_file_end;
                 break;
             }