aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-02-09 12:10:30 -0500
committerEric W. Biederman <ebiederm@xmission.com>2012-05-15 17:08:35 -0400
commita7c1938e22c02b008655524c766d185ae99d9d53 (patch)
treef6b862a5d187908007614e5537f4cd1e31a40df4 /arch
parent52137abe1820196d956bfd51edebc571b3427deb (diff)
userns: Convert stat to return values mapped from kuids and kgids
- Store uids and gids with kuid_t and kgid_t in struct kstat - Convert uid and gids to userspace usable values with from_kuid and from_kgid Acked-by: Serge Hallyn <serge.hallyn@canonical.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/kernel/sys_oabi-compat.c4
-rw-r--r--arch/parisc/hpux/fs.c4
-rw-r--r--arch/s390/kernel/compat_linux.c4
-rw-r--r--arch/sparc/kernel/sys_sparc32.c4
-rw-r--r--arch/x86/ia32/sys_ia32.c4
5 files changed, 10 insertions, 10 deletions
diff --git a/arch/arm/kernel/sys_oabi-compat.c b/arch/arm/kernel/sys_oabi-compat.c
index af0aaebf4de6..3e94811690ce 100644
--- a/arch/arm/kernel/sys_oabi-compat.c
+++ b/arch/arm/kernel/sys_oabi-compat.c
@@ -124,8 +124,8 @@ static long cp_oldabi_stat64(struct kstat *stat,
124 tmp.__st_ino = stat->ino; 124 tmp.__st_ino = stat->ino;
125 tmp.st_mode = stat->mode; 125 tmp.st_mode = stat->mode;
126 tmp.st_nlink = stat->nlink; 126 tmp.st_nlink = stat->nlink;
127 tmp.st_uid = stat->uid; 127 tmp.st_uid = from_kuid_munged(current_user_ns(), stat->uid);
128 tmp.st_gid = stat->gid; 128 tmp.st_gid = from_kgid_munged(current_user_ns(), stat->gid);
129 tmp.st_rdev = huge_encode_dev(stat->rdev); 129 tmp.st_rdev = huge_encode_dev(stat->rdev);
130 tmp.st_size = stat->size; 130 tmp.st_size = stat->size;
131 tmp.st_blocks = stat->blocks; 131 tmp.st_blocks = stat->blocks;
diff --git a/arch/parisc/hpux/fs.c b/arch/parisc/hpux/fs.c
index 0dc8543acb4f..c71eb6c79897 100644
--- a/arch/parisc/hpux/fs.c
+++ b/arch/parisc/hpux/fs.c
@@ -159,8 +159,8 @@ static int cp_hpux_stat(struct kstat *stat, struct hpux_stat64 __user *statbuf)
159 tmp.st_ino = stat->ino; 159 tmp.st_ino = stat->ino;
160 tmp.st_mode = stat->mode; 160 tmp.st_mode = stat->mode;
161 tmp.st_nlink = stat->nlink; 161 tmp.st_nlink = stat->nlink;
162 tmp.st_uid = stat->uid; 162 tmp.st_uid = from_kuid_munged(current_user_ns(), stat->uid);
163 tmp.st_gid = stat->gid; 163 tmp.st_gid = from_kgid_munged(current_user_ns(), stat->gid);
164 tmp.st_rdev = new_encode_dev(stat->rdev); 164 tmp.st_rdev = new_encode_dev(stat->rdev);
165 tmp.st_size = stat->size; 165 tmp.st_size = stat->size;
166 tmp.st_atime = stat->atime.tv_sec; 166 tmp.st_atime = stat->atime.tv_sec;
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index f0273ed760ef..65426525d9f2 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -547,8 +547,8 @@ static int cp_stat64(struct stat64_emu31 __user *ubuf, struct kstat *stat)
547 tmp.__st_ino = (u32)stat->ino; 547 tmp.__st_ino = (u32)stat->ino;
548 tmp.st_mode = stat->mode; 548 tmp.st_mode = stat->mode;
549 tmp.st_nlink = (unsigned int)stat->nlink; 549 tmp.st_nlink = (unsigned int)stat->nlink;
550 tmp.st_uid = stat->uid; 550 tmp.st_uid = from_kuid_munged(current_user_ns(), stat->uid);
551 tmp.st_gid = stat->gid; 551 tmp.st_gid = from_kgid_munged(current_user_ns(), stat->gid);
552 tmp.st_rdev = huge_encode_dev(stat->rdev); 552 tmp.st_rdev = huge_encode_dev(stat->rdev);
553 tmp.st_size = stat->size; 553 tmp.st_size = stat->size;
554 tmp.st_blksize = (u32)stat->blksize; 554 tmp.st_blksize = (u32)stat->blksize;
diff --git a/arch/sparc/kernel/sys_sparc32.c b/arch/sparc/kernel/sys_sparc32.c
index 29c478ffed91..f7392336961f 100644
--- a/arch/sparc/kernel/sys_sparc32.c
+++ b/arch/sparc/kernel/sys_sparc32.c
@@ -139,8 +139,8 @@ static int cp_compat_stat64(struct kstat *stat,
139 err |= put_user(stat->ino, &statbuf->st_ino); 139 err |= put_user(stat->ino, &statbuf->st_ino);
140 err |= put_user(stat->mode, &statbuf->st_mode); 140 err |= put_user(stat->mode, &statbuf->st_mode);
141 err |= put_user(stat->nlink, &statbuf->st_nlink); 141 err |= put_user(stat->nlink, &statbuf->st_nlink);
142 err |= put_user(stat->uid, &statbuf->st_uid); 142 err |= put_user(from_kuid_munged(current_user_ns(), stat->uid), &statbuf->st_uid);
143 err |= put_user(stat->gid, &statbuf->st_gid); 143 err |= put_user(from_kgid_munged(current_user_ns(), stat->gid), &statbuf->st_gid);
144 err |= put_user(huge_encode_dev(stat->rdev), &statbuf->st_rdev); 144 err |= put_user(huge_encode_dev(stat->rdev), &statbuf->st_rdev);
145 err |= put_user(0, (unsigned long __user *) &statbuf->__pad3[0]); 145 err |= put_user(0, (unsigned long __user *) &statbuf->__pad3[0]);
146 err |= put_user(stat->size, &statbuf->st_size); 146 err |= put_user(stat->size, &statbuf->st_size);
diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
index aec2202a596c..d5c820a54590 100644
--- a/arch/x86/ia32/sys_ia32.c
+++ b/arch/x86/ia32/sys_ia32.c
@@ -71,8 +71,8 @@ static int cp_stat64(struct stat64 __user *ubuf, struct kstat *stat)
71{ 71{
72 typeof(ubuf->st_uid) uid = 0; 72 typeof(ubuf->st_uid) uid = 0;
73 typeof(ubuf->st_gid) gid = 0; 73 typeof(ubuf->st_gid) gid = 0;
74 SET_UID(uid, stat->uid); 74 SET_UID(uid, from_kuid_munged(current_user_ns(), stat->uid));
75 SET_GID(gid, stat->gid); 75 SET_GID(gid, from_kgid_munged(current_user_ns(), stat->gid));
76 if (!access_ok(VERIFY_WRITE, ubuf, sizeof(struct stat64)) || 76 if (!access_ok(VERIFY_WRITE, ubuf, sizeof(struct stat64)) ||
77 __put_user(huge_encode_dev(stat->dev), &ubuf->st_dev) || 77 __put_user(huge_encode_dev(stat->dev), &ubuf->st_dev) ||
78 __put_user(stat->ino, &ubuf->__st_ino) || 78 __put_user(stat->ino, &ubuf->__st_ino) ||