Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Thu, 26 Jun 2014 22:22:32 -0400
From: Rich Felker <dalias@...c.org>
To: musl@...ts.openwall.com
Subject: Re: ELF loader rejects older glibc binary

On Thu, Jun 26, 2014 at 05:46:38PM -0700, Isaac Dunham wrote:
> On Thu, Jun 26, 2014 at 10:50:08AM +0300, Timo Teras wrote:
> > On Wed, 25 Jun 2014 20:59:24 -0700
> > Isaac Dunham <ibid.ag@...il.com> wrote:
> > > The drivers in question may be found here:
> > > http://support.brother.com/g/b/downloadlist.aspx?c=us&lang=en&prod=dcp7065dn_all&os=128
> > > 
> > > I grabbed the "LPR printer driver".
> > > After extracting it (ar x dcp7065*deb; tar xvzf data.tar.gz),
> > > I found the binaries in 
> > > usr/local/Brother/Printer/DCP7065DN/{inf,lpd}/;
> > > the one I'd suggest poking at first is 
> > > "usr/local/Brother/Printer/DCP7065DN/lpd/rawtobr3" (I previously
> > > determined that rawtobr3 does all the conversions).
> > > After locating the binaries and verifying with file that they were
> > > dynamically linked ELF binaries, I ran ldd.
> > > When this failed with the message:
> > > ldd: rawtobr3: Not a valid dynamic program
> > > I then ran "strace ldd rawtobr3"; the output indicates that musl
> > > mmap'd it and failed without trying to run it:
> > > 
> > > ---start strace output---
> > > execve("/usr/bin/ldd", ["ldd", "rawtobr3"], [/* 19 vars */]) = 0
> > > open("rawtobr3", O_RDONLY|O_LARGEFILE)  = 3
> > > read(3,
> > > "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\2\0\3\0\1\0\0\0\324\207\4\0104\0\0\0"...,
> > > 936) = 936 mmap2(0x8048000, 49152, PROT_READ|PROT_EXEC, MAP_PRIVATE,
> > > 3, 0) = 0x566f1000 munmap(0x566f1000, 49152)               = 0
> > > writev(2, [{"ldd: rawtobr3: Not a valid dynam"..., 43}, {NULL, 0}],
> > > 2ldd: rawtobr3: Not a valid dynamic program ) = 43
> > > exit_group(1)                           = ? +++ exited with 1 +++
> > > ---end strace output---
> > > 
> > > strings suggests that it expects glibc 2.1 ABI, and that almost all
> > > the symbol requirements are met (_IO_stdin_used being the possible
> > > exception).
> > 
> > Do note that Alpine Linux runs grsec which includes PaX features. One
> > is that text relocations are disabled by default.
> > 
> > Try first:
> >   paxctl -c -pem /path/to/rawtobr3
> > 
> > if it makes any difference.
> 
> Thanks for mentioning that; I've just tested on my other musl system,
> and it's definitely a kernel difference (it runs on a non-pax system.)

It's probably some dubious pax feature that disallows mmap at a chosen
address without MAP_FIXED. If you can just edit the binary to use
ld-musl as its PT_INTERP rather than invoking it via ld-musl manually,
the kernel will do the mapping and I think it will work fine then.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.