All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Peter Collingbourne <pcc@google.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Dave Martin <Dave.Martin@arm.com>, Will Deacon <will@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Andrea Arcangeli <aarcange@redhat.com>
Cc: kbuild-all@lists.01.org,
	Linux Memory Management List <linux-mm@kvack.org>,
	Peter Collingbourne <pcc@google.com>,
	Alistair Delva <adelva@google.com>,
	Lokesh Gidra <lokeshgidra@google.com>
Subject: Re: [PATCH v3 1/2] userfaultfd: do not untag user pointers
Date: Sat, 3 Jul 2021 17:05:21 +0800	[thread overview]
Message-ID: <202107031608.tzwIjv2f-lkp@intel.com> (raw)
In-Reply-To: <20210702225705.2477947-2-pcc@google.com>

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

Hi Peter,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on arm64/for-next/core]
[also build test WARNING on kselftest/next v5.13]
[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/Peter-Collingbourne/userfaultfd-do-not-untag-user-pointers/20210703-065801
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
config: i386-randconfig-s002-20210702 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://github.com/0day-ci/linux/commit/42177546697fa573571799dc11ecd12a65449886
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Peter-Collingbourne/userfaultfd-do-not-untag-user-pointers/20210703-065801
        git checkout 42177546697fa573571799dc11ecd12a65449886
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash

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


sparse warnings: (new ones prefixed by >>)
   fs/userfaultfd.c:1816:40: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected unsigned long long [usertype] start @@     got unsigned long long * @@
   fs/userfaultfd.c:1816:40: sparse:     expected unsigned long long [usertype] start
   fs/userfaultfd.c:1816:40: sparse:     got unsigned long long *
   fs/userfaultfd.c:1864:40: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected unsigned long long [usertype] start @@     got unsigned long long * @@
   fs/userfaultfd.c:1864:40: sparse:     expected unsigned long long [usertype] start
   fs/userfaultfd.c:1864:40: sparse:     got unsigned long long *
>> fs/userfaultfd.c:1816:40: sparse: sparse: non size-preserving pointer to integer cast
   fs/userfaultfd.c:1864:40: sparse: sparse: non size-preserving pointer to integer cast

vim +1816 fs/userfaultfd.c

ad465cae96b456 Andrea Arcangeli 2015-09-04  1797  
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1798  static int userfaultfd_writeprotect(struct userfaultfd_ctx *ctx,
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1799  				    unsigned long arg)
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1800  {
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1801  	int ret;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1802  	struct uffdio_writeprotect uffdio_wp;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1803  	struct uffdio_writeprotect __user *user_uffdio_wp;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1804  	struct userfaultfd_wake_range range;
23080e2783ba45 Peter Xu         2020-04-06  1805  	bool mode_wp, mode_dontwake;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1806  
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1807  	if (READ_ONCE(ctx->mmap_changing))
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1808  		return -EAGAIN;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1809  
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1810  	user_uffdio_wp = (struct uffdio_writeprotect __user *) arg;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1811  
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1812  	if (copy_from_user(&uffdio_wp, user_uffdio_wp,
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1813  			   sizeof(struct uffdio_writeprotect)))
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1814  		return -EFAULT;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1815  
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06 @1816  	ret = validate_range(ctx->mm, &uffdio_wp.range.start,
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1817  			     uffdio_wp.range.len);
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1818  	if (ret)
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1819  		return ret;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1820  
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1821  	if (uffdio_wp.mode & ~(UFFDIO_WRITEPROTECT_MODE_DONTWAKE |
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1822  			       UFFDIO_WRITEPROTECT_MODE_WP))
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1823  		return -EINVAL;
23080e2783ba45 Peter Xu         2020-04-06  1824  
23080e2783ba45 Peter Xu         2020-04-06  1825  	mode_wp = uffdio_wp.mode & UFFDIO_WRITEPROTECT_MODE_WP;
23080e2783ba45 Peter Xu         2020-04-06  1826  	mode_dontwake = uffdio_wp.mode & UFFDIO_WRITEPROTECT_MODE_DONTWAKE;
23080e2783ba45 Peter Xu         2020-04-06  1827  
23080e2783ba45 Peter Xu         2020-04-06  1828  	if (mode_wp && mode_dontwake)
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1829  		return -EINVAL;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1830  
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1831  	ret = mwriteprotect_range(ctx->mm, uffdio_wp.range.start,
23080e2783ba45 Peter Xu         2020-04-06  1832  				  uffdio_wp.range.len, mode_wp,
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1833  				  &ctx->mmap_changing);
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1834  	if (ret)
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1835  		return ret;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1836  
23080e2783ba45 Peter Xu         2020-04-06  1837  	if (!mode_wp && !mode_dontwake) {
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1838  		range.start = uffdio_wp.range.start;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1839  		range.len = uffdio_wp.range.len;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1840  		wake_userfault(ctx, &range);
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1841  	}
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1842  	return ret;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1843  }
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1844  

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

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH v3 1/2] userfaultfd: do not untag user pointers
Date: Sat, 03 Jul 2021 17:05:21 +0800	[thread overview]
Message-ID: <202107031608.tzwIjv2f-lkp@intel.com> (raw)
In-Reply-To: <20210702225705.2477947-2-pcc@google.com>

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

Hi Peter,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on arm64/for-next/core]
[also build test WARNING on kselftest/next v5.13]
[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/Peter-Collingbourne/userfaultfd-do-not-untag-user-pointers/20210703-065801
base:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/core
config: i386-randconfig-s002-20210702 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://github.com/0day-ci/linux/commit/42177546697fa573571799dc11ecd12a65449886
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Peter-Collingbourne/userfaultfd-do-not-untag-user-pointers/20210703-065801
        git checkout 42177546697fa573571799dc11ecd12a65449886
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash

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


sparse warnings: (new ones prefixed by >>)
   fs/userfaultfd.c:1816:40: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected unsigned long long [usertype] start @@     got unsigned long long * @@
   fs/userfaultfd.c:1816:40: sparse:     expected unsigned long long [usertype] start
   fs/userfaultfd.c:1816:40: sparse:     got unsigned long long *
   fs/userfaultfd.c:1864:40: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected unsigned long long [usertype] start @@     got unsigned long long * @@
   fs/userfaultfd.c:1864:40: sparse:     expected unsigned long long [usertype] start
   fs/userfaultfd.c:1864:40: sparse:     got unsigned long long *
>> fs/userfaultfd.c:1816:40: sparse: sparse: non size-preserving pointer to integer cast
   fs/userfaultfd.c:1864:40: sparse: sparse: non size-preserving pointer to integer cast

vim +1816 fs/userfaultfd.c

ad465cae96b456 Andrea Arcangeli 2015-09-04  1797  
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1798  static int userfaultfd_writeprotect(struct userfaultfd_ctx *ctx,
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1799  				    unsigned long arg)
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1800  {
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1801  	int ret;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1802  	struct uffdio_writeprotect uffdio_wp;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1803  	struct uffdio_writeprotect __user *user_uffdio_wp;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1804  	struct userfaultfd_wake_range range;
23080e2783ba45 Peter Xu         2020-04-06  1805  	bool mode_wp, mode_dontwake;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1806  
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1807  	if (READ_ONCE(ctx->mmap_changing))
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1808  		return -EAGAIN;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1809  
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1810  	user_uffdio_wp = (struct uffdio_writeprotect __user *) arg;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1811  
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1812  	if (copy_from_user(&uffdio_wp, user_uffdio_wp,
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1813  			   sizeof(struct uffdio_writeprotect)))
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1814  		return -EFAULT;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1815  
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06 @1816  	ret = validate_range(ctx->mm, &uffdio_wp.range.start,
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1817  			     uffdio_wp.range.len);
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1818  	if (ret)
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1819  		return ret;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1820  
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1821  	if (uffdio_wp.mode & ~(UFFDIO_WRITEPROTECT_MODE_DONTWAKE |
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1822  			       UFFDIO_WRITEPROTECT_MODE_WP))
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1823  		return -EINVAL;
23080e2783ba45 Peter Xu         2020-04-06  1824  
23080e2783ba45 Peter Xu         2020-04-06  1825  	mode_wp = uffdio_wp.mode & UFFDIO_WRITEPROTECT_MODE_WP;
23080e2783ba45 Peter Xu         2020-04-06  1826  	mode_dontwake = uffdio_wp.mode & UFFDIO_WRITEPROTECT_MODE_DONTWAKE;
23080e2783ba45 Peter Xu         2020-04-06  1827  
23080e2783ba45 Peter Xu         2020-04-06  1828  	if (mode_wp && mode_dontwake)
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1829  		return -EINVAL;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1830  
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1831  	ret = mwriteprotect_range(ctx->mm, uffdio_wp.range.start,
23080e2783ba45 Peter Xu         2020-04-06  1832  				  uffdio_wp.range.len, mode_wp,
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1833  				  &ctx->mmap_changing);
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1834  	if (ret)
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1835  		return ret;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1836  
23080e2783ba45 Peter Xu         2020-04-06  1837  	if (!mode_wp && !mode_dontwake) {
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1838  		range.start = uffdio_wp.range.start;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1839  		range.len = uffdio_wp.range.len;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1840  		wake_userfault(ctx, &range);
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1841  	}
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1842  	return ret;
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1843  }
63b2d4174c4ad1 Andrea Arcangeli 2020-04-06  1844  

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

  parent reply	other threads:[~2021-07-03  9:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-02 22:57 [PATCH v3 0/2] userfaultfd: do not untag user pointers Peter Collingbourne
2021-07-02 22:57 ` Peter Collingbourne
2021-07-02 22:57 ` [PATCH v3 1/2] " Peter Collingbourne
2021-07-02 22:57   ` Peter Collingbourne
2021-07-02 22:57   ` Peter Collingbourne
2021-07-03  2:46   ` kernel test robot
2021-07-03  2:46     ` kernel test robot
2021-07-03  3:06   ` kernel test robot
2021-07-03  3:06     ` kernel test robot
2021-07-03  5:02   ` kernel test robot
2021-07-03  5:02     ` kernel test robot
2021-07-03  9:05   ` kernel test robot [this message]
2021-07-03  9:05     ` kernel test robot
2021-07-04 15:39   ` Andrey Konovalov
2021-07-04 15:39     ` Andrey Konovalov
2021-07-04 15:39     ` Andrey Konovalov
2021-07-02 22:57 ` [PATCH v3 2/2] selftest: use mmap instead of posix_memalign to allocate memory Peter Collingbourne
2021-07-02 22:57   ` Peter Collingbourne
2021-07-02 22:57   ` Peter Collingbourne

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=202107031608.tzwIjv2f-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=Dave.Martin@arm.com \
    --cc=aarcange@redhat.com \
    --cc=adelva@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-mm@kvack.org \
    --cc=lokeshgidra@google.com \
    --cc=pcc@google.com \
    --cc=vincenzo.frascino@arm.com \
    --cc=will@kernel.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.