~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to arch/x86/kernel/traps.c

  • Committer: Package Import Robot
  • Author(s): Ben Hutchings, Bastian Blank, Ben Hutchings, Uwe Kleine-König
  • Date: 2012-03-04 15:32:20 UTC
  • mfrom: (1.3.14)
  • mto: This revision was merged to the branch mainline in revision 57.
  • Revision ID: package-import@ubuntu.com-20120304153220-zbhqnmufx18yk6q4
* New upstream stable update:
  http://www.kernel.org/pub/linux/kernel/v3.x/ChangeLog-3.2.8
  - [i386] i387: move TS_USEDFPU flag from thread_info to task_struct
  - [x86] additional refactoring of FPU/SSE state save and restore
  http://www.kernel.org/pub/linux/kernel/v3.x/ChangeLog-3.2.9
  - vfs: fix d_inode_lookup() dentry ref leak
  - target: Allow control CDBs with data > 1 page
  - epoll: introduce POLLFREE to flush ->signalfd_wqh before kfree()
  - epoll: ep_unregister_pollwait() can use the freed pwq->whead
  - epoll: limit paths (CVE-2011-1083)
  - cdrom: use copy_to_user() without the underscores

[ Bastian Blank ]
* [mips,mipsel] Also remove ext4 modules from installer.

[ Ben Hutchings ]
* Update debconf template translations:
  - Update Dutch (Willem Kuyn) (Closes: #658736)
  - Add Polish (Michał Kułach) (Closes: #658912)
* Bump ABI to 2
* fs: Introduce and enable security restrictions on links:
  - Do not follow symlinks in /tmp that are owned by other users
    (sysctl: fs.protected_symlinks)
  - Do not allow unprivileged users to create hard links to sensitive files
    (sysctl: fs.protected_hardlinks) (Closes: #609455)
    + This breaks the 'at' package in stable, which will be fixed shortly
      (see #597130)
  The precise restrictions are specified in Documentation/sysctl/fs.txt in
  the linux-doc-3.2 and linux-source-3.2 packages.
* iwlwifi: fix key removal (Closes: #651199)
* cgroups: Set CGROUP_PERF
* hid: Enable HID_HOLTEK, HID_PRIMAX, HID_SPEEDLINK, HID_WIIMOTE as modules,
  HID_ACRUX_FF
* media/rc: Enable RC_ATI_REMOTE as module
* gspca: Enable USB_GSPCA_TOPRO as module
* dvb-usb: Enable DVB_USB_PCTV452E, DVB_USB_MXL111SF as modules

[ Uwe Kleine-König ]
* [x86] Update rt featureset to 3.2.9-rt15

Show diffs side-by-side

added added

removed removed

Lines of Context:
562
562
}
563
563
 
564
564
/*
565
 
 * __math_state_restore assumes that cr0.TS is already clear and the
566
 
 * fpu state is all ready for use.  Used during context switch.
 
565
 * This gets called with the process already owning the
 
566
 * FPU state, and with CR0.TS cleared. It just needs to
 
567
 * restore the FPU register state.
567
568
 */
568
 
void __math_state_restore(void)
 
569
void __math_state_restore(struct task_struct *tsk)
569
570
{
570
 
        struct thread_info *thread = current_thread_info();
571
 
        struct task_struct *tsk = thread->task;
 
571
        /* We need a safe address that is cheap to find and that is already
 
572
           in L1. We've just brought in "tsk->thread.has_fpu", so use that */
 
573
#define safe_address (tsk->thread.has_fpu)
 
574
 
 
575
        /* AMD K7/K8 CPUs don't save/restore FDP/FIP/FOP unless an exception
 
576
           is pending.  Clear the x87 state here by setting it to fixed
 
577
           values. safe_address is a random variable that should be in L1 */
 
578
        alternative_input(
 
579
                ASM_NOP8 ASM_NOP2,
 
580
                "emms\n\t"              /* clear stack tags */
 
581
                "fildl %P[addr]",       /* set F?P to defined value */
 
582
                X86_FEATURE_FXSAVE_LEAK,
 
583
                [addr] "m" (safe_address));
572
584
 
573
585
        /*
574
586
         * Paranoid restore. send a SIGSEGV if we fail to restore the state.
575
587
         */
576
588
        if (unlikely(restore_fpu_checking(tsk))) {
577
 
                stts();
 
589
                __thread_fpu_end(tsk);
578
590
                force_sig(SIGSEGV, tsk);
579
591
                return;
580
592
        }
581
 
 
582
 
        thread->status |= TS_USEDFPU;   /* So we fnsave on switch_to() */
583
 
        tsk->fpu_counter++;
584
593
}
585
594
 
586
595
/*
590
599
 * Careful.. There are problems with IBM-designed IRQ13 behaviour.
591
600
 * Don't touch unless you *really* know how it works.
592
601
 *
593
 
 * Must be called with kernel preemption disabled (in this case,
594
 
 * local interrupts are disabled at the call-site in entry.S).
 
602
 * Must be called with kernel preemption disabled (eg with local
 
603
 * local interrupts as in the case of do_device_not_available).
595
604
 */
596
 
asmlinkage void math_state_restore(void)
 
605
void math_state_restore(void)
597
606
{
598
 
        struct thread_info *thread = current_thread_info();
599
 
        struct task_struct *tsk = thread->task;
 
607
        struct task_struct *tsk = current;
600
608
 
601
609
        if (!tsk_used_math(tsk)) {
602
610
                local_irq_enable();
613
621
                local_irq_disable();
614
622
        }
615
623
 
616
 
        clts();                         /* Allow maths ops (or we recurse) */
 
624
        __thread_fpu_begin(tsk);
 
625
        __math_state_restore(tsk);
617
626
 
618
 
        __math_state_restore();
 
627
        tsk->fpu_counter++;
619
628
}
620
629
EXPORT_SYMBOL_GPL(math_state_restore);
621
630