[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202211291728.HzBtk4p7-lkp@intel.com>
Date: Tue, 29 Nov 2022 18:01:59 +0800
From: kernel test robot <lkp@...el.com>
To: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
x86@...nel.org, Dave Hansen <dave.hansen@...ux.intel.com>
Subject: [tip:x86/mm 5/16] security/selinux/hooks.c:5152:13: sparse: sparse:
incorrect type in assignment (different address spaces)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git x86/mm
head: 2072e952de1d5c2748165a6818e4986d24dae06e
commit: 5744534bdae403270f86d934a6c5878da6a5a64f [5/16] x86/uaccess: Provide untagged_addr() and remove tags before address check
config: x86_64-randconfig-s022-20221128
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/commit/?id=5744534bdae403270f86d934a6c5878da6a5a64f
git remote add tip https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
git fetch --no-tags tip x86/mm
git checkout 5744534bdae403270f86d934a6c5878da6a5a64f
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash security/selinux/ security/smack/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
sparse warnings: (new ones prefixed by >>)
security/selinux/hooks.c: note: in included file:
include/net/sctp/structs.h:335:41: sparse: sparse: array of flexible structures
>> security/selinux/hooks.c:5152:13: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected int [noderef] __user *__ptr_clean @@ got int * @@
security/selinux/hooks.c:5152:13: sparse: expected int [noderef] __user *__ptr_clean
security/selinux/hooks.c:5152:13: sparse: got int *
security/selinux/hooks.c:5410:22: sparse: sparse: restricted __be16 degrades to integer
security/selinux/hooks.c:5411:22: sparse: sparse: restricted __be16 degrades to integer
--
security/smack/smack_lsm.c:1759:61: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct cred const *cred @@ got struct cred const [noderef] __rcu *cred @@
security/smack/smack_lsm.c:1759:61: sparse: expected struct cred const *cred
security/smack/smack_lsm.c:1759:61: sparse: got struct cred const [noderef] __rcu *cred
>> security/smack/smack_lsm.c:4028:13: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected int [noderef] __user *__ptr_clean @@ got int * @@
security/smack/smack_lsm.c:4028:13: sparse: expected int [noderef] __user *__ptr_clean
security/smack/smack_lsm.c:4028:13: sparse: got int *
security/smack/smack_lsm.c:4977:30: sparse: sparse: cast removes address space '__rcu' of expression
vim +5152 security/selinux/hooks.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 5121
2c7946a7bf45ae Catherine Zhang 2006-03-20 5122 static int selinux_socket_getpeersec_stream(struct socket *sock, char __user *optval,
^1da177e4c3f41 Linus Torvalds 2005-04-16 5123 int __user *optlen, unsigned len)
^1da177e4c3f41 Linus Torvalds 2005-04-16 5124 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 5125 int err = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 5126 char *scontext;
^1da177e4c3f41 Linus Torvalds 2005-04-16 5127 u32 scontext_len;
253bfae6e0ad97 Paul Moore 2010-04-22 5128 struct sk_security_struct *sksec = sock->sk->sk_security;
3de4bab5b9f884 Paul Moore 2006-11-17 5129 u32 peer_sid = SECSID_NULL;
^1da177e4c3f41 Linus Torvalds 2005-04-16 5130
253bfae6e0ad97 Paul Moore 2010-04-22 5131 if (sksec->sclass == SECCLASS_UNIX_STREAM_SOCKET ||
d452930fd3b903 Richard Haines 2018-02-13 5132 sksec->sclass == SECCLASS_TCP_SOCKET ||
d452930fd3b903 Richard Haines 2018-02-13 5133 sksec->sclass == SECCLASS_SCTP_SOCKET)
dd3e7836bfe093 Eric Paris 2010-04-07 5134 peer_sid = sksec->peer_sid;
253bfae6e0ad97 Paul Moore 2010-04-22 5135 if (peer_sid == SECSID_NULL)
253bfae6e0ad97 Paul Moore 2010-04-22 5136 return -ENOPROTOOPT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 5137
aa8e712cee93d5 Stephen Smalley 2018-03-01 5138 err = security_sid_to_context(&selinux_state, peer_sid, &scontext,
aa8e712cee93d5 Stephen Smalley 2018-03-01 5139 &scontext_len);
^1da177e4c3f41 Linus Torvalds 2005-04-16 5140 if (err)
253bfae6e0ad97 Paul Moore 2010-04-22 5141 return err;
^1da177e4c3f41 Linus Torvalds 2005-04-16 5142
^1da177e4c3f41 Linus Torvalds 2005-04-16 5143 if (scontext_len > len) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 5144 err = -ERANGE;
^1da177e4c3f41 Linus Torvalds 2005-04-16 5145 goto out_len;
^1da177e4c3f41 Linus Torvalds 2005-04-16 5146 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 5147
^1da177e4c3f41 Linus Torvalds 2005-04-16 5148 if (copy_to_user(optval, scontext, scontext_len))
^1da177e4c3f41 Linus Torvalds 2005-04-16 5149 err = -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 5150
^1da177e4c3f41 Linus Torvalds 2005-04-16 5151 out_len:
^1da177e4c3f41 Linus Torvalds 2005-04-16 @5152 if (put_user(scontext_len, optlen))
^1da177e4c3f41 Linus Torvalds 2005-04-16 5153 err = -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 5154 kfree(scontext);
^1da177e4c3f41 Linus Torvalds 2005-04-16 5155 return err;
^1da177e4c3f41 Linus Torvalds 2005-04-16 5156 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 5157
:::::: The code at line 5152 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2
:::::: TO: Linus Torvalds <torvalds@...970.osdl.org>
:::::: CC: Linus Torvalds <torvalds@...970.osdl.org>
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (164412 bytes)
Powered by blists - more mailing lists