From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31653 invoked by alias); 14 Dec 2011 22:29:33 -0000 Received: (qmail 31643 invoked by uid 22791); 14 Dec 2011 22:29:32 -0000 X-SWARE-Spam-Status: No, hits=-3.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,TW_CP,TW_FN X-Spam-Check-By: sourceware.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 14 Dec 2011 22:29:19 +0000 Received: from vapier.localnet (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id 8E5911B4048; Wed, 14 Dec 2011 22:29:18 +0000 (UTC) From: Mike Frysinger To: "Carlos O'Donell" Subject: Re: [patch] handle unaligned arm abs relocs Date: Wed, 14 Dec 2011 22:29:00 -0000 User-Agent: KMail/1.13.7 (Linux/3.1.0-atsc; KDE/4.6.5; x86_64; ; ) Cc: libc-ports@sourceware.org References: <201112121920.17908.vapier@gentoo.org> <4EE91DA5.90807@mentor.com> In-Reply-To: <4EE91DA5.90807@mentor.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart7704641.WIfrQHU5hb"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-Id: <201112141729.19045.vapier@gentoo.org> X-IsSubscribed: yes Mailing-List: contact libc-ports-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: libc-ports-owner@sourceware.org X-SW-Source: 2011-12/txt/msg00019.txt.bz2 --nextPart7704641.WIfrQHU5hb Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-length: 1905 On Wednesday 14 December 2011 17:05:25 Carlos O'Donell wrote: > On 12/12/2011 7:20 PM, Mike Frysinger wrote: > > background can be found here: > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D51456 > >=20 > > 2011-12-12 Mike Frysinger > >=20 > > * dl-machine.h (elf_machine_rel, R_ARM_ABS32): Declare "reloc_value". > > Replace reloc_addr addition with memcpy's. > >=20 > > diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h > > index 5ceeaa9..fe64800 100644 > > --- a/sysdeps/arm/dl-machine.h > > +++ b/sysdeps/arm/dl-machine.h > > @@ -413,6 +413,7 @@ elf_machine_rel (struct link_map *map, const > > break; > > case R_ARM_ABS32: > > { > > + Elf32_Addr reloc_value; > > # ifndef RTLD_BOOTSTRAP > > /* This is defined in rtld.c, but nowhere in the static > > libc.a; make the reference weak so static programs can > > @@ -431,7 +432,10 @@ elf_machine_rel (struct link_map *map, const > > used while loading those libraries. */ > > value -=3D map->l_addr + refsym->st_value; > > # endif > > - *reloc_addr +=3D value; > > + /* Support relocations on mis-aligned offsets. */ > > + memcpy (&reloc_value, reloc_addr_arg, sizeof (reloc_value)); > > + reloc_value +=3D value; > > + memcpy (reloc_addr_arg, &reloc_value, sizeof (reloc_value)); >=20 > I don't believe that memcpy is safe this early in the loader. >=20 > You might be lucky and get an inlined memcpy or builtin, but you > might not and if you go through the PLT you'll fault since > it's not yet setup. i thought it should be OK because R_ARM_COPY already calls memcpy() a few=20 lines up, but i don't know the ARM loader that well to say what is necessary looking at the relocs that exist on my local arm ldso and i only see: R_ARM_RELATIVE R_ARM_GLOB_DAT R_ARM_JUMP_SLOT hopefully someone who understands ARM better can comment ... -mike --nextPart7704641.WIfrQHU5hb Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. Content-length: 836 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) iQIcBAABAgAGBQJO6SM+AAoJEEFjO5/oN/WBQtIQANcwXhbLSnJ1I3qTkrmYPqb+ kkLbtQxW2oFKOIU1GWwX+3vbaLf+r3uK3Zg1cPRQkoQMU1ztIf3YwBEsGLGfNFlp o6P9u+xszAtR5Bth2EDCLFm6DAohjP7yO/cHX8oK4YVbmF7lLm9a6ksE1UGHTKSf Kkzg4Z5ZoGjyDKQtigcf3ivhqcGKsr+MCTJ8ELOrmSWzRfPCtHkQk3a09ba1t7DL seGpr+s/6tOipCPr4gfF6xepAoumbG5HGdJ1JZ7OGsI0H+wo6QC1SPGf6pG3y2j4 PiMQV5mLeZTghk8EB2Gmza4JHv/RNkVVeefthYuox0XDQr5jRybh9sIEU9CAn/o2 aaGWHXactT4aPkrQt42uBH6tRhxUj7OnytDMMJdCl5NaHT7qQH4JoBpkfYio0AD9 cnKlqa0gZfWS3CbdqGwT6lCE5LHg12PLN6YsjIH7K7lcjwaHWMMZxe7xpZUVw5hB auA4scGjgY4f7UD5qv4EKDVsxGWKtMS+R8Wgn5avYOjNK/iM/Rxhd2LiyGUP5A4g 7gBDY9GvnHJQBriYUzy1Mi79xUt9KiGk2B5NdncoHlHh924Kb+ylqG9eist0cYTM ESv3ItazyQL3/7ZrrA/ORbJg60vEeTD/dl0cjM/X8D4X1qcfFNj5nnUiY0fRmmGj UQ/HeW88EVZ1+DkZmk0y =h7GB -----END PGP SIGNATURE----- --nextPart7704641.WIfrQHU5hb--