compiling ports on rpi3 - relocation 1031

Shawn Webb shawn.webb at hardenedbsd.org
Wed Jan 4 13:07:18 UTC 2017


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,
> > 
> > I get this error when, for instance, trying to compile screen on the rpi3:
> > 
> > ===>  Building for screen-4.4.0_2
> > /usr/local/lib/libintl.so: Unhandled relocation 1031
> > Fatal error
> > *** Error code 1
> > 
> > Stop.
> > make[1]: stopped in /usr/ports/sysutils/screen
> > *** Error code 1
> > 
> > Stop.
> > make: stopped in /usr/ports/sysutils/screen
> > 
> > Is there a workaround for this?
> > 
> > I'm using an image built with sources r311011 ports r430455 and the
> > image was created with crochet.
> > 
> > uname -a
> > FreeBSD rpi3 12.0-CURRENT FreeBSD 12.0-CURRENT #0 7456285(master)-dirty:
> > Tue Jan  3 16:25:46 GMT 2017
> > john at localhost:/root/tmp/crochet/work/obj/arm64.aarch64/root/tmp/crochet/fbsd12-src/sys/PEA
> >  arm64
> 
> This is TLSDESC relocation outside PLT.
> 
> Try this (I did not even compiled the changed code).
> 
> 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, int flags,
>  	const Elf_Sym *def;
>  	SymCache *cache;
>  	Elf_Addr *where;
> +	struct tls_data *tlsdesc;
>  	unsigned long symnum;
>  
>  	if ((flags & SYMLOOK_IFUNC) != 0)
> @@ -391,6 +392,14 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags,
>  		case R_AARCH64_RELATIVE:
>  			*where = (Elf_Addr)(obj->relocbase + rela->r_addend);
>  			break;
> +		case R_AARCH64_TLSDESC:
> +			if (symnum != 0) {
> +				tlsdesc = (struct tls_data *)where[1];
> +				if (tlsdesc->index == -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=214971

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

Thanks,

-- 
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

GPG Key ID:          0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/freebsd-arm/attachments/20170104/339ed72e/attachment.sig>


More information about the freebsd-arm mailing list