/linux/fs/ |
H A D | mnt_idmapping.c | 79 vfsuid_t make_vfsuid(struct mnt_idmap *idmap, in make_vfsuid() argument 85 if (idmap == &nop_mnt_idmap) in make_vfsuid() 87 if (idmap == &invalid_mnt_idmap) in make_vfsuid() 95 return VFSUIDT_INIT_RAW(map_id_down(&idmap->uid_map, uid)); in make_vfsuid() 119 vfsgid_t make_vfsgid(struct mnt_idmap *idmap, in make_vfsgid() argument 124 if (idmap == &nop_mnt_idmap) in make_vfsgid() 126 if (idmap == &invalid_mnt_idmap) in make_vfsgid() 134 return VFSGIDT_INIT_RAW(map_id_down(&idmap->gid_map, gid)); in make_vfsgid() 149 kuid_t from_vfsuid(struct mnt_idmap *idmap, in from_vfsuid() argument 154 if (idmap == &nop_mnt_idmap) in from_vfsuid() [all …]
|
H A D | attr.c | 33 int setattr_should_drop_sgid(struct mnt_idmap *idmap, in setattr_should_drop_sgid() argument 42 if (!in_group_or_capable(idmap, inode, i_gid_into_vfsgid(idmap, inode))) in setattr_should_drop_sgid() 63 int setattr_should_drop_suidgid(struct mnt_idmap *idmap, in setattr_should_drop_suidgid() argument 73 kill |= setattr_should_drop_sgid(idmap, inode); in setattr_should_drop_suidgid() 94 static bool chown_ok(struct mnt_idmap *idmap, in chown_ok() argument 97 vfsuid_t vfsuid = i_uid_into_vfsuid(idmap, inode); in chown_ok() 101 if (capable_wrt_inode_uidgid(idmap, inode, CAP_CHOWN)) in chown_ok() 121 static bool chgrp_ok(struct mnt_idmap *idmap, in chgrp_ok() argument 124 vfsgid_t vfsgid = i_gid_into_vfsgid(idmap, inode); in chgrp_ok() 125 vfsuid_t vfsuid = i_uid_into_vfsuid(idmap, inode); in chgrp_ok() [all …]
|
H A D | posix_acl.c | 114 static struct posix_acl *__get_acl(struct mnt_idmap *idmap, in __get_acl() argument 157 acl = inode->i_op->get_acl(idmap, dentry, type); in __get_acl() 374 posix_acl_permission(struct mnt_idmap *idmap, struct inode *inode, in posix_acl_permission() argument 389 vfsuid = i_uid_into_vfsuid(idmap, inode); in posix_acl_permission() 394 vfsuid = make_vfsuid(idmap, fs_userns, in posix_acl_permission() 400 vfsgid = i_gid_into_vfsgid(idmap, inode); in posix_acl_permission() 408 vfsgid = make_vfsgid(idmap, fs_userns, in posix_acl_permission() 604 posix_acl_chmod(struct mnt_idmap *idmap, struct dentry *dentry, in posix_acl_chmod() argument 626 ret = inode->i_op->set_acl(idmap, dentry, acl, ACL_TYPE_ACCESS); in posix_acl_chmod() 705 int posix_acl_update_mode(struct mnt_idmap *idmap, in posix_acl_update_mode() argument [all …]
|
H A D | bad_inode.c | 30 static int bad_inode_create(struct mnt_idmap *idmap, in bad_inode_create() argument 54 static int bad_inode_symlink(struct mnt_idmap *idmap, in bad_inode_symlink() argument 61 static int bad_inode_mkdir(struct mnt_idmap *idmap, struct inode *dir, in bad_inode_mkdir() argument 72 static int bad_inode_mknod(struct mnt_idmap *idmap, struct inode *dir, in bad_inode_mknod() argument 78 static int bad_inode_rename2(struct mnt_idmap *idmap, in bad_inode_rename2() argument 92 static int bad_inode_permission(struct mnt_idmap *idmap, in bad_inode_permission() argument 98 static int bad_inode_getattr(struct mnt_idmap *idmap, in bad_inode_getattr() argument 105 static int bad_inode_setattr(struct mnt_idmap *idmap, in bad_inode_setattr() argument 148 static int bad_inode_tmpfile(struct mnt_idmap *idmap, in bad_inode_tmpfile() argument 155 static int bad_inode_set_acl(struct mnt_idmap *idmap, in bad_inode_set_acl() argument
|
H A D | xattr.c | 97 int may_write_xattr(struct mnt_idmap *idmap, struct inode *inode) in may_write_xattr() argument 103 if (HAS_UNMAPPED_ID(idmap, inode)) in may_write_xattr() 113 xattr_permission(struct mnt_idmap *idmap, struct inode *inode, in xattr_permission() argument 119 ret = may_write_xattr(idmap, inode); in xattr_permission() 151 !inode_owner_or_capable(idmap, inode)) in xattr_permission() 155 return inode_permission(idmap, inode, mask); in xattr_permission() 184 __vfs_setxattr(struct mnt_idmap *idmap, struct dentry *dentry, in __vfs_setxattr() argument 200 return handler->set(handler, idmap, dentry, inode, name, value, in __vfs_setxattr() 222 int __vfs_setxattr_noperm(struct mnt_idmap *idmap, in __vfs_setxattr_noperm() argument 234 error = __vfs_setxattr(idmap, dentry, inode, name, value, in __vfs_setxattr_noperm() [all …]
|
H A D | namei.c | 316 static int check_acl(struct mnt_idmap *idmap, in check_acl() argument 329 return posix_acl_permission(idmap, inode, acl, mask); in check_acl() 336 int error = posix_acl_permission(idmap, inode, acl, mask); in check_acl() 380 static int acl_permission_check(struct mnt_idmap *idmap, in acl_permission_check() argument 409 vfsuid = i_uid_into_vfsuid(idmap, inode); in acl_permission_check() 418 int error = check_acl(idmap, inode, mask); in acl_permission_check() 432 vfsgid_t vfsgid = i_gid_into_vfsgid(idmap, inode); in acl_permission_check() 463 int generic_permission(struct mnt_idmap *idmap, struct inode *inode, in generic_permission() argument 471 ret = acl_permission_check(idmap, inode, mask); in generic_permission() 478 if (capable_wrt_inode_uidgid(idmap, inode, in generic_permission() [all …]
|
H A D | internal.h | 59 int may_linkat(struct mnt_idmap *idmap, const struct path *link); 66 int vfs_tmpfile(struct mnt_idmap *idmap, 203 bool in_group_or_capable(struct mnt_idmap *idmap, 291 int may_write_xattr(struct mnt_idmap *idmap, struct inode *inode); 294 int do_set_acl(struct mnt_idmap *idmap, struct dentry *dentry, 296 ssize_t do_get_acl(struct mnt_idmap *idmap, struct dentry *dentry, 299 static inline int do_set_acl(struct mnt_idmap *idmap, in do_set_acl() argument 305 static inline ssize_t do_get_acl(struct mnt_idmap *idmap, in do_get_acl() argument 319 struct mnt_idmap *mnt_idmap_get(struct mnt_idmap *idmap); 320 void mnt_idmap_put(struct mnt_idmap *idmap);
|
/linux/fs/nfs/ |
H A D | nfs4idmap.c | 65 struct idmap *idmap; member 68 struct idmap { struct 76 static struct user_namespace *idmap_userns(const struct idmap *idmap) in idmap_userns() argument 78 if (idmap && idmap->user_ns) in idmap_userns() 79 return idmap->user_ns; in idmap_userns() 280 const char *type, struct idmap *idmap) in nfs_idmap_request_key() argument 290 if (!idmap->user_ns || idmap->user_ns == &init_user_ns) in nfs_idmap_request_key() 293 mutex_lock(&idmap->idmap_mutex); in nfs_idmap_request_key() 295 desc, NULL, "", 0, idmap); in nfs_idmap_request_key() 296 mutex_unlock(&idmap->idmap_mutex); in nfs_idmap_request_key() [all …]
|
/linux/include/linux/ |
H A D | mnt_idmapping.h | 119 struct mnt_idmap *mnt_idmap_get(struct mnt_idmap *idmap); 120 void mnt_idmap_put(struct mnt_idmap *idmap); 122 vfsuid_t make_vfsuid(struct mnt_idmap *idmap, 125 vfsgid_t make_vfsgid(struct mnt_idmap *idmap, 128 kuid_t from_vfsuid(struct mnt_idmap *idmap, 131 kgid_t from_vfsgid(struct mnt_idmap *idmap, 146 static inline bool vfsuid_has_fsmapping(struct mnt_idmap *idmap, in vfsuid_has_fsmapping() argument 150 return uid_valid(from_vfsuid(idmap, fs_userns, vfsuid)); in vfsuid_has_fsmapping() 184 static inline bool vfsgid_has_fsmapping(struct mnt_idmap *idmap, in vfsgid_has_fsmapping() argument 188 return gid_valid(from_vfsgid(idmap, fs_userns, vfsgid)); in vfsgid_has_fsmapping() [all …]
|
H A D | security.h | 188 int cap_inode_removexattr(struct mnt_idmap *idmap, 191 int cap_inode_killpriv(struct mnt_idmap *idmap, struct dentry *dentry); 192 int cap_inode_getsecurity(struct mnt_idmap *idmap, 398 void security_inode_post_create_tmpfile(struct mnt_idmap *idmap, 415 int security_inode_setattr(struct mnt_idmap *idmap, 417 void security_inode_post_setattr(struct mnt_idmap *idmap, struct dentry *dentry, 420 int security_inode_setxattr(struct mnt_idmap *idmap, 423 int security_inode_set_acl(struct mnt_idmap *idmap, 428 int security_inode_get_acl(struct mnt_idmap *idmap, 430 int security_inode_remove_acl(struct mnt_idmap *idmap, [all …]
|
H A D | capability.h | 189 struct mnt_idmap *idmap, 191 bool capable_wrt_inode_uidgid(struct mnt_idmap *idmap, 212 int get_vfs_caps_from_disk(struct mnt_idmap *idmap, 216 int cap_convert_nscap(struct mnt_idmap *idmap, struct dentry *dentry,
|
/linux/fs/smb/server/ |
H A D | vfs.c | 143 void ksmbd_vfs_query_maximal_access(struct mnt_idmap *idmap, in ksmbd_vfs_query_maximal_access() argument 148 if (!inode_permission(idmap, d_inode(dentry), MAY_OPEN | MAY_WRITE)) in ksmbd_vfs_query_maximal_access() 154 if (!inode_permission(idmap, d_inode(dentry), MAY_OPEN | MAY_READ)) in ksmbd_vfs_query_maximal_access() 157 if (!inode_permission(idmap, d_inode(dentry), MAY_OPEN | MAY_EXEC)) in ksmbd_vfs_query_maximal_access() 160 if (!inode_permission(idmap, d_inode(dentry->d_parent), MAY_EXEC | MAY_WRITE)) in ksmbd_vfs_query_maximal_access() 212 struct mnt_idmap *idmap; in ksmbd_vfs_mkdir() local 228 idmap = mnt_idmap(path.mnt); in ksmbd_vfs_mkdir() 230 err = vfs_mkdir(idmap, d_inode(path.dentry), dentry, mode); in ksmbd_vfs_mkdir() 234 d = lookup_one(idmap, dentry->d_name.name, dentry->d_parent, in ksmbd_vfs_mkdir() 257 static ssize_t ksmbd_vfs_getcasexattr(struct mnt_idmap *idmap, in ksmbd_vfs_getcasexattr() argument [all …]
|
H A D | smbacl.h | 84 int parse_sec_desc(struct mnt_idmap *idmap, struct smb_ntsd *pntsd, 86 int build_sec_desc(struct mnt_idmap *idmap, struct smb_ntsd *pntsd, 105 static inline uid_t posix_acl_uid_translate(struct mnt_idmap *idmap, in posix_acl_uid_translate() argument 111 vfsuid = make_vfsuid(idmap, &init_user_ns, pace->e_uid); in posix_acl_uid_translate() 117 static inline gid_t posix_acl_gid_translate(struct mnt_idmap *idmap, in posix_acl_gid_translate() argument 123 vfsgid = make_vfsgid(idmap, &init_user_ns, pace->e_gid); in posix_acl_gid_translate()
|
H A D | smbacl.c | 257 static int sid_to_id(struct mnt_idmap *idmap, in sid_to_id() argument 279 uid = from_vfsuid(idmap, &init_user_ns, VFSUIDT_INIT(uid)); in sid_to_id() 290 gid = from_vfsgid(idmap, &init_user_ns, VFSGIDT_INIT(gid)); in sid_to_id() 365 static void parse_dacl(struct mnt_idmap *idmap, in parse_dacl() argument 495 ret = sid_to_id(idmap, &ppace[i]->sid, SIDOWNER, &temp_fattr); in parse_dacl() 581 static void set_posix_acl_entries_dacl(struct mnt_idmap *idmap, in set_posix_acl_entries_dacl() argument 606 uid = posix_acl_uid_translate(idmap, pace); in set_posix_acl_entries_dacl() 613 gid = posix_acl_gid_translate(idmap, pace); in set_posix_acl_entries_dacl() 672 uid = posix_acl_uid_translate(idmap, pace); in set_posix_acl_entries_dacl() 677 gid = posix_acl_gid_translate(idmap, pace); in set_posix_acl_entries_dacl() [all …]
|
/linux/fs/xfs/ |
H A D | xfs_iops.c | 171 struct mnt_idmap *idmap, in xfs_generic_create() argument 179 .idmap = idmap, in xfs_generic_create() 281 struct mnt_idmap *idmap, in xfs_vn_mknod() argument 287 return xfs_generic_create(idmap, dir, dentry, mode, rdev, NULL); in xfs_vn_mknod() 292 struct mnt_idmap *idmap, in xfs_vn_create() argument 298 return xfs_generic_create(idmap, dir, dentry, mode, 0, NULL); in xfs_vn_create() 303 struct mnt_idmap *idmap, in xfs_vn_mkdir() argument 308 return xfs_generic_create(idmap, dir, dentry, mode | S_IFDIR, 0, NULL); in xfs_vn_mkdir() 428 struct mnt_idmap *idmap, in xfs_vn_symlink() argument 445 error = xfs_symlink(idmap, XFS_I(dir), &name, symname, mode, &cip); in xfs_vn_symlink() [all …]
|
/linux/Documentation/admin-guide/nfs/ |
H A D | nfs-idmapper.rst | 9 or by placing a call to the rpc.idmap daemon. 19 legacy rpc.idmap daemon for the id mapping. This result will be stored 20 in a custom NFS idmap cache. 31 ``create id_resolver * * /usr/sbin/nfs.idmap %k %d 600`` 34 This will direct all id_resolver requests to the program /usr/sbin/nfs.idmap. 36 expire. This parameter is optional for /usr/sbin/nfs.idmap. When the timeout 37 is not specified, nfs.idmap will default to 600 seconds. 53 ``create id_resolver * * /usr/sbin/nfs.idmap %k %d 600`` 59 /usr/sbin/nfs.idmap will handle gid, user, and group lookups. 65 nfs.idmap [all …]
|
/linux/security/integrity/evm/ |
H A D | evm_main.c | 461 static int evm_xattr_change(struct mnt_idmap *idmap, in evm_xattr_change() argument 497 static int evm_protect_xattr(struct mnt_idmap *idmap, in evm_protect_xattr() argument 559 !evm_xattr_change(idmap, dentry, xattr_name, xattr_value, in evm_protect_xattr() 587 static int evm_inode_setxattr(struct mnt_idmap *idmap, struct dentry *dentry, in evm_inode_setxattr() argument 606 return evm_protect_xattr(idmap, dentry, xattr_name, xattr_value, in evm_inode_setxattr() 619 static int evm_inode_removexattr(struct mnt_idmap *idmap, struct dentry *dentry, in evm_inode_removexattr() argument 628 return evm_protect_xattr(idmap, dentry, xattr_name, NULL, 0); in evm_inode_removexattr() 632 static int evm_inode_set_acl_change(struct mnt_idmap *idmap, in evm_inode_set_acl_change() argument 644 rc = posix_acl_update_mode(idmap, inode, &mode, &kacl); in evm_inode_set_acl_change() 651 static inline int evm_inode_set_acl_change(struct mnt_idmap *idmap, in evm_inode_set_acl_change() argument [all …]
|
/linux/fs/f2fs/ |
H A D | namei.c | 219 static struct inode *f2fs_new_inode(struct mnt_idmap *idmap, in f2fs_new_inode() argument 243 inode_init_owner(idmap, inode, dir, mode); in f2fs_new_inode() 352 static int f2fs_create(struct mnt_idmap *idmap, struct inode *dir, in f2fs_create() argument 369 inode = f2fs_new_inode(idmap, dir, mode, dentry->d_name.name); in f2fs_create() 606 static int f2fs_symlink(struct mnt_idmap *idmap, struct inode *dir, in f2fs_symlink() argument 629 inode = f2fs_new_inode(idmap, dir, S_IFLNK | S_IRWXUGO, NULL); in f2fs_symlink() 686 static int f2fs_mkdir(struct mnt_idmap *idmap, struct inode *dir, in f2fs_mkdir() argument 700 inode = f2fs_new_inode(idmap, dir, S_IFDIR | mode, NULL); in f2fs_mkdir() 741 static int f2fs_mknod(struct mnt_idmap *idmap, struct inode *dir, in f2fs_mknod() argument 757 inode = f2fs_new_inode(idmap, dir, mode, NULL); in f2fs_mknod() [all …]
|
/linux/fs/fat/ |
H A D | file.c | 398 int fat_getattr(struct mnt_idmap *idmap, const struct path *path, in fat_getattr() argument 404 generic_fillattr(idmap, request_mask, inode, stat); in fat_getattr() 459 static int fat_allow_set_time(struct mnt_idmap *idmap, in fat_allow_set_time() argument 464 if (!vfsuid_eq_kuid(i_uid_into_vfsuid(idmap, inode), in fat_allow_set_time() 466 if (vfsgid_in_group_p(i_gid_into_vfsgid(idmap, inode))) in fat_allow_set_time() 480 int fat_setattr(struct mnt_idmap *idmap, struct dentry *dentry, in fat_setattr() argument 491 if (fat_allow_set_time(idmap, sbi, inode)) in fat_setattr() 495 error = setattr_prepare(idmap, dentry, attr); in fat_setattr() 521 (!uid_eq(from_vfsuid(idmap, i_user_ns(inode), attr->ia_vfsuid), in fat_setattr() 524 (!gid_eq(from_vfsgid(idmap, i_user_ns(inode), attr->ia_vfsgid), in fat_setattr() [all …]
|
/linux/fs/minix/ |
H A D | namei.c | 36 static int minix_mknod(struct mnt_idmap *idmap, struct inode *dir, in minix_mknod() argument 53 static int minix_tmpfile(struct mnt_idmap *idmap, struct inode *dir, in minix_tmpfile() argument 66 static int minix_create(struct mnt_idmap *idmap, struct inode *dir, in minix_create() argument 72 static int minix_symlink(struct mnt_idmap *idmap, struct inode *dir, in minix_symlink() argument 107 static int minix_mkdir(struct mnt_idmap *idmap, struct inode *dir, in minix_mkdir() argument 176 static int minix_rename(struct mnt_idmap *idmap, in minix_rename() argument
|
/linux/fs/ntfs3/ |
H A D | namei.c | 107 static int ntfs_create(struct mnt_idmap *idmap, struct inode *dir, in ntfs_create() argument 110 return ntfs_create_inode(idmap, dir, dentry, NULL, S_IFREG | mode, 0, in ntfs_create() 117 static int ntfs_mknod(struct mnt_idmap *idmap, struct inode *dir, in ntfs_mknod() argument 120 return ntfs_create_inode(idmap, dir, dentry, NULL, mode, rdev, NULL, 0, in ntfs_mknod() 189 static int ntfs_symlink(struct mnt_idmap *idmap, struct inode *dir, in ntfs_symlink() argument 197 return ntfs_create_inode(idmap, dir, dentry, NULL, S_IFLNK | 0777, 0, in ntfs_symlink() 204 static int ntfs_mkdir(struct mnt_idmap *idmap, struct inode *dir, in ntfs_mkdir() argument 207 return ntfs_create_inode(idmap, dir, dentry, NULL, S_IFDIR | mode, 0, in ntfs_mkdir() 234 static int ntfs_rename(struct mnt_idmap *idmap, struct inode *dir, in ntfs_rename() argument
|
/linux/fs/exfat/ |
H A D | file.c | 90 static bool exfat_allow_set_time(struct mnt_idmap *idmap, in exfat_allow_set_time() argument 95 if (!vfsuid_eq_kuid(i_uid_into_vfsuid(idmap, inode), in exfat_allow_set_time() 97 if (vfsgid_in_group_p(i_gid_into_vfsgid(idmap, inode))) in exfat_allow_set_time() 266 int exfat_getattr(struct mnt_idmap *idmap, const struct path *path, in exfat_getattr() argument 273 generic_fillattr(idmap, request_mask, inode, stat); in exfat_getattr() 282 int exfat_setattr(struct mnt_idmap *idmap, struct dentry *dentry, in exfat_setattr() argument 304 exfat_allow_set_time(idmap, sbi, inode)) { in exfat_setattr() 309 error = setattr_prepare(idmap, dentry, attr); in exfat_setattr() 315 (!uid_eq(from_vfsuid(idmap, i_user_ns(inode), attr->ia_vfsuid), in exfat_setattr() 318 (!gid_eq(from_vfsgid(idmap, i_user_ns(inode), attr->ia_vfsgid), in exfat_setattr() [all …]
|
/linux/fs/fuse/ |
H A D | acl.c | 67 struct posix_acl *fuse_get_acl(struct mnt_idmap *idmap, in fuse_get_acl() argument 95 int fuse_set_acl(struct mnt_idmap *idmap, struct dentry *dentry, in fuse_set_acl() argument 147 !in_group_or_capable(idmap, inode, in fuse_set_acl() 148 i_gid_into_vfsgid(idmap, inode))) in fuse_set_acl()
|
/linux/fs/ocfs2/ |
H A D | file.h | 53 int ocfs2_setattr(struct mnt_idmap *idmap, struct dentry *dentry, 55 int ocfs2_getattr(struct mnt_idmap *idmap, const struct path *path, 57 int ocfs2_permission(struct mnt_idmap *idmap,
|
/linux/fs/sysv/ |
H A D | namei.c | 44 static int sysv_mknod(struct mnt_idmap *idmap, struct inode *dir, in sysv_mknod() argument 64 static int sysv_create(struct mnt_idmap *idmap, struct inode *dir, in sysv_create() argument 70 static int sysv_symlink(struct mnt_idmap *idmap, struct inode *dir, in sysv_symlink() argument 113 static int sysv_mkdir(struct mnt_idmap *idmap, struct inode *dir, in sysv_mkdir() argument 191 static int sysv_rename(struct mnt_idmap *idmap, struct inode *old_dir, in sysv_rename() argument
|