Re: Segfaults caused by new DT_MIPS_RLD_MAP_REL tag and RPATH removers

Aurelien Jarno <[email protected]>
Newsgroups gmane.linux.debian.ports.mips
Message-ID <[email protected]>
On 2016-04-08 10:45, Aurelien Jarno wrote:
> Hi,
> 
> On 2016-04-07 11:51, James Cowgill wrote:
> > 
> > Based only on chrpath and cmake reverse dependencies, there is an upper
> > bound of about 1500 binNMUs (after the tools after fixed). Hopefully
> > that can be reduced!
> >
> > I really don't have any time to fix all this. Please can someone else
> > have a look!
> 
> I'll try to do an archive scan asap to really get an idea on how many
> packages are affected. After I'll look at how to fix chrpath, but help
> would be welcome as I also don't have a lot of time.

Please find below a small quick and dirty python script to check that.
There is probably a way to do it better and cleaner, but it does its
job.

I will start an archive scan and will start working on a chrpath fix.

Aurelien



#!/usr/bin/python3

from sys import argv, exit
from elftools.elf.elffile import ELFFile, DynamicSection

# MIPS specific constants
DT_MIPS_BASE_ADDRESS=0x70000006
DT_MIPS_RLD_MAP=0x70000016
DT_MIPS_RLD_MAP_REL=0x70000035

good = True
filename = argv[1]

with open(filename, 'rb') as f:
    for section in ELFFile(f).iter_sections():
        if not isinstance(section, DynamicSection):
            continue
    
        base = None
        rld_map = None
        rld_map_rel = None
        rld_map_rel_offset = None
        for index, tag in enumerate(section.iter_tags()):
            if tag.entry.d_tag == DT_MIPS_BASE_ADDRESS:
                base = tag.entry.d_val
            elif tag.entry.d_tag == DT_MIPS_RLD_MAP:
                rld_map = tag.entry.d_val
            elif tag.entry.d_tag == DT_MIPS_RLD_MAP_REL:
                rld_map_rel = tag.entry.d_val
                rld_map_rel_offset = section.header.sh_offset + index * section.header.sh_entsize
    
        if base and rld_map and rld_map_rel:
            if rld_map != base + rld_map_rel + rld_map_rel_offset:
                good = False

print('%s: %s' % (filename, 'ok' if good else 'bad'))
exit(0 if good else 1)

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
[email protected]                 http://www.aurel32.net
signature.asc (application/pgp-signature, 819 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBCgAGBQJXB9/uAAoJELqceAYd3Yyb3mEQAJaQzVGYOkRFa4T6LsFsNusy
bExhJ2amoJiHbXH+wKa4plWC16509VIneliD18mcb0Lo0yY7n3vW6oMPrZXZBnTD
uqtfDAaKHqReMmTiV+UNEvbap04F63s9rAVdEeMT8J1dZEIyyzNyW2R4ayTl+NJR
iUi7oXpoQEdNOI/m0qnjdpt3FesavLjWrizxLB6En7o+eI0bUT+oghnGv/6jr8G1
QTTB1qltmLAYpAa/EhPe2u0RKY27XQ+X2wpwqapc/wOshxmxHqDvoW4MLnrtrH19
npenFzoD79PuNyF82BduRjpnBAf/F805M5+Wh7Zy/yo8mexiRlzERpgbzNDXqNw2
vD3hhb+Hojo28jhrt0XfvNIlnj56msZdNn+WJqRCe6OQwILM+bM2sDlYrh9G2jg/
DqAZv+M+Nx94L7sScss5pajo8lerK70hJahneZ9bA8SQ16PGmiQejITz/r/XBhQ+
IJAaBNbn07aV85VGj3cn3c/qjFk05jgh2MsCAyyGGpl54lXUnDbewLiJRT6H0+bB
gL6UutqpP8nb1aUYywDW/+Um1pG66glF7+Sjpvdw6holmHFPTWe/cMVDNsG0kjkM
Bk9WEjgMZGXzTAdhXaajigYZR85nPtdzEnlg7S9MxBVLyX7D31EvA+FOaFaL3Ake
981f49pRNz1m3SaJAuOk
=uzQi
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.