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: <202104210515.VoF3YT1J-lkp@intel.com>
Date:   Wed, 21 Apr 2021 05:22:02 +0800
From:   kernel test robot <lkp@...el.com>
To:     Liam Howlett <liam.howlett@...cle.com>,
        Catalin Marinas <catalin.marinas@....com>,
        Will Deacon <will@...nel.org>,
        Julien Grall <julien.grall@....com>
Cc:     kbuild-all@...ts.01.org, Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Andrii Nakryiko <andrii@...nel.org>,
        Liam Howlett <liam.howlett@...cle.com>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH 1/3] arm64: armv8_deprecated: Fix swp_handler() signal
 generation

Hi Liam,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on arm64/for-next/core]
[also build test WARNING on arm-perf/for-next/perf xlnx/master arm/for-next soc/for-next kvmarm/next linus/master v5.12-rc8 next-20210420]
[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]

url:    https://github.com/0day-ci/linux/commits/Liam-Howlett/arm64-armv8_deprecated-Fix-swp_handler-signal-generation/20210421-005252
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
config: arm64-allyesconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/96a011695861072d32851ba3a104b19106955869
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Liam-Howlett/arm64-armv8_deprecated-Fix-swp_handler-signal-generation/20210421-005252
        git checkout 96a011695861072d32851ba3a104b19106955869
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

   arch/arm64/kernel/armv8_deprecated.c: In function 'swp_handler':
>> arch/arm64/kernel/armv8_deprecated.c:418:11: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
     418 |  else if (res = -ENXIO) /* Unaligned pointer */
         |           ^~~


vim +418 arch/arm64/kernel/armv8_deprecated.c

   365	
   366	/*
   367	 * swp_handler logs the id of calling process, dissects the instruction, sanity
   368	 * checks the memory location, calls emulate_swpX for the actual operation and
   369	 * deals with fixup/error handling before returning
   370	 */
   371	static int swp_handler(struct pt_regs *regs, u32 instr)
   372	{
   373		u32 destreg, data, type, address = 0;
   374		const void __user *user_ptr;
   375		int rn, rt2, res = 0;
   376	
   377		perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS, 1, regs, regs->pc);
   378	
   379		type = instr & TYPE_SWPB;
   380	
   381		switch (aarch32_check_condition(instr, regs->pstate)) {
   382		case ARM_OPCODE_CONDTEST_PASS:
   383			break;
   384		case ARM_OPCODE_CONDTEST_FAIL:
   385			/* Condition failed - return to next instruction */
   386			goto ret;
   387		case ARM_OPCODE_CONDTEST_UNCOND:
   388			/* If unconditional encoding - not a SWP, undef */
   389			return -EFAULT;
   390		default:
   391			return -EINVAL;
   392		}
   393	
   394		rn = aarch32_insn_extract_reg_num(instr, A32_RN_OFFSET);
   395		rt2 = aarch32_insn_extract_reg_num(instr, A32_RT2_OFFSET);
   396	
   397		address = (u32)regs->user_regs.regs[rn];
   398		data	= (u32)regs->user_regs.regs[rt2];
   399		destreg = aarch32_insn_extract_reg_num(instr, A32_RT_OFFSET);
   400	
   401		pr_debug("addr in r%d->0x%08x, dest is r%d, source in r%d->0x%08x)\n",
   402			rn, address, destreg,
   403			aarch32_insn_extract_reg_num(instr, A32_RT2_OFFSET), data);
   404	
   405		/* Check access in reasonable access range for both SWP and SWPB */
   406		user_ptr = (const void __user *)(unsigned long)(address & ~3);
   407		if (!access_ok(user_ptr, 4)) {
   408			pr_debug("SWP{B} emulation: access to 0x%08x not allowed!\n",
   409				 address);
   410			goto e_access;
   411		}
   412	
   413		res = emulate_swpX(address, &data, type);
   414		if (!res)
   415			regs->user_regs.regs[destreg] = data;
   416		else if (res == -EFAULT)
   417			goto e_fault;
 > 418		else if (res = -ENXIO) /* Unaligned pointer */
   419			goto e_align;
   420	
   421	ret:
   422		if (type == TYPE_SWPB)
   423			trace_instruction_emulation("swpb", regs->pc);
   424		else
   425			trace_instruction_emulation("swp", regs->pc);
   426	
   427		pr_warn_ratelimited("\"%s\" (%ld) uses obsolete SWP{B} instruction at 0x%llx\n",
   428				current->comm, (unsigned long)current->pid, regs->pc);
   429	
   430		arm64_skip_faulting_instruction(regs, 4);
   431		return 0;
   432	
   433	e_fault:
   434		pr_debug("SWP{B} emulation: access caused memory abort!\n");
   435		arm64_notify_segfault(address);
   436		return 0;
   437	
   438	e_align:
   439	e_access:
   440		force_signal_inject(SIGSEGV, SEGV_ACCERR, address, 0);
   441		return 0;
   442	}
   443	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (76777 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ