Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Jan 2017 08:07:15 -0500
From:      Shawn Webb <shawn.webb@hardenedbsd.org>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        tech-lists <tech-lists@zyxst.net>, freebsd-arm@freebsd.org
Subject:   Re: compiling ports on rpi3 - relocation 1031
Message-ID:  <20170104130715.54fq45whnlellr6u@mutt-hardenedbsd>
In-Reply-To: <20170104102224.GB2356@kib.kiev.ua>
References:  <055826e7-9b91-11ac-6ae2-2a5d5da4db4a@zyxst.net> <20170104102224.GB2356@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help

--pzeqs5vyoptmz7ks
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Jan 04, 2017 at 12:22:25PM +0200, Konstantin Belousov wrote:
> On Wed, Jan 04, 2017 at 09:36:34AM +0000, tech-lists wrote:
> > Hello list,
> >=20
> > I get this error when, for instance, trying to compile screen on the rp=
i3:
> >=20
> > =3D=3D=3D>  Building for screen-4.4.0_2
> > /usr/local/lib/libintl.so: Unhandled relocation 1031
> > Fatal error
> > *** Error code 1
> >=20
> > Stop.
> > make[1]: stopped in /usr/ports/sysutils/screen
> > *** Error code 1
> >=20
> > Stop.
> > make: stopped in /usr/ports/sysutils/screen
> >=20
> > Is there a workaround for this?
> >=20
> > I'm using an image built with sources r311011 ports r430455 and the
> > image was created with crochet.
> >=20
> > uname -a
> > FreeBSD rpi3 12.0-CURRENT FreeBSD 12.0-CURRENT #0 7456285(master)-dirty:
> > Tue Jan  3 16:25:46 GMT 2017
> > john@localhost:/root/tmp/crochet/work/obj/arm64.aarch64/root/tmp/croche=
t/fbsd12-src/sys/PEA
> >  arm64
>=20
> This is TLSDESC relocation outside PLT.
>=20
> Try this (I did not even compiled the changed code).
>=20
> diff --git a/libexec/rtld-elf/aarch64/reloc.c b/libexec/rtld-elf/aarch64/=
reloc.c
> index 3f9de07db29..45ad5d02ce3 100644
> --- a/libexec/rtld-elf/aarch64/reloc.c
> +++ b/libexec/rtld-elf/aarch64/reloc.c
> @@ -317,6 +317,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, in=
t flags,
>  	const Elf_Sym *def;
>  	SymCache *cache;
>  	Elf_Addr *where;
> +	struct tls_data *tlsdesc;
>  	unsigned long symnum;
> =20
>  	if ((flags & SYMLOOK_IFUNC) !=3D 0)
> @@ -391,6 +392,14 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, i=
nt flags,
>  		case R_AARCH64_RELATIVE:
>  			*where =3D (Elf_Addr)(obj->relocbase + rela->r_addend);
>  			break;
> +		case R_AARCH64_TLSDESC:
> +			if (symnum !=3D 0) {
> +				tlsdesc =3D (struct tls_data *)where[1];
> +				if (tlsdesc->index =3D=3D -1)
> +					rtld_tlsdesc_handle_locked(tlsdesc,
> +					    SYMLOOK_IN_PLT | flags, lockstate);
> +			}
> +			break;
>  		default:
>  			rtld_printf("%s: Unhandled relocation %lu\n",
>  			    obj->path, ELF_R_TYPE(rela->r_info));

The fix is here, waiting to be committed:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D214971

I've been running the patch I attached to that ticket for a couple weeks
now without issues in HardenedBSD.

Thanks,

--=20
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

GPG Key ID:          0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE

--pzeqs5vyoptmz7ks
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEKrq2ve9q9Ia+iT2eaoRlj1JFbu4FAlhs84EACgkQaoRlj1JF
bu4b8Q//R9uJ9z5+cjEkGYMYusBbAda6E1WzNegxBFaSUiyCXSH+MjHY8XIwJuA9
f1OGYhCmw8GRaJJk051WsYq+nHSToqzKMZ3hm8i6xYkI65/dog7YcZhACoRbc3rm
kZVP+3if1avI2X8WlDog66Lt9CgEDQB422OKNifEwlS1PV4rl2ddFddLilV972Y5
zkrKXWsbBe9kTmfdmbMtGisZ1ofKb2dyf6bWj0buYAWr/2OB676Uos1edjyGEEaB
R8//tHTE1TX2F0hZr/bx8lZ9lYCd08l5HHZECQxMxfNNOHMRocvIb50Fxj+wp0Dh
Y/uhRH3qQpScwewyko0zBpxmRfTj8pFyq9fLB/grfUjfu9vbKe4ykaFrrAGocRiT
gYuLTE+YVzEdWNdXkqOSK9WzvKGxAq7Jbe6sZGhYnWs5GPeDFW9NL/XU83napY6K
wXfnCPGVTMBz5tGK4pS1/p9IDBYcqMUNj77lNHOb7mpdc3Lawqg5geY0se9ei5T0
/o3z16h5jIYz2hUCWdp0NERT6ExHQOWKRY5VcwS8CN6Pwa1w9zHskd20k+7l9OeW
FKmUEMERydi/lGrg9h2fR3csMPE/nf6t/hlPqLi2/ZYHm0gnu/VLlVbG0w1M+veJ
nI3fbZhrxdy6Qr47GVCz1kf6IJF9zm6t79Q06Q79zEIynov5VmQ=
=exIZ
-----END PGP SIGNATURE-----

--pzeqs5vyoptmz7ks--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170104130715.54fq45whnlellr6u>