mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: alexander.levin@verizon.com
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>,
	Borislav Petkov <bpetkov@suse.de>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>,
	alexander.levin@verizon.com
Subject: [PATCH AUTOSEL for 4.9 03/24] selftests/x86/ldt_get: Add a few additional tests for limits
Date: Wed, 22 Nov 2017 22:26:11 +0000	[thread overview]
Message-ID: <20171122222604.20122-3-alexander.levin@verizon.com> (raw)
In-Reply-To: <20171122222604.20122-1-alexander.levin@verizon.com>

From: Andy Lutomirski <luto@kernel.org>

[ Upstream commit fec8f5ae1715a01c72ad52cb2ecd8aacaf142302 ]

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>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
---
 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 e717fed80219..f936a3cd3e35 100644
--- a/tools/testing/selftests/x86/ldt_gdt.c
+++ b/tools/testing/selftests/x86/ldt_gdt.c
@@ -360,9 +360,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);
 }
 
-- 
2.11.0

  parent reply	other threads:[~2017-11-22 22:37 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-22 22:26 [PATCH AUTOSEL for 4.9 01/24] ima: fix hash algorithm initialization alexander.levin
2017-11-22 22:26 ` [PATCH AUTOSEL for 4.9 02/24] s390/pci: do not require AIS facility alexander.levin
2017-11-22 22:26 ` [PATCH AUTOSEL for 4.9 05/24] m68k: fix ColdFire node shift size calculation alexander.levin
2017-11-22 22:26 ` [PATCH AUTOSEL for 4.9 04/24] staging: greybus: loopback: Fix iteration count on async path alexander.levin
2017-11-22 22:26 ` alexander.levin [this message]
2017-11-22 22:26 ` [PATCH AUTOSEL for 4.9 06/24] serial: 8250_fintek: Fix rs485 disablement on invalid ioctl() alexander.levin
2017-11-22 22:26 ` [PATCH AUTOSEL for 4.9 07/24] staging: rtl8188eu: avoid a null dereference on pmlmepriv alexander.levin
2017-11-22 22:26 ` [PATCH AUTOSEL for 4.9 10/24] mmc: sdhci-msm: fix issue with power irq alexander.levin
2017-11-22 22:26 ` [PATCH AUTOSEL for 4.9 08/24] spi: sh-msiof: Fix DMA transfer size check alexander.levin
2017-11-22 22:26 ` [PATCH AUTOSEL for 4.9 09/24] spi: spi-axi: fix potential use-after-free after deregistration alexander.levin
2017-11-22 22:26 ` [PATCH AUTOSEL for 4.9 13/24] usb: phy: tahvo: fix error handling in tahvo_usb_probe() alexander.levin
2017-11-22 22:26 ` [PATCH AUTOSEL for 4.9 14/24] serial: 8250: Preserve DLD[7:4] for PORT_XR17V35X alexander.levin
2017-11-22 22:26 ` [PATCH AUTOSEL for 4.9 11/24] usb: dwc2: Fix UDC state tracking alexander.levin
2017-11-22 22:26 ` [PATCH AUTOSEL for 4.9 12/24] usb: dwc2: Error out of dwc2_hsotg_ep_disable() if we're in host mode alexander.levin
2017-11-22 22:26 ` [PATCH AUTOSEL for 4.9 16/24] x86/entry: Use SYSCALL_DEFINE() macros for sys_modify_ldt() alexander.levin
2017-11-22 22:26 ` [PATCH AUTOSEL for 4.9 18/24] EDAC, sb_edac: Fix missing break in switch alexander.levin
2017-11-22 22:26 ` [PATCH AUTOSEL for 4.9 17/24] irqchip/gic: Make quirks matching conditional on init return value alexander.levin
2017-11-22 22:26 ` [PATCH AUTOSEL for 4.9 15/24] kprobes: Use synchronize_rcu_tasks() for optprobe with CONFIG_PREEMPT=y alexander.levin
2017-11-22 22:26 ` [PATCH AUTOSEL for 4.9 21/24] perf test attr: Fix ignored test case result alexander.levin
2017-11-22 22:26 ` [PATCH AUTOSEL for 4.9 22/24] kprobes/x86: Disable preemption in ftrace-based jprobes alexander.levin
2017-11-22 22:26 ` [PATCH AUTOSEL for 4.9 20/24] usbip: tools: Install all headers needed for libusbip development alexander.levin
2017-11-22 22:26 ` [PATCH AUTOSEL for 4.9 19/24] sysrq : fix Show Regs call trace on ARM alexander.levin
2017-11-22 22:26 ` [PATCH AUTOSEL for 4.9 24/24] iio: adc: ti-ads1015: add 10% to conversion wait time alexander.levin
2017-11-22 22:26 ` [PATCH AUTOSEL for 4.9 23/24] tools include: Do not use poison with C++ alexander.levin

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=20171122222604.20122-3-alexander.levin@verizon.com \
    --to=alexander.levin@verizon.com \
    --cc=bpetkov@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=stable@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®