kernel: authorize the newly type for all roles. refer: http://aospxref.com/kernel-android12-5.10-lts/xref/security/selinux/ss/policydb.c#950
This commit is contained in:
@@ -81,7 +81,8 @@ static bool add_typeattribute(struct policydb *db, const char *type,
|
|||||||
// htable is a struct instead of pointer above 5.8.0:
|
// htable is a struct instead of pointer above 5.8.0:
|
||||||
// https://elixir.bootlin.com/linux/v5.8-rc1/source/security/selinux/ss/symtab.h
|
// https://elixir.bootlin.com/linux/v5.8-rc1/source/security/selinux/ss/symtab.h
|
||||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
|
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
|
||||||
#define ksu_hashtab_for_each(htab, cur) ksu_hash_for_each (htab.htable, htab.size, cur)
|
#define ksu_hashtab_for_each(htab, cur) \
|
||||||
|
ksu_hash_for_each(htab.htable, htab.size, cur)
|
||||||
#else
|
#else
|
||||||
#define ksu_hashtab_for_each(htab, cur) \
|
#define ksu_hashtab_for_each(htab, cur) \
|
||||||
ksu_hash_for_each(htab->htable, htab->size, cur)
|
ksu_hash_for_each(htab->htable, htab->size, cur)
|
||||||
@@ -95,8 +96,7 @@ static bool add_typeattribute(struct policydb *db, const char *type,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define avtab_for_each(avtab, cur) \
|
#define avtab_for_each(avtab, cur) \
|
||||||
ksu_hash_for_each (avtab.htable, avtab.nslot, cur) \
|
ksu_hash_for_each(avtab.htable, avtab.nslot, cur);
|
||||||
;
|
|
||||||
|
|
||||||
static struct avtab_node *get_avtab_node(struct policydb *db,
|
static struct avtab_node *get_avtab_node(struct policydb *db,
|
||||||
struct avtab_key *key,
|
struct avtab_key *key,
|
||||||
@@ -693,7 +693,7 @@ static bool add_type(struct policydb *db, const char *type_name, bool attr)
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; i < db->p_roles.nprim; ++i) {
|
for (i = 0; i < db->p_roles.nprim; ++i) {
|
||||||
ebitmap_set_bit(&db->role_val_to_struct[i]->types, value - 1,
|
ebitmap_set_bit(&db->role_val_to_struct[i]->types, value - 1,
|
||||||
0);
|
1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -743,7 +743,7 @@ static bool add_type(struct policydb *db, const char *type_name, bool attr)
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; i < db->p_roles.nprim; ++i) {
|
for (i = 0; i < db->p_roles.nprim; ++i) {
|
||||||
ebitmap_set_bit(&db->role_val_to_struct[i]->types, value - 1,
|
ebitmap_set_bit(&db->role_val_to_struct[i]->types, value - 1,
|
||||||
0);
|
1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -854,7 +854,7 @@ static bool add_type(struct policydb *db, const char *type_name, bool attr)
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; i < db->p_roles.nprim; ++i) {
|
for (i = 0; i < db->p_roles.nprim; ++i) {
|
||||||
ebitmap_set_bit(&db->role_val_to_struct[i]->types, value - 1,
|
ebitmap_set_bit(&db->role_val_to_struct[i]->types, value - 1,
|
||||||
0);
|
1);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user