author | chunhan |
Tue, 09 Jul 2013 14:43:51 +0800 | |
changeset 27 | fc749f19b894 |
parent 26 | b6333712cb02 |
child 28 | e298d755bc35 |
permissions | -rw-r--r-- |
19 | 1 |
(*<*) |
18 | 2 |
theory Current_prop |
3 |
imports Main Flask_type Flask My_list_prefix Init_prop Valid_prop Delete_prop |
|
4 |
begin |
|
19 | 5 |
(*>*) |
18 | 6 |
|
7 |
context flask begin |
|
8 |
||
9 |
lemma procs_of_shm_prop1: "\<lbrakk> p_flag \<in> procs_of_shm s h; valid s\<rbrakk> \<Longrightarrow> h \<in> current_shms s" |
|
10 |
apply (induct s arbitrary:p_flag) |
|
11 |
apply (case_tac p_flag, simp, drule init_procs_has_shm, simp) |
|
12 |
apply (frule vd_cons, frule vt_grant_os) |
|
13 |
apply (case_tac a, auto split:if_splits option.splits) |
|
14 |
done |
|
15 |
||
16 |
lemma procs_of_shm_prop2: "\<lbrakk>(p, flag) \<in> procs_of_shm s h; valid s\<rbrakk> \<Longrightarrow> p \<in> current_procs s" |
|
17 |
apply (induct s arbitrary:p flag) |
|
18 |
apply (simp, drule init_procs_has_shm, simp) |
|
19 |
apply (frule vd_cons, frule vt_grant_os) |
|
20 |
apply (case_tac a, auto split:if_splits option.splits) |
|
21 |
done |
|
22 |
||
26 | 23 |
lemma procs_of_shm_prop2': |
24 |
"\<lbrakk>p \<notin> current_procs s; valid s\<rbrakk> \<Longrightarrow> \<forall> flag h. (p, flag) \<notin> procs_of_shm s h" |
|
25 |
by (auto dest:procs_of_shm_prop2) |
|
26 |
||
18 | 27 |
lemma procs_of_shm_prop3: "\<lbrakk>(p, flag) \<in> procs_of_shm s h; (p, flag') \<in> procs_of_shm s h; valid s\<rbrakk> |
28 |
\<Longrightarrow> flag = flag'" |
|
29 |
apply (induct s arbitrary:p flag flag') |
|
30 |
apply (simp, drule_tac flag = flag in init_procs_has_shm, drule_tac flag = flag' in init_procs_has_shm, simp) |
|
31 |
apply (frule vd_cons, frule vt_grant_os) |
|
32 |
apply (case_tac a, auto split:if_splits option.splits dest:procs_of_shm_prop2) |
|
33 |
done |
|
34 |
||
35 |
lemma procs_of_shm_prop4: "\<lbrakk>(p, flag) \<in> procs_of_shm s h; valid s\<rbrakk> \<Longrightarrow> flag_of_proc_shm s p h = Some flag" |
|
36 |
apply (induct s arbitrary:p flag) |
|
37 |
apply (simp, drule init_procs_has_shm, simp) |
|
38 |
apply (frule vd_cons, frule vt_grant_os) |
|
39 |
apply (case_tac a, auto split:if_splits option.splits dest:procs_of_shm_prop2) |
|
40 |
done |
|
41 |
||
42 |
lemma procs_of_shm_prop4': |
|
43 |
"\<lbrakk>flag_of_proc_shm s p h = None; valid s\<rbrakk> \<Longrightarrow> \<forall> flag. (p, flag) \<notin> procs_of_shm s h" |
|
44 |
by (auto dest:procs_of_shm_prop4) |
|
45 |
||
46 |
lemma not_init_intro_proc: |
|
47 |
"\<lbrakk>p \<notin> current_procs s; valid s\<rbrakk> \<Longrightarrow> deleted (O_proc p) s \<or> p \<notin> init_procs" |
|
48 |
using not_deleted_init_proc by auto |
|
49 |
||
50 |
lemma not_init_intro_proc': |
|
51 |
"\<lbrakk>p \<notin> current_procs s; valid s\<rbrakk> \<Longrightarrow> \<not> (\<not> deleted (O_proc p) s \<and> p \<in> init_procs)" |
|
52 |
using not_deleted_init_proc by auto |
|
53 |
||
23
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
19
diff
changeset
|
54 |
lemma info_shm_flow_in_procs: |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
19
diff
changeset
|
55 |
"\<lbrakk>info_flow_shm s p p'; valid s\<rbrakk> \<Longrightarrow> p \<in> current_procs s \<and> p' \<in> current_procs s" |
26 | 56 |
by (auto intro:procs_of_shm_prop2 simp:info_flow_shm_def one_flow_shm_def) |
25
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
57 |
|
27 | 58 |
lemma flag_of_proc_shm_prop1: |
59 |
"\<lbrakk>flag_of_proc_shm s p h = Some flag; valid s\<rbrakk> \<Longrightarrow> (p, flag) \<in> procs_of_shm s h" |
|
60 |
apply (induct s arbitrary:p flag) |
|
61 |
apply (simp, drule init_shmflag_has_proc, simp) |
|
62 |
apply (frule vd_cons, frule vt_grant_os) |
|
63 |
apply (case_tac a, auto split:if_splits option.splits dest:procs_of_shm_prop2) |
|
64 |
done |
|
65 |
||
66 |
(*********** simpset for one_flow_shm **************) |
|
67 |
||
68 |
lemma one_flow_not_self: |
|
69 |
"one_flow_shm s h p p \<Longrightarrow> False" |
|
70 |
by (simp add:one_flow_shm_def) |
|
71 |
||
72 |
lemma one_flow_shm_attach: |
|
73 |
"valid (Attach p h flag # s) \<Longrightarrow> one_flow_shm (Attach p h flag # s) = (\<lambda> h' pa pb. |
|
74 |
if (h' = h) |
|
75 |
then (pa = p \<and> pb \<noteq> p \<and> flag = SHM_RDWR \<and> (\<exists> flagb. (pb, flagb) \<in> procs_of_shm s h)) \<or> |
|
76 |
(pb = p \<and> pa \<noteq> p \<and> (pa, SHM_RDWR) \<in> procs_of_shm s h) \<or> |
|
77 |
(one_flow_shm s h pa pb) |
|
78 |
else one_flow_shm s h' pa pb )" |
|
79 |
apply (rule ext, rule ext, rule ext, frule vd_cons, frule vt_grant_os) |
|
80 |
by (auto simp add: one_flow_shm_def) |
|
81 |
||
82 |
lemma one_flow_shm_detach: |
|
83 |
"valid (Detach p h # s) \<Longrightarrow> one_flow_shm (Detach p h # s) = (\<lambda> h' pa pb. |
|
84 |
if (h' = h) |
|
85 |
then (pa \<noteq> p \<and> pb \<noteq> p \<and> one_flow_shm s h' pa pb) |
|
86 |
else one_flow_shm s h' pa pb)" |
|
87 |
apply (rule ext, rule ext, rule ext, frule vt_grant_os) |
|
88 |
by (auto simp:one_flow_shm_def) |
|
89 |
||
90 |
lemma one_flow_shm_deleteshm: |
|
91 |
"valid (DeleteShM p h # s) \<Longrightarrow> one_flow_shm (DeleteShM p h # s) = (\<lambda> h' pa pb. |
|
92 |
if (h' = h) |
|
93 |
then False |
|
94 |
else one_flow_shm s h' pa pb)" |
|
95 |
apply (rule ext, rule ext, rule ext, frule vt_grant_os) |
|
96 |
by (auto simp: one_flow_shm_def) |
|
97 |
||
98 |
lemma one_flow_shm_clone: |
|
99 |
"valid (Clone p p' fds shms # s) \<Longrightarrow> one_flow_shm (Clone p p' fds shms # s) = (\<lambda> h pa pb. |
|
100 |
if (pa = p' \<and> pb \<noteq> p' \<and> h \<in> shms) |
|
101 |
then (if (pb = p) then (flag_of_proc_shm s p h = Some SHM_RDWR) else one_flow_shm s h p pb) |
|
102 |
else if (pb = p' \<and> pa \<noteq> p' \<and> h \<in> shms) |
|
103 |
then (if (pa = p) then (flag_of_proc_shm s p h = Some SHM_RDWR) else one_flow_shm s h pa p) |
|
104 |
else one_flow_shm s h pa pb)" |
|
105 |
apply (rule ext, rule ext, rule ext, frule vt_grant_os, frule vd_cons, clarsimp) |
|
106 |
apply (frule_tac p = p' in procs_of_shm_prop2', simp) |
|
107 |
apply (auto simp:one_flow_shm_def intro:procs_of_shm_prop4 flag_of_proc_shm_prop1) |
|
108 |
done |
|
109 |
||
110 |
lemma one_flow_shm_execve: |
|
111 |
"valid (Execve p f fds # s) \<Longrightarrow> one_flow_shm (Execve p f fds # s) = (\<lambda> h pa pb. |
|
112 |
pa \<noteq> p \<and> pb \<noteq> p \<and> one_flow_shm s h pa pb )" |
|
113 |
apply (rule ext, rule ext, rule ext, frule vt_grant_os, frule vd_cons) |
|
114 |
by (auto simp:one_flow_shm_def) |
|
115 |
||
116 |
lemma one_flow_shm_kill: |
|
117 |
"valid (Kill p p' # s) \<Longrightarrow> one_flow_shm (Kill p p' # s) = (\<lambda> h pa pb. |
|
118 |
pa \<noteq> p' \<and> pb \<noteq> p' \<and> one_flow_shm s h pa pb )" |
|
119 |
apply (rule ext, rule ext, rule ext, frule vt_grant_os, frule vd_cons) |
|
120 |
by (auto simp:one_flow_shm_def) |
|
121 |
||
122 |
lemma one_flow_shm_exit: |
|
123 |
"valid (Exit p # s) \<Longrightarrow> one_flow_shm (Exit p # s) = (\<lambda> h pa pb. |
|
124 |
pa \<noteq> p \<and> pb \<noteq> p \<and> one_flow_shm s h pa pb )" |
|
125 |
apply (rule ext, rule ext, rule ext, frule vt_grant_os, frule vd_cons) |
|
126 |
by (auto simp:one_flow_shm_def) |
|
127 |
||
128 |
lemma one_flow_shm_other: |
|
129 |
"\<lbrakk>valid (e # s); |
|
130 |
\<forall> p h flag. e \<noteq> Attach p h flag; |
|
131 |
\<forall> p h. e \<noteq> Detach p h; |
|
132 |
\<forall> p h. e \<noteq> DeleteShM p h; |
|
133 |
\<forall> p p' fds shms. e \<noteq> Clone p p' fds shms; |
|
134 |
\<forall> p f fds. e \<noteq> Execve p f fds; |
|
135 |
\<forall> p p'. e \<noteq> Kill p p'; |
|
136 |
\<forall> p. e \<noteq> Exit p |
|
137 |
\<rbrakk> \<Longrightarrow> one_flow_shm (e # s) = one_flow_shm s" |
|
138 |
apply (rule ext, rule ext, rule ext, frule vt_grant_os, frule vd_cons) |
|
139 |
apply (case_tac e, auto simp:one_flow_shm_def dest:procs_of_shm_prop2) |
|
140 |
apply (drule procs_of_shm_prop1, auto) |
|
141 |
done |
|
142 |
||
143 |
lemmas one_flow_shm_simps = one_flow_shm_other one_flow_shm_attach one_flow_shm_detach one_flow_shm_deleteshm |
|
144 |
one_flow_shm_clone one_flow_shm_execve one_flow_shm_kill one_flow_shm_exit |
|
145 |
||
146 |
||
147 |
inductive Info_flow_shm :: "t_state \<Rightarrow> t_process \<Rightarrow> t_process \<Rightarrow> bool" |
|
148 |
where |
|
149 |
ifs_self: "p \<in> current_procs s \<Longrightarrow> Info_flow_shm s p p" |
|
150 |
| ifs_flow:"\<lbrakk>Info_flow_shm s p p'; one_flow_shm s h p' p''\<rbrakk> \<Longrightarrow> Info_flow_shm s p p''" |
|
151 |
||
152 |
lemma Info_flow_trans_aux: |
|
153 |
"Info_flow_shm s p' p'' \<Longrightarrow> \<forall>p. Info_flow_shm s p p' \<longrightarrow> Info_flow_shm s p p''" |
|
154 |
apply (erule Info_flow_shm.induct) |
|
155 |
by (auto intro:Info_flow_shm.intros) |
|
156 |
||
157 |
lemma Info_flow_trans: |
|
158 |
"\<lbrakk>Info_flow_shm s p p'; Info_flow_shm s p' p''\<rbrakk> \<Longrightarrow> Info_flow_shm s p p''" |
|
159 |
by (auto dest:Info_flow_trans_aux) |
|
160 |
||
161 |
lemma one_flow_flows: |
|
162 |
"\<lbrakk>one_flow_shm s h p p'; valid s\<rbrakk> \<Longrightarrow> Info_flow_shm s p p'" |
|
163 |
apply (rule Info_flow_shm.intros(2), simp_all) |
|
164 |
apply (rule Info_flow_shm.intros(1)) |
|
165 |
apply (auto intro:procs_of_shm_prop2 simp:one_flow_shm_def) |
|
166 |
done |
|
167 |
||
168 |
lemma ifs_flow': "\<lbrakk>one_flow_shm s h p p'; Info_flow_shm s p' p''; valid s\<rbrakk> \<Longrightarrow> Info_flow_shm s p p''" |
|
169 |
apply (drule one_flow_flows, simp+) |
|
170 |
apply (erule Info_flow_trans, simp+) |
|
171 |
done |
|
172 |
||
173 |
lemma Info_flow_shm_cases1: |
|
174 |
"\<lbrakk>Info_flow_shm s pa pb; |
|
175 |
\<And>p \<tau>. \<lbrakk>\<tau> = s; pa = p; pb = p; p \<in> current_procs \<tau>\<rbrakk> \<Longrightarrow> P; |
|
176 |
\<And>\<tau> p p' h p''. \<lbrakk>\<tau> = s; pa = p; pb = p''; Info_flow_shm \<tau> p p'; one_flow_shm \<tau> h p' p''\<rbrakk> \<Longrightarrow> P\<rbrakk> |
|
177 |
\<Longrightarrow> P" |
|
178 |
by (erule Info_flow_shm.cases, auto) |
|
179 |
||
180 |
||
181 |
lemma Info_flow_shm_prop1: |
|
182 |
"\<not> Info_flow_shm s p p \<Longrightarrow> p \<notin> current_procs s" |
|
183 |
by (rule notI, drule Info_flow_shm.intros(1), simp) |
|
184 |
||
185 |
lemma Info_flow_shm_intro4: |
|
186 |
"\<lbrakk>(p, flagb) \<in> procs_of_shm s h; valid s\<rbrakk> \<Longrightarrow> Info_flow_shm s p p" |
|
187 |
by (drule procs_of_shm_prop2, simp, simp add:Info_flow_shm.intros) |
|
188 |
||
189 |
(********* simpset for inductive Info_flow_shm **********) |
|
25
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
190 |
|
27 | 191 |
lemma Info_flow_shm_attach1: |
192 |
"Info_flow_shm s' pa pb \<Longrightarrow> valid s' \<and> (s' = Attach p h flag # s) \<longrightarrow> |
|
193 |
((Info_flow_shm s pa pb) \<or> |
|
194 |
(\<not> Info_flow_shm s pa pb \<and> pa = p \<and> pb \<noteq> p \<and> flag = SHM_RDWR \<and> |
|
195 |
(\<exists> p' flagb. (p', flagb) \<in> procs_of_shm s h \<and> Info_flow_shm s p' pb)) \<or> |
|
196 |
(\<not> Info_flow_shm s pa pb \<and> pb = p \<and> pa \<noteq> p \<and> |
|
197 |
(\<exists> p'. (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s pa p')))" |
|
198 |
proof (induct rule:Info_flow_shm.induct) |
|
199 |
case (ifs_self proc \<tau>) |
|
200 |
show ?case |
|
201 |
proof (rule impI) |
|
202 |
assume pre: "valid \<tau> \<and> \<tau> = Attach p h flag # s" |
|
203 |
hence p1: "p \<in> current_procs s" and p2: "valid s" by (auto intro:vd_cons dest:vt_grant_os) |
|
204 |
hence p3: "Info_flow_shm s p p" by (auto intro:Info_flow_shm.intros) |
|
205 |
from ifs_self pre have "proc \<in> current_procs s" by simp |
|
206 |
hence p4: "Info_flow_shm s proc proc" by (auto intro:Info_flow_shm.intros) |
|
207 |
show "Info_flow_shm s proc proc \<or> |
|
208 |
(\<not> Info_flow_shm s proc proc \<and> proc = p \<and> proc \<noteq> p \<and> flag = SHM_RDWR \<and> |
|
209 |
(\<exists>p' flagb. (p', flagb) \<in> procs_of_shm s h \<and> Info_flow_shm s p' proc)) \<or> |
|
210 |
(\<not> Info_flow_shm s proc proc \<and> proc = p \<and> proc \<noteq> p \<and> |
|
211 |
(\<exists>p'. (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s proc p'))" |
|
212 |
using p4 p3 by auto |
|
213 |
qed |
|
214 |
next |
|
215 |
case (ifs_flow \<tau> pa pb h' pc) |
|
216 |
thus ?case |
|
217 |
proof (rule_tac impI) |
|
218 |
assume p1:"Info_flow_shm \<tau> pa pb" and p2: "valid \<tau> \<and> (\<tau> = Attach p h flag # s) \<longrightarrow> Info_flow_shm s pa pb \<or> |
|
219 |
\<not> Info_flow_shm s pa pb \<and> pa = p \<and> |
|
220 |
pb \<noteq> p \<and> flag = SHM_RDWR \<and> (\<exists>p' flagb. (p', flagb) \<in> procs_of_shm s h \<and> Info_flow_shm s p' pb) \<or> |
|
221 |
\<not> Info_flow_shm s pa pb \<and> pb = p \<and> pa \<noteq> p \<and> (\<exists>p'. (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s pa p')" |
|
222 |
and p3: "one_flow_shm \<tau> h' pb pc" and p4: "valid \<tau> \<and> \<tau> = Attach p h flag # s" |
|
223 |
from p2 and p4 have p2': "Info_flow_shm s pa pb \<or> |
|
224 |
(\<not> Info_flow_shm s pa pb \<and> pa = p \<and> pb \<noteq> p \<and> flag = SHM_RDWR \<and> |
|
225 |
(\<exists>p' flagb. (p', flagb) \<in> procs_of_shm s h \<and> Info_flow_shm s p' pb)) \<or> |
|
226 |
(\<not> Info_flow_shm s pa pb \<and> pb = p \<and> pa \<noteq> p \<and> |
|
227 |
(\<exists>p'. (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s pa p'))" |
|
228 |
by (erule_tac impE, simp) |
|
229 |
from p4 have p5: "valid s" and p6: "os_grant s (Attach p h flag)" by (auto intro:vd_cons dest:vt_grant_os) |
|
230 |
from p6 have "p \<in> current_procs s" by simp hence p7:"Info_flow_shm s p p" by (erule_tac Info_flow_shm.intros) |
|
231 |
from p3 p4 have p8: "if (h' = h) |
|
232 |
then (pb = p \<and> pc \<noteq> p \<and> flag = SHM_RDWR \<and> (\<exists> flagb. (pc, flagb) \<in> procs_of_shm s h)) \<or> |
|
233 |
(pc = p \<and> pb \<noteq> p \<and> (pb, SHM_RDWR) \<in> procs_of_shm s h) \<or> |
|
234 |
(one_flow_shm s h pb pc) |
|
235 |
else one_flow_shm s h' pb pc " by (auto simp add:one_flow_shm_attach) |
|
236 |
||
237 |
have "\<lbrakk>pa = p; pc = p\<rbrakk> \<Longrightarrow> Info_flow_shm s pa pc " using p7 by simp |
|
238 |
moreover have "\<lbrakk>pa = p; pc \<noteq> p; flag = SHM_RDWR; \<not> Info_flow_shm s pa pc\<rbrakk> |
|
239 |
\<Longrightarrow> \<exists>p' flagb. (p', flagb) \<in> procs_of_shm s h \<and> Info_flow_shm s p' pc" |
|
240 |
sorry |
|
241 |
moreover have "\<lbrakk>pa = p; pc \<noteq> p; flag \<noteq> SHM_RDWR; \<not> Info_flow_shm s pa pc\<rbrakk> |
|
242 |
\<Longrightarrow> Info_flow_shm s pa pc" |
|
243 |
sorry |
|
244 |
moreover have "\<lbrakk>pc = p; pa \<noteq> p; \<not> Info_flow_shm s pa pc\<rbrakk> |
|
245 |
\<Longrightarrow> \<exists>p'. (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s pa p'" |
|
246 |
sorry |
|
247 |
ultimately |
|
248 |
||
249 |
||
250 |
||
251 |
show "Info_flow_shm s pa pc \<or> |
|
252 |
(\<not> Info_flow_shm s pa pc \<and> pa = p \<and> pc \<noteq> p \<and> flag = SHM_RDWR \<and> |
|
253 |
(\<exists>p' flagb. (p', flagb) \<in> procs_of_shm s h \<and> Info_flow_shm s p' pc)) \<or> |
|
254 |
(\<not> Info_flow_shm s pa pc \<and> pc = p \<and> pa \<noteq> p \<and> |
|
255 |
(\<exists>p'. (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s pa p'))" |
|
256 |
apply auto |
|
257 |
sorry |
|
258 |
qed |
|
259 |
qed |
|
260 |
||
261 |
lemma Info_flow_shm_intro3: |
|
262 |
"\<lbrakk>Info_flow_shm s p from; (from, SHM_RDWR) \<in> procs_of_shm s h; (to, flag) \<in> procs_of_shm s h\<rbrakk> |
|
263 |
\<Longrightarrow> Info_flow_shm s p to" |
|
264 |
apply (case_tac "from = to", simp) |
|
265 |
apply (erule_tac h = h in Info_flow_shm.intros(2), simp add:one_flow_shm_def) |
|
266 |
by (rule_tac x = flag in exI, simp) |
|
267 |
||
268 |
lemma Info_flow_shm_attach1: |
|
269 |
"Info_flow_shm s' pa pb \<Longrightarrow> valid s' \<and> (s' = Attach p h flag # s) \<longrightarrow> |
|
270 |
(if Info_flow_shm s pa pb then True else |
|
271 |
(if (pa = p \<and> flag = SHM_RDWR) |
|
272 |
then (\<exists> p' flagb. (p', flagb) \<in> procs_of_shm s h \<and> Info_flow_shm s p' pb) |
|
273 |
else if (pb = p) |
|
274 |
then (\<exists> p'. (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s pa p') |
|
275 |
else (\<exists> p' flag'. Info_flow_shm s pa p \<and> flag = SHM_RDWR \<and> (p', flag') \<in> procs_of_shm s h \<and> |
|
276 |
Info_flow_shm s p' pb) \<or> |
|
277 |
(\<exists> p'. Info_flow_shm s pa p' \<and> (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s p pb) |
|
278 |
) )" |
|
279 |
proof (induct rule:Info_flow_shm.induct) |
|
280 |
case (ifs_self proc \<tau>) |
|
281 |
show ?case |
|
282 |
proof (rule impI) |
|
283 |
assume pre: "valid \<tau> \<and> \<tau> = Attach p h flag # s" |
|
284 |
hence p1: "p \<in> current_procs s" and p2: "valid s" by (auto intro:vd_cons dest:vt_grant_os) |
|
285 |
hence p3: "Info_flow_shm s p p" by (auto intro:Info_flow_shm.intros) |
|
286 |
from ifs_self pre have "proc \<in> current_procs s" by simp |
|
287 |
hence p4: "Info_flow_shm s proc proc" by (auto intro:Info_flow_shm.intros) |
|
288 |
show "if Info_flow_shm s proc proc then True |
|
289 |
else if proc = p \<and> flag = SHM_RDWR then \<exists>p' flagb. (p', flagb) \<in> procs_of_shm s h \<and> Info_flow_shm s p' proc |
|
290 |
else if proc = p then \<exists>p'. (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s proc p' |
|
291 |
else (\<exists>p' flag'. Info_flow_shm s proc p \<and> |
|
292 |
flag = SHM_RDWR \<and> (p', flag') \<in> procs_of_shm s h \<and> Info_flow_shm s p' proc) \<or> |
|
293 |
(\<exists>p'. Info_flow_shm s proc p' \<and> (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s p proc)" using p4 p3 by auto |
|
294 |
qed |
|
295 |
next |
|
296 |
case (ifs_flow \<tau> pa pb h' pc) |
|
297 |
thus ?case |
|
298 |
proof (rule_tac impI) |
|
299 |
assume p1:"Info_flow_shm \<tau> pa pb" and p2: "valid \<tau> \<and> \<tau> = Attach p h flag # s \<longrightarrow> |
|
300 |
(if Info_flow_shm s pa pb then True |
|
301 |
else if pa = p \<and> flag = SHM_RDWR then \<exists>p' flagb. (p', flagb) \<in> procs_of_shm s h \<and> Info_flow_shm s p' pb |
|
302 |
else if pb = p then \<exists>p'. (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s pa p' |
|
303 |
else (\<exists>p' flag'. Info_flow_shm s pa p \<and> |
|
304 |
flag = SHM_RDWR \<and> (p', flag') \<in> procs_of_shm s h \<and> Info_flow_shm s p' pb) \<or> |
|
305 |
(\<exists>p'. Info_flow_shm s pa p' \<and> (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s p pb))" |
|
306 |
and p3: "one_flow_shm \<tau> h' pb pc" and p4: "valid \<tau> \<and> \<tau> = Attach p h flag # s" |
|
307 |
||
308 |
from p2 and p4 have p2': "(if Info_flow_shm s pa pb then True |
|
309 |
else if pa = p \<and> flag = SHM_RDWR then \<exists>p' flagb. (p', flagb) \<in> procs_of_shm s h \<and> Info_flow_shm s p' pb |
|
310 |
else if pb = p then \<exists>p'. (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s pa p' |
|
311 |
else (\<exists>p' flag'. Info_flow_shm s pa p \<and> |
|
312 |
flag = SHM_RDWR \<and> (p', flag') \<in> procs_of_shm s h \<and> Info_flow_shm s p' pb) \<or> |
|
313 |
(\<exists>p'. Info_flow_shm s pa p' \<and> (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s p pb))" |
|
314 |
by (erule_tac impE, simp) |
|
315 |
from p4 have p5: "valid s" and p6: "os_grant s (Attach p h flag)" by (auto intro:vd_cons dest:vt_grant_os) |
|
316 |
from p6 have "p \<in> current_procs s" by simp hence p7:"Info_flow_shm s p p" by (erule_tac Info_flow_shm.intros) |
|
317 |
from p3 p4 have p8: "if (h' = h) |
|
318 |
then (pb = p \<and> pc \<noteq> p \<and> flag = SHM_RDWR \<and> (\<exists> flagb. (pc, flagb) \<in> procs_of_shm s h)) \<or> |
|
319 |
(pc = p \<and> pb \<noteq> p \<and> (pb, SHM_RDWR) \<in> procs_of_shm s h) \<or> |
|
320 |
(one_flow_shm s h pb pc) |
|
321 |
else one_flow_shm s h' pb pc " by (auto simp add:one_flow_shm_attach) |
|
322 |
||
323 |
have "\<And> flagb. (pc, flagb) \<in> procs_of_shm s h |
|
324 |
\<Longrightarrow> \<exists> p' flagb. (p', flagb) \<in> procs_of_shm s h \<and> Info_flow_shm s p' pc" |
|
325 |
apply (rule_tac x= pc in exI, rule_tac x = flagb in exI, frule procs_of_shm_prop2) |
|
326 |
by (simp add:p5, simp add:Info_flow_shm.intros(1)) |
|
327 |
hence p10: "\<not> Info_flow_shm s p pc \<Longrightarrow> (\<exists>p' flagb. (p', flagb) \<in> procs_of_shm s h \<and> Info_flow_shm s p' pc) \<or> |
|
328 |
Info_flow_shm s pa pc" |
|
329 |
using p2' p7 p8 p5 |
|
330 |
by (auto split:if_splits dest:Info_flow_shm.intros(2)) |
|
331 |
(* apply (rule_tac x = pb in exI, simp add:one_flow_flows, rule_tac x = flagb in exI, simp)+ *) |
|
332 |
moreover have "pc = p \<Longrightarrow> (\<exists> p'. (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s pa p') |
|
333 |
\<or> Info_flow_shm s pa pc" |
|
334 |
using p2' p7 p8 p5 |
|
335 |
by (auto split:if_splits intro:Info_flow_shm_intro3 simp:one_flow_shm_def) |
|
336 |
moreover have "\<lbrakk>pc \<noteq> p; pa \<noteq> p \<or> flag \<noteq> SHM_RDWR\<rbrakk> \<Longrightarrow> (\<exists>p' flag'. Info_flow_shm s pa p \<and> |
|
337 |
flag = SHM_RDWR \<and> (p', flag') \<in> procs_of_shm s h \<and> Info_flow_shm s p' pc) \<or> |
|
338 |
(\<exists>p'. Info_flow_shm s pa p' \<and> (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s p pc) \<or> |
|
339 |
Info_flow_shm s pa pc" |
|
340 |
using p2' p7 p8 p5 |
|
341 |
apply (auto split:if_splits intro:Info_flow_shm_intro3 simp:one_flow_shm_def) |
|
342 |
apply (rule_tac x = pc in exI, simp add:Info_flow_shm_intro4) |
|
343 |
apply (rule_tac x = flagb in exI, simp) |
|
344 |
done |
|
345 |
ultimately show "if Info_flow_shm s pa pc then True |
|
346 |
else if pa = p \<and> flag = SHM_RDWR then \<exists>p' flagb. (p', flagb) \<in> procs_of_shm s h \<and> Info_flow_shm s p' pc |
|
347 |
else if pc = p then \<exists>p'. (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s pa p' |
|
348 |
else (\<exists>p' flag'. Info_flow_shm s pa p \<and> |
|
349 |
flag = SHM_RDWR \<and> (p', flag') \<in> procs_of_shm s h \<and> Info_flow_shm s p' pc) \<or> |
|
350 |
(\<exists>p'. Info_flow_shm s pa p' \<and> (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s p pc)" |
|
351 |
using p7 by auto |
|
352 |
qed |
|
353 |
qed |
|
354 |
||
355 |
||
356 |
||
357 |
||
358 |
||
359 |
||
360 |
||
361 |
||
362 |
||
363 |
||
364 |
lemma Info_flow_shm_attach: |
|
365 |
"valid (Attach p h flag # s) \<Longrightarrow> Info_flow_shm (Attach p h flag # s) = (\<lambda> pa pb. |
|
366 |
(Info_flow_shm s pa pb) \<or> |
|
367 |
(pa = p \<and> flag = SHM_RDWR \<and> (\<exists> flagb. (p', flagb) \<in> procs_of_shm s h \<and> Info_flow_shm s p' pb)) \<or> |
|
368 |
(pb = p \<and> (\<exists> p'. (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s p' pa)) )" |
|
369 |
apply (rule ext, rule ext, rule iffI) |
|
370 |
apply (case_tac "Info_flow_shm s pa pb", simp) |
|
371 |
apply (case_tac "pa = p \<and> flag = SHM_RDWR \<and> (\<exists>flagb. (p', flagb) \<in> procs_of_shm s h \<and> Info_flow_shm s p' pb)", simp) |
|
372 |
||
373 |
apply (erule Info_flow_shm_cases1, simp, drule_tac p = pc in Info_flow_shm.intros(1), simp) |
|
374 |
apply (simp add:one_flow_shm_simps split:if_splits, erule disjE, simp) |
|
375 |
||
376 |
||
377 |
||
378 |
apply (simp split:if_splits, (rule impI|rule allI|rule conjI|erule conjE|erule exE)+, simp) |
|
379 |
apply (simp) |
|
380 |
apply (simp, erule Info_flow_shm_cases', simp, simp) |
|
381 |
apply (rule_tac x = |
|
382 |
apply (auto dest:Info_flow_shm.cases) |
|
383 |
apply (auto simp add:one_flow_shm_simps) |
|
26 | 384 |
|
385 |
lemma info_flow_shm_detach: |
|
386 |
"valid (Detach p h # s) \<Longrightarrow> info_flow_shm (Detach p h # s) = (\<lambda> pa pb. |
|
387 |
self_shm s pa pb \<or> ((p = pa \<or> p = pb) \<and> (\<exists> h'. h' \<noteq> h \<and> one_flow_shm s h' pa pb)) \<or> |
|
388 |
(pa \<noteq> p \<and> pb \<noteq> p \<and> info_flow_shm s pa pb) )" |
|
389 |
apply (rule ext, rule ext, frule vt_grant_os) |
|
390 |
by (auto simp:info_flow_shm_def one_flow_shm_def) |
|
391 |
||
392 |
lemma info_flow_shm_deleteshm: |
|
393 |
"valid (DeleteShM p h # s) \<Longrightarrow> info_flow_shm (DeleteShM p h # s) = (\<lambda> pa pb. |
|
394 |
self_shm s pa pb \<or> (\<exists> h'. h' \<noteq> h \<and> one_flow_shm s h' pa pb) )" |
|
395 |
apply (rule ext, rule ext, frule vt_grant_os) |
|
396 |
by (auto simp:info_flow_shm_def one_flow_shm_def) |
|
397 |
||
398 |
lemma info_flow_shm_clone: |
|
399 |
"valid (Clone p p' fds shms # s) \<Longrightarrow> info_flow_shm (Clone p p' fds shms # s) = (\<lambda> pa pb. |
|
400 |
(pa = p' \<and> pb = p') \<or> (pa = p' \<and> pb \<noteq> p' \<and> (\<exists> h \<in> shms. one_flow_shm s h p pb)) \<or> |
|
401 |
(pb = p' \<and> pa \<noteq> p' \<and> (\<exists> h \<in> shms. one_flow_shm s h pa p)) \<or> |
|
402 |
(pa \<noteq> p' \<and> pb \<noteq> p' \<and> info_flow_shm s pa pb))" |
|
403 |
apply (rule ext, rule ext, frule vt_grant_os, frule vd_cons, clarsimp) |
|
404 |
apply (frule_tac p = p' in procs_of_shm_prop2', simp) |
|
405 |
apply (auto simp:info_flow_shm_def one_flow_shm_def) |
|
406 |
done |
|
407 |
||
408 |
lemma info_flow_shm_execve: |
|
409 |
"valid (Execve p f fds # s) \<Longrightarrow> info_flow_shm (Execve p f fds # s) = (\<lambda> pa pb. |
|
410 |
(pa = p \<and> pb = p) \<or> (pa \<noteq> p \<and> pb \<noteq> p \<and> info_flow_shm s pa pb) )" |
|
411 |
apply (rule ext, rule ext, frule vt_grant_os, frule vd_cons) |
|
412 |
by (auto simp:info_flow_shm_def one_flow_shm_def) |
|
413 |
||
414 |
lemma info_flow_shm_kill: |
|
415 |
"valid (Kill p p' # s) \<Longrightarrow> info_flow_shm (Kill p p' # s) = (\<lambda> pa pb. |
|
416 |
pa \<noteq> p' \<and> pb \<noteq> p' \<and> info_flow_shm s pa pb )" |
|
417 |
apply (rule ext, rule ext, frule vt_grant_os, frule vd_cons) |
|
418 |
by (auto simp:info_flow_shm_def one_flow_shm_def) |
|
419 |
||
420 |
lemma info_flow_shm_exit: |
|
421 |
"valid (Exit p # s) \<Longrightarrow> info_flow_shm (Exit p # s) = (\<lambda> pa pb. |
|
422 |
pa \<noteq> p \<and> pb \<noteq> p \<and> info_flow_shm s pa pb )" |
|
423 |
apply (rule ext, rule ext, frule vt_grant_os, frule vd_cons) |
|
424 |
by (auto simp:info_flow_shm_def one_flow_shm_def) |
|
425 |
||
426 |
lemma info_flow_shm_other: |
|
427 |
"\<lbrakk>valid (e # s); |
|
428 |
\<forall> p h flag. e \<noteq> Attach p h flag; |
|
429 |
\<forall> p h. e \<noteq> Detach p h; |
|
430 |
\<forall> p h. e \<noteq> DeleteShM p h; |
|
431 |
\<forall> p p' fds shms. e \<noteq> Clone p p' fds shms; |
|
432 |
\<forall> p f fds. e \<noteq> Execve p f fds; |
|
433 |
\<forall> p p'. e \<noteq> Kill p p'; |
|
434 |
\<forall> p. e \<noteq> Exit p |
|
435 |
\<rbrakk> \<Longrightarrow> info_flow_shm (e # s) = info_flow_shm s" |
|
436 |
apply (rule ext, rule ext, frule vt_grant_os, frule vd_cons) |
|
437 |
apply (case_tac e, auto simp:info_flow_shm_def one_flow_shm_def dest:procs_of_shm_prop2) |
|
438 |
apply (erule_tac x = h in allE, simp) |
|
439 |
apply (drule procs_of_shm_prop1, auto) |
|
440 |
done |
|
441 |
||
442 |
||
443 |
(* |
|
25
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
444 |
lemma info_flow_shm_prop1: |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
445 |
"\<lbrakk>info_flow_shm s p p'; p \<noteq> p'; valid s\<rbrakk> |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
446 |
\<Longrightarrow> \<exists> h h' flag. (p, SHM_RDWR) \<in> procs_of_shm s h \<and> (p', flag) \<in> procs_of_shm s h'" |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
447 |
by (induct rule: info_flow_shm.induct, auto) |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
448 |
|
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
449 |
lemma info_flow_shm_cases: |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
450 |
"\<lbrakk>info_flow_shm \<tau> pa pb; \<And>p s. \<lbrakk>s = \<tau> ; pa = p; pb = p; p \<in> current_procs s\<rbrakk> \<Longrightarrow> P; |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
451 |
\<And>s p p' h p'' flag. \<lbrakk>s = \<tau>; pa = p; pb = p''; info_flow_shm s p p'; (p', SHM_RDWR) \<in> procs_of_shm s h; |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
452 |
(p'', flag) \<in> procs_of_shm s h\<rbrakk>\<Longrightarrow> P\<rbrakk> |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
453 |
\<Longrightarrow> P" |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
454 |
by (erule info_flow_shm.cases, auto) |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
455 |
|
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
456 |
definition one_flow_shm :: "t_state \<Rightarrow> t_process \<Rightarrow> t_process \<Rightarrow> bool" |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
457 |
where |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
458 |
"one_flow_shm s p p' \<equiv> p \<noteq> p' \<and> (\<exists> h flag. (p, SHM_RDWR) \<in> procs_of_shm s h \<and> (p', flag) \<in> procs_of_shm s h)" |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
459 |
|
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
460 |
inductive flows_shm :: "t_state \<Rightarrow> t_process \<Rightarrow> t_process \<Rightarrow> bool" |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
461 |
where |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
462 |
"p \<in> current_procs s \<Longrightarrow> flows_shm s p p" |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
463 |
| "\<lbrakk>flows_shm s p p'; one_flow_shm s p' p''\<rbrakk> \<Longrightarrow> flows_shm s p p''" |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
464 |
|
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
465 |
definition attached_procs :: "t_state \<Rightarrow> t_shm \<Rightarrow> t_process set" |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
466 |
where |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
467 |
"attached_procs s h \<equiv> {p. \<exists> flag. (p, flag) \<in> procs_of_shm s h}" |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
468 |
|
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
469 |
definition flowed_procs:: "t_state \<Rightarrow> t_shm \<Rightarrow> t_process set" |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
470 |
where |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
471 |
"flowed_procs s h \<equiv> {p'. \<exists> p \<in> attached_procs s h. flows_shm s p p'}" |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
472 |
|
26 | 473 |
inductive flowed_shm:: "t_state \<Rightarrow> t_process \<Rightarrow> t_shm set" |
474 |
||
25
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
475 |
fun Info_flow_shm :: "t_state \<Rightarrow> t_process \<Rightarrow> t_process set" |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
476 |
where |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
477 |
"Info_flow_shm [] = (\<lambda> p. {p'. flows_shm [] p p'})" |
26 | 478 |
| "Info_flow_shm (Attach p h flag # s) = (\<lambda> p'. |
479 |
if (p' = p) then flowed_procs s h |
|
480 |
else if () |
|
481 |
" |
|
25
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
482 |
|
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
483 |
|
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
484 |
lemma info_flow_shm_attach: |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
485 |
"valid (Attach p h flag # s) \<Longrightarrow> info_flow_shm (Attach p h flag # s) = (\<lambda> pa pb. (info_flow_shm s pa pb) \<or> |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
486 |
(if (pa = p) |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
487 |
then (if (flag = SHM_RDWR) |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
488 |
then (\<exists> flag. (pb, flag) \<in> procs_of_shm s h) |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
489 |
else (pb = p)) |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
490 |
else (if (pb = p) |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
491 |
then (pa, SHM_RDWR) \<in> procs_of_shm s h |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
492 |
else info_flow_shm s pa pb)) )" |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
493 |
apply (frule vd_cons, frule vt_grant_os, rule ext, rule ext) |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
494 |
apply (case_tac "info_flow_shm s pa pb", simp) |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
495 |
|
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
496 |
thm info_flow_shm.cases |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
497 |
apply (auto split:if_splits intro:info_flow_shm.intros elim:info_flow_shm_cases) |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
498 |
apply (erule info_flow_shm_cases, simp, simp split:if_splits) |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
499 |
apply (rule_tac p = pa and p' = p' in info_flow_shm.intros(2), simp+) |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
500 |
apply (rule notI, erule info_flow_shm.cases, simp+) |
259a50be4381
wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents:
23
diff
changeset
|
501 |
pr 5 |
26 | 502 |
*) |
503 |
lemmas info_flow_shm_simps = info_flow_shm_other info_flow_shm_attach info_flow_shm_detach info_flow_shm_deleteshm |
|
504 |
info_flow_shm_clone info_flow_shm_execve info_flow_shm_kill info_flow_shm_exit |
|
23
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
19
diff
changeset
|
505 |
|
19 | 506 |
lemma has_same_inode_in_current: |
507 |
"\<lbrakk>has_same_inode s f f'; valid s\<rbrakk> \<Longrightarrow> f \<in> current_files s \<and> f' \<in> current_files s" |
|
508 |
by (auto simp add:has_same_inode_def current_files_def) |
|
509 |
||
510 |
lemma has_same_inode_prop1: |
|
511 |
"\<lbrakk>has_same_inode s f f'; is_file s f; valid s\<rbrakk> \<Longrightarrow> is_file s f'" |
|
512 |
by (auto simp:has_same_inode_def is_file_def) |
|
513 |
||
514 |
lemma has_same_inode_prop1': |
|
515 |
"\<lbrakk>has_same_inode s f f'; is_file s f'; valid s\<rbrakk> \<Longrightarrow> is_file s f" |
|
516 |
by (auto simp:has_same_inode_def is_file_def) |
|
517 |
||
518 |
lemma has_same_inode_prop2: |
|
519 |
"\<lbrakk>has_same_inode s f f'; file_of_proc_fd s p fd = Some f; valid s\<rbrakk> \<Longrightarrow> is_file s f'" |
|
520 |
apply (drule has_same_inode_prop1) |
|
521 |
apply (simp add:file_of_pfd_is_file, simp+) |
|
522 |
done |
|
523 |
||
524 |
lemma has_same_inode_prop2': |
|
525 |
"\<lbrakk>has_same_inode s f f'; file_of_proc_fd s p fd = Some f'; valid s\<rbrakk> \<Longrightarrow> is_file s f" |
|
526 |
apply (drule has_same_inode_prop1') |
|
527 |
apply (simp add:file_of_pfd_is_file, simp+) |
|
528 |
done |
|
529 |
||
530 |
lemma tobj_in_init_alive: |
|
531 |
"tobj_in_init obj \<Longrightarrow> init_alive obj" |
|
532 |
by (case_tac obj, auto) |
|
533 |
||
534 |
lemma tobj_in_alive: |
|
535 |
"tobj_in_init obj \<Longrightarrow> alive [] obj" |
|
536 |
by (case_tac obj, auto simp:is_file_nil) |
|
537 |
||
18 | 538 |
end |
539 |
||
540 |
end |