diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-18 11:31:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-18 11:31:11 -0400 |
commit | 90d1c087861dcc3d1175993fc03492c137fd21bb (patch) | |
tree | ee90db200e3c5c249cf3150249c0f8c700e300d2 /arch/x86 | |
parent | 96b90f27bcf22f1d06cc16d9475cefa6ea4c4718 (diff) | |
parent | a6dfa128ce5c414ab46b1d690f7a1b8decb8526d (diff) |
Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 fixes from Ingo Molnar:
"This tree includes:
- an FPU related crash fix
- a ptrace fix (with matching testcase in tools/testing/selftests/)
- an x86 Kconfig DMA-config defaults tweak to better avoid
non-working drivers"
* 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
config: Enable NEED_DMA_MAP_STATE by default when SWIOTLB is selected
x86/fpu: Load xsave pointer *after* initialization
x86/ptrace: Fix the TIF_FORCED_TF logic in handle_signal()
x86, selftests: Add single_step_syscall test
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/Kconfig | 2 | ||||
-rw-r--r-- | arch/x86/kernel/i387.c | 8 | ||||
-rw-r--r-- | arch/x86/kernel/signal.c | 22 |
3 files changed, 18 insertions, 14 deletions
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index d43e7e1c784b..937812b8e0b9 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -178,7 +178,7 @@ config SBUS | |||
178 | 178 | ||
179 | config NEED_DMA_MAP_STATE | 179 | config NEED_DMA_MAP_STATE |
180 | def_bool y | 180 | def_bool y |
181 | depends on X86_64 || INTEL_IOMMU || DMA_API_DEBUG | 181 | depends on X86_64 || INTEL_IOMMU || DMA_API_DEBUG || SWIOTLB |
182 | 182 | ||
183 | config NEED_SG_DMA_LENGTH | 183 | config NEED_SG_DMA_LENGTH |
184 | def_bool y | 184 | def_bool y |
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c index 367f39d35e9c..009183276bb7 100644 --- a/arch/x86/kernel/i387.c +++ b/arch/x86/kernel/i387.c | |||
@@ -341,7 +341,7 @@ int xstateregs_get(struct task_struct *target, const struct user_regset *regset, | |||
341 | unsigned int pos, unsigned int count, | 341 | unsigned int pos, unsigned int count, |
342 | void *kbuf, void __user *ubuf) | 342 | void *kbuf, void __user *ubuf) |
343 | { | 343 | { |
344 | struct xsave_struct *xsave = &target->thread.fpu.state->xsave; | 344 | struct xsave_struct *xsave; |
345 | int ret; | 345 | int ret; |
346 | 346 | ||
347 | if (!cpu_has_xsave) | 347 | if (!cpu_has_xsave) |
@@ -351,6 +351,8 @@ int xstateregs_get(struct task_struct *target, const struct user_regset *regset, | |||
351 | if (ret) | 351 | if (ret) |
352 | return ret; | 352 | return ret; |
353 | 353 | ||
354 | xsave = &target->thread.fpu.state->xsave; | ||
355 | |||
354 | /* | 356 | /* |
355 | * Copy the 48bytes defined by the software first into the xstate | 357 | * Copy the 48bytes defined by the software first into the xstate |
356 | * memory layout in the thread struct, so that we can copy the entire | 358 | * memory layout in the thread struct, so that we can copy the entire |
@@ -369,7 +371,7 @@ int xstateregs_set(struct task_struct *target, const struct user_regset *regset, | |||
369 | unsigned int pos, unsigned int count, | 371 | unsigned int pos, unsigned int count, |
370 | const void *kbuf, const void __user *ubuf) | 372 | const void *kbuf, const void __user *ubuf) |
371 | { | 373 | { |
372 | struct xsave_struct *xsave = &target->thread.fpu.state->xsave; | 374 | struct xsave_struct *xsave; |
373 | int ret; | 375 | int ret; |
374 | 376 | ||
375 | if (!cpu_has_xsave) | 377 | if (!cpu_has_xsave) |
@@ -379,6 +381,8 @@ int xstateregs_set(struct task_struct *target, const struct user_regset *regset, | |||
379 | if (ret) | 381 | if (ret) |
380 | return ret; | 382 | return ret; |
381 | 383 | ||
384 | xsave = &target->thread.fpu.state->xsave; | ||
385 | |||
382 | ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, xsave, 0, -1); | 386 | ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, xsave, 0, -1); |
383 | /* | 387 | /* |
384 | * mxcsr reserved bits must be masked to zero for security reasons. | 388 | * mxcsr reserved bits must be masked to zero for security reasons. |
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c index f9804080ccb3..1ea14fd53933 100644 --- a/arch/x86/kernel/signal.c +++ b/arch/x86/kernel/signal.c | |||
@@ -616,7 +616,8 @@ setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs) | |||
616 | static void | 616 | static void |
617 | handle_signal(struct ksignal *ksig, struct pt_regs *regs) | 617 | handle_signal(struct ksignal *ksig, struct pt_regs *regs) |
618 | { | 618 | { |
619 | bool failed; | 619 | bool stepping, failed; |
620 | |||
620 | /* Are we from a system call? */ | 621 | /* Are we from a system call? */ |
621 | if (syscall_get_nr(current, regs) >= 0) { | 622 | if (syscall_get_nr(current, regs) >= 0) { |
622 | /* If so, check system call restarting.. */ | 623 | /* If so, check system call restarting.. */ |
@@ -640,12 +641,13 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs) | |||
640 | } | 641 | } |
641 | 642 | ||
642 | /* | 643 | /* |
643 | * If TF is set due to a debugger (TIF_FORCED_TF), clear the TF | 644 | * If TF is set due to a debugger (TIF_FORCED_TF), clear TF now |
644 | * flag so that register information in the sigcontext is correct. | 645 | * so that register information in the sigcontext is correct and |
646 | * then notify the tracer before entering the signal handler. | ||
645 | */ | 647 | */ |
646 | if (unlikely(regs->flags & X86_EFLAGS_TF) && | 648 | stepping = test_thread_flag(TIF_SINGLESTEP); |
647 | likely(test_and_clear_thread_flag(TIF_FORCED_TF))) | 649 | if (stepping) |
648 | regs->flags &= ~X86_EFLAGS_TF; | 650 | user_disable_single_step(current); |
649 | 651 | ||
650 | failed = (setup_rt_frame(ksig, regs) < 0); | 652 | failed = (setup_rt_frame(ksig, regs) < 0); |
651 | if (!failed) { | 653 | if (!failed) { |
@@ -656,10 +658,8 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs) | |||
656 | * it might disable possible debug exception from the | 658 | * it might disable possible debug exception from the |
657 | * signal handler. | 659 | * signal handler. |
658 | * | 660 | * |
659 | * Clear TF when entering the signal handler, but | 661 | * Clear TF for the case when it wasn't set by debugger to |
660 | * notify any tracer that was single-stepping it. | 662 | * avoid the recursive send_sigtrap() in SIGTRAP handler. |
661 | * The tracer may want to single-step inside the | ||
662 | * handler too. | ||
663 | */ | 663 | */ |
664 | regs->flags &= ~(X86_EFLAGS_DF|X86_EFLAGS_RF|X86_EFLAGS_TF); | 664 | regs->flags &= ~(X86_EFLAGS_DF|X86_EFLAGS_RF|X86_EFLAGS_TF); |
665 | /* | 665 | /* |
@@ -668,7 +668,7 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs) | |||
668 | if (used_math()) | 668 | if (used_math()) |
669 | fpu_reset_state(current); | 669 | fpu_reset_state(current); |
670 | } | 670 | } |
671 | signal_setup_done(failed, ksig, test_thread_flag(TIF_SINGLESTEP)); | 671 | signal_setup_done(failed, ksig, stepping); |
672 | } | 672 | } |
673 | 673 | ||
674 | #ifdef CONFIG_X86_32 | 674 | #ifdef CONFIG_X86_32 |