|
@@ -42,8 +42,8 @@ static const struct inode_operations hugetlbfs_dir_inode_operations;
|
|
static const struct inode_operations hugetlbfs_inode_operations;
|
|
static const struct inode_operations hugetlbfs_inode_operations;
|
|
|
|
|
|
struct hugetlbfs_config {
|
|
struct hugetlbfs_config {
|
|
- uid_t uid;
|
|
|
|
- gid_t gid;
|
|
|
|
|
|
+ kuid_t uid;
|
|
|
|
+ kgid_t gid;
|
|
umode_t mode;
|
|
umode_t mode;
|
|
long nr_blocks;
|
|
long nr_blocks;
|
|
long nr_inodes;
|
|
long nr_inodes;
|
|
@@ -785,13 +785,17 @@ hugetlbfs_parse_options(char *options, struct hugetlbfs_config *pconfig)
|
|
case Opt_uid:
|
|
case Opt_uid:
|
|
if (match_int(&args[0], &option))
|
|
if (match_int(&args[0], &option))
|
|
goto bad_val;
|
|
goto bad_val;
|
|
- pconfig->uid = option;
|
|
|
|
|
|
+ pconfig->uid = make_kuid(current_user_ns(), option);
|
|
|
|
+ if (!uid_valid(pconfig->uid))
|
|
|
|
+ goto bad_val;
|
|
break;
|
|
break;
|
|
|
|
|
|
case Opt_gid:
|
|
case Opt_gid:
|
|
if (match_int(&args[0], &option))
|
|
if (match_int(&args[0], &option))
|
|
goto bad_val;
|
|
goto bad_val;
|
|
- pconfig->gid = option;
|
|
|
|
|
|
+ pconfig->gid = make_kgid(current_user_ns(), option);
|
|
|
|
+ if (!gid_valid(pconfig->gid))
|
|
|
|
+ goto bad_val;
|
|
break;
|
|
break;
|
|
|
|
|
|
case Opt_mode:
|
|
case Opt_mode:
|
|
@@ -924,7 +928,9 @@ static struct vfsmount *hugetlbfs_vfsmount;
|
|
|
|
|
|
static int can_do_hugetlb_shm(void)
|
|
static int can_do_hugetlb_shm(void)
|
|
{
|
|
{
|
|
- return capable(CAP_IPC_LOCK) || in_group_p(sysctl_hugetlb_shm_group);
|
|
|
|
|
|
+ kgid_t shm_group;
|
|
|
|
+ shm_group = make_kgid(&init_user_ns, sysctl_hugetlb_shm_group);
|
|
|
|
+ return capable(CAP_IPC_LOCK) || in_group_p(shm_group);
|
|
}
|
|
}
|
|
|
|
|
|
struct file *hugetlb_file_setup(const char *name, unsigned long addr,
|
|
struct file *hugetlb_file_setup(const char *name, unsigned long addr,
|