Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
file.h File Reference
#include "domain.h"
#include "match.h"

Go to the source code of this file.

Data Structures

struct  path_cond
 
struct  file_perms
 
struct  aa_file_rules
 

Macros

#define AA_MAY_CREATE   0x0010
 
#define AA_MAY_DELETE   0x0020
 
#define AA_MAY_META_WRITE   0x0040
 
#define AA_MAY_META_READ   0x0080
 
#define AA_MAY_CHMOD   0x0100
 
#define AA_MAY_CHOWN   0x0200
 
#define AA_MAY_LOCK   0x0400
 
#define AA_EXEC_MMAP   0x0800
 
#define AA_MAY_LINK   0x1000
 
#define AA_LINK_SUBSET   AA_MAY_LOCK /* overlaid */
 
#define AA_MAY_ONEXEC   0x40000000 /* exec allows onexec */
 
#define AA_MAY_CHANGE_PROFILE   0x80000000
 
#define AA_MAY_CHANGEHAT   0x80000000 /* ctrl auditing only */
 
#define AA_AUDIT_FILE_MASK
 
#define AA_X_INDEX_MASK   0x03ff
 
#define AA_X_TYPE_MASK   0x0c00
 
#define AA_X_TYPE_SHIFT   10
 
#define AA_X_NONE   0x0000
 
#define AA_X_NAME   0x0400 /* use executable name px */
 
#define AA_X_TABLE   0x0800 /* use a specified name ->n# */
 
#define AA_X_UNSAFE   0x1000
 
#define AA_X_CHILD   0x2000 /* make >AA_X_NONE apply to children */
 
#define AA_X_INHERIT   0x4000
 
#define AA_X_UNCONFINED   0x8000
 
#define AA_SECURE_X_NEEDED   0x8000
 
#define COMBINED_PERM_MASK(X)   ((X).allow | (X).audit | (X).quiet | (X).kill)
 
#define dfa_user_allow(dfa, state)
 
#define dfa_user_audit(dfa, state)   ((ACCEPT_TABLE2(dfa)[state]) & 0x7f)
 
#define dfa_user_quiet(dfa, state)   (((ACCEPT_TABLE2(dfa)[state]) >> 7) & 0x7f)
 
#define dfa_user_xindex(dfa, state)   (dfa_map_xindex(ACCEPT_TABLE(dfa)[state] & 0x3fff))
 
#define dfa_other_allow(dfa, state)
 
#define dfa_other_audit(dfa, state)   (((ACCEPT_TABLE2(dfa)[state]) >> 14) & 0x7f)
 
#define dfa_other_quiet(dfa, state)   ((((ACCEPT_TABLE2(dfa)[state]) >> 7) >> 14) & 0x7f)
 
#define dfa_other_xindex(dfa, state)   dfa_map_xindex((ACCEPT_TABLE(dfa)[state] >> 14) & 0x3fff)
 
#define ACC_FMODE(x)   (("\000\004\002\006"[(x)&O_ACCMODE]) | (((x) << 1) & 0x40))
 
#define MAP_OPEN_FLAGS(x)   ((((x) + 1) & O_ACCMODE) ? (x) + 1 : (x))
 

Functions

int aa_audit_file (struct aa_profile *profile, struct file_perms *perms, gfp_t gfp, int op, u32 request, const char *name, const char *target, kuid_t ouid, const char *info, int error)
 
unsigned int aa_str_perms (struct aa_dfa *dfa, unsigned int start, const char *name, struct path_cond *cond, struct file_perms *perms)
 
int aa_path_perm (int op, struct aa_profile *profile, struct path *path, int flags, u32 request, struct path_cond *cond)
 
int aa_path_link (struct aa_profile *profile, struct dentry *old_dentry, struct path *new_dir, struct dentry *new_dentry)
 
int aa_file_perm (int op, struct aa_profile *profile, struct file *file, u32 request)
 

Variables

struct file_perms nullperms
 

Macro Definition Documentation

#define AA_AUDIT_FILE_MASK
Value:
AA_MAY_CREATE | AA_MAY_DELETE | \
AA_MAY_META_READ | AA_MAY_META_WRITE | \
AA_MAY_CHMOD | AA_MAY_CHOWN | AA_MAY_LOCK | \
AA_EXEC_MMAP | AA_MAY_LINK)

Definition at line 44 of file file.h.

#define AA_EXEC_MMAP   0x0800

Definition at line 36 of file file.h.

#define AA_LINK_SUBSET   AA_MAY_LOCK /* overlaid */

Definition at line 39 of file file.h.

#define AA_MAY_CHANGE_PROFILE   0x80000000

Definition at line 41 of file file.h.

#define AA_MAY_CHANGEHAT   0x80000000 /* ctrl auditing only */

Definition at line 42 of file file.h.

#define AA_MAY_CHMOD   0x0100

Definition at line 33 of file file.h.

#define AA_MAY_CHOWN   0x0200

Definition at line 34 of file file.h.

#define AA_MAY_CREATE   0x0010

Definition at line 28 of file file.h.

#define AA_MAY_DELETE   0x0020

Definition at line 29 of file file.h.

#define AA_MAY_LINK   0x1000

Definition at line 38 of file file.h.

#define AA_MAY_LOCK   0x0400

Definition at line 35 of file file.h.

#define AA_MAY_META_READ   0x0080

Definition at line 31 of file file.h.

#define AA_MAY_META_WRITE   0x0040

Definition at line 30 of file file.h.

#define AA_MAY_ONEXEC   0x40000000 /* exec allows onexec */

Definition at line 40 of file file.h.

#define AA_SECURE_X_NEEDED   0x8000

Definition at line 70 of file file.h.

#define AA_X_CHILD   0x2000 /* make >AA_X_NONE apply to children */

Definition at line 65 of file file.h.

#define AA_X_INDEX_MASK   0x03ff

Definition at line 56 of file file.h.

#define AA_X_INHERIT   0x4000

Definition at line 66 of file file.h.

#define AA_X_NAME   0x0400 /* use executable name px */

Definition at line 61 of file file.h.

#define AA_X_NONE   0x0000

Definition at line 60 of file file.h.

#define AA_X_TABLE   0x0800 /* use a specified name ->n# */

Definition at line 62 of file file.h.

#define AA_X_TYPE_MASK   0x0c00

Definition at line 58 of file file.h.

#define AA_X_TYPE_SHIFT   10

Definition at line 59 of file file.h.

#define AA_X_UNCONFINED   0x8000

Definition at line 67 of file file.h.

#define AA_X_UNSAFE   0x1000

Definition at line 64 of file file.h.

#define ACC_FMODE (   x)    (("\000\004\002\006"[(x)&O_ACCMODE]) | (((x) << 1) & 0x40))

Definition at line 189 of file file.h.

#define COMBINED_PERM_MASK (   X)    ((X).allow | (X).audit | (X).quiet | (X).kill)

Definition at line 97 of file file.h.

#define dfa_other_allow (   dfa,
  state 
)
Value:
((((ACCEPT_TABLE(dfa)[state]) >> 14) & \
0x7f) | \
((ACCEPT_TABLE(dfa)[state]) & 0x80000000))

Definition at line 138 of file file.h.

#define dfa_other_audit (   dfa,
  state 
)    (((ACCEPT_TABLE2(dfa)[state]) >> 14) & 0x7f)

Definition at line 141 of file file.h.

#define dfa_other_quiet (   dfa,
  state 
)    ((((ACCEPT_TABLE2(dfa)[state]) >> 7) >> 14) & 0x7f)

Definition at line 142 of file file.h.

#define dfa_other_xindex (   dfa,
  state 
)    dfa_map_xindex((ACCEPT_TABLE(dfa)[state] >> 14) & 0x3fff)

Definition at line 144 of file file.h.

#define dfa_user_allow (   dfa,
  state 
)
Value:
(((ACCEPT_TABLE(dfa)[state]) & 0x7f) | \
((ACCEPT_TABLE(dfa)[state]) & 0x80000000))

Definition at line 131 of file file.h.

#define dfa_user_audit (   dfa,
  state 
)    ((ACCEPT_TABLE2(dfa)[state]) & 0x7f)

Definition at line 133 of file file.h.

#define dfa_user_quiet (   dfa,
  state 
)    (((ACCEPT_TABLE2(dfa)[state]) >> 7) & 0x7f)

Definition at line 134 of file file.h.

#define dfa_user_xindex (   dfa,
  state 
)    (dfa_map_xindex(ACCEPT_TABLE(dfa)[state] & 0x3fff))

Definition at line 135 of file file.h.

#define MAP_OPEN_FLAGS (   x)    ((((x) + 1) & O_ACCMODE) ? (x) + 1 : (x))

Definition at line 192 of file file.h.

Function Documentation

int aa_audit_file ( struct aa_profile profile,
struct file_perms perms,
gfp_t  gfp,
int  op,
u32  request,
const char name,
const char target,
kuid_t  ouid,
const char info,
int  error 
)

Definition at line 106 of file file.c.

int aa_file_perm ( int  op,
struct aa_profile profile,
struct file file,
u32  request 
)

Definition at line 448 of file file.c.

int aa_path_link ( struct aa_profile profile,
struct dentry old_dentry,
struct path new_dir,
struct dentry new_dentry 
)

aa_path_link - Handle hard link permission check : the profile being enforced (NOT NULL) : the target dentry (NOT NULL) : directory the new link will be created in (NOT NULL) : the link being created (NOT NULL)

Handle the permission test for a link & target pair. Permission is encoded as a pair where the link permission is determined first, and if allowed, the target is tested. The target test is done from the point of the link match (not start of DFA) making the target permission dependent on the link permission match.

The subset test if required forces that permissions granted on link are a subset of the permission granted to target.

Returns: %0 if allowed else error

Definition at line 348 of file file.c.

int aa_path_perm ( int  op,
struct aa_profile profile,
struct path path,
int  flags,
u32  request,
struct path_cond cond 
)

aa_path_perm - do permissions check & audit for : operation being checked : profile being enforced (NOT NULL) : path to check permissions of (NOT NULL) : any additional path flags beyond what the profile specifies : requested permissions : conditional info for this request (NOT NULL)

Returns: %0 else error if access denied or other error

Definition at line 278 of file file.c.

unsigned int aa_str_perms ( struct aa_dfa dfa,
unsigned int  start,
const char name,
struct path_cond cond,
struct file_perms perms 
)

Definition at line 238 of file file.c.

Variable Documentation

struct file_perms nullperms

Definition at line 22 of file file.c.