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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202202241831.OT84m49q-lkp@intel.com>
Date:   Thu, 24 Feb 2022 18:44:12 +0800
From:   kernel test robot <lkp@...el.com>
To:     Xiaoming Ni <nixiaoming@...wei.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
        Luis Chamberlain <mcgrof@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linux Memory Management List <linux-mm@...ck.org>
Subject: kernel/stackleak.c:33:50: sparse: sparse: incorrect type in argument
 3 (different address spaces)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   23d04328444a8fa0ca060c5e532220dac8e8bc26
commit: 0df8bdd5e3b3e557ce2c2575fce0c64c5dd1045a stackleak: move stack_erasing sysctl to stackleak.c
date:   5 weeks ago
config: arm64-randconfig-s031-20220223 (https://download.01.org/0day-ci/archive/20220224/202202241831.OT84m49q-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 11.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0df8bdd5e3b3e557ce2c2575fce0c64c5dd1045a
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout 0df8bdd5e3b3e557ce2c2575fce0c64c5dd1045a
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm64 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 >>)
>> kernel/stackleak.c:33:50: sparse: sparse: incorrect type in argument 3 (different address spaces) @@     expected void * @@     got void [noderef] __user *buffer @@
   kernel/stackleak.c:33:50: sparse:     expected void *
   kernel/stackleak.c:33:50: sparse:     got void [noderef] __user *buffer
>> kernel/stackleak.c:53:35: sparse: sparse: incorrect type in initializer (incompatible argument 3 (different address spaces)) @@     expected int ( [usertype] *proc_handler )( ... ) @@     got int ( * )( ... ) @@
   kernel/stackleak.c:53:35: sparse:     expected int ( [usertype] *proc_handler )( ... )
   kernel/stackleak.c:53:35: sparse:     got int ( * )( ... )

vim +33 kernel/stackleak.c

964c9dff009189 Alexander Popov 2018-08-17  22  
0df8bdd5e3b3e5 Xiaoming Ni     2022-01-21  23  #ifdef CONFIG_SYSCTL
0df8bdd5e3b3e5 Xiaoming Ni     2022-01-21  24  static int stack_erasing_sysctl(struct ctl_table *table, int write,
0df8bdd5e3b3e5 Xiaoming Ni     2022-01-21  25  			void __user *buffer, size_t *lenp, loff_t *ppos)
964c9dff009189 Alexander Popov 2018-08-17  26  {
964c9dff009189 Alexander Popov 2018-08-17  27  	int ret = 0;
964c9dff009189 Alexander Popov 2018-08-17  28  	int state = !static_branch_unlikely(&stack_erasing_bypass);
964c9dff009189 Alexander Popov 2018-08-17  29  	int prev_state = state;
964c9dff009189 Alexander Popov 2018-08-17  30  
964c9dff009189 Alexander Popov 2018-08-17  31  	table->data = &state;
964c9dff009189 Alexander Popov 2018-08-17  32  	table->maxlen = sizeof(int);
964c9dff009189 Alexander Popov 2018-08-17 @33  	ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
964c9dff009189 Alexander Popov 2018-08-17  34  	state = !!state;
964c9dff009189 Alexander Popov 2018-08-17  35  	if (ret || !write || state == prev_state)
964c9dff009189 Alexander Popov 2018-08-17  36  		return ret;
964c9dff009189 Alexander Popov 2018-08-17  37  
964c9dff009189 Alexander Popov 2018-08-17  38  	if (state)
964c9dff009189 Alexander Popov 2018-08-17  39  		static_branch_disable(&stack_erasing_bypass);
964c9dff009189 Alexander Popov 2018-08-17  40  	else
964c9dff009189 Alexander Popov 2018-08-17  41  		static_branch_enable(&stack_erasing_bypass);
964c9dff009189 Alexander Popov 2018-08-17  42  
964c9dff009189 Alexander Popov 2018-08-17  43  	pr_warn("stackleak: kernel stack erasing is %s\n",
964c9dff009189 Alexander Popov 2018-08-17  44  					state ? "enabled" : "disabled");
964c9dff009189 Alexander Popov 2018-08-17  45  	return ret;
964c9dff009189 Alexander Popov 2018-08-17  46  }
0df8bdd5e3b3e5 Xiaoming Ni     2022-01-21  47  static struct ctl_table stackleak_sysctls[] = {
0df8bdd5e3b3e5 Xiaoming Ni     2022-01-21  48  	{
0df8bdd5e3b3e5 Xiaoming Ni     2022-01-21  49  		.procname	= "stack_erasing",
0df8bdd5e3b3e5 Xiaoming Ni     2022-01-21  50  		.data		= NULL,
0df8bdd5e3b3e5 Xiaoming Ni     2022-01-21  51  		.maxlen		= sizeof(int),
0df8bdd5e3b3e5 Xiaoming Ni     2022-01-21  52  		.mode		= 0600,
0df8bdd5e3b3e5 Xiaoming Ni     2022-01-21 @53  		.proc_handler	= stack_erasing_sysctl,
0df8bdd5e3b3e5 Xiaoming Ni     2022-01-21  54  		.extra1		= SYSCTL_ZERO,
0df8bdd5e3b3e5 Xiaoming Ni     2022-01-21  55  		.extra2		= SYSCTL_ONE,
0df8bdd5e3b3e5 Xiaoming Ni     2022-01-21  56  	},
0df8bdd5e3b3e5 Xiaoming Ni     2022-01-21  57  	{}
0df8bdd5e3b3e5 Xiaoming Ni     2022-01-21  58  };
0df8bdd5e3b3e5 Xiaoming Ni     2022-01-21  59  

:::::: The code at line 33 was first introduced by commit
:::::: 964c9dff0091893a9a74a88edf984c6da0b779f7 stackleak: Allow runtime disabling of kernel stack erasing

:::::: TO: Alexander Popov <alex.popov@...ux.com>
:::::: CC: Kees Cook <keescook@...omium.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