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: <202111270700.JpIS0kPB-lkp@intel.com>
Date:   Sat, 27 Nov 2021 07:22:29 +0800
From:   kernel test robot <lkp@...el.com>
To:     Christian Brauner <christian.brauner@...ntu.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: [brauner:fs.fixes.ceph 1/1] fs/ceph/file.c:613:24: sparse: sparse:
 incorrect type in assignment (different base types)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git fs.fixes.ceph
head:   5eb2c57bf8928aecfe8c06fbeaf09e1ab0741337
commit: 5eb2c57bf8928aecfe8c06fbeaf09e1ab0741337 [1/1] ceph: fix up non-directory creation in SGID directories
config: x86_64-randconfig-s021-20211126 (https://download.01.org/0day-ci/archive/20211127/202111270700.JpIS0kPB-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/brauner/linux.git/commit/?id=5eb2c57bf8928aecfe8c06fbeaf09e1ab0741337
        git remote add brauner https://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux.git
        git fetch --no-tags brauner fs.fixes.ceph
        git checkout 5eb2c57bf8928aecfe8c06fbeaf09e1ab0741337
        # save the config file to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash fs/ceph/

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 >>)
>> fs/ceph/file.c:613:24: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [addressable] [assigned] [usertype] gid @@     got unsigned int @@
   fs/ceph/file.c:613:24: sparse:     expected restricted __le32 [addressable] [assigned] [usertype] gid
   fs/ceph/file.c:613:24: sparse:     got unsigned int
   fs/ceph/file.c:623:24: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le32 [addressable] [assigned] [usertype] gid @@     got unsigned int @@
   fs/ceph/file.c:623:24: sparse:     expected restricted __le32 [addressable] [assigned] [usertype] gid
   fs/ceph/file.c:623:24: sparse:     got unsigned int

vim +613 fs/ceph/file.c

   568	
   569	static int ceph_finish_async_create(struct inode *dir, struct dentry *dentry,
   570					    struct file *file, umode_t mode,
   571					    struct ceph_mds_request *req,
   572					    struct ceph_acl_sec_ctx *as_ctx,
   573					    struct ceph_file_layout *lo)
   574	{
   575		int ret;
   576		char xattr_buf[4];
   577		struct ceph_mds_reply_inode in = { };
   578		struct ceph_mds_reply_info_in iinfo = { .in = &in };
   579		struct ceph_inode_info *ci = ceph_inode(dir);
   580		struct inode *inode;
   581		struct timespec64 now;
   582		struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(dir->i_sb);
   583		struct ceph_vino vino = { .ino = req->r_deleg_ino,
   584					  .snap = CEPH_NOSNAP };
   585	
   586		ktime_get_real_ts64(&now);
   587	
   588		inode = ceph_get_inode(dentry->d_sb, vino);
   589		if (IS_ERR(inode))
   590			return PTR_ERR(inode);
   591	
   592		iinfo.inline_version = CEPH_INLINE_NONE;
   593		iinfo.change_attr = 1;
   594		ceph_encode_timespec64(&iinfo.btime, &now);
   595	
   596		iinfo.xattr_len = ARRAY_SIZE(xattr_buf);
   597		iinfo.xattr_data = xattr_buf;
   598		memset(iinfo.xattr_data, 0, iinfo.xattr_len);
   599	
   600		in.ino = cpu_to_le64(vino.ino);
   601		in.snapid = cpu_to_le64(CEPH_NOSNAP);
   602		in.version = cpu_to_le64(1);	// ???
   603		in.cap.caps = in.cap.wanted = cpu_to_le32(CEPH_CAP_ALL_FILE);
   604		in.cap.cap_id = cpu_to_le64(1);
   605		in.cap.realm = cpu_to_le64(ci->i_snap_realm->ino);
   606		in.cap.flags = CEPH_CAP_FLAG_AUTH;
   607		in.ctime = in.mtime = in.atime = iinfo.btime;
   608		in.truncate_seq = cpu_to_le32(1);
   609		in.truncate_size = cpu_to_le64(-1ULL);
   610		in.xattr_version = cpu_to_le64(1);
   611		in.uid = cpu_to_le32(from_kuid(&init_user_ns, current_fsuid()));
   612		if (dir->i_mode & S_ISGID) {
 > 613			in.gid = from_kgid(&init_user_ns, dir->i_gid);
   614	
   615			/* Directories always inherit the setgid bit. */
   616			if (S_ISDIR(mode))
   617				mode |= S_ISGID;
   618			else if ((mode & (S_ISGID | S_IXGRP)) == (S_ISGID | S_IXGRP) &&
   619				 !in_group_p(dir->i_gid) &&
   620				 !capable_wrt_inode_uidgid(&init_user_ns, dir, CAP_FSETID))
   621				mode &= ~S_ISGID;
   622		} else {
   623			in.gid = from_kgid(&init_user_ns, current_fsgid());
   624		}
   625		in.mode = cpu_to_le32((u32)mode);
   626	
   627		in.nlink = cpu_to_le32(1);
   628		in.max_size = cpu_to_le64(lo->stripe_unit);
   629	
   630		ceph_file_layout_to_legacy(lo, &in.layout);
   631	
   632		down_read(&mdsc->snap_rwsem);
   633		ret = ceph_fill_inode(inode, NULL, &iinfo, NULL, req->r_session,
   634				      req->r_fmode, NULL);
   635		up_read(&mdsc->snap_rwsem);
   636		if (ret) {
   637			dout("%s failed to fill inode: %d\n", __func__, ret);
   638			ceph_dir_clear_complete(dir);
   639			if (!d_unhashed(dentry))
   640				d_drop(dentry);
   641			if (inode->i_state & I_NEW)
   642				discard_new_inode(inode);
   643		} else {
   644			struct dentry *dn;
   645	
   646			dout("%s d_adding new inode 0x%llx to 0x%llx/%s\n", __func__,
   647				vino.ino, ceph_ino(dir), dentry->d_name.name);
   648			ceph_dir_clear_ordered(dir);
   649			ceph_init_inode_acls(inode, as_ctx);
   650			if (inode->i_state & I_NEW) {
   651				/*
   652				 * If it's not I_NEW, then someone created this before
   653				 * we got here. Assume the server is aware of it at
   654				 * that point and don't worry about setting
   655				 * CEPH_I_ASYNC_CREATE.
   656				 */
   657				ceph_inode(inode)->i_ceph_flags = CEPH_I_ASYNC_CREATE;
   658				unlock_new_inode(inode);
   659			}
   660			if (d_in_lookup(dentry) || d_really_is_negative(dentry)) {
   661				if (!d_unhashed(dentry))
   662					d_drop(dentry);
   663				dn = d_splice_alias(inode, dentry);
   664				WARN_ON_ONCE(dn && dn != dentry);
   665			}
   666			file->f_mode |= FMODE_CREATED;
   667			ret = finish_open(file, dentry, ceph_open);
   668		}
   669		return ret;
   670	}
   671	

---
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