~ubuntu-branches/ubuntu/utopic/xen/utopic

« back to all changes in this revision

Viewing changes to xen/xsm/flask/include/avc.h

  • Committer: Bazaar Package Importer
  • Author(s): Bastian Blank
  • Date: 2010-05-06 15:47:38 UTC
  • mto: (1.3.1) (15.1.1 sid) (4.1.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20100506154738-agoz0rlafrh1fnq7
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Access vector cache interface for object managers.
 
3
 *
 
4
 * Author : Stephen Smalley, <sds@epoch.ncsc.mil>
 
5
 */
 
6
 
 
7
/* Ported to Xen 3.0, George Coker, <gscoker@alpha.ncsc.mil> */
 
8
 
 
9
#ifndef _FLASK_AVC_H_
 
10
#define _FLASK_AVC_H_
 
11
 
 
12
#include <xen/errno.h>
 
13
#include <xen/lib.h>
 
14
#include <xen/spinlock.h>
 
15
#include <asm/percpu.h>
 
16
#include "flask.h"
 
17
#include "av_permissions.h"
 
18
#include "security.h"
 
19
 
 
20
#ifdef FLASK_DEVELOP
 
21
extern int flask_enforcing;
 
22
#else
 
23
#define flask_enforcing 1
 
24
#endif
 
25
 
 
26
/*
 
27
 * An entry in the AVC.
 
28
 */
 
29
struct avc_entry;
 
30
 
 
31
struct task_struct;
 
32
struct vfsmount;
 
33
struct dentry;
 
34
struct inode;
 
35
struct sock;
 
36
struct sk_buff;
 
37
 
 
38
/* Auxiliary data to use in generating the audit record. */
 
39
struct avc_audit_data {
 
40
    char    type;
 
41
#define AVC_AUDIT_DATA_DEV  1
 
42
    struct domain *d;
 
43
    unsigned long device;
 
44
};
 
45
 
 
46
#define v4info fam.v4
 
47
#define v6info fam.v6
 
48
 
 
49
/* Initialize an AVC audit data structure. */
 
50
#define AVC_AUDIT_DATA_INIT(_d,_t) \
 
51
        { memset((_d), 0, sizeof(struct avc_audit_data)); \
 
52
         (_d)->type = AVC_AUDIT_DATA_##_t; }
 
53
 
 
54
/*
 
55
 * AVC statistics
 
56
 */
 
57
struct avc_cache_stats
 
58
{
 
59
    unsigned int lookups;
 
60
    unsigned int hits;
 
61
    unsigned int misses;
 
62
    unsigned int allocations;
 
63
    unsigned int reclaims;
 
64
    unsigned int frees;
 
65
};
 
66
 
 
67
/*
 
68
 * AVC operations
 
69
 */
 
70
 
 
71
void avc_init(void);
 
72
 
 
73
void avc_audit(u32 ssid, u32 tsid, u16 tclass, u32 requested,
 
74
        struct av_decision *avd, int result, struct avc_audit_data *auditdata);
 
75
 
 
76
int avc_has_perm_noaudit(u32 ssid, u32 tsid, u16 tclass, u32 requested,
 
77
                                                     struct av_decision *avd);
 
78
 
 
79
int avc_has_perm(u32 ssid, u32 tsid, u16 tclass, u32 requested,
 
80
                                             struct avc_audit_data *auditdata);
 
81
 
 
82
#define AVC_CALLBACK_GRANT        1
 
83
#define AVC_CALLBACK_TRY_REVOKE        2
 
84
#define AVC_CALLBACK_REVOKE        4
 
85
#define AVC_CALLBACK_RESET        8
 
86
#define AVC_CALLBACK_AUDITALLOW_ENABLE    16
 
87
#define AVC_CALLBACK_AUDITALLOW_DISABLE    32
 
88
#define AVC_CALLBACK_AUDITDENY_ENABLE    64
 
89
#define AVC_CALLBACK_AUDITDENY_DISABLE    128
 
90
 
 
91
int avc_add_callback(int (*callback)(u32 event, u32 ssid, u32 tsid,
 
92
                        u16 tclass, u32 perms, u32 *out_retained), u32 events, 
 
93
                                    u32 ssid, u32 tsid, u16 tclass, u32 perms);
 
94
 
 
95
/* Exported to selinuxfs */
 
96
int avc_get_hash_stats(char *buf, uint32_t size);
 
97
extern unsigned int avc_cache_threshold;
 
98
 
 
99
#ifdef FLASK_AVC_STATS
 
100
DECLARE_PER_CPU(struct avc_cache_stats, avc_cache_stats);
 
101
#endif
 
102
 
 
103
#endif /* _FLASK_AVC_H_ */
 
104