diff options
-rw-r--r-- | 4.8.15/0000_README | 2 | ||||
-rw-r--r-- | 4.8.15/4420_grsecurity-3.1-4.8.15-201701031913.patch (renamed from 4.8.15/4420_grsecurity-3.1-4.8.15-201612301949.patch) | 584 |
2 files changed, 380 insertions, 206 deletions
diff --git a/4.8.15/0000_README b/4.8.15/0000_README index 97a03a1..fed975b 100644 --- a/4.8.15/0000_README +++ b/4.8.15/0000_README @@ -2,7 +2,7 @@ README ----------------------------------------------------------------------------- Individual Patch Descriptions: ----------------------------------------------------------------------------- -Patch: 4420_grsecurity-3.1-4.8.15-201612301949.patch +Patch: 4420_grsecurity-3.1-4.8.15-201701031913.patch From: http://www.grsecurity.net Desc: hardened-sources base patch from upstream grsecurity diff --git a/4.8.15/4420_grsecurity-3.1-4.8.15-201612301949.patch b/4.8.15/4420_grsecurity-3.1-4.8.15-201701031913.patch index b16a42d..f7efab2 100644 --- a/4.8.15/4420_grsecurity-3.1-4.8.15-201612301949.patch +++ b/4.8.15/4420_grsecurity-3.1-4.8.15-201701031913.patch @@ -28736,7 +28736,7 @@ index 6f8902b..5d42150 100644 + .fill PAGE_SIZE_asm - GDT_SIZE,1,0 + .endr diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S -index 9f8efc9..e1942f9 100644 +index 9f8efc9..448c93f 100644 --- a/arch/x86/kernel/head_64.S +++ b/arch/x86/kernel/head_64.S @@ -20,6 +20,8 @@ @@ -28841,15 +28841,32 @@ index 9f8efc9..e1942f9 100644 1: wrmsr /* Make changes effective */ /* Setup cr0 */ -@@ -294,6 +342,7 @@ ENTRY(secondary_startup_64) +@@ -294,10 +342,10 @@ ENTRY(secondary_startup_64) * REX.W + FF /5 JMP m16:64 Jump far, absolute indirect, * address given in m16:64. */ +- movq initial_code(%rip),%rax + pax_set_fptr_mask - movq initial_code(%rip),%rax pushq $0 # fake return address to stop unwinder pushq $__KERNEL_CS # set correct cs -@@ -328,7 +377,7 @@ ENDPROC(start_cpu0) +- pushq %rax # target address in negative space ++ pushq initial_code(%rip) # target address in negative space + lretq + ENDPROC(secondary_startup_64) + +@@ -311,10 +359,9 @@ ENDPROC(secondary_startup_64) + */ + ENTRY(start_cpu0) + movq stack_start(%rip),%rsp +- movq initial_code(%rip),%rax + pushq $0 # fake return address to stop unwinder + pushq $__KERNEL_CS # set correct cs +- pushq %rax # target address in negative space ++ pushq initial_code(%rip) # target address in negative space + lretq + ENDPROC(start_cpu0) + #endif +@@ -328,7 +375,7 @@ ENDPROC(start_cpu0) .quad INIT_PER_CPU_VAR(irq_stack_union) GLOBAL(stack_start) @@ -28858,7 +28875,7 @@ index 9f8efc9..e1942f9 100644 .word 0 __FINITDATA -@@ -417,40 +466,70 @@ GLOBAL(name) +@@ -417,40 +464,70 @@ GLOBAL(name) __INITDATA NEXT_PAGE(early_level4_pgt) .fill 511,8,0 @@ -28941,7 +28958,7 @@ index 9f8efc9..e1942f9 100644 NEXT_PAGE(level2_kernel_pgt) /* -@@ -467,31 +546,79 @@ NEXT_PAGE(level2_kernel_pgt) +@@ -467,31 +544,79 @@ NEXT_PAGE(level2_kernel_pgt) KERNEL_IMAGE_SIZE/PMD_SIZE) NEXT_PAGE(level2_fixmap_pgt) @@ -50936,7 +50953,7 @@ index 56dd261..493d7e0 100644 packetlen_aligned = ALIGN(packetlen, sizeof(u64)); diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c -index a1c086b..b205fcb 100644 +index a1c086b..2001144 100644 --- a/drivers/hv/hv.c +++ b/drivers/hv/hv.c @@ -183,6 +183,7 @@ static struct clocksource hyperv_cs_tsc = { @@ -50967,7 +50984,7 @@ index a1c086b..b205fcb 100644 hypercall_msr.enable = 1; - hypercall_msr.guest_physical_address = vmalloc_to_pfn(virtaddr); -+ hypercall_msr.guest_physical_address = __phys_to_pfn(slow_virt_to_phys((ktla_ktva((unsigned long)hv_hypercall_page)))); ++ hypercall_msr.guest_physical_address = __phys_to_pfn(slow_virt_to_phys((void *)(ktla_ktva((unsigned long)hv_hypercall_page)))); wrmsrl(HV_X64_MSR_HYPERCALL, hypercall_msr.as_uint64); /* Confirm that hypercall page did get setup. */ @@ -62752,7 +62769,7 @@ index b03e4f5..78e4cc4 100644 spin_unlock_irqrestore(&pdata->tstamp_lock, flags); diff --git a/drivers/net/ethernet/amd/xgbe/xgbe.h b/drivers/net/ethernet/amd/xgbe/xgbe.h -index 98d9d63..3825a58 100644 +index 98d9d63..0433122 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe.h +++ b/drivers/net/ethernet/amd/xgbe/xgbe.h @@ -786,9 +786,9 @@ struct xgbe_prv_data { @@ -62762,9 +62779,9 @@ index 98d9d63..3825a58 100644 - struct xgbe_hw_if hw_if; - struct xgbe_phy_if phy_if; - struct xgbe_desc_if desc_if; -+ struct xgbe_hw_if *hw_if; -+ struct xgbe_phy_if *phy_if; -+ struct xgbe_desc_if *desc_if; ++ const struct xgbe_hw_if *hw_if; ++ const struct xgbe_phy_if *phy_if; ++ const struct xgbe_desc_if *desc_if; /* AXI DMA settings */ unsigned int coherent; @@ -125395,7 +125412,7 @@ index 0000000..fce7f71 +} diff --git a/grsecurity/gracl_ip.c b/grsecurity/gracl_ip.c new file mode 100644 -index 0000000..5da5304 +index 0000000..d877c38 --- /dev/null +++ b/grsecurity/gracl_ip.c @@ -0,0 +1,387 @@ @@ -125468,7 +125485,7 @@ index 0000000..5da5304 +static const char * gr_sockfamilies[AF_MAX] = { + "unspec", "unix", "inet", "ax25", "ipx", "appletalk", "netrom", "bridge", "atmpvc", "x25", + "inet6", "rose", "decnet", "netbeui", "security", "key", "netlink", "packet", "ash", -+ "econet", "atmsvc", "rds", "sna", "irda", "ppox", "wanpipe", "llc", "fam_27", "fam_28", ++ "econet", "atmsvc", "rds", "sna", "irda", "ppox", "wanpipe", "llc", "ib", "mpls", "can", + "tipc", "bluetooth", "iucv", "rxrpc", "isdn", "phonet", "ieee802154", "ciaf", "alg", + "nfc", "vsock", "kcm", "qipcrtr" + }; @@ -132113,7 +132130,7 @@ index b097cf8..3d40e14 100644 if (x == 0) return 0; diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h -index 6f96247..f6ae0d7 100644 +index 6f96247..ca27641 100644 --- a/include/asm-generic/bug.h +++ b/include/asm-generic/bug.h @@ -62,13 +62,13 @@ struct bug_entry { @@ -132141,6 +132158,15 @@ index 6f96247..f6ae0d7 100644 void __warn(const char *file, int line, void *caller, unsigned taint, struct pt_regs *regs, struct warn_args *args); +@@ -151,7 +152,7 @@ void __warn(const char *file, int line, void *caller, unsigned taint, + #endif + + #ifndef HAVE_ARCH_BUG_ON +-#define BUG_ON(condition) do { if (condition) BUG(); } while (0) ++#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while (0) + #endif + + #ifndef HAVE_ARCH_WARN_ON diff --git a/include/asm-generic/cache.h b/include/asm-generic/cache.h index 1bfcfe5..e04c5c9 100644 --- a/include/asm-generic/cache.h @@ -168707,12 +168733,12 @@ index 8b29dc1..ec1516e 100644 diff --git a/scripts/gcc-plugins/checker_plugin.c b/scripts/gcc-plugins/checker_plugin.c new file mode 100644 -index 0000000..2b3c178 +index 0000000..0cd5656 --- /dev/null +++ b/scripts/gcc-plugins/checker_plugin.c -@@ -0,0 +1,496 @@ +@@ -0,0 +1,491 @@ +/* -+ * Copyright 2011-2016 by the PaX Team <pageexec@freemail.hu> ++ * Copyright 2011-2017 by the PaX Team <pageexec@freemail.hu> + * Licensed under the GPL v2 + * + * Note: the choice of the license means that the compilation process is @@ -168942,7 +168968,7 @@ index 0000000..2b3c178 + TREE_THIS_VOLATILE(context_error_decl) = 1; + DECL_ASSEMBLER_NAME(context_error_decl); + -+ attr = tree_cons(NULL, build_string(14, "context error"), NULL); ++ attr = tree_cons(NULL, build_const_char_string(14, "context error"), NULL); + attr = tree_cons(get_identifier("error"), attr, NULL); + decl_attributes(&context_error_decl, attr, 0); +} @@ -169010,8 +169036,7 @@ index 0000000..2b3c178 + +// stmt = gimple_build_call(builtin_decl_implicit(BUILT_IN_TRAP), 0); + len = strlen(file) + 1; -+ filename = build_string(len, file); -+ TREE_TYPE(filename) = build_array_type(unsigned_char_type_node, build_index_type(size_int(len))); ++ filename = build_const_char_string(len, file); + filename = build1(ADDR_EXPR, const_ptr_type_node, filename); + stmt = gimple_build_call(error, 2, filename, build_int_cst(NULL_TREE, line)); + gimple_set_location(stmt, loc); @@ -169149,7 +169174,6 @@ index 0000000..2b3c178 + const struct plugin_argument * const argv = plugin_info->argv; + int i; + bool enable_user, enable_context; -+ struct register_pass_info context_pass_info; + + static const struct ggc_root_tab gt_ggc_r_gt_checker[] = { + { @@ -169169,11 +169193,8 @@ index 0000000..2b3c178 + LAST_GGC_ROOT_TAB + }; + -+ context_pass_info.pass = make_context_pass(); -+// context_pass_info.reference_pass_name = "ssa"; -+ context_pass_info.reference_pass_name = "phiprop"; -+ context_pass_info.ref_pass_instance_number = 1; -+ context_pass_info.pos_op = PASS_POS_INSERT_AFTER; ++// PASS_INFO(context, "ssa", 1, PASS_POS_INSERT_AFTER); ++ PASS_INFO(context, "phiprop", 1, PASS_POS_INSERT_AFTER); + + if (!plugin_default_version_check(version, &gcc_version)) { + error(G_("incompatible gcc/plugin versions")); @@ -169209,12 +169230,12 @@ index 0000000..2b3c178 +} diff --git a/scripts/gcc-plugins/colorize_plugin.c b/scripts/gcc-plugins/colorize_plugin.c new file mode 100644 -index 0000000..31fd196 +index 0000000..e6a0d72 --- /dev/null +++ b/scripts/gcc-plugins/colorize_plugin.c -@@ -0,0 +1,162 @@ +@@ -0,0 +1,158 @@ +/* -+ * Copyright 2012-2016 by PaX Team <pageexec@freemail.hu> ++ * Copyright 2012-2017 by PaX Team <pageexec@freemail.hu> + * Licensed under the GPL v2 + * + * Note: the choice of the license means that the compilation process is @@ -169332,13 +169353,9 @@ index 0000000..31fd196 + const int argc = plugin_info->argc; + const struct plugin_argument * const argv = plugin_info->argv; + int i; -+ struct register_pass_info colorize_rearm_pass_info; + bool colorize; + -+ colorize_rearm_pass_info.pass = make_colorize_rearm_pass(); -+ colorize_rearm_pass_info.reference_pass_name = "*free_lang_data"; -+ colorize_rearm_pass_info.ref_pass_instance_number = 1; -+ colorize_rearm_pass_info.pos_op = PASS_POS_INSERT_AFTER; ++ PASS_INFO(colorize_rearm, "*free_lang_data", 1, PASS_POS_INSERT_AFTER); + + if (!plugin_default_version_check(version, &gcc_version)) { + error(G_("incompatible gcc/plugin versions")); @@ -169377,13 +169394,13 @@ index 0000000..31fd196 +} diff --git a/scripts/gcc-plugins/constify_plugin.c b/scripts/gcc-plugins/constify_plugin.c new file mode 100644 -index 0000000..5287631c +index 0000000..e9051b5 --- /dev/null +++ b/scripts/gcc-plugins/constify_plugin.c -@@ -0,0 +1,582 @@ +@@ -0,0 +1,577 @@ +/* + * Copyright 2011 by Emese Revfy <re.emese@gmail.com> -+ * Copyright 2011-2016 by PaX Team <pageexec@freemail.hu> ++ * Copyright 2011-2017 by PaX Team <pageexec@freemail.hu> + * Licensed under the GPL v2, or (at your option) v3 + * + * This gcc plugin constifies all structures which contain only function pointers or are explicitly marked for constification. @@ -169927,12 +169944,7 @@ index 0000000..5287631c + const struct plugin_argument * const argv = plugin_info->argv; + int i; + -+ struct register_pass_info check_local_variables_pass_info; -+ -+ check_local_variables_pass_info.pass = make_check_local_variables_pass(); -+ check_local_variables_pass_info.reference_pass_name = "ssa"; -+ check_local_variables_pass_info.ref_pass_instance_number = 1; -+ check_local_variables_pass_info.pos_op = PASS_POS_INSERT_BEFORE; ++ PASS_INFO(check_local_variables, "ssa", 1, PASS_POS_INSERT_BEFORE); + + if (!plugin_default_version_check(version, &gcc_version)) { + error(G_("incompatible gcc/plugin versions")); @@ -169964,9 +169976,16 @@ index 0000000..5287631c + return 0; +} diff --git a/scripts/gcc-plugins/cyc_complexity_plugin.c b/scripts/gcc-plugins/cyc_complexity_plugin.c -index 34df974..8af7db0 100644 +index 34df974..2b01d4d 100644 --- a/scripts/gcc-plugins/cyc_complexity_plugin.c +++ b/scripts/gcc-plugins/cyc_complexity_plugin.c +@@ -1,5 +1,5 @@ + /* +- * Copyright 2011-2016 by Emese Revfy <re.emese@gmail.com> ++ * Copyright 2011-2017 by Emese Revfy <re.emese@gmail.com> + * Licensed under the GPL v2, or (at your option) v3 + * + * Homepage: @@ -20,7 +20,7 @@ #include "gcc-common.h" @@ -169976,7 +169995,7 @@ index 34df974..8af7db0 100644 static struct plugin_info cyc_complexity_plugin_info = { .version = "20160225", -@@ -49,7 +49,7 @@ static unsigned int cyc_complexity_execute(void) +@@ -49,15 +49,11 @@ static unsigned int cyc_complexity_execute(void) #include "gcc-generate-gimple-pass.h" @@ -169984,12 +170003,21 @@ index 34df974..8af7db0 100644 +__visible int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version) { const char * const plugin_name = plugin_info->base_name; - struct register_pass_info cyc_complexity_pass_info; +- struct register_pass_info cyc_complexity_pass_info; + +- cyc_complexity_pass_info.pass = make_cyc_complexity_pass(); +- cyc_complexity_pass_info.reference_pass_name = "ssa"; +- cyc_complexity_pass_info.ref_pass_instance_number = 1; +- cyc_complexity_pass_info.pos_op = PASS_POS_INSERT_AFTER; ++ PASS_INFO(cyc_complexity, "ssa", 1, PASS_POS_INSERT_AFTER); + + if (!plugin_default_version_check(version, &gcc_version)) { + error(G_("incompatible gcc/plugin versions")); diff --git a/scripts/gcc-plugins/gcc-common.h b/scripts/gcc-plugins/gcc-common.h -index 172850b..a4e216d 100644 +index 172850b..879f0d5 100644 --- a/scripts/gcc-plugins/gcc-common.h +++ b/scripts/gcc-plugins/gcc-common.h -@@ -21,14 +21,20 @@ +@@ -21,14 +21,22 @@ #include "rtl.h" #include "tm_p.h" #include "flags.h" @@ -170002,7 +170030,9 @@ index 172850b..a4e216d 100644 #include "except.h" #include "function.h" #include "toplev.h" -+//#include "expr.h" ++#if BUILDING_GCC_VERSION >= 5000 ++#include "expr.h" ++#endif #include "basic-block.h" #include "intl.h" #include "ggc.h" @@ -170010,9 +170040,13 @@ index 172850b..a4e216d 100644 #include "timevar.h" #include "params.h" -@@ -40,12 +46,18 @@ +@@ -39,13 +47,22 @@ + #include "hash-map.h" #endif ++#if BUILDING_GCC_VERSION >= 7000 ++#include "memmodel.h" ++#endif #include "emit-rtl.h" +//#include "reload.h" +//#include "ira.h" @@ -170029,7 +170063,7 @@ index 172850b..a4e216d 100644 #if BUILDING_GCC_VERSION == 4005 #include <sys/mman.h> -@@ -57,6 +69,8 @@ +@@ -57,6 +74,8 @@ #endif #if BUILDING_GCC_VERSION >= 4006 @@ -170038,18 +170072,21 @@ index 172850b..a4e216d 100644 #include "c-family/c-common.h" #else #include "c-common.h" -@@ -75,8 +89,10 @@ +@@ -75,8 +94,13 @@ #endif #include "diagnostic.h" +//#include "tree-diagnostic.h" #include "tree-dump.h" #include "tree-pass.h" ++#if BUILDING_GCC_VERSION >= 4009 ++#include "pass_manager.h" ++#endif +//#include "df.h" #include "predict.h" #include "ipa-utils.h" -@@ -87,6 +103,7 @@ +@@ -87,10 +111,14 @@ #include "internal-fn.h" #include "gimple-expr.h" #include "gimple-fold.h" @@ -170057,7 +170094,14 @@ index 172850b..a4e216d 100644 #include "context.h" #include "tree-ssa-alias.h" #include "tree-ssa.h" -@@ -109,7 +126,15 @@ + #include "stringpool.h" ++#if BUILDING_GCC_VERSION >= 7000 ++#include "tree-vrp.h" ++#endif + #include "tree-ssanames.h" + #include "print-tree.h" + #include "tree-eh.h" +@@ -109,27 +137,33 @@ #include "ssa-iterators.h" #endif @@ -170073,7 +170117,28 @@ index 172850b..a4e216d 100644 #include "builtins.h" #endif -@@ -130,6 +155,7 @@ extern void dump_gimple_stmt(pretty_printer *, gimple, int, int); +-/* #include "expr.h" where are you... */ +-extern rtx emit_move_insn(rtx x, rtx y); +- + /* missing from basic_block.h... */ +-extern void debug_dominance_info(enum cdi_direction dir); +-extern void debug_dominance_tree(enum cdi_direction dir, basic_block root); ++void debug_dominance_info(enum cdi_direction dir); ++void debug_dominance_tree(enum cdi_direction dir, basic_block root); + + #if BUILDING_GCC_VERSION == 4006 +-extern void debug_gimple_stmt(gimple); +-extern void debug_gimple_seq(gimple_seq); +-extern void print_gimple_seq(FILE *, gimple_seq, int, int); +-extern void print_gimple_stmt(FILE *, gimple, int, int); +-extern void print_gimple_expr(FILE *, gimple, int, int); +-extern void dump_gimple_stmt(pretty_printer *, gimple, int, int); ++void debug_gimple_stmt(gimple); ++void debug_gimple_seq(gimple_seq); ++void print_gimple_seq(FILE *, gimple_seq, int, int); ++void print_gimple_stmt(FILE *, gimple, int, int); ++void print_gimple_expr(FILE *, gimple, int, int); ++void dump_gimple_stmt(pretty_printer *, gimple, int, int); #endif #define __unused __attribute__((__unused__)) @@ -170081,7 +170146,37 @@ index 172850b..a4e216d 100644 #define DECL_NAME_POINTER(node) IDENTIFIER_POINTER(DECL_NAME(node)) #define DECL_NAME_LENGTH(node) IDENTIFIER_LENGTH(DECL_NAME(node)) -@@ -165,6 +191,7 @@ static inline bool gimple_call_builtin_p(gimple stmt, enum built_in_function cod +@@ -139,6 +173,29 @@ extern void dump_gimple_stmt(pretty_printer *, gimple, int, int); + /* should come from c-tree.h if only it were installed for gcc 4.5... */ + #define C_TYPE_FIELDS_READONLY(TYPE) TREE_LANG_FLAG_1(TYPE) + ++static inline tree build_const_char_string(int len, const char *str) ++{ ++ tree cstr, elem, index, type; ++ ++ cstr = build_string(len, str); ++ elem = build_type_variant(char_type_node, 1, 0); ++ index = build_index_type(size_int(len - 1)); ++ type = build_array_type(elem, index); ++ TREE_TYPE(cstr) = type; ++ TREE_CONSTANT(cstr) = 1; ++ TREE_READONLY(cstr) = 1; ++ TREE_STATIC(cstr) = 1; ++ return cstr; ++} ++ ++#define PASS_INFO(NAME, REF, ID, POS) \ ++struct register_pass_info NAME##_pass_info = { \ ++ .pass = make_##NAME##_pass(), \ ++ .reference_pass_name = REF, \ ++ .ref_pass_instance_number = ID, \ ++ .pos_op = POS, \ ++} ++ + #if BUILDING_GCC_VERSION == 4005 + #define FOR_EACH_LOCAL_DECL(FUN, I, D) \ + for (tree vars = (FUN)->local_decls, (I) = 0; \ +@@ -165,6 +222,7 @@ static inline bool gimple_call_builtin_p(gimple stmt, enum built_in_function cod fndecl = gimple_call_fndecl(stmt); if (!fndecl || DECL_BUILT_IN_CLASS(fndecl) != BUILT_IN_NORMAL) return false; @@ -170089,7 +170184,7 @@ index 172850b..a4e216d 100644 return DECL_FUNCTION_CODE(fndecl) == code; } -@@ -286,6 +313,22 @@ static inline struct cgraph_node *cgraph_next_function_with_gimple_body(struct c +@@ -286,6 +344,22 @@ static inline struct cgraph_node *cgraph_next_function_with_gimple_body(struct c return NULL; } @@ -170112,8 +170207,37 @@ index 172850b..a4e216d 100644 #define FOR_EACH_FUNCTION_WITH_GIMPLE_BODY(node) \ for ((node) = cgraph_first_function_with_gimple_body(); (node); \ (node) = cgraph_next_function_with_gimple_body(node)) -@@ -495,6 +538,14 @@ static inline const greturn *as_a_const_greturn(const_gimple stmt) +@@ -398,6 +472,7 @@ typedef union gimple_statement_d gassign; + typedef union gimple_statement_d gcall; + typedef union gimple_statement_d gcond; + typedef union gimple_statement_d gdebug; ++typedef union gimple_statement_d ggoto; + typedef union gimple_statement_d gphi; + typedef union gimple_statement_d greturn; + +@@ -451,6 +526,16 @@ static inline const gdebug *as_a_const_gdebug(const_gimple stmt) + return stmt; + } ++static inline ggoto *as_a_ggoto(gimple stmt) ++{ ++ return stmt; ++} ++ ++static inline const ggoto *as_a_const_ggoto(const_gimple stmt) ++{ ++ return stmt; ++} ++ + static inline gphi *as_a_gphi(gimple stmt) + { + return stmt; +@@ -493,8 +578,18 @@ static inline const greturn *as_a_const_greturn(const_gimple stmt) + #define section_name_prefix LTO_SECTION_NAME_PREFIX + #define fatal_error(loc, gmsgid, ...) fatal_error((gmsgid), __VA_ARGS__) + ++rtx emit_move_insn(rtx x, rtx y); ++ typedef struct rtx_def rtx_insn; +static inline const char *get_decl_section_name(const_tree decl) @@ -170127,7 +170251,44 @@ index 172850b..a4e216d 100644 static inline void set_decl_section_name(tree node, const char *value) { if (value) -@@ -608,8 +659,15 @@ inline bool is_a_helper<const gassign *>::test(const_gimple gs) +@@ -510,6 +605,7 @@ typedef struct gimple_statement_base gassign; + typedef struct gimple_statement_call gcall; + typedef struct gimple_statement_base gcond; + typedef struct gimple_statement_base gdebug; ++typedef struct gimple_statement_base ggoto; + typedef struct gimple_statement_phi gphi; + typedef struct gimple_statement_base greturn; + +@@ -563,6 +659,16 @@ static inline const gdebug *as_a_const_gdebug(const_gimple stmt) + return stmt; + } + ++static inline ggoto *as_a_ggoto(gimple stmt) ++{ ++ return stmt; ++} ++ ++static inline const ggoto *as_a_const_ggoto(const_gimple stmt) ++{ ++ return stmt; ++} ++ + static inline gphi *as_a_gphi(gimple stmt) + { + return as_a<gphi>(stmt); +@@ -590,6 +696,11 @@ static inline const greturn *as_a_const_greturn(const_gimple stmt) + #define NODE_DECL(node) (node)->decl + #define cgraph_node_name(node) (node)->name() + #define NODE_IMPLICIT_ALIAS(node) (node)->cpp_implicit_alias ++ ++static inline opt_pass *get_pass_for_id(int id) ++{ ++ return g->get_passes()->get_pass_for_id(id); ++} + #endif + + #if BUILDING_GCC_VERSION >= 5000 && BUILDING_GCC_VERSION < 6000 +@@ -608,8 +719,15 @@ inline bool is_a_helper<const gassign *>::test(const_gimple gs) #define TODO_verify_stmts TODO_verify_il #define TODO_verify_rtl_sharing TODO_verify_il @@ -170143,7 +170304,7 @@ index 172850b..a4e216d 100644 /* symtab/cgraph related */ #define debug_cgraph_node(node) (node)->debug() #define cgraph_get_node(decl) cgraph_node::get(decl) -@@ -618,6 +676,7 @@ inline bool is_a_helper<const gassign *>::test(const_gimple gs) +@@ -618,6 +736,7 @@ inline bool is_a_helper<const gassign *>::test(const_gimple gs) #define cgraph_n_nodes symtab->cgraph_count #define cgraph_max_uid symtab->cgraph_max_uid #define varpool_get_node(decl) varpool_node::get(decl) @@ -170151,7 +170312,7 @@ index 172850b..a4e216d 100644 #define cgraph_create_edge(caller, callee, call_stmt, count, freq, nest) \ (caller)->create_edge((callee), (call_stmt), (count), (freq)) -@@ -673,6 +732,11 @@ static inline cgraph_node_ptr cgraph_alias_target(cgraph_node_ptr node) +@@ -673,6 +792,11 @@ static inline cgraph_node_ptr cgraph_alias_target(cgraph_node_ptr node) return node->get_alias_target(); } @@ -170163,6 +170324,47 @@ index 172850b..a4e216d 100644 static inline struct cgraph_node_hook_list *cgraph_add_function_insertion_hook(cgraph_node_hook hook, void *data) { return symtab->add_cgraph_insertion_hook(hook, data); +@@ -730,6 +854,13 @@ static inline gimple gimple_build_assign_with_ops(enum tree_code subcode, tree l + + template <> + template <> ++inline bool is_a_helper<const ggoto *>::test(const_gimple gs) ++{ ++ return gs->code == GIMPLE_GOTO; ++} ++ ++template <> ++template <> + inline bool is_a_helper<const greturn *>::test(const_gimple gs) + { + return gs->code == GIMPLE_RETURN; +@@ -765,6 +896,16 @@ static inline const gcall *as_a_const_gcall(const_gimple stmt) + return as_a<const gcall *>(stmt); + } + ++static inline ggoto *as_a_ggoto(gimple stmt) ++{ ++ return as_a<ggoto *>(stmt); ++} ++ ++static inline const ggoto *as_a_const_ggoto(const_gimple stmt) ++{ ++ return as_a<const ggoto *>(stmt); ++} ++ + static inline gphi *as_a_gphi(gimple stmt) + { + return as_a<gphi *>(stmt); +@@ -827,4 +968,9 @@ static inline void debug_gimple_stmt(const_gimple s) + #define debug_gimple_stmt(s) debug_gimple_stmt(CONST_CAST_GIMPLE(s)) + #endif + ++#if BUILDING_GCC_VERSION >= 7000 ++#define get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep, keep_aligning) \ ++ get_inner_reference(exp, pbitsize, pbitpos, poffset, pmode, punsignedp, preversep, pvolatilep) ++#endif ++ + #endif diff --git a/scripts/gcc-plugins/gcc-generate-gimple-pass.h b/scripts/gcc-plugins/gcc-generate-gimple-pass.h index 526c3c7..831300b 100644 --- a/scripts/gcc-plugins/gcc-generate-gimple-pass.h @@ -170236,12 +170438,12 @@ index 0000000..7514850 +fi diff --git a/scripts/gcc-plugins/initify_plugin.c b/scripts/gcc-plugins/initify_plugin.c new file mode 100644 -index 0000000..46bd9b9 +index 0000000..07af312 --- /dev/null +++ b/scripts/gcc-plugins/initify_plugin.c -@@ -0,0 +1,1809 @@ +@@ -0,0 +1,1805 @@ +/* -+ * Copyright 2015-2016 by Emese Revfy <re.emese@gmail.com> ++ * Copyright 2015-2017 by Emese Revfy <re.emese@gmail.com> + * Licensed under the GPL v2 + * + * Homepage: @@ -171918,7 +172120,7 @@ index 0000000..46bd9b9 + DECL_ATTRIBUTES(fndecl) = copy_list(DECL_ATTRIBUTES(fndecl)); + + section_name = NODE_SYMBOL(node)->aux == (void *)INIT ? ".init.text" : ".exit.text"; -+ section_str = build_string(strlen(section_name) + 1, section_name); ++ section_str = build_const_char_string(strlen(section_name) + 1, section_name); + TREE_READONLY(section_str) = 1; + TREE_STATIC(section_str) = 1; + attr_args = build_tree_list(NULL_TREE, section_str); @@ -171993,17 +172195,13 @@ index 0000000..46bd9b9 + +__visible int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version) +{ -+ struct register_pass_info initify_info; + int i; + const int argc = plugin_info->argc; + bool enabled = true; + const struct plugin_argument * const argv = plugin_info->argv; + const char * const plugin_name = plugin_info->base_name; + -+ initify_info.pass = make_initify_pass(); -+ initify_info.reference_pass_name = "inline"; -+ initify_info.ref_pass_instance_number = 1; -+ initify_info.pos_op = PASS_POS_INSERT_AFTER; ++ PASS_INFO(initify, "inline", 1, PASS_POS_INSERT_AFTER); + + if (!plugin_default_version_check(version, &gcc_version)) { + error(G_("incompatible gcc/plugin versions")); @@ -172042,7 +172240,7 @@ index 0000000..46bd9b9 + + register_callback(plugin_name, PLUGIN_INFO, NULL, &initify_plugin_info); + if (enabled) { -+ register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &initify_info); ++ register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &initify_pass_info); + register_callback(plugin_name, PLUGIN_START_UNIT, initify_start_unit, NULL); + } + register_callback(plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL); @@ -172051,12 +172249,12 @@ index 0000000..46bd9b9 +} diff --git a/scripts/gcc-plugins/kallocstat_plugin.c b/scripts/gcc-plugins/kallocstat_plugin.c new file mode 100644 -index 0000000..3bd3089 +index 0000000..0a9214d --- /dev/null +++ b/scripts/gcc-plugins/kallocstat_plugin.c -@@ -0,0 +1,135 @@ +@@ -0,0 +1,131 @@ +/* -+ * Copyright 2011-2016 by the PaX Team <pageexec@freemail.hu> ++ * Copyright 2011-2017 by the PaX Team <pageexec@freemail.hu> + * Licensed under the GPL v2 + * + * Note: the choice of the license means that the compilation process is @@ -172173,12 +172371,8 @@ index 0000000..3bd3089 +__visible int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version) +{ + const char * const plugin_name = plugin_info->base_name; -+ struct register_pass_info kallocstat_pass_info; + -+ kallocstat_pass_info.pass = make_kallocstat_pass(); -+ kallocstat_pass_info.reference_pass_name = "ssa"; -+ kallocstat_pass_info.ref_pass_instance_number = 1; -+ kallocstat_pass_info.pos_op = PASS_POS_INSERT_AFTER; ++ PASS_INFO(kallocstat, "ssa", 1, PASS_POS_INSERT_AFTER); + + if (!plugin_default_version_check(version, &gcc_version)) { + error(G_("incompatible gcc/plugin versions")); @@ -172192,12 +172386,12 @@ index 0000000..3bd3089 +} diff --git a/scripts/gcc-plugins/kernexec_plugin.c b/scripts/gcc-plugins/kernexec_plugin.c new file mode 100644 -index 0000000..a213367 +index 0000000..9ac2ebb --- /dev/null +++ b/scripts/gcc-plugins/kernexec_plugin.c -@@ -0,0 +1,407 @@ +@@ -0,0 +1,393 @@ +/* -+ * Copyright 2011-2016 by the PaX Team <pageexec@freemail.hu> ++ * Copyright 2011-2017 by the PaX Team <pageexec@freemail.hu> + * Licensed under the GPL v2 + * + * Note: the choice of the license means that the compilation process is @@ -172350,9 +172544,9 @@ index 0000000..a213367 + new_fptr = make_ssa_name(new_fptr, NULL); + + // build asm volatile("orq %%r12, %0\n\t" : "=r"(new_fptr) : "0"(old_fptr)); -+ input = build_tree_list(NULL_TREE, build_string(2, "0")); ++ input = build_tree_list(NULL_TREE, build_const_char_string(2, "0")); + input = chainon(NULL_TREE, build_tree_list(input, old_fptr)); -+ output = build_tree_list(NULL_TREE, build_string(3, "=r")); ++ output = build_tree_list(NULL_TREE, build_const_char_string(3, "=r")); + output = chainon(NULL_TREE, build_tree_list(output, new_fptr)); +#if BUILDING_GCC_VERSION <= 4007 + VEC_safe_push(tree, gc, inputs, input); @@ -172545,24 +172739,10 @@ index 0000000..a213367 + const int argc = plugin_info->argc; + const struct plugin_argument * const argv = plugin_info->argv; + int i; -+ struct register_pass_info kernexec_reload_pass_info; -+ struct register_pass_info kernexec_fptr_pass_info; -+ struct register_pass_info kernexec_retaddr_pass_info; -+ -+ kernexec_reload_pass_info.pass = make_kernexec_reload_pass(); -+ kernexec_reload_pass_info.reference_pass_name = "early_optimizations"; -+ kernexec_reload_pass_info.ref_pass_instance_number = 1; -+ kernexec_reload_pass_info.pos_op = PASS_POS_INSERT_BEFORE; + -+ kernexec_fptr_pass_info.pass = make_kernexec_fptr_pass(); -+ kernexec_fptr_pass_info.reference_pass_name = "early_optimizations"; -+ kernexec_fptr_pass_info.ref_pass_instance_number = 1; -+ kernexec_fptr_pass_info.pos_op = PASS_POS_INSERT_BEFORE; -+ -+ kernexec_retaddr_pass_info.pass = make_kernexec_retaddr_pass(); -+ kernexec_retaddr_pass_info.reference_pass_name = "pro_and_epilogue"; -+ kernexec_retaddr_pass_info.ref_pass_instance_number = 1; -+ kernexec_retaddr_pass_info.pos_op = PASS_POS_INSERT_AFTER; ++ PASS_INFO(kernexec_reload, "early_optimizations", 1, PASS_POS_INSERT_BEFORE); ++ PASS_INFO(kernexec_fptr, "early_optimizations", 1, PASS_POS_INSERT_BEFORE); ++ PASS_INFO(kernexec_retaddr, "pro_and_epilogue", 1, PASS_POS_INSERT_AFTER); + + if (!plugin_default_version_check(version, &gcc_version)) { + error(G_("incompatible gcc/plugin versions")); @@ -172605,12 +172785,12 @@ index 0000000..a213367 +} diff --git a/scripts/gcc-plugins/latent_entropy_plugin.c b/scripts/gcc-plugins/latent_entropy_plugin.c new file mode 100644 -index 0000000..fc16dd7 +index 0000000..56b1ece --- /dev/null +++ b/scripts/gcc-plugins/latent_entropy_plugin.c -@@ -0,0 +1,613 @@ +@@ -0,0 +1,609 @@ +/* -+ * Copyright 2012-2016 by the PaX Team <pageexec@freemail.hu> ++ * Copyright 2012-2017 by the PaX Team <pageexec@freemail.hu> + * Copyright 2016 by Emese Revfy <re.emese@gmail.com> + * Licensed under the GPL v2 + * @@ -173182,12 +173362,6 @@ index 0000000..fc16dd7 + const struct plugin_argument * const argv = plugin_info->argv; + int i; + -+ struct register_pass_info latent_entropy_pass_info; -+ -+ latent_entropy_pass_info.pass = make_latent_entropy_pass(); -+ latent_entropy_pass_info.reference_pass_name = "optimized"; -+ latent_entropy_pass_info.ref_pass_instance_number = 1; -+ latent_entropy_pass_info.pos_op = PASS_POS_INSERT_BEFORE; + static const struct ggc_root_tab gt_ggc_r_gt_latent_entropy[] = { + { + .base = &latent_entropy_decl, @@ -173199,6 +173373,8 @@ index 0000000..fc16dd7 + LAST_GGC_ROOT_TAB + }; + ++ PASS_INFO(latent_entropy, "optimized", 1, PASS_POS_INSERT_BEFORE); ++ + if (!plugin_default_version_check(version, &gcc_version)) { + error(G_("incompatible gcc/plugin versions")); + return 1; @@ -174836,12 +175012,12 @@ index 0000000..161102f +} diff --git a/scripts/gcc-plugins/rap_plugin/rap_plugin.c b/scripts/gcc-plugins/rap_plugin/rap_plugin.c new file mode 100644 -index 0000000..e42b7e5 +index 0000000..8359861 --- /dev/null +++ b/scripts/gcc-plugins/rap_plugin/rap_plugin.c -@@ -0,0 +1,515 @@ +@@ -0,0 +1,505 @@ +/* -+ * Copyright 2012-2016 by PaX Team <pageexec@freemail.hu> ++ * Copyright 2012-2017 by PaX Team <pageexec@freemail.hu> + * Licensed under the GPL v2 + * + * Homepage: http://pax.grsecurity.net/ @@ -174897,7 +175073,7 @@ index 0000000..e42b7e5 + if (!var && full) { + tree clobber; + -+ clobber = build_tree_list(NULL_TREE, build_string(7, "memory")); ++ clobber = build_tree_list(NULL_TREE, build_const_char_string(7, "memory")); +#if BUILDING_GCC_VERSION <= 4007 + VEC_safe_push(tree, gc, clobbers, clobber); +#else @@ -174906,7 +175082,7 @@ index 0000000..e42b7e5 + } else if (full) { + tree input, output; + -+ input = build_tree_list(NULL_TREE, build_string(2, "0")); ++ input = build_tree_list(NULL_TREE, build_const_char_string(2, "0")); + input = chainon(NULL_TREE, build_tree_list(input, var)); +#if BUILDING_GCC_VERSION <= 4007 + VEC_safe_push(tree, gc, inputs, input); @@ -174914,7 +175090,7 @@ index 0000000..e42b7e5 + vec_safe_push(inputs, input); +#endif + -+ output = build_tree_list(NULL_TREE, build_string(4, "=rm")); ++ output = build_tree_list(NULL_TREE, build_const_char_string(4, "=rm")); + gcc_assert(SSA_NAME_VAR(var)); + var = make_ssa_name(SSA_NAME_VAR(var), NULL); + output = chainon(NULL_TREE, build_tree_list(output, var)); @@ -174926,7 +175102,7 @@ index 0000000..e42b7e5 + } else { + tree input; + -+ input = build_tree_list(NULL_TREE, build_string(3, "rm")); ++ input = build_tree_list(NULL_TREE, build_const_char_string(3, "rm")); + input = chainon(NULL_TREE, build_tree_list(input, var)); +#if BUILDING_GCC_VERSION <= 4007 + VEC_safe_push(tree, gc, inputs, input); @@ -175229,18 +175405,8 @@ index 0000000..e42b7e5 + bool enable_call = false; + bool enable_abs = false, enable_abs_finish = false; + -+ struct register_pass_info rap_fptr_pass_info; -+ struct register_pass_info rap_unignore_pass_info; -+ -+ rap_fptr_pass_info.pass = make_rap_fptr_pass(); -+ rap_fptr_pass_info.reference_pass_name = "nrv"; -+ rap_fptr_pass_info.ref_pass_instance_number = 1; -+ rap_fptr_pass_info.pos_op = PASS_POS_INSERT_AFTER; -+ -+ rap_unignore_pass_info.pass = make_rap_unignore_pass(); -+ rap_unignore_pass_info.reference_pass_name = "final"; -+ rap_unignore_pass_info.ref_pass_instance_number = 1; -+ rap_unignore_pass_info.pos_op = PASS_POS_INSERT_BEFORE; ++ PASS_INFO(rap_fptr, "nrv", 1, PASS_POS_INSERT_AFTER); ++ PASS_INFO(rap_unignore, "final", 1, PASS_POS_INSERT_BEFORE); + + if (!rap_version_check(version, &gcc_version)) { + error(G_("incompatible gcc/plugin versions")); @@ -175458,9 +175624,16 @@ index 0000000..65bc1cd + U64TO8_LE(out, b); +} diff --git a/scripts/gcc-plugins/sancov_plugin.c b/scripts/gcc-plugins/sancov_plugin.c -index aedd611..7ea0b3f 100644 +index aedd611..72265dd 100644 --- a/scripts/gcc-plugins/sancov_plugin.c +++ b/scripts/gcc-plugins/sancov_plugin.c +@@ -1,5 +1,5 @@ + /* +- * Copyright 2011-2016 by Emese Revfy <re.emese@gmail.com> ++ * Copyright 2011-2017 by Emese Revfy <re.emese@gmail.com> + * Licensed under the GPL v2, or (at your option) v3 + * + * Homepage: @@ -21,7 +21,7 @@ #include "gcc-common.h" @@ -175470,15 +175643,54 @@ index aedd611..7ea0b3f 100644 tree sancov_fndecl; -@@ -86,7 +86,7 @@ static void sancov_start_unit(void __unused *gcc_data, void __unused *user_data) +@@ -62,6 +62,7 @@ static unsigned int sancov_execute(void) + + #include "gcc-generate-gimple-pass.h" + ++#if BUILDING_GCC_VERSION < 6000 + static void sancov_start_unit(void __unused *gcc_data, void __unused *user_data) + { + tree leaf_attr, nothrow_attr; +@@ -85,11 +86,11 @@ static void sancov_start_unit(void __unused *gcc_data, void __unused *user_data) + decl_attributes(&sancov_fndecl, leaf_attr, 0); #endif } ++#endif -int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version) +__visible int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version *version) { int i; - struct register_pass_info sancov_plugin_pass_info; +- struct register_pass_info sancov_plugin_pass_info; + const char * const plugin_name = plugin_info->base_name; + const int argc = plugin_info->argc; + const struct plugin_argument * const argv = plugin_info->argv; +@@ -107,14 +108,11 @@ int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version + }; + + /* BBs can be split afterwards?? */ +- sancov_plugin_pass_info.pass = make_sancov_pass(); + #if BUILDING_GCC_VERSION >= 4009 +- sancov_plugin_pass_info.reference_pass_name = "asan"; ++ PASS_INFO(sancov, "asan", 0, PASS_POS_INSERT_BEFORE); + #else +- sancov_plugin_pass_info.reference_pass_name = "nrv"; ++ PASS_INFO(sancov, "nrv", 1, PASS_POS_INSERT_BEFORE); + #endif +- sancov_plugin_pass_info.ref_pass_instance_number = 0; +- sancov_plugin_pass_info.pos_op = PASS_POS_INSERT_BEFORE; + + if (!plugin_default_version_check(version, &gcc_version)) { + error(G_("incompatible gcc/plugin versions")); +@@ -137,7 +135,7 @@ int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gcc_version + #if BUILDING_GCC_VERSION < 6000 + register_callback(plugin_name, PLUGIN_START_UNIT, &sancov_start_unit, NULL); + register_callback(plugin_name, PLUGIN_REGISTER_GGC_ROOTS, NULL, (void *)>_ggc_r_gt_sancov); +- register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &sancov_plugin_pass_info); ++ register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &sancov_pass_info); + #endif + + return 0; diff --git a/scripts/gcc-plugins/size_overflow_plugin/.gitignore b/scripts/gcc-plugins/size_overflow_plugin/.gitignore new file mode 100644 index 0000000..36211fb @@ -210251,12 +210463,12 @@ index 0000000..be9724d +exit 0 diff --git a/scripts/gcc-plugins/size_overflow_plugin/insert_size_overflow_asm.c b/scripts/gcc-plugins/size_overflow_plugin/insert_size_overflow_asm.c new file mode 100644 -index 0000000..9fb6a1a +index 0000000..d459e5f --- /dev/null +++ b/scripts/gcc-plugins/size_overflow_plugin/insert_size_overflow_asm.c @@ -0,0 +1,374 @@ +/* -+ * Copyright 2011-2016 by Emese Revfy <re.emese@gmail.com> ++ * Copyright 2011-2017 by Emese Revfy <re.emese@gmail.com> + * Licensed under the GPL v2 + * + * Homepage: @@ -210377,9 +210589,9 @@ index 0000000..9fb6a1a + mark_str = convert_mark_to_str(asm_data->intentional_mark); + asm_comment = create_asm_comment(asm_data, mark_str); + -+ str_input = build_string(2, "0"); ++ str_input = build_const_char_string(2, "0"); + input = create_asm_io_list(str_input, asm_data->input); -+ str_output = build_string(4, "=rm"); ++ str_output = build_const_char_string(4, "=rm"); + output = create_asm_io_list(str_output, asm_data->output); + + asm_stmt = as_a_gasm(gimple_build_asm_vec(asm_comment, input, output, NULL, NULL)); @@ -212509,12 +212721,12 @@ index 0000000..663b6c9 +} diff --git a/scripts/gcc-plugins/size_overflow_plugin/size_overflow_ipa.c b/scripts/gcc-plugins/size_overflow_plugin/size_overflow_ipa.c new file mode 100644 -index 0000000..34b9974 +index 0000000..1fe86f3 --- /dev/null +++ b/scripts/gcc-plugins/size_overflow_plugin/size_overflow_ipa.c @@ -0,0 +1,1333 @@ +/* -+ * Copyright 2011-2016 by Emese Revfy <re.emese@gmail.com> ++ * Copyright 2011-2017 by Emese Revfy <re.emese@gmail.com> + * Licensed under the GPL v2 + * + * Homepage: @@ -214359,12 +214571,12 @@ index 0000000..b5291e1 + diff --git a/scripts/gcc-plugins/size_overflow_plugin/size_overflow_plugin.c b/scripts/gcc-plugins/size_overflow_plugin/size_overflow_plugin.c new file mode 100644 -index 0000000..df0c102 +index 0000000..4645a29 --- /dev/null +++ b/scripts/gcc-plugins/size_overflow_plugin/size_overflow_plugin.c -@@ -0,0 +1,313 @@ +@@ -0,0 +1,299 @@ +/* -+ * Copyright 2011-2016 by Emese Revfy <re.emese@gmail.com> ++ * Copyright 2011-2017 by Emese Revfy <re.emese@gmail.com> + * Licensed under the GPL v2 + * + * Homepage: @@ -214589,11 +214801,6 @@ index 0000000..df0c102 + const int argc = plugin_info->argc; + const struct plugin_argument * const argv = plugin_info->argv; + bool enable = true; -+ struct register_pass_info insert_size_overflow_asm_pass_info; -+ struct register_pass_info size_overflow_pass_info; -+#if BUILDING_GCC_VERSION >= 4009 -+ struct register_pass_info disable_ubsan_si_overflow_pass_info; -+#endif + + static const struct ggc_root_tab gt_ggc_r_gt_size_overflow[] = { + { @@ -214606,15 +214813,11 @@ index 0000000..df0c102 + LAST_GGC_ROOT_TAB + }; + -+ insert_size_overflow_asm_pass_info.pass = make_insert_size_overflow_asm_pass(); -+ insert_size_overflow_asm_pass_info.reference_pass_name = "ssa"; -+ insert_size_overflow_asm_pass_info.ref_pass_instance_number = 1; -+ insert_size_overflow_asm_pass_info.pos_op = PASS_POS_INSERT_AFTER; -+ -+ size_overflow_pass_info.pass = make_size_overflow_pass(); -+ size_overflow_pass_info.reference_pass_name = "inline"; -+ size_overflow_pass_info.ref_pass_instance_number = 1; -+ size_overflow_pass_info.pos_op = PASS_POS_INSERT_AFTER; ++ PASS_INFO(insert_size_overflow_asm, "ssa", 1, PASS_POS_INSERT_AFTER); ++ PASS_INFO(size_overflow, "inline", 1, PASS_POS_INSERT_AFTER); ++#if BUILDING_GCC_VERSION >= 4009 ++ PASS_INFO(disable_ubsan_si_overflow, "ubsan", 1, PASS_POS_REPLACE); ++#endif + + if (!plugin_default_version_check(version, &gcc_version)) { + error(G_("incompatible gcc/plugin versions")); @@ -214662,11 +214865,6 @@ index 0000000..df0c102 + register_callback(plugin_name, PLUGIN_REGISTER_GGC_ROOTS, NULL, (void *)>_ggc_r_gt_size_overflow); +#if BUILDING_GCC_VERSION >= 4009 + flag_sanitize |= SANITIZE_SI_OVERFLOW; -+ disable_ubsan_si_overflow_pass_info.pass = make_disable_ubsan_si_overflow_pass(); -+ disable_ubsan_si_overflow_pass_info.reference_pass_name = "ubsan"; -+ disable_ubsan_si_overflow_pass_info.ref_pass_instance_number = 1; -+ disable_ubsan_si_overflow_pass_info.pos_op = PASS_POS_REPLACE; -+ + register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &disable_ubsan_si_overflow_pass_info); +#endif + register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &insert_size_overflow_asm_pass_info); @@ -215153,12 +215351,12 @@ index 0000000..67cacb9 + diff --git a/scripts/gcc-plugins/size_overflow_plugin/size_overflow_transform.c b/scripts/gcc-plugins/size_overflow_plugin/size_overflow_transform.c new file mode 100644 -index 0000000..620a44a +index 0000000..e2cfd20 --- /dev/null +++ b/scripts/gcc-plugins/size_overflow_plugin/size_overflow_transform.c @@ -0,0 +1,772 @@ +/* -+ * Copyright 2011-2016 by Emese Revfy <re.emese@gmail.com> ++ * Copyright 2011-2017 by Emese Revfy <re.emese@gmail.com> + * Licensed under the GPL v2 + * + * Homepage: @@ -215208,7 +215406,7 @@ index 0000000..620a44a + + gcc_assert(is_size_overflow_insert_check_asm(stmt)); + -+ list = build_tree_list(NULL_TREE, build_string(3, "rm")); ++ list = build_tree_list(NULL_TREE, build_const_char_string(3, "rm")); + list = chainon(NULL_TREE, build_tree_list(list, new_input)); + gimple_asm_set_input_op(stmt, 0, list); +} @@ -215931,12 +216129,12 @@ index 0000000..620a44a +} diff --git a/scripts/gcc-plugins/size_overflow_plugin/size_overflow_transform_core.c b/scripts/gcc-plugins/size_overflow_plugin/size_overflow_transform_core.c new file mode 100644 -index 0000000..69e3a85 +index 0000000..7b24aea --- /dev/null +++ b/scripts/gcc-plugins/size_overflow_plugin/size_overflow_transform_core.c -@@ -0,0 +1,1025 @@ +@@ -0,0 +1,1013 @@ +/* -+ * Copyright 2011-2016 by Emese Revfy <re.emese@gmail.com> ++ * Copyright 2011-2017 by Emese Revfy <re.emese@gmail.com> + * Licensed under the GPL v2 + * + * Homepage: @@ -216365,18 +216563,6 @@ index 0000000..69e3a85 + +static tree create_string_param(tree string) +{ -+ tree i_type, a_type; -+ const int length = TREE_STRING_LENGTH(string); -+ -+ gcc_assert(length > 0); -+ -+ i_type = build_index_type(build_int_cst(NULL_TREE, length - 1)); -+ a_type = build_array_type(char_type_node, i_type); -+ -+ TREE_TYPE(string) = a_type; -+ TREE_CONSTANT(string) = 1; -+ TREE_READONLY(string) = 1; -+ + return build1(ADDR_EXPR, ptr_type_node, string); +} + @@ -216414,17 +216600,17 @@ index 0000000..69e3a85 + + loc_line = build_int_cstu(unsigned_type_node, xloc.line); + -+ loc_file = build_string(strlen(xloc.file) + 1, xloc.file); ++ loc_file = build_const_char_string(strlen(xloc.file) + 1, xloc.file); + loc_file = create_string_param(loc_file); + -+ current_func = build_string(DECL_NAME_LENGTH(current_function_decl) + 1, DECL_NAME_POINTER(current_function_decl)); ++ current_func = build_const_char_string(DECL_NAME_LENGTH(current_function_decl) + 1, DECL_NAME_POINTER(current_function_decl)); + current_func = create_string_param(current_func); + + gcc_assert(DECL_NAME(SSA_NAME_VAR(arg)) != NULL); + call_count++; + len = asprintf(&ssa_name_buf, "%s_%u %s, count: %u, decl: %s; num: %u; context: %s;\n", DECL_NAME_POINTER(SSA_NAME_VAR(arg)), SSA_NAME_VERSION(arg), min ? "min" : "max", call_count, expand_from->next_node->decl_name, expand_from->next_node->num, expand_from->next_node->context); + gcc_assert(len > 0); -+ ssa_name = build_string(len + 1, ssa_name_buf); ++ ssa_name = build_const_char_string(len + 1, ssa_name_buf); + free(ssa_name_buf); + ssa_name = create_string_param(ssa_name); + @@ -216962,12 +217148,12 @@ index 0000000..69e3a85 +} diff --git a/scripts/gcc-plugins/stackleak_plugin.c b/scripts/gcc-plugins/stackleak_plugin.c new file mode 100644 -index 0000000..d8d3a9e +index 0000000..b70f0bc --- /dev/null +++ b/scripts/gcc-plugins/stackleak_plugin.c -@@ -0,0 +1,350 @@ +@@ -0,0 +1,342 @@ +/* -+ * Copyright 2011-2016 by the PaX Team <pageexec@freemail.hu> ++ * Copyright 2011-2017 by the PaX Team <pageexec@freemail.hu> + * Licensed under the GPL v2 + * + * Note: the choice of the license means that the compilation process is @@ -217249,8 +217435,7 @@ index 0000000..d8d3a9e + const int argc = plugin_info->argc; + const struct plugin_argument * const argv = plugin_info->argv; + int i; -+ struct register_pass_info stackleak_tree_instrument_pass_info; -+ struct register_pass_info stackleak_final_pass_info; ++ + static const struct ggc_root_tab gt_ggc_r_gt_stackleak[] = { + { + .base = &track_function_decl, @@ -217269,16 +217454,9 @@ index 0000000..d8d3a9e + LAST_GGC_ROOT_TAB + }; + -+ stackleak_tree_instrument_pass_info.pass = make_stackleak_tree_instrument_pass(); -+// stackleak_tree_instrument_pass_info.reference_pass_name = "tree_profile"; -+ stackleak_tree_instrument_pass_info.reference_pass_name = "optimized"; -+ stackleak_tree_instrument_pass_info.ref_pass_instance_number = 1; -+ stackleak_tree_instrument_pass_info.pos_op = PASS_POS_INSERT_BEFORE; -+ -+ stackleak_final_pass_info.pass = make_stackleak_final_pass(); -+ stackleak_final_pass_info.reference_pass_name = "final"; -+ stackleak_final_pass_info.ref_pass_instance_number = 1; -+ stackleak_final_pass_info.pos_op = PASS_POS_INSERT_BEFORE; ++// PASS_INFO(stackleak_tree_instrument, "tree_profile", 1, PASS_POS_INSERT_BEFORE); ++ PASS_INFO(stackleak_tree_instrument, "optimized", 1, PASS_POS_INSERT_BEFORE); ++ PASS_INFO(stackleak_final, "final", 1, PASS_POS_INSERT_BEFORE); + + if (!plugin_default_version_check(version, &gcc_version)) { + error(G_("incompatible gcc/plugin versions")); @@ -217318,12 +217496,12 @@ index 0000000..d8d3a9e +} diff --git a/scripts/gcc-plugins/structleak_plugin.c b/scripts/gcc-plugins/structleak_plugin.c new file mode 100644 -index 0000000..583faac +index 0000000..0afee93 --- /dev/null +++ b/scripts/gcc-plugins/structleak_plugin.c -@@ -0,0 +1,239 @@ +@@ -0,0 +1,235 @@ +/* -+ * Copyright 2013-2016 by PaX Team <pageexec@freemail.hu> ++ * Copyright 2013-2017 by PaX Team <pageexec@freemail.hu> + * Licensed under the GPL v2 + * + * Note: the choice of the license means that the compilation process is @@ -217527,12 +217705,8 @@ index 0000000..583faac + const int argc = plugin_info->argc; + const struct plugin_argument * const argv = plugin_info->argv; + bool enable = true; -+ struct register_pass_info structleak_pass_info; + -+ structleak_pass_info.pass = make_structleak_pass(); -+ structleak_pass_info.reference_pass_name = "early_optimizations"; -+ structleak_pass_info.ref_pass_instance_number = 1; -+ structleak_pass_info.pos_op = PASS_POS_INSERT_BEFORE; ++ PASS_INFO(structleak, "early_optimizations", 1, PASS_POS_INSERT_BEFORE); + + if (!plugin_default_version_check(version, &gcc_version)) { + error(G_("incompatible gcc/plugin versions")); |