Oops, this is bad, and unfortunately I committed too many patches yesterday
to understand which one brought this bug...



On Sun, Jul 16, 2017 at 7:57 PM, <[email protected]> wrote:

>   TEST tst-elf-permissions.so             OSv v0.24-399-ge6fadac
> eth0: 192.168.122.15
> Assertion failed: (phdr.p_flags & (PF_R | PF_W | PF_X)) == PF_R
> (core/elf.cc: fix_permissions: 475)
>
>
We've seen Jenkins doing two runs and both of them failed at exactly the
same place. Moreover, on my Fedora 25 installation, I ran this test 1000
times, and it didn't fail once....

Note how the failure is while *loading* the test object, not even when
running it, where we discover that the GNU_RELRO section is not marked
read-only. This can either be memory corruption (oops) or a linker bug
(this particular test does funky monkey-business on the linker).

It turns out to be the latter: The test fails if the "gold" linker is used
to build it. If I add "-fuse-ld=gold" in COMMON in modules/tests/Makefile,
running this test fails with the exact same assertion, and it's clear why:

$ readelf -a build/release/tests/tst-elf-permissions.so
Program Headers:
  Type           Offset             VirtAddr           PhysAddr
                 FileSiz            MemSiz              Flags  Align
...
  GNU_RELRO      0x0000000000001da0 0x0000000000002da0 0x0000000000002da0
                 0x0000000000000260 0x0000000000000260  RW     8

Note how GNU_RELRO is marked read-write, but it should have been read-only.

I am guessing that recently, our Jenkins machine was modified to change the
default BFD linker to the GOLD one. Is this possible?

An easy fix would be to add -fuse-ld=bfd. I'm trying to think if that's the
right fix, though.

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to