diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2011-08-27 11:51:15 -0400 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2011-08-27 11:51:15 -0400 |
commit | 7db2659302b97e2001655e2b369c99673eb72213 (patch) | |
tree | a38544a4abf23479699bd0f7eb90e26d754bde32 | |
parent | Grsec/PaX: 2.2.2-2.6.32.45-201108251825 + 2.2.2-3.0.3-201108251825 (diff) | |
download | hardened-patchset-7db2659302b97e2001655e2b369c99673eb72213.tar.gz hardened-patchset-7db2659302b97e2001655e2b369c99673eb72213.tar.bz2 hardened-patchset-7db2659302b97e2001655e2b369c99673eb72213.zip |
Grsec/PaX: 2.2.2-2.6.32.45-201108262310 + 2.2.2-3.0.3-20110826231020110826
-rw-r--r-- | 2.6.32/0000_README | 2 | ||||
-rw-r--r-- | 2.6.32/4420_grsecurity-2.2.2-2.6.32.45-201108262310.patch (renamed from 2.6.32/4420_grsecurity-2.2.2-2.6.32.45-201108251825.patch) | 448 | ||||
-rw-r--r-- | 3.0.3/0000_README | 2 | ||||
-rw-r--r-- | 3.0.3/4420_grsecurity-2.2.2-3.0.3-201108262310.patch (renamed from 3.0.3/4420_grsecurity-2.2.2-3.0.3-201108251825.patch) | 449 |
4 files changed, 384 insertions, 517 deletions
diff --git a/2.6.32/0000_README b/2.6.32/0000_README index 75f57cf..f6d9728 100644 --- a/2.6.32/0000_README +++ b/2.6.32/0000_README @@ -11,7 +11,7 @@ Patch: 1044_linux-2.6.32.45.patch From: http://www.kernel.org Desc: Linux 2.6.39.45 -Patch: 4420_grsecurity-2.2.2-2.6.32.45-201108251825.patch +Patch: 4420_grsecurity-2.2.2-2.6.32.45-201108262310.patch From: http://www.grsecurity.net Desc: hardened-sources base patch from upstream grsecurity diff --git a/2.6.32/4420_grsecurity-2.2.2-2.6.32.45-201108251825.patch b/2.6.32/4420_grsecurity-2.2.2-2.6.32.45-201108262310.patch index 9336af8..0ce666e 100644 --- a/2.6.32/4420_grsecurity-2.2.2-2.6.32.45-201108251825.patch +++ b/2.6.32/4420_grsecurity-2.2.2-2.6.32.45-201108262310.patch @@ -8890,10 +8890,13 @@ diff -urNp linux-2.6.32.45/arch/x86/include/asm/kprobes.h linux-2.6.32.45/arch/x diff -urNp linux-2.6.32.45/arch/x86/include/asm/kvm_host.h linux-2.6.32.45/arch/x86/include/asm/kvm_host.h --- linux-2.6.32.45/arch/x86/include/asm/kvm_host.h 2011-05-10 22:12:01.000000000 -0400 -+++ linux-2.6.32.45/arch/x86/include/asm/kvm_host.h 2011-05-10 22:12:26.000000000 -0400 -@@ -536,7 +536,7 @@ struct kvm_x86_ops { ++++ linux-2.6.32.45/arch/x86/include/asm/kvm_host.h 2011-08-26 20:19:09.000000000 -0400 +@@ -534,9 +534,9 @@ struct kvm_x86_ops { + bool (*gb_page_enable)(void); + const struct trace_print_flags *exit_reasons_str; - }; +-}; ++} __do_const; -extern struct kvm_x86_ops *kvm_x86_ops; +extern const struct kvm_x86_ops *kvm_x86_ops; @@ -12622,36 +12625,16 @@ diff -urNp linux-2.6.32.45/arch/x86/kernel/cpu/mtrr/main.c linux-2.6.32.45/arch/ mtrr_ops[ops->vendor] = ops; diff -urNp linux-2.6.32.45/arch/x86/kernel/cpu/mtrr/mtrr.h linux-2.6.32.45/arch/x86/kernel/cpu/mtrr/mtrr.h --- linux-2.6.32.45/arch/x86/kernel/cpu/mtrr/mtrr.h 2011-03-27 14:31:47.000000000 -0400 -+++ linux-2.6.32.45/arch/x86/kernel/cpu/mtrr/mtrr.h 2011-04-17 15:56:46.000000000 -0400 -@@ -12,19 +12,19 @@ - extern unsigned int mtrr_usage_table[MTRR_MAX_VAR_RANGES]; - - struct mtrr_ops { -- u32 vendor; -- u32 use_intel_if; -- void (*set)(unsigned int reg, unsigned long base, -+ const u32 vendor; -+ const u32 use_intel_if; -+ void (* const set)(unsigned int reg, unsigned long base, - unsigned long size, mtrr_type type); -- void (*set_all)(void); -+ void (* const set_all)(void); - -- void (*get)(unsigned int reg, unsigned long *base, -+ void (* const get)(unsigned int reg, unsigned long *base, - unsigned long *size, mtrr_type *type); -- int (*get_free_region)(unsigned long base, unsigned long size, -+ int (* const get_free_region)(unsigned long base, unsigned long size, - int replace_reg); -- int (*validate_add_page)(unsigned long base, unsigned long size, -+ int (* const validate_add_page)(unsigned long base, unsigned long size, ++++ linux-2.6.32.45/arch/x86/kernel/cpu/mtrr/mtrr.h 2011-08-26 20:23:57.000000000 -0400 +@@ -25,14 +25,14 @@ struct mtrr_ops { + int (*validate_add_page)(unsigned long base, unsigned long size, unsigned int type); -- int (*have_wrcomb)(void); -+ int (* const have_wrcomb)(void); - }; + int (*have_wrcomb)(void); +-}; ++} __do_const; extern int generic_get_free_region(unsigned long base, unsigned long size, -@@ -32,7 +32,7 @@ extern int generic_get_free_region(unsig + int replace_reg); extern int generic_validate_add_page(unsigned long base, unsigned long size, unsigned int type); @@ -13757,7 +13740,7 @@ diff -urNp linux-2.6.32.45/arch/x86/kernel/entry_32.S linux-2.6.32.45/arch/x86/k CFI_ADJUST_CFA_OFFSET -24 diff -urNp linux-2.6.32.45/arch/x86/kernel/entry_64.S linux-2.6.32.45/arch/x86/kernel/entry_64.S --- linux-2.6.32.45/arch/x86/kernel/entry_64.S 2011-03-27 14:31:47.000000000 -0400 -+++ linux-2.6.32.45/arch/x86/kernel/entry_64.S 2011-08-25 17:42:18.000000000 -0400 ++++ linux-2.6.32.45/arch/x86/kernel/entry_64.S 2011-08-26 20:19:09.000000000 -0400 @@ -53,6 +53,7 @@ #include <asm/paravirt.h> #include <asm/ftrace.h> @@ -13766,7 +13749,7 @@ diff -urNp linux-2.6.32.45/arch/x86/kernel/entry_64.S linux-2.6.32.45/arch/x86/k /* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this. */ #include <linux/elf-em.h> -@@ -174,6 +175,262 @@ ENTRY(native_usergs_sysret64) +@@ -174,6 +175,264 @@ ENTRY(native_usergs_sysret64) ENDPROC(native_usergs_sysret64) #endif /* CONFIG_PARAVIRT */ @@ -13985,6 +13968,7 @@ diff -urNp linux-2.6.32.45/arch/x86/kernel/entry_64.S linux-2.6.32.45/arch/x86/k +ENTRY(pax_erase_kstack) + pushq %rdi + pushq %rax ++ pushq %r10 + + GET_THREAD_INFO(%r10) + mov TI_lowest_stack(%r10), %rdi @@ -14021,6 +14005,7 @@ diff -urNp linux-2.6.32.45/arch/x86/kernel/entry_64.S linux-2.6.32.45/arch/x86/k + sub $256, %rdi + mov %rdi, TI_lowest_stack(%r10) + ++ popq %r10 + popq %rax + popq %rdi + ret @@ -14029,7 +14014,7 @@ diff -urNp linux-2.6.32.45/arch/x86/kernel/entry_64.S linux-2.6.32.45/arch/x86/k .macro TRACE_IRQS_IRETQ offset=ARGOFFSET #ifdef CONFIG_TRACE_IRQFLAGS -@@ -317,7 +574,7 @@ ENTRY(save_args) +@@ -317,7 +576,7 @@ ENTRY(save_args) leaq -ARGOFFSET+16(%rsp),%rdi /* arg1 for handler */ movq_cfi rbp, 8 /* push %rbp */ leaq 8(%rsp), %rbp /* mov %rsp, %ebp */ @@ -14038,7 +14023,7 @@ diff -urNp linux-2.6.32.45/arch/x86/kernel/entry_64.S linux-2.6.32.45/arch/x86/k je 1f SWAPGS /* -@@ -409,7 +666,7 @@ ENTRY(ret_from_fork) +@@ -409,7 +668,7 @@ ENTRY(ret_from_fork) RESTORE_REST @@ -14047,7 +14032,7 @@ diff -urNp linux-2.6.32.45/arch/x86/kernel/entry_64.S linux-2.6.32.45/arch/x86/k je int_ret_from_sys_call testl $_TIF_IA32, TI_flags(%rcx) # 32-bit compat task needs IRET -@@ -455,7 +712,7 @@ END(ret_from_fork) +@@ -455,7 +714,7 @@ END(ret_from_fork) ENTRY(system_call) CFI_STARTPROC simple CFI_SIGNAL_FRAME @@ -14056,7 +14041,7 @@ diff -urNp linux-2.6.32.45/arch/x86/kernel/entry_64.S linux-2.6.32.45/arch/x86/k CFI_REGISTER rip,rcx /*CFI_REGISTER rflags,r11*/ SWAPGS_UNSAFE_STACK -@@ -468,12 +725,13 @@ ENTRY(system_call_after_swapgs) +@@ -468,12 +727,13 @@ ENTRY(system_call_after_swapgs) movq %rsp,PER_CPU_VAR(old_rsp) movq PER_CPU_VAR(kernel_stack),%rsp @@ -14071,7 +14056,7 @@ diff -urNp linux-2.6.32.45/arch/x86/kernel/entry_64.S linux-2.6.32.45/arch/x86/k movq %rax,ORIG_RAX-ARGOFFSET(%rsp) movq %rcx,RIP-ARGOFFSET(%rsp) CFI_REL_OFFSET rip,RIP-ARGOFFSET -@@ -502,6 +760,8 @@ sysret_check: +@@ -502,6 +762,8 @@ sysret_check: andl %edi,%edx jnz sysret_careful CFI_REMEMBER_STATE @@ -14080,7 +14065,7 @@ diff -urNp linux-2.6.32.45/arch/x86/kernel/entry_64.S linux-2.6.32.45/arch/x86/k /* * sysretq will re-enable interrupts: */ -@@ -562,6 +822,9 @@ auditsys: +@@ -562,6 +824,9 @@ auditsys: movq %rax,%rsi /* 2nd arg: syscall number */ movl $AUDIT_ARCH_X86_64,%edi /* 1st arg: audit arch */ call audit_syscall_entry @@ -14090,7 +14075,7 @@ diff -urNp linux-2.6.32.45/arch/x86/kernel/entry_64.S linux-2.6.32.45/arch/x86/k LOAD_ARGS 0 /* reload call-clobbered registers */ jmp system_call_fastpath -@@ -592,6 +855,9 @@ tracesys: +@@ -592,6 +857,9 @@ tracesys: FIXUP_TOP_OF_STACK %rdi movq %rsp,%rdi call syscall_trace_enter @@ -14100,7 +14085,7 @@ diff -urNp linux-2.6.32.45/arch/x86/kernel/entry_64.S linux-2.6.32.45/arch/x86/k /* * Reload arg registers from stack in case ptrace changed them. * We don't reload %rax because syscall_trace_enter() returned -@@ -613,7 +879,7 @@ tracesys: +@@ -613,7 +881,7 @@ tracesys: GLOBAL(int_ret_from_sys_call) DISABLE_INTERRUPTS(CLBR_NONE) TRACE_IRQS_OFF @@ -14109,7 +14094,7 @@ diff -urNp linux-2.6.32.45/arch/x86/kernel/entry_64.S linux-2.6.32.45/arch/x86/k je retint_restore_args movl $_TIF_ALLWORK_MASK,%edi /* edi: mask to check */ -@@ -800,6 +1066,16 @@ END(interrupt) +@@ -800,6 +1068,16 @@ END(interrupt) CFI_ADJUST_CFA_OFFSET 10*8 call save_args PARTIAL_FRAME 0 @@ -14126,7 +14111,7 @@ diff -urNp linux-2.6.32.45/arch/x86/kernel/entry_64.S linux-2.6.32.45/arch/x86/k call \func .endm -@@ -822,7 +1098,7 @@ ret_from_intr: +@@ -822,7 +1100,7 @@ ret_from_intr: CFI_ADJUST_CFA_OFFSET -8 exit_intr: GET_THREAD_INFO(%rcx) @@ -14135,7 +14120,7 @@ diff -urNp linux-2.6.32.45/arch/x86/kernel/entry_64.S linux-2.6.32.45/arch/x86/k je retint_kernel /* Interrupt came from user space */ -@@ -844,12 +1120,15 @@ retint_swapgs: /* return to user-space +@@ -844,12 +1122,15 @@ retint_swapgs: /* return to user-space * The iretq could re-enable interrupts: */ DISABLE_INTERRUPTS(CLBR_ANY) @@ -14151,7 +14136,7 @@ diff -urNp linux-2.6.32.45/arch/x86/kernel/entry_64.S linux-2.6.32.45/arch/x86/k /* * The iretq could re-enable interrupts: */ -@@ -1032,6 +1311,16 @@ ENTRY(\sym) +@@ -1032,6 +1313,16 @@ ENTRY(\sym) CFI_ADJUST_CFA_OFFSET 15*8 call error_entry DEFAULT_FRAME 0 @@ -14168,7 +14153,7 @@ diff -urNp linux-2.6.32.45/arch/x86/kernel/entry_64.S linux-2.6.32.45/arch/x86/k movq %rsp,%rdi /* pt_regs pointer */ xorl %esi,%esi /* no error code */ call \do_sym -@@ -1049,6 +1338,16 @@ ENTRY(\sym) +@@ -1049,6 +1340,16 @@ ENTRY(\sym) subq $15*8, %rsp call save_paranoid TRACE_IRQS_OFF @@ -14185,7 +14170,7 @@ diff -urNp linux-2.6.32.45/arch/x86/kernel/entry_64.S linux-2.6.32.45/arch/x86/k movq %rsp,%rdi /* pt_regs pointer */ xorl %esi,%esi /* no error code */ call \do_sym -@@ -1066,9 +1365,24 @@ ENTRY(\sym) +@@ -1066,9 +1367,24 @@ ENTRY(\sym) subq $15*8, %rsp call save_paranoid TRACE_IRQS_OFF @@ -14211,7 +14196,7 @@ diff -urNp linux-2.6.32.45/arch/x86/kernel/entry_64.S linux-2.6.32.45/arch/x86/k subq $EXCEPTION_STKSZ, TSS_ist + (\ist - 1) * 8(%rbp) call \do_sym addq $EXCEPTION_STKSZ, TSS_ist + (\ist - 1) * 8(%rbp) -@@ -1085,6 +1399,16 @@ ENTRY(\sym) +@@ -1085,6 +1401,16 @@ ENTRY(\sym) CFI_ADJUST_CFA_OFFSET 15*8 call error_entry DEFAULT_FRAME 0 @@ -14228,7 +14213,7 @@ diff -urNp linux-2.6.32.45/arch/x86/kernel/entry_64.S linux-2.6.32.45/arch/x86/k movq %rsp,%rdi /* pt_regs pointer */ movq ORIG_RAX(%rsp),%rsi /* get error code */ movq $-1,ORIG_RAX(%rsp) /* no syscall to restart */ -@@ -1104,6 +1428,16 @@ ENTRY(\sym) +@@ -1104,6 +1430,16 @@ ENTRY(\sym) call save_paranoid DEFAULT_FRAME 0 TRACE_IRQS_OFF @@ -14245,7 +14230,7 @@ diff -urNp linux-2.6.32.45/arch/x86/kernel/entry_64.S linux-2.6.32.45/arch/x86/k movq %rsp,%rdi /* pt_regs pointer */ movq ORIG_RAX(%rsp),%rsi /* get error code */ movq $-1,ORIG_RAX(%rsp) /* no syscall to restart */ -@@ -1405,14 +1739,27 @@ ENTRY(paranoid_exit) +@@ -1405,14 +1741,27 @@ ENTRY(paranoid_exit) TRACE_IRQS_OFF testl %ebx,%ebx /* swapgs needed? */ jnz paranoid_restore @@ -14274,7 +14259,7 @@ diff -urNp linux-2.6.32.45/arch/x86/kernel/entry_64.S linux-2.6.32.45/arch/x86/k TRACE_IRQS_IRETQ 0 RESTORE_ALL 8 jmp irq_return -@@ -1470,7 +1817,7 @@ ENTRY(error_entry) +@@ -1470,7 +1819,7 @@ ENTRY(error_entry) movq_cfi r14, R14+8 movq_cfi r15, R15+8 xorl %ebx,%ebx @@ -14283,7 +14268,7 @@ diff -urNp linux-2.6.32.45/arch/x86/kernel/entry_64.S linux-2.6.32.45/arch/x86/k je error_kernelspace error_swapgs: SWAPGS -@@ -1529,6 +1876,16 @@ ENTRY(nmi) +@@ -1529,6 +1878,16 @@ ENTRY(nmi) CFI_ADJUST_CFA_OFFSET 15*8 call save_paranoid DEFAULT_FRAME 0 @@ -14300,7 +14285,7 @@ diff -urNp linux-2.6.32.45/arch/x86/kernel/entry_64.S linux-2.6.32.45/arch/x86/k /* paranoidentry do_nmi, 0; without TRACE_IRQS_OFF */ movq %rsp,%rdi movq $-1,%rsi -@@ -1539,11 +1896,25 @@ ENTRY(nmi) +@@ -1539,11 +1898,25 @@ ENTRY(nmi) DISABLE_INTERRUPTS(CLBR_NONE) testl %ebx,%ebx /* swapgs needed? */ jnz nmi_restore @@ -57199,38 +57184,16 @@ diff -urNp linux-2.6.32.45/include/linux/binfmts.h linux-2.6.32.45/include/linux }; diff -urNp linux-2.6.32.45/include/linux/blkdev.h linux-2.6.32.45/include/linux/blkdev.h --- linux-2.6.32.45/include/linux/blkdev.h 2011-03-27 14:31:47.000000000 -0400 -+++ linux-2.6.32.45/include/linux/blkdev.h 2011-04-17 15:56:46.000000000 -0400 -@@ -1265,19 +1265,19 @@ static inline int blk_integrity_rq(struc - #endif /* CONFIG_BLK_DEV_INTEGRITY */ - - struct block_device_operations { -- int (*open) (struct block_device *, fmode_t); -- int (*release) (struct gendisk *, fmode_t); -- int (*locked_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); -- int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); -- int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); -- int (*direct_access) (struct block_device *, sector_t, -+ int (* const open) (struct block_device *, fmode_t); -+ int (* const release) (struct gendisk *, fmode_t); -+ int (* const locked_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); -+ int (* const ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); -+ int (* const compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); -+ int (* const direct_access) (struct block_device *, sector_t, - void **, unsigned long *); -- int (*media_changed) (struct gendisk *); -- unsigned long long (*set_capacity) (struct gendisk *, -+ int (* const media_changed) (struct gendisk *); -+ unsigned long long (* const set_capacity) (struct gendisk *, - unsigned long long); -- int (*revalidate_disk) (struct gendisk *); -- int (*getgeo)(struct block_device *, struct hd_geometry *); -- struct module *owner; -+ int (* const revalidate_disk) (struct gendisk *); -+ int (*const getgeo)(struct block_device *, struct hd_geometry *); -+ struct module * const owner; - }; ++++ linux-2.6.32.45/include/linux/blkdev.h 2011-08-26 20:27:21.000000000 -0400 +@@ -1278,7 +1278,7 @@ struct block_device_operations { + int (*revalidate_disk) (struct gendisk *); + int (*getgeo)(struct block_device *, struct hd_geometry *); + struct module *owner; +-}; ++} __do_const; extern int __blkdev_driver_ioctl(struct block_device *, fmode_t, unsigned int, + unsigned long); diff -urNp linux-2.6.32.45/include/linux/blktrace_api.h linux-2.6.32.45/include/linux/blktrace_api.h --- linux-2.6.32.45/include/linux/blktrace_api.h 2011-03-27 14:31:47.000000000 -0400 +++ linux-2.6.32.45/include/linux/blktrace_api.h 2011-05-04 17:56:28.000000000 -0400 @@ -57337,8 +57300,8 @@ diff -urNp linux-2.6.32.45/include/linux/capability.h linux-2.6.32.45/include/li struct dentry; diff -urNp linux-2.6.32.45/include/linux/compiler-gcc4.h linux-2.6.32.45/include/linux/compiler-gcc4.h --- linux-2.6.32.45/include/linux/compiler-gcc4.h 2011-03-27 14:31:47.000000000 -0400 -+++ linux-2.6.32.45/include/linux/compiler-gcc4.h 2011-08-05 20:33:55.000000000 -0400 -@@ -36,4 +36,13 @@ ++++ linux-2.6.32.45/include/linux/compiler-gcc4.h 2011-08-26 20:19:09.000000000 -0400 +@@ -36,4 +36,16 @@ the kernel context */ #define __cold __attribute__((__cold__)) @@ -57348,14 +57311,17 @@ diff -urNp linux-2.6.32.45/include/linux/compiler-gcc4.h linux-2.6.32.45/include +#define __bos1(ptr) __bos((ptr), 1) + +#if __GNUC_MINOR__ >= 5 ++#ifdef CONSTIFY_PLUGIN +#define __no_const __attribute__((no_const)) ++#define __do_const __attribute__((do_const)) ++#endif +#endif + #endif diff -urNp linux-2.6.32.45/include/linux/compiler.h linux-2.6.32.45/include/linux/compiler.h --- linux-2.6.32.45/include/linux/compiler.h 2011-03-27 14:31:47.000000000 -0400 -+++ linux-2.6.32.45/include/linux/compiler.h 2011-08-05 20:33:55.000000000 -0400 -@@ -247,6 +247,10 @@ void ftrace_likely_update(struct ftrace_ ++++ linux-2.6.32.45/include/linux/compiler.h 2011-08-26 20:19:09.000000000 -0400 +@@ -247,6 +247,14 @@ void ftrace_likely_update(struct ftrace_ # define __attribute_const__ /* unimplemented */ #endif @@ -57363,10 +57329,14 @@ diff -urNp linux-2.6.32.45/include/linux/compiler.h linux-2.6.32.45/include/linu +# define __no_const +#endif + ++#ifndef __do_const ++# define __do_const ++#endif ++ /* * Tell gcc if a function is cold. The compiler will assume any path * directly leading to the call is unlikely. -@@ -256,6 +260,22 @@ void ftrace_likely_update(struct ftrace_ +@@ -256,6 +264,22 @@ void ftrace_likely_update(struct ftrace_ #define __cold #endif @@ -57389,7 +57359,7 @@ diff -urNp linux-2.6.32.45/include/linux/compiler.h linux-2.6.32.45/include/linu /* Simple shorthand for a section definition */ #ifndef __section # define __section(S) __attribute__ ((__section__(#S))) -@@ -278,6 +298,7 @@ void ftrace_likely_update(struct ftrace_ +@@ -278,6 +302,7 @@ void ftrace_likely_update(struct ftrace_ * use is to mediate communication between process-level code and irq/NMI * handlers, all running on the same CPU. */ @@ -57452,8 +57422,8 @@ diff -urNp linux-2.6.32.45/include/linux/decompress/mm.h linux-2.6.32.45/include #define large_malloc(a) vmalloc(a) diff -urNp linux-2.6.32.45/include/linux/dma-mapping.h linux-2.6.32.45/include/linux/dma-mapping.h --- linux-2.6.32.45/include/linux/dma-mapping.h 2011-03-27 14:31:47.000000000 -0400 -+++ linux-2.6.32.45/include/linux/dma-mapping.h 2011-04-17 15:56:46.000000000 -0400 -@@ -16,50 +16,50 @@ enum dma_data_direction { ++++ linux-2.6.32.45/include/linux/dma-mapping.h 2011-08-26 20:19:09.000000000 -0400 +@@ -16,51 +16,51 @@ enum dma_data_direction { }; struct dma_map_ops { @@ -57514,11 +57484,12 @@ diff -urNp linux-2.6.32.45/include/linux/dma-mapping.h linux-2.6.32.45/include/l + int (* const mapping_error)(struct device *dev, dma_addr_t dma_addr); + int (* const dma_supported)(struct device *dev, u64 mask); int (*set_dma_mask)(struct device *dev, u64 mask); -- int is_phys; -+ const int is_phys; - }; + int is_phys; +-}; ++} __do_const; #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) + diff -urNp linux-2.6.32.45/include/linux/dst.h linux-2.6.32.45/include/linux/dst.h --- linux-2.6.32.45/include/linux/dst.h 2011-03-27 14:31:47.000000000 -0400 +++ linux-2.6.32.45/include/linux/dst.h 2011-04-17 15:56:46.000000000 -0400 @@ -57629,7 +57600,7 @@ diff -urNp linux-2.6.32.45/include/linux/fscache-cache.h linux-2.6.32.45/include fscache_set_op_state(op, "Init"); diff -urNp linux-2.6.32.45/include/linux/fs.h linux-2.6.32.45/include/linux/fs.h --- linux-2.6.32.45/include/linux/fs.h 2011-07-13 17:23:04.000000000 -0400 -+++ linux-2.6.32.45/include/linux/fs.h 2011-08-23 21:22:32.000000000 -0400 ++++ linux-2.6.32.45/include/linux/fs.h 2011-08-26 20:19:09.000000000 -0400 @@ -90,6 +90,11 @@ struct inodes_stat_t { /* Expect random access pattern */ #define FMODE_RANDOM ((__force fmode_t)4096) @@ -57740,19 +57711,12 @@ diff -urNp linux-2.6.32.45/include/linux/fs.h linux-2.6.32.45/include/linux/fs.h * array */ }; int fiemap_fill_next_extent(struct fiemap_extent_info *info, u64 logical, -@@ -1486,7 +1491,7 @@ struct block_device_operations; - * can be called without the big kernel lock held in all filesystems. - */ - struct file_operations { -- struct module *owner; -+ struct module * const owner; - loff_t (*llseek) (struct file *, loff_t, int); - ssize_t (*read) (struct file *, char __user *, size_t, loff_t *); - ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); -@@ -1513,6 +1518,7 @@ struct file_operations { +@@ -1512,7 +1517,8 @@ struct file_operations { + ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int); ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); int (*setlease)(struct file *, long, struct file_lock **); - }; +-}; ++} __do_const; +typedef struct file_operations __no_const file_operations_no_const; struct inode_operations { @@ -59043,7 +59007,7 @@ diff -urNp linux-2.6.32.45/include/linux/kallsyms.h linux-2.6.32.45/include/linu static void __check_printsym_format(const char *fmt, ...) diff -urNp linux-2.6.32.45/include/linux/kgdb.h linux-2.6.32.45/include/linux/kgdb.h --- linux-2.6.32.45/include/linux/kgdb.h 2011-03-27 14:31:47.000000000 -0400 -+++ linux-2.6.32.45/include/linux/kgdb.h 2011-08-05 20:33:55.000000000 -0400 ++++ linux-2.6.32.45/include/linux/kgdb.h 2011-08-26 20:25:20.000000000 -0400 @@ -74,8 +74,8 @@ void kgdb_breakpoint(void); extern int kgdb_connected; @@ -59055,34 +59019,21 @@ diff -urNp linux-2.6.32.45/include/linux/kgdb.h linux-2.6.32.45/include/linux/kg extern struct task_struct *kgdb_usethread; extern struct task_struct *kgdb_contthread; -@@ -226,8 +226,8 @@ extern int kgdb_arch_remove_breakpoint(u - * hardware debug registers. - */ - struct kgdb_arch { -- unsigned char gdb_bpt_instr[BREAK_INSTR_SIZE]; -- unsigned long flags; -+ const unsigned char gdb_bpt_instr[BREAK_INSTR_SIZE]; -+ const unsigned long flags; - - int (*set_breakpoint)(unsigned long, char *); - int (*remove_breakpoint)(unsigned long, char *); -@@ -251,20 +251,20 @@ struct kgdb_arch { - */ - struct kgdb_io { - const char *name; -- int (*read_char) (void); -- void (*write_char) (u8); -- void (*flush) (void); -- int (*init) (void); -- void (*pre_exception) (void); -- void (*post_exception) (void); -+ int (* const read_char) (void); -+ void (* const write_char) (u8); -+ void (* const flush) (void); -+ int (* const init) (void); -+ void (* const pre_exception) (void); -+ void (* const post_exception) (void); - }; +@@ -235,7 +235,7 @@ struct kgdb_arch { + int (*remove_hw_breakpoint)(unsigned long, int, enum kgdb_bptype); + void (*remove_all_hw_break)(void); + void (*correct_hw_break)(void); +-}; ++} __do_const; + + /** + * struct kgdb_io - Describe the interface for an I/O driver to talk with KGDB. +@@ -257,14 +257,14 @@ struct kgdb_io { + int (*init) (void); + void (*pre_exception) (void); + void (*post_exception) (void); +-}; ++} __do_const; -extern struct kgdb_arch arch_kgdb_ops; +extern const struct kgdb_arch arch_kgdb_ops; @@ -59182,7 +59133,7 @@ diff -urNp linux-2.6.32.45/include/linux/kvm_host.h linux-2.6.32.45/include/linu int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu); diff -urNp linux-2.6.32.45/include/linux/libata.h linux-2.6.32.45/include/linux/libata.h --- linux-2.6.32.45/include/linux/libata.h 2011-03-27 14:31:47.000000000 -0400 -+++ linux-2.6.32.45/include/linux/libata.h 2011-08-05 20:33:55.000000000 -0400 ++++ linux-2.6.32.45/include/linux/libata.h 2011-08-26 20:19:09.000000000 -0400 @@ -525,11 +525,11 @@ struct ata_ioports { struct ata_host { @@ -59206,15 +59157,15 @@ diff -urNp linux-2.6.32.45/include/linux/libata.h linux-2.6.32.45/include/linux/ spinlock_t *lock; /* Flags owned by the EH context. Only EH should touch these once the port is active */ -@@ -883,7 +883,7 @@ struct ata_port_operations { - * ->inherits must be the last field and all the preceding +@@ -884,7 +884,7 @@ struct ata_port_operations { * fields must be pointers. */ -- const struct ata_port_operations *inherits; -+ const struct ata_port_operations * const inherits; - }; + const struct ata_port_operations *inherits; +-}; ++} __do_const; struct ata_port_info { + unsigned long flags; @@ -892,7 +892,7 @@ struct ata_port_info { unsigned long pio_mask; unsigned long mwdma_mask; @@ -61140,26 +61091,16 @@ diff -urNp linux-2.6.32.45/include/net/lapb.h linux-2.6.32.45/include/net/lapb.h struct lapb_frame frmr_data; diff -urNp linux-2.6.32.45/include/net/neighbour.h linux-2.6.32.45/include/net/neighbour.h --- linux-2.6.32.45/include/net/neighbour.h 2011-03-27 14:31:47.000000000 -0400 -+++ linux-2.6.32.45/include/net/neighbour.h 2011-04-17 15:56:46.000000000 -0400 -@@ -125,12 +125,12 @@ struct neighbour - struct neigh_ops - { - int family; -- void (*solicit)(struct neighbour *, struct sk_buff*); -- void (*error_report)(struct neighbour *, struct sk_buff*); -- int (*output)(struct sk_buff*); -- int (*connected_output)(struct sk_buff*); -- int (*hh_output)(struct sk_buff*); -- int (*queue_xmit)(struct sk_buff*); -+ void (* const solicit)(struct neighbour *, struct sk_buff*); -+ void (* const error_report)(struct neighbour *, struct sk_buff*); -+ int (* const output)(struct sk_buff*); -+ int (* const connected_output)(struct sk_buff*); -+ int (* const hh_output)(struct sk_buff*); -+ int (* const queue_xmit)(struct sk_buff*); - }; ++++ linux-2.6.32.45/include/net/neighbour.h 2011-08-26 20:29:08.000000000 -0400 +@@ -131,7 +131,7 @@ struct neigh_ops + int (*connected_output)(struct sk_buff*); + int (*hh_output)(struct sk_buff*); + int (*queue_xmit)(struct sk_buff*); +-}; ++} __do_const; struct pneigh_entry + { diff -urNp linux-2.6.32.45/include/net/netlink.h linux-2.6.32.45/include/net/netlink.h --- linux-2.6.32.45/include/net/netlink.h 2011-07-13 17:23:04.000000000 -0400 +++ linux-2.6.32.45/include/net/netlink.h 2011-08-21 18:08:11.000000000 -0400 @@ -61328,83 +61269,16 @@ diff -urNp linux-2.6.32.45/include/scsi/scsi_device.h linux-2.6.32.45/include/sc sdev_dev; diff -urNp linux-2.6.32.45/include/scsi/scsi_transport_fc.h linux-2.6.32.45/include/scsi/scsi_transport_fc.h --- linux-2.6.32.45/include/scsi/scsi_transport_fc.h 2011-03-27 14:31:47.000000000 -0400 -+++ linux-2.6.32.45/include/scsi/scsi_transport_fc.h 2011-08-05 20:33:55.000000000 -0400 -@@ -663,9 +663,9 @@ struct fc_function_template { - int (*bsg_timeout)(struct fc_bsg_job *); - - /* allocation lengths for host-specific data */ -- u32 dd_fcrport_size; -- u32 dd_fcvport_size; -- u32 dd_bsg_size; -+ const u32 dd_fcrport_size; -+ const u32 dd_fcvport_size; -+ const u32 dd_bsg_size; - - /* - * The driver sets these to tell the transport class it -@@ -675,39 +675,39 @@ struct fc_function_template { - */ ++++ linux-2.6.32.45/include/scsi/scsi_transport_fc.h 2011-08-26 20:19:09.000000000 -0400 +@@ -708,7 +708,7 @@ struct fc_function_template { + unsigned long show_host_system_hostname:1; - /* remote port fixed attributes */ -- unsigned long show_rport_maxframe_size:1; -- unsigned long show_rport_supported_classes:1; -- unsigned long show_rport_dev_loss_tmo:1; -+ const unsigned long show_rport_maxframe_size:1; -+ const unsigned long show_rport_supported_classes:1; -+ const unsigned long show_rport_dev_loss_tmo:1; - - /* - * target dynamic attributes - * These should all be "1" if the driver uses the remote port - * add/delete functions (so attributes reflect rport values). - */ -- unsigned long show_starget_node_name:1; -- unsigned long show_starget_port_name:1; -- unsigned long show_starget_port_id:1; -+ const unsigned long show_starget_node_name:1; -+ const unsigned long show_starget_port_name:1; -+ const unsigned long show_starget_port_id:1; - - /* host fixed attributes */ -- unsigned long show_host_node_name:1; -- unsigned long show_host_port_name:1; -- unsigned long show_host_permanent_port_name:1; -- unsigned long show_host_supported_classes:1; -- unsigned long show_host_supported_fc4s:1; -- unsigned long show_host_supported_speeds:1; -- unsigned long show_host_maxframe_size:1; -- unsigned long show_host_serial_number:1; -+ const unsigned long show_host_node_name:1; -+ const unsigned long show_host_port_name:1; -+ const unsigned long show_host_permanent_port_name:1; -+ const unsigned long show_host_supported_classes:1; -+ const unsigned long show_host_supported_fc4s:1; -+ const unsigned long show_host_supported_speeds:1; -+ const unsigned long show_host_maxframe_size:1; -+ const unsigned long show_host_serial_number:1; - /* host dynamic attributes */ -- unsigned long show_host_port_id:1; -- unsigned long show_host_port_type:1; -- unsigned long show_host_port_state:1; -- unsigned long show_host_active_fc4s:1; -- unsigned long show_host_speed:1; -- unsigned long show_host_fabric_name:1; -- unsigned long show_host_symbolic_name:1; -- unsigned long show_host_system_hostname:1; -+ const unsigned long show_host_port_id:1; -+ const unsigned long show_host_port_type:1; -+ const unsigned long show_host_port_state:1; -+ const unsigned long show_host_active_fc4s:1; -+ const unsigned long show_host_speed:1; -+ const unsigned long show_host_fabric_name:1; -+ const unsigned long show_host_symbolic_name:1; -+ const unsigned long show_host_system_hostname:1; - -- unsigned long disable_target_scan:1; -+ const unsigned long disable_target_scan:1; - }; + unsigned long disable_target_scan:1; +-}; ++} __do_const; + /** diff -urNp linux-2.6.32.45/include/sound/ac97_codec.h linux-2.6.32.45/include/sound/ac97_codec.h --- linux-2.6.32.45/include/sound/ac97_codec.h 2011-03-27 14:31:47.000000000 -0400 +++ linux-2.6.32.45/include/sound/ac97_codec.h 2011-04-17 15:56:46.000000000 -0400 @@ -66828,7 +66702,7 @@ diff -urNp linux-2.6.32.45/localversion-grsec linux-2.6.32.45/localversion-grsec +-grsec diff -urNp linux-2.6.32.45/Makefile linux-2.6.32.45/Makefile --- linux-2.6.32.45/Makefile 2011-08-16 20:37:25.000000000 -0400 -+++ linux-2.6.32.45/Makefile 2011-08-24 18:35:52.000000000 -0400 ++++ linux-2.6.32.45/Makefile 2011-08-26 22:53:29.000000000 -0400 @@ -221,8 +221,9 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" HOSTCC = gcc @@ -66881,7 +66755,7 @@ diff -urNp linux-2.6.32.45/Makefile linux-2.6.32.45/Makefile endif +ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-plugin.sh $(HOSTCC)), y) -+CONSTIFY_PLUGIN := -fplugin=$(objtree)/tools/gcc/constify_plugin.so ++CONSTIFY_PLUGIN := -fplugin=$(objtree)/tools/gcc/constify_plugin.so -DCONSTIFY_PLUGIN +ifdef CONFIG_PAX_MEMORY_STACKLEAK +STACKLEAK_PLUGIN := -fplugin=$(objtree)/tools/gcc/stackleak_plugin.so -fplugin-arg-stackleak_plugin-track-lowest-sp=100 +endif @@ -66944,15 +66818,6 @@ diff -urNp linux-2.6.32.45/Makefile linux-2.6.32.45/Makefile # clean - Delete most, but leave enough to build external modules # -@@ -1242,7 +1266,7 @@ distclean: mrproper - @find $(srctree) $(RCS_FIND_IGNORE) \ - \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ - -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ -- -o -name '.*.rej' -o -size 0 \ -+ -o -name '.*.rej' -o -size 0 -o -name '*.so' \ - -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \ - -type f -print | xargs rm -f - @@ -1289,6 +1313,7 @@ help: @echo ' modules_prepare - Set up for building external modules' @echo ' tags/TAGS - Generate tags file for editors' @@ -66961,7 +66826,15 @@ diff -urNp linux-2.6.32.45/Makefile linux-2.6.32.45/Makefile @echo ' kernelrelease - Output the release version string' @echo ' kernelversion - Output the version stored in Makefile' @echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \ -@@ -1421,7 +1446,7 @@ clean: $(clean-dirs) +@@ -1390,6 +1415,7 @@ PHONY += $(module-dirs) modules + $(module-dirs): crmodverdir $(objtree)/Module.symvers + $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@) + ++modules: KBUILD_CFLAGS += $(CONSTIFY_PLUGIN) $(STACKLEAK_PLUGIN) + modules: $(module-dirs) + @$(kecho) ' Building modules, stage 2.'; + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost +@@ -1421,7 +1447,7 @@ clean: $(clean-dirs) $(call cmd,rmdirs) $(call cmd,rmfiles) @find $(KBUILD_EXTMOD) $(RCS_FIND_IGNORE) \ @@ -66970,7 +66843,7 @@ diff -urNp linux-2.6.32.45/Makefile linux-2.6.32.45/Makefile -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ -o -name '*.gcno' \) -type f -print | xargs rm -f -@@ -1445,7 +1470,7 @@ endif # KBUILD_EXTMOD +@@ -1445,7 +1471,7 @@ endif # KBUILD_EXTMOD quiet_cmd_tags = GEN $@ cmd_tags = $(CONFIG_SHELL) $(srctree)/scripts/tags.sh $@ @@ -76207,8 +76080,8 @@ diff -urNp linux-2.6.32.45/sound/usb/usbaudio.c linux-2.6.32.45/sound/usb/usbaud } diff -urNp linux-2.6.32.45/tools/gcc/constify_plugin.c linux-2.6.32.45/tools/gcc/constify_plugin.c --- linux-2.6.32.45/tools/gcc/constify_plugin.c 1969-12-31 19:00:00.000000000 -0500 -+++ linux-2.6.32.45/tools/gcc/constify_plugin.c 2011-08-24 18:36:35.000000000 -0400 -@@ -0,0 +1,259 @@ ++++ linux-2.6.32.45/tools/gcc/constify_plugin.c 2011-08-26 20:19:09.000000000 -0400 +@@ -0,0 +1,288 @@ +/* + * Copyright 2011 by Emese Revfy <re.emese@gmail.com> + * Licensed under the GPL v2, or (at your option) v3 @@ -76235,29 +76108,29 @@ diff -urNp linux-2.6.32.45/tools/gcc/constify_plugin.c linux-2.6.32.45/tools/gcc +#include "plugin.h" +//#include "c-tree.h" + -+#define C_TYPE_FIELDS_READONLY(TYPE) TREE_LANG_FLAG_1 (TYPE) ++#define C_TYPE_FIELDS_READONLY(TYPE) TREE_LANG_FLAG_1(TYPE) + +int plugin_is_GPL_compatible; + +static struct plugin_info const_plugin_info = { -+ .version = "20110824", ++ .version = "20110826", + .help = "no-constify\tturn off constification\n", +}; + ++static void constify_type(tree type); +static bool walk_struct(tree node); + -+static void deconstify_node(tree type) ++static tree deconstify_type(tree old_type) +{ -+ tree field; ++ tree new_type, field; + -+ C_TYPE_FIELDS_READONLY(type) = 0; -+ for (field = TYPE_FIELDS(type); field; field = TREE_CHAIN(field)) { -+ enum tree_code code = TREE_CODE(TREE_TYPE(field)); -+ if (code == RECORD_TYPE || code == UNION_TYPE) -+ deconstify_node(TREE_TYPE(field)); -+ TREE_READONLY(field) = 0; -+ TYPE_READONLY(TREE_TYPE(field)) = 0; -+ } ++ new_type = build_qualified_type(old_type, TYPE_QUALS(old_type) & ~TYPE_QUAL_CONST); ++ TYPE_FIELDS(new_type) = copy_list(TYPE_FIELDS(new_type)); ++ for (field = TYPE_FIELDS(new_type); field; field = TREE_CHAIN(field)) ++ DECL_FIELD_CONTEXT(field) = new_type; ++ TYPE_READONLY(new_type) = 0; ++ C_TYPE_FIELDS_READONLY(new_type) = 0; ++ return new_type; +} + +static tree handle_no_const_attribute(tree *node, tree name, tree args, int flags, bool *no_add_attrs) @@ -76275,7 +76148,7 @@ diff -urNp linux-2.6.32.45/tools/gcc/constify_plugin.c linux-2.6.32.45/tools/gcc + return NULL_TREE; + } + -+ if (!DECL_P(*node)) { ++ if (TYPE_P(*node)) { + if (TREE_CODE(*node) == RECORD_TYPE || TREE_CODE(*node) == UNION_TYPE) + *no_add_attrs = false; + else @@ -76290,7 +76163,7 @@ diff -urNp linux-2.6.32.45/tools/gcc/constify_plugin.c linux-2.6.32.45/tools/gcc + return NULL_TREE; + } + -+ if (lookup_attribute("no_const", TYPE_ATTRIBUTES(type))) { ++ if (lookup_attribute(IDENTIFIER_POINTER(name), TYPE_ATTRIBUTES(type))) { + error("%qE attribute is already applied to the type", name); + return NULL_TREE; + } @@ -76301,12 +76174,29 @@ diff -urNp linux-2.6.32.45/tools/gcc/constify_plugin.c linux-2.6.32.45/tools/gcc + } + + if (TREE_CODE(*node) == TYPE_DECL) { -+ TREE_TYPE(*node) = build_qualified_type(type, TYPE_QUALS(type) & ~TYPE_QUAL_CONST); -+ TYPE_FIELDS(TREE_TYPE(*node)) = copy_list(TYPE_FIELDS(TREE_TYPE(*node))); -+ deconstify_node(TREE_TYPE(*node)); ++ TREE_TYPE(*node) = deconstify_type(type); ++ TREE_READONLY(*node) = 0; ++ return NULL_TREE; ++ } ++ ++ return NULL_TREE; ++} ++ ++static tree handle_do_const_attribute(tree *node, tree name, tree args, int flags, bool *no_add_attrs) ++{ ++ *no_add_attrs = true; ++ if (!TYPE_P(*node)) { ++ error("%qE attribute applies to types only", name); ++ return NULL_TREE; ++ } ++ ++ if (TREE_CODE(*node) != RECORD_TYPE && TREE_CODE(*node) != UNION_TYPE) { ++ error("%qE attribute applies to struct and union types only", name); + return NULL_TREE; + } + ++ *no_add_attrs = false; ++ constify_type(*node); + return NULL_TREE; +} + @@ -76320,14 +76210,26 @@ diff -urNp linux-2.6.32.45/tools/gcc/constify_plugin.c linux-2.6.32.45/tools/gcc + .handler = handle_no_const_attribute +}; + ++static struct attribute_spec do_const_attr = { ++ .name = "do_const", ++ .min_length = 0, ++ .max_length = 0, ++ .decl_required = false, ++ .type_required = false, ++ .function_type_required = false, ++ .handler = handle_do_const_attribute ++}; ++ +static void register_attributes(void *event_data, void *data) +{ + register_attribute(&no_const_attr); ++ register_attribute(&do_const_attr); +} + -+static void constify_node(tree node) ++static void constify_type(tree type) +{ -+ TREE_READONLY(node) = 1; ++ TYPE_READONLY(type) = 1; ++ C_TYPE_FIELDS_READONLY(type) = 1; +} + +static bool is_fptr(tree field) @@ -76356,7 +76258,7 @@ diff -urNp linux-2.6.32.45/tools/gcc/constify_plugin.c linux-2.6.32.45/tools/gcc + if (code == RECORD_TYPE || code == UNION_TYPE) { + if (!(walk_struct(type))) + return false; -+ } else if (is_fptr(field) == false && !TREE_READONLY(field)) ++ } else if (!is_fptr(field) && !TREE_READONLY(field)) + return false; + } + return true; @@ -76364,16 +76266,16 @@ diff -urNp linux-2.6.32.45/tools/gcc/constify_plugin.c linux-2.6.32.45/tools/gcc + +static void finish_type(void *event_data, void *data) +{ -+ tree node = (tree)event_data; ++ tree type = (tree)event_data; + -+ if (node == NULL_TREE) ++ if (type == NULL_TREE) + return; + -+ if (TREE_READONLY(node)) ++ if (TYPE_READONLY(type)) + return; + -+ if (walk_struct(node)) -+ constify_node(node); ++ if (walk_struct(type)) ++ constify_type(type); +} + +static unsigned int check_local_variables(void); @@ -76468,6 +76370,7 @@ diff -urNp linux-2.6.32.45/tools/gcc/constify_plugin.c linux-2.6.32.45/tools/gcc + + return 0; +} +Binary files linux-2.6.32.45/tools/gcc/constify_plugin.so and linux-2.6.32.45/tools/gcc/constify_plugin.so differ diff -urNp linux-2.6.32.45/tools/gcc/Makefile linux-2.6.32.45/tools/gcc/Makefile --- linux-2.6.32.45/tools/gcc/Makefile 1969-12-31 19:00:00.000000000 -0500 +++ linux-2.6.32.45/tools/gcc/Makefile 2011-08-05 20:33:55.000000000 -0400 @@ -76731,6 +76634,7 @@ diff -urNp linux-2.6.32.45/tools/gcc/stackleak_plugin.c linux-2.6.32.45/tools/gc + + return 0; +} +Binary files linux-2.6.32.45/tools/gcc/stackleak_plugin.so and linux-2.6.32.45/tools/gcc/stackleak_plugin.so differ diff -urNp linux-2.6.32.45/usr/gen_init_cpio.c linux-2.6.32.45/usr/gen_init_cpio.c --- linux-2.6.32.45/usr/gen_init_cpio.c 2011-03-27 14:31:47.000000000 -0400 +++ linux-2.6.32.45/usr/gen_init_cpio.c 2011-04-17 15:56:46.000000000 -0400 diff --git a/3.0.3/0000_README b/3.0.3/0000_README index b76e6ac..b64e0c1 100644 --- a/3.0.3/0000_README +++ b/3.0.3/0000_README @@ -3,7 +3,7 @@ README Individual Patch Descriptions: ----------------------------------------------------------------------------- -Patch: 4420_grsecurity-2.2.2-3.0.3-201108251825.patch +Patch: 4420_grsecurity-2.2.2-3.0.3-201108262310.patch From: http://www.grsecurity.net Desc: hardened-sources base patch from upstream grsecurity diff --git a/3.0.3/4420_grsecurity-2.2.2-3.0.3-201108251825.patch b/3.0.3/4420_grsecurity-2.2.2-3.0.3-201108262310.patch index 04ec669..857914a 100644 --- a/3.0.3/4420_grsecurity-2.2.2-3.0.3-201108251825.patch +++ b/3.0.3/4420_grsecurity-2.2.2-3.0.3-201108262310.patch @@ -7340,7 +7340,7 @@ diff -urNp linux-3.0.3/arch/x86/include/asm/kprobes.h linux-3.0.3/arch/x86/inclu diff -urNp linux-3.0.3/arch/x86/include/asm/kvm_host.h linux-3.0.3/arch/x86/include/asm/kvm_host.h --- linux-3.0.3/arch/x86/include/asm/kvm_host.h 2011-07-21 22:17:23.000000000 -0400 -+++ linux-3.0.3/arch/x86/include/asm/kvm_host.h 2011-08-23 21:47:55.000000000 -0400 ++++ linux-3.0.3/arch/x86/include/asm/kvm_host.h 2011-08-26 19:49:56.000000000 -0400 @@ -441,7 +441,7 @@ struct kvm_arch { unsigned int n_used_mmu_pages; unsigned int n_requested_mmu_pages; @@ -7350,15 +7350,15 @@ diff -urNp linux-3.0.3/arch/x86/include/asm/kvm_host.h linux-3.0.3/arch/x86/incl struct hlist_head mmu_page_hash[KVM_NUM_MMU_PAGES]; /* * Hash table of struct kvm_mmu_page. -@@ -618,7 +618,7 @@ struct kvm_x86_ops { - struct x86_instruction_info *info, +@@ -619,7 +619,7 @@ struct kvm_x86_ops { enum x86_intercept_stage stage); -- const struct trace_print_flags *exit_reasons_str; -+ const struct trace_print_flags * const exit_reasons_str; - }; + const struct trace_print_flags *exit_reasons_str; +-}; ++} __do_const; struct kvm_arch_async_pf { + u32 token; diff -urNp linux-3.0.3/arch/x86/include/asm/local.h linux-3.0.3/arch/x86/include/asm/local.h --- linux-3.0.3/arch/x86/include/asm/local.h 2011-07-21 22:17:23.000000000 -0400 +++ linux-3.0.3/arch/x86/include/asm/local.h 2011-08-23 21:47:55.000000000 -0400 @@ -10718,7 +10718,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/cpu/common.c linux-3.0.3/arch/x86/kernel/ if (cpumask_test_and_set_cpu(cpu, cpu_initialized_mask)) { diff -urNp linux-3.0.3/arch/x86/kernel/cpu/intel.c linux-3.0.3/arch/x86/kernel/cpu/intel.c --- linux-3.0.3/arch/x86/kernel/cpu/intel.c 2011-08-23 21:44:40.000000000 -0400 -+++ linux-3.0.3/arch/x86/kernel/cpu/intel.c 2011-08-23 21:47:55.000000000 -0400 ++++ linux-3.0.3/arch/x86/kernel/cpu/intel.c 2011-08-26 19:49:56.000000000 -0400 @@ -172,7 +172,7 @@ static void __cpuinit trap_init_f00f_bug * Update the IDT descriptor and reload the IDT so that * it uses the read-only mapped virtual address. @@ -10728,6 +10728,15 @@ diff -urNp linux-3.0.3/arch/x86/kernel/cpu/intel.c linux-3.0.3/arch/x86/kernel/c load_idt(&idt_descr); } #endif +@@ -466,7 +466,7 @@ static void __cpuinit init_intel(struct + + rdmsrl(MSR_IA32_ENERGY_PERF_BIAS, epb); + if ((epb & 0xF) == 0) { +- printk_once(KERN_WARNING, "x86: updated energy_perf_bias" ++ printk_once(KERN_WARNING "x86: updated energy_perf_bias" + " to 'normal' from 'performance'\n" + "You can view and update epb via utility," + " such as x86_energy_perf_policy(8)\n"); diff -urNp linux-3.0.3/arch/x86/kernel/cpu/Makefile linux-3.0.3/arch/x86/kernel/cpu/Makefile --- linux-3.0.3/arch/x86/kernel/cpu/Makefile 2011-07-21 22:17:23.000000000 -0400 +++ linux-3.0.3/arch/x86/kernel/cpu/Makefile 2011-08-23 21:47:55.000000000 -0400 @@ -10874,18 +10883,16 @@ diff -urNp linux-3.0.3/arch/x86/kernel/cpu/mtrr/main.c linux-3.0.3/arch/x86/kern diff -urNp linux-3.0.3/arch/x86/kernel/cpu/mtrr/mtrr.h linux-3.0.3/arch/x86/kernel/cpu/mtrr/mtrr.h --- linux-3.0.3/arch/x86/kernel/cpu/mtrr/mtrr.h 2011-07-21 22:17:23.000000000 -0400 -+++ linux-3.0.3/arch/x86/kernel/cpu/mtrr/mtrr.h 2011-08-23 21:47:55.000000000 -0400 -@@ -12,8 +12,8 @@ - extern unsigned int mtrr_usage_table[MTRR_MAX_VAR_RANGES]; - - struct mtrr_ops { -- u32 vendor; -- u32 use_intel_if; -+ const u32 vendor; -+ const u32 use_intel_if; - void (*set)(unsigned int reg, unsigned long base, - unsigned long size, mtrr_type type); - void (*set_all)(void); ++++ linux-3.0.3/arch/x86/kernel/cpu/mtrr/mtrr.h 2011-08-26 19:49:56.000000000 -0400 +@@ -25,7 +25,7 @@ struct mtrr_ops { + int (*validate_add_page)(unsigned long base, unsigned long size, + unsigned int type); + int (*have_wrcomb)(void); +-}; ++} __do_const; + + extern int generic_get_free_region(unsigned long base, unsigned long size, + int replace_reg); diff -urNp linux-3.0.3/arch/x86/kernel/cpu/perf_event.c linux-3.0.3/arch/x86/kernel/cpu/perf_event.c --- linux-3.0.3/arch/x86/kernel/cpu/perf_event.c 2011-07-21 22:17:23.000000000 -0400 +++ linux-3.0.3/arch/x86/kernel/cpu/perf_event.c 2011-08-23 21:48:14.000000000 -0400 @@ -11739,7 +11746,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/entry_32.S linux-3.0.3/arch/x86/kernel/en CFI_ADJUST_CFA_OFFSET -24 diff -urNp linux-3.0.3/arch/x86/kernel/entry_64.S linux-3.0.3/arch/x86/kernel/entry_64.S --- linux-3.0.3/arch/x86/kernel/entry_64.S 2011-07-21 22:17:23.000000000 -0400 -+++ linux-3.0.3/arch/x86/kernel/entry_64.S 2011-08-25 17:38:59.000000000 -0400 ++++ linux-3.0.3/arch/x86/kernel/entry_64.S 2011-08-26 19:49:56.000000000 -0400 @@ -53,6 +53,7 @@ #include <asm/paravirt.h> #include <asm/ftrace.h> @@ -11748,7 +11755,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/entry_64.S linux-3.0.3/arch/x86/kernel/en /* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this. */ #include <linux/elf-em.h> -@@ -176,6 +177,262 @@ ENTRY(native_usergs_sysret64) +@@ -176,6 +177,264 @@ ENTRY(native_usergs_sysret64) ENDPROC(native_usergs_sysret64) #endif /* CONFIG_PARAVIRT */ @@ -11967,6 +11974,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/entry_64.S linux-3.0.3/arch/x86/kernel/en +ENTRY(pax_erase_kstack) + pushq %rdi + pushq %rax ++ pushq %r10 + + GET_THREAD_INFO(%r10) + mov TI_lowest_stack(%r10), %rdi @@ -12003,6 +12011,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/entry_64.S linux-3.0.3/arch/x86/kernel/en + sub $256, %rdi + mov %rdi, TI_lowest_stack(%r10) + ++ popq %r10 + popq %rax + popq %rdi + ret @@ -12011,7 +12020,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/entry_64.S linux-3.0.3/arch/x86/kernel/en .macro TRACE_IRQS_IRETQ offset=ARGOFFSET #ifdef CONFIG_TRACE_IRQFLAGS -@@ -318,7 +575,7 @@ ENTRY(save_args) +@@ -318,7 +577,7 @@ ENTRY(save_args) leaq -RBP+8(%rsp),%rdi /* arg1 for handler */ movq_cfi rbp, 8 /* push %rbp */ leaq 8(%rsp), %rbp /* mov %rsp, %ebp */ @@ -12020,7 +12029,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/entry_64.S linux-3.0.3/arch/x86/kernel/en je 1f SWAPGS /* -@@ -409,7 +666,7 @@ ENTRY(ret_from_fork) +@@ -409,7 +668,7 @@ ENTRY(ret_from_fork) RESTORE_REST @@ -12029,7 +12038,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/entry_64.S linux-3.0.3/arch/x86/kernel/en je int_ret_from_sys_call testl $_TIF_IA32, TI_flags(%rcx) # 32-bit compat task needs IRET -@@ -455,7 +712,7 @@ END(ret_from_fork) +@@ -455,7 +714,7 @@ END(ret_from_fork) ENTRY(system_call) CFI_STARTPROC simple CFI_SIGNAL_FRAME @@ -12038,7 +12047,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/entry_64.S linux-3.0.3/arch/x86/kernel/en CFI_REGISTER rip,rcx /*CFI_REGISTER rflags,r11*/ SWAPGS_UNSAFE_STACK -@@ -468,12 +725,13 @@ ENTRY(system_call_after_swapgs) +@@ -468,12 +727,13 @@ ENTRY(system_call_after_swapgs) movq %rsp,PER_CPU_VAR(old_rsp) movq PER_CPU_VAR(kernel_stack),%rsp @@ -12053,7 +12062,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/entry_64.S linux-3.0.3/arch/x86/kernel/en movq %rax,ORIG_RAX-ARGOFFSET(%rsp) movq %rcx,RIP-ARGOFFSET(%rsp) CFI_REL_OFFSET rip,RIP-ARGOFFSET -@@ -502,6 +760,8 @@ sysret_check: +@@ -502,6 +762,8 @@ sysret_check: andl %edi,%edx jnz sysret_careful CFI_REMEMBER_STATE @@ -12062,7 +12071,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/entry_64.S linux-3.0.3/arch/x86/kernel/en /* * sysretq will re-enable interrupts: */ -@@ -560,6 +820,9 @@ auditsys: +@@ -560,6 +822,9 @@ auditsys: movq %rax,%rsi /* 2nd arg: syscall number */ movl $AUDIT_ARCH_X86_64,%edi /* 1st arg: audit arch */ call audit_syscall_entry @@ -12072,7 +12081,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/entry_64.S linux-3.0.3/arch/x86/kernel/en LOAD_ARGS 0 /* reload call-clobbered registers */ jmp system_call_fastpath -@@ -590,6 +853,9 @@ tracesys: +@@ -590,6 +855,9 @@ tracesys: FIXUP_TOP_OF_STACK %rdi movq %rsp,%rdi call syscall_trace_enter @@ -12082,7 +12091,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/entry_64.S linux-3.0.3/arch/x86/kernel/en /* * Reload arg registers from stack in case ptrace changed them. * We don't reload %rax because syscall_trace_enter() returned -@@ -611,7 +877,7 @@ tracesys: +@@ -611,7 +879,7 @@ tracesys: GLOBAL(int_ret_from_sys_call) DISABLE_INTERRUPTS(CLBR_NONE) TRACE_IRQS_OFF @@ -12091,7 +12100,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/entry_64.S linux-3.0.3/arch/x86/kernel/en je retint_restore_args movl $_TIF_ALLWORK_MASK,%edi /* edi: mask to check */ -@@ -793,6 +1059,16 @@ END(interrupt) +@@ -793,6 +1061,16 @@ END(interrupt) CFI_ADJUST_CFA_OFFSET ORIG_RAX-RBP call save_args PARTIAL_FRAME 0 @@ -12108,7 +12117,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/entry_64.S linux-3.0.3/arch/x86/kernel/en call \func .endm -@@ -825,7 +1101,7 @@ ret_from_intr: +@@ -825,7 +1103,7 @@ ret_from_intr: CFI_ADJUST_CFA_OFFSET -8 exit_intr: GET_THREAD_INFO(%rcx) @@ -12117,7 +12126,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/entry_64.S linux-3.0.3/arch/x86/kernel/en je retint_kernel /* Interrupt came from user space */ -@@ -847,12 +1123,15 @@ retint_swapgs: /* return to user-space +@@ -847,12 +1125,15 @@ retint_swapgs: /* return to user-space * The iretq could re-enable interrupts: */ DISABLE_INTERRUPTS(CLBR_ANY) @@ -12133,7 +12142,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/entry_64.S linux-3.0.3/arch/x86/kernel/en /* * The iretq could re-enable interrupts: */ -@@ -1027,6 +1306,16 @@ ENTRY(\sym) +@@ -1027,6 +1308,16 @@ ENTRY(\sym) CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15 call error_entry DEFAULT_FRAME 0 @@ -12150,7 +12159,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/entry_64.S linux-3.0.3/arch/x86/kernel/en movq %rsp,%rdi /* pt_regs pointer */ xorl %esi,%esi /* no error code */ call \do_sym -@@ -1044,6 +1333,16 @@ ENTRY(\sym) +@@ -1044,6 +1335,16 @@ ENTRY(\sym) CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15 call save_paranoid TRACE_IRQS_OFF @@ -12167,7 +12176,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/entry_64.S linux-3.0.3/arch/x86/kernel/en movq %rsp,%rdi /* pt_regs pointer */ xorl %esi,%esi /* no error code */ call \do_sym -@@ -1052,7 +1351,7 @@ ENTRY(\sym) +@@ -1052,7 +1353,7 @@ ENTRY(\sym) END(\sym) .endm @@ -12176,7 +12185,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/entry_64.S linux-3.0.3/arch/x86/kernel/en .macro paranoidzeroentry_ist sym do_sym ist ENTRY(\sym) INTR_FRAME -@@ -1062,8 +1361,24 @@ ENTRY(\sym) +@@ -1062,8 +1363,24 @@ ENTRY(\sym) CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15 call save_paranoid TRACE_IRQS_OFF @@ -12201,7 +12210,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/entry_64.S linux-3.0.3/arch/x86/kernel/en subq $EXCEPTION_STKSZ, INIT_TSS_IST(\ist) call \do_sym addq $EXCEPTION_STKSZ, INIT_TSS_IST(\ist) -@@ -1080,6 +1395,16 @@ ENTRY(\sym) +@@ -1080,6 +1397,16 @@ ENTRY(\sym) CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15 call error_entry DEFAULT_FRAME 0 @@ -12218,7 +12227,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/entry_64.S linux-3.0.3/arch/x86/kernel/en movq %rsp,%rdi /* pt_regs pointer */ movq ORIG_RAX(%rsp),%rsi /* get error code */ movq $-1,ORIG_RAX(%rsp) /* no syscall to restart */ -@@ -1099,6 +1424,16 @@ ENTRY(\sym) +@@ -1099,6 +1426,16 @@ ENTRY(\sym) call save_paranoid DEFAULT_FRAME 0 TRACE_IRQS_OFF @@ -12235,7 +12244,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/entry_64.S linux-3.0.3/arch/x86/kernel/en movq %rsp,%rdi /* pt_regs pointer */ movq ORIG_RAX(%rsp),%rsi /* get error code */ movq $-1,ORIG_RAX(%rsp) /* no syscall to restart */ -@@ -1361,14 +1696,27 @@ ENTRY(paranoid_exit) +@@ -1361,14 +1698,27 @@ ENTRY(paranoid_exit) TRACE_IRQS_OFF testl %ebx,%ebx /* swapgs needed? */ jnz paranoid_restore @@ -12264,7 +12273,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/entry_64.S linux-3.0.3/arch/x86/kernel/en TRACE_IRQS_IRETQ 0 RESTORE_ALL 8 jmp irq_return -@@ -1426,7 +1774,7 @@ ENTRY(error_entry) +@@ -1426,7 +1776,7 @@ ENTRY(error_entry) movq_cfi r14, R14+8 movq_cfi r15, R15+8 xorl %ebx,%ebx @@ -12273,7 +12282,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/entry_64.S linux-3.0.3/arch/x86/kernel/en je error_kernelspace error_swapgs: SWAPGS -@@ -1490,6 +1838,16 @@ ENTRY(nmi) +@@ -1490,6 +1840,16 @@ ENTRY(nmi) CFI_ADJUST_CFA_OFFSET ORIG_RAX-R15 call save_paranoid DEFAULT_FRAME 0 @@ -12290,7 +12299,7 @@ diff -urNp linux-3.0.3/arch/x86/kernel/entry_64.S linux-3.0.3/arch/x86/kernel/en /* paranoidentry do_nmi, 0; without TRACE_IRQS_OFF */ movq %rsp,%rdi movq $-1,%rsi -@@ -1500,11 +1858,25 @@ ENTRY(nmi) +@@ -1500,11 +1860,25 @@ ENTRY(nmi) DISABLE_INTERRUPTS(CLBR_NONE) testl %ebx,%ebx /* swapgs needed? */ jnz nmi_restore @@ -24747,7 +24756,16 @@ diff -urNp linux-3.0.3/drivers/gpu/drm/mga/mga_irq.c linux-3.0.3/drivers/gpu/drm *sequence = cur_fence; diff -urNp linux-3.0.3/drivers/gpu/drm/nouveau/nouveau_bios.c linux-3.0.3/drivers/gpu/drm/nouveau/nouveau_bios.c --- linux-3.0.3/drivers/gpu/drm/nouveau/nouveau_bios.c 2011-07-21 22:17:23.000000000 -0400 -+++ linux-3.0.3/drivers/gpu/drm/nouveau/nouveau_bios.c 2011-08-23 21:47:55.000000000 -0400 ++++ linux-3.0.3/drivers/gpu/drm/nouveau/nouveau_bios.c 2011-08-26 19:49:56.000000000 -0400 +@@ -200,7 +200,7 @@ struct methods { + const char desc[8]; + void (*loadbios)(struct drm_device *, uint8_t *); + const bool rw; +-}; ++} __do_const; + + static struct methods shadow_methods[] = { + { "PRAMIN", load_vbios_pramin, true }, @@ -5488,7 +5488,7 @@ parse_bit_displayport_tbl_entry(struct d struct bit_table { const char id; @@ -51523,16 +51541,16 @@ diff -urNp linux-3.0.3/include/linux/binfmts.h linux-3.0.3/include/linux/binfmts diff -urNp linux-3.0.3/include/linux/blkdev.h linux-3.0.3/include/linux/blkdev.h --- linux-3.0.3/include/linux/blkdev.h 2011-07-21 22:17:23.000000000 -0400 -+++ linux-3.0.3/include/linux/blkdev.h 2011-08-23 21:47:56.000000000 -0400 -@@ -1307,7 +1307,7 @@ struct block_device_operations { - int (*getgeo)(struct block_device *, struct hd_geometry *); ++++ linux-3.0.3/include/linux/blkdev.h 2011-08-26 19:49:56.000000000 -0400 +@@ -1308,7 +1308,7 @@ struct block_device_operations { /* this callback is with swap_lock and sometimes page table lock held */ void (*swap_slot_free_notify) (struct block_device *, unsigned long); -- struct module *owner; -+ struct module * const owner; - }; + struct module *owner; +-}; ++} __do_const; extern int __blkdev_driver_ioctl(struct block_device *, fmode_t, unsigned int, + unsigned long); diff -urNp linux-3.0.3/include/linux/blktrace_api.h linux-3.0.3/include/linux/blktrace_api.h --- linux-3.0.3/include/linux/blktrace_api.h 2011-07-21 22:17:23.000000000 -0400 +++ linux-3.0.3/include/linux/blktrace_api.h 2011-08-23 21:47:56.000000000 -0400 @@ -51653,18 +51671,21 @@ diff -urNp linux-3.0.3/include/linux/cleancache.h linux-3.0.3/include/linux/clea cleancache_register_ops(struct cleancache_ops *ops); diff -urNp linux-3.0.3/include/linux/compiler-gcc4.h linux-3.0.3/include/linux/compiler-gcc4.h --- linux-3.0.3/include/linux/compiler-gcc4.h 2011-07-21 22:17:23.000000000 -0400 -+++ linux-3.0.3/include/linux/compiler-gcc4.h 2011-08-23 21:47:56.000000000 -0400 -@@ -31,6 +31,9 @@ ++++ linux-3.0.3/include/linux/compiler-gcc4.h 2011-08-26 19:49:56.000000000 -0400 +@@ -31,6 +31,12 @@ #if __GNUC_MINOR__ >= 5 + ++#ifdef CONSTIFY_PLUGIN +#define __no_const __attribute__((no_const)) ++#define __do_const __attribute__((do_const)) ++#endif + /* * Mark a position in code as unreachable. This can be used to * suppress control flow warnings after asm blocks that transfer -@@ -46,6 +49,11 @@ +@@ -46,6 +52,11 @@ #define __noclone __attribute__((__noclone__)) #endif @@ -51678,8 +51699,8 @@ diff -urNp linux-3.0.3/include/linux/compiler-gcc4.h linux-3.0.3/include/linux/c #if __GNUC_MINOR__ > 0 diff -urNp linux-3.0.3/include/linux/compiler.h linux-3.0.3/include/linux/compiler.h --- linux-3.0.3/include/linux/compiler.h 2011-07-21 22:17:23.000000000 -0400 -+++ linux-3.0.3/include/linux/compiler.h 2011-08-23 21:47:56.000000000 -0400 -@@ -264,6 +264,10 @@ void ftrace_likely_update(struct ftrace_ ++++ linux-3.0.3/include/linux/compiler.h 2011-08-26 19:49:56.000000000 -0400 +@@ -264,6 +264,14 @@ void ftrace_likely_update(struct ftrace_ # define __attribute_const__ /* unimplemented */ #endif @@ -51687,10 +51708,14 @@ diff -urNp linux-3.0.3/include/linux/compiler.h linux-3.0.3/include/linux/compil +# define __no_const +#endif + ++#ifndef __do_const ++# define __do_const ++#endif ++ /* * Tell gcc if a function is cold. The compiler will assume any path * directly leading to the call is unlikely. -@@ -273,6 +277,22 @@ void ftrace_likely_update(struct ftrace_ +@@ -273,6 +281,22 @@ void ftrace_likely_update(struct ftrace_ #define __cold #endif @@ -51713,7 +51738,7 @@ diff -urNp linux-3.0.3/include/linux/compiler.h linux-3.0.3/include/linux/compil /* Simple shorthand for a section definition */ #ifndef __section # define __section(S) __attribute__ ((__section__(#S))) -@@ -306,6 +326,7 @@ void ftrace_likely_update(struct ftrace_ +@@ -306,6 +330,7 @@ void ftrace_likely_update(struct ftrace_ * use is to mediate communication between process-level code and irq/NMI * handlers, all running on the same CPU. */ @@ -51776,16 +51801,16 @@ diff -urNp linux-3.0.3/include/linux/decompress/mm.h linux-3.0.3/include/linux/d #define large_malloc(a) vmalloc(a) diff -urNp linux-3.0.3/include/linux/dma-mapping.h linux-3.0.3/include/linux/dma-mapping.h --- linux-3.0.3/include/linux/dma-mapping.h 2011-07-21 22:17:23.000000000 -0400 -+++ linux-3.0.3/include/linux/dma-mapping.h 2011-08-23 21:47:56.000000000 -0400 -@@ -49,7 +49,7 @@ struct dma_map_ops { - int (*mapping_error)(struct device *dev, dma_addr_t dma_addr); ++++ linux-3.0.3/include/linux/dma-mapping.h 2011-08-26 19:49:56.000000000 -0400 +@@ -50,7 +50,7 @@ struct dma_map_ops { int (*dma_supported)(struct device *dev, u64 mask); int (*set_dma_mask)(struct device *dev, u64 mask); -- int is_phys; -+ const int is_phys; - }; + int is_phys; +-}; ++} __do_const; #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1)) + diff -urNp linux-3.0.3/include/linux/efi.h linux-3.0.3/include/linux/efi.h --- linux-3.0.3/include/linux/efi.h 2011-07-21 22:17:23.000000000 -0400 +++ linux-3.0.3/include/linux/efi.h 2011-08-23 21:47:56.000000000 -0400 @@ -51908,7 +51933,7 @@ diff -urNp linux-3.0.3/include/linux/fscache-cache.h linux-3.0.3/include/linux/f INIT_LIST_HEAD(&op->pend_link); diff -urNp linux-3.0.3/include/linux/fs.h linux-3.0.3/include/linux/fs.h --- linux-3.0.3/include/linux/fs.h 2011-07-21 22:17:23.000000000 -0400 -+++ linux-3.0.3/include/linux/fs.h 2011-08-23 21:48:14.000000000 -0400 ++++ linux-3.0.3/include/linux/fs.h 2011-08-26 19:49:56.000000000 -0400 @@ -109,6 +109,11 @@ struct inodes_stat_t { /* File was opened by fanotify and shouldn't generate fanotify events */ #define FMODE_NONOTIFY ((__force fmode_t)0x1000000) @@ -51921,19 +51946,12 @@ diff -urNp linux-3.0.3/include/linux/fs.h linux-3.0.3/include/linux/fs.h /* * The below are the various read and write types that we support. Some of * them include behavioral modifiers that send information down to the -@@ -1544,7 +1549,7 @@ struct block_device_operations; - * the big kernel lock held in all filesystems. - */ - struct file_operations { -- struct module *owner; -+ struct module * const owner; - loff_t (*llseek) (struct file *, loff_t, int); - ssize_t (*read) (struct file *, char __user *, size_t, loff_t *); - ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); -@@ -1572,6 +1577,7 @@ struct file_operations { +@@ -1571,7 +1576,8 @@ struct file_operations { + int (*setlease)(struct file *, long, struct file_lock **); long (*fallocate)(struct file *file, int mode, loff_t offset, loff_t len); - }; +-}; ++} __do_const; +typedef struct file_operations __no_const file_operations_no_const; #define IPERM_FLAG_RCU 0x0001 @@ -53232,7 +53250,7 @@ diff -urNp linux-3.0.3/include/linux/kallsyms.h linux-3.0.3/include/linux/kallsy static void __check_printsym_format(const char *fmt, ...) diff -urNp linux-3.0.3/include/linux/kgdb.h linux-3.0.3/include/linux/kgdb.h --- linux-3.0.3/include/linux/kgdb.h 2011-07-21 22:17:23.000000000 -0400 -+++ linux-3.0.3/include/linux/kgdb.h 2011-08-23 21:47:56.000000000 -0400 ++++ linux-3.0.3/include/linux/kgdb.h 2011-08-26 19:49:56.000000000 -0400 @@ -53,7 +53,7 @@ extern int kgdb_connected; extern int kgdb_io_module_registered; @@ -53242,34 +53260,24 @@ diff -urNp linux-3.0.3/include/linux/kgdb.h linux-3.0.3/include/linux/kgdb.h extern struct task_struct *kgdb_usethread; extern struct task_struct *kgdb_contthread; -@@ -241,8 +241,8 @@ extern void kgdb_arch_late(void); - * hardware debug registers. - */ - struct kgdb_arch { -- unsigned char gdb_bpt_instr[BREAK_INSTR_SIZE]; -- unsigned long flags; -+ const unsigned char gdb_bpt_instr[BREAK_INSTR_SIZE]; -+ const unsigned long flags; - - int (*set_breakpoint)(unsigned long, char *); - int (*remove_breakpoint)(unsigned long, char *); -@@ -268,14 +268,14 @@ struct kgdb_arch { - * not a console - */ - struct kgdb_io { -- const char *name; -+ const char * const name; - int (*read_char) (void); - void (*write_char) (u8); - void (*flush) (void); - int (*init) (void); +@@ -251,7 +251,7 @@ struct kgdb_arch { + void (*disable_hw_break)(struct pt_regs *regs); + void (*remove_all_hw_break)(void); + void (*correct_hw_break)(void); +-}; ++} __do_const; + + /** + * struct kgdb_io - Describe the interface for an I/O driver to talk with KGDB. +@@ -276,7 +276,7 @@ struct kgdb_io { void (*pre_exception) (void); void (*post_exception) (void); -- int is_console; -+ const int is_console; - }; + int is_console; +-}; ++} __do_const; extern struct kgdb_arch arch_kgdb_ops; + diff -urNp linux-3.0.3/include/linux/kmod.h linux-3.0.3/include/linux/kmod.h --- linux-3.0.3/include/linux/kmod.h 2011-07-21 22:17:23.000000000 -0400 +++ linux-3.0.3/include/linux/kmod.h 2011-08-23 21:48:14.000000000 -0400 @@ -53305,16 +53313,16 @@ diff -urNp linux-3.0.3/include/linux/kvm_host.h linux-3.0.3/include/linux/kvm_ho int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu); diff -urNp linux-3.0.3/include/linux/libata.h linux-3.0.3/include/linux/libata.h --- linux-3.0.3/include/linux/libata.h 2011-07-21 22:17:23.000000000 -0400 -+++ linux-3.0.3/include/linux/libata.h 2011-08-23 21:47:56.000000000 -0400 -@@ -898,7 +898,7 @@ struct ata_port_operations { - * ->inherits must be the last field and all the preceding ++++ linux-3.0.3/include/linux/libata.h 2011-08-26 19:49:56.000000000 -0400 +@@ -899,7 +899,7 @@ struct ata_port_operations { * fields must be pointers. */ -- const struct ata_port_operations *inherits; -+ const struct ata_port_operations * const inherits; - }; + const struct ata_port_operations *inherits; +-}; ++} __do_const; struct ata_port_info { + unsigned long flags; diff -urNp linux-3.0.3/include/linux/mca.h linux-3.0.3/include/linux/mca.h --- linux-3.0.3/include/linux/mca.h 2011-07-21 22:17:23.000000000 -0400 +++ linux-3.0.3/include/linux/mca.h 2011-08-23 21:47:56.000000000 -0400 @@ -55082,8 +55090,8 @@ diff -urNp linux-3.0.3/include/net/lapb.h linux-3.0.3/include/net/lapb.h struct lapb_frame frmr_data; diff -urNp linux-3.0.3/include/net/neighbour.h linux-3.0.3/include/net/neighbour.h --- linux-3.0.3/include/net/neighbour.h 2011-07-21 22:17:23.000000000 -0400 -+++ linux-3.0.3/include/net/neighbour.h 2011-08-23 21:47:56.000000000 -0400 -@@ -117,7 +117,7 @@ struct neighbour { ++++ linux-3.0.3/include/net/neighbour.h 2011-08-26 19:49:56.000000000 -0400 +@@ -117,14 +117,14 @@ struct neighbour { }; struct neigh_ops { @@ -55092,6 +55100,14 @@ diff -urNp linux-3.0.3/include/net/neighbour.h linux-3.0.3/include/net/neighbour void (*solicit)(struct neighbour *, struct sk_buff*); void (*error_report)(struct neighbour *, struct sk_buff*); int (*output)(struct sk_buff*); + int (*connected_output)(struct sk_buff*); + int (*hh_output)(struct sk_buff*); + int (*queue_xmit)(struct sk_buff*); +-}; ++} __do_const; + + struct pneigh_entry { + struct pneigh_entry *next; diff -urNp linux-3.0.3/include/net/netlink.h linux-3.0.3/include/net/netlink.h --- linux-3.0.3/include/net/netlink.h 2011-07-21 22:17:23.000000000 -0400 +++ linux-3.0.3/include/net/netlink.h 2011-08-23 21:47:56.000000000 -0400 @@ -55245,83 +55261,16 @@ diff -urNp linux-3.0.3/include/scsi/scsi_device.h linux-3.0.3/include/scsi/scsi_ sdev_dev; diff -urNp linux-3.0.3/include/scsi/scsi_transport_fc.h linux-3.0.3/include/scsi/scsi_transport_fc.h --- linux-3.0.3/include/scsi/scsi_transport_fc.h 2011-07-21 22:17:23.000000000 -0400 -+++ linux-3.0.3/include/scsi/scsi_transport_fc.h 2011-08-23 21:47:56.000000000 -0400 -@@ -666,9 +666,9 @@ struct fc_function_template { - int (*bsg_timeout)(struct fc_bsg_job *); - - /* allocation lengths for host-specific data */ -- u32 dd_fcrport_size; -- u32 dd_fcvport_size; -- u32 dd_bsg_size; -+ const u32 dd_fcrport_size; -+ const u32 dd_fcvport_size; -+ const u32 dd_bsg_size; - - /* - * The driver sets these to tell the transport class it -@@ -678,39 +678,39 @@ struct fc_function_template { - */ ++++ linux-3.0.3/include/scsi/scsi_transport_fc.h 2011-08-26 19:49:56.000000000 -0400 +@@ -711,7 +711,7 @@ struct fc_function_template { + unsigned long show_host_system_hostname:1; - /* remote port fixed attributes */ -- unsigned long show_rport_maxframe_size:1; -- unsigned long show_rport_supported_classes:1; -- unsigned long show_rport_dev_loss_tmo:1; -+ const unsigned long show_rport_maxframe_size:1; -+ const unsigned long show_rport_supported_classes:1; -+ const unsigned long show_rport_dev_loss_tmo:1; - - /* - * target dynamic attributes - * These should all be "1" if the driver uses the remote port - * add/delete functions (so attributes reflect rport values). - */ -- unsigned long show_starget_node_name:1; -- unsigned long show_starget_port_name:1; -- unsigned long show_starget_port_id:1; -+ const unsigned long show_starget_node_name:1; -+ const unsigned long show_starget_port_name:1; -+ const unsigned long show_starget_port_id:1; - - /* host fixed attributes */ -- unsigned long show_host_node_name:1; -- unsigned long show_host_port_name:1; -- unsigned long show_host_permanent_port_name:1; -- unsigned long show_host_supported_classes:1; -- unsigned long show_host_supported_fc4s:1; -- unsigned long show_host_supported_speeds:1; -- unsigned long show_host_maxframe_size:1; -- unsigned long show_host_serial_number:1; -+ const unsigned long show_host_node_name:1; -+ const unsigned long show_host_port_name:1; -+ const unsigned long show_host_permanent_port_name:1; -+ const unsigned long show_host_supported_classes:1; -+ const unsigned long show_host_supported_fc4s:1; -+ const unsigned long show_host_supported_speeds:1; -+ const unsigned long show_host_maxframe_size:1; -+ const unsigned long show_host_serial_number:1; - /* host dynamic attributes */ -- unsigned long show_host_port_id:1; -- unsigned long show_host_port_type:1; -- unsigned long show_host_port_state:1; -- unsigned long show_host_active_fc4s:1; -- unsigned long show_host_speed:1; -- unsigned long show_host_fabric_name:1; -- unsigned long show_host_symbolic_name:1; -- unsigned long show_host_system_hostname:1; -+ const unsigned long show_host_port_id:1; -+ const unsigned long show_host_port_type:1; -+ const unsigned long show_host_port_state:1; -+ const unsigned long show_host_active_fc4s:1; -+ const unsigned long show_host_speed:1; -+ const unsigned long show_host_fabric_name:1; -+ const unsigned long show_host_symbolic_name:1; -+ const unsigned long show_host_system_hostname:1; - -- unsigned long disable_target_scan:1; -+ const unsigned long disable_target_scan:1; - }; + unsigned long disable_target_scan:1; +-}; ++} __do_const; + /** diff -urNp linux-3.0.3/include/sound/ak4xxx-adda.h linux-3.0.3/include/sound/ak4xxx-adda.h --- linux-3.0.3/include/sound/ak4xxx-adda.h 2011-07-21 22:17:23.000000000 -0400 +++ linux-3.0.3/include/sound/ak4xxx-adda.h 2011-08-23 21:47:56.000000000 -0400 @@ -55383,16 +55332,16 @@ diff -urNp linux-3.0.3/include/sound/sb16_csp.h linux-3.0.3/include/sound/sb16_c * CSP private data diff -urNp linux-3.0.3/include/sound/soc.h linux-3.0.3/include/sound/soc.h --- linux-3.0.3/include/sound/soc.h 2011-07-21 22:17:23.000000000 -0400 -+++ linux-3.0.3/include/sound/soc.h 2011-08-23 21:47:56.000000000 -0400 -@@ -635,7 +635,7 @@ struct snd_soc_platform_driver { - struct snd_soc_dai *); ++++ linux-3.0.3/include/sound/soc.h 2011-08-26 19:49:56.000000000 -0400 +@@ -636,7 +636,7 @@ struct snd_soc_platform_driver { /* platform stream ops */ -- struct snd_pcm_ops *ops; -+ struct snd_pcm_ops * const ops; - }; + struct snd_pcm_ops *ops; +-}; ++} __do_const; struct snd_soc_platform { + const char *name; diff -urNp linux-3.0.3/include/sound/ymfpci.h linux-3.0.3/include/sound/ymfpci.h --- linux-3.0.3/include/sound/ymfpci.h 2011-07-21 22:17:23.000000000 -0400 +++ linux-3.0.3/include/sound/ymfpci.h 2011-08-23 21:47:56.000000000 -0400 @@ -60487,7 +60436,7 @@ diff -urNp linux-3.0.3/localversion-grsec linux-3.0.3/localversion-grsec +-grsec diff -urNp linux-3.0.3/Makefile linux-3.0.3/Makefile --- linux-3.0.3/Makefile 2011-08-23 21:44:40.000000000 -0400 -+++ linux-3.0.3/Makefile 2011-08-24 18:10:12.000000000 -0400 ++++ linux-3.0.3/Makefile 2011-08-26 22:52:37.000000000 -0400 @@ -245,8 +245,9 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" HOSTCC = gcc @@ -60513,26 +60462,12 @@ diff -urNp linux-3.0.3/Makefile linux-3.0.3/Makefile KBUILD_AFLAGS_KERNEL := KBUILD_CFLAGS_KERNEL := KBUILD_AFLAGS := -D__ASSEMBLY__ -@@ -407,10 +410,11 @@ export RCS_TAR_IGNORE := --exclude SCCS - # Rules shared between *config targets and build targets - - # Basic helpers built in scripts/ --PHONY += scripts_basic --scripts_basic: -+PHONY += scripts_basic0 scripts_basic gcc-plugins -+scripts_basic0: - $(Q)$(MAKE) $(build)=scripts/basic - $(Q)rm -f .tmp_quiet_recordmcount -+scripts_basic: scripts_basic0 gcc-plugins - - # To avoid any implicit rule to kick in, define an empty command. - scripts/basic/%: scripts_basic ; -@@ -564,6 +568,24 @@ else +@@ -564,6 +567,24 @@ else KBUILD_CFLAGS += -O2 endif +ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-plugin.sh $(HOSTCC)), y) -+CONSTIFY_PLUGIN := -fplugin=$(objtree)/tools/gcc/constify_plugin.so ++CONSTIFY_PLUGIN := -fplugin=$(objtree)/tools/gcc/constify_plugin.so -DCONSTIFY_PLUGIN +ifdef CONFIG_PAX_MEMORY_STACKLEAK +STACKLEAK_PLUGIN := -fplugin=$(objtree)/tools/gcc/stackleak_plugin.so -fplugin-arg-stackleak_plugin-track-lowest-sp=100 +endif @@ -60552,7 +60487,7 @@ diff -urNp linux-3.0.3/Makefile linux-3.0.3/Makefile include $(srctree)/arch/$(SRCARCH)/Makefile ifneq ($(CONFIG_FRAME_WARN),0) -@@ -708,7 +730,7 @@ export mod_strip_cmd +@@ -708,7 +729,7 @@ export mod_strip_cmd ifeq ($(KBUILD_EXTMOD),) @@ -60561,7 +60496,7 @@ diff -urNp linux-3.0.3/Makefile linux-3.0.3/Makefile vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \ $(core-y) $(core-m) $(drivers-y) $(drivers-m) \ -@@ -907,6 +929,7 @@ define rule_vmlinux-modpost +@@ -907,6 +928,7 @@ define rule_vmlinux-modpost endef # vmlinux image - including updated kernel symbols @@ -60569,7 +60504,7 @@ diff -urNp linux-3.0.3/Makefile linux-3.0.3/Makefile vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o $(kallsyms.o) FORCE ifdef CONFIG_HEADERS_CHECK $(Q)$(MAKE) -f $(srctree)/Makefile headers_check -@@ -973,7 +996,7 @@ ifneq ($(KBUILD_SRC),) +@@ -973,7 +995,7 @@ ifneq ($(KBUILD_SRC),) endif # prepare2 creates a makefile if using a separate output directory @@ -60578,7 +60513,7 @@ diff -urNp linux-3.0.3/Makefile linux-3.0.3/Makefile prepare1: prepare2 include/linux/version.h include/generated/utsrelease.h \ include/config/auto.conf -@@ -1087,6 +1110,7 @@ all: modules +@@ -1087,6 +1109,7 @@ all: modules # using awk while concatenating to the final file. PHONY += modules @@ -60586,15 +60521,14 @@ diff -urNp linux-3.0.3/Makefile linux-3.0.3/Makefile modules: $(vmlinux-dirs) $(if $(KBUILD_BUILTIN),vmlinux) modules.builtin $(Q)$(AWK) '!x[$$0]++' $(vmlinux-dirs:%=$(objtree)/%/modules.order) > $(objtree)/modules.order @$(kecho) ' Building modules, stage 2.'; -@@ -1198,7 +1222,7 @@ distclean: mrproper - @find $(srctree) $(RCS_FIND_IGNORE) \ - \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ - -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ -- -o -name '.*.rej' -o -size 0 \ -+ -o -name '.*.rej' -o -size 0 -o -name '*.so' \ - -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \ - -type f -print | xargs rm -f +@@ -1359,6 +1382,7 @@ PHONY += $(module-dirs) modules + $(module-dirs): crmodverdir $(objtree)/Module.symvers + $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@) ++modules: KBUILD_CFLAGS += $(CONSTIFY_PLUGIN) $(STACKLEAK_PLUGIN) + modules: $(module-dirs) + @$(kecho) ' Building modules, stage 2.'; + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost @@ -1404,7 +1428,7 @@ clean: $(clean-dirs) $(call cmd,rmdirs) $(call cmd,rmfiles) @@ -69694,8 +69628,8 @@ diff -urNp linux-3.0.3/sound/usb/card.h linux-3.0.3/sound/usb/card.h struct snd_usb_stream { diff -urNp linux-3.0.3/tools/gcc/constify_plugin.c linux-3.0.3/tools/gcc/constify_plugin.c --- linux-3.0.3/tools/gcc/constify_plugin.c 1969-12-31 19:00:00.000000000 -0500 -+++ linux-3.0.3/tools/gcc/constify_plugin.c 2011-08-24 18:13:06.000000000 -0400 -@@ -0,0 +1,259 @@ ++++ linux-3.0.3/tools/gcc/constify_plugin.c 2011-08-26 19:49:56.000000000 -0400 +@@ -0,0 +1,288 @@ +/* + * Copyright 2011 by Emese Revfy <re.emese@gmail.com> + * Licensed under the GPL v2, or (at your option) v3 @@ -69722,29 +69656,29 @@ diff -urNp linux-3.0.3/tools/gcc/constify_plugin.c linux-3.0.3/tools/gcc/constif +#include "plugin.h" +//#include "c-tree.h" + -+#define C_TYPE_FIELDS_READONLY(TYPE) TREE_LANG_FLAG_1 (TYPE) ++#define C_TYPE_FIELDS_READONLY(TYPE) TREE_LANG_FLAG_1(TYPE) + +int plugin_is_GPL_compatible; + +static struct plugin_info const_plugin_info = { -+ .version = "20110824", ++ .version = "20110826", + .help = "no-constify\tturn off constification\n", +}; + ++static void constify_type(tree type); +static bool walk_struct(tree node); + -+static void deconstify_node(tree type) ++static tree deconstify_type(tree old_type) +{ -+ tree field; ++ tree new_type, field; + -+ C_TYPE_FIELDS_READONLY(type) = 0; -+ for (field = TYPE_FIELDS(type); field; field = TREE_CHAIN(field)) { -+ enum tree_code code = TREE_CODE(TREE_TYPE(field)); -+ if (code == RECORD_TYPE || code == UNION_TYPE) -+ deconstify_node(TREE_TYPE(field)); -+ TREE_READONLY(field) = 0; -+ TYPE_READONLY(TREE_TYPE(field)) = 0; -+ } ++ new_type = build_qualified_type(old_type, TYPE_QUALS(old_type) & ~TYPE_QUAL_CONST); ++ TYPE_FIELDS(new_type) = copy_list(TYPE_FIELDS(new_type)); ++ for (field = TYPE_FIELDS(new_type); field; field = TREE_CHAIN(field)) ++ DECL_FIELD_CONTEXT(field) = new_type; ++ TYPE_READONLY(new_type) = 0; ++ C_TYPE_FIELDS_READONLY(new_type) = 0; ++ return new_type; +} + +static tree handle_no_const_attribute(tree *node, tree name, tree args, int flags, bool *no_add_attrs) @@ -69762,7 +69696,7 @@ diff -urNp linux-3.0.3/tools/gcc/constify_plugin.c linux-3.0.3/tools/gcc/constif + return NULL_TREE; + } + -+ if (!DECL_P(*node)) { ++ if (TYPE_P(*node)) { + if (TREE_CODE(*node) == RECORD_TYPE || TREE_CODE(*node) == UNION_TYPE) + *no_add_attrs = false; + else @@ -69777,7 +69711,7 @@ diff -urNp linux-3.0.3/tools/gcc/constify_plugin.c linux-3.0.3/tools/gcc/constif + return NULL_TREE; + } + -+ if (lookup_attribute("no_const", TYPE_ATTRIBUTES(type))) { ++ if (lookup_attribute(IDENTIFIER_POINTER(name), TYPE_ATTRIBUTES(type))) { + error("%qE attribute is already applied to the type", name); + return NULL_TREE; + } @@ -69788,15 +69722,32 @@ diff -urNp linux-3.0.3/tools/gcc/constify_plugin.c linux-3.0.3/tools/gcc/constif + } + + if (TREE_CODE(*node) == TYPE_DECL) { -+ TREE_TYPE(*node) = build_qualified_type(type, TYPE_QUALS(type) & ~TYPE_QUAL_CONST); -+ TYPE_FIELDS(TREE_TYPE(*node)) = copy_list(TYPE_FIELDS(TREE_TYPE(*node))); -+ deconstify_node(TREE_TYPE(*node)); ++ TREE_TYPE(*node) = deconstify_type(type); ++ TREE_READONLY(*node) = 0; + return NULL_TREE; + } + + return NULL_TREE; +} + ++static tree handle_do_const_attribute(tree *node, tree name, tree args, int flags, bool *no_add_attrs) ++{ ++ *no_add_attrs = true; ++ if (!TYPE_P(*node)) { ++ error("%qE attribute applies to types only", name); ++ return NULL_TREE; ++ } ++ ++ if (TREE_CODE(*node) != RECORD_TYPE && TREE_CODE(*node) != UNION_TYPE) { ++ error("%qE attribute applies to struct and union types only", name); ++ return NULL_TREE; ++ } ++ ++ *no_add_attrs = false; ++ constify_type(*node); ++ return NULL_TREE; ++} ++ +static struct attribute_spec no_const_attr = { + .name = "no_const", + .min_length = 0, @@ -69807,14 +69758,26 @@ diff -urNp linux-3.0.3/tools/gcc/constify_plugin.c linux-3.0.3/tools/gcc/constif + .handler = handle_no_const_attribute +}; + ++static struct attribute_spec do_const_attr = { ++ .name = "do_const", ++ .min_length = 0, ++ .max_length = 0, ++ .decl_required = false, ++ .type_required = false, ++ .function_type_required = false, ++ .handler = handle_do_const_attribute ++}; ++ +static void register_attributes(void *event_data, void *data) +{ + register_attribute(&no_const_attr); ++ register_attribute(&do_const_attr); +} + -+static void constify_node(tree node) ++static void constify_type(tree type) +{ -+ TREE_READONLY(node) = 1; ++ TYPE_READONLY(type) = 1; ++ C_TYPE_FIELDS_READONLY(type) = 1; +} + +static bool is_fptr(tree field) @@ -69843,7 +69806,7 @@ diff -urNp linux-3.0.3/tools/gcc/constify_plugin.c linux-3.0.3/tools/gcc/constif + if (code == RECORD_TYPE || code == UNION_TYPE) { + if (!(walk_struct(type))) + return false; -+ } else if (is_fptr(field) == false && !TREE_READONLY(field)) ++ } else if (!is_fptr(field) && !TREE_READONLY(field)) + return false; + } + return true; @@ -69851,16 +69814,16 @@ diff -urNp linux-3.0.3/tools/gcc/constify_plugin.c linux-3.0.3/tools/gcc/constif + +static void finish_type(void *event_data, void *data) +{ -+ tree node = (tree)event_data; ++ tree type = (tree)event_data; + -+ if (node == NULL_TREE) ++ if (type == NULL_TREE) + return; + -+ if (TREE_READONLY(node)) ++ if (TYPE_READONLY(type)) + return; + -+ if (walk_struct(node)) -+ constify_node(node); ++ if (walk_struct(type)) ++ constify_type(type); +} + +static unsigned int check_local_variables(void); |