From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH 1/3] arm64: armv8_deprecated: Fix swp_handler() signal generation
Date: Wed, 21 Apr 2021 05:22:02 +0800 [thread overview]
Message-ID: <202104210515.VoF3YT1J-lkp@intel.com> (raw)
In-Reply-To: <20210420165001.3790670-1-Liam.Howlett@Oracle.com>
[-- Attachment #1: Type: text/plain, Size: 4911 bytes --]
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@intel.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(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 76777 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: Liam Howlett <liam.howlett@oracle.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Julien Grall <julien.grall@arm.com>
Cc: kbuild-all@lists.01.org, Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Liam Howlett <liam.howlett@oracle.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH 1/3] arm64: armv8_deprecated: Fix swp_handler() signal generation
Date: Wed, 21 Apr 2021 05:22:02 +0800 [thread overview]
Message-ID: <202104210515.VoF3YT1J-lkp@intel.com> (raw)
In-Reply-To: <20210420165001.3790670-1-Liam.Howlett@Oracle.com>
[-- Attachment #1: Type: text/plain, Size: 4789 bytes --]
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@intel.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
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 76777 bytes --]
next prev parent reply other threads:[~2021-04-20 21:22 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-20 16:50 [PATCH 1/3] arm64: armv8_deprecated: Fix swp_handler() signal generation Liam Howlett
2021-04-20 16:50 ` Liam Howlett
2021-04-20 16:50 ` [PATCH 3/3] arch/arm64/kernel/traps: Use find_vma_intersection() in traps for setting si_code Liam Howlett
2021-04-20 16:50 ` Liam Howlett
2021-04-22 12:53 ` Will Deacon
2021-04-22 12:53 ` Will Deacon
2021-04-22 18:56 ` Liam Howlett
2021-04-22 18:56 ` Liam Howlett
2021-04-20 16:50 ` [PATCH 2/3] arm64: signal: sigreturn() and rt_sigreturn() sometime returns the wrong signals Liam Howlett
2021-04-20 16:50 ` Liam Howlett
2021-04-22 12:48 ` Will Deacon
2021-04-22 12:48 ` Will Deacon
2021-04-22 18:22 ` Eric W. Biederman
2021-04-22 18:22 ` Eric W. Biederman
2021-04-22 19:24 ` Liam Howlett
2021-04-22 19:24 ` Liam Howlett
2021-04-23 18:17 ` Eric W. Biederman
2021-04-23 18:17 ` Eric W. Biederman
2021-04-23 20:03 ` Liam Howlett
2021-04-23 20:03 ` Liam Howlett
2021-04-29 17:52 ` Eric W. Biederman
2021-04-29 17:52 ` Eric W. Biederman
2021-04-30 18:48 ` Liam Howlett
2021-04-30 18:48 ` Liam Howlett
2021-04-30 19:57 ` Eric W. Biederman
2021-04-30 19:57 ` Eric W. Biederman
2021-04-30 20:31 ` Liam Howlett
2021-04-30 20:31 ` Liam Howlett
2021-04-20 21:22 ` kernel test robot [this message]
2021-04-20 21:22 ` [PATCH 1/3] arm64: armv8_deprecated: Fix swp_handler() signal generation kernel test robot
2021-04-21 15:47 ` Liam Howlett
2021-04-21 15:47 ` Liam Howlett
2021-04-21 15:47 ` Liam Howlett
2021-04-22 12:59 ` Will Deacon
2021-04-22 12:59 ` Will Deacon
2021-04-23 1:00 ` Liam Howlett
2021-04-23 1:00 ` Liam Howlett
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202104210515.VoF3YT1J-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.