From: kernel test robot <lkp@intel.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: kbuild-all@lists.01.org, linux-kernel@vger.kernel.org
Subject: [arnd-playground:compat-alloc-user-space-10 1/40] kernel/kexec.c:274:52: sparse: sparse: incorrect type in argument 3 (different address spaces)
Date: Tue, 20 Jul 2021 12:37:37 +0800 [thread overview]
Message-ID: <202107201226.681AIMm6-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 3835 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git compat-alloc-user-space-10
head: 58da7172523fefac0902591b73596ce2b21e5038
commit: 5357a3311b528fbd96e088885c5c17a5ce670ad7 [1/40] kexec: avoid compat_alloc_user_space
config: i386-randconfig-s002-20210720 (attached as .config)
compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/commit/?id=5357a3311b528fbd96e088885c5c17a5ce670ad7
git remote add arnd-playground https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git
git fetch --no-tags arnd-playground compat-alloc-user-space-10
git checkout 5357a3311b528fbd96e088885c5c17a5ce670ad7
# 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>
sparse warnings: (new ones prefixed by >>)
>> kernel/kexec.c:274:52: sparse: sparse: incorrect type in argument 3 (different address spaces) @@ expected struct kexec_segment *segments @@ got struct kexec_segment [noderef] __user *segments @@
kernel/kexec.c:274:52: sparse: expected struct kexec_segment *segments
kernel/kexec.c:274:52: sparse: got struct kexec_segment [noderef] __user *segments
vim +274 kernel/kexec.c
6b27aef09fea32 Dominik Brodowski 2018-03-17 254
6b27aef09fea32 Dominik Brodowski 2018-03-17 255 SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
6b27aef09fea32 Dominik Brodowski 2018-03-17 256 struct kexec_segment __user *, segments, unsigned long, flags)
6b27aef09fea32 Dominik Brodowski 2018-03-17 257 {
5357a3311b528f Arnd Bergmann 2021-05-19 258 struct kexec_segment *ksegments;
5357a3311b528f Arnd Bergmann 2021-05-19 259 unsigned long bytes, result;
6b27aef09fea32 Dominik Brodowski 2018-03-17 260
6b27aef09fea32 Dominik Brodowski 2018-03-17 261 result = kexec_load_check(nr_segments, flags);
6b27aef09fea32 Dominik Brodowski 2018-03-17 262 if (result)
6b27aef09fea32 Dominik Brodowski 2018-03-17 263 return result;
6b27aef09fea32 Dominik Brodowski 2018-03-17 264
5357a3311b528f Arnd Bergmann 2021-05-19 265 bytes = nr_segments * sizeof(ksegments[0]);
5357a3311b528f Arnd Bergmann 2021-05-19 266 ksegments = kmalloc(bytes, GFP_KERNEL);
5357a3311b528f Arnd Bergmann 2021-05-19 267 if (!ksegments)
5357a3311b528f Arnd Bergmann 2021-05-19 268 return -ENOMEM;
6b27aef09fea32 Dominik Brodowski 2018-03-17 269
5357a3311b528f Arnd Bergmann 2021-05-19 270 result = copy_from_user(ksegments, segments, bytes);
5357a3311b528f Arnd Bergmann 2021-05-19 271 if (result)
5357a3311b528f Arnd Bergmann 2021-05-19 272 goto fail;
72414d3f1d22fc Maneesh Soni 2005-06-25 273
0eea08678ebe9f Minfei Huang 2016-05-23 @274 result = do_kexec_load(entry, nr_segments, segments, flags);
9b492cf58077a0 Xunlei Pang 2016-05-23 275
5357a3311b528f Arnd Bergmann 2021-05-19 276 fail:
5357a3311b528f Arnd Bergmann 2021-05-19 277 kfree(ksegments);
dc009d92435f99 Eric W. Biederman 2005-06-25 278 return result;
dc009d92435f99 Eric W. Biederman 2005-06-25 279 }
dc009d92435f99 Eric W. Biederman 2005-06-25 280
:::::: The code at line 274 was first introduced by commit
:::::: 0eea08678ebe9f7d8ef98fed974a5bf1a0dd2dd2 kexec: do a cleanup for function kexec_load
:::::: TO: Minfei Huang <mnfhuang@gmail.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>
---
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: 37883 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [arnd-playground:compat-alloc-user-space-10 1/40] kernel/kexec.c:274:52: sparse: sparse: incorrect type in argument 3 (different address spaces)
Date: Tue, 20 Jul 2021 12:37:37 +0800 [thread overview]
Message-ID: <202107201226.681AIMm6-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 3900 bytes --]
tree: https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git compat-alloc-user-space-10
head: 58da7172523fefac0902591b73596ce2b21e5038
commit: 5357a3311b528fbd96e088885c5c17a5ce670ad7 [1/40] kexec: avoid compat_alloc_user_space
config: i386-randconfig-s002-20210720 (attached as .config)
compiler: gcc-10 (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/commit/?id=5357a3311b528fbd96e088885c5c17a5ce670ad7
git remote add arnd-playground https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git
git fetch --no-tags arnd-playground compat-alloc-user-space-10
git checkout 5357a3311b528fbd96e088885c5c17a5ce670ad7
# 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>
sparse warnings: (new ones prefixed by >>)
>> kernel/kexec.c:274:52: sparse: sparse: incorrect type in argument 3 (different address spaces) @@ expected struct kexec_segment *segments @@ got struct kexec_segment [noderef] __user *segments @@
kernel/kexec.c:274:52: sparse: expected struct kexec_segment *segments
kernel/kexec.c:274:52: sparse: got struct kexec_segment [noderef] __user *segments
vim +274 kernel/kexec.c
6b27aef09fea32 Dominik Brodowski 2018-03-17 254
6b27aef09fea32 Dominik Brodowski 2018-03-17 255 SYSCALL_DEFINE4(kexec_load, unsigned long, entry, unsigned long, nr_segments,
6b27aef09fea32 Dominik Brodowski 2018-03-17 256 struct kexec_segment __user *, segments, unsigned long, flags)
6b27aef09fea32 Dominik Brodowski 2018-03-17 257 {
5357a3311b528f Arnd Bergmann 2021-05-19 258 struct kexec_segment *ksegments;
5357a3311b528f Arnd Bergmann 2021-05-19 259 unsigned long bytes, result;
6b27aef09fea32 Dominik Brodowski 2018-03-17 260
6b27aef09fea32 Dominik Brodowski 2018-03-17 261 result = kexec_load_check(nr_segments, flags);
6b27aef09fea32 Dominik Brodowski 2018-03-17 262 if (result)
6b27aef09fea32 Dominik Brodowski 2018-03-17 263 return result;
6b27aef09fea32 Dominik Brodowski 2018-03-17 264
5357a3311b528f Arnd Bergmann 2021-05-19 265 bytes = nr_segments * sizeof(ksegments[0]);
5357a3311b528f Arnd Bergmann 2021-05-19 266 ksegments = kmalloc(bytes, GFP_KERNEL);
5357a3311b528f Arnd Bergmann 2021-05-19 267 if (!ksegments)
5357a3311b528f Arnd Bergmann 2021-05-19 268 return -ENOMEM;
6b27aef09fea32 Dominik Brodowski 2018-03-17 269
5357a3311b528f Arnd Bergmann 2021-05-19 270 result = copy_from_user(ksegments, segments, bytes);
5357a3311b528f Arnd Bergmann 2021-05-19 271 if (result)
5357a3311b528f Arnd Bergmann 2021-05-19 272 goto fail;
72414d3f1d22fc Maneesh Soni 2005-06-25 273
0eea08678ebe9f Minfei Huang 2016-05-23 @274 result = do_kexec_load(entry, nr_segments, segments, flags);
9b492cf58077a0 Xunlei Pang 2016-05-23 275
5357a3311b528f Arnd Bergmann 2021-05-19 276 fail:
5357a3311b528f Arnd Bergmann 2021-05-19 277 kfree(ksegments);
dc009d92435f99 Eric W. Biederman 2005-06-25 278 return result;
dc009d92435f99 Eric W. Biederman 2005-06-25 279 }
dc009d92435f99 Eric W. Biederman 2005-06-25 280
:::::: The code at line 274 was first introduced by commit
:::::: 0eea08678ebe9f7d8ef98fed974a5bf1a0dd2dd2 kexec: do a cleanup for function kexec_load
:::::: TO: Minfei Huang <mnfhuang@gmail.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>
---
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: 37883 bytes --]
next reply other threads:[~2021-07-20 6:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-20 4:37 kernel test robot [this message]
2021-07-20 4:37 ` [arnd-playground:compat-alloc-user-space-10 1/40] kernel/kexec.c:274:52: sparse: sparse: incorrect type in argument 3 (different address spaces) kernel test robot
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=202107201226.681AIMm6-lkp@intel.com \
--to=lkp@intel.com \
--cc=arnd@arndb.de \
--cc=kbuild-all@lists.01.org \
--cc=linux-kernel@vger.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.