mnt_idmapping.h (fc04dafd263d8c0b0251b63d47f35b29373d50f2) | mnt_idmapping.h (77940f0d96cd2ec9fe2125f74f513a7254bcdd7f) |
---|---|
1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef _LINUX_MNT_IDMAPPING_H 3#define _LINUX_MNT_IDMAPPING_H 4 5#include <linux/types.h> 6#include <linux/uidgid.h> 7 8struct user_namespace; --- 56 unchanged lines hidden (view full) --- 65 66static inline bool vfsgid_eq(vfsgid_t left, vfsgid_t right) 67{ 68 return vfsgid_valid(left) && __vfsgid_val(left) == __vfsgid_val(right); 69} 70 71/** 72 * vfsuid_eq_kuid - check whether kuid and vfsuid have the same value | 1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef _LINUX_MNT_IDMAPPING_H 3#define _LINUX_MNT_IDMAPPING_H 4 5#include <linux/types.h> 6#include <linux/uidgid.h> 7 8struct user_namespace; --- 56 unchanged lines hidden (view full) --- 65 66static inline bool vfsgid_eq(vfsgid_t left, vfsgid_t right) 67{ 68 return vfsgid_valid(left) && __vfsgid_val(left) == __vfsgid_val(right); 69} 70 71/** 72 * vfsuid_eq_kuid - check whether kuid and vfsuid have the same value |
73 * @kuid: the kuid to compare | |
74 * @vfsuid: the vfsuid to compare | 73 * @vfsuid: the vfsuid to compare |
74 * @kuid: the kuid to compare |
|
75 * | 75 * |
76 * Check whether @kuid and @vfsuid have the same values. | 76 * Check whether @vfsuid and @kuid have the same values. |
77 * | 77 * |
78 * Return: true if @kuid and @vfsuid have the same value, false if not. | 78 * Return: true if @vfsuid and @kuid have the same value, false if not. |
79 * Comparison between two invalid uids returns false. 80 */ 81static inline bool vfsuid_eq_kuid(vfsuid_t vfsuid, kuid_t kuid) 82{ 83 return vfsuid_valid(vfsuid) && __vfsuid_val(vfsuid) == __kuid_val(kuid); 84} 85 86/** 87 * vfsgid_eq_kgid - check whether kgid and vfsgid have the same value | 79 * Comparison between two invalid uids returns false. 80 */ 81static inline bool vfsuid_eq_kuid(vfsuid_t vfsuid, kuid_t kuid) 82{ 83 return vfsuid_valid(vfsuid) && __vfsuid_val(vfsuid) == __kuid_val(kuid); 84} 85 86/** 87 * vfsgid_eq_kgid - check whether kgid and vfsgid have the same value |
88 * @kgid: the kgid to compare | |
89 * @vfsgid: the vfsgid to compare | 88 * @vfsgid: the vfsgid to compare |
89 * @kgid: the kgid to compare |
|
90 * | 90 * |
91 * Check whether @kgid and @vfsgid have the same values. | 91 * Check whether @vfsgid and @kgid have the same values. |
92 * | 92 * |
93 * Return: true if @kgid and @vfsgid have the same value, false if not. | 93 * Return: true if @vfsgid and @kgid have the same value, false if not. |
94 * Comparison between two invalid gids returns false. 95 */ | 94 * Comparison between two invalid gids returns false. 95 */ |
96static inline bool vfsgid_eq_kgid(kgid_t kgid, vfsgid_t vfsgid) | 96static inline bool vfsgid_eq_kgid(vfsgid_t vfsgid, kgid_t kgid) |
97{ 98 return vfsgid_valid(vfsgid) && __vfsgid_val(vfsgid) == __kgid_val(kgid); 99} 100 101/* 102 * vfs{g,u}ids are created from k{g,u}ids. 103 * We don't allow them to be created from regular {u,g}id. 104 */ --- 61 unchanged lines hidden (view full) --- 166 */ 167static inline bool no_idmapping(const struct user_namespace *mnt_userns, 168 const struct user_namespace *fs_userns) 169{ 170 return initial_idmapping(mnt_userns) || mnt_userns == fs_userns; 171} 172 173/** | 97{ 98 return vfsgid_valid(vfsgid) && __vfsgid_val(vfsgid) == __kgid_val(kgid); 99} 100 101/* 102 * vfs{g,u}ids are created from k{g,u}ids. 103 * We don't allow them to be created from regular {u,g}id. 104 */ --- 61 unchanged lines hidden (view full) --- 166 */ 167static inline bool no_idmapping(const struct user_namespace *mnt_userns, 168 const struct user_namespace *fs_userns) 169{ 170 return initial_idmapping(mnt_userns) || mnt_userns == fs_userns; 171} 172 173/** |
174 * mapped_kuid_fs - map a filesystem kuid into a mnt_userns | 174 * make_vfsuid - map a filesystem kuid into a mnt_userns |
175 * @mnt_userns: the mount's idmapping 176 * @fs_userns: the filesystem's idmapping 177 * @kuid : kuid to be mapped 178 * 179 * Take a @kuid and remap it from @fs_userns into @mnt_userns. Use this 180 * function when preparing a @kuid to be reported to userspace. 181 * 182 * If no_idmapping() determines that this is not an idmapped mount we can --- 28 unchanged lines hidden (view full) --- 211static inline kuid_t mapped_kuid_fs(struct user_namespace *mnt_userns, 212 struct user_namespace *fs_userns, 213 kuid_t kuid) 214{ 215 return AS_KUIDT(make_vfsuid(mnt_userns, fs_userns, kuid)); 216} 217 218/** | 175 * @mnt_userns: the mount's idmapping 176 * @fs_userns: the filesystem's idmapping 177 * @kuid : kuid to be mapped 178 * 179 * Take a @kuid and remap it from @fs_userns into @mnt_userns. Use this 180 * function when preparing a @kuid to be reported to userspace. 181 * 182 * If no_idmapping() determines that this is not an idmapped mount we can --- 28 unchanged lines hidden (view full) --- 211static inline kuid_t mapped_kuid_fs(struct user_namespace *mnt_userns, 212 struct user_namespace *fs_userns, 213 kuid_t kuid) 214{ 215 return AS_KUIDT(make_vfsuid(mnt_userns, fs_userns, kuid)); 216} 217 218/** |
219 * mapped_kgid_fs - map a filesystem kgid into a mnt_userns | 219 * make_vfsgid - map a filesystem kgid into a mnt_userns |
220 * @mnt_userns: the mount's idmapping 221 * @fs_userns: the filesystem's idmapping 222 * @kgid : kgid to be mapped 223 * 224 * Take a @kgid and remap it from @fs_userns into @mnt_userns. Use this 225 * function when preparing a @kgid to be reported to userspace. 226 * 227 * If no_idmapping() determines that this is not an idmapped mount we can --- 222 unchanged lines hidden --- | 220 * @mnt_userns: the mount's idmapping 221 * @fs_userns: the filesystem's idmapping 222 * @kgid : kgid to be mapped 223 * 224 * Take a @kgid and remap it from @fs_userns into @mnt_userns. Use this 225 * function when preparing a @kgid to be reported to userspace. 226 * 227 * If no_idmapping() determines that this is not an idmapped mount we can --- 222 unchanged lines hidden --- |