selinux: support name based type transitions in conditional policies
RFC PATCH 1/1 selinux: support name based type transitions in conditional policies
With the move of name based type transitions to the avtab structure such statements are candidate to be used in conditional policies. They are already read into the policy database (which might be seen as a mistake as referencing them after a boolean change causes a use-after-free).
Copy the avtab_trans structures on boolean changes to keep them available.
CC Juraj Marcin <[email protected]>
Signed-off-by Christian Göttsche <[email protected]>
---
Based on patcheset by Juraj Marcin [1]
[1]: https://patchwork.kernel.org/project/selinux/list/?series=752711
--- security/selinux/ss/avtab.c | 2 +- security/selinux/ss/avtab.h | 2 + security/selinux/ss/conditional.c | 96 ++++++++++++++++++++++++++++--- 3 files changed, 92 insertions(+), 8 deletions(-)
security/selinux/ss/avtab.c +1 -1
@@ -297,7 +297,7 @@ static int avtab_trans_destroy_helper(void *k, void *d, void *args)return 0 ; } -static void avtab_trans_destroy (struct avtab_trans *trans) +void avtab_trans_destroy (struct avtab_trans *trans) {hashtab_map (&trans->name_trans.table, avtab_trans_destroy_helper,NULL );hashtab_destroy (&trans->name_trans.table);
security/selinux/ss/avtab.h +2 -0
@@ -125,6 +125,8 @@ struct avtab_node *avtab_search_node_next(struct avtab_node *node, int specified#define MAX_AVTAB_HASH_BITS 16#define MAX_AVTAB_HASH_BUCKETS (1 << MAX_AVTAB_HASH_BITS) +void avtab_trans_destroy (struct avtab_trans *trans); +/* policydb filename transitions compatibility */ int avtab_filename_trans_read (struct avtab *a,void *fp,struct policydb *p);
security/selinux/ss/conditional.c +89 -7
121 lines not on this page · raw message
Signature · 1 line
2.40.1