From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965028AbdKGKWG (ORCPT ); Tue, 7 Nov 2017 05:22:06 -0500 Received: from terminus.zytor.com ([65.50.211.136]:56393 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964989AbdKGKV5 (ORCPT ); Tue, 7 Nov 2017 05:21:57 -0500 Date: Tue, 7 Nov 2017 02:18:16 -0800 From: tip-bot for Andy Lutomirski Message-ID: 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 Reply-To: bpetkov@suse.de, peterz@infradead.org, tglx@linutronix.de, torvalds@linux-foundation.org, mingo@kernel.org, linux-kernel@vger.kernel.org, luto@kernel.org, hpa@zytor.com In-Reply-To: <5601c15ea9b3113d288953fd2838b18bedf6bc67.1509794321.git.luto@kernel.org> References: <5601c15ea9b3113d288953fd2838b18bedf6bc67.1509794321.git.luto@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/asm] selftests/x86/ldt_get: Add a few additional tests for limits Git-Commit-ID: fec8f5ae1715a01c72ad52cb2ecd8aacaf142302 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: fec8f5ae1715a01c72ad52cb2ecd8aacaf142302 Gitweb: https://git.kernel.org/tip/fec8f5ae1715a01c72ad52cb2ecd8aacaf142302 Author: Andy Lutomirski AuthorDate: Sat, 4 Nov 2017 04:19:52 -0700 Committer: Ingo Molnar 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 Cc: Borislav Petkov Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/5601c15ea9b3113d288953fd2838b18bedf6bc67.1509794321.git.luto@kernel.org Signed-off-by: Ingo Molnar --- 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); }