Skip to contentSkip to conversation

Add Intel umip(User Mode Instruction Prevention) basic function tests

PATCH New Pengfei Xu 2 participants 2 messages Jan 17, 2019 – Jan 23, 2019

lore
Share & tools
lore

Pengfei Xu

author
#0 lore raw

PATCH v6 1/1 Add Intel umip(User Mode Instruction Prevention) basic function tests

umip is a security feature present in new Intel Processors. Intel CPU like ICE lake or newer is required.
When umip enabled, it prevents the execution of certain instructions and situation as below:
when Current Privilege Level (CPL) is greater than 0, user space applications could not access to system-wide settings such as the global and local descriptor tables, the segment selectors to the current task state and the local descriptor table.
umip is enabled by default at boot.
umip will protect below instructions in user mode:
* SGDT - Store Global Descriptor Table
* SIDT - Store Interrupt Descriptor Table
* SLDT - Store Local Descriptor Table
* SMSW - Store Machine Status Word
* STR - Store Task Register
If CPU not support umip, you still could comment cpuinfo check code to verify anyway.

---
 runtest/secure_umip                              |   2 +
 testcases/kernel/security/umip/.gitignore        |   1 +
 testcases/kernel/security/umip/Makefile          |   7 +
 testcases/kernel/security/umip/umip_basic_test.c | 174 +++++++++++++++++++++++
 4 files changed, 184 insertions(+)
 create mode 100644 runtest/secure_umip
 create mode 100644 testcases/kernel/security/umip/.gitignore
 create mode 100644 testcases/kernel/security/umip/Makefile
 create mode 100644 testcases/kernel/security/umip/umip_basic_test.c
runtest/secure_umip new file +2 -0
new file mode 100644
index 000000000..499be3273
@@ -0,0 +1,2 @@
+#DESCRIPTION: CPU security feature UMIP test
+umip_instruction_test umip_basic_test
testcases/kernel/security/umip/.gitignore new file +1 -0
new file mode 100644
index 000000000..a8bb84631
@@ -0,0 +1 @@
+umip_basic_test
testcases/kernel/security/umip/Makefile new file +7 -0
new file mode 100644
index 000000000..18896b6f2
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+top_srcdir		?= ../../../..
+
+include $(top_srcdir)/include/mk/testcases.mk
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/security/umip/umip_basic_test.c new file +174 -0

174 lines not on this page · raw message

Signature · 1 line
2.14.1
#1 lore raw

PATCH v6 1/1 Add Intel umip(User Mode Instruction Prevention) basic function tests

Hi!
Pushed with a few changes, thanks!

* added the kconfig requirement to the tst_test structure
* the whole test is now in #ifdef __x86_64__ (otherwise the asm statements would fail to compile on other architectures)
* moved the runtest entry to kernel_misc
(in order to avoid having runtest files with just one entry)

Signature · 2 lines
Cyril Hrubis
[email protected]