All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@kernel.org>
To: X86 ML <x86@kernel.org>
Cc: Borislav Petkov <bpetkov@suse.de>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andy Lutomirski <luto@kernel.org>
Subject: [PATCH 4/5] selftests/x86/ldt_gdt: Run most existing LDT test cases against the GDT as well
Date: Sat,  4 Nov 2017 04:19:51 -0700	[thread overview]
Message-ID: <686a1eda63414da38fcecc2412db8dba1ae40581.1509794321.git.luto@kernel.org> (raw)
In-Reply-To: <cover.1509794321.git.luto@kernel.org>
In-Reply-To: <cover.1509794321.git.luto@kernel.org>

Now that the main test infrastructure supports the GDT, run tests
that will pass the kernel's GDT permission tests against the GDT.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
 tools/testing/selftests/x86/ldt_gdt.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/x86/ldt_gdt.c b/tools/testing/selftests/x86/ldt_gdt.c
index 337f217d0ae9..05d0d6f49c2c 100644
--- a/tools/testing/selftests/x86/ldt_gdt.c
+++ b/tools/testing/selftests/x86/ldt_gdt.c
@@ -188,7 +188,15 @@ static bool install_valid_mode(const struct user_desc *d, uint32_t ar,
 
 static bool install_valid(const struct user_desc *desc, uint32_t ar)
 {
-	return install_valid_mode(desc, ar, false, true);
+	bool ret = install_valid_mode(desc, ar, false, true);
+
+	if (desc->contents <= 1 && desc->seg_32bit &&
+	    !desc->seg_not_present) {
+		/* Should work in the GDT, too. */
+		install_valid_mode(desc, ar, false, false);
+	}
+
+	return ret;
 }
 
 static void install_invalid(const struct user_desc *desc, bool oldmode)
-- 
2.13.6

  parent reply	other threads:[~2017-11-04 11:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-04 11:19 [PATCH 0/5] Minor selftests improvements Andy Lutomirski
2017-11-04 11:19 ` [PATCH 1/5] selftests/x86/protection_keys: Fix syscall NR redefinition warnings Andy Lutomirski
2017-11-07 10:16   ` [tip:x86/asm] " tip-bot for Andy Lutomirski
2017-11-04 11:19 ` [PATCH 2/5] selftests/x86/ldt_gdt: Robustify against set_thread_area() and LAR oddities Andy Lutomirski
2017-11-07 10:17   ` [tip:x86/asm] " tip-bot for Andy Lutomirski
2017-11-04 11:19 ` [PATCH 3/5] selftests/x86/ldt_gdt: Add infrastructure to test set_thread_area() Andy Lutomirski
2017-11-07 10:17   ` [tip:x86/asm] " tip-bot for Andy Lutomirski
2017-11-04 11:19 ` Andy Lutomirski [this message]
2017-11-07 10:17   ` [tip:x86/asm] selftests/x86/ldt_gdt: Run most existing LDT test cases against the GDT as well tip-bot for Andy Lutomirski
2017-11-04 11:19 ` [PATCH 5/5] selftests/x86/ldt_get: Add a few additional tests for limits Andy Lutomirski
2017-11-07 10:18   ` [tip:x86/asm] " tip-bot for Andy Lutomirski
2017-11-07 10:13 ` [PATCH 0/5] Minor selftests improvements Ingo Molnar

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=686a1eda63414da38fcecc2412db8dba1ae40581.1509794321.git.luto@kernel.org \
    --to=luto@kernel.org \
    --cc=bpetkov@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.