[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-3.0.4-testing] [LINUX] Add a few missing changes from update to 2.6.16.38 point release.



# HG changeset patch
# User Christian Limpach <Christian.Limpach@xxxxxxxxxxxxx>
# Date 1171539298 0
# Node ID 3341afbb1953fbc847a22d48d8a68ce09743a904
# Parent  d401cb96d8a0da5febe737b86f453a88f1f45bb7
[LINUX] Add a few missing changes from update to 2.6.16.38 point release.

Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxxx>
---
 linux-2.6-xen-sparse/arch/i386/kernel/entry-xen.S             |    2 
 linux-2.6-xen-sparse/arch/i386/pci/irq-xen.c                  |    6 ++
 linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S           |    4 +
 linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c           |    5 +-
 linux-2.6-xen-sparse/arch/x86_64/kernel/setup64-xen.c         |    6 ++
 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/system.h   |    8 +++
 linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/system.h |   22 +++++++++-
 7 files changed, 48 insertions(+), 5 deletions(-)

diff -r d401cb96d8a0 -r 3341afbb1953 
linux-2.6-xen-sparse/arch/i386/kernel/entry-xen.S
--- a/linux-2.6-xen-sparse/arch/i386/kernel/entry-xen.S Mon Jan 29 15:04:58 
2007 +0000
+++ b/linux-2.6-xen-sparse/arch/i386/kernel/entry-xen.S Thu Feb 15 11:34:58 
2007 +0000
@@ -158,6 +158,8 @@ ENTRY(ret_from_fork)
        call schedule_tail
        GET_THREAD_INFO(%ebp)
        popl %eax
+       pushl $0x0202                   # Reset kernel eflags
+       popfl
        jmp syscall_exit
 
 /*
diff -r d401cb96d8a0 -r 3341afbb1953 
linux-2.6-xen-sparse/arch/i386/pci/irq-xen.c
--- a/linux-2.6-xen-sparse/arch/i386/pci/irq-xen.c      Mon Jan 29 15:04:58 
2007 +0000
+++ b/linux-2.6-xen-sparse/arch/i386/pci/irq-xen.c      Thu Feb 15 11:34:58 
2007 +0000
@@ -549,6 +549,12 @@ static __init int intel_router_probe(str
                case PCI_DEVICE_ID_INTEL_ICH8_2:
                case PCI_DEVICE_ID_INTEL_ICH8_3:
                case PCI_DEVICE_ID_INTEL_ICH8_4:
+               case PCI_DEVICE_ID_INTEL_ICH9_0:
+               case PCI_DEVICE_ID_INTEL_ICH9_1:
+               case PCI_DEVICE_ID_INTEL_ICH9_2:
+               case PCI_DEVICE_ID_INTEL_ICH9_3:
+               case PCI_DEVICE_ID_INTEL_ICH9_4:
+               case PCI_DEVICE_ID_INTEL_ICH9_5:
                        r->name = "PIIX/ICH";
                        r->get = pirq_piix_get;
                        r->set = pirq_piix_set;
diff -r d401cb96d8a0 -r 3341afbb1953 
linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S
--- a/linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S       Mon Jan 29 
15:04:58 2007 +0000
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/entry-xen.S       Thu Feb 15 
11:34:58 2007 +0000
@@ -177,6 +177,10 @@ 1:
 /* rdi:        prev */ 
 ENTRY(ret_from_fork)
        CFI_DEFAULT_STACK
+       push kernel_eflags(%rip)
+       CFI_ADJUST_CFA_OFFSET 4
+       popf                            # reset kernel eflags
+       CFI_ADJUST_CFA_OFFSET -4
        call schedule_tail
        GET_THREAD_INFO(%rcx)
        testl 
$(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%rcx)
diff -r d401cb96d8a0 -r 3341afbb1953 
linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c
--- a/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c       Mon Jan 29 
15:04:58 2007 +0000
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c       Thu Feb 15 
11:34:58 2007 +0000
@@ -1306,7 +1306,10 @@ static void __cpuinit init_intel(struct 
        if ((c->x86 == 0xf && c->x86_model >= 0x03) ||
            (c->x86 == 0x6 && c->x86_model >= 0x0e))
                set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability);
-       set_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability);
+       if (c->x86 == 15)
+               set_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability);
+       else
+               clear_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability);
        c->x86_max_cores = intel_num_cpu_cores(c);
 
        srat_detect_node();
diff -r d401cb96d8a0 -r 3341afbb1953 
linux-2.6-xen-sparse/arch/x86_64/kernel/setup64-xen.c
--- a/linux-2.6-xen-sparse/arch/x86_64/kernel/setup64-xen.c     Mon Jan 29 
15:04:58 2007 +0000
+++ b/linux-2.6-xen-sparse/arch/x86_64/kernel/setup64-xen.c     Thu Feb 15 
11:34:58 2007 +0000
@@ -234,6 +234,8 @@ void __cpuinit check_efer(void)
         }       
 }
 
+unsigned long kernel_eflags;
+
 /*
  * cpu_init() initializes state that is per-CPU. Some data is already
  * initialized (naturally) in the bootstrap process, such as the GDT
@@ -357,4 +359,6 @@ void __cpuinit cpu_init (void)
        set_debug(0UL, 7);
 
        fpu_init(); 
-}
+
+       raw_local_save_flags(kernel_eflags);
+}
diff -r d401cb96d8a0 -r 3341afbb1953 
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/system.h
--- a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/system.h       Mon Jan 
29 15:04:58 2007 +0000
+++ b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/system.h       Thu Feb 
15 11:34:58 2007 +0000
@@ -21,9 +21,14 @@ struct task_struct;  /* one of the strang
 struct task_struct;    /* one of the stranger aspects of C forward 
declarations.. */
 extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, 
struct task_struct *next));
 
+/*
+ * Saving eflags is important. It switches not only IOPL between tasks,
+ * it also protects other tasks from NT leaking through sysenter etc.
+ */
 #define switch_to(prev,next,last) do {                                 \
        unsigned long esi,edi;                                          \
-       asm volatile("pushl %%ebp\n\t"                                  \
+       asm volatile("pushfl\n\t"               /* Save flags */        \
+                    "pushl %%ebp\n\t"                                  \
                     "movl %%esp,%0\n\t"        /* save ESP */          \
                     "movl %5,%%esp\n\t"        /* restore ESP */       \
                     "movl $1f,%1\n\t"          /* save EIP */          \
@@ -31,6 +36,7 @@ extern struct task_struct * FASTCALL(__s
                     "jmp __switch_to\n"                                \
                     "1:\t"                                             \
                     "popl %%ebp\n\t"                                   \
+                    "popfl"                                            \
                     :"=m" (prev->thread.esp),"=m" (prev->thread.eip),  \
                      "=a" (last),"=S" (esi),"=D" (edi)                 \
                     :"m" (next->thread.esp),"m" (next->thread.eip),    \
diff -r d401cb96d8a0 -r 3341afbb1953 
linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/system.h
--- a/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/system.h     Mon Jan 
29 15:04:58 2007 +0000
+++ b/linux-2.6-xen-sparse/include/asm-x86_64/mach-xen/asm/system.h     Thu Feb 
15 11:34:58 2007 +0000
@@ -29,12 +29,13 @@
 #define __RESTORE(reg,offset) "movq (14-" #offset ")*8(%%rsp),%%" #reg "\n\t"
 
 /* frame pointer must be last for get_wchan */
-#define SAVE_CONTEXT    "pushq %%rbp ; movq %%rsi,%%rbp\n\t"
-#define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp\n\t"
+#define SAVE_CONTEXT    "pushf ; pushq %%rbp ; movq %%rsi,%%rbp\n\t"
+#define RESTORE_CONTEXT "movq %%rbp,%%rsi ; popq %%rbp ; popf\n\t"
 
 #define __EXTRA_CLOBBER  \
        ,"rcx","rbx","rdx","r8","r9","r10","r11","r12","r13","r14","r15"
 
+/* Save restore flags to clear handle leaking NT */
 #define switch_to(prev,next,last) \
        asm volatile(SAVE_CONTEXT                                               
    \
                     "movq %%rsp,%P[threadrsp](%[prev])\n\t" /* save RSP */     
  \
@@ -166,6 +167,23 @@ struct alt_instr {
  * Clear and set 'TS' bit respectively
  */
 #define clts() (HYPERVISOR_fpu_taskswitch(0))
+
+static inline unsigned long __raw_local_save_flags(void)
+{
+       unsigned long flags;
+
+       __asm__ __volatile__(
+               "# __raw_save_flags\n\t"
+               "pushfq ; popq %q0"
+               : "=g" (flags)
+               : /* no input */
+               : "memory"
+       );
+
+       return flags;
+}
+#define raw_local_save_flags(flags) \
+               do { (flags) = __raw_local_save_flags(); } while (0)
 
 static inline unsigned long read_cr0(void)
 { 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.