diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2015-05-29 08:30:03 -0400 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2015-05-29 08:30:03 -0400 |
commit | 3896e54a5e5781b0c950817bf3b89e8f53185893 (patch) | |
tree | 486e910f69294996a1c2c48235d335bb4043771c | |
parent | Grsec/PaX: 3.1-{3.14.43,4.0.4}-201505222222 (diff) | |
download | hardened-patchset-3896e54a5e5781b0c950817bf3b89e8f53185893.tar.gz hardened-patchset-3896e54a5e5781b0c950817bf3b89e8f53185893.tar.bz2 hardened-patchset-3896e54a5e5781b0c950817bf3b89e8f53185893.zip |
Grsec/PaX: 3.1-{3.2.69,3.14.43,4.0.4}-20150527211320150527
-rw-r--r-- | 3.14.43/0000_README | 2 | ||||
-rw-r--r-- | 3.14.43/4420_grsecurity-3.1-3.14.43-201505272112.patch (renamed from 3.14.43/4420_grsecurity-3.1-3.14.43-201505222221.patch) | 47 | ||||
-rw-r--r-- | 3.2.69/0000_README | 2 | ||||
-rw-r--r-- | 3.2.69/4420_grsecurity-3.1-3.2.69-201505272108.patch (renamed from 3.2.69/4420_grsecurity-3.1-3.2.69-201505181926.patch) | 38 | ||||
-rw-r--r-- | 4.0.4/0000_README | 2 | ||||
-rw-r--r-- | 4.0.4/4420_grsecurity-3.1-4.0.4-201505272113.patch (renamed from 4.0.4/4420_grsecurity-3.1-4.0.4-201505222222.patch) | 905 |
6 files changed, 904 insertions, 92 deletions
diff --git a/3.14.43/0000_README b/3.14.43/0000_README index 6494a01..09a43ed 100644 --- a/3.14.43/0000_README +++ b/3.14.43/0000_README @@ -2,7 +2,7 @@ README ----------------------------------------------------------------------------- Individual Patch Descriptions: ----------------------------------------------------------------------------- -Patch: 4420_grsecurity-3.1-3.14.43-201505222221.patch +Patch: 4420_grsecurity-3.1-3.14.43-201505272112.patch From: http://www.grsecurity.net Desc: hardened-sources base patch from upstream grsecurity diff --git a/3.14.43/4420_grsecurity-3.1-3.14.43-201505222221.patch b/3.14.43/4420_grsecurity-3.1-3.14.43-201505272112.patch index c57dea0..2ecf955 100644 --- a/3.14.43/4420_grsecurity-3.1-3.14.43-201505222221.patch +++ b/3.14.43/4420_grsecurity-3.1-3.14.43-201505272112.patch @@ -76699,6 +76699,19 @@ index aead369..0dfecfd 100644 xfs_dir3_get_dtype(mp, filetype))) return 0; sfep = dp->d_ops->sf_nextentry(sfp, sfep); +diff --git a/fs/xfs/xfs_error.c b/fs/xfs/xfs_error.c +index 9995b80..981f0f4 100644 +--- a/fs/xfs/xfs_error.c ++++ b/fs/xfs/xfs_error.c +@@ -156,7 +156,7 @@ xfs_error_report( + { + if (level <= xfs_error_level) { + xfs_alert_tag(mp, XFS_PTAG_ERROR_REPORT, +- "Internal error %s at line %d of file %s. Caller 0x%p", ++ "Internal error %s at line %d of file %s. Caller 0x%pS", + tag, linenum, filename, ra); + + xfs_stack_trace(); diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index 78e62cc..eec3706 100644 --- a/fs/xfs/xfs_ioctl.c @@ -120148,10 +120161,10 @@ index 0000000..0c96d8a +} diff --git a/tools/gcc/constify_plugin.c b/tools/gcc/constify_plugin.c new file mode 100644 -index 0000000..93b181d +index 0000000..da184c5 --- /dev/null +++ b/tools/gcc/constify_plugin.c -@@ -0,0 +1,563 @@ +@@ -0,0 +1,564 @@ +/* + * Copyright 2011 by Emese Revfy <re.emese@gmail.com> + * Copyright 2011-2015 by PaX Team <pageexec@freemail.hu> @@ -120390,7 +120403,8 @@ index 0000000..93b181d + return NULL_TREE; + } + -+ error("%qE attribute used on type %qT that is not constified", name, type); ++ if (TYPE_FIELDS(type)) ++ error("%qE attribute used on type %qT that is not constified", name, type); + return NULL_TREE; +} + @@ -120717,10 +120731,10 @@ index 0000000..93b181d +} diff --git a/tools/gcc/gcc-common.h b/tools/gcc/gcc-common.h new file mode 100644 -index 0000000..d8ec362 +index 0000000..77f8462 --- /dev/null +++ b/tools/gcc/gcc-common.h -@@ -0,0 +1,666 @@ +@@ -0,0 +1,689 @@ +#ifndef GCC_COMMON_H_INCLUDED +#define GCC_COMMON_H_INCLUDED + @@ -120935,6 +120949,12 @@ index 0000000..d8ec362 + return false; + } +} ++ ++static inline void add_local_decl(struct function *fun, tree d) ++{ ++ gcc_assert(TREE_CODE(d) == VAR_DECL); ++ fun->local_decls = tree_cons(NULL_TREE, d, fun->local_decls); ++} +#endif + +#if BUILDING_GCC_VERSION <= 4006 @@ -121012,6 +121032,11 @@ index 0000000..d8ec362 +#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)) ++ ++static inline void varpool_add_new_variable(tree decl) ++{ ++ varpool_finalize_decl(decl); ++} +#endif + +#if BUILDING_GCC_VERSION == 4006 @@ -121128,8 +121153,10 @@ index 0000000..d8ec362 +#define add_referenced_var(var) +#define mark_sym_for_renaming(var) +#define varpool_mark_needed_node(node) ++#define create_var_ann(var) +#define TODO_dump_func 0 +#define TODO_dump_cgraph 0 ++ +#endif + +#if BUILDING_GCC_VERSION <= 4009 @@ -121150,6 +121177,11 @@ index 0000000..d8ec362 +#if BUILDING_GCC_VERSION <= 4009 +typedef struct rtx_def rtx_insn; + ++static inline void set_decl_section_name(tree node, const char *value) ++{ ++ DECL_SECTION_NAME(node) = build_string(strlen(value) + 1, value); ++} ++ +static inline gasm *as_a_gasm(gimple stmt) +{ + return stmt; @@ -121246,6 +121278,11 @@ index 0000000..d8ec362 + varpool_node::finalize_decl(decl); +} + ++static inline void varpool_add_new_variable(tree decl) ++{ ++ varpool_node::add(decl); ++} ++ +static inline cgraph_node_ptr cgraph_function_node(cgraph_node_ptr node, enum availability *availability) +{ + return node->function_symbol(availability); diff --git a/3.2.69/0000_README b/3.2.69/0000_README index 8bf4976..4b24d8f 100644 --- a/3.2.69/0000_README +++ b/3.2.69/0000_README @@ -194,7 +194,7 @@ Patch: 1068_linux-3.2.69.patch From: http://www.kernel.org Desc: Linux 3.2.69 -Patch: 4420_grsecurity-3.1-3.2.69-201505181926.patch +Patch: 4420_grsecurity-3.1-3.2.69-201505272108.patch From: http://www.grsecurity.net Desc: hardened-sources base patch from upstream grsecurity diff --git a/3.2.69/4420_grsecurity-3.1-3.2.69-201505181926.patch b/3.2.69/4420_grsecurity-3.1-3.2.69-201505272108.patch index b43610c..58543ee 100644 --- a/3.2.69/4420_grsecurity-3.1-3.2.69-201505181926.patch +++ b/3.2.69/4420_grsecurity-3.1-3.2.69-201505272108.patch @@ -115626,10 +115626,10 @@ index 0000000..0c96d8a +} diff --git a/tools/gcc/constify_plugin.c b/tools/gcc/constify_plugin.c new file mode 100644 -index 0000000..93b181d +index 0000000..da184c5 --- /dev/null +++ b/tools/gcc/constify_plugin.c -@@ -0,0 +1,563 @@ +@@ -0,0 +1,564 @@ +/* + * Copyright 2011 by Emese Revfy <re.emese@gmail.com> + * Copyright 2011-2015 by PaX Team <pageexec@freemail.hu> @@ -115868,7 +115868,8 @@ index 0000000..93b181d + return NULL_TREE; + } + -+ error("%qE attribute used on type %qT that is not constified", name, type); ++ if (TYPE_FIELDS(type)) ++ error("%qE attribute used on type %qT that is not constified", name, type); + return NULL_TREE; +} + @@ -116195,10 +116196,10 @@ index 0000000..93b181d +} diff --git a/tools/gcc/gcc-common.h b/tools/gcc/gcc-common.h new file mode 100644 -index 0000000..d8ec362 +index 0000000..77f8462 --- /dev/null +++ b/tools/gcc/gcc-common.h -@@ -0,0 +1,666 @@ +@@ -0,0 +1,689 @@ +#ifndef GCC_COMMON_H_INCLUDED +#define GCC_COMMON_H_INCLUDED + @@ -116413,6 +116414,12 @@ index 0000000..d8ec362 + return false; + } +} ++ ++static inline void add_local_decl(struct function *fun, tree d) ++{ ++ gcc_assert(TREE_CODE(d) == VAR_DECL); ++ fun->local_decls = tree_cons(NULL_TREE, d, fun->local_decls); ++} +#endif + +#if BUILDING_GCC_VERSION <= 4006 @@ -116490,6 +116497,11 @@ index 0000000..d8ec362 +#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)) ++ ++static inline void varpool_add_new_variable(tree decl) ++{ ++ varpool_finalize_decl(decl); ++} +#endif + +#if BUILDING_GCC_VERSION == 4006 @@ -116606,8 +116618,10 @@ index 0000000..d8ec362 +#define add_referenced_var(var) +#define mark_sym_for_renaming(var) +#define varpool_mark_needed_node(node) ++#define create_var_ann(var) +#define TODO_dump_func 0 +#define TODO_dump_cgraph 0 ++ +#endif + +#if BUILDING_GCC_VERSION <= 4009 @@ -116628,6 +116642,11 @@ index 0000000..d8ec362 +#if BUILDING_GCC_VERSION <= 4009 +typedef struct rtx_def rtx_insn; + ++static inline void set_decl_section_name(tree node, const char *value) ++{ ++ DECL_SECTION_NAME(node) = build_string(strlen(value) + 1, value); ++} ++ +static inline gasm *as_a_gasm(gimple stmt) +{ + return stmt; @@ -116724,6 +116743,11 @@ index 0000000..d8ec362 + varpool_node::finalize_decl(decl); +} + ++static inline void varpool_add_new_variable(tree decl) ++{ ++ varpool_node::add(decl); ++} ++ +static inline cgraph_node_ptr cgraph_function_node(cgraph_node_ptr node, enum availability *availability) +{ + return node->function_symbol(availability); @@ -129688,7 +129712,7 @@ index 0000000..1d296ce +} diff --git a/tools/gcc/structleak_plugin.c b/tools/gcc/structleak_plugin.c new file mode 100644 -index 0000000..4436cbe +index 0000000..e9dbd4b --- /dev/null +++ b/tools/gcc/structleak_plugin.c @@ -0,0 +1,287 @@ @@ -129957,7 +129981,7 @@ index 0000000..4436cbe + return 1; + } + -+ if (strncmp(lang_hooks.name, "GNU C", 5) || !strncmp(lang_hooks.name, "GNU C+", 6)) { ++ if (strncmp(lang_hooks.name, "GNU C", 5) && !strncmp(lang_hooks.name, "GNU C+", 6)) { + inform(UNKNOWN_LOCATION, G_("%s supports C only"), plugin_name); + enable = false; + } diff --git a/4.0.4/0000_README b/4.0.4/0000_README index 34a1fb8..e870dbc 100644 --- a/4.0.4/0000_README +++ b/4.0.4/0000_README @@ -2,7 +2,7 @@ README ----------------------------------------------------------------------------- Individual Patch Descriptions: ----------------------------------------------------------------------------- -Patch: 4420_grsecurity-3.1-4.0.4-201505222222.patch +Patch: 4420_grsecurity-3.1-4.0.4-201505272113.patch From: http://www.grsecurity.net Desc: hardened-sources base patch from upstream grsecurity diff --git a/4.0.4/4420_grsecurity-3.1-4.0.4-201505222222.patch b/4.0.4/4420_grsecurity-3.1-4.0.4-201505272113.patch index 63e7f9a..b338663 100644 --- a/4.0.4/4420_grsecurity-3.1-4.0.4-201505222222.patch +++ b/4.0.4/4420_grsecurity-3.1-4.0.4-201505272113.patch @@ -373,7 +373,7 @@ index 4d68ec8..9546b75 100644 pcd. [PARIDE] diff --git a/Makefile b/Makefile -index 3d16bcc..a3b342e 100644 +index 3d16bcc..c31faf4 100644 --- a/Makefile +++ b/Makefile @@ -298,7 +298,9 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \ @@ -398,7 +398,7 @@ index 3d16bcc..a3b342e 100644 $(Q)$(MAKE) $(build)=scripts/basic $(Q)rm -f .tmp_quiet_recordmcount -@@ -622,6 +624,72 @@ endif +@@ -622,6 +624,74 @@ endif # Tell gcc to never replace conditional load with a non-conditional one KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0) @@ -445,9 +445,11 @@ index 3d16bcc..a3b342e 100644 +ifdef CONFIG_PAX_MEMORY_STRUCTLEAK +STRUCTLEAK_PLUGIN_CFLAGS := -fplugin=$(objtree)/tools/gcc/structleak_plugin.so -DSTRUCTLEAK_PLUGIN +endif ++INITIFY_PLUGIN_CFLAGS := -fplugin=$(objtree)/tools/gcc/initify_plugin.so -DINITIFY_PLUGIN +GCC_PLUGINS_CFLAGS := $(CONSTIFY_PLUGIN_CFLAGS) $(STACKLEAK_PLUGIN_CFLAGS) $(KALLOCSTAT_PLUGIN_CFLAGS) +GCC_PLUGINS_CFLAGS += $(KERNEXEC_PLUGIN_CFLAGS) $(CHECKER_PLUGIN_CFLAGS) $(COLORIZE_PLUGIN_CFLAGS) +GCC_PLUGINS_CFLAGS += $(SIZE_OVERFLOW_PLUGIN_CFLAGS) $(LATENT_ENTROPY_PLUGIN_CFLAGS) $(STRUCTLEAK_PLUGIN_CFLAGS) ++GCC_PLUGINS_CFLAGS += $(INITIFY_PLUGIN_CFLAGS) +GCC_PLUGINS_CFLAGS += $(RANDSTRUCT_PLUGIN_CFLAGS) +GCC_PLUGINS_AFLAGS := $(KERNEXEC_PLUGIN_AFLAGS) +export PLUGINCC GCC_PLUGINS_CFLAGS GCC_PLUGINS_AFLAGS CONSTIFY_PLUGIN LATENT_ENTROPY_PLUGIN_CFLAGS @@ -471,7 +473,7 @@ index 3d16bcc..a3b342e 100644 ifdef CONFIG_READABLE_ASM # Disable optimizations that make assembler listings hard to read. # reorder blocks reorders the control in the function -@@ -714,7 +782,7 @@ KBUILD_CFLAGS += $(call cc-option, -gsplit-dwarf, -g) +@@ -714,7 +784,7 @@ KBUILD_CFLAGS += $(call cc-option, -gsplit-dwarf, -g) else KBUILD_CFLAGS += -g endif @@ -480,7 +482,7 @@ index 3d16bcc..a3b342e 100644 endif ifdef CONFIG_DEBUG_INFO_DWARF4 KBUILD_CFLAGS += $(call cc-option, -gdwarf-4,) -@@ -884,7 +952,7 @@ export mod_sign_cmd +@@ -884,7 +954,7 @@ export mod_sign_cmd ifeq ($(KBUILD_EXTMOD),) @@ -489,7 +491,7 @@ index 3d16bcc..a3b342e 100644 vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \ $(core-y) $(core-m) $(drivers-y) $(drivers-m) \ -@@ -934,6 +1002,8 @@ endif +@@ -934,6 +1004,8 @@ endif # The actual objects are generated when descending, # make sure no implicit rule kicks in @@ -498,7 +500,7 @@ index 3d16bcc..a3b342e 100644 $(sort $(vmlinux-deps)): $(vmlinux-dirs) ; # Handle descending into subdirectories listed in $(vmlinux-dirs) -@@ -943,7 +1013,7 @@ $(sort $(vmlinux-deps)): $(vmlinux-dirs) ; +@@ -943,7 +1015,7 @@ $(sort $(vmlinux-deps)): $(vmlinux-dirs) ; # Error messages still appears in the original language PHONY += $(vmlinux-dirs) @@ -507,7 +509,7 @@ index 3d16bcc..a3b342e 100644 $(Q)$(MAKE) $(build)=$@ define filechk_kernel.release -@@ -986,10 +1056,13 @@ prepare1: prepare2 $(version_h) include/generated/utsrelease.h \ +@@ -986,10 +1058,13 @@ prepare1: prepare2 $(version_h) include/generated/utsrelease.h \ archprepare: archheaders archscripts prepare1 scripts_basic @@ -521,7 +523,7 @@ index 3d16bcc..a3b342e 100644 prepare: prepare0 # Generate some files -@@ -1103,6 +1176,8 @@ all: modules +@@ -1103,6 +1178,8 @@ all: modules # using awk while concatenating to the final file. PHONY += modules @@ -530,7 +532,7 @@ index 3d16bcc..a3b342e 100644 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.'; -@@ -1118,7 +1193,7 @@ modules.builtin: $(vmlinux-dirs:%=%/modules.builtin) +@@ -1118,7 +1195,7 @@ modules.builtin: $(vmlinux-dirs:%=%/modules.builtin) # Target to prepare building external modules PHONY += modules_prepare @@ -539,7 +541,7 @@ index 3d16bcc..a3b342e 100644 # Target to install modules PHONY += modules_install -@@ -1184,7 +1259,10 @@ MRPROPER_FILES += .config .config.old .version .old_version \ +@@ -1184,7 +1261,10 @@ MRPROPER_FILES += .config .config.old .version .old_version \ Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \ signing_key.priv signing_key.x509 x509.genkey \ extra_certificates signing_key.x509.keyid \ @@ -551,7 +553,7 @@ index 3d16bcc..a3b342e 100644 # clean - Delete most, but leave enough to build external modules # -@@ -1223,7 +1301,7 @@ distclean: mrproper +@@ -1223,7 +1303,7 @@ distclean: mrproper @find $(srctree) $(RCS_FIND_IGNORE) \ \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ @@ -560,7 +562,7 @@ index 3d16bcc..a3b342e 100644 -type f -print | xargs rm -f -@@ -1389,6 +1467,8 @@ PHONY += $(module-dirs) modules +@@ -1389,6 +1469,8 @@ PHONY += $(module-dirs) modules $(module-dirs): crmodverdir $(objtree)/Module.symvers $(Q)$(MAKE) $(build)=$(patsubst _module_%,%,$@) @@ -569,7 +571,7 @@ index 3d16bcc..a3b342e 100644 modules: $(module-dirs) @$(kecho) ' Building modules, stage 2.'; $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost -@@ -1529,17 +1609,21 @@ else +@@ -1529,17 +1611,21 @@ else target-dir = $(if $(KBUILD_EXTMOD),$(dir $<),$(dir $@)) endif @@ -595,7 +597,7 @@ index 3d16bcc..a3b342e 100644 $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) %.symtypes: %.c prepare scripts FORCE $(Q)$(MAKE) $(build)=$(build-dir) $(target-dir)$(notdir $@) -@@ -1551,11 +1635,15 @@ endif +@@ -1551,11 +1637,15 @@ endif $(build)=$(build-dir) # Make sure the latest headers are built for Documentation Documentation/: headers_install @@ -13969,7 +13971,7 @@ index e3531f8..e123f35 100644 ret; ENDPROC(cast6_xts_dec_8way) diff --git a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S -index 26d49eb..c0a8c84 100644 +index 26d49eb..8bf39c8 100644 --- a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S +++ b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S @@ -45,6 +45,7 @@ @@ -13988,6 +13990,15 @@ index 26d49eb..c0a8c84 100644 ret ################################################################ +@@ -330,7 +332,7 @@ ENDPROC(crc_pcl) + ## PCLMULQDQ tables + ## Table is 128 entries x 2 words (8 bytes) each + ################################################################ +-.section .rotata, "a", %progbits ++.section .rodata, "a", %progbits + .align 8 + K_table: + .long 0x493c7d27, 0x00000001 diff --git a/arch/x86/crypto/ghash-clmulni-intel_asm.S b/arch/x86/crypto/ghash-clmulni-intel_asm.S index 5d1e007..098cb4f 100644 --- a/arch/x86/crypto/ghash-clmulni-intel_asm.S @@ -39369,6 +39380,165 @@ index 956b7e5..b655045 100644 composite = kzalloc(sizeof(*composite), GFP_KERNEL); if (!composite) { +diff --git a/drivers/clk/hisilicon/clk-hi3620.c b/drivers/clk/hisilicon/clk-hi3620.c +index 2e4f6d4..b4cf487 100644 +--- a/drivers/clk/hisilicon/clk-hi3620.c ++++ b/drivers/clk/hisilicon/clk-hi3620.c +@@ -38,44 +38,44 @@ + #include "clk.h" + + /* clock parent list */ +-static const char *timer0_mux_p[] __initconst = { "osc32k", "timerclk01", }; +-static const char *timer1_mux_p[] __initconst = { "osc32k", "timerclk01", }; +-static const char *timer2_mux_p[] __initconst = { "osc32k", "timerclk23", }; +-static const char *timer3_mux_p[] __initconst = { "osc32k", "timerclk23", }; +-static const char *timer4_mux_p[] __initconst = { "osc32k", "timerclk45", }; +-static const char *timer5_mux_p[] __initconst = { "osc32k", "timerclk45", }; +-static const char *timer6_mux_p[] __initconst = { "osc32k", "timerclk67", }; +-static const char *timer7_mux_p[] __initconst = { "osc32k", "timerclk67", }; +-static const char *timer8_mux_p[] __initconst = { "osc32k", "timerclk89", }; +-static const char *timer9_mux_p[] __initconst = { "osc32k", "timerclk89", }; +-static const char *uart0_mux_p[] __initconst = { "osc26m", "pclk", }; +-static const char *uart1_mux_p[] __initconst = { "osc26m", "pclk", }; +-static const char *uart2_mux_p[] __initconst = { "osc26m", "pclk", }; +-static const char *uart3_mux_p[] __initconst = { "osc26m", "pclk", }; +-static const char *uart4_mux_p[] __initconst = { "osc26m", "pclk", }; +-static const char *spi0_mux_p[] __initconst = { "osc26m", "rclk_cfgaxi", }; +-static const char *spi1_mux_p[] __initconst = { "osc26m", "rclk_cfgaxi", }; +-static const char *spi2_mux_p[] __initconst = { "osc26m", "rclk_cfgaxi", }; ++static const char * const timer0_mux_p[] __initconst = { "osc32k", "timerclk01", }; ++static const char * const timer1_mux_p[] __initconst = { "osc32k", "timerclk01", }; ++static const char * const timer2_mux_p[] __initconst = { "osc32k", "timerclk23", }; ++static const char * const timer3_mux_p[] __initconst = { "osc32k", "timerclk23", }; ++static const char * const timer4_mux_p[] __initconst = { "osc32k", "timerclk45", }; ++static const char * const timer5_mux_p[] __initconst = { "osc32k", "timerclk45", }; ++static const char * const timer6_mux_p[] __initconst = { "osc32k", "timerclk67", }; ++static const char * const timer7_mux_p[] __initconst = { "osc32k", "timerclk67", }; ++static const char * const timer8_mux_p[] __initconst = { "osc32k", "timerclk89", }; ++static const char * const timer9_mux_p[] __initconst = { "osc32k", "timerclk89", }; ++static const char * const uart0_mux_p[] __initconst = { "osc26m", "pclk", }; ++static const char * const uart1_mux_p[] __initconst = { "osc26m", "pclk", }; ++static const char * const uart2_mux_p[] __initconst = { "osc26m", "pclk", }; ++static const char * const uart3_mux_p[] __initconst = { "osc26m", "pclk", }; ++static const char * const uart4_mux_p[] __initconst = { "osc26m", "pclk", }; ++static const char * const spi0_mux_p[] __initconst = { "osc26m", "rclk_cfgaxi", }; ++static const char * const spi1_mux_p[] __initconst = { "osc26m", "rclk_cfgaxi", }; ++static const char * const spi2_mux_p[] __initconst = { "osc26m", "rclk_cfgaxi", }; + /* share axi parent */ +-static const char *saxi_mux_p[] __initconst = { "armpll3", "armpll2", }; +-static const char *pwm0_mux_p[] __initconst = { "osc32k", "osc26m", }; +-static const char *pwm1_mux_p[] __initconst = { "osc32k", "osc26m", }; +-static const char *sd_mux_p[] __initconst = { "armpll2", "armpll3", }; +-static const char *mmc1_mux_p[] __initconst = { "armpll2", "armpll3", }; +-static const char *mmc1_mux2_p[] __initconst = { "osc26m", "mmc1_div", }; +-static const char *g2d_mux_p[] __initconst = { "armpll2", "armpll3", }; +-static const char *venc_mux_p[] __initconst = { "armpll2", "armpll3", }; +-static const char *vdec_mux_p[] __initconst = { "armpll2", "armpll3", }; +-static const char *vpp_mux_p[] __initconst = { "armpll2", "armpll3", }; +-static const char *edc0_mux_p[] __initconst = { "armpll2", "armpll3", }; +-static const char *ldi0_mux_p[] __initconst = { "armpll2", "armpll4", ++static const char * const saxi_mux_p[] __initconst = { "armpll3", "armpll2", }; ++static const char * const pwm0_mux_p[] __initconst = { "osc32k", "osc26m", }; ++static const char * const pwm1_mux_p[] __initconst = { "osc32k", "osc26m", }; ++static const char * const sd_mux_p[] __initconst = { "armpll2", "armpll3", }; ++static const char * const mmc1_mux_p[] __initconst = { "armpll2", "armpll3", }; ++static const char * const mmc1_mux2_p[] __initconst = { "osc26m", "mmc1_div", }; ++static const char * const g2d_mux_p[] __initconst = { "armpll2", "armpll3", }; ++static const char * const venc_mux_p[] __initconst = { "armpll2", "armpll3", }; ++static const char * const vdec_mux_p[] __initconst = { "armpll2", "armpll3", }; ++static const char * const vpp_mux_p[] __initconst = { "armpll2", "armpll3", }; ++static const char * const edc0_mux_p[] __initconst = { "armpll2", "armpll3", }; ++static const char * const ldi0_mux_p[] __initconst = { "armpll2", "armpll4", + "armpll3", "armpll5", }; +-static const char *edc1_mux_p[] __initconst = { "armpll2", "armpll3", }; +-static const char *ldi1_mux_p[] __initconst = { "armpll2", "armpll4", ++static const char * const edc1_mux_p[] __initconst = { "armpll2", "armpll3", }; ++static const char * const ldi1_mux_p[] __initconst = { "armpll2", "armpll4", + "armpll3", "armpll5", }; +-static const char *rclk_hsic_p[] __initconst = { "armpll3", "armpll2", }; +-static const char *mmc2_mux_p[] __initconst = { "armpll2", "armpll3", }; +-static const char *mmc3_mux_p[] __initconst = { "armpll2", "armpll3", }; ++static const char * const rclk_hsic_p[] __initconst = { "armpll3", "armpll2", }; ++static const char * const mmc2_mux_p[] __initconst = { "armpll2", "armpll3", }; ++static const char * const mmc3_mux_p[] __initconst = { "armpll2", "armpll3", }; + + + /* fixed rate clocks */ +diff --git a/drivers/clk/hisilicon/clk-hix5hd2.c b/drivers/clk/hisilicon/clk-hix5hd2.c +index 3f369c6..05f9ffd 100644 +--- a/drivers/clk/hisilicon/clk-hix5hd2.c ++++ b/drivers/clk/hisilicon/clk-hix5hd2.c +@@ -46,15 +46,15 @@ static struct hisi_fixed_rate_clock hix5hd2_fixed_rate_clks[] __initdata = { + { HIX5HD2_FIXED_83M, "83m", NULL, CLK_IS_ROOT, 83333333, }, + }; + +-static const char *sfc_mux_p[] __initconst = { ++static const char * const sfc_mux_p[] __initconst = { + "24m", "150m", "200m", "100m", "75m", }; + static u32 sfc_mux_table[] = {0, 4, 5, 6, 7}; + +-static const char *sdio_mux_p[] __initconst = { ++static const char * const sdio_mux_p[] __initconst = { + "75m", "100m", "50m", "15m", }; + static u32 sdio_mux_table[] = {0, 1, 2, 3}; + +-static const char *fephy_mux_p[] __initconst = { "25m", "125m"}; ++static const char * const fephy_mux_p[] __initconst = { "25m", "125m"}; + static u32 fephy_mux_table[] = {0, 1}; + + +diff --git a/drivers/clk/rockchip/clk-rk3188.c b/drivers/clk/rockchip/clk-rk3188.c +index 7eb684c..147c6fc 100644 +--- a/drivers/clk/rockchip/clk-rk3188.c ++++ b/drivers/clk/rockchip/clk-rk3188.c +@@ -704,7 +704,7 @@ static struct rockchip_clk_branch rk3188_clk_branches[] __initdata = { + GATE(ACLK_GPS, "aclk_gps", "aclk_peri", 0, RK2928_CLKGATE_CON(8), 13, GFLAGS), + }; + +-static const char *rk3188_critical_clocks[] __initconst = { ++static const char * const rk3188_critical_clocks[] __initconst = { + "aclk_cpu", + "aclk_peri", + "hclk_peri", +diff --git a/drivers/clk/rockchip/clk-rk3288.c b/drivers/clk/rockchip/clk-rk3288.c +index 05d7a0b..4fc131c 100644 +--- a/drivers/clk/rockchip/clk-rk3288.c ++++ b/drivers/clk/rockchip/clk-rk3288.c +@@ -771,7 +771,7 @@ static struct rockchip_clk_branch rk3288_clk_branches[] __initdata = { + GATE(0, "pclk_isp_in", "ext_isp", 0, RK3288_CLKGATE_CON(16), 3, GFLAGS), + }; + +-static const char *rk3288_critical_clocks[] __initconst = { ++static const char * const rk3288_critical_clocks[] __initconst = { + "aclk_cpu", + "aclk_peri", + "hclk_peri", +diff --git a/drivers/clk/rockchip/clk.h b/drivers/clk/rockchip/clk.h +index 58d2e3b..0c21b0d 100644 +--- a/drivers/clk/rockchip/clk.h ++++ b/drivers/clk/rockchip/clk.h +@@ -182,7 +182,7 @@ struct clk *rockchip_clk_register_mmc(const char *name, + const char **parent_names, u8 num_parents, + void __iomem *reg, int shift); + +-#define PNAME(x) static const char *x[] __initconst ++#define PNAME(x) static const char * const x[] __initconst + + enum rockchip_clk_branch_type { + branch_composite, +diff --git a/drivers/clk/samsung/clk.h b/drivers/clk/samsung/clk.h +index e4c7538..99c50cd 100644 +--- a/drivers/clk/samsung/clk.h ++++ b/drivers/clk/samsung/clk.h +@@ -260,7 +260,7 @@ struct samsung_gate_clock { + #define GATE_DA(_id, dname, cname, pname, o, b, f, gf, a) \ + __GATE(_id, dname, cname, pname, o, b, f, gf, a) + +-#define PNAME(x) static const char *x[] __initdata ++#define PNAME(x) static const char * const x[] __initconst + + /** + * struct samsung_clk_reg_dump: register dump of clock controller registers. diff --git a/drivers/clk/socfpga/clk-gate.c b/drivers/clk/socfpga/clk-gate.c index dd3a78c..386d49c 100644 --- a/drivers/clk/socfpga/clk-gate.c @@ -39437,6 +39607,58 @@ index de6da95..c98278b 100644 clk = clk_register(NULL, &pll_clk->hw.hw); if (WARN_ON(IS_ERR(clk))) { +diff --git a/drivers/clk/ti/composite.c b/drivers/clk/ti/composite.c +index 3654f61..81abe81 100644 +--- a/drivers/clk/ti/composite.c ++++ b/drivers/clk/ti/composite.c +@@ -69,7 +69,7 @@ struct component_clk { + struct list_head link; + }; + +-static const char * __initconst component_clk_types[] = { ++static const char * const __initconst component_clk_types[] = { + "gate", "divider", "mux" + }; + +diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c +index f870aad..04ba1e4 100644 +--- a/drivers/clk/zynq/clkc.c ++++ b/drivers/clk/zynq/clkc.c +@@ -85,22 +85,22 @@ static DEFINE_SPINLOCK(canmioclk_lock); + static DEFINE_SPINLOCK(dbgclk_lock); + static DEFINE_SPINLOCK(aperclk_lock); + +-static const char *armpll_parents[] __initconst = {"armpll_int", "ps_clk"}; +-static const char *ddrpll_parents[] __initconst = {"ddrpll_int", "ps_clk"}; +-static const char *iopll_parents[] __initconst = {"iopll_int", "ps_clk"}; +-static const char *gem0_mux_parents[] __initconst = {"gem0_div1", "dummy_name"}; +-static const char *gem1_mux_parents[] __initconst = {"gem1_div1", "dummy_name"}; +-static const char *can0_mio_mux2_parents[] __initconst = {"can0_gate", ++static const char * const armpll_parents[] __initconst = {"armpll_int", "ps_clk"}; ++static const char * const ddrpll_parents[] __initconst = {"ddrpll_int", "ps_clk"}; ++static const char * const iopll_parents[] __initconst = {"iopll_int", "ps_clk"}; ++static const char * gem0_mux_parents[] __initdata = {"gem0_div1", "dummy_name"}; ++static const char * gem1_mux_parents[] __initdata = {"gem1_div1", "dummy_name"}; ++static const char * const can0_mio_mux2_parents[] __initconst = {"can0_gate", + "can0_mio_mux"}; +-static const char *can1_mio_mux2_parents[] __initconst = {"can1_gate", ++static const char * const can1_mio_mux2_parents[] __initconst = {"can1_gate", + "can1_mio_mux"}; +-static const char *dbg_emio_mux_parents[] __initconst = {"dbg_div", ++static const char * dbg_emio_mux_parents[] __initdata = {"dbg_div", + "dummy_name"}; + +-static const char *dbgtrc_emio_input_names[] __initconst = {"trace_emio_clk"}; +-static const char *gem0_emio_input_names[] __initconst = {"gem0_emio_clk"}; +-static const char *gem1_emio_input_names[] __initconst = {"gem1_emio_clk"}; +-static const char *swdt_ext_clk_input_names[] __initconst = {"swdt_ext_clk"}; ++static const char * const dbgtrc_emio_input_names[] __initconst = {"trace_emio_clk"}; ++static const char * const gem0_emio_input_names[] __initconst = {"gem0_emio_clk"}; ++static const char * const gem1_emio_input_names[] __initconst = {"gem1_emio_clk"}; ++static const char * const swdt_ext_clk_input_names[] __initconst = {"swdt_ext_clk"}; + + static void __init zynq_clk_register_fclk(enum zynq_clk fclk, + const char *clk_name, void __iomem *fclk_ctrl_reg, diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c index b0c18ed..1713a80 100644 --- a/drivers/cpufreq/acpi-cpufreq.c @@ -45023,32 +45245,6 @@ index 87f7dff..7300125 100644 dsp_cmx_send(void *arg) { struct dsp_conf *conf; -diff --git a/drivers/leds/leds-clevo-mail.c b/drivers/leds/leds-clevo-mail.c -index 0f9ed1e..2715d6f 100644 ---- a/drivers/leds/leds-clevo-mail.c -+++ b/drivers/leds/leds-clevo-mail.c -@@ -40,7 +40,7 @@ static int __init clevo_mail_led_dmi_callback(const struct dmi_system_id *id) - * detected as working, but in reality it is not) as low as - * possible. - */ --static struct dmi_system_id clevo_mail_led_dmi_table[] __initdata = { -+static struct dmi_system_id clevo_mail_led_dmi_table[] __initconst = { - { - .callback = clevo_mail_led_dmi_callback, - .ident = "Clevo D410J", -diff --git a/drivers/leds/leds-ss4200.c b/drivers/leds/leds-ss4200.c -index 046cb70..6b20d39 100644 ---- a/drivers/leds/leds-ss4200.c -+++ b/drivers/leds/leds-ss4200.c -@@ -91,7 +91,7 @@ MODULE_PARM_DESC(nodetect, "Skip DMI-based hardware detection"); - * detected as working, but in reality it is not) as low as - * possible. - */ --static struct dmi_system_id nas_led_whitelist[] __initdata = { -+static struct dmi_system_id nas_led_whitelist[] __initconst = { - { - .callback = ss4200_led_dmi_callback, - .ident = "Intel SS4200-E", diff --git a/drivers/lguest/core.c b/drivers/lguest/core.c index 7dc93aa..8272379 100644 --- a/drivers/lguest/core.c @@ -50954,19 +51150,6 @@ index 3f155e7..0f4b1f0 100644 proc_create("devices", 0, proc_bus_pci_dir, &proc_bus_pci_dev_operations); proc_initialized = 1; -diff --git a/drivers/platform/chrome/chromeos_laptop.c b/drivers/platform/chrome/chromeos_laptop.c -index b84fdd6..b89d829 100644 ---- a/drivers/platform/chrome/chromeos_laptop.c -+++ b/drivers/platform/chrome/chromeos_laptop.c -@@ -479,7 +479,7 @@ static struct chromeos_laptop cr48 = { - .callback = chromeos_laptop_dmi_matched, \ - .driver_data = (void *)&board_ - --static struct dmi_system_id chromeos_laptop_dmi_table[] __initdata = { -+static struct dmi_system_id chromeos_laptop_dmi_table[] __initconst = { - { - .ident = "Samsung Series 5 550", - .matches = { diff --git a/drivers/platform/chrome/chromeos_pstore.c b/drivers/platform/chrome/chromeos_pstore.c index 3474920..acc9581 100644 --- a/drivers/platform/chrome/chromeos_pstore.c @@ -68436,7 +68619,7 @@ index e4141f2..d8263e8 100644 i += packet_length_size; if (copy_to_user(&buf[i], msg_ctx->msg, msg_ctx->msg_size)) diff --git a/fs/exec.c b/fs/exec.c -index 00400cf..b9dca28 100644 +index 00400cf..b9d927b 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -56,8 +56,20 @@ @@ -69253,7 +69436,7 @@ index 00400cf..b9dca28 100644 +#endif + +#ifdef CONFIG_PAX_SIZE_OVERFLOW -+void report_size_overflow(const char *file, unsigned int line, const char *func, const char *ssa_name) ++void __nocapture(1, 3, 4) report_size_overflow(const char *file, unsigned int line, const char *func, const char *ssa_name) +{ + printk(KERN_ERR "PAX: size overflow detected in function %s %s:%u %s", func, file, line, ssa_name); + dump_stack(); @@ -87783,6 +87966,27 @@ index b097cf8..3d40e14 100644 { if (x == 0) return 0; +diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h +index 630dd23..8c1dcb6b 100644 +--- a/include/asm-generic/bug.h ++++ b/include/asm-generic/bug.h +@@ -62,13 +62,13 @@ struct bug_entry { + * to provide better diagnostics. + */ + #ifndef __WARN_TAINT +-extern __printf(3, 4) ++extern __printf(3, 4) __nocapture(1, 3, 4) + void warn_slowpath_fmt(const char *file, const int line, + const char *fmt, ...); +-extern __printf(4, 5) ++extern __printf(4, 5) __nocapture(1, 4, 5) + void warn_slowpath_fmt_taint(const char *file, const int line, unsigned taint, + const char *fmt, ...); +-extern void warn_slowpath_null(const char *file, const int line); ++extern __nocapture(1) void warn_slowpath_null(const char *file, const int line); + #define WANT_WARN_ON_SLOWPATH + #define __WARN() warn_slowpath_null(__FILE__, __LINE__) + #define __WARN_printf(arg...) warn_slowpath_fmt(__FILE__, __LINE__, arg) diff --git a/include/asm-generic/cache.h b/include/asm-generic/cache.h index 1bfcfe5..e04c5c9 100644 --- a/include/asm-generic/cache.h @@ -88003,7 +88207,7 @@ index 72d8803..cb9749c 100644 + #endif /* __ASM_GENERIC_UACCESS_H */ diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h -index ac78910..775a306 100644 +index ac78910..8b5f068 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h @@ -234,6 +234,7 @@ @@ -88014,7 +88218,24 @@ index ac78910..775a306 100644 *(__vermagic) /* Kernel version magic */ \ . = ALIGN(8); \ VMLINUX_SYMBOL(__start___tracepoints_ptrs) = .; \ -@@ -727,17 +728,18 @@ +@@ -492,6 +493,7 @@ + KERNEL_CTORS() \ + MCOUNT_REC() \ + *(.init.rodata) \ ++ *(.init.rodata.*) \ + FTRACE_EVENTS() \ + TRACE_SYSCALLS() \ + KPROBE_BLACKLIST() \ +@@ -511,6 +513,8 @@ + + #define EXIT_DATA \ + *(.exit.data) \ ++ *(.exit.rodata) \ ++ *(.exit.rodata.*) \ + MEM_DISCARD(exit.data) \ + MEM_DISCARD(exit.rodata) + +@@ -727,17 +731,18 @@ * section in the linker script will go there too. @phdr should have * a leading colon. * @@ -88452,11 +88673,26 @@ index ab25814..d1540d1 100644 asmlinkage long compat_sys_lookup_dcookie(u32, u32, char __user *, compat_size_t); /* +diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h +index cdf13ca..ba5e086 100644 +--- a/include/linux/compiler-gcc.h ++++ b/include/linux/compiler-gcc.h +@@ -94,8 +94,8 @@ + */ + #define __pure __attribute__((pure)) + #define __aligned(x) __attribute__((aligned(x))) +-#define __printf(a, b) __attribute__((format(printf, a, b))) +-#define __scanf(a, b) __attribute__((format(scanf, a, b))) ++#define __printf(a, b) __attribute__((format(printf, a, b))) __nocapture(a, b) ++#define __scanf(a, b) __attribute__((format(scanf, a, b))) __nocapture(a, b) + #define noinline __attribute__((noinline)) + #define __attribute_const__ __attribute__((__const__)) + #define __maybe_unused __attribute__((unused)) diff --git a/include/linux/compiler-gcc4.h b/include/linux/compiler-gcc4.h -index 769e198..f670585 100644 +index 769e198..7ee7cb5 100644 --- a/include/linux/compiler-gcc4.h +++ b/include/linux/compiler-gcc4.h -@@ -39,9 +39,34 @@ +@@ -39,9 +39,38 @@ # define __compiletime_warning(message) __attribute__((warning(message))) # define __compiletime_error(message) __attribute__((error(message))) #endif /* __CHECKER__ */ @@ -88488,14 +88724,18 @@ index 769e198..f670585 100644 +#define __latent_entropy __attribute__((latent_entropy)) +#endif + ++#ifdef INITIFY_PLUGIN ++#define __nocapture(...) __attribute__((nocapture(__VA_ARGS__))) ++#endif ++ /* * Mark a position in code as unreachable. This can be used to * suppress control flow warnings after asm blocks that transfer diff --git a/include/linux/compiler-gcc5.h b/include/linux/compiler-gcc5.h -index efee493..06f9f63 100644 +index efee493..8aa8f6b 100644 --- a/include/linux/compiler-gcc5.h +++ b/include/linux/compiler-gcc5.h -@@ -28,6 +28,30 @@ +@@ -28,6 +28,34 @@ # define __compiletime_error(message) __attribute__((error(message))) #endif /* __CHECKER__ */ @@ -88523,11 +88763,15 @@ index efee493..06f9f63 100644 +#define __latent_entropy __attribute__((latent_entropy)) +#endif + ++#ifdef INITIFY_PLUGIN ++#define __nocapture(...) __attribute__((nocapture(__VA_ARGS__))) ++#endif ++ /* * Mark a position in code as unreachable. This can be used to * suppress control flow warnings after asm blocks that transfer diff --git a/include/linux/compiler.h b/include/linux/compiler.h -index 1b45e4a..33028cd 100644 +index 1b45e4a..eff29a7 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -5,11 +5,14 @@ @@ -88639,7 +88883,7 @@ index 1b45e4a..33028cd 100644 data_access_exceeds_word_size(); barrier(); } -@@ -364,6 +386,34 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s +@@ -364,6 +386,38 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s # define __attribute_const__ /* unimplemented */ #endif @@ -88671,10 +88915,14 @@ index 1b45e4a..33028cd 100644 +# define __latent_entropy +#endif + ++#ifndef __nocapture ++# define __nocapture(...) ++#endif ++ /* * Tell gcc if a function is cold. The compiler will assume any path * directly leading to the call is unlikely. -@@ -373,6 +423,22 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s +@@ -373,6 +427,22 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s #define __cold #endif @@ -88697,7 +88945,7 @@ index 1b45e4a..33028cd 100644 /* Simple shorthand for a section definition */ #ifndef __section # define __section(S) __attribute__ ((__section__(#S))) -@@ -387,6 +453,8 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s +@@ -387,6 +457,8 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) #endif @@ -88706,7 +88954,7 @@ index 1b45e4a..33028cd 100644 /* Is this type a native word size -- useful for atomic operations */ #ifndef __native_word # define __native_word(t) (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) -@@ -466,8 +534,9 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s +@@ -466,8 +538,9 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s */ #define __ACCESS_ONCE(x) ({ \ __maybe_unused typeof(x) __var = (__force typeof(x)) 0; \ @@ -89181,7 +89429,7 @@ index 8293262..2b3b8bd 100644 extern bool frontswap_enabled; extern struct frontswap_ops * diff --git a/include/linux/fs.h b/include/linux/fs.h -index 52cc449..58b25c9 100644 +index 52cc449..31f35cb 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -410,7 +410,7 @@ struct address_space { @@ -89248,6 +89496,15 @@ index 52cc449..58b25c9 100644 struct inode_operations { struct dentry * (*lookup) (struct inode *,struct dentry *, unsigned int); +@@ -2269,7 +2270,7 @@ extern int register_chrdev_region(dev_t, unsigned, const char *); + extern int __register_chrdev(unsigned int major, unsigned int baseminor, + unsigned int count, const char *name, + const struct file_operations *fops); +-extern void __unregister_chrdev(unsigned int major, unsigned int baseminor, ++extern __nocapture(4) void __unregister_chrdev(unsigned int major, unsigned int baseminor, + unsigned int count, const char *name); + extern void unregister_chrdev_region(dev_t, unsigned); + extern void chrdev_show(struct seq_file *,off_t); @@ -2918,4 +2919,14 @@ static inline bool dir_relax(struct inode *inode) return !IS_DEADDIR(inode); } @@ -90975,14 +91232,14 @@ index dd1109f..4f4fdda 100644 raw_spinlock_t lock; struct cpumask *percpu_enabled; diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h -index 676d730..5e05daec 100644 +index 676d730..8d3a1ad 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -40,6 +40,7 @@ struct device_node; struct irq_domain; struct of_device_id; struct irq_chip; -+struct irq_chip_no_const; ++typedef struct irq_chip __no_const irq_chip_no_const; struct irq_data; /* Number of irqs reserved for a legacy isa controller */ @@ -103673,6 +103930,41 @@ index 4abda07..b9d3765 100644 { phys_addr_t paddr = dma_to_phys(hwdev, dev_addr); +diff --git a/lib/test-hexdump.c b/lib/test-hexdump.c +index daf29a39..56f44ac 100644 +--- a/lib/test-hexdump.c ++++ b/lib/test-hexdump.c +@@ -18,26 +18,26 @@ static const unsigned char data_b[] = { + + static const unsigned char data_a[] = ".2.{....p..$}.4...1.....L...C..."; + +-static const char *test_data_1_le[] __initconst = { ++static const char * const test_data_1_le[] __initconst = { + "be", "32", "db", "7b", "0a", "18", "93", "b2", + "70", "ba", "c4", "24", "7d", "83", "34", "9b", + "a6", "9c", "31", "ad", "9c", "0f", "ac", "e9", + "4c", "d1", "19", "99", "43", "b1", "af", "0c", + }; + +-static const char *test_data_2_le[] __initconst = { ++static const char * const test_data_2_le[] __initconst = { + "32be", "7bdb", "180a", "b293", + "ba70", "24c4", "837d", "9b34", + "9ca6", "ad31", "0f9c", "e9ac", + "d14c", "9919", "b143", "0caf", + }; + +-static const char *test_data_4_le[] __initconst = { ++static const char * const test_data_4_le[] __initconst = { + "7bdb32be", "b293180a", "24c4ba70", "9b34837d", + "ad319ca6", "e9ac0f9c", "9919d14c", "0cafb143", + }; + +-static const char *test_data_8_le[] __initconst = { ++static const char * const test_data_8_le[] __initconst = { + "b293180a7bdb32be", "9b34837d24c4ba70", + "e9ac0f9cad319ca6", "0cafb1439919d14c", + }; diff --git a/lib/usercopy.c b/lib/usercopy.c index 4f5b1dd..7cab418 100644 --- a/lib/usercopy.c @@ -118922,10 +119214,10 @@ index 0000000..de92ed9 +randomize_layout_seed.h diff --git a/tools/gcc/Makefile b/tools/gcc/Makefile new file mode 100644 -index 0000000..a51677e +index 0000000..4945d82 --- /dev/null +++ b/tools/gcc/Makefile -@@ -0,0 +1,52 @@ +@@ -0,0 +1,54 @@ +#CC := gcc +#PLUGIN_SOURCE_FILES := pax_plugin.c +#PLUGIN_OBJECT_FILES := $(patsubst %.c,%.o,$(PLUGIN_SOURCE_FILES)) @@ -118952,6 +119244,7 @@ index 0000000..a51677e +$(HOSTLIBS)-y += colorize_plugin.so +$(HOSTLIBS)-$(CONFIG_PAX_LATENT_ENTROPY) += latent_entropy_plugin.so +$(HOSTLIBS)-$(CONFIG_PAX_MEMORY_STRUCTLEAK) += structleak_plugin.so ++$(HOSTLIBS)-y += initify_plugin.so +$(HOSTLIBS)-$(CONFIG_GRKERNSEC_RANDSTRUCT) += randomize_layout_plugin.so + +subdir-$(CONFIG_PAX_SIZE_OVERFLOW) := size_overflow_plugin @@ -118967,6 +119260,7 @@ index 0000000..a51677e +colorize_plugin-objs := colorize_plugin.o +latent_entropy_plugin-objs := latent_entropy_plugin.o +structleak_plugin-objs := structleak_plugin.o ++initify_plugin-objs := initify_plugin.o +randomize_layout_plugin-objs := randomize_layout_plugin.o + +$(obj)/randomize_layout_plugin.o: $(objtree)/$(obj)/randomize_layout_seed.h @@ -119357,10 +119651,10 @@ index 0000000..0c96d8a +} diff --git a/tools/gcc/constify_plugin.c b/tools/gcc/constify_plugin.c new file mode 100644 -index 0000000..93b181d +index 0000000..da184c5 --- /dev/null +++ b/tools/gcc/constify_plugin.c -@@ -0,0 +1,563 @@ +@@ -0,0 +1,564 @@ +/* + * Copyright 2011 by Emese Revfy <re.emese@gmail.com> + * Copyright 2011-2015 by PaX Team <pageexec@freemail.hu> @@ -119599,7 +119893,8 @@ index 0000000..93b181d + return NULL_TREE; + } + -+ error("%qE attribute used on type %qT that is not constified", name, type); ++ if (TYPE_FIELDS(type)) ++ error("%qE attribute used on type %qT that is not constified", name, type); + return NULL_TREE; +} + @@ -119926,10 +120221,10 @@ index 0000000..93b181d +} diff --git a/tools/gcc/gcc-common.h b/tools/gcc/gcc-common.h new file mode 100644 -index 0000000..d8ec362 +index 0000000..77f8462 --- /dev/null +++ b/tools/gcc/gcc-common.h -@@ -0,0 +1,666 @@ +@@ -0,0 +1,689 @@ +#ifndef GCC_COMMON_H_INCLUDED +#define GCC_COMMON_H_INCLUDED + @@ -120144,6 +120439,12 @@ index 0000000..d8ec362 + return false; + } +} ++ ++static inline void add_local_decl(struct function *fun, tree d) ++{ ++ gcc_assert(TREE_CODE(d) == VAR_DECL); ++ fun->local_decls = tree_cons(NULL_TREE, d, fun->local_decls); ++} +#endif + +#if BUILDING_GCC_VERSION <= 4006 @@ -120221,6 +120522,11 @@ index 0000000..d8ec362 +#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)) ++ ++static inline void varpool_add_new_variable(tree decl) ++{ ++ varpool_finalize_decl(decl); ++} +#endif + +#if BUILDING_GCC_VERSION == 4006 @@ -120337,8 +120643,10 @@ index 0000000..d8ec362 +#define add_referenced_var(var) +#define mark_sym_for_renaming(var) +#define varpool_mark_needed_node(node) ++#define create_var_ann(var) +#define TODO_dump_func 0 +#define TODO_dump_cgraph 0 ++ +#endif + +#if BUILDING_GCC_VERSION <= 4009 @@ -120359,6 +120667,11 @@ index 0000000..d8ec362 +#if BUILDING_GCC_VERSION <= 4009 +typedef struct rtx_def rtx_insn; + ++static inline void set_decl_section_name(tree node, const char *value) ++{ ++ DECL_SECTION_NAME(node) = build_string(strlen(value) + 1, value); ++} ++ +static inline gasm *as_a_gasm(gimple stmt) +{ + return stmt; @@ -120455,6 +120768,11 @@ index 0000000..d8ec362 + varpool_node::finalize_decl(decl); +} + ++static inline void varpool_add_new_variable(tree decl) ++{ ++ varpool_node::add(decl); ++} ++ +static inline cgraph_node_ptr cgraph_function_node(cgraph_node_ptr node, enum availability *availability) +{ + return node->function_symbol(availability); @@ -120610,6 +120928,439 @@ index 0000000..7514850 + HASH=`echo -n "$SEED" | sha256sum | cut -d" " -f1 | tr -d ' \n'` + echo "#define RANDSTRUCT_HASHED_SEED \"$HASH\"" > "$2" +fi +diff --git a/tools/gcc/initify_plugin.c b/tools/gcc/initify_plugin.c +new file mode 100644 +index 0000000..125442a +--- /dev/null ++++ b/tools/gcc/initify_plugin.c +@@ -0,0 +1,427 @@ ++/* ++ * Copyright 2011-2015 by Emese Revfy <re.emese@gmail.com> ++ * Licensed under the GPL v2, or (at your option) v3 ++ * ++ * Homepage: ++ * https://github.com/ephox-gcc-plugins/initify ++ * ++ * Move string constants (__func__ and function string arguments marked by the nocapture attribute) ++ * only referenced in __init/__exit functions to __initconst/__exitconst sections. ++ * ++ * Usage: ++ * $ make ++ * $ make run ++ */ ++ ++#include "gcc-common.h" ++ ++int plugin_is_GPL_compatible; ++ ++static struct plugin_info initify_plugin_info = { ++ .version = "20150524a", ++ .help = "initify_plugin\n", ++}; ++ ++static tree handle_nocapture_attribute(tree *node, tree __unused name, tree args, int __unused flags, bool *no_add_attrs) ++{ ++ tree orig_attr, arg; ++ ++ *no_add_attrs = true; ++ switch (TREE_CODE(*node)) { ++ case FUNCTION_DECL: ++ case FUNCTION_TYPE: ++ case METHOD_TYPE: ++ break; ++ ++ case TYPE_DECL: { ++ const_tree fntype = TREE_TYPE(*node); ++ ++ if (TREE_CODE(fntype) == POINTER_TYPE) ++ fntype = TREE_TYPE(fntype); ++ if (TREE_CODE(fntype) == FUNCTION_TYPE || TREE_CODE(fntype) == METHOD_TYPE) ++ break; ++ // FALLTHROUGH ++ } ++ ++ default: ++ error("%s: %qE attribute only applies to functions", __func__, name); ++ debug_tree(*node); ++ return NULL_TREE; ++ } ++ ++ for (arg = args; arg; arg = TREE_CHAIN(arg)) { ++ tree position = TREE_VALUE(arg); ++ ++ if (TREE_CODE(position) != INTEGER_CST) { ++ error("%s: parameter isn't an integer", __func__); ++ debug_tree(arg); ++ return NULL_TREE; ++ } ++ } ++ ++ orig_attr = lookup_attribute("nocapture", DECL_ATTRIBUTES(*node)); ++ if (orig_attr) ++ chainon(TREE_VALUE(orig_attr), args); ++ else ++ *no_add_attrs = false; ++ ++ return NULL_TREE; ++} ++ ++static struct attribute_spec nocapture_attr = { ++ .name = "nocapture", ++ .min_length = 1, ++ .max_length = -1, ++ .decl_required = true, ++ .type_required = false, ++ .function_type_required = false, ++ .handler = handle_nocapture_attribute, ++#if BUILDING_GCC_VERSION >= 4007 ++ .affects_type_identity = false ++#endif ++}; ++ ++static void register_attributes(void __unused *event_data, void __unused *data) ++{ ++ register_attribute(&nocapture_attr); ++} ++ ++static const char *get_init_exit_section(const_tree decl) ++{ ++ const_tree section; ++ tree attr_value; ++ ++ section = lookup_attribute("section", DECL_ATTRIBUTES(decl)); ++ if (!section) ++ return NULL; ++ ++ gcc_assert(TREE_VALUE(section)); ++ for (attr_value = TREE_VALUE(section); attr_value; attr_value = TREE_CHAIN(attr_value)) { ++ const char *str = TREE_STRING_POINTER(TREE_VALUE(attr_value)); ++ ++ if (!strncmp(str, ".init.", 6)) ++ return str; ++ ++ if (!strncmp(str, ".exit.", 6)) ++ return str; ++ } ++ ++ return NULL; ++} ++ ++static tree get_string_cst(tree var) ++{ ++ if (var == NULL_TREE) ++ return NULL_TREE; ++ ++ if (TREE_CODE(var) == STRING_CST) ++ return var; ++ ++ switch (TREE_CODE_CLASS(TREE_CODE(var))) { ++ case tcc_expression: ++ case tcc_reference: { ++ int i; ++ ++ for (i = 0; i < TREE_OPERAND_LENGTH(var); i++) { ++ tree ret = get_string_cst(TREE_OPERAND(var, i)); ++ if (ret != NULL_TREE) ++ return ret; ++ } ++ break; ++ } ++ ++ default: ++ break; ++ } ++ ++ return NULL_TREE; ++} ++ ++static bool set_init_exit_section(tree decl, bool initexit) ++{ ++ const char *str; ++ ++ gcc_assert(DECL_P(decl)); ++ ++ str = get_init_exit_section(decl); ++ if (str) ++ return false; ++ ++ if (initexit) ++ set_decl_section_name(decl, ".init.rodata.str"); ++ else ++ set_decl_section_name(decl, ".exit.rodata.str"); ++ return true; ++} ++ ++static void search_local_strs(bool initexit) ++{ ++ unsigned int i; ++ tree var; ++ ++ FOR_EACH_LOCAL_DECL(cfun, i, var) { ++ tree str, init_val = DECL_INITIAL(var); ++ ++ if (init_val == NULL_TREE) ++ continue; ++ if (strcmp(DECL_NAME_POINTER(var), "__func__")) ++ continue; ++ ++ str = get_string_cst(init_val); ++ gcc_assert(str); ++ ++ if (set_init_exit_section(var, initexit)) ++ ;//inform(DECL_SOURCE_LOCATION(var), "initified local var: %s: %s", DECL_NAME_POINTER(current_function_decl), TREE_STRING_POINTER(str)); ++ } ++} ++ ++static tree create_tmp_assign(gcall *stmt, unsigned int num) ++{ ++ tree str, type, decl, arg = gimple_call_arg(stmt, num); ++ ++ str = get_string_cst(arg); ++ decl = build_decl(DECL_SOURCE_LOCATION(current_function_decl), VAR_DECL, create_tmp_var_name("cicus"), TREE_TYPE(str)); ++ ++ type = TREE_TYPE(TREE_TYPE(decl)); ++ TYPE_READONLY(type) = 1; ++ TREE_PUBLIC(type) = 0; ++ ++ DECL_INITIAL(decl) = str; ++ DECL_CONTEXT(decl) = current_function_decl; ++ DECL_ARTIFICIAL(decl) = 1; ++ ++ TREE_STATIC(decl) = 1; ++ TREE_READONLY(decl) = 1; ++ TREE_ADDRESSABLE(decl) = 1; ++ TREE_USED(decl) = 1; ++ ++ add_referenced_var(decl); ++ add_local_decl(cfun, decl); ++ ++ varpool_add_new_variable(decl); ++ varpool_mark_needed_node(varpool_node(decl)); ++ ++ DECL_CHAIN(decl) = BLOCK_VARS(DECL_INITIAL(current_function_decl)); ++ BLOCK_VARS(DECL_INITIAL (current_function_decl)) = decl; ++ ++ decl = build_unary_op(DECL_SOURCE_LOCATION(current_function_decl), ADDR_EXPR, decl, 0); ++ gimple_call_set_arg(stmt, num, decl); ++ update_stmt(stmt); ++ ++ return TREE_OPERAND(decl, 0); ++} ++ ++static bool is_vararg(const_tree fn) ++{ ++ tree arg_list; ++ ++ arg_list = TYPE_ARG_TYPES(TREE_TYPE(fn)); ++ if (arg_list == NULL_TREE) ++ return false; ++ ++ return tree_last(arg_list) != void_list_node; ++} ++ ++// __printf(1, 0), 0: turn off the varargs checking ++static bool check_varargs(const_tree attr) ++{ ++ const_tree attr_val; ++ ++ for (attr_val = TREE_VALUE(attr); attr_val; attr_val = TREE_CHAIN(attr_val)) { ++ if (TREE_VALUE(attr_val) == integer_zero_node) ++ return false; ++ } ++ return true; ++} ++ ++static bool is_in_nocapture_attr_value(const_gimple stmt, unsigned int num) ++{ ++ unsigned int attr_arg_val = 0; ++ tree attr_val; ++ const_tree attr; ++ const_tree fndecl = gimple_call_fndecl(stmt); ++ ++ gcc_assert(DECL_ABSTRACT_ORIGIN(fndecl) == NULL_TREE); ++ ++ attr = lookup_attribute("nocapture", DECL_ATTRIBUTES(fndecl)); ++ for (attr_val = TREE_VALUE(attr); attr_val; attr_val = TREE_CHAIN(attr_val)) { ++ attr_arg_val = (unsigned int)tree_to_uhwi(TREE_VALUE(attr_val)); ++ ++ if (attr_arg_val == num + 1) ++ return true; ++ } ++ ++ if (!is_vararg(fndecl)) ++ return false; ++ if (!check_varargs(attr)) ++ return false; ++ return attr_arg_val < num + 1; ++} ++ ++static void search_str_param(gcall *stmt, bool initexit) ++{ ++ unsigned int num; ++ ++ for (num = 0; num < gimple_call_num_args(stmt); num++) { ++ tree var, str, arg = gimple_call_arg(stmt, num); ++ ++ str = get_string_cst(arg); ++ if (str == NULL_TREE) ++ continue; ++ ++ if (!is_in_nocapture_attr_value(stmt, num)) ++ continue; ++ ++ var = create_tmp_assign(stmt, num); ++ if (set_init_exit_section(var, initexit)) ++ ;//inform(gimple_location(stmt), "initified function arg: %s: [%s]", DECL_NAME_POINTER(current_function_decl), TREE_STRING_POINTER(str)); ++ } ++} ++ ++static bool has_nocapture_attr(const gcall *stmt) ++{ ++ const_tree attr, fndecl = gimple_call_fndecl(stmt); ++ ++ if (fndecl == NULL_TREE) ++ return false; ++ ++ attr = lookup_attribute("nocapture", DECL_ATTRIBUTES(fndecl)); ++ return attr != NULL_TREE; ++} ++ ++static void search_const_strs(bool initexit) ++{ ++ basic_block bb; ++ ++ FOR_ALL_BB_FN(bb, cfun) { ++ gimple_stmt_iterator gsi; ++ ++ for (gsi = gsi_start_bb(bb); !gsi_end_p(gsi); gsi_next(&gsi)) { ++ gcall *call_stmt; ++ gimple stmt = gsi_stmt(gsi); ++ ++ if (!is_gimple_call(stmt)) ++ continue; ++ ++ call_stmt = as_a_gcall(stmt); ++ if (has_nocapture_attr(call_stmt)) ++ search_str_param(call_stmt, initexit); ++ } ++ } ++} ++ ++static unsigned int handle_function(void) ++{ ++ bool initexit; ++ const char *section = get_init_exit_section(current_function_decl); ++ ++ if (!section) ++ return 0; ++ ++ initexit = !strncmp(section, ".init.", 6); ++ search_local_strs(initexit); ++ search_const_strs(initexit); ++ ++ return 0; ++} ++ ++#if BUILDING_GCC_VERSION >= 4009 ++namespace { ++static const struct pass_data initify_plugin_pass_data = { ++#else ++static struct gimple_opt_pass initify_plugin_pass = { ++ .pass = { ++#endif ++ .type = GIMPLE_PASS, ++ .name = "initify_plugin", ++#if BUILDING_GCC_VERSION >= 4008 ++ .optinfo_flags = OPTGROUP_NONE, ++#endif ++#if BUILDING_GCC_VERSION >= 5000 ++#elif BUILDING_GCC_VERSION >= 4009 ++ .has_gate = false, ++ .has_execute = true, ++#else ++ .gate = NULL, ++ .execute = handle_function, ++ .sub = NULL, ++ .next = NULL, ++ .static_pass_number = 0, ++#endif ++ .tv_id = TV_NONE, ++ .properties_required = 0, ++ .properties_provided = 0, ++ .properties_destroyed = 0, ++ .todo_flags_start = 0, ++ .todo_flags_finish = TODO_dump_func | TODO_verify_ssa | TODO_verify_stmts | TODO_remove_unused_locals | TODO_update_ssa_no_phi | TODO_cleanup_cfg | TODO_ggc_collect | TODO_verify_flow ++#if BUILDING_GCC_VERSION < 4009 ++ } ++#endif ++}; ++ ++#if BUILDING_GCC_VERSION >= 4009 ++class initify_plugin_pass : public gimple_opt_pass { ++public: ++ initify_plugin_pass() : gimple_opt_pass(initify_plugin_pass_data, g) {} ++#if BUILDING_GCC_VERSION >= 5000 ++ virtual unsigned int execute(function *) { return handle_function(); } ++#else ++ unsigned int execute() { return handle_function(); } ++#endif ++}; ++} ++ ++static struct opt_pass *make_initify_plugin_pass(void) ++{ ++ return new initify_plugin_pass(); ++} ++#else ++static struct opt_pass *make_initify_plugin_pass(void) ++{ ++ return &initify_plugin_pass.pass; ++} ++#endif ++ ++static unsigned int (*old_section_type_flags)(tree decl, const char *name, int reloc); ++ ++static unsigned int initify_section_type_flags(tree decl, const char *name, int reloc) ++{ ++ if (!strcmp(name, ".init.rodata.str") || !strcmp(name, ".exit.rodata.str")) { ++ gcc_assert(TREE_CODE(decl) == VAR_DECL); ++ gcc_assert(DECL_INITIAL(decl)); ++ gcc_assert(TREE_CODE(DECL_INITIAL(decl)) == STRING_CST); ++ ++ return 1 | SECTION_MERGE | SECTION_STRINGS; ++ } ++ ++ return old_section_type_flags(decl, name, reloc); ++} ++ ++static void initify_start_unit(void __unused *gcc_data, void __unused *user_data) ++{ ++ old_section_type_flags = targetm.section_type_flags; ++ targetm.section_type_flags = initify_section_type_flags; ++} ++ ++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 initify_plugin_pass_info; ++ ++ initify_plugin_pass_info.pass = make_initify_plugin_pass(); ++ initify_plugin_pass_info.reference_pass_name = "nrv"; ++ initify_plugin_pass_info.ref_pass_instance_number = 1; ++ initify_plugin_pass_info.pos_op = PASS_POS_INSERT_AFTER; ++ ++ if (!plugin_default_version_check(version, &gcc_version)) { ++ error(G_("incompatible gcc/plugin versions")); ++ return 1; ++ } ++ ++ register_callback(plugin_name, PLUGIN_INFO, NULL, &initify_plugin_info); ++ register_callback(plugin_name, PLUGIN_PASS_MANAGER_SETUP, NULL, &initify_plugin_pass_info); ++ register_callback(plugin_name, PLUGIN_ATTRIBUTES, register_attributes, NULL); ++ register_callback(plugin_name, PLUGIN_START_UNIT, initify_start_unit, NULL); ++ ++ return 0; ++} diff --git a/tools/gcc/kallocstat_plugin.c b/tools/gcc/kallocstat_plugin.c new file mode 100644 index 0000000..457d54e |