Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Ingo Molnar: "Misc changes: - fix lguest bug - fix /proc/meminfo output on certain configs - fix pvclock bug - fix reboot on certain iMacs by adding new reboot quirk - fix bootup crash - fix FPU boot line option parsing - add more x86 self-tests - small cleanups, documentation improvements, etc" * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/cpu/amd: Remove an unneeded condition in srat_detect_node() x86/vdso/pvclock: Protect STABLE check with the seqcount x86/mm: Improve switch_mm() barrier comments selftests/x86: Test __kernel_sigreturn and __kernel_rt_sigreturn x86/reboot/quirks: Add iMac10,1 to pci_reboot_dmi_table[] lguest: Map switcher text R/O x86/boot: Hide local labels in verify_cpu() x86/fpu: Disable AVX when eagerfpu is off x86/fpu: Disable MPX when eagerfpu is off x86/fpu: Disable XGETBV1 when no XSAVE x86/fpu: Fix early FPU command-line parsing x86/mm: Use PAGE_ALIGNED instead of IS_ALIGNED selftests/x86: Disable the ldt_gdt_64 test for now x86/mm/pat: Make split_page_count() check for empty levels to fix /proc/meminfo output x86/boot: Double BOOT_HEAP_SIZE to 64KB x86/mm: Add barriers and document switch_mm()-vs-flush synchronization
This commit is contained in:
@@ -4,9 +4,11 @@ include ../lib.mk
|
||||
|
||||
.PHONY: all all_32 all_64 warn_32bit_failure clean
|
||||
|
||||
TARGETS_C_BOTHBITS := single_step_syscall sysret_ss_attrs ldt_gdt syscall_nt ptrace_syscall
|
||||
TARGETS_C_BOTHBITS := single_step_syscall sysret_ss_attrs syscall_nt ptrace_syscall
|
||||
TARGETS_C_32BIT_ONLY := entry_from_vm86 syscall_arg_fault sigreturn test_syscall_vdso unwind_vdso \
|
||||
test_FCMOV test_FCOMI test_FISTTP
|
||||
test_FCMOV test_FCOMI test_FISTTP \
|
||||
ldt_gdt \
|
||||
vdso_restorer
|
||||
|
||||
TARGETS_C_32BIT_ALL := $(TARGETS_C_BOTHBITS) $(TARGETS_C_32BIT_ONLY)
|
||||
BINARIES_32 := $(TARGETS_C_32BIT_ALL:%=%_32)
|
||||
|
88
tools/testing/selftests/x86/vdso_restorer.c
Normal file
88
tools/testing/selftests/x86/vdso_restorer.c
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* vdso_restorer.c - tests vDSO-based signal restore
|
||||
* Copyright (c) 2015 Andrew Lutomirski
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* This makes sure that sa_restorer == NULL keeps working on 32-bit
|
||||
* configurations. Modern glibc doesn't use it under any circumstances,
|
||||
* so it's easy to overlook breakage.
|
||||
*
|
||||
* 64-bit userspace has never supported sa_restorer == NULL, so this is
|
||||
* 32-bit only.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <syscall.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
/* Open-code this -- the headers are too messy to easily use them. */
|
||||
struct real_sigaction {
|
||||
void *handler;
|
||||
unsigned long flags;
|
||||
void *restorer;
|
||||
unsigned int mask[2];
|
||||
};
|
||||
|
||||
static volatile sig_atomic_t handler_called;
|
||||
|
||||
static void handler_with_siginfo(int sig, siginfo_t *info, void *ctx_void)
|
||||
{
|
||||
handler_called = 1;
|
||||
}
|
||||
|
||||
static void handler_without_siginfo(int sig)
|
||||
{
|
||||
handler_called = 1;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int nerrs = 0;
|
||||
struct real_sigaction sa;
|
||||
|
||||
memset(&sa, 0, sizeof(sa));
|
||||
sa.handler = handler_with_siginfo;
|
||||
sa.flags = SA_SIGINFO;
|
||||
sa.restorer = NULL; /* request kernel-provided restorer */
|
||||
|
||||
if (syscall(SYS_rt_sigaction, SIGUSR1, &sa, NULL, 8) != 0)
|
||||
err(1, "raw rt_sigaction syscall");
|
||||
|
||||
raise(SIGUSR1);
|
||||
|
||||
if (handler_called) {
|
||||
printf("[OK]\tSA_SIGINFO handler returned successfully\n");
|
||||
} else {
|
||||
printf("[FAIL]\tSA_SIGINFO handler was not called\n");
|
||||
nerrs++;
|
||||
}
|
||||
|
||||
sa.flags = 0;
|
||||
sa.handler = handler_without_siginfo;
|
||||
if (syscall(SYS_sigaction, SIGUSR1, &sa, 0) != 0)
|
||||
err(1, "raw sigaction syscall");
|
||||
handler_called = 0;
|
||||
|
||||
raise(SIGUSR1);
|
||||
|
||||
if (handler_called) {
|
||||
printf("[OK]\t!SA_SIGINFO handler returned successfully\n");
|
||||
} else {
|
||||
printf("[FAIL]\t!SA_SIGINFO handler was not called\n");
|
||||
nerrs++;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user