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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202210172227.77lx6Lyp-lkp@intel.com>
Date:   Mon, 17 Oct 2022 22:19:21 +0800
From:   kernel test robot <lkp@...el.com>
To:     Huacai Chen <chenhuacai@...ngson.cn>,
        Huacai Chen <chenhuacai@...nel.org>
Cc:     kbuild-all@...ts.01.org, loongarch@...ts.linux.dev,
        Xuefeng Li <lixuefeng@...ngson.cn>,
        Tiezhu Yang <yangtiezhu@...ngson.cn>,
        Guo Ren <guoren@...nel.org>, Xuerui Wang <kernel@...0n.name>,
        Jiaxun Yang <jiaxun.yang@...goat.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2] LoongArch: Add unaligned access support

Hi Huacai,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v6.1-rc1 next-20221017]
[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/Huacai-Chen/LoongArch-Add-unaligned-access-support/20221017-115912
patch link:    https://lore.kernel.org/r/20221017022330.2383060-1-chenhuacai%40loongson.cn
patch subject: [PATCH V2] LoongArch: Add unaligned access support
config: loongarch-randconfig-s031-20221017
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/43203da95f81c534f5d756124e52f9915a18c08e
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Huacai-Chen/LoongArch-Add-unaligned-access-support/20221017-115912
        git checkout 43203da95f81c534f5d756124e52f9915a18c08e
        # 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 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/unaligned.c:269:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *addr @@     got void [noderef] __user *addr @@
   arch/loongarch/kernel/unaligned.c:269:38: sparse:     expected void *addr
   arch/loongarch/kernel/unaligned.c:269:38: sparse:     got void [noderef] __user *addr
   arch/loongarch/kernel/unaligned.c:276:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *addr @@     got void [noderef] __user *addr @@
   arch/loongarch/kernel/unaligned.c:276:38: sparse:     expected void *addr
   arch/loongarch/kernel/unaligned.c:276:38: sparse:     got void [noderef] __user *addr
   arch/loongarch/kernel/unaligned.c:282:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *addr @@     got void [noderef] __user *addr @@
   arch/loongarch/kernel/unaligned.c:282:38: sparse:     expected void *addr
   arch/loongarch/kernel/unaligned.c:282:38: sparse:     got void [noderef] __user *addr
   arch/loongarch/kernel/unaligned.c:288:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *addr @@     got void [noderef] __user *addr @@
   arch/loongarch/kernel/unaligned.c:288:38: sparse:     expected void *addr
   arch/loongarch/kernel/unaligned.c:288:38: sparse:     got void [noderef] __user *addr
   arch/loongarch/kernel/unaligned.c:294:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *addr @@     got void [noderef] __user *addr @@
   arch/loongarch/kernel/unaligned.c:294:38: sparse:     expected void *addr
   arch/loongarch/kernel/unaligned.c:294:38: sparse:     got void [noderef] __user *addr
   arch/loongarch/kernel/unaligned.c:302:39: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *addr @@     got void [noderef] __user *addr @@
   arch/loongarch/kernel/unaligned.c:302:39: sparse:     expected void *addr
   arch/loongarch/kernel/unaligned.c:302:39: sparse:     got void [noderef] __user *addr
   arch/loongarch/kernel/unaligned.c:309:39: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *addr @@     got void [noderef] __user *addr @@
   arch/loongarch/kernel/unaligned.c:309:39: sparse:     expected void *addr
   arch/loongarch/kernel/unaligned.c:309:39: sparse:     got void [noderef] __user *addr
   arch/loongarch/kernel/unaligned.c:315:39: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *addr @@     got void [noderef] __user *addr @@
   arch/loongarch/kernel/unaligned.c:315:39: sparse:     expected void *addr
   arch/loongarch/kernel/unaligned.c:315:39: sparse:     got void [noderef] __user *addr
   arch/loongarch/kernel/unaligned.c:320:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *addr @@     got void [noderef] __user *addr @@
   arch/loongarch/kernel/unaligned.c:320:38: sparse:     expected void *addr
   arch/loongarch/kernel/unaligned.c:320:38: sparse:     got void [noderef] __user *addr
   arch/loongarch/kernel/unaligned.c:326:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *addr @@     got void [noderef] __user *addr @@
   arch/loongarch/kernel/unaligned.c:326:38: sparse:     expected void *addr
   arch/loongarch/kernel/unaligned.c:326:38: sparse:     got void [noderef] __user *addr
   arch/loongarch/kernel/unaligned.c:333:39: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *addr @@     got void [noderef] __user *addr @@
   arch/loongarch/kernel/unaligned.c:333:39: sparse:     expected void *addr
   arch/loongarch/kernel/unaligned.c:333:39: sparse:     got void [noderef] __user *addr
   arch/loongarch/kernel/unaligned.c:339:39: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void *addr @@     got void [noderef] __user *addr @@
   arch/loongarch/kernel/unaligned.c:339:39: sparse:     expected void *addr
   arch/loongarch/kernel/unaligned.c:339:39: sparse:     got void [noderef] __user *addr

vim +269 arch/loongarch/kernel/unaligned.c

   244	
   245	void emulate_load_store_insn(struct pt_regs *regs, void __user *addr, unsigned int *pc)
   246	{
   247		bool user = user_mode(regs);
   248		unsigned int res;
   249		unsigned long origpc;
   250		unsigned long origra;
   251		unsigned long value = 0;
   252		union loongarch_instruction insn;
   253	
   254		origpc = (unsigned long)pc;
   255		origra = regs->regs[1];
   256	
   257		perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, regs, 0);
   258	
   259		/*
   260		 * This load never faults.
   261		 */
   262		__get_inst(&insn.word, pc, user);
   263		if (user && !access_ok(addr, 8))
   264			goto sigbus;
   265	
   266		if (insn.reg2i12_format.opcode == ldd_op ||
   267			insn.reg2i14_format.opcode == ldptrd_op ||
   268			insn.reg3_format.opcode == ldxd_op) {
 > 269			res = unaligned_read(addr, &value, 8, 1);
   270			if (res)
   271				goto fault;
   272			regs->regs[insn.reg2i12_format.rd] = value;
   273		} else if (insn.reg2i12_format.opcode == ldw_op ||
   274			insn.reg2i14_format.opcode == ldptrw_op ||
   275			insn.reg3_format.opcode == ldxw_op) {
   276			res = unaligned_read(addr, &value, 4, 1);
   277			if (res)
   278				goto fault;
   279			regs->regs[insn.reg2i12_format.rd] = value;
   280		} else if (insn.reg2i12_format.opcode == ldwu_op ||
   281			insn.reg3_format.opcode == ldxwu_op) {
   282			res = unaligned_read(addr, &value, 4, 0);
   283			if (res)
   284				goto fault;
   285			regs->regs[insn.reg2i12_format.rd] = value;
   286		} else if (insn.reg2i12_format.opcode == ldh_op ||
   287			insn.reg3_format.opcode == ldxh_op) {
   288			res = unaligned_read(addr, &value, 2, 1);
   289			if (res)
   290				goto fault;
   291			regs->regs[insn.reg2i12_format.rd] = value;
   292		} else if (insn.reg2i12_format.opcode == ldhu_op ||
   293			insn.reg3_format.opcode == ldxhu_op) {
   294			res = unaligned_read(addr, &value, 2, 0);
   295			if (res)
   296				goto fault;
   297			regs->regs[insn.reg2i12_format.rd] = value;
   298		} else if (insn.reg2i12_format.opcode == std_op ||
   299			insn.reg2i14_format.opcode == stptrd_op ||
   300			insn.reg3_format.opcode == stxd_op) {
   301			value = regs->regs[insn.reg2i12_format.rd];
   302			res = unaligned_write(addr, value, 8);
   303			if (res)
   304				goto fault;
   305		} else if (insn.reg2i12_format.opcode == stw_op ||
   306			insn.reg2i14_format.opcode == stptrw_op ||
   307			insn.reg3_format.opcode == stxw_op) {
   308			value = regs->regs[insn.reg2i12_format.rd];
   309			res = unaligned_write(addr, value, 4);
   310			if (res)
   311				goto fault;
   312		} else if (insn.reg2i12_format.opcode == sth_op ||
   313			insn.reg3_format.opcode == stxh_op) {
   314			value = regs->regs[insn.reg2i12_format.rd];
   315			res = unaligned_write(addr, value, 2);
   316			if (res)
   317				goto fault;
   318		} else if (insn.reg2i12_format.opcode == fldd_op ||
   319			insn.reg3_format.opcode == fldxd_op) {
   320			res = unaligned_read(addr, &value, 8, 1);
   321			if (res)
   322				goto fault;
   323			write_fpr(insn.reg2i12_format.rd, value);
   324		} else if (insn.reg2i12_format.opcode == flds_op ||
   325			insn.reg3_format.opcode == fldxs_op) {
   326			res = unaligned_read(addr, &value, 4, 1);
   327			if (res)
   328				goto fault;
   329			write_fpr(insn.reg2i12_format.rd, value);
   330		} else if (insn.reg2i12_format.opcode == fstd_op ||
   331			insn.reg3_format.opcode == fstxd_op) {
   332			value = read_fpr(insn.reg2i12_format.rd);
   333			res = unaligned_write(addr, value, 8);
   334			if (res)
   335				goto fault;
   336		} else if (insn.reg2i12_format.opcode == fsts_op ||
   337			insn.reg3_format.opcode == fstxs_op) {
   338			value = read_fpr(insn.reg2i12_format.rd);
   339			res = unaligned_write(addr, value, 4);
   340			if (res)
   341				goto fault;
   342		} else
   343			goto sigbus;
   344	
   345	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (151812 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ