packages (GRSECURITY_RAW): kernel/kernel-grsec_full.patch - up to http://ww...

mguevara mguevara at pld-linux.org
Mon Oct 19 02:34:43 CEST 2009


Author: mguevara                     Date: Mon Oct 19 00:34:43 2009 GMT
Module: packages                      Tag: GRSECURITY_RAW
---- Log message:
- up to http://www.grsecurity.net/~spender/grsecurity-2.1.14-2.6.31.4-200910181015.patch

---- Files affected:
packages/kernel:
   kernel-grsec_full.patch (1.3.2.17 -> 1.3.2.18) 

---- Diffs:

================================================================
Index: packages/kernel/kernel-grsec_full.patch
diff -u packages/kernel/kernel-grsec_full.patch:1.3.2.17 packages/kernel/kernel-grsec_full.patch:1.3.2.18
--- packages/kernel/kernel-grsec_full.patch:1.3.2.17	Wed Oct 14 23:57:51 2009
+++ packages/kernel/kernel-grsec_full.patch	Mon Oct 19 02:34:34 2009
@@ -6454,24 +6454,31 @@
  extern int iommu_pass_through;
 diff -urNp linux-2.6.31.4/arch/x86/include/asm/irqflags.h linux-2.6.31.4/arch/x86/include/asm/irqflags.h
 --- linux-2.6.31.4/arch/x86/include/asm/irqflags.h	2009-10-05 13:12:06.000000000 -0400
-+++ linux-2.6.31.4/arch/x86/include/asm/irqflags.h	2009-10-14 17:18:30.945315132 -0400
-@@ -147,6 +147,20 @@ static inline unsigned long __raw_local_
++++ linux-2.6.31.4/arch/x86/include/asm/irqflags.h	2009-10-18 10:12:57.682033309 -0400
+@@ -147,6 +147,27 @@ static inline unsigned long __raw_local_
  #define INTERRUPT_RETURN		iret
  #define ENABLE_INTERRUPTS_SYSEXIT	sti; sysexit
  #define GET_CR0_INTO_EAX		movl %cr0, %eax
 +
 +/* PaX: special register usage in entry_32.S, beware */
-+#define PAX_OPEN_KERNEL		\
-+	movl %esi, %cr0
++#ifdef CONFIG_PAX_KERNEXEC
++#define PAX_RESTORE_KERNEL	\
++	bt $16, %esi;		\
++	jc 1f;			\
++	movl %esi, %cr0;	\
++1:
 +
 +#define PAX_CLOSE_KERNEL	\
-+	movl %cr0, %edx;	\
-+	testl $X86_CR0_WP, %edx;\
-+	jnz 1f;			\
-+	movl %edx, %esi;	\
-+	orl $X86_CR0_WP, %esi;	\
-+	movl %esi, %cr0;	\
++	movl %cr0, %esi;	\
++	movl %esi, %edx;	\
++	bts $16, %edx;		\
++	jc 1f;			\
++	movl %edx, %cr0;	\
 +1:
++#else
++#define PAX_RESTORE_KERNEL
++#define PAX_CLOSE_KERNEL
++#endif
 +
  #endif
  
@@ -6902,7 +6909,7 @@
  #define __VIRTUAL_MASK_SHIFT	47
 diff -urNp linux-2.6.31.4/arch/x86/include/asm/paravirt.h linux-2.6.31.4/arch/x86/include/asm/paravirt.h
 --- linux-2.6.31.4/arch/x86/include/asm/paravirt.h	2009-10-05 13:12:06.000000000 -0400
-+++ linux-2.6.31.4/arch/x86/include/asm/paravirt.h	2009-10-14 17:18:30.945315132 -0400
++++ linux-2.6.31.4/arch/x86/include/asm/paravirt.h	2009-10-18 10:08:40.907788965 -0400
 @@ -350,6 +350,12 @@ struct pv_mmu_ops {
  	   an mfn.  We can tell which is which from the index. */
  	void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx,
@@ -6916,7 +6923,40 @@
  };
  
  struct raw_spinlock;
-@@ -1437,6 +1443,21 @@ static inline void __set_fixmap(unsigned
+@@ -528,10 +534,11 @@ int paravirt_disable_iospace(void);
+ #define EXTRA_CLOBBERS
+ #define VEXTRA_CLOBBERS
+ #else  /* CONFIG_X86_64 */
++/* [re]ax isn't an arg, but the return val */
+ #define PVOP_VCALL_ARGS					\
+ 	unsigned long __edi = __edi, __esi = __esi,	\
+-		__edx = __edx, __ecx = __ecx
+-#define PVOP_CALL_ARGS		PVOP_VCALL_ARGS, __eax
++		__edx = __edx, __ecx = __ecx, __eax = __eax
++#define PVOP_CALL_ARGS		PVOP_VCALL_ARGS
+ 
+ #define PVOP_CALL_ARG1(x)		"D" ((unsigned long)(x))
+ #define PVOP_CALL_ARG2(x)		"S" ((unsigned long)(x))
+@@ -543,6 +550,7 @@ int paravirt_disable_iospace(void);
+ 				"=c" (__ecx)
+ #define PVOP_CALL_CLOBBERS	PVOP_VCALL_CLOBBERS, "=a" (__eax)
+ 
++/* void functions are still allowed [re]ax for scratch */
+ #define PVOP_VCALLEE_CLOBBERS	"=a" (__eax)
+ #define PVOP_CALLEE_CLOBBERS	PVOP_VCALLEE_CLOBBERS
+ 
+@@ -617,8 +625,8 @@ int paravirt_disable_iospace(void);
+ 		       VEXTRA_CLOBBERS,					\
+ 		       pre, post, ##__VA_ARGS__)
+ 
+-#define __PVOP_VCALLEESAVE(rettype, op, pre, post, ...)			\
+-	____PVOP_CALL(rettype, op.func, CLBR_RET_REG,			\
++#define __PVOP_VCALLEESAVE(op, pre, post, ...)				\
++	____PVOP_VCALL(op.func, CLBR_RET_REG,				\
+ 		      PVOP_VCALLEE_CLOBBERS, ,				\
+ 		      pre, post, ##__VA_ARGS__)
+ 
+@@ -1437,6 +1445,21 @@ static inline void __set_fixmap(unsigned
  	pv_mmu_ops.set_fixmap(idx, phys, flags);
  }
  
@@ -6938,7 +6978,54 @@
  void _paravirt_nop(void);
  u32 _paravirt_ident_32(u32);
  u64 _paravirt_ident_64(u64);
-@@ -1688,7 +1709,7 @@ static inline unsigned long __raw_local_
+@@ -1565,42 +1588,22 @@ extern struct paravirt_patch_site __para
+ 
+ static inline unsigned long __raw_local_save_flags(void)
+ {
+-	unsigned long f;
+-
+-	asm volatile(paravirt_alt(PARAVIRT_CALL)
+-		     : "=a"(f)
+-		     : paravirt_type(pv_irq_ops.save_fl),
+-		       paravirt_clobber(CLBR_EAX)
+-		     : "memory", "cc");
+-	return f;
++	return PVOP_CALLEE0(unsigned long, pv_irq_ops.save_fl);
+ }
+ 
+ static inline void raw_local_irq_restore(unsigned long f)
+ {
+-	asm volatile(paravirt_alt(PARAVIRT_CALL)
+-		     : "=a"(f)
+-		     : PV_FLAGS_ARG(f),
+-		       paravirt_type(pv_irq_ops.restore_fl),
+-		       paravirt_clobber(CLBR_EAX)
+-		     : "memory", "cc");
++	return PVOP_VCALLEE1(pv_irq_ops.restore_fl, f);
+ }
+ 
+ static inline void raw_local_irq_disable(void)
+ {
+-	asm volatile(paravirt_alt(PARAVIRT_CALL)
+-		     :
+-		     : paravirt_type(pv_irq_ops.irq_disable),
+-		       paravirt_clobber(CLBR_EAX)
+-		     : "memory", "eax", "cc");
++	PVOP_VCALLEE0(pv_irq_ops.irq_disable);
+ }
+ 
+ static inline void raw_local_irq_enable(void)
+ {
+-	asm volatile(paravirt_alt(PARAVIRT_CALL)
+-		     :
+-		     : paravirt_type(pv_irq_ops.irq_enable),
+-		       paravirt_clobber(CLBR_EAX)
+-		     : "memory", "eax", "cc");
++	PVOP_VCALLEE0(pv_irq_ops.irq_enable);
+ }
+ 
+ static inline unsigned long __raw_local_irq_save(void)
+@@ -1688,7 +1691,7 @@ static inline unsigned long __raw_local_
  
  #define PARA_PATCH(struct, off)        ((PARAVIRT_PATCH_##struct + (off)) / 4)
  #define PARA_SITE(ptype, clobbers, ops) _PVSITE(ptype, clobbers, ops, .long, 4)
@@ -6947,21 +7034,30 @@
  #endif
  
  #define INTERRUPT_RETURN						\
-@@ -1713,6 +1734,18 @@ static inline unsigned long __raw_local_
+@@ -1713,6 +1716,27 @@ static inline unsigned long __raw_local_
  		  jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_usergs_sysret32))
  
  #ifdef CONFIG_X86_32
-+#define PAX_OPEN_KERNEL						\
++
++#ifdef CONFIG_PAX_KERNEXEC
++#define PAX_RESTORE_KERNEL					\
++	bt $16, %esi;						\
++	jc 1f;							\
 +	push %eax; push %ecx;					\
-+	call PARA_INDIRECT(pv_mmu_ops+PV_MMU_pax_open_kernel);	\
-+	mov %eax, %edx;						\
-+	pop %ecx; pop %eax
++	movl %esi, %eax;					\
++	call PARA_INDIRECT(pv_cpu_ops+PV_CPU_write_cr0);	\
++	pop %ecx; pop %eax;					\
++1:
 +
 +#define PAX_CLOSE_KERNEL					\
 +	push %eax; push %ecx;					\
-+	mov %edx, %eax;						\
 +	call PARA_INDIRECT(pv_mmu_ops+PV_MMU_pax_close_kernel);	\
++	movl %eax, %esi;					\
 +	pop %ecx; pop %eax
++#else
++#define PAX_RESTORE_KERNEL
++#define PAX_CLOSE_KERNEL
++#endif
 +
  #define GET_CR0_INTO_EAX				\
  	push %ecx; push %edx;				\
@@ -8725,13 +8821,17 @@
  
 diff -urNp linux-2.6.31.4/arch/x86/kernel/asm-offsets_32.c linux-2.6.31.4/arch/x86/kernel/asm-offsets_32.c
 --- linux-2.6.31.4/arch/x86/kernel/asm-offsets_32.c	2009-10-05 13:12:06.000000000 -0400
-+++ linux-2.6.31.4/arch/x86/kernel/asm-offsets_32.c	2009-10-12 23:12:55.159062083 -0400
-@@ -115,6 +115,8 @@ void foo(void)
++++ linux-2.6.31.4/arch/x86/kernel/asm-offsets_32.c	2009-10-18 10:09:07.003389630 -0400
+@@ -115,6 +115,12 @@ void foo(void)
  	OFFSET(PV_CPU_iret, pv_cpu_ops, iret);
  	OFFSET(PV_CPU_irq_enable_sysexit, pv_cpu_ops, irq_enable_sysexit);
  	OFFSET(PV_CPU_read_cr0, pv_cpu_ops, read_cr0);
-+	OFFSET(PV_MMU_pax_open_kernel, pv_mmu_ops, pax_open_kernel);
++
++#ifdef CONFIG_PAX_KERNEXEC
++	OFFSET(PV_CPU_write_cr0, pv_cpu_ops, write_cr0);
 +	OFFSET(PV_MMU_pax_close_kernel, pv_mmu_ops, pax_close_kernel);
++#endif
++
  #endif
  
  #ifdef CONFIG_XEN
@@ -9388,7 +9488,7 @@
  efi_rt_function_ptr:
 diff -urNp linux-2.6.31.4/arch/x86/kernel/entry_32.S linux-2.6.31.4/arch/x86/kernel/entry_32.S
 --- linux-2.6.31.4/arch/x86/kernel/entry_32.S	2009-10-05 13:12:06.000000000 -0400
-+++ linux-2.6.31.4/arch/x86/kernel/entry_32.S	2009-10-13 19:00:18.378759190 -0400
++++ linux-2.6.31.4/arch/x86/kernel/entry_32.S	2009-10-18 10:09:07.029411525 -0400
 @@ -191,7 +191,7 @@
  
  #endif	/* CONFIG_X86_32_LAZY_GS */
@@ -9407,17 +9507,14 @@
  	movl %edx, %ds
  	movl %edx, %es
  	movl $(__KERNEL_PERCPU), %edx
-@@ -232,6 +232,18 @@
+@@ -232,6 +232,15 @@
  	SET_KERNEL_GS %edx
  .endm
  
 +.macro SAVE_ALL
-+#ifdef CONFIG_PAX_KERNEXEC
-+	__SAVE_ALL __KERNEL_DS
-+	PAX_CLOSE_KERNEL;
-+	movl %edx, %esi;
-+#elif defined(CONFIG_PAX_PAGEEXEC) || defined(CONFIG_PAX_SEGMEXEC) || defined(CONFIG_PAX_MEMORY_UDEREF)
++#if defined(CONFIG_PAX_KERNEXEC) || defined(CONFIG_PAX_PAGEEXEC) || defined(CONFIG_PAX_SEGMEXEC) || defined(CONFIG_PAX_MEMORY_UDEREF)
 +	__SAVE_ALL __KERNEL_DS
++	PAX_CLOSE_KERNEL
 +#else
 +	__SAVE_ALL __USER_DS
 +#endif
@@ -9426,7 +9523,7 @@
  .macro RESTORE_INT_REGS
  	popl %ebx
  	CFI_ADJUST_CFA_OFFSET -4
-@@ -352,7 +364,17 @@ check_userspace:
+@@ -352,7 +361,15 @@ check_userspace:
  	movb PT_CS(%esp), %al
  	andl $(X86_EFLAGS_VM | SEGMENT_RPL_MASK), %eax
  	cmpl $USER_RPL, %eax
@@ -9434,9 +9531,7 @@
 +#ifdef CONFIG_PAX_KERNEXEC
 +	jae resume_userspace
 +
-+	testl $X86_CR0_WP, %esi
-+	jnz resume_kernel
-+	PAX_OPEN_KERNEL;
++	PAX_RESTORE_KERNEL
 +	jmp resume_kernel
 +#else
  	jb resume_kernel		# not returning to v8086 or userspace
@@ -9444,7 +9539,7 @@
  
  ENTRY(resume_userspace)
  	LOCKDEP_SYS_EXIT
-@@ -414,10 +436,9 @@ sysenter_past_esp:
+@@ -414,10 +431,9 @@ sysenter_past_esp:
  	/*CFI_REL_OFFSET cs, 0*/
  	/*
  	 * Push current_thread_info()->sysenter_return to the stack.
@@ -9457,7 +9552,7 @@
  	CFI_ADJUST_CFA_OFFSET 4
  	CFI_REL_OFFSET eip, 0
  
-@@ -430,9 +451,19 @@ sysenter_past_esp:
+@@ -430,9 +446,19 @@ sysenter_past_esp:
   * Load the potential sixth argument from user stack.
   * Careful about security.
   */
@@ -9477,7 +9572,7 @@
  	movl %ebp,PT_EBP(%esp)
  .section __ex_table,"a"
  	.align 4
-@@ -455,12 +486,23 @@ sysenter_do_call:
+@@ -455,12 +481,23 @@ sysenter_do_call:
  	testl $_TIF_ALLWORK_MASK, %ecx
  	jne sysexit_audit
  sysenter_exit:
@@ -9501,7 +9596,7 @@
  	PTGS_TO_GS
  	ENABLE_INTERRUPTS_SYSEXIT
  
-@@ -504,11 +546,17 @@ sysexit_audit:
+@@ -504,11 +541,17 @@ sysexit_audit:
  
  	CFI_ENDPROC
  .pushsection .fixup,"ax"
@@ -9521,7 +9616,7 @@
  .popsection
  	PTGS_TO_GS_EX
  ENDPROC(ia32_sysenter_target)
-@@ -538,6 +586,10 @@ syscall_exit:
+@@ -538,6 +581,10 @@ syscall_exit:
  	testl $_TIF_ALLWORK_MASK, %ecx	# current->work
  	jne syscall_exit_work
  
@@ -9532,7 +9627,7 @@
  restore_all:
  	TRACE_IRQS_IRET
  restore_all_notrace:
-@@ -602,7 +654,13 @@ ldt_ss:
+@@ -602,7 +649,13 @@ ldt_ss:
  	mov PT_OLDESP(%esp), %eax	/* load userspace esp */
  	mov %dx, %ax			/* eax: new kernel esp */
  	sub %eax, %edx			/* offset (low word is 0) */
@@ -9547,7 +9642,7 @@
  	shr $16, %edx
  	mov %dl, GDT_ENTRY_ESPFIX_SS * 8 + 4(%ebx) /* bits 16..23 */
  	mov %dh, GDT_ENTRY_ESPFIX_SS * 8 + 7(%ebx) /* bits 24..31 */
-@@ -642,25 +700,19 @@ work_resched:
+@@ -642,25 +695,19 @@ work_resched:
  
  work_notifysig:				# deal with pending signals and
  					# notify-resume requests
@@ -9576,7 +9671,7 @@
  #endif
  	xorl %edx, %edx
  	call do_notify_resume
-@@ -695,6 +747,10 @@ END(syscall_exit_work)
+@@ -695,6 +742,10 @@ END(syscall_exit_work)
  
  	RING0_INT_FRAME			# can't unwind into user space anyway
  syscall_fault:
@@ -9587,7 +9682,7 @@
  	GET_THREAD_INFO(%ebp)
  	movl $-EFAULT,PT_EAX(%esp)
  	jmp resume_userspace
-@@ -735,7 +791,13 @@ PTREGSCALL(vm86old)
+@@ -735,7 +786,13 @@ PTREGSCALL(vm86old)
   * normal stack and adjusts ESP with the matching offset.
   */
  	/* fixup the stack */
@@ -9602,7 +9697,7 @@
  	mov GDT_ENTRY_ESPFIX_SS * 8 + 4(%ebx), %al /* bits 16..23 */
  	mov GDT_ENTRY_ESPFIX_SS * 8 + 7(%ebx), %ah /* bits 24..31 */
  	shl $16, %eax
-@@ -1198,7 +1260,6 @@ return_to_handler:
+@@ -1198,7 +1255,6 @@ return_to_handler:
  	ret
  #endif
  
@@ -9610,15 +9705,12 @@
  #include "syscall_table_32.S"
  
  syscall_table_size=(.-sys_call_table)
-@@ -1250,12 +1311,18 @@ error_code:
+@@ -1250,12 +1306,15 @@ error_code:
  	movl %ecx, %fs
  	UNWIND_ESPFIX_STACK
  	GS_TO_REG %ecx
 +
-+#ifdef CONFIG_PAX_KERNEXEC
-+	PAX_CLOSE_KERNEL;
-+	movl %edx, %esi
-+#endif
++	PAX_CLOSE_KERNEL
 +
  	movl PT_GS(%esp), %edi		# get the function address
  	movl PT_ORIG_EAX(%esp), %edx	# get the error code
@@ -9630,32 +9722,22 @@
  	movl %ecx, %ds
  	movl %ecx, %es
  	TRACE_IRQS_OFF
-@@ -1351,6 +1418,14 @@ nmi_stack_correct:
+@@ -1351,6 +1410,9 @@ nmi_stack_correct:
  	xorl %edx,%edx		# zero error code
  	movl %esp,%eax		# pt_regs pointer
  	call do_nmi
 +
-+#ifdef CONFIG_PAX_KERNEXEC
-+	testl $X86_CR0_WP, %esi
-+	jnz 1f
-+	PAX_OPEN_KERNEL;
-+1:
-+#endif
++	PAX_RESTORE_KERNEL
 +
  	jmp restore_all_notrace
  	CFI_ENDPROC
  
-@@ -1391,6 +1466,14 @@ nmi_espfix_stack:
+@@ -1391,6 +1453,9 @@ nmi_espfix_stack:
  	FIXUP_ESPFIX_STACK		# %eax == %esp
  	xorl %edx,%edx			# zero error code
  	call do_nmi
 +
-+#ifdef CONFIG_PAX_KERNEXEC
-+	testl $X86_CR0_WP, %esi
-+	jnz 1f
-+	PAX_OPEN_KERNEL;
-+1:
-+#endif
++	PAX_RESTORE_KERNEL
 +
  	RESTORE_REGS
  	lss 12+4(%esp), %esp		# back to espfix stack
@@ -9712,7 +9794,7 @@
  	/* Reserve INITRD */
 diff -urNp linux-2.6.31.4/arch/x86/kernel/head_32.S linux-2.6.31.4/arch/x86/kernel/head_32.S
 --- linux-2.6.31.4/arch/x86/kernel/head_32.S	2009-10-05 13:12:06.000000000 -0400
-+++ linux-2.6.31.4/arch/x86/kernel/head_32.S	2009-10-11 15:29:56.556364216 -0400
++++ linux-2.6.31.4/arch/x86/kernel/head_32.S	2009-10-18 10:15:00.924043933 -0400
 @@ -19,10 +19,17 @@
  #include <asm/setup.h>
  #include <asm/processor-flags.h>
@@ -9783,7 +9865,7 @@
 +	movb %al,__KERNEL_PERCPU + 4(%edi)
 +	movb %ah,__KERNEL_PERCPU + 7(%edi)
 +	movl $__per_cpu_end - 1,%eax
-+	subl $__per_cpu_load,%eax
++	subl $__per_cpu_start,%eax
 +	movw %ax,__KERNEL_PERCPU + 0(%edi)
 +#endif
 +
@@ -10726,16 +10808,8 @@
  }
 diff -urNp linux-2.6.31.4/arch/x86/kernel/module.c linux-2.6.31.4/arch/x86/kernel/module.c
 --- linux-2.6.31.4/arch/x86/kernel/module.c	2009-10-05 13:12:06.000000000 -0400
-+++ linux-2.6.31.4/arch/x86/kernel/module.c	2009-10-12 23:12:55.189930027 -0400
-@@ -27,6 +27,7 @@
- #include <asm/system.h>
- #include <asm/page.h>
- #include <asm/pgtable.h>
-+#include <asm/desc.h>
- 
- #if 0
- #define DEBUGP printk
-@@ -34,7 +35,7 @@
++++ linux-2.6.31.4/arch/x86/kernel/module.c	2009-10-18 10:09:07.037806226 -0400
+@@ -34,7 +34,7 @@
  #define DEBUGP(fmt...)
  #endif
  
@@ -10744,7 +10818,7 @@
  {
  	struct vm_struct *area;
  
-@@ -48,9 +49,90 @@ void *module_alloc(unsigned long size)
+@@ -48,9 +48,90 @@ void *module_alloc(unsigned long size)
  	if (!area)
  		return NULL;
  
@@ -10837,7 +10911,7 @@
  
  /* Free memory returned from module_alloc */
  void module_free(struct module *mod, void *module_region)
-@@ -77,14 +159,16 @@ int apply_relocate(Elf32_Shdr *sechdrs,
+@@ -77,14 +158,16 @@ int apply_relocate(Elf32_Shdr *sechdrs,
  	unsigned int i;
  	Elf32_Rel *rel = (void *)sechdrs[relsec].sh_addr;
  	Elf32_Sym *sym;
@@ -10857,7 +10931,7 @@
  		/* This is the symbol it is referring to.  Note that all
  		   undefined symbols have been resolved.  */
  		sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
-@@ -93,11 +177,15 @@ int apply_relocate(Elf32_Shdr *sechdrs,
+@@ -93,11 +176,15 @@ int apply_relocate(Elf32_Shdr *sechdrs,
  		switch (ELF32_R_TYPE(rel[i].r_info)) {
  		case R_386_32:
  			/* We add the value into the location given */
@@ -10875,7 +10949,7 @@
  			break;
  		default:
  			printk(KERN_ERR "module %s: Unknown relocation: %u\n",
-@@ -153,21 +241,30 @@ int apply_relocate_add(Elf64_Shdr *sechd
+@@ -153,21 +240,30 @@ int apply_relocate_add(Elf64_Shdr *sechd
  		case R_X86_64_NONE:
  			break;
  		case R_X86_64_64:
@@ -12174,7 +12248,7 @@
  		tsk->thread.sysenter_cs = 0;
 diff -urNp linux-2.6.31.4/arch/x86/kernel/vmi_32.c linux-2.6.31.4/arch/x86/kernel/vmi_32.c
 --- linux-2.6.31.4/arch/x86/kernel/vmi_32.c	2009-10-05 13:12:06.000000000 -0400
-+++ linux-2.6.31.4/arch/x86/kernel/vmi_32.c	2009-10-13 19:00:18.380098626 -0400
++++ linux-2.6.31.4/arch/x86/kernel/vmi_32.c	2009-10-18 10:15:00.936767037 -0400
 @@ -44,12 +44,17 @@ typedef u32 __attribute__((regparm(1))) 
  typedef u64 __attribute__((regparm(2))) (VROMLONGFUNC)(int);
  
@@ -12253,10 +12327,11 @@
  	ap.fs = __KERNEL_PERCPU;
  	ap.gs = __KERNEL_STACK_CANARY;
  
-@@ -486,6 +492,16 @@ static void vmi_leave_lazy_mmu(void)
+@@ -486,6 +492,18 @@ static void vmi_leave_lazy_mmu(void)
  	paravirt_leave_lazy_mmu();
  }
  
++#ifdef CONFIG_PAX_KERNEXEC
 +static unsigned long vmi_pax_open_kernel(void)
 +{
 +	return 0;
@@ -12266,11 +12341,12 @@
 +{
 +	return 0;
 +}
++#endif
 +
  static inline int __init check_vmi_rom(struct vrom_header *rom)
  {
  	struct pci_header *pci;
-@@ -498,6 +514,10 @@ static inline int __init check_vmi_rom(s
+@@ -498,6 +516,10 @@ static inline int __init check_vmi_rom(s
  		return 0;
  	if (rom->vrom_signature != VMI_SIGNATURE)
  		return 0;
@@ -12281,7 +12357,7 @@
  	if (rom->api_version_maj != VMI_API_REV_MAJOR ||
  	    rom->api_version_min+1 < VMI_API_REV_MINOR+1) {
  		printk(KERN_WARNING "VMI: Found mismatched rom version %d.%d\n",
-@@ -562,7 +582,7 @@ static inline int __init probe_vmi_rom(v
+@@ -562,7 +584,7 @@ static inline int __init probe_vmi_rom(v
  		struct vrom_header *romstart;
  		romstart = (struct vrom_header *)isa_bus_to_virt(base);
  		if (check_vmi_rom(romstart)) {
@@ -12290,7 +12366,7 @@
  			return 1;
  		}
  	}
-@@ -836,6 +856,11 @@ static inline int __init activate_vmi(vo
+@@ -836,6 +858,11 @@ static inline int __init activate_vmi(vo
  
  	para_fill(pv_irq_ops.safe_halt, Halt);
  
@@ -12302,7 +12378,7 @@
  	/*
  	 * Alternative instruction rewriting doesn't happen soon enough
  	 * to convert VMI_IRET to a call instead of a jump; so we have
-@@ -853,16 +878,16 @@ static inline int __init activate_vmi(vo
+@@ -853,16 +880,16 @@ static inline int __init activate_vmi(vo
  
  void __init vmi_init(void)
  {
@@ -12323,7 +12399,7 @@
  
  #ifdef CONFIG_X86_IO_APIC
  	/* This is virtual hardware; timer routing is wired correctly */
-@@ -874,7 +899,7 @@ void __init vmi_activate(void)
+@@ -874,7 +901,7 @@ void __init vmi_activate(void)
  {
  	unsigned long flags;
  
@@ -15523,16 +15599,8 @@
  	}
 diff -urNp linux-2.6.31.4/arch/x86/mm/init_32.c linux-2.6.31.4/arch/x86/mm/init_32.c
 --- linux-2.6.31.4/arch/x86/mm/init_32.c	2009-10-05 13:12:06.000000000 -0400
-+++ linux-2.6.31.4/arch/x86/mm/init_32.c	2009-10-11 15:29:56.560399027 -0400
-@@ -51,6 +51,7 @@
- #include <asm/cacheflush.h>
- #include <asm/page_types.h>
- #include <asm/init.h>
-+#include <asm/desc.h>
- 
- unsigned long highstart_pfn, highend_pfn;
- 
-@@ -72,36 +73,6 @@ static __init void *alloc_low_page(void)
++++ linux-2.6.31.4/arch/x86/mm/init_32.c	2009-10-18 10:09:07.063636365 -0400
+@@ -72,36 +72,6 @@ static __init void *alloc_low_page(void)
  }
  
  /*
@@ -15569,7 +15637,7 @@
   * Create a page table and place a pointer to it in a middle page
   * directory entry:
   */
-@@ -121,13 +92,28 @@ static pte_t * __init one_page_table_ini
+@@ -121,13 +91,28 @@ static pte_t * __init one_page_table_ini
  			page_table = (pte_t *)alloc_low_page();
  
  		paravirt_alloc_pte(&init_mm, __pa(page_table) >> PAGE_SHIFT);
@@ -15598,7 +15666,7 @@
  pmd_t * __init populate_extra_pmd(unsigned long vaddr)
  {
  	int pgd_idx = pgd_index(vaddr);
-@@ -201,6 +187,7 @@ page_table_range_init(unsigned long star
+@@ -201,6 +186,7 @@ page_table_range_init(unsigned long star
  	int pgd_idx, pmd_idx;
  	unsigned long vaddr;
  	pgd_t *pgd;
@@ -15606,7 +15674,7 @@
  	pmd_t *pmd;
  	pte_t *pte = NULL;
  
-@@ -210,8 +197,13 @@ page_table_range_init(unsigned long star
+@@ -210,8 +196,13 @@ page_table_range_init(unsigned long star
  	pgd = pgd_base + pgd_idx;
  
<<Diff was trimmed, longer than 597 lines>>

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/kernel/kernel-grsec_full.patch?r1=1.3.2.17&r2=1.3.2.18&f=u



More information about the pld-cvs-commit mailing list