selinux: implement new format of filename transitions
PATCH v2 1/1 selinux: implement new format of filename transitions
Implement a new, more space-efficient way of storing filename transitions in the binary policy. The internal structures have already been converted to this new representation; this patch just implements reading/writing an equivalent represntation from/to the binary policy.
This new format reduces the size of Fedora policy from 7.6 MB to only 3.3 MB (with policy optimization enabled in both cases). With the unconfined module disabled, the size is reduced from 3.3 MB to 2.4 MB.
The time to load policy into kernel is also shorter with the new format. On Fedora Rawhide x86_64 it dropped from 157 ms to 106 ms; without the unconfined module from 115 ms to 105 ms.
---
Changes in v2:
- rename the read/write helpers
- move update of filename_trans_ttypes in filename_trans_read_helper() to later in the function
- make filename_trans_read_helper() count filename_trans_count correctly
security/selinux/include/security.h | 3 +- security/selinux/ss/policydb.c | 212 ++++++++++++++++++++++++---- 2 files changed, 189 insertions(+), 26 deletions(-)
security/selinux/include/security.h +2 -1
@@ -41,10 +41,11 @@#define POLICYDB_VERSION_XPERMS_IOCTL 30#define POLICYDB_VERSION_INFINIBAND 31#define POLICYDB_VERSION_GLBLUB 32 +#define POLICYDB_VERSION_COMP_FTRANS 33/* compressed filename transitions */ /* Range of policy versions we understand*/ #define POLICYDB_VERSION_MIN POLICYDB_VERSION_BASE -#define POLICYDB_VERSION_MAX POLICYDB_VERSION_GLBLUB +#define POLICYDB_VERSION_MAX POLICYDB_VERSION_COMP_FTRANS/* Mask for just the mount related flags */ #define SE_MNTMASK 0x0f
security/selinux/ss/policydb.c +187 -25
283 lines not on this page · raw message
Signature · 1 line
2.25.2
Quoted 24 lines · Ondrej Mosnacek
Implement a new, more space-efficient way of storing filename transitions in the binary policy. The internal structures have already been converted to this new representation; this patch just implements reading/writing an equivalent represntation from/to the binary policy.
This new format reduces the size of Fedora policy from 7.6 MB to only 3.3 MB (with policy optimization enabled in both cases). With the unconfined module disabled, the size is reduced from 3.3 MB to 2.4 MB.
The time to load policy into kernel is also shorter with the new format. On Fedora Rawhide
x86_64it dropped from 157 ms to 106 ms; without the unconfined module from 115 ms to 105 ms.Signed-off-by Ondrej Mosnacek <[email protected]>---
Changes in v2:
- rename the read/write helpers
- move update offilename_trans_ttypesinfilename_trans_read_helper()to later in the function
- makefilename_trans_read_helper()countfilename_trans_countcorrectly
Quoted 3 lines
security/selinux/include/security.h | 3 +- security/selinux/ss/policydb.c | 212 ++++++++++++++++++++++++---- 2 files changed, 189 insertions(+), 26 deletions(-)
Merged into selinux/next, thanks.
Signature · 2 lines
paul moore www.paul-moore.com