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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202202131523.w4Vvi8jc-lkp@intel.com>
Date:   Sun, 13 Feb 2022 15:37:45 +0800
From:   kernel test robot <lkp@...el.com>
To:     Arnd Bergmann <arnd@...db.de>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: [arnd-playground:set_fs 6/11] lib/test_lockup.c:420:13: sparse:
 sparse: incorrect type in argument 1 (different address spaces)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git set_fs
head:   0a081326831928b0d739bce68b8c0f9138b9c8ba
commit: a954036380ae20dbfa0c203bf6cafb21d1f3cedd [6/11] uaccess: generalize access_ok()
config: i386-randconfig-s002 (https://download.01.org/0day-ci/archive/20220213/202202131523.w4Vvi8jc-lkp@intel.com/config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/commit/?id=a954036380ae20dbfa0c203bf6cafb21d1f3cedd
        git remote add arnd-playground https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git
        git fetch --no-tags arnd-playground set_fs
        git checkout a954036380ae20dbfa0c203bf6cafb21d1f3cedd
        # save the config file to linux build tree
        mkdir build_dir
        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@...el.com>


sparse warnings: (new ones prefixed by >>)
>> lib/test_lockup.c:420:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __user *ptr @@     got void *ptr @@
   lib/test_lockup.c:420:13: sparse:     expected void const [noderef] __user *ptr
   lib/test_lockup.c:420:13: sparse:     got void *ptr
>> lib/test_lockup.c:421:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const [noderef] __user *ptr @@     got void * @@
   lib/test_lockup.c:421:13: sparse:     expected void const [noderef] __user *ptr
   lib/test_lockup.c:421:13: sparse:     got void *
   lib/test_lockup.c:230:9: sparse: sparse: context imbalance in 'test_lock' - wrong count at exit
   lib/test_lockup.c:250:25: sparse: sparse: context imbalance in 'test_unlock' - unexpected unlock

vim +420 lib/test_lockup.c

30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  410  
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  411  static bool test_kernel_ptr(unsigned long addr, int size)
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  412  {
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  413  	void *ptr = (void *)addr;
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  414  	char buf;
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  415  
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  416  	if (!addr)
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  417  		return false;
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  418  
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  419  	/* should be at least readable kernel address */
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06 @420  	if (access_ok(ptr, 1) ||
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06 @421  	    access_ok(ptr + size - 1, 1) ||
25f12ae45fc193 Christoph Hellwig     2020-06-17  422  	    get_kernel_nofault(buf, ptr) ||
25f12ae45fc193 Christoph Hellwig     2020-06-17  423  	    get_kernel_nofault(buf, ptr + size - 1)) {
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  424  		pr_err("invalid kernel ptr: %#lx\n", addr);
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  425  		return true;
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  426  	}
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  427  
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  428  	return false;
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  429  }
30428ef5d1e8ca Konstantin Khlebnikov 2020-04-06  430  

:::::: The code at line 420 was first introduced by commit
:::::: 30428ef5d1e8caf78639cc70a802f1cb7b1cec04 lib/test_lockup: test module to generate lockups

:::::: TO: Konstantin Khlebnikov <khlebnikov@...dex-team.ru>
:::::: CC: Linus Torvalds <torvalds@...ux-foundation.org>

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ