On Tue, Apr 27, 2021 at 01:43:11PM -0700, Yu-cheng Yu wrote:
quoted hunk ↗ jump to hunk
@@ -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?
+int arch_setup_elf_property(struct arch_elf_state *state)
+{
+ int r = 0;
+
+ if (!IS_ENABLED(CONFIG_X86_SHADOW_STACK))
+ return r;
+
+ memset(¤t->thread.cet, 0, sizeof(struct cet_status));
+
+ if (static_cpu_has(X86_FEATURE_SHSTK)) {
cpu_feature_enabled
+ if (state->gnu_property & GNU_PROPERTY_X86_FEATURE_1_SHSTK)
+ r = shstk_setup();
+ }
+
+ return r;
+}
+#endif
...
quoted hunk ↗ jump to hunk
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...
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette