Re: [PATCH v3 6/9] x86/entry/vdso: include GNU_PROPERTY and GNU_STACK PHDRs

Andrew Cooper <[email protected]>
Newsgroups org.kernel.vger.linux-sgx,org.kernel.vger.linux-kernel,org.kvack.linux-mm
Message-ID <[email protected]>
On 12/11/2025 8:22 pm, H. Peter Anvin wrote:
>  arch/x86/entry/vdso/common/vdso-layout.lds.S | 51 +++++++++++---------
>  1 file changed, 28 insertions(+), 23 deletions(-)
>
> diff --git a/arch/x86/entry/vdso/common/vdso-layout.lds.S b/arch/x86/entry/vdso/common/vdso-layout.lds.S
> index ec1ac191a057..696bacb99ed8 100644
> --- a/arch/x86/entry/vdso/common/vdso-layout.lds.S
> +++ b/arch/x86/entry/vdso/common/vdso-layout.lds.S
> @@ -26,7 +26,7 @@ SECTIONS
>  
>  	. = SIZEOF_HEADERS;
>  
> -	.hash		: { *(.hash) }			:text
> +	.hash		: { *(.hash) }		:text
>  	.gnu.hash	: { *(.gnu.hash) }
>  	.dynsym		: { *(.dynsym) }
>  	.dynstr		: { *(.dynstr) }
> @@ -34,7 +34,7 @@ SECTIONS
>  	.gnu.version_d	: { *(.gnu.version_d) }
>  	.gnu.version_r	: { *(.gnu.version_r) }
>  
> -	.dynamic	: { *(.dynamic) }		:text	:dynamic
> +	.dynamic	: { *(.dynamic) }	:text :dynamic
>  
>  	.rodata		: {
>  		*(.rodata*)
> @@ -45,31 +45,28 @@ SECTIONS
>  		*(.bss*)
>  		*(.dynbss*)
>  		*(.gnu.linkonce.b.*)
> -	}						:text
> +	}					:text
>  
> -	/*
> -	 * Discard .note.gnu.property sections which are unused and have
> -	 * different alignment requirement from vDSO note sections.
> -	 */
> -	/DISCARD/ : {
> +	.note.gnu.property : {
>  		*(.note.gnu.property)
> -	}
> -	.note		: { *(.note.*) }		:text	:note
> -
> -	.eh_frame_hdr	: { *(.eh_frame_hdr) }		:text	:eh_frame_hdr
> -	.eh_frame	: { KEEP (*(.eh_frame)) }	:text
> +	}					:text :note :gnu_property
> +	.note		: {
> +		*(.note*)
> +	}					:text :note
>  
> +	.eh_frame_hdr	: { *(.eh_frame_hdr) }	:text :eh_frame_hdr
> +	.eh_frame	: {
> +		KEEP (*(.eh_frame))
> +		*(.eh_frame.*)
> +	}					:text
>  
>  	/*
>  	 * Text is well-separated from actual data: there's plenty of
>  	 * stuff that isn't used at runtime in between.
> -	 */
> -
> +	*/
>  	.text		: {
>  		*(.text*)
> -	}						:text	=0x90909090,
> -
> -
> +	}					:text	=0x90909090
>  

Almost all of these hunks look to be whitespace changes only.  Was that
intentional?  It certainly makes it harder to read.

>  	.altinstructions	: { *(.altinstructions) }	:text
>  	.altinstr_replacement	: { *(.altinstr_replacement) }	:text
> @@ -87,15 +84,23 @@ SECTIONS
>   * Very old versions of ld do not recognize this name token; use the constant.
>   */
>  #define PT_GNU_EH_FRAME	0x6474e550
> +#define PT_GNU_STACK	0x6474e551
> +#define PT_GNU_PROPERTY	0x6474e553
>  
>  /*
>   * We must supply the ELF program headers explicitly to get just one
>   * PT_LOAD segment, and set the flags explicitly to make segments read-only.
> - */
> +*/

This looks like it wants undoing too.

That said, I do strongly agree with the reasoning behind this patch.

~Andrew
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.