Re: [PATCH] Init: fixed an error caused by using __initdata instead of __initconst

From: kbuild test robot
Date: Thu Jan 09 2020 - 11:27:10 EST


Hi,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linux/master]
[also build test ERROR on linus/master v5.5-rc5 next-20200108]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/carlosteniswarrior-gmail-com/Init-fixed-an-error-caused-by-using-__initdata-instead-of-__initconst/20200109-034253
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1522d9da40bdfe502c91163e6d769332897201fa
config: parisc-c3000_defconfig (attached as .config)
compiler: hppa-linux-gcc (GCC) 7.5.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.5.0 make.cross ARCH=parisc

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

All error/warnings (new ones prefixed by >>):

>> init/main.c:983:20: error: initcall_level_names causes a section type conflict with __setup_str_set_debug_rodata
static const char *initcall_level_names[] __initconst = {
^~~~~~~~~~~~~~~~~~~~
In file included from include/linux/printk.h:6:0,
from include/linux/kernel.h:15,
from include/linux/list.h:9,
from include/linux/module.h:12,
from init/main.c:17:
include/linux/init.h:254:20: note: '__setup_str_set_debug_rodata' was declared here
static const char __setup_str_##unique_id[] __initconst \
^
>> include/linux/init.h:262:2: note: in expansion of macro '__setup_param'
__setup_param(str, fn, fn, 0)
^~~~~~~~~~~~~
>> init/main.c:1075:1: note: in expansion of macro '__setup'
__setup("rodata=", set_debug_rodata);
^~~~~~~

vim +983 init/main.c

981
982 /* Keep these in sync with initcalls in include/linux/init.h */
> 983 static const char *initcall_level_names[] __initconst = {
984 "pure",
985 "core",
986 "postcore",
987 "arch",
988 "subsys",
989 "fs",
990 "device",
991 "late",
992 };
993
994 static void __init do_initcall_level(int level)
995 {
996 initcall_entry_t *fn;
997
998 strcpy(initcall_command_line, saved_command_line);
999 parse_args(initcall_level_names[level],
1000 initcall_command_line, __start___param,
1001 __stop___param - __start___param,
1002 level, level,
1003 NULL, &repair_env_string);
1004
1005 trace_initcall_level(initcall_level_names[level]);
1006 for (fn = initcall_levels[level]; fn < initcall_levels[level+1]; fn++)
1007 do_one_initcall(initcall_from_entry(fn));
1008 }
1009
1010 static void __init do_initcalls(void)
1011 {
1012 int level;
1013
1014 for (level = 0; level < ARRAY_SIZE(initcall_levels) - 1; level++)
1015 do_initcall_level(level);
1016 }
1017
1018 /*
1019 * Ok, the machine is now initialized. None of the devices
1020 * have been touched yet, but the CPU subsystem is up and
1021 * running, and memory and process management works.
1022 *
1023 * Now we can finally start doing some real work..
1024 */
1025 static void __init do_basic_setup(void)
1026 {
1027 cpuset_init_smp();
1028 driver_init();
1029 init_irq_proc();
1030 do_ctors();
1031 usermodehelper_enable();
1032 do_initcalls();
1033 }
1034
1035 static void __init do_pre_smp_initcalls(void)
1036 {
1037 initcall_entry_t *fn;
1038
1039 trace_initcall_level("early");
1040 for (fn = __initcall_start; fn < __initcall0_start; fn++)
1041 do_one_initcall(initcall_from_entry(fn));
1042 }
1043
1044 static int run_init_process(const char *init_filename)
1045 {
1046 argv_init[0] = init_filename;
1047 pr_info("Run %s as init process\n", init_filename);
1048 return do_execve(getname_kernel(init_filename),
1049 (const char __user *const __user *)argv_init,
1050 (const char __user *const __user *)envp_init);
1051 }
1052
1053 static int try_to_run_init_process(const char *init_filename)
1054 {
1055 int ret;
1056
1057 ret = run_init_process(init_filename);
1058
1059 if (ret && ret != -ENOENT) {
1060 pr_err("Starting init: %s exists but couldn't execute it (error %d)\n",
1061 init_filename, ret);
1062 }
1063
1064 return ret;
1065 }
1066
1067 static noinline void __init kernel_init_freeable(void);
1068
1069 #if defined(CONFIG_STRICT_KERNEL_RWX) || defined(CONFIG_STRICT_MODULE_RWX)
1070 bool rodata_enabled __ro_after_init = true;
1071 static int __init set_debug_rodata(char *str)
1072 {
1073 return strtobool(str, &rodata_enabled);
1074 }
> 1075 __setup("rodata=", set_debug_rodata);
1076 #endif
1077

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx Intel Corporation

Attachment: .config.gz
Description: application/gzip