[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202301111205.dCVHxb4N-lkp@intel.com>
Date: Wed, 11 Jan 2023 13:02:46 +0800
From: kernel test robot <lkp@...el.com>
To: Youling Tang <tangyouling@...ngson.cn>,
Huacai Chen <chenhuacai@...nel.org>,
Xi Ruoyao <xry111@...111.site>,
Jinyang He <hejinyang@...ngson.cn>
Cc: oe-kbuild-all@...ts.linux.dev, Xuerui Wang <kernel@...0n.name>,
loongarch@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/4] LoongArch: Add support for kernel address space
layout randomization (KASLR)
Hi Youling,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.2-rc3 next-20230111]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Youling-Tang/LoongArch-Use-trampoline-for-exception-handlers-and-kill-la-abs/20230109-171344
patch link: https://lore.kernel.org/r/1673255274-18238-5-git-send-email-tangyouling%40loongson.cn
patch subject: [PATCH 4/4] LoongArch: Add support for kernel address space layout randomization (KASLR)
config: loongarch-randconfig-s032-20230110
compiler: loongarch64-linux-gcc (GCC) 12.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://github.com/intel-lab-lkp/linux/commit/66cda25683cd9f1c9b39a92e6cfe0e579b5b0722
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Youling-Tang/LoongArch-Use-trampoline-for-exception-handlers-and-kill-la-abs/20230109-171344
git checkout 66cda25683cd9f1c9b39a92e6cfe0e579b5b0722
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=loongarch olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=loongarch SHELL=/bin/bash arch/loongarch/kernel/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
sparse warnings: (new ones prefixed by >>)
arch/loongarch/kernel/relocate.c:175:1: sparse: sparse: unused label 'out'
>> arch/loongarch/kernel/relocate.c:127:38: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected char *cmdline @@ got void [noderef] __iomem * @@
arch/loongarch/kernel/relocate.c:127:38: sparse: expected char *cmdline
arch/loongarch/kernel/relocate.c:127:38: sparse: got void [noderef] __iomem *
arch/loongarch/kernel/relocate.c:160:48: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned long long [usertype] relocated_addr @@ got void * @@
arch/loongarch/kernel/relocate.c:160:48: sparse: expected unsigned long long [usertype] relocated_addr
arch/loongarch/kernel/relocate.c:160:48: sparse: got void *
vim +127 arch/loongarch/kernel/relocate.c
117
118 void *__init relocate_kernel(void)
119 {
120 Elf64_Rela *rela, *rela_end;
121 void *loc_new;
122 unsigned long kernel_length;
123 long offset = 0;
124 int res = 1;
125 /* Default to original kernel entry point */
126 void *kernel_entry = start_kernel;
> 127 char *cmdline = early_ioremap(fw_arg1, COMMAND_LINE_SIZE);
128
129 /* Boot command line was passed in fw_arg1 */
130 strscpy(boot_command_line, cmdline, COMMAND_LINE_SIZE);
131
132 kernel_length = (long)(_end) - (long)(_text);
133
134 loc_new = determine_relocation_address();
135
136 /* Sanity check relocation address */
137 if (relocation_addr_valid(loc_new))
138 offset = (unsigned long)loc_new - (unsigned long)(_text);
139
140 if (offset) {
141 /* Copy the kernel to it's new location */
142 memcpy(loc_new, _text, kernel_length);
143
144 /* Sync the caches ready for execution of new kernel */
145 __asm__ __volatile__ (
146 "ibar 0 \t\n"
147 "dbar 0 \t\n");
148
149 rela = (Elf64_Rela *)RELOCATED(&__rela_dyn_start);
150 rela_end = (Elf64_Rela *)RELOCATED(&__rela_dyn_end);
151
152 for ( ; rela < rela_end; rela++) {
153 Elf64_Addr addr = rela->r_offset;
154 Elf64_Addr relocated_addr = rela->r_addend;
155
156 if (rela->r_info != R_LARCH_RELATIVE)
157 continue;
158
159 if (relocated_addr >= VMLINUX_LOAD_ADDRESS)
160 relocated_addr = RELOCATED(relocated_addr);
161
162 *(Elf64_Addr *)RELOCATED(addr) = relocated_addr;
163
164 }
165
166 /* The current thread is now within the relocated image */
167 __current_thread_info = RELOCATED(__current_thread_info);
168
169 /* Return the new kernel's entry point */
170 kernel_entry = RELOCATED(start_kernel);
171
172 /* Error may occur before, so keep it at last */
173 update_kaslr_offset(&__kaslr_offset, offset);
174 }
> 175 out:
176 return kernel_entry;
177 }
178
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
View attachment "config" of type "text/plain" (170626 bytes)
Powered by blists - more mailing lists