cregit-Linux how code gets into the kernel

Release 4.7 include/linux/uidgid.h

Directory: include/linux
#ifndef _LINUX_UIDGID_H

#define _LINUX_UIDGID_H

/*
 * A set of types for the internal kernel types representing uids and gids.
 *
 * The types defined in this header allow distinguishing which uids and gids in
 * the kernel are values used by userspace and which uid and gid values are
 * the internal kernel values.  With the addition of user namespaces the values
 * can be different.  Using the type system makes it possible for the compiler
 * to detect when we overlook these differences.
 *
 */
#include <linux/types.h>
#include <linux/highuid.h>

struct user_namespace;
extern struct user_namespace init_user_ns;

typedef struct {
	
uid_t val;
} 
kuid_t;


typedef struct {
	
gid_t val;
} 
kgid_t;


#define KUIDT_INIT(value) (kuid_t){ value }

#define KGIDT_INIT(value) (kgid_t){ value }

#ifdef CONFIG_MULTIUSER

static inline uid_t __kuid_val(kuid_t uid) { return uid.val; }

Contributors

PersonTokensPropCommitsCommitProp
eric w. biedermaneric w. biederman15100.00%1100.00%
Total15100.00%1100.00%


static inline gid_t __kgid_val(kgid_t gid) { return gid.val; }

Contributors

PersonTokensPropCommitsCommitProp
eric w. biedermaneric w. biederman15100.00%1100.00%
Total15100.00%1100.00%

#else
static inline uid_t __kuid_val(kuid_t uid) { return 0; }

Contributors

PersonTokensPropCommitsCommitProp
iulia mandaiulia manda13100.00%1100.00%
Total13100.00%1100.00%


static inline gid_t __kgid_val(kgid_t gid) { return 0; }

Contributors

PersonTokensPropCommitsCommitProp
iulia mandaiulia manda13100.00%1100.00%
Total13100.00%1100.00%

#endif #define GLOBAL_ROOT_UID KUIDT_INIT(0) #define GLOBAL_ROOT_GID KGIDT_INIT(0) #define INVALID_UID KUIDT_INIT(-1) #define INVALID_GID KGIDT_INIT(-1)
static inline bool uid_eq(kuid_t left, kuid_t right) { return __kuid_val(left) == __kuid_val(right); }

Contributors

PersonTokensPropCommitsCommitProp
eric w. biedermaneric w. biederman24100.00%1100.00%
Total24100.00%1100.00%


static inline bool gid_eq(kgid_t left, kgid_t right) { return __kgid_val(left) == __kgid_val(right); }

Contributors

PersonTokensPropCommitsCommitProp
eric w. biedermaneric w. biederman24100.00%1100.00%
Total24100.00%1100.00%


static inline bool uid_gt(kuid_t left, kuid_t right) { return __kuid_val(left) > __kuid_val(right); }

Contributors

PersonTokensPropCommitsCommitProp
eric w. biedermaneric w. biederman24100.00%1100.00%
Total24100.00%1100.00%


static inline bool gid_gt(kgid_t left, kgid_t right) { return __kgid_val(left) > __kgid_val(right); }

Contributors

PersonTokensPropCommitsCommitProp
eric w. biedermaneric w. biederman24100.00%1100.00%
Total24100.00%1100.00%


static inline bool uid_gte(kuid_t left, kuid_t right) { return __kuid_val(left) >= __kuid_val(right); }

Contributors

PersonTokensPropCommitsCommitProp
eric w. biedermaneric w. biederman24100.00%1100.00%
Total24100.00%1100.00%


static inline bool gid_gte(kgid_t left, kgid_t right) { return __kgid_val(left) >= __kgid_val(right); }

Contributors

PersonTokensPropCommitsCommitProp
eric w. biedermaneric w. biederman24100.00%1100.00%
Total24100.00%1100.00%


static inline bool uid_lt(kuid_t left, kuid_t right) { return __kuid_val(left) < __kuid_val(right); }

Contributors

PersonTokensPropCommitsCommitProp
eric w. biedermaneric w. biederman24100.00%1100.00%
Total24100.00%1100.00%


static inline bool gid_lt(kgid_t left, kgid_t right) { return __kgid_val(left) < __kgid_val(right); }

Contributors

PersonTokensPropCommitsCommitProp
eric w. biedermaneric w. biederman24100.00%1100.00%
Total24100.00%1100.00%


static inline bool uid_lte(kuid_t left, kuid_t right) { return __kuid_val(left) <= __kuid_val(right); }

Contributors

PersonTokensPropCommitsCommitProp
eric w. biedermaneric w. biederman24100.00%1100.00%
Total24100.00%1100.00%


static inline bool gid_lte(kgid_t left, kgid_t right) { return __kgid_val(left) <= __kgid_val(right); }

Contributors

PersonTokensPropCommitsCommitProp
eric w. biedermaneric w. biederman24100.00%1100.00%
Total24100.00%1100.00%


static inline bool uid_valid(kuid_t uid) { return __kuid_val(uid) != (uid_t) -1; }

Contributors

PersonTokensPropCommitsCommitProp
eric w. biedermaneric w. biederman1568.18%150.00%
josh triplettjosh triplett731.82%150.00%
Total22100.00%2100.00%


static inline bool gid_valid(kgid_t gid) { return __kgid_val(gid) != (gid_t) -1; }

Contributors

PersonTokensPropCommitsCommitProp
eric w. biedermaneric w. biederman1568.18%150.00%
josh triplettjosh triplett731.82%150.00%
Total22100.00%2100.00%

#ifdef CONFIG_USER_NS extern kuid_t make_kuid(struct user_namespace *from, uid_t uid); extern kgid_t make_kgid(struct user_namespace *from, gid_t gid); extern uid_t from_kuid(struct user_namespace *to, kuid_t uid); extern gid_t from_kgid(struct user_namespace *to, kgid_t gid); extern uid_t from_kuid_munged(struct user_namespace *to, kuid_t uid); extern gid_t from_kgid_munged(struct user_namespace *to, kgid_t gid);
static inline bool kuid_has_mapping(struct user_namespace *ns, kuid_t uid) { return from_kuid(ns, uid) != (uid_t) -1; }

Contributors

PersonTokensPropCommitsCommitProp
eric w. biedermaneric w. biederman29100.00%1100.00%
Total29100.00%1100.00%


static inline bool kgid_has_mapping(struct user_namespace *ns, kgid_t gid) { return from_kgid(ns, gid) != (gid_t) -1; }

Contributors

PersonTokensPropCommitsCommitProp
eric w. biedermaneric w. biederman29100.00%1100.00%
Total29100.00%1100.00%

#else
static inline kuid_t make_kuid(struct user_namespace *from, uid_t uid) { return KUIDT_INIT(uid); }

Contributors

PersonTokensPropCommitsCommitProp
eric w. biedermaneric w. biederman21100.00%1100.00%
Total21100.00%1100.00%


static inline kgid_t make_kgid(struct user_namespace *from, gid_t gid) { return KGIDT_INIT(gid); }

Contributors

PersonTokensPropCommitsCommitProp
eric w. biedermaneric w. biederman21100.00%1100.00%
Total21100.00%1100.00%


static inline uid_t from_kuid(struct user_namespace *to, kuid_t kuid) { return __kuid_val(kuid); }

Contributors

PersonTokensPropCommitsCommitProp
eric w. biedermaneric w. biederman21100.00%1100.00%
Total21100.00%1100.00%


static inline gid_t from_kgid(struct user_namespace *to, kgid_t kgid) { return __kgid_val(kgid); }

Contributors

PersonTokensPropCommitsCommitProp
eric w. biedermaneric w. biederman21100.00%1100.00%
Total21100.00%1100.00%


static inline uid_t from_kuid_munged(struct user_namespace *to, kuid_t kuid) { uid_t uid = from_kuid(to, kuid); if (uid == (uid_t)-1) uid = overflowuid; return uid; }

Contributors

PersonTokensPropCommitsCommitProp
eric w. biedermaneric w. biederman42100.00%1100.00%
Total42100.00%1100.00%


static inline gid_t from_kgid_munged(struct user_namespace *to, kgid_t kgid) { gid_t gid = from_kgid(to, kgid); if (gid == (gid_t)-1) gid = overflowgid; return gid; }

Contributors

PersonTokensPropCommitsCommitProp
eric w. biedermaneric w. biederman42100.00%1100.00%
Total42100.00%1100.00%


static inline bool kuid_has_mapping(struct user_namespace *ns, kuid_t uid) { return true; }

Contributors

PersonTokensPropCommitsCommitProp
eric w. biedermaneric w. biederman18100.00%1100.00%
Total18100.00%1100.00%


static inline bool kgid_has_mapping(struct user_namespace *ns, kgid_t gid) { return true; }

Contributors

PersonTokensPropCommitsCommitProp
eric w. biedermaneric w. biederman18100.00%1100.00%
Total18100.00%1100.00%

#endif /* CONFIG_USER_NS */ #endif /* _LINUX_UIDGID_H */

Overall Contributors

PersonTokensPropCommitsCommitProp
eric w. biedermaneric w. biederman72093.87%250.00%
iulia mandaiulia manda334.30%125.00%
josh triplettjosh triplett141.83%125.00%
Total767100.00%4100.00%
Directory: include/linux
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
{% endraw %}