ia64/xen-unstable

view tools/flask/policy/Rules.modular @ 19648:f0e2df69a8eb

x86 hvm: Allow cross-vendor migration

Intercept #UD and emulate SYSCALL/SYSENTER/SYSEXIT as necessary.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue May 26 15:01:36 2009 +0100 (2009-05-26)
parents 294fc8fc4ba0
children
line source
1 ########################################
2 #
3 # Rules and Targets for building modular policies
4 #
6 ALL_MODULES := $(filter $(BASE_MODS) $(MOD_MODS),$(DETECTED_MODS))
7 ALL_INTERFACES := $(ALL_MODULES:.te=.if)
9 BASE_PKG := base.pp
10 BASE_FC := base.fc
12 BASE_SECTIONS := tmp/pre_te_files.conf tmp/generated_definitions.conf tmp/all_interfaces.conf tmp/all_attrs_types.conf $(GLOBALBOOL) $(GLOBALTUN) tmp/only_te_rules.conf tmp/all_post.conf
14 BASE_PRE_TE_FILES := $(SECCLASS) $(ISIDS) $(AVS) $(M4SUPPORT) $(POLDIR)/mls $(POLDIR)/mcs
15 BASE_TE_FILES := $(BASE_MODS)
16 BASE_POST_TE_FILES := $(POLDIR)/systemuser $(POLDIR)/constraints
17 BASE_FC_FILES := $(BASE_MODS:.te=.fc)
19 MOD_MODULES := $(MOD_MODS:.te=.mod)
20 MOD_PKGS := $(notdir $(MOD_MODS:.te=.pp))
22 # search layer dirs for source files
23 vpath %.te $(ALL_LAYERS)
24 vpath %.if $(ALL_LAYERS)
25 vpath %.fc $(ALL_LAYERS)
27 ########################################
28 #
29 # default action: create all module packages
30 #
31 default: base
33 base: $(BASE_PKG)
35 modules: $(MOD_PKGS)
37 #policy: $(POLVER)
38 #install: $(LOADPATH) $(FCPATH) $(APPFILES) $(USERPATH)/local.users
39 #load: tmp/load
41 ########################################
42 #
43 # Create a base module package
44 #
45 $(BASE_PKG): tmp/base.mod $(BASE_FC)
46 @echo "Creating $(NAME) base module package"
47 $(QUIET) $(SEMOD_PKG) $@ $^
49 ########################################
50 #
51 # Compile a base module
52 #
53 tmp/base.mod: base.conf
54 @echo "Compiling $(NAME) base module"
55 $(QUIET) $(CHECKMODULE) $^ -o $@
57 ########################################
58 #
59 # Construct a base module policy.conf
60 #
61 base.conf: $(BASE_SECTIONS)
62 @echo "Creating $(NAME) base module policy.conf"
63 # checkpolicy can use the #line directives provided by -s for error reporting:
64 $(QUIET) m4 -D self_contained_policy $(M4PARAM) -s $^ > tmp/$@.tmp
65 $(QUIET) sed -e /^portcon/d -e /^nodecon/d -e /^netifcon/d < tmp/$@.tmp > $@
66 # the ordering of these ocontexts matters:
67 $(QUIET) grep ^portcon tmp/$@.tmp >> $@ || true
68 $(QUIET) grep ^netifcon tmp/$@.tmp >> $@ || true
69 $(QUIET) grep ^nodecon tmp/$@.tmp >> $@ || true
71 tmp/pre_te_files.conf: $(BASE_PRE_TE_FILES)
72 @test -d tmp || mkdir -p tmp
73 $(QUIET) cat $^ > $@
75 tmp/generated_definitions.conf: $(ALL_LAYERS) $(BASE_TE_FILES)
76 @test -d tmp || mkdir -p tmp
77 # define all available object classes
78 $(QUIET) $(GENPERM) $(AVS) $(SECCLASS) > $@
79 # per-userdomain templates
80 $(QUIET) echo "define(\`per_userdomain_templates',\`" >> $@
81 $(QUIET) for i in $(patsubst %.te,%,$(notdir $(ALL_MODULES))); do \
82 echo "ifdef(\`""$$i""_per_userdomain_template',\`""$$i""_per_userdomain_template("'$$*'")')" \
83 >> $@ ;\
84 done
85 $(QUIET) echo "')" >> $@
86 # define foo.te
87 $(QUIET) for i in $(notdir $(BASE_TE_FILES)); do \
88 echo "define(\`$$i')" >> $@ ;\
89 done
90 $(QUIET) $(SETTUN) $(BOOLEANS) >> $@
92 tmp/all_interfaces.conf: $(M4SUPPORT) $(ALL_INTERFACES)
93 ifeq ($(ALL_INTERFACES),)
94 $(error No enabled modules! $(notdir $(MOD_CONF)) may need to be generated by using "make conf")
95 endif
96 @test -d tmp || mkdir -p tmp
97 $(QUIET) m4 $^ | sed -e s/dollarsstar/\$$\*/g > $@
99 tmp/all_te_files.conf: $(BASE_TE_FILES)
100 ifeq ($(BASE_TE_FILES),)
101 $(error No enabled modules! $(notdir $(MOD_CONF)) may need to be generated by using "make conf")
102 endif
103 @test -d tmp || mkdir -p tmp
104 $(QUIET) cat $^ > $@
106 tmp/post_te_files.conf: $(BASE_POST_TE_FILES)
107 @test -d tmp || mkdir -p tmp
108 $(QUIET) cat $^ > $@
110 # extract attributes and put them first. extract post te stuff
111 # like genfscon and put last. portcon, nodecon, and netifcon
112 # is delayed since they are generated by m4
113 tmp/all_attrs_types.conf tmp/only_te_rules.conf tmp/all_post.conf: tmp/all_te_files.conf tmp/post_te_files.conf
114 $(QUIET) grep ^attribute tmp/all_te_files.conf > tmp/all_attrs_types.conf || true
115 $(QUIET) grep '^type ' tmp/all_te_files.conf >> tmp/all_attrs_types.conf
116 $(QUIET) cat tmp/post_te_files.conf > tmp/all_post.conf
117 $(QUIET) grep '^sid ' tmp/all_te_files.conf >> tmp/all_post.conf || true
118 $(QUIET) egrep '^fs_use_(xattr|task|trans)' tmp/all_te_files.conf >> tmp/all_post.conf || true
119 $(QUIET) grep ^genfscon tmp/all_te_files.conf >> tmp/all_post.conf || true
120 $(QUIET) sed -r -e /^attribute/d -e '/^type /d' -e /^genfscon/d \
121 -e '/^sid /d' -e '/^fs_use_(xattr|task|trans)/d' \
122 < tmp/all_te_files.conf > tmp/only_te_rules.conf
124 ########################################
125 #
126 # Construct base module file contexts
127 #
128 $(BASE_FC): $(M4SUPPORT) tmp/generated_definitions.conf $(BASE_FC_FILES) $(FCSORT)
129 ifeq ($(BASE_FC_FILES),)
130 $(error No enabled modules! $(notdir $(MOD_CONF)) may need to be generated by using "make conf")
131 endif
132 @echo "Creating $(NAME) base module file contexts."
133 @test -d tmp || mkdir -p tmp
134 $(QUIET) m4 $(M4PARAM) $(M4SUPPORT) tmp/generated_definitions.conf $(BASE_FC_FILES) > tmp/$@.tmp
135 $(QUIET) grep -e HOME -e ROLE tmp/$@.tmp > $(HOMEDIR_TEMPLATE)
136 $(QUIET) sed -i -e /HOME/d -e /ROLE/d tmp/$@.tmp
137 $(QUIET) $(FCSORT) tmp/$@.tmp $@
139 ########################################
140 #
141 # Build module packages
142 #
143 tmp/%.mod: $(M4SUPPORT) tmp/generated_definitions.conf tmp/all_interfaces.conf %.te
144 @if test -z "$(filter $^,$(MOD_MODS))"; then \
145 echo "The $(notdir $(basename $@)) module is not configured to be compiled as a lodable module." ;\
146 false ;\
147 fi
148 @echo "Compliling $(NAME) $(@F) module"
149 $(QUIET) m4 $(M4PARAM) -s $^ > $(@:.mod=.tmp)
150 $(QUIET) $(CHECKMODULE) -m $(@:.mod=.tmp) -o $@
152 %.pp: tmp/%.mod %.fc
153 @echo "Creating $(NAME) $(@F) policy package"
154 $(QUIET) $(SEMOD_PKG) $@ $^
156 ########################################
157 #
158 # Clean the sources
159 #
160 clean:
161 rm -fR tmp
162 rm -f base.conf
163 rm -f *.pp
164 rm -f $(BASE_FC)
166 .PHONY: default base modules clean