NetBSD Problem Report #57511

From www@netbsd.org  Fri Jul  7 08:17:57 2023
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 9F5421A923D
	for <gnats-bugs@gnats.NetBSD.org>; Fri,  7 Jul 2023 08:17:57 +0000 (UTC)
Message-Id: <20230707081756.18F281A923E@mollari.NetBSD.org>
Date: Fri,  7 Jul 2023 08:17:56 +0000 (UTC)
From: rokuyama.rk@gmail.com
Reply-To: rokuyama.rk@gmail.com
To: gnats-bugs@NetBSD.org
Subject: ld.elf_so(1) does not support secure PLT for alpha
X-Send-Pr-Version: www-1.0

>Number:         57511
>Notify-List:    riastradh@NetBSD.org
>Category:       port-alpha
>Synopsis:       ld.elf_so(1) does not support secure PLT for alpha
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-alpha-maintainer
>State:          analyzed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 07 08:20:00 +0000 2023
>Closed-Date:    
>Last-Modified:  Sun Apr 20 06:25:01 +0000 2025
>Originator:     Rin Okuyama
>Release:        10.99.4
>Organization:
Internet Initiative Japan Inc.
>Environment:
NetBSD ds10 10.99.4 NetBSD 10.99.4 (GENERIC-$Revision: 1.418 $) #6: Wed Jun 28 19:19:37 JST 2023 rin@latipes:/home/rin/repos/src/sys/arch/alpha/compile/DS10 alpha
>Description:
Dynamic-linked binaries for alpha built with binutils 2.39 crash
due to SIGSEGV in __start, trying to jump into NULL.

This is worked around by forcibly disabling secure PLT option,
introduced by binutils 2.39 for us.

With this option, write permission to .plt section is dropped,
and we need to parse GOT differently as before, see
``if (elf64_alpha_use_secureplt)'' blocks in
external/gpl3/binutils/dist/bfd/elf64-alpha.c.

Also note that there is no official System V (or ELF) ABI
definitions published for alpha.
>How-To-Repeat:
Try to run any dynamically-linked binaries generated by binutils
2.39 on alpha. Then, it will crash due to SIGSEGV.
>Fix:
Add support for secure PLT for ld.elf_so(1) on alpha.

>Release-Note:

>Audit-Trail:
From: "Rin Okuyama" <rin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57511 CVS commit: src/external/gpl3/binutils/dist/bfd
Date: Fri, 7 Jul 2023 08:33:25 +0000

 Module Name:	src
 Committed By:	rin
 Date:		Fri Jul  7 08:33:25 UTC 2023

 Modified Files:
 	src/external/gpl3/binutils/dist/bfd: elf64-alpha.c

 Log Message:
 PR port-alpha/57511 Temporally disable secure PLT for alpha
 until support is added to ld.elf_so(1).


 To generate a diff of this commit:
 cvs rdiff -u -r1.10 -r1.11 src/external/gpl3/binutils/dist/bfd/elf64-alpha.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Rin Okuyama" <rin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57511 CVS commit: src/doc
Date: Fri, 7 Jul 2023 08:39:24 +0000

 Module Name:	src
 Committed By:	rin
 Date:		Fri Jul  7 08:39:24 UTC 2023

 Modified Files:
 	src/doc: HACKS

 Log Message:
 doc/HACKS: Document PR port-alpha/57511


 To generate a diff of this commit:
 cvs rdiff -u -r1.236 -r1.237 src/doc/HACKS

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Rin Okuyama" <rin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57511 CVS commit: src/external/gpl3/gdb/dist/bfd
Date: Thu, 17 Aug 2023 07:40:20 +0000

 Module Name:	src
 Committed By:	rin
 Date:		Thu Aug 17 07:40:20 UTC 2023

 Modified Files:
 	src/external/gpl3/gdb/dist/bfd: configure

 Log Message:
 gdb/bfd: Disable secure PLT for NetBSD/alpha, lost during merge

 Until our ld.elf_so supports it, see PR port-alpha/57511

 This does not affect platforms other than alpha.

 XXX
 mknative later


 To generate a diff of this commit:
 cvs rdiff -u -r1.16 -r1.17 src/external/gpl3/gdb/dist/bfd/configure

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Taylor R Campbell <riastradh@NetBSD.org>
To: rokuyama.rk@gmail.com, thorpej@NetBSD.org
Cc: gnats-bugs@NetBSD.org, netbsd-bugs@NetBSD.org
Subject: Re: port-alpha/57511: ld.elf_so(1) does not support secure PLT for alpha
Date: Thu, 17 Apr 2025 19:29:46 +0000

 This is a multi-part message in MIME format.
 --=_k+R2A0jPCfl/fFvU84G4E4n02s6AxFtx

 The attached patch addresses PR 57511 and PR 57717 by implementing
 support for secureplt in ld.elf_so on alpha and flipping it back on by
 default (as upstream has it) in binutils.

 I also took the liberty of leaving some more explanatory comments
 about what's going on in rtld_start.S, based on examination of PLT
 headers actually generated by binutils.

 Missing: automatic tests of programs built with `-Wl,--secureplt',
 `-Wl,--no-secureplt', and `-Wl,--no-secureplt,--traditional-format',
 so we make sure all three paths remain exercised.

 Review welcome!  I hope my accent isn't showing through too much in
 the assembly code as a non-native Alpha speaker.

 --=_k+R2A0jPCfl/fFvU84G4E4n02s6AxFtx
 Content-Type: text/plain; charset="ISO-8859-1"; name="pr57511-alphasecureplt"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: attachment; filename="pr57511-alphasecureplt.patch"

 # HG changeset patch
 # User Taylor R Campbell <riastradh@NetBSD.org>
 # Date 1744917745 0
 #      Thu Apr 17 19:22:25 2025 +0000
 # Branch trunk
 # Node ID ff8aa06d8f252223c352e0560098b25e54967e80
 # Parent  438b14ea036dd2bd2e1109f5e08f7d74109e6fae
 # EXP-Topic riastradh-pr57511-alphasecureplt
 ld.elf_so on alpha: Add support for secureplt.

 Enable secureplt by default in binutils now that ld.elf_so can handle
 it.

 PR port-alpha/57511: ld.elf_so(1) does not support secure PLT for alpha
 PR port-alpha/57717: Alpha linker generates LOAD segments (and
   generates warnings about them)

 diff -r 438b14ea036d -r ff8aa06d8f25 doc/HACKS
 --- a/doc/HACKS	Thu Apr 17 13:43:59 2025 +0000
 +++ b/doc/HACKS	Thu Apr 17 19:22:25 2025 +0000
 @@ -949,17 +949,6 @@ descr
  	kernel cannot execute /sbin/init.
  kcah
 =20
 -hack	Disable secure PLT for alpha
 -cdate	Fri Jul  7 08:33:25 UTC 2023
 -who	rin
 -port	alpha
 -file	src/external/gpl3/binutils/dist/bfd/elf64-alpha.c: 1.11
 -pr	port-alpha/57511
 -descr
 -	Temporally disable secure PLT support, introduced by
 -	binutils 2.39 for us. We need its support to ld.elf_so(1).
 -kcah
 -
  hack	openssl: Disable ec_nistp_64_gcc_128 on aarch64eb
  cdate	Sat Jul  8 23:54:27 UTC 2023
  who	rin
 diff -r 438b14ea036d -r ff8aa06d8f25 external/gpl3/binutils/dist/bfd/elf64-=
 alpha.c
 --- a/external/gpl3/binutils/dist/bfd/elf64-alpha.c	Thu Apr 17 13:43:59 202=
 5 +0000
 +++ b/external/gpl3/binutils/dist/bfd/elf64-alpha.c	Thu Apr 17 19:22:25 202=
 5 +0000
 @@ -83,7 +83,7 @@
 =20
  /* Set by ld emulation.  Putting this into the link_info or hash structure
     is simply working too hard.  */
 -#if defined(USE_SECUREPLT) && 0 /* XXX port-alpha/57511 */
 +#if defined(USE_SECUREPLT)
  bool elf64_alpha_use_secureplt =3D true;
  #else
  bool elf64_alpha_use_secureplt =3D false;
 diff -r 438b14ea036d -r ff8aa06d8f25 libexec/ld.elf_so/arch/alpha/alpha_rel=
 oc.c
 --- a/libexec/ld.elf_so/arch/alpha/alpha_reloc.c	Thu Apr 17 13:43:59 2025 +=
 0000
 +++ b/libexec/ld.elf_so/arch/alpha/alpha_reloc.c	Thu Apr 17 19:22:25 2025 +=
 0000
 @@ -78,6 +78,7 @@
  #define	adbg(x)		/* nothing */
  #endif
 =20
 +void _rtld_bind_start_secureplt(void);
  void _rtld_bind_start(void);
  void _rtld_bind_start_old(void);
  void _rtld_relocate_nonplt_self(Elf_Dyn *, Elf_Addr);
 @@ -91,7 +92,19 @@ void
  	uint32_t word0;
 =20
  	/*
 -	 * The PLTGOT on the Alpha looks like this:
 +	 * If we're using Alpha secureplt, the PLTGOT points to the
 +	 * .got.plt section.  Just fill in the rtld binding stub and
 +	 * we're done -- we're not writing to instruction memory, so no
 +	 * imb needed.
 +	 */
 +	if (obj->secureplt) {
 +		obj->pltgot[0] =3D (Elf_Addr) _rtld_bind_start_secureplt;
 +		obj->pltgot[1] =3D (Elf_Addr) obj;
 +		return;
 +	}
 +
 +	/*
 +	 * The non-secureplt PLTGOT on the Alpha looks like this:
  	 *
  	 *	PLT HEADER
  	 *	.
 @@ -418,7 +431,8 @@ static inline int
  		 *
  		 * Note if the shared object uses the old PLT format, then
  		 * we cannot patch up the PLT safely, and so we skip it
 -		 * in that case[*].
 +		 * in that case[*].  And if the shared object has a read-only
 +		 * secureplt, then we also skip it.
  		 *
  		 * [*] Actually, if we're not doing lazy-binding, then
  		 * we *can* (and do) patch up this PLT entry; the PLTGOT
 @@ -426,6 +440,10 @@ static inline int
  		 * so this test will fail as it would for the new PLT
  		 * entry format.
  		 */
 +		if (obj->secureplt) {
 +			rdbg(("  secureplt format"));
 +			goto out;
 +		}
  		if (obj->pltgot[2] =3D=3D (Elf_Addr) &_rtld_bind_start_old) {
  			rdbg(("  old PLT format"));
  			goto out;
 diff -r 438b14ea036d -r ff8aa06d8f25 libexec/ld.elf_so/arch/alpha/rtld_star=
 t.S
 --- a/libexec/ld.elf_so/arch/alpha/rtld_start.S	Thu Apr 17 13:43:59 2025 +0=
 000
 +++ b/libexec/ld.elf_so/arch/alpha/rtld_start.S	Thu Apr 17 19:22:25 2025 +0=
 000
 @@ -92,7 +92,7 @@ END(_rtld_start)
  	lda	sp, -168(sp)					;	\
  	stq	ra, 0(sp)					;	\
  	stq	v0, 8(sp)					;	\
 -	stq	t0, 16(sp)					;	\
 +	stq	t0, 16(sp)	/* XXX t0-t7 necessary? */	;	\
  	stq	t1, 24(sp)					;	\
  	stq	t2, 32(sp)					;	\
  	stq	t3, 40(sp)					;	\
 @@ -106,7 +106,7 @@ END(_rtld_start)
  	stq	a3, 104(sp)					;	\
  	stq	a4, 112(sp)					;	\
  	stq	a5, 120(sp)					;	\
 -	stq	t8, 128(sp)					;	\
 +	stq	t8, 128(sp)	/* XXX t8-t11 necessary? */	;	\
  	stq	t9, 136(sp)					;	\
  	stq	t10, 144(sp)					;	\
  	stq	t11, 152(sp)					;	\
 @@ -119,7 +119,7 @@ END(_rtld_start)
  	br	t0, 1f						;	\
  1:	LDGP(t0)
 =20
 -#define	RTLD_BIND_START_EPILOGUE					\
 +#define	RTLD_BIND_START_EPILOGUE(imb)					\
  	/* Move the destination address into position. */		\
  	mov	v0, pv						;	\
  									\
 @@ -157,7 +157,77 @@ 1:	LDGP(t0)
  	jmp	zero, (pv)
 =20
  /*
 - * Lazy binding entry point, called via PLT.
 + * _rtld_bind_start_secureplt(_rtld_bind_start_secureplt@pv, obj@at,
 + *     (sizeof(Elf_Rela)*index)@t11)
 + *
 + *	Lazy binding entry point, called via PLT with read-only
 + *	secureplt, when DT_ALPHA_PLTRO is set.  The PLT itself looks
 + *	something like this:
 + *
 + *	_PROCEDURE_LINKAGE_TABLE_:
 + *		subq	pv, at, t11	// t11 :=3D pv - ent0 =3D 4*index
 + *		s4subq	t11, t11, t11	// t11 :=3D 12*index
 + *		addq	t11, t11, t11	// t11 :=3D 24*index
 + *					//      =3D sizeof(Elf_Rela)*index
 + *		ldah	at, ...(at)	// at  :=3D PLTGOT
 + *		lda	at, ...(at)
 + *		ldq	pv, 0(at)	// pv  :=3D PLTGOT[0]
 + *					//      =3D _rtld_bind_start_secureplt
 + *		ldq	at, 8(at)	// at  :=3D PLTGOT[1]
 + *					//	=3D obj
 + *		jmp	(pv)
 + *	0:	br	at, _PROCEDURE_LINKAGE_TABLE_	// at :=3D ent0
 + *	ent0:	br	0b		// pv - ent0 =3D 0 =3D 4*index
 + *	ent1:	br	0b		// pv - ent0 =3D 4 =3D 4*index
 + *	ent2:	br	0b		// pv - ent0 =3D 8 =3D 4*index
 + *	...
 + */
 +NESTED_NOPROFILE(_rtld_bind_start_secureplt, 0, 168, ra, 0, 0)
 +
 +	RTLD_BIND_START_PROLOGUE
 +
 +	/* Set up the arguments for _rtld_bind. */
 +	mov	at_reg, a0
 +	mov	t11, a1
 +
 +	CALL(_rtld_bind)
 +
 +	RTLD_BIND_START_EPILOGUE(/* no text writes, so no imb */)
 +
 +END(_rtld_bind_start_secureplt)
 +
 +/*
 + * _rtld_bind_start(_rtld_bind_start@pv, &PLTGOT[2]@pv,
 + *     (ent0 + 4*(index + 1))@at)
 + *
 + *	Lazy binding entry point, called via PLT with read/write
 + *	non-secureplt, when DT_ALPHA_PLTRO is not set.  The PLT itself
 + *	looks something like this at program startup, with PLTGOT (an
 + *	array of 64-bit Elf_Addr) pointing at _PROCEDURE_LINKAGE_TABLE_
 + *	and PLTGOT[2] and PLTGOT[3] initialized by _rtld_setup_pltgot:
 + *
 + *	_PROCEDURE_LINKAGE_TABLE_:
 + *		br	pv, .Lref	// pv  :=3D .Lref
 + *	.Lref:	ldq	pv, 12(pv)	// pv  :=3D PLTGOT[2]
 + *					        =3D _rtld_bind_start
 + *		unop			// no-op for alignment
 + *		jmp	pv, (pv)	// pv  :=3D &PLTGOT[2]
 + *		.qword	(_rtld_bind_start)	// PLTGOT[2]
 + *		.qword	(object pointer)	// PLTGOT[3]
 + *	ent0:	br	at, _PROCEDURE_LINKAGE_TABLE_
 + *		unop			// space for adjusted stub
 + *		unop			// space for adjusted stub
 + *	ent1:	br	at, _PROCEDURE_LINKAGE_TABLE_
 + *		unop
 + *		unop
 + *	ent2:	br	at, _PROCEDURE_LINKAGE_TABLE_
 + *		unop
 + *		unop
 + *	...
 + *
 + *	Note: Distance from &PLTGOT[2] (pv) to ent[0] + 4 (at) is 20
 + *	bytes, and each ent[index] + 4 (at) after that is separated by
 + *	3 instructions, i.e., 12 bytes.
   */
  NESTED_NOPROFILE(_rtld_bind_start, 0, 168, ra, 0, 0)
 =20
 @@ -171,13 +241,37 @@ NESTED_NOPROFILE(_rtld_bind_start, 0, 16
 =20
  	CALL(_rtld_bind)
 =20
 -	RTLD_BIND_START_EPILOGUE
 +	RTLD_BIND_START_EPILOGUE(imb)
 =20
  END(_rtld_bind_start)
 =20
  /*
 - * Lazy binding entry point, called via PLT.  This version is for the
 - * old PLT entry format.
 + * _rtld_bind_start_old(&PLTGOT[2]@pv, (sizeof(Elf_Rela)*index)@at)
 + *
 + *	Lazy binding entry point, called via PLT.  This version is for
 + *	the old PLT entry format, for which the PLT looks something
 + *	like this at program startup, with PLTGOT (an array of 64-bit
 + *	Elf_Addr) pointing at _PROCEDURE_LINKAGE_TABLE_, and PLTGOT[2]
 + *	and PLTGOT[3] initialized by _rtld_setup_pltgot:
 + *
 + *	_PROCEDURE_LINKAGE_TABLE_:
 + *		br	pv, 1f		// pv  :=3D .Lref
 + *	.Lref:	ldq	pv, 12(pv)	// pv  :=3D PLTGOT[2]
 + *					        =3D _rtld_bind_start
 + *		unop			// no-op for alignment
 + *		jmp	pv, (pv)	// pv  :=3D &PLTGOT[2]
 + *		.qword	(_rtld_bind_start)	// PLTGOT[2]
 + *		.qword	(object pointer)	// PLTGOT[3]
 + *	ent0:	ldah	at, 0		// at  :=3D 24*0
 + *		lda	at, 0(at)	//      =3D sizeof(Elf_Rela)*index
 + *		br	_PROCEDURE_LINKAGE_TABLE_
 + *	ent1:	ldah	at, 0		// at  :=3D 24*1
 + *		lda	at, 24(at)	//      =3D sizeof(Elf_Rela)*index
 + *		br	_PROCEDURE_LINKAGE_TABLE_
 + *	ent3:	ldah	at, 0		// at  :=3D 24*2
 + *		lda	at, 48(at)	//      =3D sizeof(Elf_Rela)*index
 + *		br	_PROCEDURE_LINKAGE_TABLE_
 + *	...
   */
  NESTED_NOPROFILE(_rtld_bind_start_old, 0, 168, ra, 0, 0)
 =20
 @@ -189,6 +283,6 @@ NESTED_NOPROFILE(_rtld_bind_start_old, 0
 =20
  	CALL(_rtld_bind)
 =20
 -	RTLD_BIND_START_EPILOGUE
 +	RTLD_BIND_START_EPILOGUE(imb)
 =20
  END(_rtld_bind_start_old)
 diff -r 438b14ea036d -r ff8aa06d8f25 libexec/ld.elf_so/headers.c
 --- a/libexec/ld.elf_so/headers.c	Thu Apr 17 13:43:59 2025 +0000
 +++ b/libexec/ld.elf_so/headers.c	Thu Apr 17 19:22:25 2025 +0000
 @@ -347,6 +347,11 @@ void
  			break;
  #endif
 =20
 +#ifdef __alpha__
 +		case DT_ALPHA_PLTRO:
 +			obj->secureplt =3D (dynp->d_un.d_val !=3D 0);
 +			break;
 +#endif
  #ifdef __mips__
  		case DT_MIPS_LOCAL_GOTNO:
  			obj->local_gotno =3D dynp->d_un.d_val;
 diff -r 438b14ea036d -r ff8aa06d8f25 libexec/ld.elf_so/rtld.h
 --- a/libexec/ld.elf_so/rtld.h	Thu Apr 17 13:43:59 2025 +0000
 +++ b/libexec/ld.elf_so/rtld.h	Thu Apr 17 19:22:25 2025 +0000
 @@ -218,6 +218,9 @@ typedef struct Struct_Obj_Entry {
  					   dlopen'ed */
  			phdr_loaded:1,	/* Phdr is loaded and doesn't need to
  					 * be freed. */
 +#ifdef __alpha__
 +			secureplt:1,	/* True if PLT is read-only format */
 +#endif
  #if defined(__HAVE_TLS_VARIANT_I) || defined(__HAVE_TLS_VARIANT_II)
  			tls_static:1,	/* True if static TLS offset
  					 * has been allocated */
 diff -r 438b14ea036d -r ff8aa06d8f25 sys/arch/alpha/include/elf_machdep.h
 --- a/sys/arch/alpha/include/elf_machdep.h	Thu Apr 17 13:43:59 2025 +0000
 +++ b/sys/arch/alpha/include/elf_machdep.h	Thu Apr 17 19:22:25 2025 +0000
 @@ -74,4 +74,7 @@
 =20
  #define	R_TYPE(name)		__CONCAT(R_ALPHA_,name)
 =20
 +/* Alpha dynamic tags */
 +#define	DT_ALPHA_PLTRO		0x70000000	/* secure (read-only) PLT */
 +
  #endif /* _ALPHA_ELF_MACHDEP_H_ */

 --=_k+R2A0jPCfl/fFvU84G4E4n02s6AxFtx--

State-Changed-From-To: open->analyzed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Thu, 17 Apr 2025 22:10:35 +0000
State-Changed-Why:
patch posted


From: Jason Thorpe <thorpej@me.com>
To: Taylor Campbell <riastradh@NetBSD.org>
Cc: Rin Okuyama <rokuyama.rk@gmail.com>,
 Jason Thorpe <thorpej@NetBSD.org>,
 "gnats-bugs@netbsd.org" <gnats-bugs@NetBSD.org>,
 "netbsd-bugs@netbsd.org" <netbsd-bugs@NetBSD.org>
Subject: Re: port-alpha/57511: ld.elf_so(1) does not support secure PLT for
 alpha
Date: Fri, 18 Apr 2025 09:00:17 -0700

 > On Apr 17, 2025, at 12:29=E2=80=AFPM, Taylor R Campbell =
 <riastradh@NetBSD.org> wrote:
 >=20
 > The attached patch addresses PR 57511 and PR 57717 by implementing
 > support for secureplt in ld.elf_so on alpha and flipping it back on by
 > default (as upstream has it) in binutils.
 >=20
 > I also took the liberty of leaving some more explanatory comments
 > about what's going on in rtld_start.S, based on examination of PLT
 > headers actually generated by binutils.
 >=20
 > Missing: automatic tests of programs built with `-Wl,--secureplt',
 > `-Wl,--no-secureplt', and `-Wl,--no-secureplt,--traditional-format',
 > so we make sure all three paths remain exercised.
 >=20
 > Review welcome!  I hope my accent isn't showing through too much in
 > the assembly code as a non-native Alpha speaker.
 > <pr57511-alphasecureplt.patch>

 Looks good to me.  I do have concerns about the performance implications =
 of large programs that end up with multiple GOTs, but that=E2=80=99s an =
 issue with the format, not with the change itself.

 -- thorpej

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57511 CVS commit: src
Date: Fri, 18 Apr 2025 17:56:50 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Fri Apr 18 17:56:50 UTC 2025

 Modified Files:
 	src/libexec/ld.elf_so: headers.c rtld.h
 	src/libexec/ld.elf_so/arch/alpha: alpha_reloc.c rtld_start.S
 	src/sys/arch/alpha/include: elf_machdep.h

 Log Message:
 ld.elf_so on alpha: Add support for secureplt.

 ok thorpej

 PR port-alpha/57511: ld.elf_so(1) does not support secure PLT for alpha
 PR port-alpha/57717: Alpha linker generates LOAD segments (and
   generates warnings about them)


 To generate a diff of this commit:
 cvs rdiff -u -r1.73 -r1.74 src/libexec/ld.elf_so/headers.c
 cvs rdiff -u -r1.147 -r1.148 src/libexec/ld.elf_so/rtld.h
 cvs rdiff -u -r1.45 -r1.46 src/libexec/ld.elf_so/arch/alpha/alpha_reloc.c
 cvs rdiff -u -r1.16 -r1.17 src/libexec/ld.elf_so/arch/alpha/rtld_start.S
 cvs rdiff -u -r1.15 -r1.16 src/sys/arch/alpha/include/elf_machdep.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Taylor R Campbell <riastradh@NetBSD.org>
To: Jason Thorpe <thorpej@me.com>
Cc: Rin Okuyama <rokuyama.rk@gmail.com>,
	Jason Thorpe <thorpej@NetBSD.org>,
	gnats-bugs@NetBSD.org, netbsd-bugs@NetBSD.org
Subject: Re: port-alpha/57511: ld.elf_so(1) does not support secure PLT for
	alpha
Date: Fri, 18 Apr 2025 18:20:18 +0000

 > Date: Fri, 18 Apr 2025 09:00:17 -0700
 > From: Jason Thorpe <thorpej@me.com>
 > 
 > Looks good to me.  I do have concerns about the performance
 > implications of large programs that end up with multiple GOTs, but
 > that's an issue with the format, not with the change itself.

 Thanks!  I split it up into two commits to make it easier to pull them
 up separately if we want: one to add support to ld.elf_so, the other
 to remove our local hack disabling secureplt by default in binutils
 (and we could always put -Wl,--no-secureplt in bsd.*.mk in a third
 commit, of course).

 How is the multiple-GOT issue different from other architectures?

From: "Taylor R Campbell" <riastradh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/57511 CVS commit: src
Date: Fri, 18 Apr 2025 18:21:17 +0000

 Module Name:	src
 Committed By:	riastradh
 Date:		Fri Apr 18 18:21:17 UTC 2025

 Modified Files:
 	src/doc: HACKS
 	src/external/gpl3/binutils/dist/bfd: elf64-alpha.c

 Log Message:
 binutils: Remove local hack to disable secureplt by default on alpha.

 ld.elf_so can handle it now, so there's no need to patch it out of
 binutils.  Users can always use -Wl,--no-secureplt to disable it if
 they want.

 PR port-alpha/57511: ld.elf_so(1) does not support secure PLT for alpha
 PR port-alpha/57717: Alpha linker generates LOAD segments (and
   generates warnings about them)


 To generate a diff of this commit:
 cvs rdiff -u -r1.250 -r1.251 src/doc/HACKS
 cvs rdiff -u -r1.12 -r1.13 src/external/gpl3/binutils/dist/bfd/elf64-alpha.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Rin Okuyama <rokuyama.rk@gmail.com>
To: Taylor R Campbell <riastradh@NetBSD.org>, Jason Thorpe <thorpej@me.com>
Cc: gnats-bugs@NetBSD.org, netbsd-bugs@NetBSD.org
Subject: Re: port-alpha/57511: ld.elf_so(1) does not support secure PLT for
 alpha
Date: Sun, 20 Apr 2025 15:23:52 +0900

 On 2025/04/19 3:20, Taylor R Campbell wrote:
 >> Date: Fri, 18 Apr 2025 09:00:17 -0700
 >> From: Jason Thorpe <thorpej@me.com>
 >>
 >> Looks good to me.  I do have concerns about the performance
 >> implications of large programs that end up with multiple GOTs, but
 >> that's an issue with the format, not with the change itself.
 > 
 > Thanks!  I split it up into two commits to make it easier to pull them
 > up separately if we want: one to add support to ld.elf_so, the other
 > to remove our local hack disabling secureplt by default in binutils
 > (and we could always put -Wl,--no-secureplt in bsd.*.mk in a third
 > commit, of course).
 > 
 > How is the multiple-GOT issue different from other architectures?

 Thanks for your works!!

 -current as of yesterday works just fine on my AlphaStation DS10:
 no regression for full ATF run, and some pkgsrc's successfully build.

 rin

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.