From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964986AbdKGKV2 (ORCPT ); Tue, 7 Nov 2017 05:21:28 -0500 Received: from terminus.zytor.com ([65.50.211.136]:41321 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932920AbdKGKVZ (ORCPT ); Tue, 7 Nov 2017 05:21:25 -0500 Date: Tue, 7 Nov 2017 02:17:52 -0800 From: tip-bot for Andy Lutomirski Message-ID: Cc: mingo@kernel.org, luto@kernel.org, tglx@linutronix.de, hpa@zytor.com, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, bpetkov@suse.de, peterz@infradead.org Reply-To: mingo@kernel.org, luto@kernel.org, tglx@linutronix.de, hpa@zytor.com, linux-kernel@vger.kernel.org, torvalds@linux-foundation.org, bpetkov@suse.de, peterz@infradead.org In-Reply-To: <686a1eda63414da38fcecc2412db8dba1ae40581.1509794321.git.luto@kernel.org> References: <686a1eda63414da38fcecc2412db8dba1ae40581.1509794321.git.luto@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/asm] selftests/x86/ldt_gdt: Run most existing LDT test cases against the GDT as well Git-Commit-ID: adedf2893c192dd09b1cc2f2dcfdd7cad99ec49d 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: adedf2893c192dd09b1cc2f2dcfdd7cad99ec49d Gitweb: https://git.kernel.org/tip/adedf2893c192dd09b1cc2f2dcfdd7cad99ec49d Author: Andy Lutomirski AuthorDate: Sat, 4 Nov 2017 04:19:51 -0700 Committer: Ingo Molnar CommitDate: Tue, 7 Nov 2017 11:13:43 +0100 selftests/x86/ldt_gdt: Run most existing LDT test cases against the GDT as well 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 Cc: Borislav Petkov Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/686a1eda63414da38fcecc2412db8dba1ae40581.1509794321.git.luto@kernel.org Signed-off-by: Ingo Molnar --- 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 45f3024..3bb42ff 100644 --- a/tools/testing/selftests/x86/ldt_gdt.c +++ b/tools/testing/selftests/x86/ldt_gdt.c @@ -189,7 +189,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)