public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: wanghongzhe <wanghongzhe@huawei.com>, luto@amacapital.net
Cc: kbuild-all@lists.01.org, andrii@kernel.org, ast@kernel.org,
	bpf@vger.kernel.org, daniel@iogearbox.net,
	john.fastabend@gmail.com, kafai@fb.com, keescook@chromium.org,
	kpsingh@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/1] Firstly, as Andy mentioned, this should be smp_rmb() instead of rmb(). considering that TSYNC is a cross-thread situation, and rmb() is a mandatory barrier which should not be used to control SMP effects, since mandatory barriers impose unnecessary overhead on both SMP and UP systems, as kernel Documentation said.
Date: Tue, 2 Feb 2021 22:01:33 +0800	[thread overview]
Message-ID: <202102022122.aBZxxalL-lkp@intel.com> (raw)
In-Reply-To: <1612260787-28015-1-git-send-email-wanghongzhe@huawei.com>

[-- Attachment #1: Type: text/plain, Size: 3377 bytes --]

Hi wanghongzhe,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on v5.11-rc6]
[also build test WARNING on next-20210125]
[cannot apply to kees/for-next/seccomp]
[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/wanghongzhe/Firstly-as-Andy-mentioned-this-should-be-smp_rmb-instead-of-rmb-considering-that-TSYNC-is-a-cross-thread-situation-and-r/20210202-173311
base:    1048ba83fb1c00cd24172e23e8263972f6b5d9ac
config: i386-randconfig-s001-20210202 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-215-g0fb77bb6-dirty
        # https://github.com/0day-ci/linux/commit/f79414957fc8acb6b680bbcd26fa987328a5724a
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review wanghongzhe/Firstly-as-Andy-mentioned-this-should-be-smp_rmb-instead-of-rmb-considering-that-TSYNC-is-a-cross-thread-situation-and-r/20210202-173311
        git checkout f79414957fc8acb6b680bbcd26fa987328a5724a
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

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 >>):

   kernel/seccomp.c: In function '__secure_computing':
>> kernel/seccomp.c:1313:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
    1313 |   if (unlikely(current->seccomp.mode != SECCOMP_MODE_FILTER))
         |      ^
   kernel/seccomp.c:1315:2: note: here
    1315 |  case SECCOMP_MODE_FILTER:
         |  ^~~~


vim +1313 kernel/seccomp.c

  1283	
  1284	int __secure_computing(const struct seccomp_data *sd)
  1285	{
  1286		int this_syscall;
  1287	
  1288		if (IS_ENABLED(CONFIG_CHECKPOINT_RESTORE) &&
  1289		    unlikely(current->ptrace & PT_SUSPEND_SECCOMP))
  1290			return 0;
  1291	
  1292		this_syscall = sd ? sd->nr :
  1293			syscall_get_nr(current, current_pt_regs());
  1294	
  1295		/*
  1296		 * Make sure that any changes to mode from another thread have
  1297		 * been seen after SYSCALL_WORK_SECCOMP was seen.
  1298		 */
  1299		smp_rmb();
  1300	
  1301		switch (current->seccomp.mode) {
  1302		case SECCOMP_MODE_STRICT:
  1303			__secure_computing_strict(this_syscall);  /* may call do_exit */
  1304			return 0;
  1305		/*
  1306		 * Make sure that change to mode (from SECCOMP_MODE_DISABLED to
  1307		 * SECCOMP_MODE_FILTER) from another thread using TSYNC ability
  1308		 * have been seen after SYSCALL_WORK_SECCOMP was seen. Read mode again behind
  1309		 * smp_rmb(), if it equals SECCOMP_MODE_FILTER, go to the right path.
  1310		 */
  1311		case SECCOMP_MODE_DISABLED:
  1312			smp_rmb();
> 1313			if (unlikely(current->seccomp.mode != SECCOMP_MODE_FILTER))
  1314				BUG();
  1315		case SECCOMP_MODE_FILTER:
  1316			return __seccomp_filter(this_syscall, sd, false);
  1317		default:
  1318			BUG();
  1319		}
  1320	}
  1321	#endif /* CONFIG_HAVE_ARCH_SECCOMP_FILTER */
  1322	

---
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: 35554 bytes --]

  parent reply	other threads:[~2021-02-02 14:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-01 12:50 [PATCH] seccomp: Improve performance by optimizing memory barrier wanghongzhe
2021-02-01 15:39 ` Andy Lutomirski
2021-02-02  1:50   ` Wanghongzhe (Hongzhe, EulerOS)
2021-02-02 10:13   ` [PATCH v1 1/1] Firstly, as Andy mentioned, this should be smp_rmb() instead of rmb(). considering that TSYNC is a cross-thread situation, and rmb() is a mandatory barrier which should not be used to control SMP effects, since mandatory barriers impose unnecessary overhead on both SMP and UP systems, as kernel Documentation said wanghongzhe
2021-02-02 11:53     ` Greg KH
2021-02-02 14:01     ` kernel test robot [this message]
2021-02-02 19:02     ` Kees Cook
2021-02-04  8:45       ` [PATCH v1 1/1] Firstly, as Andy mentioned, this should be smp_rmb() instead of rmb(). considering that TSYNC is a cross-thread situation, and rmb() is a mandatory barrier which should not be used to control SMP effects, since mandatory barriers imp Wanghongzhe (Hongzhe, EulerOS)

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=202102022122.aBZxxalL-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kbuild-all@lists.01.org \
    --cc=keescook@chromium.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=wanghongzhe@huawei.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox