aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2010-04-13 08:05:19 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2010-04-14 12:21:53 +0000
commitf4c1523e429f2a7e9d5c83c6d8a41b0a6fdbd2b0 (patch)
treed2c4108ef53bd7eb97d0efce918cef9c3e119a2f
parent6dd7139df647443641f5a1a6bddc77a93e64d697 (diff)
downloadalpine_aports-f4c1523e429f2a7e9d5c83c6d8a41b0a6fdbd2b0.tar.bz2
alpine_aports-f4c1523e429f2a7e9d5c83c6d8a41b0a6fdbd2b0.tar.xz
alpine_aports-f4c1523e429f2a7e9d5c83c6d8a41b0a6fdbd2b0.zip
main/linux-grsec: upgrade to 2.1.14-2.6.32.11-201004071936
(cherry picked from commit 4afea78ab3bd6afcac3466cd87785aa355c66e43)
-rw-r--r--main/linux-grsec/APKBUILD6
-rw-r--r--main/linux-grsec/grsecurity-2.1.14-2.6.32.11-201004071936.patch (renamed from main/linux-grsec/grsecurity-2.1.14-2.6.32.11-201004042103.patch)282
2 files changed, 167 insertions, 121 deletions
diff --git a/main/linux-grsec/APKBUILD b/main/linux-grsec/APKBUILD
index 0e93993e87..2b81673eaf 100644
--- a/main/linux-grsec/APKBUILD
+++ b/main/linux-grsec/APKBUILD
@@ -4,7 +4,7 @@ _flavor=grsec
4pkgname=linux-${_flavor} 4pkgname=linux-${_flavor}
5pkgver=2.6.32.11 5pkgver=2.6.32.11
6_kernver=2.6.32 6_kernver=2.6.32
7pkgrel=0 7pkgrel=1
8pkgdesc="Linux kernel with grsecurity" 8pkgdesc="Linux kernel with grsecurity"
9url=http://grsecurity.net 9url=http://grsecurity.net
10depends="mkinitfs linux-firmware" 10depends="mkinitfs linux-firmware"
@@ -14,7 +14,7 @@ _config=${config:-kernelconfig.${CARCH:-x86}}
14install= 14install=
15source="ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$_kernver.tar.bz2 15source="ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-$_kernver.tar.bz2
16 ftp://ftp.kernel.org/pub/linux/kernel/v2.6/patch-$pkgver.bz2 16 ftp://ftp.kernel.org/pub/linux/kernel/v2.6/patch-$pkgver.bz2
17 grsecurity-2.1.14-2.6.32.11-201004042103.patch 17 grsecurity-2.1.14-2.6.32.11-201004071936.patch
18 ip_gre.patch 18 ip_gre.patch
19 ip_gre2.patch 19 ip_gre2.patch
20 arp.patch 20 arp.patch
@@ -126,7 +126,7 @@ firmware() {
126 126
127md5sums="260551284ac224c3a43c4adac7df4879 linux-2.6.32.tar.bz2 127md5sums="260551284ac224c3a43c4adac7df4879 linux-2.6.32.tar.bz2
128855c248334a71ef5ca3d8cb89d51334f patch-2.6.32.11.bz2 128855c248334a71ef5ca3d8cb89d51334f patch-2.6.32.11.bz2
12986fc90c3b2821a5dc0df726893c63297 grsecurity-2.1.14-2.6.32.11-201004042103.patch 1296eabb0c08a988a97a823b5462d1c5018 grsecurity-2.1.14-2.6.32.11-201004071936.patch
1303ef822f3a2723b9a80c3f12954457225 ip_gre.patch 1303ef822f3a2723b9a80c3f12954457225 ip_gre.patch
13113ca9e91700e459da269c957062bbea7 ip_gre2.patch 13113ca9e91700e459da269c957062bbea7 ip_gre2.patch
1324c39a161d918e7f274292ecfd168b891 arp.patch 1324c39a161d918e7f274292ecfd168b891 arp.patch
diff --git a/main/linux-grsec/grsecurity-2.1.14-2.6.32.11-201004042103.patch b/main/linux-grsec/grsecurity-2.1.14-2.6.32.11-201004071936.patch
index 77ce387829..62c446bc3e 100644
--- a/main/linux-grsec/grsecurity-2.1.14-2.6.32.11-201004042103.patch
+++ b/main/linux-grsec/grsecurity-2.1.14-2.6.32.11-201004071936.patch
@@ -6908,6 +6908,21 @@ diff -urNp linux-2.6.32.11/arch/x86/include/asm/iommu.h linux-2.6.32.11/arch/x86
6908 extern int force_iommu, no_iommu; 6908 extern int force_iommu, no_iommu;
6909 extern int iommu_detected; 6909 extern int iommu_detected;
6910 extern int iommu_pass_through; 6910 extern int iommu_pass_through;
6911diff -urNp linux-2.6.32.11/arch/x86/include/asm/irqflags.h linux-2.6.32.11/arch/x86/include/asm/irqflags.h
6912--- linux-2.6.32.11/arch/x86/include/asm/irqflags.h 2010-03-15 11:52:04.000000000 -0400
6913+++ linux-2.6.32.11/arch/x86/include/asm/irqflags.h 2010-04-07 19:33:06.601891934 -0400
6914@@ -142,6 +142,11 @@ static inline unsigned long __raw_local_
6915 sti; \
6916 sysexit
6917
6918+#define GET_CR0_INTO_RDI mov %cr0, %rdi
6919+#define SET_RDI_INTO_CR0 mov %rdi, %cr0
6920+#define GET_CR3_INTO_RDI mov %cr3, %rdi
6921+#define SET_RDI_INTO_CR3 mov %rdi, %cr3
6922+
6923 #else
6924 #define INTERRUPT_RETURN iret
6925 #define ENABLE_INTERRUPTS_SYSEXIT sti; sysexit
6911diff -urNp linux-2.6.32.11/arch/x86/include/asm/kvm_host.h linux-2.6.32.11/arch/x86/include/asm/kvm_host.h 6926diff -urNp linux-2.6.32.11/arch/x86/include/asm/kvm_host.h linux-2.6.32.11/arch/x86/include/asm/kvm_host.h
6912--- linux-2.6.32.11/arch/x86/include/asm/kvm_host.h 2010-03-15 11:52:04.000000000 -0400 6927--- linux-2.6.32.11/arch/x86/include/asm/kvm_host.h 2010-03-15 11:52:04.000000000 -0400
6913+++ linux-2.6.32.11/arch/x86/include/asm/kvm_host.h 2010-04-04 20:46:41.500459645 -0400 6928+++ linux-2.6.32.11/arch/x86/include/asm/kvm_host.h 2010-04-04 20:46:41.500459645 -0400
@@ -7210,8 +7225,8 @@ diff -urNp linux-2.6.32.11/arch/x86/include/asm/mman.h linux-2.6.32.11/arch/x86/
7210 #endif /* _ASM_X86_MMAN_H */ 7225 #endif /* _ASM_X86_MMAN_H */
7211diff -urNp linux-2.6.32.11/arch/x86/include/asm/mmu_context.h linux-2.6.32.11/arch/x86/include/asm/mmu_context.h 7226diff -urNp linux-2.6.32.11/arch/x86/include/asm/mmu_context.h linux-2.6.32.11/arch/x86/include/asm/mmu_context.h
7212--- linux-2.6.32.11/arch/x86/include/asm/mmu_context.h 2010-03-15 11:52:04.000000000 -0400 7227--- linux-2.6.32.11/arch/x86/include/asm/mmu_context.h 2010-03-15 11:52:04.000000000 -0400
7213+++ linux-2.6.32.11/arch/x86/include/asm/mmu_context.h 2010-04-04 20:58:33.220592413 -0400 7228+++ linux-2.6.32.11/arch/x86/include/asm/mmu_context.h 2010-04-06 22:21:53.692294722 -0400
7214@@ -24,6 +24,22 @@ void destroy_context(struct mm_struct *m 7229@@ -24,6 +24,21 @@ void destroy_context(struct mm_struct *m
7215 7230
7216 static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk) 7231 static inline void enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
7217 { 7232 {
@@ -7223,18 +7238,17 @@ diff -urNp linux-2.6.32.11/arch/x86/include/asm/mmu_context.h linux-2.6.32.11/ar
7223+ pax_open_kernel(); 7238+ pax_open_kernel();
7224+ pgd = get_cpu_pgd(smp_processor_id()); 7239+ pgd = get_cpu_pgd(smp_processor_id());
7225+ for (i = USER_PGD_PTRS; i < 2 * USER_PGD_PTRS; ++i) 7240+ for (i = USER_PGD_PTRS; i < 2 * USER_PGD_PTRS; ++i)
7226+#ifdef CONFIG_PARAVIRT 7241+ if (paravirt_enabled())
7227+ set_pgd(pgd+i, native_make_pgd(0)); 7242+ set_pgd(pgd+i, native_make_pgd(0));
7228+#else 7243+ else
7229+ pgd[i] = native_make_pgd(0); 7244+ pgd[i] = native_make_pgd(0);
7230+#endif
7231+ pax_close_kernel(); 7245+ pax_close_kernel();
7232+#endif 7246+#endif
7233+ 7247+
7234 #ifdef CONFIG_SMP 7248 #ifdef CONFIG_SMP
7235 if (percpu_read(cpu_tlbstate.state) == TLBSTATE_OK) 7249 if (percpu_read(cpu_tlbstate.state) == TLBSTATE_OK)
7236 percpu_write(cpu_tlbstate.state, TLBSTATE_LAZY); 7250 percpu_write(cpu_tlbstate.state, TLBSTATE_LAZY);
7237@@ -34,37 +50,96 @@ static inline void switch_mm(struct mm_s 7251@@ -34,37 +49,96 @@ static inline void switch_mm(struct mm_s
7238 struct task_struct *tsk) 7252 struct task_struct *tsk)
7239 { 7253 {
7240 unsigned cpu = smp_processor_id(); 7254 unsigned cpu = smp_processor_id();
@@ -7425,7 +7439,7 @@ diff -urNp linux-2.6.32.11/arch/x86/include/asm/page_64_types.h linux-2.6.32.11/
7425 #define __VIRTUAL_MASK_SHIFT 47 7439 #define __VIRTUAL_MASK_SHIFT 47
7426diff -urNp linux-2.6.32.11/arch/x86/include/asm/paravirt.h linux-2.6.32.11/arch/x86/include/asm/paravirt.h 7440diff -urNp linux-2.6.32.11/arch/x86/include/asm/paravirt.h linux-2.6.32.11/arch/x86/include/asm/paravirt.h
7427--- linux-2.6.32.11/arch/x86/include/asm/paravirt.h 2010-03-15 11:52:04.000000000 -0400 7441--- linux-2.6.32.11/arch/x86/include/asm/paravirt.h 2010-03-15 11:52:04.000000000 -0400
7428+++ linux-2.6.32.11/arch/x86/include/asm/paravirt.h 2010-04-04 20:47:28.952733264 -0400 7442+++ linux-2.6.32.11/arch/x86/include/asm/paravirt.h 2010-04-07 16:58:23.343008831 -0400
7429@@ -729,6 +729,21 @@ static inline void __set_fixmap(unsigned 7443@@ -729,6 +729,21 @@ static inline void __set_fixmap(unsigned
7430 pv_mmu_ops.set_fixmap(idx, phys, flags); 7444 pv_mmu_ops.set_fixmap(idx, phys, flags);
7431 } 7445 }
@@ -7457,6 +7471,28 @@ diff -urNp linux-2.6.32.11/arch/x86/include/asm/paravirt.h linux-2.6.32.11/arch/
7457 #endif 7471 #endif
7458 7472
7459 #define INTERRUPT_RETURN \ 7473 #define INTERRUPT_RETURN \
7474@@ -1022,6 +1037,21 @@ extern void default_banner(void);
7475 PARA_SITE(PARA_PATCH(pv_cpu_ops, PV_CPU_irq_enable_sysexit), \
7476 CLBR_NONE, \
7477 jmp PARA_INDIRECT(pv_cpu_ops+PV_CPU_irq_enable_sysexit))
7478+
7479+#define GET_CR0_INTO_RDI \
7480+ call PARA_INDIRECT(pv_cpu_ops+PV_CPU_read_cr0); \
7481+ mov %rax,%rdi
7482+
7483+#define SET_RDI_INTO_CR0 \
7484+ call PARA_INDIRECT(pv_cpu_ops+PV_CPU_write_cr0)
7485+
7486+#define GET_CR3_INTO_RDI \
7487+ call PARA_INDIRECT(pv_mmu_ops+PV_MMU_read_cr3); \
7488+ mov %rax,%rdi
7489+
7490+#define SET_RDI_INTO_CR3 \
7491+ call PARA_INDIRECT(pv_mmu_ops+PV_MMU_write_cr3)
7492+
7493 #endif /* CONFIG_X86_32 */
7494
7495 #endif /* __ASSEMBLY__ */
7460diff -urNp linux-2.6.32.11/arch/x86/include/asm/paravirt_types.h linux-2.6.32.11/arch/x86/include/asm/paravirt_types.h 7496diff -urNp linux-2.6.32.11/arch/x86/include/asm/paravirt_types.h linux-2.6.32.11/arch/x86/include/asm/paravirt_types.h
7461--- linux-2.6.32.11/arch/x86/include/asm/paravirt_types.h 2010-03-15 11:52:04.000000000 -0400 7497--- linux-2.6.32.11/arch/x86/include/asm/paravirt_types.h 2010-03-15 11:52:04.000000000 -0400
7462+++ linux-2.6.32.11/arch/x86/include/asm/paravirt_types.h 2010-04-04 20:46:41.505526780 -0400 7498+++ linux-2.6.32.11/arch/x86/include/asm/paravirt_types.h 2010-04-04 20:46:41.505526780 -0400
@@ -10641,7 +10677,7 @@ diff -urNp linux-2.6.32.11/arch/x86/kernel/entry_32.S linux-2.6.32.11/arch/x86/k
10641 CFI_ADJUST_CFA_OFFSET -24 10677 CFI_ADJUST_CFA_OFFSET -24
10642diff -urNp linux-2.6.32.11/arch/x86/kernel/entry_64.S linux-2.6.32.11/arch/x86/kernel/entry_64.S 10678diff -urNp linux-2.6.32.11/arch/x86/kernel/entry_64.S linux-2.6.32.11/arch/x86/kernel/entry_64.S
10643--- linux-2.6.32.11/arch/x86/kernel/entry_64.S 2010-03-15 11:52:04.000000000 -0400 10679--- linux-2.6.32.11/arch/x86/kernel/entry_64.S 2010-03-15 11:52:04.000000000 -0400
10644+++ linux-2.6.32.11/arch/x86/kernel/entry_64.S 2010-04-04 20:58:33.220592413 -0400 10680+++ linux-2.6.32.11/arch/x86/kernel/entry_64.S 2010-04-07 16:58:23.343008831 -0400
10645@@ -53,6 +53,7 @@ 10681@@ -53,6 +53,7 @@
10646 #include <asm/paravirt.h> 10682 #include <asm/paravirt.h>
10647 #include <asm/ftrace.h> 10683 #include <asm/ftrace.h>
@@ -10650,7 +10686,7 @@ diff -urNp linux-2.6.32.11/arch/x86/kernel/entry_64.S linux-2.6.32.11/arch/x86/k
10650 10686
10651 /* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this. */ 10687 /* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this. */
10652 #include <linux/elf-em.h> 10688 #include <linux/elf-em.h>
10653@@ -174,6 +175,200 @@ ENTRY(native_usergs_sysret64) 10689@@ -174,6 +175,189 @@ ENTRY(native_usergs_sysret64)
10654 ENDPROC(native_usergs_sysret64) 10690 ENDPROC(native_usergs_sysret64)
10655 #endif /* CONFIG_PARAVIRT */ 10691 #endif /* CONFIG_PARAVIRT */
10656 10692
@@ -10671,16 +10707,13 @@ diff -urNp linux-2.6.32.11/arch/x86/kernel/entry_64.S linux-2.6.32.11/arch/x86/k
10671+ENTRY(pax_enter_kernel) 10707+ENTRY(pax_enter_kernel)
10672+ 10708+
10673+#ifdef CONFIG_PAX_KERNEXEC 10709+#ifdef CONFIG_PAX_KERNEXEC
10674+ push %rax
10675+ push %rdi 10710+ push %rdi
10676+ 10711+
10677+#ifdef CONFIG_PARAVIRT 10712+#ifdef CONFIG_PARAVIRT
10678+ PV_SAVE_REGS(CLBR_NONE | CLBR_RAX | CLBR_RDI) 10713+ PV_SAVE_REGS(CLBR_RDI)
10679+ call PARA_INDIRECT(pv_cpu_ops+PV_CPU_read_cr0)
10680+ mov %rax,%rdi
10681+#else
10682+ mov %cr0,%rdi
10683+#endif 10714+#endif
10715+
10716+ GET_CR0_INTO_RDI
10684+ bts $16,%rdi 10717+ bts $16,%rdi
10685+ jnc 1f 10718+ jnc 1f
10686+ mov %cs,%edi 10719+ mov %cs,%edi
@@ -10688,17 +10721,14 @@ diff -urNp linux-2.6.32.11/arch/x86/kernel/entry_64.S linux-2.6.32.11/arch/x86/k
10688+ jz 3f 10721+ jz 3f
10689+ ljmpq __KERNEL_CS,3f 10722+ ljmpq __KERNEL_CS,3f
10690+1: ljmpq __KERNEXEC_KERNEL_CS,2f 10723+1: ljmpq __KERNEXEC_KERNEL_CS,2f
10691+2: 10724+2: SET_RDI_INTO_CR0
10692+#ifdef CONFIG_PARAVIRT
10693+ call PARA_INDIRECT(pv_cpu_ops+PV_CPU_write_cr0)
10694+3: PV_RESTORE_REGS(CLBR_NONE | CLBR_RAX | CLBR_RDI)
10695+#else
10696+ mov %rdi,%cr0
10697+3: 10725+3:
10726+
10727+#ifdef CONFIG_PARAVIRT
10728+ PV_RESTORE_REGS(CLBR_RDI)
10698+#endif 10729+#endif
10699+ 10730+
10700+ pop %rdi 10731+ pop %rdi
10701+ pop %rax
10702+#endif 10732+#endif
10703+ 10733+
10704+ retq 10734+ retq
@@ -10707,34 +10737,26 @@ diff -urNp linux-2.6.32.11/arch/x86/kernel/entry_64.S linux-2.6.32.11/arch/x86/k
10707+ENTRY(pax_exit_kernel) 10737+ENTRY(pax_exit_kernel)
10708+ 10738+
10709+#ifdef CONFIG_PAX_KERNEXEC 10739+#ifdef CONFIG_PAX_KERNEXEC
10710+ push %rax
10711+ push %rdi 10740+ push %rdi
10712+ 10741+
10713+#ifdef CONFIG_PARAVIRT 10742+#ifdef CONFIG_PARAVIRT
10714+ PV_SAVE_REGS(CLBR_NONE | CLBR_RAX | CLBR_RDI) 10743+ PV_SAVE_REGS(CLBR_RDI)
10715+#endif 10744+#endif
10745+
10716+ mov %cs,%rdi 10746+ mov %cs,%rdi
10717+ cmp $__KERNEXEC_KERNEL_CS,%edi 10747+ cmp $__KERNEXEC_KERNEL_CS,%edi
10718+ jnz 2f 10748+ jnz 2f
10719+#ifdef CONFIG_PARAVIRT 10749+ GET_CR0_INTO_RDI
10720+ call PARA_INDIRECT(pv_cpu_ops+PV_CPU_read_cr0)
10721+ mov %rax,%rdi
10722+#else
10723+ mov %cr0,%rdi
10724+#endif
10725+ btr $16,%rdi 10750+ btr $16,%rdi
10726+ ljmpq __KERNEL_CS,1f 10751+ ljmpq __KERNEL_CS,1f
10727+1: 10752+1: SET_RDI_INTO_CR0
10728+#ifdef CONFIG_PARAVIRT
10729+ call PARA_INDIRECT(pv_cpu_ops+PV_CPU_write_cr0)
10730+2: PV_RESTORE_REGS(CLBR_NONE | CLBR_RAX | CLBR_RDI);
10731+#else
10732+ mov %rdi,%cr0
10733+2: 10753+2:
10754+
10755+#ifdef CONFIG_PARAVIRT
10756+ PV_RESTORE_REGS(CLBR_RDI);
10734+#endif 10757+#endif
10735+ 10758+
10736+ pop %rdi 10759+ pop %rdi
10737+ pop %rax
10738+#endif 10760+#endif
10739+ 10761+
10740+ retq 10762+ retq
@@ -10743,115 +10765,118 @@ diff -urNp linux-2.6.32.11/arch/x86/kernel/entry_64.S linux-2.6.32.11/arch/x86/k
10743+ENTRY(pax_enter_kernel_user) 10765+ENTRY(pax_enter_kernel_user)
10744+ 10766+
10745+#ifdef CONFIG_PAX_MEMORY_UDEREF 10767+#ifdef CONFIG_PAX_MEMORY_UDEREF
10746+ push %rax
10747+ push %rdi 10768+ push %rdi
10769+ push %rbx
10748+ 10770+
10749+#ifdef CONFIG_PARAVIRT 10771+#ifdef CONFIG_PARAVIRT
10750+ PV_SAVE_REGS(CLBR_NONE | CLBR_RAX | CLBR_RDI) 10772+ PV_SAVE_REGS(CLBR_RDI)
10751+ call PARA_INDIRECT(pv_mmu_ops+PV_MMU_read_cr3)
10752+#else
10753+ mov %cr3,%rax
10754+#endif 10773+#endif
10755+ 10774+
10756+ mov %rax,%rdi 10775+ GET_CR3_INTO_RDI
10757+ add $__START_KERNEL_map,%rax 10776+ mov %rdi,%rbx
10758+ sub phys_base(%rip),%rax 10777+ add $__START_KERNEL_map,%rbx
10778+ sub phys_base(%rip),%rbx
10759+ 10779+
10780+#ifdef CONFIG_PARAVIRT
10781+ push %rdi
10782+ cmpl $0, pv_info+PARAVIRT_enabled
10783+ jz 1f
10760+ i = 0 10784+ i = 0
10761+ .rept USER_PGD_PTRS 10785+ .rept USER_PGD_PTRS
10762+#ifdef CONFIG_PARAVIRT 10786+ mov i*8(%rbx),%rsi
10763+ mov i*8(%rax),%rsi 10787+ mov $0,%sil
10764+ mov $0,$sil 10788+ lea i*8(%rbx),%rdi
10765+ lea i*8(%rax),%rdi 10789+ call PARA_INDIRECT(pv_mmu_ops+PV_MMU_set_pgd)
10766+ call PARA_INDIRECT(pv_mmu_ops+PV_MMU_set+pgd) 10790+ i = i + 1
10767+#else 10791+ .endr
10768+ movb $0,i*8(%rax) 10792+ jmp 2f
10793+1:
10769+#endif 10794+#endif
10795+
10796+ i = 0
10797+ .rept USER_PGD_PTRS
10798+ movb $0,i*8(%rbx)
10770+ i = i + 1 10799+ i = i + 1
10771+ .endr 10800+ .endr
10772+ 10801+
10773+#ifdef CONFIG_PARAVIRT 10802+#ifdef CONFIG_PARAVIRT
10774+ call PARA_INDIRECT(pv_mmu_ops+PV_MMU_write_cr3) 10803+2: pop %rdi
10775+ PV_RESTORE_REGS(CLBR_NONE | CLBR_RAX | CLBR_RDI)
10776+#else
10777+ mov %rdi,%cr3
10778+#endif 10804+#endif
10805+ SET_RDI_INTO_CR3
10779+ 10806+
10780+#ifdef CONFIG_PAX_KERNEXEC 10807+#ifdef CONFIG_PAX_KERNEXEC
10781+#ifdef CONFIG_PARAVIRT 10808+ GET_CR0_INTO_RDI
10782+ PV_SAVE_REGS(CLBR_NONE | CLBR_RAX | CLBR_RDI)
10783+ call PARA_INDIRECT(pv_cpu_ops+PV_CPU_read_cr0)
10784+ mov %rax,%rdi
10785+#else
10786+ mov %cr0,%rdi
10787+#endif
10788+ bts $16,%rdi 10809+ bts $16,%rdi
10789+#ifdef CONFIG_PARAVIRT 10810+ SET_RDI_INTO_CR0
10790+ call PARA_INDIRECT(pv_cpu_ops+PV_CPU_write_cr0)
10791+ PV_RESTORE_REGS(CLBR_NONE | CLBR_RAX | CLBR_RDI)
10792+#else
10793+ mov %rdi,%cr0
10794+#endif 10811+#endif
10812+
10813+#ifdef CONFIG_PARAVIRT
10814+ PV_RESTORE_REGS(CLBR_RDI)
10795+#endif 10815+#endif
10796+ 10816+
10817+ pop %rbx
10797+ pop %rdi 10818+ pop %rdi
10798+ pop %rax
10799+#endif 10819+#endif
10800+ 10820+
10801+ retq 10821+ retq
10802+ENDPROC(pax_enter_kernel_user) 10822+ENDPROC(pax_enter_kernel_user)
10803+ 10823+
10804+ENTRY(pax_exit_kernel_user) 10824+ENTRY(pax_exit_kernel_user)
10805+ push %rax 10825+
10826+#ifdef CONFIG_PAX_MEMORY_UDEREF
10806+ push %rdi 10827+ push %rdi
10807+ 10828+
10808+#ifdef CONFIG_PAX_KERNEXEC
10809+#ifdef CONFIG_PARAVIRT 10829+#ifdef CONFIG_PARAVIRT
10810+ PV_SAVE_REGS(CLBR_NONE | CLBR_RAX | CLBR_RDI) 10830+ push %rbx
10811+ call PARA_INDIRECT(pv_cpu_ops+PV_CPU_read_cr0) 10831+ PV_SAVE_REGS(CLBR_RDI)
10812+ mov %rax,%rdi
10813+#else
10814+ mov %cr0,%rdi
10815+#endif 10832+#endif
10833+
10834+#ifdef CONFIG_PAX_KERNEXEC
10835+ GET_CR0_INTO_RDI
10816+ btr $16,%rdi 10836+ btr $16,%rdi
10817+#ifdef CONFIG_PARAVIRT 10837+ SET_RDI_INTO_CR0
10818+ call PARA_INDIRECT(pv_cpu_ops+PV_CPU_write_cr0)
10819+ PV_RESTORE_REGS(CLBR_NONE | CLBR_RAX | CLBR_RDI)
10820+#else
10821+ mov %rdi,%cr0
10822+#endif
10823+#endif 10838+#endif
10824+ 10839+
10840+ GET_CR3_INTO_RDI
10841+ add $__START_KERNEL_map,%rdi
10842+ sub phys_base(%rip),%rdi
10843+
10825+#ifdef CONFIG_PARAVIRT 10844+#ifdef CONFIG_PARAVIRT
10826+ PV_SAVE_REGS(CLBR_NONE | CLBR_RAX | CLBR_RDI) 10845+ cmpl $0, pv_info+PARAVIRT_enabled
10827+ call PARA_INDIRECT(pv_mmu_ops+PV_MMU_read_cr3) 10846+ jz 1f
10828+#else 10847+ mov %rdi,%rbx
10829+ mov %cr3,%rax 10848+ i = 0
10849+ .rept USER_PGD_PTRS
10850+ mov i*8(%rbx),%rsi
10851+ mov $0x67,%sil
10852+ lea i*8(%rbx),%rdi
10853+ call PARA_INDIRECT(pv_mmu_ops+PV_MMU_set_pgd)
10854+ i = i + 1
10855+ .endr
10856+ jmp 2f
10857+1:
10830+#endif 10858+#endif
10831+ add $__START_KERNEL_map,%rax
10832+ sub phys_base(%rip),%rax
10833+ 10859+
10834+ i = 0 10860+ i = 0
10835+ .rept USER_PGD_PTRS 10861+ .rept USER_PGD_PTRS
10836+#ifdef CONFIG_PARAVIRT 10862+ movb $0x67,i*8(%rdi)
10837+ mov i*8(%rax),%rsi
10838+ mov $0x67,$sil
10839+ lea i*8(%rax),%rdi
10840+ call PARA_INDIRECT(pv_mmu_ops+PV_MMU_set+pgd)
10841+#else
10842+ movb $0x67,i*8(%rax)
10843+#endif
10844+ i = i + 1 10863+ i = i + 1
10845+ .endr 10864+ .endr
10846+ 10865+
10866+#ifdef CONFIG_PARAVIRT
10867+2: PV_RESTORE_REGS(CLBR_RDI)
10868+ pop %rbx
10869+#endif
10870+
10847+ pop %rdi 10871+ pop %rdi
10848+ pop %rax 10872+#endif
10873+
10849+ retq 10874+ retq
10850+ENDPROC(pax_exit_kernel_user) 10875+ENDPROC(pax_exit_kernel_user)
10851 10876
10852 .macro TRACE_IRQS_IRETQ offset=ARGOFFSET 10877 .macro TRACE_IRQS_IRETQ offset=ARGOFFSET
10853 #ifdef CONFIG_TRACE_IRQFLAGS 10878 #ifdef CONFIG_TRACE_IRQFLAGS
10854@@ -468,6 +663,11 @@ ENTRY(system_call_after_swapgs) 10879@@ -468,6 +652,11 @@ ENTRY(system_call_after_swapgs)
10855 10880
10856 movq %rsp,PER_CPU_VAR(old_rsp) 10881 movq %rsp,PER_CPU_VAR(old_rsp)
10857 movq PER_CPU_VAR(kernel_stack),%rsp 10882 movq PER_CPU_VAR(kernel_stack),%rsp
@@ -10863,7 +10888,7 @@ diff -urNp linux-2.6.32.11/arch/x86/kernel/entry_64.S linux-2.6.32.11/arch/x86/k
10863 /* 10888 /*
10864 * No need to follow this irqs off/on section - it's straight 10889 * No need to follow this irqs off/on section - it's straight
10865 * and short: 10890 * and short:
10866@@ -502,6 +702,11 @@ sysret_check: 10891@@ -502,6 +691,11 @@ sysret_check:
10867 andl %edi,%edx 10892 andl %edi,%edx
10868 jnz sysret_careful 10893 jnz sysret_careful
10869 CFI_REMEMBER_STATE 10894 CFI_REMEMBER_STATE
@@ -10875,7 +10900,7 @@ diff -urNp linux-2.6.32.11/arch/x86/kernel/entry_64.S linux-2.6.32.11/arch/x86/k
10875 /* 10900 /*
10876 * sysretq will re-enable interrupts: 10901 * sysretq will re-enable interrupts:
10877 */ 10902 */
10878@@ -800,7 +1005,16 @@ END(interrupt) 10903@@ -800,7 +994,16 @@ END(interrupt)
10879 CFI_ADJUST_CFA_OFFSET 10*8 10904 CFI_ADJUST_CFA_OFFSET 10*8
10880 call save_args 10905 call save_args
10881 PARTIAL_FRAME 0 10906 PARTIAL_FRAME 0
@@ -10893,7 +10918,7 @@ diff -urNp linux-2.6.32.11/arch/x86/kernel/entry_64.S linux-2.6.32.11/arch/x86/k
10893 .endm 10918 .endm
10894 10919
10895 /* 10920 /*
10896@@ -844,12 +1058,18 @@ retint_swapgs: /* return to user-space 10921@@ -844,12 +1047,18 @@ retint_swapgs: /* return to user-space
10897 * The iretq could re-enable interrupts: 10922 * The iretq could re-enable interrupts:
10898 */ 10923 */
10899 DISABLE_INTERRUPTS(CLBR_ANY) 10924 DISABLE_INTERRUPTS(CLBR_ANY)
@@ -10912,7 +10937,7 @@ diff -urNp linux-2.6.32.11/arch/x86/kernel/entry_64.S linux-2.6.32.11/arch/x86/k
10912 /* 10937 /*
10913 * The iretq could re-enable interrupts: 10938 * The iretq could re-enable interrupts:
10914 */ 10939 */
10915@@ -1032,7 +1252,16 @@ ENTRY(\sym) 10940@@ -1032,7 +1241,16 @@ ENTRY(\sym)
10916 CFI_ADJUST_CFA_OFFSET 15*8 10941 CFI_ADJUST_CFA_OFFSET 15*8
10917 call error_entry 10942 call error_entry
10918 DEFAULT_FRAME 0 10943 DEFAULT_FRAME 0
@@ -10930,7 +10955,7 @@ diff -urNp linux-2.6.32.11/arch/x86/kernel/entry_64.S linux-2.6.32.11/arch/x86/k
10930 xorl %esi,%esi /* no error code */ 10955 xorl %esi,%esi /* no error code */
10931 call \do_sym 10956 call \do_sym
10932 jmp error_exit /* %ebx: no swapgs flag */ 10957 jmp error_exit /* %ebx: no swapgs flag */
10933@@ -1049,7 +1278,16 @@ ENTRY(\sym) 10958@@ -1049,7 +1267,16 @@ ENTRY(\sym)
10934 subq $15*8, %rsp 10959 subq $15*8, %rsp
10935 call save_paranoid 10960 call save_paranoid
10936 TRACE_IRQS_OFF 10961 TRACE_IRQS_OFF
@@ -10948,7 +10973,7 @@ diff -urNp linux-2.6.32.11/arch/x86/kernel/entry_64.S linux-2.6.32.11/arch/x86/k
10948 xorl %esi,%esi /* no error code */ 10973 xorl %esi,%esi /* no error code */
10949 call \do_sym 10974 call \do_sym
10950 jmp paranoid_exit /* %ebx: no swapgs flag */ 10975 jmp paranoid_exit /* %ebx: no swapgs flag */
10951@@ -1066,9 +1304,23 @@ ENTRY(\sym) 10976@@ -1066,9 +1293,23 @@ ENTRY(\sym)
10952 subq $15*8, %rsp 10977 subq $15*8, %rsp
10953 call save_paranoid 10978 call save_paranoid
10954 TRACE_IRQS_OFF 10979 TRACE_IRQS_OFF
@@ -10974,7 +10999,7 @@ diff -urNp linux-2.6.32.11/arch/x86/kernel/entry_64.S linux-2.6.32.11/arch/x86/k
10974 subq $EXCEPTION_STKSZ, TSS_ist + (\ist - 1) * 8(%rbp) 10999 subq $EXCEPTION_STKSZ, TSS_ist + (\ist - 1) * 8(%rbp)
10975 call \do_sym 11000 call \do_sym
10976 addq $EXCEPTION_STKSZ, TSS_ist + (\ist - 1) * 8(%rbp) 11001 addq $EXCEPTION_STKSZ, TSS_ist + (\ist - 1) * 8(%rbp)
10977@@ -1085,7 +1337,16 @@ ENTRY(\sym) 11002@@ -1085,7 +1326,16 @@ ENTRY(\sym)
10978 CFI_ADJUST_CFA_OFFSET 15*8 11003 CFI_ADJUST_CFA_OFFSET 15*8
10979 call error_entry 11004 call error_entry
10980 DEFAULT_FRAME 0 11005 DEFAULT_FRAME 0
@@ -10992,7 +11017,7 @@ diff -urNp linux-2.6.32.11/arch/x86/kernel/entry_64.S linux-2.6.32.11/arch/x86/k
10992 movq ORIG_RAX(%rsp),%rsi /* get error code */ 11017 movq ORIG_RAX(%rsp),%rsi /* get error code */
10993 movq $-1,ORIG_RAX(%rsp) /* no syscall to restart */ 11018 movq $-1,ORIG_RAX(%rsp) /* no syscall to restart */
10994 call \do_sym 11019 call \do_sym
10995@@ -1104,7 +1365,16 @@ ENTRY(\sym) 11020@@ -1104,7 +1354,16 @@ ENTRY(\sym)
10996 call save_paranoid 11021 call save_paranoid
10997 DEFAULT_FRAME 0 11022 DEFAULT_FRAME 0
10998 TRACE_IRQS_OFF 11023 TRACE_IRQS_OFF
@@ -11010,7 +11035,7 @@ diff -urNp linux-2.6.32.11/arch/x86/kernel/entry_64.S linux-2.6.32.11/arch/x86/k
11010 movq ORIG_RAX(%rsp),%rsi /* get error code */ 11035 movq ORIG_RAX(%rsp),%rsi /* get error code */
11011 movq $-1,ORIG_RAX(%rsp) /* no syscall to restart */ 11036 movq $-1,ORIG_RAX(%rsp) /* no syscall to restart */
11012 call \do_sym 11037 call \do_sym
11013@@ -1408,11 +1678,13 @@ ENTRY(paranoid_exit) 11038@@ -1408,11 +1667,13 @@ ENTRY(paranoid_exit)
11014 testl $3,CS(%rsp) 11039 testl $3,CS(%rsp)
11015 jnz paranoid_userspace 11040 jnz paranoid_userspace
11016 paranoid_swapgs: 11041 paranoid_swapgs:
@@ -11024,7 +11049,7 @@ diff -urNp linux-2.6.32.11/arch/x86/kernel/entry_64.S linux-2.6.32.11/arch/x86/k
11024 TRACE_IRQS_IRETQ 0 11049 TRACE_IRQS_IRETQ 0
11025 RESTORE_ALL 8 11050 RESTORE_ALL 8
11026 jmp irq_return 11051 jmp irq_return
11027@@ -1529,6 +1801,16 @@ ENTRY(nmi) 11052@@ -1529,6 +1790,16 @@ ENTRY(nmi)
11028 CFI_ADJUST_CFA_OFFSET 15*8 11053 CFI_ADJUST_CFA_OFFSET 15*8
11029 call save_paranoid 11054 call save_paranoid
11030 DEFAULT_FRAME 0 11055 DEFAULT_FRAME 0
@@ -11041,7 +11066,7 @@ diff -urNp linux-2.6.32.11/arch/x86/kernel/entry_64.S linux-2.6.32.11/arch/x86/k
11041 /* paranoidentry do_nmi, 0; without TRACE_IRQS_OFF */ 11066 /* paranoidentry do_nmi, 0; without TRACE_IRQS_OFF */
11042 movq %rsp,%rdi 11067 movq %rsp,%rdi
11043 movq $-1,%rsi 11068 movq $-1,%rsi
11044@@ -1544,6 +1826,7 @@ ENTRY(nmi) 11069@@ -1544,6 +1815,7 @@ ENTRY(nmi)
11045 nmi_swapgs: 11070 nmi_swapgs:
11046 SWAPGS_UNSAFE_STACK 11071 SWAPGS_UNSAFE_STACK
11047 nmi_restore: 11072 nmi_restore:
@@ -30825,6 +30850,18 @@ diff -urNp linux-2.6.32.11/fs/hfsplus/inode.c linux-2.6.32.11/fs/hfsplus/inode.c
30825 hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, 30850 hfs_bnode_read(fd.bnode, &entry, fd.entryoffset,
30826 sizeof(struct hfsplus_cat_file)); 30851 sizeof(struct hfsplus_cat_file));
30827 hfsplus_inode_write_fork(inode, &file->data_fork); 30852 hfsplus_inode_write_fork(inode, &file->data_fork);
30853diff -urNp linux-2.6.32.11/fs/hugetlbfs/inode.c linux-2.6.32.11/fs/hugetlbfs/inode.c
30854--- linux-2.6.32.11/fs/hugetlbfs/inode.c 2010-03-15 11:52:04.000000000 -0400
30855+++ linux-2.6.32.11/fs/hugetlbfs/inode.c 2010-04-06 22:13:08.677504702 -0400
30856@@ -909,7 +909,7 @@ static struct file_system_type hugetlbfs
30857 .kill_sb = kill_litter_super,
30858 };
30859
30860-static struct vfsmount *hugetlbfs_vfsmount;
30861+struct vfsmount *hugetlbfs_vfsmount;
30862
30863 static int can_do_hugetlb_shm(void)
30864 {
30828diff -urNp linux-2.6.32.11/fs/ioctl.c linux-2.6.32.11/fs/ioctl.c 30865diff -urNp linux-2.6.32.11/fs/ioctl.c linux-2.6.32.11/fs/ioctl.c
30829--- linux-2.6.32.11/fs/ioctl.c 2010-03-15 11:52:04.000000000 -0400 30866--- linux-2.6.32.11/fs/ioctl.c 2010-03-15 11:52:04.000000000 -0400
30830+++ linux-2.6.32.11/fs/ioctl.c 2010-04-04 20:46:41.653544810 -0400 30867+++ linux-2.6.32.11/fs/ioctl.c 2010-04-04 20:46:41.653544810 -0400
@@ -33684,8 +33721,8 @@ diff -urNp linux-2.6.32.11/grsecurity/gracl_alloc.c linux-2.6.32.11/grsecurity/g
33684+} 33721+}
33685diff -urNp linux-2.6.32.11/grsecurity/gracl.c linux-2.6.32.11/grsecurity/gracl.c 33722diff -urNp linux-2.6.32.11/grsecurity/gracl.c linux-2.6.32.11/grsecurity/gracl.c
33686--- linux-2.6.32.11/grsecurity/gracl.c 1969-12-31 19:00:00.000000000 -0500 33723--- linux-2.6.32.11/grsecurity/gracl.c 1969-12-31 19:00:00.000000000 -0500
33687+++ linux-2.6.32.11/grsecurity/gracl.c 2010-04-04 20:46:41.668784531 -0400 33724+++ linux-2.6.32.11/grsecurity/gracl.c 2010-04-06 22:16:21.600343588 -0400
33688@@ -0,0 +1,3917 @@ 33725@@ -0,0 +1,3924 @@
33689+#include <linux/kernel.h> 33726+#include <linux/kernel.h>
33690+#include <linux/module.h> 33727+#include <linux/module.h>
33691+#include <linux/sched.h> 33728+#include <linux/sched.h>
@@ -33764,6 +33801,10 @@ diff -urNp linux-2.6.32.11/grsecurity/gracl.c linux-2.6.32.11/grsecurity/gracl.c
33764+extern struct vfsmount *sock_mnt; 33801+extern struct vfsmount *sock_mnt;
33765+extern struct vfsmount *pipe_mnt; 33802+extern struct vfsmount *pipe_mnt;
33766+extern struct vfsmount *shm_mnt; 33803+extern struct vfsmount *shm_mnt;
33804+#ifdef CONFIG_HUGETLBFS
33805+extern struct vfsmount *hugetlbfs_vfsmount;
33806+#endif
33807+
33767+static struct acl_object_label *fakefs_obj; 33808+static struct acl_object_label *fakefs_obj;
33768+ 33809+
33769+extern int gr_init_uidset(void); 33810+extern int gr_init_uidset(void);
@@ -35479,6 +35520,9 @@ diff -urNp linux-2.6.32.11/grsecurity/gracl.c linux-2.6.32.11/grsecurity/gracl.c
35479+ spin_lock(&dcache_lock); 35520+ spin_lock(&dcache_lock);
35480+ 35521+
35481+ if (unlikely(mnt == shm_mnt || mnt == pipe_mnt || mnt == sock_mnt || 35522+ if (unlikely(mnt == shm_mnt || mnt == pipe_mnt || mnt == sock_mnt ||
35523+#ifdef CONFIG_HUGETLBFS
35524+ mnt == hugetlbfs_vfsmount ||
35525+#endif
35482+ /* ignore Eric Biederman */ 35526+ /* ignore Eric Biederman */
35483+ IS_PRIVATE(l_dentry->d_inode))) { 35527+ IS_PRIVATE(l_dentry->d_inode))) {
35484+ retval = fakefs_obj; 35528+ retval = fakefs_obj;
@@ -47655,7 +47699,7 @@ diff -urNp linux-2.6.32.11/kernel/hrtimer.c linux-2.6.32.11/kernel/hrtimer.c
47655 } 47699 }
47656diff -urNp linux-2.6.32.11/kernel/kallsyms.c linux-2.6.32.11/kernel/kallsyms.c 47700diff -urNp linux-2.6.32.11/kernel/kallsyms.c linux-2.6.32.11/kernel/kallsyms.c
47657--- linux-2.6.32.11/kernel/kallsyms.c 2010-03-15 11:52:04.000000000 -0400 47701--- linux-2.6.32.11/kernel/kallsyms.c 2010-03-15 11:52:04.000000000 -0400
47658+++ linux-2.6.32.11/kernel/kallsyms.c 2010-04-04 20:46:41.693491350 -0400 47702+++ linux-2.6.32.11/kernel/kallsyms.c 2010-04-06 22:21:53.692294722 -0400
47659@@ -11,6 +11,9 @@ 47703@@ -11,6 +11,9 @@
47660 * Changed the compression method from stem compression to "table lookup" 47704 * Changed the compression method from stem compression to "table lookup"
47661 * compression (see scripts/kallsyms.c for a more complete description) 47705 * compression (see scripts/kallsyms.c for a more complete description)
@@ -47676,7 +47720,7 @@ diff -urNp linux-2.6.32.11/kernel/kallsyms.c linux-2.6.32.11/kernel/kallsyms.c
47676 if (addr >= (unsigned long)_sinittext 47720 if (addr >= (unsigned long)_sinittext
47677 && addr <= (unsigned long)_einittext) 47721 && addr <= (unsigned long)_einittext)
47678 return 1; 47722 return 1;
47679@@ -67,6 +73,24 @@ static inline int is_kernel_text(unsigne 47723@@ -67,6 +73,26 @@ static inline int is_kernel_text(unsigne
47680 47724
47681 static inline int is_kernel(unsigned long addr) 47725 static inline int is_kernel(unsigned long addr)
47682 { 47726 {
@@ -47684,8 +47728,10 @@ diff -urNp linux-2.6.32.11/kernel/kallsyms.c linux-2.6.32.11/kernel/kallsyms.c
47684+ return 1; 47728+ return 1;
47685+ 47729+
47686+#if defined(CONFIG_X86_32) && defined(CONFIG_PAX_KERNEXEC) 47730+#if defined(CONFIG_X86_32) && defined(CONFIG_PAX_KERNEXEC)
47731+#ifdef CONFIG_MODULES
47687+ if ((unsigned long)MODULES_EXEC_VADDR <= ktla_ktva(addr) && ktla_ktva(addr) <= (unsigned long)MODULES_EXEC_END) 47732+ if ((unsigned long)MODULES_EXEC_VADDR <= ktla_ktva(addr) && ktla_ktva(addr) <= (unsigned long)MODULES_EXEC_END)
47688+ return 0; 47733+ return 0;
47734+#endif
47689+ 47735+
47690+ if (is_kernel_text(addr)) 47736+ if (is_kernel_text(addr))
47691+ return 1; 47737+ return 1;
@@ -47701,7 +47747,7 @@ diff -urNp linux-2.6.32.11/kernel/kallsyms.c linux-2.6.32.11/kernel/kallsyms.c
47701 if (addr >= (unsigned long)_stext && addr <= (unsigned long)_end) 47747 if (addr >= (unsigned long)_stext && addr <= (unsigned long)_end)
47702 return 1; 47748 return 1;
47703 return in_gate_area_no_task(addr); 47749 return in_gate_area_no_task(addr);
47704@@ -413,7 +437,6 @@ static unsigned long get_ksymbol_core(st 47750@@ -413,7 +439,6 @@ static unsigned long get_ksymbol_core(st
47705 47751
47706 static void reset_iter(struct kallsym_iter *iter, loff_t new_pos) 47752 static void reset_iter(struct kallsym_iter *iter, loff_t new_pos)
47707 { 47753 {
@@ -47709,7 +47755,7 @@ diff -urNp linux-2.6.32.11/kernel/kallsyms.c linux-2.6.32.11/kernel/kallsyms.c
47709 iter->nameoff = get_symbol_offset(new_pos); 47755 iter->nameoff = get_symbol_offset(new_pos);
47710 iter->pos = new_pos; 47756 iter->pos = new_pos;
47711 } 47757 }
47712@@ -461,6 +484,11 @@ static int s_show(struct seq_file *m, vo 47758@@ -461,6 +486,11 @@ static int s_show(struct seq_file *m, vo
47713 { 47759 {
47714 struct kallsym_iter *iter = m->private; 47760 struct kallsym_iter *iter = m->private;
47715 47761
@@ -47721,7 +47767,7 @@ diff -urNp linux-2.6.32.11/kernel/kallsyms.c linux-2.6.32.11/kernel/kallsyms.c
47721 /* Some debugging symbols have no name. Ignore them. */ 47767 /* Some debugging symbols have no name. Ignore them. */
47722 if (!iter->name[0]) 47768 if (!iter->name[0])
47723 return 0; 47769 return 0;
47724@@ -501,7 +529,7 @@ static int kallsyms_open(struct inode *i 47770@@ -501,7 +531,7 @@ static int kallsyms_open(struct inode *i
47725 struct kallsym_iter *iter; 47771 struct kallsym_iter *iter;
47726 int ret; 47772 int ret;
47727 47773