Path: blob/master/security/selinux/ss/constraint.h
10817 views
/*1* A constraint is a condition that must be satisfied in2* order for one or more permissions to be granted.3* Constraints are used to impose additional restrictions4* beyond the type-based rules in `te' or the role-based5* transition rules in `rbac'. Constraints are typically6* used to prevent a process from transitioning to a new user7* identity or role unless it is in a privileged type.8* Constraints are likewise typically used to prevent a9* process from labeling an object with a different user10* identity.11*12* Author : Stephen Smalley, <[email protected]>13*/14#ifndef _SS_CONSTRAINT_H_15#define _SS_CONSTRAINT_H_1617#include "ebitmap.h"1819#define CEXPR_MAXDEPTH 52021struct constraint_expr {22#define CEXPR_NOT 1 /* not expr */23#define CEXPR_AND 2 /* expr and expr */24#define CEXPR_OR 3 /* expr or expr */25#define CEXPR_ATTR 4 /* attr op attr */26#define CEXPR_NAMES 5 /* attr op names */27u32 expr_type; /* expression type */2829#define CEXPR_USER 1 /* user */30#define CEXPR_ROLE 2 /* role */31#define CEXPR_TYPE 4 /* type */32#define CEXPR_TARGET 8 /* target if set, source otherwise */33#define CEXPR_XTARGET 16 /* special 3rd target for validatetrans rule */34#define CEXPR_L1L2 32 /* low level 1 vs. low level 2 */35#define CEXPR_L1H2 64 /* low level 1 vs. high level 2 */36#define CEXPR_H1L2 128 /* high level 1 vs. low level 2 */37#define CEXPR_H1H2 256 /* high level 1 vs. high level 2 */38#define CEXPR_L1H1 512 /* low level 1 vs. high level 1 */39#define CEXPR_L2H2 1024 /* low level 2 vs. high level 2 */40u32 attr; /* attribute */4142#define CEXPR_EQ 1 /* == or eq */43#define CEXPR_NEQ 2 /* != */44#define CEXPR_DOM 3 /* dom */45#define CEXPR_DOMBY 4 /* domby */46#define CEXPR_INCOMP 5 /* incomp */47u32 op; /* operator */4849struct ebitmap names; /* names */5051struct constraint_expr *next; /* next expression */52};5354struct constraint_node {55u32 permissions; /* constrained permissions */56struct constraint_expr *expr; /* constraint on permissions */57struct constraint_node *next; /* next constraint */58};5960#endif /* _SS_CONSTRAINT_H_ */616263