0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _SAFESETID_H
0015 #define _SAFESETID_H
0016
0017 #include <linux/types.h>
0018 #include <linux/uidgid.h>
0019 #include <linux/hashtable.h>
0020
0021
0022 extern int safesetid_initialized __initdata;
0023
0024 enum sid_policy_type {
0025 SIDPOL_DEFAULT,
0026 SIDPOL_CONSTRAINED,
0027 SIDPOL_ALLOWED
0028 };
0029
0030 typedef union {
0031 kuid_t uid;
0032 kgid_t gid;
0033 } kid_t;
0034
0035 enum setid_type {
0036 UID,
0037 GID
0038 };
0039
0040
0041
0042
0043
0044 struct setid_rule {
0045 struct hlist_node next;
0046 kid_t src_id;
0047 kid_t dst_id;
0048
0049
0050 enum setid_type type;
0051 };
0052
0053 #define SETID_HASH_BITS 8
0054
0055
0056 #define INVALID_ID (kid_t){.uid = INVALID_UID}
0057
0058 struct setid_ruleset {
0059 DECLARE_HASHTABLE(rules, SETID_HASH_BITS);
0060 char *policy_str;
0061 struct rcu_head rcu;
0062
0063
0064 enum setid_type type;
0065 };
0066
0067 enum sid_policy_type _setid_policy_lookup(struct setid_ruleset *policy,
0068 kid_t src, kid_t dst);
0069
0070 extern struct setid_ruleset __rcu *safesetid_setuid_rules;
0071 extern struct setid_ruleset __rcu *safesetid_setgid_rules;
0072
0073 #endif