Author: zbyniu                       Date: Thu Aug 23 01:27:50 2007 GMT
Module: SOURCES                       Tag: LINUX_2_6
---- Log message:
- merged changes from grsecurity-2.1.11-2.6.22.4-200708211800.patch

---- Files affected:
SOURCES:
   linux-2.6-grsec_full.patch (1.1.2.15 -> 1.1.2.16) 

---- Diffs:

================================================================
Index: SOURCES/linux-2.6-grsec_full.patch
diff -u SOURCES/linux-2.6-grsec_full.patch:1.1.2.15 
SOURCES/linux-2.6-grsec_full.patch:1.1.2.16
--- SOURCES/linux-2.6-grsec_full.patch:1.1.2.15 Mon Aug 13 13:19:04 2007
+++ SOURCES/linux-2.6-grsec_full.patch  Thu Aug 23 03:27:44 2007
@@ -323,6 +323,25 @@
  
        # Jump to the 32bit entry point
        jmpl *(code32_start - start + (DELTA_INITSEG << 4))(%esi)
+diff -urNp linux-2.6.22/arch/i386/boot/video.S 
linux-2.6.22/arch/i386/boot/video.S
+--- linux-2.6.22/arch/i386/boot/video.S        2007-07-10 14:56:30.000000000 
-0400
++++ linux-2.6.22/arch/i386/boot/video.S        2007-07-10 14:56:30.000000000 
-0400
+@@ -96,6 +96,7 @@
+ #define PARAM_LFB_PAGES               0x32
+ #define PARAM_VESA_ATTRIB     0x34
+ #define PARAM_CAPABILITIES    0x36
++#define PARAM_VESAPM_SIZE     0x3a
+ 
+ /* Define DO_STORE according to CONFIG_VIDEO_RETAIN */
+ #ifdef CONFIG_VIDEO_RETAIN
+@@ -280,6 +281,7 @@ dac_done:
+ 
+       movw    %es, %fs:(PARAM_VESAPM_SEG)
+       movw    %di, %fs:(PARAM_VESAPM_OFF)
++      movw    %cx, %fs:(PARAM_VESAPM_SIZE)
+ no_pm:        ret
+ 
+ # The video mode menu
 diff -urNp linux-2.6.22.1/arch/i386/Kconfig linux-2.6.22.1/arch/i386/Kconfig
 --- linux-2.6.22.1/arch/i386/Kconfig   2007-07-10 14:56:30.000000000 -0400
 +++ linux-2.6.22.1/arch/i386/Kconfig   2007-08-03 12:36:16.000000000 -0400
@@ -498,10 +517,10 @@
  }
  
  #ifdef CONFIG_SMP
-@@ -191,29 +203,53 @@ static void alternatives_smp_lock(u8 **s
+@@ -191,29 +203,53 @@ static void alternatives_smp_lock(u8 **s 
  {
-       u8 **ptr;
-
+       u8 **ptr;
+ 
 +#ifdef CONFIG_PAX_KERNEXEC
 +      unsigned long cr0;
 +
@@ -542,12 +561,12 @@
        for (ptr = start; ptr < end; ptr++) {
                if (*ptr < text)
                        continue;
-               if (*ptr > text_end)
+               if (*ptr > text_end)
                        continue;
 -              nop_out(*ptr, 1);
 -      };
 +              nop_out(*ptr + __KERNEL_TEXT_OFFSET, 1);
-+      }
++      }
 +
 +#ifdef CONFIG_PAX_KERNEXEC
 +      pax_close_kernel(cr0);
@@ -1476,7 +1495,7 @@
 +      __SAVE_ALL(__KERNEL_DS); \
 +      GET_CR0_INTO_EDX; \
 +      movl %edx, %esi; \
-+      orl $0x10000, %edx; \
++      orl $X86_CR0_WP, %edx; \
 +      xorl %edx, %esi; \
 +      SET_CR0_FROM_EDX
 +#elif defined(CONFIG_PAX_PAGEEXEC) || defined(CONFIG_PAX_SEGMEXEC) || 
defined(CONFIG_PAX_MEMORY_UDEREF)
@@ -1640,7 +1659,7 @@
 +#ifdef CONFIG_PAX_KERNEXEC
 +      GET_CR0_INTO_EDX
 +      movl %edx, %esi
-+      orl $0x10000, %edx
++      orl $X86_CR0_WP, %edx
 +      xorl %edx, %esi
 +      SET_CR0_FROM_EDX
 +#endif
@@ -2237,10 +2256,91 @@
  
                asm volatile(
                        "       xchgl   %%ebx,%%esp     \n"
-diff -urNp linux-2.6.22.1/arch/i386/kernel/kprobes.c 
linux-2.6.22.1/arch/i386/kernel/kprobes.c
---- linux-2.6.22.1/arch/i386/kernel/kprobes.c  2007-07-10 14:56:30.000000000 
-0400
-+++ linux-2.6.22.1/arch/i386/kernel/kprobes.c  2007-08-02 11:38:45.000000000 
-0400
-@@ -651,7 +651,7 @@ int __kprobes kprobe_exceptions_notify(s
+diff -urNp linux-2.6.22/arch/i386/kernel/kprobes.c 
linux-2.6.22/arch/i386/kernel/kprobes.c
+--- linux-2.6.22/arch/i386/kernel/kprobes.c    2007-07-10 14:56:30.000000000 
-0400
++++ linux-2.6.22/arch/i386/kernel/kprobes.c    2007-07-10 14:56:30.000000000 
-0400
+@@ -48,9 +48,24 @@ static __always_inline void set_jmp_op(v
+               char op;
+               long raddr;
+       } __attribute__((packed)) *jop;
+-      jop = (struct __arch_jmp_op *)from;
++
++#ifdef CONFIG_PAX_KERNEXEC
++      unsigned long cr0;
++#endif
++
++      jop = (struct __arch_jmp_op *)(from + __KERNEL_TEXT_OFFSET);
++
++#ifdef CONFIG_PAX_KERNEXEC
++      pax_open_kernel(cr0);
++#endif
++
+       jop->raddr = (long)(to) - ((long)(from) + 5);
+       jop->op = RELATIVEJUMP_INSTRUCTION;
++
++#ifdef CONFIG_PAX_KERNEXEC
++      pax_close_kernel(cr0);
++#endif
++
+ }
+ 
+ /*
+@@ -152,12 +167,26 @@ static int __kprobes is_IF_modifier(kpro
+ 
+ int __kprobes arch_prepare_kprobe(struct kprobe *p)
+ {
++
++#ifdef CONFIG_PAX_KERNEXEC
++      unsigned long cr0;
++#endif
++
+       /* insn: must be on special executable page on i386. */
+       p->ainsn.insn = get_insn_slot();
+       if (!p->ainsn.insn)
+               return -ENOMEM;
+ 
+-      memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t));
++#ifdef CONFIG_PAX_KERNEXEC
++      pax_open_kernel(cr0);
++#endif
++
++      memcpy(p->ainsn.insn, p->addr + __KERNEL_TEXT_OFFSET, MAX_INSN_SIZE * 
sizeof(kprobe_opcode_t));
++
++#ifdef CONFIG_PAX_KERNEXEC
++      pax_close_kernel(cr0);
++#endif
++
+       p->opcode = *p->addr;
+       if (can_boost(p->addr)) {
+               p->ainsn.boostable = 0;
+@@ -222,7 +251,7 @@ static void __kprobes prepare_singlestep
+       if (p->opcode == BREAKPOINT_INSTRUCTION)
+               regs->eip = (unsigned long)p->addr;
+       else
+-              regs->eip = (unsigned long)p->ainsn.insn;
++              regs->eip = (unsigned long)p->ainsn.insn - __KERNEL_TEXT_OFFSET;
+ }
+ 
+ /* Called with kretprobe_lock held */
+@@ -328,7 +357,7 @@ ss_probe:
+       if (p->ainsn.boostable == 1 && !p->post_handler){
+               /* Boost up -- we can execute copied instructions directly */
+               reset_current_kprobe();
+-              regs->eip = (unsigned long)p->ainsn.insn;
++              regs->eip = (unsigned long)p->ainsn.insn - __KERNEL_TEXT_OFFSET;
+               preempt_enable_no_resched();
+               return 1;
+       }
+@@ -478,7 +507,7 @@ static void __kprobes resume_execution(s
+               struct pt_regs *regs, struct kprobe_ctlblk *kcb)
+ {
+       unsigned long *tos = (unsigned long *)&regs->esp;
+-      unsigned long copy_eip = (unsigned long)p->ainsn.insn;
++      unsigned long copy_eip = (unsigned long)p->ainsn.insn - 
__KERNEL_TEXT_OFFSET;
+       unsigned long orig_eip = (unsigned long)p->addr;
+ 
+       regs->eflags &= ~TF_MASK;
+@@ -651,7 +680,7 @@ int __kprobes kprobe_exceptions_notify(s
        struct die_args *args = (struct die_args *)data;
        int ret = NOTIFY_DONE;
  
@@ -3356,7 +3456,7 @@
 diff -urNp linux-2.6.22.1/arch/i386/kernel/time.c 
linux-2.6.22.1/arch/i386/kernel/time.c
 --- linux-2.6.22.1/arch/i386/kernel/time.c     2007-07-10 14:56:30.000000000 
-0400
 +++ linux-2.6.22.1/arch/i386/kernel/time.c     2007-08-02 11:38:45.000000000 
-0400
-@@ -132,18 +132,24 @@ unsigned long profile_pc(struct pt_regs 
+@@ -132,20 +132,30 @@ unsigned long profile_pc(struct pt_regs 
        if (!v8086_mode(regs) && SEGMENT_IS_KERNEL_CODE(regs->xcs) &&
            in_lock_functions(pc)) {
  #ifdef CONFIG_FRAME_POINTER
@@ -3381,7 +3481,13 @@
 +#endif
        }
  #endif
++
++      if (!v8086_mode(regs) && SEGMENT_IS_KERNEL_CODE(regs->xcs))
++              pc += __KERNEL_TEXT_OFFSET;
++
        return pc;
+ }
+ EXPORT_SYMBOL(profile_pc);
 diff -urNp linux-2.6.22.1/arch/i386/kernel/traps.c 
linux-2.6.22.1/arch/i386/kernel/traps.c
 --- linux-2.6.22.1/arch/i386/kernel/traps.c    2007-07-10 14:56:30.000000000 
-0400
 +++ linux-2.6.22.1/arch/i386/kernel/traps.c    2007-08-02 11:38:45.000000000 
-0400
@@ -3598,31 +3704,54 @@
        tsk->thread.esp0 = (unsigned long) &info->VM86_TSS_ESP0;
        if (cpu_has_sep)
                tsk->thread.sysenter_cs = 0;
-diff -urNp linux-2.6.22.1/arch/i386/kernel/vmi.c 
linux-2.6.22.1/arch/i386/kernel/vmi.c
---- linux-2.6.22.1/arch/i386/kernel/vmi.c      2007-07-10 14:56:30.000000000 
-0400
-+++ linux-2.6.22.1/arch/i386/kernel/vmi.c      2007-08-02 11:38:45.000000000 
-0400
-@@ -89,7 +89,19 @@ struct vmi_timer_ops vmi_timer_ops;
- 
- static inline void patch_offset(unsigned char *eip, unsigned char *dest)
+diff -urNp linux-2.6.22/arch/i386/kernel/vmi.c 
linux-2.6.22/arch/i386/kernel/vmi.c
+--- linux-2.6.22/arch/i386/kernel/vmi.c        2007-07-10 14:56:30.000000000 
-0400
++++ linux-2.6.22/arch/i386/kernel/vmi.c        2007-07-10 14:56:30.000000000 
-0400
+@@ -96,18 +96,43 @@ static unsigned patch_internal(int call,
  {
--        *(unsigned long *)(eip+1) = dest-eip-5;
+       u64 reloc;
+       struct vmi_relocation_info *const rel = (struct vmi_relocation_info 
*)&reloc;
 +
 +#ifdef CONFIG_PAX_KERNEXEC
 +      unsigned long cr0;
++#endif
 +
-+      pax_open_kernel(cr0);
+       reloc = call_vrom_long_func(vmi_rom, get_reloc, call);
+       switch(rel->type) {
+               case VMI_RELOCATION_CALL_REL:
+                       BUG_ON(len < 5);
++
++#ifdef CONFIG_PAX_KERNEXEC
++                      pax_open_kernel(cr0);
 +#endif
 +
-+      *(unsigned long *)(eip+1) = dest-eip-5;
+                       *(char *)insns = MNEM_CALL;
+                       patch_offset(insns, rel->eip);
 +
 +#ifdef CONFIG_PAX_KERNEXEC
-+      pax_close_kernel(cr0);
++                      pax_close_kernel(cr0);
 +#endif
 +
- }
+                       return 5;
+ 
+               case VMI_RELOCATION_JUMP_REL:
+                       BUG_ON(len < 5);
++
++#ifdef CONFIG_PAX_KERNEXEC
++                      pax_open_kernel(cr0);
++#endif
++
+                       *(char *)insns = MNEM_JMP;
+                       patch_offset(insns, rel->eip);
++
++#ifdef CONFIG_PAX_KERNEXEC
++                      pax_close_kernel(cr0);
++#endif
++
+                       return 5;
  
- static unsigned patch_internal(int call, unsigned len, void *insns)
-@@ -485,14 +497,14 @@ static void vmi_set_pud(pud_t *pudp, pud
+               case VMI_RELOCATION_NOP:
+@@ -485,14 +510,14 @@ static void vmi_set_pud(pud_t *pudp, pud
  
  static void vmi_pte_clear(struct mm_struct *mm, unsigned long addr, pte_t 
*ptep)
  {
@@ -3639,7 +3768,7 @@
        vmi_check_page_type(__pa(pmd) >> PAGE_SHIFT, VMI_PAGE_PMD);
        vmi_ops.set_pte(pte, (pte_t *)pmd, VMI_PAGE_PD);
  }
-@@ -521,8 +533,8 @@ vmi_startup_ipi_hook(int phys_apicid, un
+@@ -521,8 +546,8 @@ vmi_startup_ipi_hook(int phys_apicid, un
        ap.ss = __KERNEL_DS;
        ap.esp = (unsigned long) start_esp;
  
@@ -3650,7 +3779,7 @@
        ap.fs = __KERNEL_PERCPU;
        ap.gs = 0;
  
-@@ -719,12 +731,20 @@ static inline int __init activate_vmi(vo
+@@ -719,12 +744,20 @@ static inline int __init activate_vmi(vo
        u64 reloc;
        const struct vmi_relocation_info *rel = (struct vmi_relocation_info 
*)&reloc;
  
@@ -3671,7 +3800,7 @@
        paravirt_ops.paravirt_enabled = 1;
        paravirt_ops.kernel_rpl = kernel_cs & SEGMENT_RPL_MASK;
  
-@@ -903,6 +923,10 @@ static inline int __init activate_vmi(vo
+@@ -903,6 +936,10 @@ static inline int __init activate_vmi(vo
  
        para_fill(safe_halt, Halt);
  
@@ -5724,9 +5853,9 @@
        }
  
        if( ((1<<cpu) & voyager_extended_vic_processors) == 0)
-diff -urNp linux-2.6.22.1/arch/i386/mm/boot_ioremap.c 
linux-2.6.22.1/arch/i386/mm/boot_ioremap.c
---- linux-2.6.22.1/arch/i386/mm/boot_ioremap.c 2007-07-10 14:56:30.000000000 
-0400
-+++ linux-2.6.22.1/arch/i386/mm/boot_ioremap.c 2007-08-02 11:38:45.000000000 
-0400
+diff -urNp linux-2.6.22/arch/i386/mm/boot_ioremap.c 
linux-2.6.22/arch/i386/mm/boot_ioremap.c
+--- linux-2.6.22/arch/i386/mm/boot_ioremap.c   2007-07-10 14:56:30.000000000 
-0400
++++ linux-2.6.22/arch/i386/mm/boot_ioremap.c   2007-07-10 14:56:30.000000000 
-0400
 @@ -7,57 +7,37 @@
   * Written by Dave Hansen <[EMAIL PROTECTED]>
   */
@@ -6161,6 +6290,15 @@
                else
                        printk(KERN_ALERT "BUG: unable to handle kernel paging"
                                        " request");
+@@ -560,7 +750,7 @@ no_context:
+                * it's allocated already.
+                */
+               if ((page >> PAGE_SHIFT) < max_low_pfn
+-                  && (page & _PAGE_PRESENT)) {
++                  && (page & (_PAGE_PRESENT | _PAGE_PSE)) == _PAGE_PRESENT) {
+                       page &= PAGE_MASK;
+                       page = ((__typeof__(page) *) __va(page))[(address >> 
PAGE_SHIFT)
+                                                                & 
(PTRS_PER_PTE - 1)];
 @@ -645,3 +835,110 @@ void vmalloc_sync_all(void)
                        start = address + PGDIR_SIZE;
        }
@@ -7022,10 +7160,10 @@
  };
  
  static int __init pcibios_irq_init(void)
-diff -urNp linux-2.6.22.1/arch/i386/pci/pcbios.c 
linux-2.6.22.1/arch/i386/pci/pcbios.c
---- linux-2.6.22.1/arch/i386/pci/pcbios.c      2007-07-10 14:56:30.000000000 
-0400
-+++ linux-2.6.22.1/arch/i386/pci/pcbios.c      2007-08-07 08:41:24.000000000 
-0400
-@@ -57,50 +57,102 @@ union bios32 {
+diff -urNp linux-2.6.22/arch/i386/pci/pcbios.c 
linux-2.6.22/arch/i386/pci/pcbios.c
+--- linux-2.6.22/arch/i386/pci/pcbios.c        2007-07-10 14:56:30.000000000 
-0400
++++ linux-2.6.22/arch/i386/pci/pcbios.c        2007-07-10 14:56:30.000000000 
-0400
+@@ -57,50 +57,119 @@ union bios32 {
  static struct {
        unsigned long address;
        unsigned short segment;
@@ -7054,13 +7192,22 @@
 -      __asm__("lcall *(%%edi); cld"
 +
 +      gdt = get_cpu_gdt_table(smp_processor_id());
-+      pack_descriptor((u32 *)&gdt[GDT_ENTRY_PCIBIOS_CS].a,
-+                      (u32 *)&gdt[GDT_ENTRY_PCIBIOS_CS].b,
++
++#ifdef CONFIG_PAX_KERNEXEC
++      pax_open_kernel(cr0);
++#endif
++
++      pack_descriptor((__u32 *)&gdt[GDT_ENTRY_PCIBIOS_CS].a,
++                      (__u32 *)&gdt[GDT_ENTRY_PCIBIOS_CS].b,
 +                      0UL, 0xFFFFFUL, 0x9B, 0xC);
-+      pack_descriptor((u32 *)&gdt[GDT_ENTRY_PCIBIOS_DS].a,
-+                      (u32 *)&gdt[GDT_ENTRY_PCIBIOS_DS].b,
++      pack_descriptor((__u32 *)&gdt[GDT_ENTRY_PCIBIOS_DS].a,
++                      (__u32 *)&gdt[GDT_ENTRY_PCIBIOS_DS].b,
 +                      0UL, 0xFFFFFUL, 0x93, 0xC);
 +
++#ifdef CONFIG_PAX_KERNEXEC
++      pax_close_kernel(cr0);
++#endif
++
 +      __asm__("movw %w7, %%ds; lcall *(%%edi); push %%ss; pop %%ds; cld"
                : "=a" (return_code),
                  "=b" (address),
@@ -7073,11 +7220,19 @@
 +                "r"(__PCIBIOS_DS)
 +              : "memory");
 +
++#ifdef CONFIG_PAX_KERNEXEC
++      pax_open_kernel(cr0);
++#endif
++
 +      gdt[GDT_ENTRY_PCIBIOS_CS].a = 0;
 +      gdt[GDT_ENTRY_PCIBIOS_CS].b = 0;
 +      gdt[GDT_ENTRY_PCIBIOS_DS].a = 0;
 +      gdt[GDT_ENTRY_PCIBIOS_DS].b = 0;
 +
++#ifdef CONFIG_PAX_KERNEXEC
++      pax_close_kernel(cr0);
++#endif
++
        local_irq_restore(flags);
  
        switch (return_code) {
@@ -7108,11 +7263,11 @@
 +
 +              for (cpu = 0; cpu < NR_CPUS; cpu++) {
 +                      gdt = get_cpu_gdt_table(cpu);
-+                      pack_descriptor((u32 *)&gdt[GDT_ENTRY_PCIBIOS_CS].a,
-+                                      (u32 *)&gdt[GDT_ENTRY_PCIBIOS_CS].b,
++                      pack_descriptor((__u32 *)&gdt[GDT_ENTRY_PCIBIOS_CS].a,
++                                      (__u32 *)&gdt[GDT_ENTRY_PCIBIOS_CS].b,
 +                                      address, length, 0x9b, flags);
-+                      pack_descriptor((u32 *)&gdt[GDT_ENTRY_PCIBIOS_DS].a,
-+                                      (u32 *)&gdt[GDT_ENTRY_PCIBIOS_DS].b,
++                      pack_descriptor((__u32 *)&gdt[GDT_ENTRY_PCIBIOS_DS].a,
++                                      (__u32 *)&gdt[GDT_ENTRY_PCIBIOS_DS].b,
 +                                      address, length, 0x93, flags);
 +              }
 +
@@ -7143,7 +7298,7 @@
  
  static int __devinit check_pcibios(void)
  {
-@@ -109,11 +161,13 @@ static int __devinit check_pcibios(void)
+@@ -109,11 +178,13 @@ static int __devinit check_pcibios(void)
        unsigned long flags, pcibios_entry;
  
        if ((pcibios_entry = bios32_service(PCI_SERVICE))) {
@@ -7160,7 +7315,7 @@
                        "jc 1f\n\t"
                        "xor %%ah, %%ah\n"
                        "1:"
-@@ -122,7 +176,8 @@ static int __devinit check_pcibios(void)
+@@ -122,7 +193,8 @@ static int __devinit check_pcibios(void)
                          "=b" (ebx),
                          "=c" (ecx)
                        : "1" (PCIBIOS_PCI_BIOS_PRESENT),
@@ -7170,7 +7325,7 @@
                        : "memory");
                local_irq_restore(flags);
  
-@@ -158,7 +213,10 @@ static int __devinit pci_bios_find_devic
+@@ -158,7 +230,10 @@ static int __devinit pci_bios_find_devic
        unsigned short bx;
        unsigned short ret;
  
@@ -7182,7 +7337,7 @@
                "jc 1f\n\t"
                "xor %%ah, %%ah\n"
                "1:"
-@@ -168,7 +226,8 @@ static int __devinit pci_bios_find_devic
+@@ -168,7 +243,8 @@ static int __devinit pci_bios_find_devic
                  "c" (device_id),
                  "d" (vendor),
                  "S" ((int) index),
@@ -7192,7 +7347,7 @@
        *bus = (bx >> 8) & 0xff;
        *device_fn = bx & 0xff;
        return (int) (ret & 0xff00) >> 8;
-@@ -188,7 +247,10 @@ static int pci_bios_read(unsigned int se
+@@ -188,7 +264,10 @@ static int pci_bios_read(unsigned int se
  
        switch (len) {
        case 1:
@@ -7204,7 +7359,7 @@
                        "jc 1f\n\t"
                        "xor %%ah, %%ah\n"
                        "1:"
-@@ -197,10 +259,14 @@ static int pci_bios_read(unsigned int se
+@@ -197,10 +276,14 @@ static int pci_bios_read(unsigned int se
                        : "1" (PCIBIOS_READ_CONFIG_BYTE),
                          "b" (bx),
                          "D" ((long)reg),
@@ -7221,7 +7376,7 @@
                        "jc 1f\n\t"
                        "xor %%ah, %%ah\n"
                        "1:"
-@@ -209,10 +275,14 @@ static int pci_bios_read(unsigned int se
+@@ -209,10 +292,14 @@ static int pci_bios_read(unsigned int se
                        : "1" (PCIBIOS_READ_CONFIG_WORD),
                          "b" (bx),
                          "D" ((long)reg),
@@ -7238,7 +7393,7 @@
                        "jc 1f\n\t"
                        "xor %%ah, %%ah\n"
                        "1:"
-@@ -221,7 +291,8 @@ static int pci_bios_read(unsigned int se
+@@ -221,7 +308,8 @@ static int pci_bios_read(unsigned int se
                        : "1" (PCIBIOS_READ_CONFIG_DWORD),
                          "b" (bx),
                          "D" ((long)reg),
@@ -7248,7 +7403,7 @@
                break;
        }
  
-@@ -244,7 +315,10 @@ static int pci_bios_write(unsigned int s
+@@ -244,7 +332,10 @@ static int pci_bios_write(unsigned int s
  
        switch (len) {
        case 1:
@@ -7260,7 +7415,7 @@
                        "jc 1f\n\t"
                        "xor %%ah, %%ah\n"
                        "1:"
-@@ -253,10 +327,14 @@ static int pci_bios_write(unsigned int s
+@@ -253,10 +344,14 @@ static int pci_bios_write(unsigned int s
                          "c" (value),
                          "b" (bx),
                          "D" ((long)reg),
@@ -7277,7 +7432,7 @@
                        "jc 1f\n\t"
                        "xor %%ah, %%ah\n"
                        "1:"
-@@ -265,10 +343,14 @@ static int pci_bios_write(unsigned int s
+@@ -265,10 +360,14 @@ static int pci_bios_write(unsigned int s
                          "c" (value),
                          "b" (bx),
                          "D" ((long)reg),
@@ -7294,7 +7449,7 @@
                        "jc 1f\n\t"
                        "xor %%ah, %%ah\n"
                        "1:"
-@@ -277,7 +359,8 @@ static int pci_bios_write(unsigned int s
+@@ -277,7 +376,8 @@ static int pci_bios_write(unsigned int s
                          "c" (value),
                          "b" (bx),
                          "D" ((long)reg),
@@ -7304,7 +7459,7 @@
                break;
        }
  
-@@ -430,10 +513,13 @@ struct irq_routing_table * __devinit pci
+@@ -430,10 +530,13 @@ struct irq_routing_table * __devinit pci
  
        DBG("PCI: Fetching IRQ routing table... ");
        __asm__("push %%es\n\t"
@@ -7319,7 +7474,7 @@
                "jc 1f\n\t"
                "xor %%ah, %%ah\n"
                "1:"
-@@ -444,7 +530,8 @@ struct irq_routing_table * __devinit pci
+@@ -444,7 +547,8 @@ struct irq_routing_table * __devinit pci
                  "1" (0),
                  "D" ((long) &opt),
                  "S" (&pci_indirect),
@@ -7329,7 +7484,7 @@
                : "memory");
        DBG("OK  ret=%d, size=%d, map=%x\n", ret, opt.size, map);
        if (ret & 0xff00)
-@@ -468,7 +555,10 @@ int pcibios_set_irq_routing(struct pci_d
+@@ -468,7 +572,10 @@ int pcibios_set_irq_routing(struct pci_d
  {
        int ret;
  
@@ -7341,7 +7496,7 @@
                "jc 1f\n\t"
                "xor %%ah, %%ah\n"
                "1:"
-@@ -476,7 +566,8 @@ int pcibios_set_irq_routing(struct pci_d
+@@ -476,7 +583,8 @@ int pcibios_set_irq_routing(struct pci_d
                : "0" (PCIBIOS_SET_PCI_HW_INT),
                  "b" ((dev->bus->number << 8) | dev->devfn),
                  "c" ((irq << 8) | (pin + 10)),
@@ -7380,6 +7535,29 @@
  /* Ugly but avoids duplication */
  #include "../../../fs/binfmt_elf.c"
  
+@@ -226,8 +233,20 @@ ia32_setup_arg_pages (struct linux_binpr
+                       mpnt->vm_flags = VM_STACK_FLAGS & ~VM_EXEC;
+               else
+                       mpnt->vm_flags = VM_STACK_FLAGS;
+-              mpnt->vm_page_prot = (mpnt->vm_flags & VM_EXEC)?
+-                                      PAGE_COPY_EXEC: PAGE_COPY;
++
++#if defined(CONFIG_PAX_PAGEEXEC) || defined(CONFIG_PAX_SEGMEXEC)
++              if (current-<mm->pax_flags & (MF_PAX_PAGEEXEC | 
MF_PAX_SEGMEXEC)) {
++                      mpnt->vm_flags &= ~VM_EXEC;
++
++#ifdef CONFIG_PAX_MPROTECT
++                      if (current->mm->pax_flags & MF_PAX_MPROTECT)
++                              mpnt->vm_flags &= ~VM_MAYEXEC;
++#endif
++
++      }
++#endif
++
++              mpnt->vm_page_prot = vm_get_page_prot(mpnt->vm_flags);
+               if ((ret = insert_vm_struct(current->mm, mpnt))) {
+                       up_write(&current->mm->mmap_sem);
+                       kmem_cache_free(vm_area_cachep, mpnt);
 diff -urNp linux-2.6.22.1/arch/ia64/ia32/ia32priv.h 
linux-2.6.22.1/arch/ia64/ia32/ia32priv.h
 --- linux-2.6.22.1/arch/ia64/ia32/ia32priv.h   2007-07-10 14:56:30.000000000 
-0400
 +++ linux-2.6.22.1/arch/ia64/ia32/ia32priv.h   2007-08-02 11:38:45.000000000 
-0400
@@ -7612,15 +7790,29 @@
  #include <asm/dma.h>
  #include <asm/ia32.h>
  #include <asm/io.h>
-@@ -130,7 +130,7 @@ ia64_init_addr_space (void)
+@@ -130,8 +130,21 @@ ia64_init_addr_space (void)
                vma->vm_mm = current->mm;
                vma->vm_start = current->thread.rbs_bot & PAGE_MASK;
                vma->vm_end = vma->vm_start + PAGE_SIZE;
 -              vma->vm_page_prot = protection_map[VM_DATA_DEFAULT_FLAGS & 0x7];
-+              vma->vm_page_prot = vm_get_page_prot(VM_DATA_DEFAULT_FLAGS);
                vma->vm_flags = VM_DATA_DEFAULT_FLAGS|VM_GROWSUP|VM_ACCOUNT;
++
++#if defined(CONFIG_PAX_PAGEEXEC) || defined(CONFIG_PAX_SEGMEXEC)
++              if (current->mm->pax_flags & (MF_PAX_PAGEEXEC | 
MF_PAX_SEGMEXEC)) {
++                      vma->vm_flags &= ~VM_EXEC;
++
++#ifdef CONFIG_PAX_MPROTECT
++                      if (current->mm->pax_flags & MF_PAX_MPROTECT)
++                              vma->vm_flags &= ~VM_MAYEXEC;
++#endif
++
++      }
++#endif
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/linux-2.6-grsec_full.patch?r1=1.1.2.15&r2=1.1.2.16&f=u

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to