Thread overview
[Issue 11171] New: Text relocations in Phobos shared library
Oct 04, 2013
Dicebot
Oct 04, 2013
Dicebot
Oct 31, 2013
Martin Krejcirik
Oct 31, 2013
safety0ff.bugz
Oct 31, 2013
Martin Krejcirik
Oct 31, 2013
safety0ff.bugz
October 04, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11171

           Summary: Text relocations in Phobos shared library
           Product: D
           Version: D2
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: public@dicebot.lv


--- Comment #0 from Dicebot <public@dicebot.lv> 2013-10-04 04:12:14 PDT ---
Have noticed that issue during package maintenance for Arch Linux and reporting by Martin Nowak request. Arch Linux automatically verifies all packages targeting official repos with own `namcap` tool. At some point I have noticed it warning me that `libphobos2.so` has text relocations.

This is how package is built: https://github.com/Dicebot/Arch-PKGBUILDs/blob/master/dmd/PKGBUILD

Essentially it is just `make -f posix.mak MODEL=$_archbits DMD=$srcdir/dmd/src/dmd RELEASE=1`

$ uname -a
Linux vbox-arch-64 3.11.2-1-ARCH #1 SMP PREEMPT Fri Sep 27 07:35:36 CEST
2013 x86_64 GNU/Linux

$ readelf -d /usr/lib/libphobos2.so | grep TEXTREL
 0x0000000000000016 (TEXTREL)            0x0

$ eu-readelf -r /usr/lib/libphobos2.so | wc -l
18615

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 04, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11171



--- Comment #1 from Dicebot <public@dicebot.lv> 2013-10-04 04:14:41 PDT ---
P.S. version of shared library in question is https://www.archlinux.org/packages/community/x86_64/libphobos/ , it can be installed at any point by standard package manager (pacman)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 31, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11171


Martin Krejcirik <mk@krej.cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mk@krej.cz


--- Comment #2 from Martin Krejcirik <mk@krej.cz> 2013-10-31 22:43:50 CET ---
Just noticed this too. It makes shared libraries unusable on hardened system
(like grsecurity).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 31, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11171


safety0ff.bugz <safety0ff.bugz@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |safety0ff.bugz@gmail.com


--- Comment #3 from safety0ff.bugz <safety0ff.bugz@gmail.com> 2013-10-31 14:55:11 PDT ---
Duplicate of #5278?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 31, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11171



--- Comment #4 from Martin Krejcirik <mk@krej.cz> 2013-10-31 23:07:52 CET ---
(In reply to comment #3)
> Duplicate of #5278?

Likely, but it's not just Gentoo. I use Grsecurity kernel on Debian and get this error:

./prog: error while loading shared libraries: /usr/local/lib/libphobos2.so.0.64: cannot make segment writable for relocation: Permission denied

The only solution is to disable MPROTECT for given exacutable. http://pax.grsecurity.net/docs/mprotect.txt

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 31, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11171



--- Comment #5 from safety0ff.bugz <safety0ff.bugz@gmail.com> 2013-10-31 15:10:09 PDT ---
(In reply to comment #4)
> (In reply to comment #3)
> > Duplicate of #5278?
> 
> Likely, but it's not just Gentoo.
I'm aware, it should probably be renamed.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------