mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-20 22:01:56 +00:00
userns: userns: check user namespace for task->file uid equivalence checks
Cheat for now and say all files belong to init_user_ns. Next step will be to let superblocks belong to a user_ns, and derive inode_userns(inode) from inode->i_sb->s_user_ns. Finally we'll introduce more flexible arrangements. Changelog: Feb 15: make is_owner_or_cap take const struct inode Feb 23: make is_owner_or_cap bool [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Serge E. Hallyn <serge.hallyn@canonical.com> Acked-by: "Eric W. Biederman" <ebiederm@xmission.com> Acked-by: Daniel Lezcano <daniel.lezcano@free.fr> Acked-by: David Howells <dhowells@redhat.com> Cc: James Morris <jmorris@namei.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
b0e77598f8
commit
e795b71799
3 changed files with 40 additions and 7 deletions
|
@ -1457,8 +1457,13 @@ enum {
|
|||
#define put_fs_excl() atomic_dec(¤t->fs_excl)
|
||||
#define has_fs_excl() atomic_read(¤t->fs_excl)
|
||||
|
||||
#define is_owner_or_cap(inode) \
|
||||
((current_fsuid() == (inode)->i_uid) || capable(CAP_FOWNER))
|
||||
/*
|
||||
* until VFS tracks user namespaces for inodes, just make all files
|
||||
* belong to init_user_ns
|
||||
*/
|
||||
extern struct user_namespace init_user_ns;
|
||||
#define inode_userns(inode) (&init_user_ns)
|
||||
extern bool is_owner_or_cap(const struct inode *inode);
|
||||
|
||||
/* not quite ready to be deprecated, but... */
|
||||
extern void lock_super(struct super_block *);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue