Thread (82 messages) 82 messages, 10 authors, 2021-05-21

Re: [PATCH v26 26/30] ELF: Introduce arch_setup_elf_property()

From: Yu, Yu-cheng <hidden>
Date: 2021-05-19 22:15:07
Also in: linux-arch, linux-doc, linux-mm, lkml

On 5/19/2021 11:10 AM, Borislav Petkov wrote:
On Tue, Apr 27, 2021 at 01:43:11PM -0700, Yu-cheng Yu wrote:
quoted
@@ -1951,6 +1951,8 @@ config X86_SHADOW_STACK
  	depends on AS_WRUSS
  	depends on ARCH_HAS_SHADOW_STACK
  	select ARCH_USES_HIGH_VMA_FLAGS
+	select ARCH_USE_GNU_PROPERTY
+	select ARCH_BINFMT_ELF_STATE
		^^^^^^^^

What's that for? Isn't ARCH_USE_GNU_PROPERTY enough?
ARCH_USE_GNU_PROPERTY is for defining parsing functions, e.g.
	arch_parse_elf_property(),
	arch_setup_property().

ARCH_BINFMT_ELF_STATE is for defining "struct arch_elf_state".

However, those parsing functions take (struct arch_elf_state *) as an 
input.  It probably makes sense to have ARCH_USE_GNU_PROPERTY dependent 
on ARCH_BINFMT_ELF_STATE.  It would be ok as-is too.  ARM people might 
have other plans in mind.

[...]
quoted
diff --git a/include/uapi/linux/elf.h b/include/uapi/linux/elf.h
index 30f68b42eeb5..24ba55ba8278 100644
--- a/include/uapi/linux/elf.h
+++ b/include/uapi/linux/elf.h
@@ -455,4 +455,13 @@ typedef struct elf64_note {
  /* Bits for GNU_PROPERTY_AARCH64_FEATURE_1_BTI */
  #define GNU_PROPERTY_AARCH64_FEATURE_1_BTI	(1U << 0)
  
+/* .note.gnu.property types for x86: */
+#define GNU_PROPERTY_X86_FEATURE_1_AND		0xc0000002
Why not 0xc0000001? ARM64 is 0xc0000000...
I just looked at the ABI document.

ARM has GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000

X86 has:
	GNU_PROPERTY_X86_ISA_1_USED	0xc0000000
	GNU_PROPERTY_X86_ISA_1_NEEDED	0xc0000001
	GNU_PROPERTY_X86_FEATURE_1_AND	0xc0000002

Yu-cheng
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help