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: <202108250232.C2AxNGcn-lkp@intel.com>
Date:   Wed, 25 Aug 2021 02:59:39 +0800
From:   kernel test robot <lkp@...el.com>
To:     Jeff Layton <jlayton@...nel.org>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: [jlayton:ceph-fscrypt-size 38/40] fs/ceph/caps.c:4189:43: error:
 incompatible type for argument 3 of 'parse_fscrypt_fields'

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git ceph-fscrypt-size
head:   a17ec2cafbd2fc0e04e8787810bec64849190db2
commit: 43bdcb97d537c60bc43663c0219a76701332618e [38/40] ceph: handle fscrypt fields in cap messages from MDS
config: i386-randconfig-a006-20210824 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
        # https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git/commit/?id=43bdcb97d537c60bc43663c0219a76701332618e
        git remote add jlayton https://git.kernel.org/pub/scm/linux/kernel/git/jlayton/linux.git
        git fetch --no-tags jlayton ceph-fscrypt-size
        git checkout 43bdcb97d537c60bc43663c0219a76701332618e
        # save the attached .config to linux build tree
        mkdir build_dir
        make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash fs/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All errors (new ones prefixed by >>):

   In file included from fs/ceph/super.h:29,
                    from fs/ceph/caps.c:13:
   fs/ceph/crypto.h:6: error: unterminated #ifndef
       6 | #ifndef _CEPH_CRYPTO_H
         | 
   In file included from fs/ceph/caps.c:16:
   fs/ceph/crypto.h:6: error: unterminated #ifndef
       6 | #ifndef _CEPH_CRYPTO_H
         | 
   In file included from include/linux/ceph/osdmap.h:7,
                    from include/linux/ceph/osd_client.h:14,
                    from include/linux/ceph/libceph.h:24,
                    from fs/ceph/super.h:22,
                    from fs/ceph/caps.c:13:
   fs/ceph/caps.c: In function 'parse_fscrypt_fields':
>> include/linux/ceph/decode.h:71:5: error: lvalue required as left operand of assignment
      71 |   v = ceph_decode_32(p);    \
         |     ^
   fs/ceph/caps.c:4058:2: note: in expansion of macro 'ceph_decode_32_safe'
    4058 |  ceph_decode_32_safe(p, end, &len, bad);
         |  ^~~~~~~~~~~~~~~~~~~
>> include/linux/ceph/decode.h:71:5: error: lvalue required as left operand of assignment
      71 |   v = ceph_decode_32(p);    \
         |     ^
   fs/ceph/caps.c:4061:2: note: in expansion of macro 'ceph_decode_32_safe'
    4061 |  ceph_decode_32_safe(p, end, &len, bad);
         |  ^~~~~~~~~~~~~~~~~~~
   fs/ceph/caps.c: In function 'ceph_handle_caps':
>> fs/ceph/caps.c:4189:43: error: incompatible type for argument 3 of 'parse_fscrypt_fields'
    4189 |   int ret = parse_fscrypt_fields(&p, end, &extra_info);
         |                                           ^~~~~~~~~~~
         |                                           |
         |                                           struct cap_extra_info *
   fs/ceph/caps.c:4053:76: note: expected 'struct cap_extra_info' but argument is of type 'struct cap_extra_info *'
    4053 | static int parse_fscrypt_fields(void **p, void *end, struct cap_extra_info extra)
         |                                                      ~~~~~~~~~~~~~~~~~~~~~~^~~~~
   fs/ceph/caps.c: In function 'ceph_encode_dentry_release':
   fs/ceph/caps.c:4640:15: error: implicit declaration of function 'ceph_encode_encrypted_fname'; did you mean 'ceph_encode_dentry_release'? [-Werror=implicit-function-declaration]
    4640 |    int ret2 = ceph_encode_encrypted_fname(dir, dentry, *p);
         |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~
         |               ceph_encode_dentry_release
   cc1: some warnings being treated as errors


vim +/parse_fscrypt_fields +4189 fs/ceph/caps.c

  4027	
  4028	#ifdef CONFIG_FS_ENCRYPTION
  4029	static int parse_fscrypt_fields(void **p, void *end, struct cap_extra_info *extra)
  4030	{
  4031		u32 len;
  4032	
  4033		ceph_decode_32_safe(p, end, extra->fscrypt_auth_len, bad);
  4034		if (extra->fscrypt_auth_len) {
  4035			ceph_decode_need(p, end, extra->fscrypt_auth_len, bad);
  4036			extra->fscrypt_auth = kmalloc(extra->fscrypt_auth_len, GFP_KERNEL);
  4037			if (!extra->fscrypt_auth)
  4038				return -ENOMEM;
  4039			ceph_decode_copy_safe(p, end, extra->fscrypt_auth,
  4040						extra->fscrypt_auth_len, bad);
  4041		}
  4042	
  4043		ceph_decode_32_safe(p, end, len, bad);
  4044		if (len == sizeof(u64))
  4045			ceph_decode_64_safe(p, end, extra->fscrypt_file_size, bad);
  4046		else
  4047			ceph_decode_skip_n(p, end, len, bad);
  4048		return 0;
  4049	bad:
  4050		return -EIO;
  4051	}
  4052	#else
  4053	static int parse_fscrypt_fields(void **p, void *end, struct cap_extra_info extra)
  4054	{
  4055		u32 len;
  4056	
  4057		/* Don't care about these fields unless we're encryption-capable */
  4058		ceph_decode_32_safe(p, end, &len, bad);
  4059		if (len)
  4060			ceph_decode_skip_n(p, end, len, bad);
> 4061		ceph_decode_32_safe(p, end, &len, bad);
  4062		if (len)
  4063			ceph_decode_skip_n(p, end, len, bad);
  4064		return 0;
  4065	bad:
  4066		return -EIO;
  4067	}
  4068	#endif
  4069	
  4070	/*
  4071	 * Handle a caps message from the MDS.
  4072	 *
  4073	 * Identify the appropriate session, inode, and call the right handler
  4074	 * based on the cap op.
  4075	 */
  4076	void ceph_handle_caps(struct ceph_mds_session *session,
  4077			      struct ceph_msg *msg)
  4078	{
  4079		struct ceph_mds_client *mdsc = session->s_mdsc;
  4080		struct inode *inode;
  4081		struct ceph_inode_info *ci;
  4082		struct ceph_cap *cap;
  4083		struct ceph_mds_caps *h;
  4084		struct ceph_mds_cap_peer *peer = NULL;
  4085		struct ceph_snap_realm *realm = NULL;
  4086		int op;
  4087		int msg_version = le16_to_cpu(msg->hdr.version);
  4088		u32 seq, mseq;
  4089		struct ceph_vino vino;
  4090		void *snaptrace;
  4091		size_t snaptrace_len;
  4092		void *p, *end;
  4093		struct cap_extra_info extra_info = {};
  4094		bool queue_trunc;
  4095	
  4096		dout("handle_caps from mds%d\n", session->s_mds);
  4097	
  4098		/* decode */
  4099		end = msg->front.iov_base + msg->front.iov_len;
  4100		if (msg->front.iov_len < sizeof(*h))
  4101			goto bad;
  4102		h = msg->front.iov_base;
  4103		op = le32_to_cpu(h->op);
  4104		vino.ino = le64_to_cpu(h->ino);
  4105		vino.snap = CEPH_NOSNAP;
  4106		seq = le32_to_cpu(h->seq);
  4107		mseq = le32_to_cpu(h->migrate_seq);
  4108	
  4109		snaptrace = h + 1;
  4110		snaptrace_len = le32_to_cpu(h->snap_trace_len);
  4111		p = snaptrace + snaptrace_len;
  4112	
  4113		if (msg_version >= 2) {
  4114			u32 flock_len;
  4115			ceph_decode_32_safe(&p, end, flock_len, bad);
  4116			if (p + flock_len > end)
  4117				goto bad;
  4118			p += flock_len;
  4119		}
  4120	
  4121		if (msg_version >= 3) {
  4122			if (op == CEPH_CAP_OP_IMPORT) {
  4123				if (p + sizeof(*peer) > end)
  4124					goto bad;
  4125				peer = p;
  4126				p += sizeof(*peer);
  4127			} else if (op == CEPH_CAP_OP_EXPORT) {
  4128				/* recorded in unused fields */
  4129				peer = (void *)&h->size;
  4130			}
  4131		}
  4132	
  4133		if (msg_version >= 4) {
  4134			ceph_decode_64_safe(&p, end, extra_info.inline_version, bad);
  4135			ceph_decode_32_safe(&p, end, extra_info.inline_len, bad);
  4136			if (p + extra_info.inline_len > end)
  4137				goto bad;
  4138			extra_info.inline_data = p;
  4139			p += extra_info.inline_len;
  4140		}
  4141	
  4142		if (msg_version >= 5) {
  4143			struct ceph_osd_client	*osdc = &mdsc->fsc->client->osdc;
  4144			u32			epoch_barrier;
  4145	
  4146			ceph_decode_32_safe(&p, end, epoch_barrier, bad);
  4147			ceph_osdc_update_epoch_barrier(osdc, epoch_barrier);
  4148		}
  4149	
  4150		if (msg_version >= 8) {
  4151			u32 pool_ns_len;
  4152	
  4153			/* version >= 6 */
  4154			ceph_decode_skip_64(&p, end, bad);	// flush_tid
  4155			/* version >= 7 */
  4156			ceph_decode_skip_32(&p, end, bad);	// caller_uid
  4157			ceph_decode_skip_32(&p, end, bad);	// caller_gid
  4158			/* version >= 8 */
  4159			ceph_decode_32_safe(&p, end, pool_ns_len, bad);
  4160			if (pool_ns_len > 0) {
  4161				ceph_decode_need(&p, end, pool_ns_len, bad);
  4162				extra_info.pool_ns =
  4163					ceph_find_or_create_string(p, pool_ns_len);
  4164				p += pool_ns_len;
  4165			}
  4166		}
  4167	
  4168		if (msg_version >= 9) {
  4169			struct ceph_timespec *btime;
  4170	
  4171			if (p + sizeof(*btime) > end)
  4172				goto bad;
  4173			btime = p;
  4174			ceph_decode_timespec64(&extra_info.btime, btime);
  4175			p += sizeof(*btime);
  4176			ceph_decode_64_safe(&p, end, extra_info.change_attr, bad);
  4177		}
  4178	
  4179		if (msg_version >= 11) {
  4180			/* version >= 10 */
  4181			ceph_decode_skip_32(&p, end, bad); // flags
  4182			/* version >= 11 */
  4183			extra_info.dirstat_valid = true;
  4184			ceph_decode_64_safe(&p, end, extra_info.nfiles, bad);
  4185			ceph_decode_64_safe(&p, end, extra_info.nsubdirs, bad);
  4186		}
  4187	
  4188		if (msg_version >= 12) {
> 4189			int ret = parse_fscrypt_fields(&p, end, &extra_info);
  4190			if (ret)
  4191				goto bad;
  4192		}
  4193	
  4194		/* lookup ino */
  4195		inode = ceph_find_inode(mdsc->fsc->sb, vino);
  4196		ci = ceph_inode(inode);
  4197		dout(" op %s ino %llx.%llx inode %p\n", ceph_cap_op_name(op), vino.ino,
  4198		     vino.snap, inode);
  4199	
  4200		mutex_lock(&session->s_mutex);
  4201		inc_session_sequence(session);
  4202		dout(" mds%d seq %lld cap seq %u\n", session->s_mds, session->s_seq,
  4203		     (unsigned)seq);
  4204	
  4205		if (!inode) {
  4206			if (op == CEPH_CAP_OP_FLUSH_ACK)
  4207				pr_info("%s: can't find ino %llx:%llx for flush_ack!\n",
  4208					__func__, vino.snap, vino.ino);
  4209			else
  4210				dout(" i don't have ino %llx\n", vino.ino);
  4211	
  4212			if (op == CEPH_CAP_OP_IMPORT) {
  4213				cap = ceph_get_cap(mdsc, NULL);
  4214				cap->cap_ino = vino.ino;
  4215				cap->queue_release = 1;
  4216				cap->cap_id = le64_to_cpu(h->cap_id);
  4217				cap->mseq = mseq;
  4218				cap->seq = seq;
  4219				cap->issue_seq = seq;
  4220				spin_lock(&session->s_cap_lock);
  4221				__ceph_queue_cap_release(session, cap);
  4222				spin_unlock(&session->s_cap_lock);
  4223			}
  4224			goto flush_cap_releases;
  4225		}
  4226	
  4227		/* these will work even if we don't have a cap yet */
  4228		switch (op) {
  4229		case CEPH_CAP_OP_FLUSHSNAP_ACK:
  4230			handle_cap_flushsnap_ack(inode, le64_to_cpu(msg->hdr.tid),
  4231						 h, session);
  4232			goto done;
  4233	
  4234		case CEPH_CAP_OP_EXPORT:
  4235			handle_cap_export(inode, h, peer, session);
  4236			goto done_unlocked;
  4237	
  4238		case CEPH_CAP_OP_IMPORT:
  4239			realm = NULL;
  4240			if (snaptrace_len) {
  4241				down_write(&mdsc->snap_rwsem);
  4242				ceph_update_snap_trace(mdsc, snaptrace,
  4243						       snaptrace + snaptrace_len,
  4244						       false, &realm);
  4245				downgrade_write(&mdsc->snap_rwsem);
  4246			} else {
  4247				down_read(&mdsc->snap_rwsem);
  4248			}
  4249			spin_lock(&ci->i_ceph_lock);
  4250			handle_cap_import(mdsc, inode, h, peer, session,
  4251					  &cap, &extra_info.issued);
  4252			handle_cap_grant(inode, session, cap,
  4253					 h, msg->middle, &extra_info);
  4254			if (realm)
  4255				ceph_put_snap_realm(mdsc, realm);
  4256			goto done_unlocked;
  4257		}
  4258	
  4259		/* the rest require a cap */
  4260		spin_lock(&ci->i_ceph_lock);
  4261		cap = __get_cap_for_mds(ceph_inode(inode), session->s_mds);
  4262		if (!cap) {
  4263			dout(" no cap on %p ino %llx:%llx from mds%d\n",
  4264			     inode, ceph_ino(inode), ceph_snap(inode),
  4265			     session->s_mds);
  4266			spin_unlock(&ci->i_ceph_lock);
  4267			if (op == CEPH_CAP_OP_FLUSH_ACK)
  4268				pr_info("%s: no cap on %p ino %llx:%llx from mds%d for flush_ack!\n",
  4269					__func__, inode, ceph_ino(inode),
  4270					ceph_snap(inode), session->s_mds);
  4271			goto flush_cap_releases;
  4272		}
  4273	
  4274		/* note that each of these drops i_ceph_lock for us */
  4275		switch (op) {
  4276		case CEPH_CAP_OP_REVOKE:
  4277		case CEPH_CAP_OP_GRANT:
  4278			__ceph_caps_issued(ci, &extra_info.issued);
  4279			extra_info.issued |= __ceph_caps_dirty(ci);
  4280			handle_cap_grant(inode, session, cap,
  4281					 h, msg->middle, &extra_info);
  4282			goto done_unlocked;
  4283	
  4284		case CEPH_CAP_OP_FLUSH_ACK:
  4285			handle_cap_flush_ack(inode, le64_to_cpu(msg->hdr.tid),
  4286					     h, session, cap);
  4287			break;
  4288	
  4289		case CEPH_CAP_OP_TRUNC:
  4290			queue_trunc = handle_cap_trunc(inode, h, session,
  4291							&extra_info);
  4292			spin_unlock(&ci->i_ceph_lock);
  4293			if (queue_trunc)
  4294				ceph_queue_vmtruncate(inode);
  4295			break;
  4296	
  4297		default:
  4298			spin_unlock(&ci->i_ceph_lock);
  4299			pr_err("ceph_handle_caps: unknown cap op %d %s\n", op,
  4300			       ceph_cap_op_name(op));
  4301		}
  4302	
  4303	done:
  4304		mutex_unlock(&session->s_mutex);
  4305	done_unlocked:
  4306		iput(inode);
  4307	out:
  4308		ceph_put_string(extra_info.pool_ns);
  4309		kfree(extra_info.fscrypt_auth);
  4310		return;
  4311	
  4312	flush_cap_releases:
  4313		/*
  4314		 * send any cap release message to try to move things
  4315		 * along for the mds (who clearly thinks we still have this
  4316		 * cap).
  4317		 */
  4318		ceph_flush_cap_releases(mdsc, session);
  4319		goto done;
  4320	bad:
  4321		pr_err("ceph_handle_caps: corrupt message\n");
  4322		ceph_msg_dump(msg);
  4323		goto out;
  4324	}
  4325	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (35799 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ