Received: from list by lists.gnu.org with archive (Exim 4.71) id 1VnRpU-0007BN-H5 for mharc-grub-devel@gnu.org; Mon, 02 Dec 2013 06:38:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51822) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnRpN-0007Ac-QW for grub-devel@gnu.org; Mon, 02 Dec 2013 06:38:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VnRfz-0001qf-VU for grub-devel@gnu.org; Mon, 02 Dec 2013 06:29:55 -0500 Received: from mail-we0-f173.google.com ([74.125.82.173]:64965) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnRfz-0001pT-Mn for grub-devel@gnu.org; Mon, 02 Dec 2013 06:28:31 -0500 Received: by mail-we0-f173.google.com with SMTP id u57so6069632wes.4 for ; Mon, 02 Dec 2013 03:28:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-type:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=hgYaKvQq45ZDAQTD2KdOnBFR7KEPZN+QlmcBx+Wgz3o=; b=ePWsRtypJEQS7haIMOG8ugOm8qzwHuvrKq8GkMGf5vVz1zSieogxwxLHnV1xUlzeOT fgbBk1RNkbLto9TW/9tS23HKSY0WgggUH1wtqLpoVKwqga0fT7U0lF/BsZxEIc7XAWSi PaJqamUJ7ZPlFqGJjEpKIPy+RXy+38JvSC6RYdfB8FhLrr7We01IahUEP51eak65V3/l GTXdohjYYJAC4yNDhStgih0gvf7L8nqmgi0R8xI/1mqwXDCX5MfFQwcyVAvjweACNx2l h7ZVjfV7VZpmzaFaS/DRlelYWmNeE8yTMGEhTKGjfGO6Rt76Of3z/Hl/XbNXiGv7IehP 2WSQ== X-Gm-Message-State: ALoCoQmAgNFiEaRqax1RxAf8x+DjzgAHHFsQdlwFjMeVKth/+IdYledo480rejdH2h5T1/d2mBWF X-Received: by 10.180.108.97 with SMTP id hj1mr17810170wib.59.1385983710487; Mon, 02 Dec 2013 03:28:30 -0800 (PST) Received: from rocoto.smurfnet.nu ([2001:4b98:dc0:41:216:3eff:fea7:75f3]) by mx.google.com with ESMTPSA id bk7sm39202433wib.10.2013.12.02.03.28.29 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 02 Dec 2013 03:28:29 -0800 (PST) Date: Mon, 2 Dec 2013 12:28:46 +0100 From: Leif Lindholm To: The development of GNU GRUB Subject: Re: [PATCH, RFC, RFT] ARM relocation fixes Message-ID: <20131202112846.GC24997@rocoto.smurfnet.nu> References: <529AD1E8.8010305@gmail.com> <20131202105330.GA24997@rocoto.smurfnet.nu> <529C6820.9090902@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <529C6820.9090902@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.125.82.173 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 11:38:19 -0000 On Mon, Dec 02, 2013 at 11:59:44AM +0100, Vladimir 'φ-coder/phcoder' Serbinenko wrote: > On 02.12.2013 11:53, Leif Lindholm wrote: > > On Sun, Dec 01, 2013 at 07:06:32AM +0100, Vladimir 'φ-coder/phcoder' Serbinenko wrote: > >> Current ARM relocation doesn't handle the cases when the relocation cant > >> be satisfied directly (like thumb call over 1M of distance or jump24 to > >> thumb mode. Attached patch adds missing tampoline and missing relocation > >> handling to EFI code (it didn't allow to use ARM (no-Thumb) binary with > >> EFI). > >> I couldn't test it on either arm-efi or ARM64 > > > > Amusingly, I wrote the attached > Nothing is attached to your mail. Right now could you pause work on > */dl.c: I'm reorganising them to declare more of it as platform > independent and unify handling (ARM dl.c is unnecessarily different from > other versions and forget some of ELF handling) Ok, I'll hold off. > > on Saturday, based on a bug report > > from Jon Masters @ Red Hat. Although an unlikely corner case, it does > > probably need the addition of grub_arch_dl_get_tramp_got_size() from > > your implementation in order to ensure the "veneers"[1] don't end up > > in a heap region different to and too far away from the one the module > > is loaded into. > > > > I'll have a look and a poke on both 32- and 64-bit stuff and respond.. > > > > I would say the modifications to grub-mkimage for arm64 are probably > > unnessecary: AArch64 relative branch range is +-128MB, and I don't > > think we'll see grub kernel images that big. > > There are no changes of this kind to mkimage. I only added missing ARM > handling and the functions which now became mkimage-specific were moved > to it. Well, I was referring specifically to: --- a/util/grub-mkimagexx.c +++ b/util/grub-mkimagexx.c @@ -731,13 +731,13 @@ SUFFIX (relocate_addresses) (Elf_Ehdr *e, Elf_Shdr *sections, case R_AARCH64_JUMP26: case R_AARCH64_CALL26: { - grub_err_t err; sym_addr -= offset; sym_addr -= SUFFIX (entry_point); - err = grub_arm64_reloc_xxxx26((grub_uint32_t *)target, + if (!grub_arm_64_check_xxxx26_offset (sym_addr)) + grub_util_error ("%s", _("CALL26 Relocation out of range")); + + grub_arm64_set_xxxx26_offset((grub_uint32_t *)target, sym_addr); - if (err) - grub_util_error ("%s", grub_errmsg); } break; default: which isn't wrong, but that offset test can only fail when your GRUB kernel is greater than 128MB in size. / Leif