direct-io.hg

view xen/include/acm/acm_core.h @ 5517:10e9028c8e3d

bitkeeper revision 1.1718.1.10 (42b7b19aqOS_1M8I4pIOFjiTPYWV-g)

Merge bk://xenbits.xensource.com/xen-unstable.bk
into spot.cl.cam.ac.uk:C:/Documents and Settings/iap10/xen-unstable.bk
author iap10@spot.cl.cam.ac.uk
date Tue Jun 21 06:20:10 2005 +0000 (2005-06-21)
parents aa52b853c28b
children 649cd37aa1ab
line source
1 /****************************************************************
2 * acm_core.h
3 *
4 * Copyright (C) 2005 IBM Corporation
5 *
6 * Author:
7 * Reiner Sailer <sailer@watson.ibm.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation, version 2 of the
12 * License.
13 *
14 * sHype header file describing core data types and constants
15 * for the access control module and relevant policies
16 *
17 */
18 #ifndef _ACM_CORE_H
19 #define _ACM_CORE_H
21 #include <xen/spinlock.h>
22 #include <public/acm.h>
23 #include <public/policy_ops.h>
25 /* Xen-internal representation of the binary policy */
26 struct acm_binary_policy {
27 u16 primary_policy_code;
28 u16 secondary_policy_code;
29 void *primary_binary_policy;
30 void *secondary_binary_policy;
32 };
34 struct chwall_binary_policy {
35 u16 max_types;
36 u16 max_ssidrefs;
37 u16 max_conflictsets;
38 domaintype_t *ssidrefs; /* [max_ssidrefs][max_types] */
39 domaintype_t *conflict_aggregate_set; /* [max_types] */
40 domaintype_t *running_types; /* [max_types] */
41 domaintype_t *conflict_sets; /* [max_conflictsets][max_types]*/
42 };
44 struct ste_binary_policy {
45 u16 max_types;
46 u16 max_ssidrefs;
47 domaintype_t *ssidrefs; /* [max_ssidrefs][max_types] */
48 atomic_t ec_eval_count, gt_eval_count;
49 atomic_t ec_denied_count, gt_denied_count;
50 atomic_t ec_cachehit_count, gt_cachehit_count;
51 };
53 /* global acm policy */
54 extern struct acm_binary_policy acm_bin_pol;
55 extern struct chwall_binary_policy chwall_bin_pol;
56 extern struct ste_binary_policy ste_bin_pol;
57 /* use the lock when reading / changing binary policy ! */
58 extern rwlock_t acm_bin_pol_rwlock;
60 /* subject and object type definitions */
61 enum acm_datatype { DOMAIN };
63 /* defines number of access decisions to other domains can be cached
64 * one entry per domain, TE does not distinguish evtchn or grant_table */
65 #define ACM_TE_CACHE_SIZE 8
66 enum acm_ste_flag { VALID, FREE };
68 /* cache line:
69 * if cache_line.valid==VALID, then
70 * STE decision is cached as "permitted"
71 * on domain cache_line.id
72 */
73 struct acm_ste_cache_line {
74 enum acm_ste_flag valid;
75 domid_t id;
76 };
78 /* general definition of a subject security id */
79 struct acm_ssid_domain {
80 enum acm_datatype datatype; /* type of subject (e.g., partition) */
81 ssidref_t ssidref; /* combined security reference */
82 void *primary_ssid; /* primary policy ssid part (e.g. chinese wall) */
83 void *secondary_ssid; /* secondary policy ssid part (e.g. type enforcement) */
84 struct domain *subject; /* backpointer to subject structure */
85 domid_t domainid; /* replicate id */
86 };
88 /* chinese wall ssid type */
89 struct chwall_ssid {
90 ssidref_t chwall_ssidref;
91 };
93 /* simple type enforcement ssid type */
94 struct ste_ssid {
95 ssidref_t ste_ssidref;
96 struct acm_ste_cache_line ste_cache[ACM_TE_CACHE_SIZE]; /* decision cache */
97 };
99 /* macros to access ssidref for primary / secondary policy
100 * primary ssidref = lower 16 bit
101 * secondary ssidref = higher 16 bit
102 */
103 #define GET_SSIDREF(POLICY, ssidref) \
104 ((POLICY) == acm_bin_pol.primary_policy_code) ? \
105 ((ssidref) & 0xffff) : ((ssidref) >> 16)
107 /* macros to access ssid pointer for primary / secondary policy */
108 #define GET_SSIDP(POLICY, ssid) \
109 ((POLICY) == acm_bin_pol.primary_policy_code) ? \
110 ((ssid)->primary_ssid) : ((ssid)->secondary_ssid)
112 /* protos */
113 int acm_init_domain_ssid(domid_t id, ssidref_t ssidref);
114 int acm_free_domain_ssid(struct acm_ssid_domain *ssid);
116 #endif