linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Xiaoming Ni <nixiaoming@huawei.com>
Cc: oe-kbuild-all@lists.linux.dev, linux-kernel@vger.kernel.org,
	Luis Chamberlain <mcgrof@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: kernel/stackleak.c:33:50: sparse: sparse: incorrect type in argument 3 (different address spaces)
Date: Wed, 22 Mar 2023 04:17:13 +0800	[thread overview]
Message-ID: <202303220449.l6Q32ILq-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   2faac9a98f010cf5b342fa89ac489c4586364e6e
commit: 0df8bdd5e3b3e557ce2c2575fce0c64c5dd1045a stackleak: move stack_erasing sysctl to stackleak.c
date:   1 year, 2 months ago
config: arm64-randconfig-s032-20230321 (https://download.01.org/0day-ci/archive/20230322/202303220449.l6Q32ILq-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 12.1.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-39-gce1a6720-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
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm64 olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.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 where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303220449.l6Q32ILq-lkp@intel.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

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

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests

             reply	other threads:[~2023-03-21 20:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-21 20:17 kernel test robot [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-09-06  2:16 kernel/stackleak.c:33:50: sparse: sparse: incorrect type in argument 3 (different address spaces) kernel test robot
2022-02-24 10:44 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=202303220449.l6Q32ILq-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mcgrof@kernel.org \
    --cc=nixiaoming@huawei.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    /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;
as well as URLs for NNTP newsgroup(s).