mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
nfsd: knfsd must use the container user namespace
Convert knfsd to use the user namespace of the container that started the server processes. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
parent
e6667c73a2
commit
e45d1a1835
6 changed files with 44 additions and 32 deletions
|
@ -570,13 +570,13 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
|
|||
err = get_int(&mesg, &an_int);
|
||||
if (err)
|
||||
goto out3;
|
||||
exp.ex_anon_uid= make_kuid(&init_user_ns, an_int);
|
||||
exp.ex_anon_uid= make_kuid(current_user_ns(), an_int);
|
||||
|
||||
/* anon gid */
|
||||
err = get_int(&mesg, &an_int);
|
||||
if (err)
|
||||
goto out3;
|
||||
exp.ex_anon_gid= make_kgid(&init_user_ns, an_int);
|
||||
exp.ex_anon_gid= make_kgid(current_user_ns(), an_int);
|
||||
|
||||
/* fsid */
|
||||
err = get_int(&mesg, &an_int);
|
||||
|
@ -1170,15 +1170,17 @@ static void show_secinfo(struct seq_file *m, struct svc_export *exp)
|
|||
static void exp_flags(struct seq_file *m, int flag, int fsid,
|
||||
kuid_t anonu, kgid_t anong, struct nfsd4_fs_locations *fsloc)
|
||||
{
|
||||
struct user_namespace *userns = m->file->f_cred->user_ns;
|
||||
|
||||
show_expflags(m, flag, NFSEXP_ALLFLAGS);
|
||||
if (flag & NFSEXP_FSID)
|
||||
seq_printf(m, ",fsid=%d", fsid);
|
||||
if (!uid_eq(anonu, make_kuid(&init_user_ns, (uid_t)-2)) &&
|
||||
!uid_eq(anonu, make_kuid(&init_user_ns, 0x10000-2)))
|
||||
seq_printf(m, ",anonuid=%u", from_kuid(&init_user_ns, anonu));
|
||||
if (!gid_eq(anong, make_kgid(&init_user_ns, (gid_t)-2)) &&
|
||||
!gid_eq(anong, make_kgid(&init_user_ns, 0x10000-2)))
|
||||
seq_printf(m, ",anongid=%u", from_kgid(&init_user_ns, anong));
|
||||
if (!uid_eq(anonu, make_kuid(userns, (uid_t)-2)) &&
|
||||
!uid_eq(anonu, make_kuid(userns, 0x10000-2)))
|
||||
seq_printf(m, ",anonuid=%u", from_kuid_munged(userns, anonu));
|
||||
if (!gid_eq(anong, make_kgid(userns, (gid_t)-2)) &&
|
||||
!gid_eq(anong, make_kgid(userns, 0x10000-2)))
|
||||
seq_printf(m, ",anongid=%u", from_kgid_munged(userns, anong));
|
||||
if (fsloc && fsloc->locations_count > 0) {
|
||||
char *loctype = (fsloc->migrated) ? "refer" : "replicas";
|
||||
int i;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue