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]
Date:	Wed, 19 Mar 2014 12:04:18 -0400
From:	Sasha Levin <sasha.levin@...cle.com>
To:	penberg@....fi
Cc:	mingo@...nel.org, kvm@...r.kernel.org,
	linux-kernel@...r.kernel.org, Sasha Levin <sasha.levin@...cle.com>
Subject: [PATCH] kvm tools: treat uids and gids in stat structure properly

Upstream commit "9p: Modify the stat structures to use kuid_t and kgid_t"
has modified the type of uid and gid in the stat structure, which breaks
build for us.

This is a rather trivial conversion from u32 to kuid_t and kgid_t.

Reported-by: Ingo Molnar <mingo@...nel.org>
Signed-off-by: Sasha Levin <sasha.levin@...cle.com>
---
 tools/kvm/virtio/9p-pdu.c |    4 +++-
 tools/kvm/virtio/9p.c     |   11 ++++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/tools/kvm/virtio/9p-pdu.c b/tools/kvm/virtio/9p-pdu.c
index 9e95f3b..cc2e871 100644
--- a/tools/kvm/virtio/9p-pdu.c
+++ b/tools/kvm/virtio/9p-pdu.c
@@ -129,7 +129,9 @@ static int virtio_p9_decode(struct p9_pdu *pdu, const char *fmt, va_list ap)
 		{
 			struct p9_wstat *stbuf = va_arg(ap, struct p9_wstat *);
 			memset(stbuf, 0, sizeof(struct p9_wstat));
-			stbuf->n_uid = stbuf->n_gid = stbuf->n_muid = -1;
+			stbuf->n_uid = KUIDT_INIT(-1);
+			stbuf->n_gid = KGIDT_INIT(-1);
+			stbuf->n_muid = KUIDT_INIT(-1);
 			retval = virtio_p9_pdu_readf(pdu, "wwdQdddqssss",
 						&stbuf->size, &stbuf->type,
 						&stbuf->dev, &stbuf->qid,
diff --git a/tools/kvm/virtio/9p.c b/tools/kvm/virtio/9p.c
index 25cdd8c..847eddb 100644
--- a/tools/kvm/virtio/9p.c
+++ b/tools/kvm/virtio/9p.c
@@ -441,8 +441,8 @@ static void virtio_p9_fill_stat(struct p9_dev *p9dev,
 	memset(statl, 0, sizeof(*statl));
 	statl->st_mode		= st->st_mode;
 	statl->st_nlink		= st->st_nlink;
-	statl->st_uid		= st->st_uid;
-	statl->st_gid		= st->st_gid;
+	statl->st_uid		= KUIDT_INIT(st->st_uid);
+	statl->st_gid		= KGIDT_INIT(st->st_gid);
 	statl->st_rdev		= st->st_rdev;
 	statl->st_size		= st->st_size;
 	statl->st_blksize	= st->st_blksize;
@@ -668,12 +668,13 @@ static void virtio_p9_setattr(struct p9_dev *p9dev,
 	    ((p9attr.valid & ATTR_CTIME)
 	     && !((p9attr.valid & ATTR_MASK) & ~ATTR_CTIME))) {
 		if (!(p9attr.valid & ATTR_UID))
-			p9attr.uid = -1;
+			p9attr.uid = KUIDT_INIT(-1);
 
 		if (!(p9attr.valid & ATTR_GID))
-			p9attr.gid = -1;
+			p9attr.gid = KGIDT_INIT(-1);
 
-		ret = lchown(fid->abs_path, p9attr.uid, p9attr.gid);
+		ret = lchown(fid->abs_path, __kuid_val(p9attr.uid),
+				__kgid_val(p9attr.gid));
 		if (ret < 0)
 			goto err_out;
 	}
-- 
1.7.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ