linux/arch
Frediano Ziglio a5b0529675 xen: Fix stack corruption in xen_failsafe_callback for 32bit PVOPS guests.
commit 9174adbee4 upstream.

This fixes CVE-2013-0190 / XSA-40

There has been an error on the xen_failsafe_callback path for failed
iret, which causes the stack pointer to be wrong when entering the
iret_exc error path.  This can result in the kernel crashing.

In the classic kernel case, the relevant code looked a little like:

        popl %eax      # Error code from hypervisor
        jz 5f
        addl $16,%esp
        jmp iret_exc   # Hypervisor said iret fault
5:      addl $16,%esp
                       # Hypervisor said segment selector fault

Here, there are two identical addls on either option of a branch which
appears to have been optimised by hoisting it above the jz, and
converting it to an lea, which leaves the flags register unaffected.

In the PVOPS case, the code looks like:

        popl_cfi %eax         # Error from the hypervisor
        lea 16(%esp),%esp     # Add $16 before choosing fault path
        CFI_ADJUST_CFA_OFFSET -16
        jz 5f
        addl $16,%esp         # Incorrectly adjust %esp again
        jmp iret_exc

It is possible unprivileged userspace applications to cause this
behaviour, for example by loading an LDT code selector, then changing
the code selector to be not-present.  At this point, there is a race
condition where it is possible for the hypervisor to return back to
userspace from an interrupt, fault on its own iret, and inject a
failsafe_callback into the kernel.

This bug has been present since the introduction of Xen PVOPS support
in commit 5ead97c84 (xen: Core Xen implementation), in 2.6.23.

Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-21 11:44:59 -08:00
..
alpha Redefine ATOMIC_INIT and ATOMIC64_INIT to drop the casts 2012-10-02 09:47:25 -07:00
arm ARM: missing ->mmap_sem around find_vma() in swp_emulate.c 2013-01-11 09:03:48 -08:00
avr32 avr32: select generic atomic64_t support 2012-03-12 10:32:57 -07:00
blackfin rtc: fix build warnings in defconfigs 2011-06-15 20:04:02 -07:00
cris CRIS: fix I/O macros 2013-01-11 09:03:49 -08:00
frv Merge branch 'setns' 2011-05-28 10:51:01 -07:00
h8300 Merge branch 'setns' 2011-05-28 10:51:01 -07:00
ia64 random: remove rand_initialize_irq() 2012-08-15 12:04:28 -07:00
m32r Fix node_start/end_pfn() definition for mm/page_cgroup.c 2011-06-27 14:13:09 -07:00
m68k m68k: fix sigset_t accessor functions 2012-11-26 11:34:35 -08:00
microblaze Merge branch 'setns' 2011-05-28 10:51:01 -07:00
mips kbuild: Fix gcc -x syntax 2012-11-26 11:34:37 -08:00
mn10300 mn10300: only add -mmem-funcs to KBUILD_CFLAGS if gcc supports it 2012-10-13 05:28:02 +09:00
parisc PARISC: fix user-triggerable panic on parisc 2012-12-03 12:59:13 -08:00
powerpc powerpc: fix wii_memory_fixups() compile error on 3.0.y tree 2013-01-21 11:44:59 -08:00
s390 s390/time: fix sched_clock() overflow 2013-01-21 11:44:58 -08:00
score score: fix off-by-one index into syscall table 2012-01-25 17:25:04 -08:00
sh sh: Fix FDPIC binary loader 2013-01-21 11:44:58 -08:00
sparc sparc: huge_ptep_set_* functions need to call set_huge_pte_at() 2013-01-11 09:03:47 -08:00
tile arch/tile: avoid generating .eh_frame information in modules 2012-10-28 10:02:10 -07:00
um um: Implement a custom pte_same() function 2012-06-01 15:12:55 +08:00
unicore32 unicore32: using generic-y format for one line asm-generic files 2011-06-09 16:29:52 +08:00
x86 xen: Fix stack corruption in xen_failsafe_callback for 32bit PVOPS guests. 2013-01-21 11:44:59 -08:00
xtensa xtensa: prevent arbitrary read in ptrace 2011-08-04 21:58:39 -07:00
.gitignore
Kconfig mm, powerpc: move the RCU page-table freeing into generic code 2011-05-25 08:39:16 -07:00