diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-02 02:54:56 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-02 02:54:56 -0400 |
commit | d3b5d35290d729a2518af00feca867385a1b08fa (patch) | |
tree | 7b56c0863d59bc57f7c7dcf5d5665c56b05f1d1b /tools | |
parent | aa2a4b6569d5b10491b606a86e574dff3852597a (diff) | |
parent | 71389703839ebe9cb426c72d5f0bd549592e583c (diff) |
Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 mm updates from Ingo Molnar:
"The main x86 MM changes in this cycle were:
- continued native kernel PCID support preparation patches to the TLB
flushing code (Andy Lutomirski)
- various fixes related to 32-bit compat syscall returning address
over 4Gb in applications, launched from 64-bit binaries - motivated
by C/R frameworks such as Virtuozzo. (Dmitry Safonov)
- continued Intel 5-level paging enablement: in particular the
conversion of x86 GUP to the generic GUP code. (Kirill A. Shutemov)
- x86/mpx ABI corner case fixes/enhancements (Joerg Roedel)
- ... plus misc updates, fixes and cleanups"
* 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (62 commits)
mm, zone_device: Replace {get, put}_zone_device_page() with a single reference to fix pmem crash
x86/mm: Fix flush_tlb_page() on Xen
x86/mm: Make flush_tlb_mm_range() more predictable
x86/mm: Remove flush_tlb() and flush_tlb_current_task()
x86/vm86/32: Switch to flush_tlb_mm_range() in mark_screen_rdonly()
x86/mm/64: Fix crash in remove_pagetable()
Revert "x86/mm/gup: Switch GUP to the generic get_user_page_fast() implementation"
x86/boot/e820: Remove a redundant self assignment
x86/mm: Fix dump pagetables for 4 levels of page tables
x86/mpx, selftests: Only check bounds-vs-shadow when we keep shadow
x86/mpx: Correctly report do_mpx_bt_fault() failures to user-space
Revert "x86/mm/numa: Remove numa_nodemask_from_meminfo()"
x86/espfix: Add support for 5-level paging
x86/kasan: Extend KASAN to support 5-level paging
x86/mm: Add basic defines/helpers for CONFIG_X86_5LEVEL=y
x86/paravirt: Add 5-level support to the paravirt code
x86/mm: Define virtual memory map for 5-level paging
x86/asm: Remove __VIRTUAL_MASK_SHIFT==47 assert
x86/boot: Detect 5-level paging support
x86/mm/numa: Remove numa_nodemask_from_meminfo()
...
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/selftests/x86/ldt_gdt.c | 46 | ||||
-rw-r--r-- | tools/testing/selftests/x86/mpx-mini-test.c | 5 |
2 files changed, 49 insertions, 2 deletions
diff --git a/tools/testing/selftests/x86/ldt_gdt.c b/tools/testing/selftests/x86/ldt_gdt.c index f6121612e769..b9a22f18566a 100644 --- a/tools/testing/selftests/x86/ldt_gdt.c +++ b/tools/testing/selftests/x86/ldt_gdt.c | |||
@@ -409,6 +409,51 @@ static void *threadproc(void *ctx) | |||
409 | } | 409 | } |
410 | } | 410 | } |
411 | 411 | ||
412 | #ifdef __i386__ | ||
413 | |||
414 | #ifndef SA_RESTORE | ||
415 | #define SA_RESTORER 0x04000000 | ||
416 | #endif | ||
417 | |||
418 | /* | ||
419 | * The UAPI header calls this 'struct sigaction', which conflicts with | ||
420 | * glibc. Sigh. | ||
421 | */ | ||
422 | struct fake_ksigaction { | ||
423 | void *handler; /* the real type is nasty */ | ||
424 | unsigned long sa_flags; | ||
425 | void (*sa_restorer)(void); | ||
426 | unsigned char sigset[8]; | ||
427 | }; | ||
428 | |||
429 | static void fix_sa_restorer(int sig) | ||
430 | { | ||
431 | struct fake_ksigaction ksa; | ||
432 | |||
433 | if (syscall(SYS_rt_sigaction, sig, NULL, &ksa, 8) == 0) { | ||
434 | /* | ||
435 | * glibc has a nasty bug: it sometimes writes garbage to | ||
436 | * sa_restorer. This interacts quite badly with anything | ||
437 | * that fiddles with SS because it can trigger legacy | ||
438 | * stack switching. Patch it up. See: | ||
439 | * | ||
440 | * https://sourceware.org/bugzilla/show_bug.cgi?id=21269 | ||
441 | */ | ||
442 | if (!(ksa.sa_flags & SA_RESTORER) && ksa.sa_restorer) { | ||
443 | ksa.sa_restorer = NULL; | ||
444 | if (syscall(SYS_rt_sigaction, sig, &ksa, NULL, | ||
445 | sizeof(ksa.sigset)) != 0) | ||
446 | err(1, "rt_sigaction"); | ||
447 | } | ||
448 | } | ||
449 | } | ||
450 | #else | ||
451 | static void fix_sa_restorer(int sig) | ||
452 | { | ||
453 | /* 64-bit glibc works fine. */ | ||
454 | } | ||
455 | #endif | ||
456 | |||
412 | static void sethandler(int sig, void (*handler)(int, siginfo_t *, void *), | 457 | static void sethandler(int sig, void (*handler)(int, siginfo_t *, void *), |
413 | int flags) | 458 | int flags) |
414 | { | 459 | { |
@@ -420,6 +465,7 @@ static void sethandler(int sig, void (*handler)(int, siginfo_t *, void *), | |||
420 | if (sigaction(sig, &sa, 0)) | 465 | if (sigaction(sig, &sa, 0)) |
421 | err(1, "sigaction"); | 466 | err(1, "sigaction"); |
422 | 467 | ||
468 | fix_sa_restorer(sig); | ||
423 | } | 469 | } |
424 | 470 | ||
425 | static jmp_buf jmpbuf; | 471 | static jmp_buf jmpbuf; |
diff --git a/tools/testing/selftests/x86/mpx-mini-test.c b/tools/testing/selftests/x86/mpx-mini-test.c index 616ee9673339..a8df159a8924 100644 --- a/tools/testing/selftests/x86/mpx-mini-test.c +++ b/tools/testing/selftests/x86/mpx-mini-test.c | |||
@@ -404,8 +404,6 @@ void handler(int signum, siginfo_t *si, void *vucontext) | |||
404 | dprintf2("info->si_lower: %p\n", __si_bounds_lower(si)); | 404 | dprintf2("info->si_lower: %p\n", __si_bounds_lower(si)); |
405 | dprintf2("info->si_upper: %p\n", __si_bounds_upper(si)); | 405 | dprintf2("info->si_upper: %p\n", __si_bounds_upper(si)); |
406 | 406 | ||
407 | check_siginfo_vs_shadow(si); | ||
408 | |||
409 | for (i = 0; i < 8; i++) | 407 | for (i = 0; i < 8; i++) |
410 | dprintf3("[%d]: %p\n", i, si_addr_ptr[i]); | 408 | dprintf3("[%d]: %p\n", i, si_addr_ptr[i]); |
411 | switch (br_reason) { | 409 | switch (br_reason) { |
@@ -416,6 +414,9 @@ void handler(int signum, siginfo_t *si, void *vucontext) | |||
416 | exit(5); | 414 | exit(5); |
417 | case 1: /* #BR MPX bounds exception */ | 415 | case 1: /* #BR MPX bounds exception */ |
418 | /* these are normal and we expect to see them */ | 416 | /* these are normal and we expect to see them */ |
417 | |||
418 | check_siginfo_vs_shadow(si); | ||
419 | |||
419 | dprintf1("bounds exception (normal): status 0x%jx at %p si_addr: %p\n", | 420 | dprintf1("bounds exception (normal): status 0x%jx at %p si_addr: %p\n", |
420 | status, (void *)ip, si->si_addr); | 421 | status, (void *)ip, si->si_addr); |
421 | num_bnd_chk++; | 422 | num_bnd_chk++; |