From: Pengfei Xu <pengfei.xu@intel.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] umip_basic_test.c: update umip basic test for new kernel v5.4
Date: Thu, 3 Oct 2019 23:50:01 +0800 [thread overview]
Message-ID: <20191003155001.17751-1-pengfei.xu@intel.com> (raw)
After linux kernel v5.4 mainline, 64bit SGDT SIDT SMSW will return
dummy value and not trigger SIGSEGV due to kernel code change.
For detailed kernel update info, you could check v5.4 commit:
x86/umip: Add emulation (spoofing) for UMIP covered instructions in
64-bit processes as well
Signed-off-by: Pengfei Xu <pengfei.xu@intel.com>
---
testcases/kernel/security/umip/umip_basic_test.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/testcases/kernel/security/umip/umip_basic_test.c b/testcases/kernel/security/umip/umip_basic_test.c
index 37850ef9f..5a2b71013 100644
--- a/testcases/kernel/security/umip/umip_basic_test.c
+++ b/testcases/kernel/security/umip/umip_basic_test.c
@@ -112,6 +112,25 @@ static void verify_umip_instruction(unsigned int n)
SAFE_WAITPID(pid, &status, 0);
+ switch (n) {
+ case 0:
+ case 1:
+ case 3:
+ /* after linux kernel v5.4 mainline, 64bit SGDT SIDT SMSW will return
+ dummy value and not trigger SIGSEGV due to kernel code change */
+ if ((tst_kvercmp(5, 4, 0)) >= 0) {
+ tst_res(TINFO, "Linux kernel version is v5.4 or after than v5.4");
+ if (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV) {
+ tst_res(TFAIL, "Got SIGSEGV");
+ return;
+ }
+ tst_res(TPASS, "Didn't receive SIGSEGV, child exited with %s",
+ tst_strstatus(status));
+ return;
+ } else
+ tst_res(TINFO, "Linux kernel version is before than v5.4");
+ }
+
if (WIFSIGNALED(status) && WTERMSIG(status) == SIGSEGV) {
tst_res(TPASS, "Got SIGSEGV");
return;
--
2.14.1
next reply other threads:[~2019-10-03 15:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-03 15:50 Pengfei Xu [this message]
2019-10-18 13:26 ` [LTP] [PATCH v2] umip_basic_test.c: update umip basic test for new kernel v5.4 Cyril Hrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191003155001.17751-1-pengfei.xu@intel.com \
--to=pengfei.xu@intel.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox