2121#include "flask.h"
2222#include "policycap.h"
2323
24- #define SECSID_NULL 0x00000000 /* unspecified SID */
25- #define SECSID_WILD 0xffffffff /* wildcard SID */
26- #define SECCLASS_NULL 0x0000 /* no class */
24+ #define SECSID_NULL 0x00000000 /* unspecified SID */
25+ #define SECSID_WILD 0xffffffff /* wildcard SID */
26+ #define SECCLASS_NULL 0x0000 /* no class */
2727
2828/* Identify specific policy version changes */
29- #define POLICYDB_VERSION_BASE 15
30- #define POLICYDB_VERSION_BOOL 16
31- #define POLICYDB_VERSION_IPV6 17
32- #define POLICYDB_VERSION_NLCLASS 18
33- #define POLICYDB_VERSION_VALIDATETRANS 19
34- #define POLICYDB_VERSION_MLS 19
35- #define POLICYDB_VERSION_AVTAB 20
36- #define POLICYDB_VERSION_RANGETRANS 21
37- #define POLICYDB_VERSION_POLCAP 22
38- #define POLICYDB_VERSION_PERMISSIVE 23
39- #define POLICYDB_VERSION_BOUNDARY 24
40- #define POLICYDB_VERSION_FILENAME_TRANS 25
41- #define POLICYDB_VERSION_ROLETRANS 26
42- #define POLICYDB_VERSION_NEW_OBJECT_DEFAULTS 27
43- #define POLICYDB_VERSION_DEFAULT_TYPE 28
44- #define POLICYDB_VERSION_CONSTRAINT_NAMES 29
45- #define POLICYDB_VERSION_XPERMS_IOCTL 30
46- #define POLICYDB_VERSION_INFINIBAND 31
47- #define POLICYDB_VERSION_GLBLUB 32
48- #define POLICYDB_VERSION_COMP_FTRANS 33 /* compressed filename transitions */
29+ #define POLICYDB_VERSION_BASE 15
30+ #define POLICYDB_VERSION_BOOL 16
31+ #define POLICYDB_VERSION_IPV6 17
32+ #define POLICYDB_VERSION_NLCLASS 18
33+ #define POLICYDB_VERSION_VALIDATETRANS 19
34+ #define POLICYDB_VERSION_MLS 19
35+ #define POLICYDB_VERSION_AVTAB 20
36+ #define POLICYDB_VERSION_RANGETRANS 21
37+ #define POLICYDB_VERSION_POLCAP 22
38+ #define POLICYDB_VERSION_PERMISSIVE 23
39+ #define POLICYDB_VERSION_BOUNDARY 24
40+ #define POLICYDB_VERSION_FILENAME_TRANS 25
41+ #define POLICYDB_VERSION_ROLETRANS 26
42+ #define POLICYDB_VERSION_NEW_OBJECT_DEFAULTS 27
43+ #define POLICYDB_VERSION_DEFAULT_TYPE 28
44+ #define POLICYDB_VERSION_CONSTRAINT_NAMES 29
45+ #define POLICYDB_VERSION_XPERMS_IOCTL 30
46+ #define POLICYDB_VERSION_INFINIBAND 31
47+ #define POLICYDB_VERSION_GLBLUB 32
48+ #define POLICYDB_VERSION_COMP_FTRANS 33 /* compressed filename transitions */
4949
5050/* Range of policy versions we understand*/
51- #define POLICYDB_VERSION_MIN POLICYDB_VERSION_BASE
52- #define POLICYDB_VERSION_MAX POLICYDB_VERSION_COMP_FTRANS
51+ #define POLICYDB_VERSION_MIN POLICYDB_VERSION_BASE
52+ #define POLICYDB_VERSION_MAX POLICYDB_VERSION_COMP_FTRANS
5353
5454/* Mask for just the mount related flags */
55- #define SE_MNTMASK 0x0f
55+ #define SE_MNTMASK 0x0f
5656/* Super block security struct flags for mount options */
5757/* BE CAREFUL, these need to be the low order bits for selinux_get_mnt_opts */
5858#define CONTEXT_MNT 0x01
5959#define FSCONTEXT_MNT 0x02
60- #define ROOTCONTEXT_MNT 0x04
60+ #define ROOTCONTEXT_MNT 0x04
6161#define DEFCONTEXT_MNT 0x08
6262#define SBLABEL_MNT 0x10
6363/* Non-mount related flags */
64- #define SE_SBINITIALIZED 0x0100
65- #define SE_SBPROC 0x0200
66- #define SE_SBGENFS 0x0400
67- #define SE_SBGENFS_XATTR 0x0800
68- #define SE_SBNATIVE 0x1000
64+ #define SE_SBINITIALIZED 0x0100
65+ #define SE_SBPROC 0x0200
66+ #define SE_SBGENFS 0x0400
67+ #define SE_SBGENFS_XATTR 0x0800
68+ #define SE_SBNATIVE 0x1000
6969
7070#define CONTEXT_STR "context"
7171#define FSCONTEXT_STR "fscontext"
72- #define ROOTCONTEXT_STR "rootcontext"
72+ #define ROOTCONTEXT_STR "rootcontext"
7373#define DEFCONTEXT_STR "defcontext"
74- #define SECLABEL_STR "seclabel"
74+ #define SECLABEL_STR "seclabel"
7575
7676struct netlbl_lsm_secattr ;
7777
@@ -81,11 +81,11 @@ extern int selinux_enabled_boot;
8181 * type_datum properties
8282 * available at the kernel policy version >= POLICYDB_VERSION_BOUNDARY
8383 */
84- #define TYPEDATUM_PROPERTY_PRIMARY 0x0001
85- #define TYPEDATUM_PROPERTY_ATTRIBUTE 0x0002
84+ #define TYPEDATUM_PROPERTY_PRIMARY 0x0001
85+ #define TYPEDATUM_PROPERTY_ATTRIBUTE 0x0002
8686
8787/* limitation of boundary depth */
88- #define POLICYDB_BOUNDS_MAXDEPTH 4
88+ #define POLICYDB_BOUNDS_MAXDEPTH 4
8989
9090struct selinux_policy ;
9191
@@ -220,12 +220,12 @@ struct av_decision {
220220 u32 flags ;
221221};
222222
223- #define XPERMS_ALLOWED 1
223+ #define XPERMS_ALLOWED 1
224224#define XPERMS_AUDITALLOW 2
225- #define XPERMS_DONTAUDIT 4
225+ #define XPERMS_DONTAUDIT 4
226226
227- #define security_xperm_set (perms , x ) ((perms)[(x) >> 5] |= 1 << ((x) & 0x1f))
228- #define security_xperm_test (perms , x ) (1 & ((perms)[(x) >> 5] >> ((x) & 0x1f)))
227+ #define security_xperm_set (perms , x ) ((perms)[(x) >> 5] |= 1 << ((x)& 0x1f))
228+ #define security_xperm_test (perms , x ) (1 & ((perms)[(x) >> 5] >> ((x)& 0x1f)))
229229struct extended_perms_data {
230230 u32 p [8 ];
231231};
@@ -239,23 +239,22 @@ struct extended_perms_decision {
239239};
240240
241241struct extended_perms {
242- u16 len ; /* length associated decision chain */
242+ u16 len ; /* length associated decision chain */
243243 struct extended_perms_data drivers ; /* flag drivers that are used */
244244};
245245
246246/* definitions of av_decision.flags */
247- #define AVD_FLAGS_PERMISSIVE 0x0001
247+ #define AVD_FLAGS_PERMISSIVE 0x0001
248248
249- void security_compute_av (u32 ssid , u32 tsid ,
250- u16 tclass , struct av_decision * avd ,
249+ void security_compute_av (u32 ssid , u32 tsid , u16 tclass ,
250+ struct av_decision * avd ,
251251 struct extended_perms * xperms );
252252
253- void security_compute_xperms_decision (u32 ssid , u32 tsid , u16 tclass ,
254- u8 driver ,
253+ void security_compute_xperms_decision (u32 ssid , u32 tsid , u16 tclass , u8 driver ,
255254 struct extended_perms_decision * xpermd );
256255
257- void security_compute_av_user (u32 ssid , u32 tsid ,
258- u16 tclass , struct av_decision * avd );
256+ void security_compute_av_user (u32 ssid , u32 tsid , u16 tclass ,
257+ struct av_decision * avd );
259258
260259int security_transition_sid (u32 ssid , u32 tsid , u16 tclass ,
261260 const struct qstr * qstr , u32 * out_sid );
@@ -294,8 +293,7 @@ int security_ib_endport_sid(const char *dev_name, u8 port_num, u32 *out_sid);
294293
295294int security_netif_sid (char * name , u32 * if_sid );
296295
297- int security_node_sid (u16 domain , void * addr , u32 addrlen ,
298- u32 * out_sid );
296+ int security_node_sid (u16 domain , void * addr , u32 addrlen , u32 * out_sid );
299297
300298int security_validate_transition (u32 oldsid , u32 newsid , u32 tasksid ,
301299 u16 tclass );
@@ -307,50 +305,47 @@ int security_bounded_transition(u32 oldsid, u32 newsid);
307305
308306int security_sid_mls_copy (u32 sid , u32 mls_sid , u32 * new_sid );
309307
310- int security_net_peersid_resolve (u32 nlbl_sid , u32 nlbl_type ,
311- u32 xfrm_sid ,
308+ int security_net_peersid_resolve (u32 nlbl_sid , u32 nlbl_type , u32 xfrm_sid ,
312309 u32 * peer_sid );
313310
314- int security_get_classes (struct selinux_policy * policy ,
315- char * * * classes , u32 * nclasses );
316- int security_get_permissions (struct selinux_policy * policy ,
317- const char * class , char * * * perms , u32 * nperms );
311+ int security_get_classes (struct selinux_policy * policy , char * * * classes ,
312+ u32 * nclasses );
313+ int security_get_permissions (struct selinux_policy * policy , const char * class ,
314+ char * * * perms , u32 * nperms );
318315int security_get_reject_unknown (void );
319316int security_get_allow_unknown (void );
320317
321- #define SECURITY_FS_USE_XATTR 1 /* use xattr */
322- #define SECURITY_FS_USE_TRANS 2 /* use transition SIDs, e.g. devpts/tmpfs */
323- #define SECURITY_FS_USE_TASK 3 /* use task SIDs, e.g. pipefs/sockfs */
324- #define SECURITY_FS_USE_GENFS 4 /* use the genfs support */
325- #define SECURITY_FS_USE_NONE 5 /* no labeling support */
326- #define SECURITY_FS_USE_MNTPOINT 6 /* use mountpoint labeling */
327- #define SECURITY_FS_USE_NATIVE 7 /* use native label support */
328- #define SECURITY_FS_USE_MAX 7 /* Highest SECURITY_FS_USE_XXX */
318+ #define SECURITY_FS_USE_XATTR 1 /* use xattr */
319+ #define SECURITY_FS_USE_TRANS 2 /* use transition SIDs, e.g. devpts/tmpfs */
320+ #define SECURITY_FS_USE_TASK 3 /* use task SIDs, e.g. pipefs/sockfs */
321+ #define SECURITY_FS_USE_GENFS 4 /* use the genfs support */
322+ #define SECURITY_FS_USE_NONE 5 /* no labeling support */
323+ #define SECURITY_FS_USE_MNTPOINT 6 /* use mountpoint labeling */
324+ #define SECURITY_FS_USE_NATIVE 7 /* use native label support */
325+ #define SECURITY_FS_USE_MAX 7 /* Highest SECURITY_FS_USE_XXX */
329326
330327int security_fs_use (struct super_block * sb );
331328
332329int security_genfs_sid (const char * fstype , const char * path , u16 sclass ,
333330 u32 * sid );
334331
335- int selinux_policy_genfs_sid (struct selinux_policy * policy ,
336- const char * fstype , const char * path , u16 sclass ,
337- u32 * sid );
332+ int selinux_policy_genfs_sid (struct selinux_policy * policy , const char * fstype ,
333+ const char * path , u16 sclass , u32 * sid );
338334
339335#ifdef CONFIG_NETLABEL
340336int security_netlbl_secattr_to_sid (struct netlbl_lsm_secattr * secattr ,
341337 u32 * sid );
342338
343- int security_netlbl_sid_to_secattr (u32 sid ,
344- struct netlbl_lsm_secattr * secattr );
339+ int security_netlbl_sid_to_secattr (u32 sid , struct netlbl_lsm_secattr * secattr );
345340#else
346- static inline int security_netlbl_secattr_to_sid ( struct netlbl_lsm_secattr * secattr ,
347- u32 * sid )
341+ static inline int
342+ security_netlbl_secattr_to_sid ( struct netlbl_lsm_secattr * secattr , u32 * sid )
348343{
349344 return - EIDRM ;
350345}
351346
352- static inline int security_netlbl_sid_to_secattr ( u32 sid ,
353- struct netlbl_lsm_secattr * secattr )
347+ static inline int
348+ security_netlbl_sid_to_secattr ( u32 sid , struct netlbl_lsm_secattr * secattr )
354349{
355350 return - ENOENT ;
356351}
@@ -363,13 +358,13 @@ const char *security_get_initial_sid_context(u32 sid);
363358 */
364359extern struct page * selinux_kernel_status_page (void );
365360
366- #define SELINUX_KERNEL_STATUS_VERSION 1
361+ #define SELINUX_KERNEL_STATUS_VERSION 1
367362struct selinux_kernel_status {
368- u32 version ; /* version number of the structure */
369- u32 sequence ; /* sequence number of seqlock logic */
370- u32 enforcing ; /* current setting of enforcing mode */
371- u32 policyload ; /* times of policy reloaded */
372- u32 deny_unknown ; /* current setting of deny_unknown */
363+ u32 version ; /* version number of the structure */
364+ u32 sequence ; /* sequence number of seqlock logic */
365+ u32 enforcing ; /* current setting of enforcing mode */
366+ u32 policyload ; /* times of policy reloaded */
367+ u32 deny_unknown ; /* current setting of deny_unknown */
373368 /*
374369 * The version > 0 supports above members.
375370 */
0 commit comments