From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1VnXUD-0000Qk-3r for mharc-grub-devel@gnu.org; Mon, 02 Dec 2013 12:40:45 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54298) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnXU6-0000Gq-8p for grub-devel@gnu.org; Mon, 02 Dec 2013 12:40:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VnXU0-0005bg-I2 for grub-devel@gnu.org; Mon, 02 Dec 2013 12:40:38 -0500 Received: from mail-ea0-x22e.google.com ([2a00:1450:4013:c01::22e]:58000) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnXU0-0005bZ-As for grub-devel@gnu.org; Mon, 02 Dec 2013 12:40:32 -0500 Received: by mail-ea0-f174.google.com with SMTP id b10so9241151eae.33 for ; Mon, 02 Dec 2013 09:40:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=Rkj4m7X8e7fwL7W5Snl9kNIpAexAGusk/+0uNZWiZhI=; b=D3MBi+dtBvr+QkcqNT0uvuzRGMnmhwG74UsAtQ+vWlwdbq2Fe4j/X//IT9BzLxFrpz dDS57kG06TYQoXzen6IsSCdedqtKNApB72FggMA2J5oh7P0aJapmlToBzwfbB+enayAv VCGvZLT7g+le2T8OPTk8KmMwvOSHarQs1rGVhq+W2lh3/bZ4JYiqFjamTko/8wiYBbSU bUkUQs8Fyopqfnk1q5LIPEVoRN/0wuYNHRtA1qb6MhsXCXDRZRtlPqI6GD78CCvsSGiN gKnKQy+BNRH1SbYOvL5UNuFsaOgM57zJ16Etms6OnQ6HOPbeF4hpz/6bvsWSpOh20zCx i25w== X-Received: by 10.15.10.7 with SMTP id f7mr2824775eet.51.1386006031495; Mon, 02 Dec 2013 09:40:31 -0800 (PST) Received: from [192.168.42.154] (39-225.197-178.cust.bluewin.ch. [178.197.225.39]) by mx.google.com with ESMTPSA id l4sm37539484een.13.2013.12.02.09.40.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Dec 2013 09:40:30 -0800 (PST) Message-ID: <529CC609.3060508@gmail.com> Date: Mon, 02 Dec 2013 18:40:25 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131005 Icedove/17.0.9 MIME-Version: 1.0 To: The development of GNU GRUB Subject: Re: [PATCH, RFC, RFT] ARM relocation fixes References: <529AD1E8.8010305@gmail.com> <20131202105330.GA24997@rocoto.smurfnet.nu> <529C6820.9090902@gmail.com> <20131202112846.GC24997@rocoto.smurfnet.nu> <529C7305.5070002@gmail.com> <20131202133051.GE24997@rocoto.smurfnet.nu> <20131202141450.GG24997@rocoto.smurfnet.nu> <20131202143306.GI24997@rocoto.smurfnet.nu> <20131202173247.GJ24997@rocoto.smurfnet.nu> In-Reply-To: <20131202173247.GJ24997@rocoto.smurfnet.nu> X-Enigmail-Version: 1.5.1 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="----enig2XKJLLWBKFJTSRPVJLPGU" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c01::22e X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Dec 2013 17:40:43 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2XKJLLWBKFJTSRPVJLPGU Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 02.12.2013 18:32, Leif Lindholm wrote: > On Mon, Dec 02, 2013 at 03:33:06PM +0100, Leif Lindholm wrote: >>>> Ok, so I've tested this on arm64, and it works on the commercial FVP= >>>> Base model (which does not trigger veneer generation due to its runt= ime >>>> memory map), but crashes on the Foundation model (which does). >>>> So the generic dl refactoring seems correct, but somehing about the >>>> veneers is fishy. >>> >>> Well, this one seems to be because mod->trampptr is never initilised >>> (which should be a problem also on the other archs?). >>> >>> With >>> diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c >>> index 33ccc98..92027e0 100644 >>> --- a/grub-core/kern/dl.c >>> +++ b/grub-core/kern/dl.c >>> @@ -317,6 +317,7 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_E= hdr *e) >>> #if !defined (__i386__) && !defined (__x86_64__) && !defined (__spar= c__) >>> ptr =3D (char *) ALIGN_UP ((grub_addr_t) ptr, GRUB_ARCH_DL_TRAMP_A= LIGN); >>> mod->tramp =3D ptr; >>> + mod->trampptr =3D (ptr + tramp); >>> ptr +=3D tramp; >>> ptr =3D (char *) ALIGN_UP ((grub_addr_t) ptr, GRUB_ARCH_DL_GOT_ALI= GN); >>> mod->got =3D ptr; >>> >>> This runs successfully on my foundation model. >> >> Umm, that's obviously not correct. But it did work :) >> >> What is needed is to store the size of the module before adding >> trampoline and got sizes. >=20 > So - after some much needed Lunch, and coffee, I think the below would > be correct? >=20 > diff --git a/grub-core/kern/dl.c b/grub-core/kern/dl.c > index 33ccc98..a83b744 100644 > --- a/grub-core/kern/dl.c > +++ b/grub-core/kern/dl.c > @@ -316,10 +316,10 @@ grub_dl_load_segments (grub_dl_t mod, const Elf_E= hdr *e) > } > #if !defined (__i386__) && !defined (__x86_64__) && !defined (__sparc_= _) > ptr =3D (char *) ALIGN_UP ((grub_addr_t) ptr, GRUB_ARCH_DL_TRAMP_ALI= GN); > - mod->tramp =3D ptr; > + mod->tramp =3D mod->trampptr =3D ptr; > ptr +=3D tramp; > ptr =3D (char *) ALIGN_UP ((grub_addr_t) ptr, GRUB_ARCH_DL_GOT_ALIGN= ); > - mod->got =3D ptr; > + mod->got =3D mod->gotptr =3D ptr; > ptr +=3D got; > #endif > =20 I've committed a fix before I saw this message but it did essentially the same. > / > Leif >=20 > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > https://lists.gnu.org/mailman/listinfo/grub-devel >=20 ------enig2XKJLLWBKFJTSRPVJLPGU Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.15 (GNU/Linux) Comment: Using GnuPG with Icedove - http://www.enigmail.net/ iF4EAREKAAYFAlKcxgkACgkQmBXlbbo5nOsSswEAkxiyHBLD1aWFsDoYmAQf4dCf 47LaJwHSzfH9LEQov6gA/iQcbY80PGKTCfi2f1cnZKG/Ce0eweGXZpA0pZJiYLda =UjAN -----END PGP SIGNATURE----- ------enig2XKJLLWBKFJTSRPVJLPGU--