Messages in this thread | | | Date | Fri, 5 Nov 2021 22:46:42 +0800 | From | kernel test robot <> | Subject | [brauner:ioctl_ns_get_init_pid 1/2] fs/nsfs.c:229:21: sparse: sparse: incorrect type in initializer (different address spaces) |
| |
tree: https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git ioctl_ns_get_init_pid head: 8dddb03b10cf28c9bd139beaec8a92531a746a85 commit: 1ad81fd698dd7e6511c3db422eba42dec3ce1b08 [1/2] nsfs: add NS_GET_PID_{FROM,IN}_PIDNS config: sh-randconfig-s031-20211104 (attached as .config) compiler: sh4-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/brauner/linux.git/commit/?id=1ad81fd698dd7e6511c3db422eba42dec3ce1b08 git remote add brauner https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git git fetch --no-tags brauner ioctl_ns_get_init_pid git checkout 1ad81fd698dd7e6511c3db422eba42dec3ce1b08 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=sh
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 >>) >> fs/nsfs.c:229:21: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected unsigned int const *__gu_addr @@ got unsigned int [noderef] [usertype] __user *[assigned] argp @@ fs/nsfs.c:229:21: sparse: expected unsigned int const *__gu_addr fs/nsfs.c:229:21: sparse: got unsigned int [noderef] [usertype] __user *[assigned] argp >> fs/nsfs.c:229:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned int const *__gu_addr @@ fs/nsfs.c:229:21: sparse: expected void const volatile [noderef] __user *ptr fs/nsfs.c:229:21: sparse: got unsigned int const *__gu_addr
vim +229 fs/nsfs.c
188 189 static long ns_ioctl(struct file *filp, unsigned int ioctl, 190 unsigned long arg) 191 { 192 struct user_namespace *user_ns; 193 struct pid_namespace *pid_ns; 194 struct task_struct *tsk; 195 struct ns_common *ns = get_proc_ns(file_inode(filp)); 196 uid_t __user *argp; 197 uid_t uid; 198 pid_t pid_nr; 199 200 switch (ioctl) { 201 case NS_GET_USERNS: 202 return open_related_ns(ns, ns_get_owner); 203 case NS_GET_PARENT: 204 if (!ns->ops->get_parent) 205 return -EINVAL; 206 return open_related_ns(ns, ns->ops->get_parent); 207 case NS_GET_NSTYPE: 208 return ns->ops->type; 209 case NS_GET_OWNER_UID: 210 if (ns->ops->type != CLONE_NEWUSER) 211 return -EINVAL; 212 user_ns = container_of(ns, struct user_namespace, ns); 213 argp = (uid_t __user *) arg; 214 uid = from_kuid_munged(current_user_ns(), user_ns->owner); 215 return put_user(uid, argp); 216 case NS_GET_PID_FROM_PIDNS: 217 fallthrough; 218 case NS_GET_PID_IN_PIDNS: 219 if (ns->ops->type != CLONE_NEWPID) 220 return -EINVAL; 221 222 pid_ns = container_of(ns, struct pid_namespace, ns); 223 224 /* Require the same privilege as for setns(). */ 225 if (!ns_capable(pid_ns->user_ns, CAP_SYS_ADMIN)) 226 return -EPERM; 227 228 argp = (pid_t __user *)arg; > 229 if (get_user(pid_nr, argp)) 230 return -EFAULT; 231 232 pid_nr = -ESRCH; 233 rcu_read_lock(); 234 if (ioctl == NS_GET_PID_IN_PIDNS) { 235 tsk = find_task_by_vpid(pid_nr); 236 if (tsk) 237 pid_nr = task_pid_nr_ns(tsk, pid_ns); 238 } else { 239 tsk = find_task_by_pid_ns(pid_nr, pid_ns); 240 if (tsk) 241 pid_nr = task_pid_vnr(tsk); 242 } 243 rcu_read_unlock(); 244 245 return pid_nr; 246 default: 247 return -ENOTTY; 248 } 249 } 250
--- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org [unhandled content-type:application/gzip] | |