2 * acm.h: Xen access control module interface defintions
4 * Reiner Sailer <sailer@watson.ibm.com>
5 * Copyright (c) 2005, International Business Machines Corporation.
8 #ifndef _XEN_PUBLIC_ACM_H
9 #define _XEN_PUBLIC_ACM_H
12 #include "sched_ctl.h"
14 /* if ACM_DEBUG defined, all hooks should
15 * print a short trace message (comment it out
16 * when not in testing mode )
18 /* #define ACM_DEBUG */
21 # define printkd(fmt, args...) printk(fmt,## args)
23 # define printkd(fmt, args...)
26 /* default ssid reference value if not supplied */
27 #define ACM_DEFAULT_SSID 0x0
28 #define ACM_DEFAULT_LOCAL_SSID 0x0
30 /* Internal ACM ERROR types */
33 #define ACM_INIT_SSID_ERROR -2
34 #define ACM_INIT_SOID_ERROR -3
37 /* External ACCESS DECISIONS */
38 #define ACM_ACCESS_PERMITTED 0
39 #define ACM_ACCESS_DENIED -111
40 #define ACM_NULL_POINTER_ERROR -200
42 /* primary policy in lower 4 bits */
43 #define ACM_NULL_POLICY 0
44 #define ACM_CHINESE_WALL_POLICY 1
45 #define ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY 2
46 #define ACM_POLICY_UNDEFINED 15
48 /* combinations have secondary policy component in higher 4bit */
49 #define ACM_CHINESE_WALL_AND_SIMPLE_TYPE_ENFORCEMENT_POLICY \
50 ((ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY << 4) | ACM_CHINESE_WALL_POLICY)
53 #define ACM_POLICY_NAME(X) \
54 ((X) == (ACM_NULL_POLICY)) ? "NULL" : \
55 ((X) == (ACM_CHINESE_WALL_POLICY)) ? "CHINESE WALL" : \
56 ((X) == (ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY)) ? "SIMPLE TYPE ENFORCEMENT" : \
57 ((X) == (ACM_CHINESE_WALL_AND_SIMPLE_TYPE_ENFORCEMENT_POLICY)) ? "CHINESE WALL AND SIMPLE TYPE ENFORCEMENT" : \
60 /* the following policy versions must be increased
61 * whenever the interpretation of the related
62 * policy's data structure changes
64 #define ACM_POLICY_VERSION 2
65 #define ACM_CHWALL_VERSION 1
66 #define ACM_STE_VERSION 1
68 /* defines a ssid reference used by xen */
69 typedef uint32_t ssidref_t;
71 /* hooks that are known to domains */
72 #define ACMHOOK_none 0
73 #define ACMHOOK_sharing 1
75 /* -------security policy relevant type definitions-------- */
77 /* type identifier; compares to "equal" or "not equal" */
78 typedef uint16_t domaintype_t;
80 /* CHINESE WALL POLICY DATA STRUCTURES
82 * current accumulated conflict type set:
83 * When a domain is started and has a type that is in
84 * a conflict set, the conflicting types are incremented in
85 * the aggregate set. When a domain is destroyed, the
86 * conflicting types to its type are decremented.
87 * If a domain has multiple types, this procedure works over
90 * conflict_aggregate_set[i] holds the number of
91 * running domains that have a conflict with type i.
93 * running_types[i] holds the number of running domains
94 * that include type i in their ssidref-referenced type set
96 * conflict_sets[i][j] is "0" if type j has no conflict
97 * with type i and is "1" otherwise.
99 /* high-16 = version, low-16 = check magic */
100 #define ACM_MAGIC 0x0001debc
102 /* each offset in bytes from start of the struct they
105 /* each buffer consists of all policy information for
106 * the respective policy given in the policy code
108 * acm_policy_buffer, acm_chwall_policy_buffer,
109 * and acm_ste_policy_buffer need to stay 32-bit aligned
110 * because we create binary policies also with external
111 * tools that assume packed representations (e.g. the java tool)
113 struct acm_policy_buffer {
114 uint32_t policy_version; /* ACM_POLICY_VERSION */
117 uint32_t policy_reference_offset;
118 uint32_t primary_policy_code;
119 uint32_t primary_buffer_offset;
120 uint32_t secondary_policy_code;
121 uint32_t secondary_buffer_offset;
124 struct acm_policy_reference_buffer {
128 struct acm_chwall_policy_buffer {
129 uint32_t policy_version; /* ACM_CHWALL_VERSION */
130 uint32_t policy_code;
131 uint32_t chwall_max_types;
132 uint32_t chwall_max_ssidrefs;
133 uint32_t chwall_max_conflictsets;
134 uint32_t chwall_ssid_offset;
135 uint32_t chwall_conflict_sets_offset;
136 uint32_t chwall_running_types_offset;
137 uint32_t chwall_conflict_aggregate_offset;
140 struct acm_ste_policy_buffer {
141 uint32_t policy_version; /* ACM_STE_VERSION */
142 uint32_t policy_code;
143 uint32_t ste_max_types;
144 uint32_t ste_max_ssidrefs;
145 uint32_t ste_ssid_offset;
148 struct acm_stats_buffer {
151 uint32_t primary_policy_code;
152 uint32_t primary_stats_offset;
153 uint32_t secondary_policy_code;
154 uint32_t secondary_stats_offset;
157 struct acm_ste_stats_buffer {
158 uint32_t ec_eval_count;
159 uint32_t gt_eval_count;
160 uint32_t ec_denied_count;
161 uint32_t gt_denied_count;
162 uint32_t ec_cachehit_count;
163 uint32_t gt_cachehit_count;
166 struct acm_ssid_buffer {
169 uint32_t policy_reference_offset;
170 uint32_t primary_policy_code;
171 uint32_t primary_max_types;
172 uint32_t primary_types_offset;
173 uint32_t secondary_policy_code;
174 uint32_t secondary_max_types;
175 uint32_t secondary_types_offset;
186 * indent-tabs-mode: nil