lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202601181018.B6nOmCUL-lkp@intel.com>
Date: Sun, 18 Jan 2026 10:29:16 +0800
From: kernel test robot <lkp@...el.com>
To: Youling Tang <tangyouling@...inos.cn>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
 Huacai Chen <chenhuacai@...nel.org>
Subject: arch/loongarch/kernel/machine_kexec.c:84:51: sparse: sparse:
 incorrect type in argument 2 (different address spaces)

Hi Youling,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   d12453c7e281d236f77b5c7d7cccbf9e5dfadfe5
commit: d162feec6b6e7ed97986118450812fdd7e9ba202 LoongArch: Add preparatory infrastructure for kexec_file
date:   4 months ago
config: loongarch-randconfig-r122-20260118 (https://download.01.org/0day-ci/archive/20260118/202601181018.B6nOmCUL-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260118/202601181018.B6nOmCUL-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202601181018.B6nOmCUL-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> arch/loongarch/kernel/machine_kexec.c:84:51: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected char const * @@     got char [noderef] __user * @@
   arch/loongarch/kernel/machine_kexec.c:84:51: sparse:     expected char const *
   arch/loongarch/kernel/machine_kexec.c:84:51: sparse:     got char [noderef] __user *

vim +84 arch/loongarch/kernel/machine_kexec.c

4a03b2ac06a5bc Youling Tang 2022-10-12   61  
4a03b2ac06a5bc Youling Tang 2022-10-12   62  int machine_kexec_prepare(struct kimage *kimage)
4a03b2ac06a5bc Youling Tang 2022-10-12   63  {
4a03b2ac06a5bc Youling Tang 2022-10-12   64  	int i;
4a03b2ac06a5bc Youling Tang 2022-10-12   65  	char *bootloader = "kexec";
4a03b2ac06a5bc Youling Tang 2022-10-12   66  	void *cmdline_ptr = (void *)KEXEC_CMDLINE_ADDR;
4a03b2ac06a5bc Youling Tang 2022-10-12   67  
4a03b2ac06a5bc Youling Tang 2022-10-12   68  	kexec_image_info(kimage);
4a03b2ac06a5bc Youling Tang 2022-10-12   69  
4a03b2ac06a5bc Youling Tang 2022-10-12   70  	kimage->arch.efi_boot = fw_arg0;
4a03b2ac06a5bc Youling Tang 2022-10-12   71  	kimage->arch.systable_ptr = fw_arg2;
4a03b2ac06a5bc Youling Tang 2022-10-12   72  
d162feec6b6e7e Youling Tang 2025-10-02   73  	if (kimage->file_mode == 1) {
d162feec6b6e7e Youling Tang 2025-10-02   74  		/*
d162feec6b6e7e Youling Tang 2025-10-02   75  		 * kimage->cmdline_buf will be released in kexec_file_load, so copy
d162feec6b6e7e Youling Tang 2025-10-02   76  		 * to the KEXEC_CMDLINE_ADDR safe area.
d162feec6b6e7e Youling Tang 2025-10-02   77  		 */
d162feec6b6e7e Youling Tang 2025-10-02   78  		memcpy((void *)KEXEC_CMDLINE_ADDR, (void *)kimage->arch.cmdline_ptr,
d162feec6b6e7e Youling Tang 2025-10-02   79  					strlen((char *)kimage->arch.cmdline_ptr) + 1);
d162feec6b6e7e Youling Tang 2025-10-02   80  		kimage->arch.cmdline_ptr = (unsigned long)KEXEC_CMDLINE_ADDR;
d162feec6b6e7e Youling Tang 2025-10-02   81  	} else {
4a03b2ac06a5bc Youling Tang 2022-10-12   82  		/* Find the command line */
4a03b2ac06a5bc Youling Tang 2022-10-12   83  		for (i = 0; i < kimage->nr_segments; i++) {
4a03b2ac06a5bc Youling Tang 2022-10-12  @84  			if (!strncmp(bootloader, (char __user *)kimage->segment[i].buf, strlen(bootloader))) {
4a03b2ac06a5bc Youling Tang 2022-10-12   85  				if (!copy_from_user(cmdline_ptr, kimage->segment[i].buf, COMMAND_LINE_SIZE))
4a03b2ac06a5bc Youling Tang 2022-10-12   86  					kimage->arch.cmdline_ptr = (unsigned long)cmdline_ptr;
4a03b2ac06a5bc Youling Tang 2022-10-12   87  				break;
4a03b2ac06a5bc Youling Tang 2022-10-12   88  			}
4a03b2ac06a5bc Youling Tang 2022-10-12   89  		}
4a03b2ac06a5bc Youling Tang 2022-10-12   90  
4a03b2ac06a5bc Youling Tang 2022-10-12   91  		if (!kimage->arch.cmdline_ptr) {
4a03b2ac06a5bc Youling Tang 2022-10-12   92  			pr_err("Command line not included in the provided image\n");
4a03b2ac06a5bc Youling Tang 2022-10-12   93  			return -EINVAL;
4a03b2ac06a5bc Youling Tang 2022-10-12   94  		}
d162feec6b6e7e Youling Tang 2025-10-02   95  	}
4a03b2ac06a5bc Youling Tang 2022-10-12   96  
4e62d1d86585e1 Youling Tang 2022-10-12   97  	/* kexec/kdump need a safe page to save reboot_code_buffer */
4a03b2ac06a5bc Youling Tang 2022-10-12   98  	kimage->control_code_page = virt_to_page((void *)KEXEC_CONTROL_CODE);
4a03b2ac06a5bc Youling Tang 2022-10-12   99  
4a03b2ac06a5bc Youling Tang 2022-10-12  100  	reboot_code_buffer = (unsigned long)page_address(kimage->control_code_page);
4a03b2ac06a5bc Youling Tang 2022-10-12  101  	memcpy((void *)reboot_code_buffer, relocate_new_kernel, relocate_new_kernel_size);
4a03b2ac06a5bc Youling Tang 2022-10-12  102  

:::::: The code at line 84 was first introduced by commit
:::::: 4a03b2ac06a5bcae29371866d9d11f5bfd4c9188 LoongArch: Add kexec support

:::::: TO: Youling Tang <tangyouling@...ngson.cn>
:::::: CC: Huacai Chen <chenhuacai@...ngson.cn>

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ