Skip to content

Commit fec8f5a

Browse files
amlutoIngo Molnar
authored andcommitted
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 <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: http://lkml.kernel.org/r/5601c15ea9b3113d288953fd2838b18bedf6bc67.1509794321.git.luto@kernel.org Signed-off-by: Ingo Molnar <[email protected]>
1 parent adedf28 commit fec8f5a

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

tools/testing/selftests/x86/ldt_gdt.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,9 +404,24 @@ static void do_simple_tests(void)
404404
install_invalid(&desc, false);
405405

406406
desc.seg_not_present = 0;
407-
desc.read_exec_only = 0;
408407
desc.seg_32bit = 1;
408+
desc.read_exec_only = 0;
409+
desc.limit = 0xfffff;
410+
409411
install_valid(&desc, AR_DPL3 | AR_TYPE_RWDATA | AR_S | AR_P | AR_DB);
412+
413+
desc.limit_in_pages = 1;
414+
415+
install_valid(&desc, AR_DPL3 | AR_TYPE_RWDATA | AR_S | AR_P | AR_DB | AR_G);
416+
desc.read_exec_only = 1;
417+
install_valid(&desc, AR_DPL3 | AR_TYPE_RODATA | AR_S | AR_P | AR_DB | AR_G);
418+
desc.contents = 1;
419+
desc.read_exec_only = 0;
420+
install_valid(&desc, AR_DPL3 | AR_TYPE_RWDATA_EXPDOWN | AR_S | AR_P | AR_DB | AR_G);
421+
desc.read_exec_only = 1;
422+
install_valid(&desc, AR_DPL3 | AR_TYPE_RODATA_EXPDOWN | AR_S | AR_P | AR_DB | AR_G);
423+
424+
desc.limit = 0;
410425
install_invalid(&desc, true);
411426
}
412427

0 commit comments

Comments
 (0)