All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Andy Lutomirski <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: peterz@infradead.org, bpetkov@suse.de,
	torvalds@linux-foundation.org, tglx@linutronix.de,
	luto@kernel.org, linux-kernel@vger.kernel.org, mingo@kernel.org,
	hpa@zytor.com
Subject: [tip:x86/asm] selftests/x86/ldt_get: Add a few additional tests for limits
Date: Tue, 7 Nov 2017 02:18:16 -0800	[thread overview]
Message-ID: <tip-fec8f5ae1715a01c72ad52cb2ecd8aacaf142302@git.kernel.org> (raw)
In-Reply-To: <5601c15ea9b3113d288953fd2838b18bedf6bc67.1509794321.git.luto@kernel.org>

Commit-ID:  fec8f5ae1715a01c72ad52cb2ecd8aacaf142302
Gitweb:     https://git.kernel.org/tip/fec8f5ae1715a01c72ad52cb2ecd8aacaf142302
Author:     Andy Lutomirski <luto@kernel.org>
AuthorDate: Sat, 4 Nov 2017 04:19:52 -0700
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 7 Nov 2017 11:13:43 +0100

selftests/x86/ldt_get: Add a few additional tests for limits

We weren't testing the .limit and .limit_in_pages fields very well.
Add more tests.

This addition seems to trigger the "bits 16:19 are undefined" issue
that was fixed in an earlier patch.  I think that, at least on my
CPU, the high nibble of the limit ends in LAR bits 16:19.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bpetkov@suse.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/5601c15ea9b3113d288953fd2838b18bedf6bc67.1509794321.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 tools/testing/selftests/x86/ldt_gdt.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/x86/ldt_gdt.c b/tools/testing/selftests/x86/ldt_gdt.c
index 3bb42ff..66e5ce5 100644
--- a/tools/testing/selftests/x86/ldt_gdt.c
+++ b/tools/testing/selftests/x86/ldt_gdt.c
@@ -404,9 +404,24 @@ static void do_simple_tests(void)
 	install_invalid(&desc, false);
 
 	desc.seg_not_present = 0;
-	desc.read_exec_only = 0;
 	desc.seg_32bit = 1;
+	desc.read_exec_only = 0;
+	desc.limit = 0xfffff;
+
 	install_valid(&desc, AR_DPL3 | AR_TYPE_RWDATA | AR_S | AR_P | AR_DB);
+
+	desc.limit_in_pages = 1;
+
+	install_valid(&desc, AR_DPL3 | AR_TYPE_RWDATA | AR_S | AR_P | AR_DB | AR_G);
+	desc.read_exec_only = 1;
+	install_valid(&desc, AR_DPL3 | AR_TYPE_RODATA | AR_S | AR_P | AR_DB | AR_G);
+	desc.contents = 1;
+	desc.read_exec_only = 0;
+	install_valid(&desc, AR_DPL3 | AR_TYPE_RWDATA_EXPDOWN | AR_S | AR_P | AR_DB | AR_G);
+	desc.read_exec_only = 1;
+	install_valid(&desc, AR_DPL3 | AR_TYPE_RODATA_EXPDOWN | AR_S | AR_P | AR_DB | AR_G);
+
+	desc.limit = 0;
 	install_invalid(&desc, true);
 }
 

  reply	other threads:[~2017-11-07 10:22 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 ` [PATCH 4/5] selftests/x86/ldt_gdt: Run most existing LDT test cases against the GDT as well Andy Lutomirski
2017-11-07 10:17   ` [tip:x86/asm] " 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-bot for Andy Lutomirski [this message]
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=tip-fec8f5ae1715a01c72ad52cb2ecd8aacaf142302@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=bpetkov@suse.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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.