[PATCH v3 5/7] x86/segment: add #define for the last user-visible GDT slot
From: H. Peter Anvin, Intel
Date: Thu Jun 21 2018 - 17:18:49 EST
From: "H. Peter Anvin" <hpa@xxxxxxxxxxxxxxx>
We don't want to advertise to user space how many slots the kernel
GDT has, but user space can trivially find out what the last
user-accessible GDT slot is. Add a #define for that so we can use
that in sizing a regset.
Signed-off-by: H. Peter Anvin (Intel) <hpa@xxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Andy Lutomirski <luto@xxxxxxxxxx>
Cc: Chang S. Bae <chang.seok.bae@xxxxxxxxx>
Cc: Markus T. Metzger <markus.t.metzger@xxxxxxxxx>
---
arch/x86/include/asm/segment.h | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/x86/include/asm/segment.h b/arch/x86/include/asm/segment.h
index e293c122d0d5..5eb809eec048 100644
--- a/arch/x86/include/asm/segment.h
+++ b/arch/x86/include/asm/segment.h
@@ -115,6 +115,11 @@
*/
#define GDT_ENTRIES 32
+/*
+ * Last user-visible GDT slot
+ */
+#define GDT_LAST_USER GDT_ENTRY_DEFAULT_USER_DS
+
/*
* Segment selector values corresponding to the above entries:
*/
@@ -194,6 +199,11 @@
*/
#define GDT_ENTRIES 16
+/*
+ * Last user-visible GDT slot
+ */
+#define GDT_LAST_USER GDT_ENTRY_PER_CPU
+
/*
* Segment selector values corresponding to the above entries:
*
--
2.14.4