Skip to contentSkip to conversation

Patch "selftests/x86/ldt_get: Add a few additional tests for limits" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Dec 6, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

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

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
selftests-x86-ldt_get-add-a-few-additional-tests-for-limits.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Wed Dec 6 17:39:55 CET 2017

From: Andy Lutomirski <[email protected]>
Date: Sat, 4 Nov 2017 04:19:52 -0700
Subject: selftests/x86/ldt_get: Add a few additional tests for limits

From: Andy Lutomirski <[email protected]>

[ 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.

---
 tools/testing/selftests/x86/ldt_gdt.c |   17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
tools/testing/selftests/x86/ldt_gdt.c +16 -1
@@ -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);
 }
 

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/selftests-x86-ldt_get-add-a-few-additional-tests-for-limits.patch queue-4.9/x86-entry-use-syscall_define-macros-for-sys_modify_ldt.patch queue-4.9/x86-fpu-set-the-xcomp_bv-when-we-fake-up-a-xsaves-area.patch