author | chunhan |
Thu, 11 Jul 2013 07:52:06 +0800 | |
changeset 28 | e298d755bc35 |
parent 27 | fc749f19b894 |
child 29 | 622516c0fe34 |
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 |
lemma Info_flow_shm_prop1: |
|
181 |
"\<not> Info_flow_shm s p p \<Longrightarrow> p \<notin> current_procs s" |
|
182 |
by (rule notI, drule Info_flow_shm.intros(1), simp) |
|
183 |
||
184 |
lemma Info_flow_shm_intro3: |
|
185 |
"\<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> |
|
186 |
\<Longrightarrow> Info_flow_shm s p to" |
|
187 |
apply (case_tac "from = to", simp) |
|
188 |
apply (erule_tac h = h in Info_flow_shm.intros(2), simp add:one_flow_shm_def) |
|
189 |
by (rule_tac x = flag in exI, simp) |
|
190 |
||
28 | 191 |
lemma Info_flow_shm_intro4: |
192 |
"\<lbrakk>(p, flagb) \<in> procs_of_shm s h; valid s\<rbrakk> \<Longrightarrow> Info_flow_shm s p p" |
|
193 |
by (drule procs_of_shm_prop2, simp, simp add:Info_flow_shm.intros) |
|
194 |
||
195 |
(********* simpset for inductive Info_flow_shm **********) |
|
196 |
||
197 |
lemma Info_flow_shm_attach1_aux: |
|
27 | 198 |
"Info_flow_shm s' pa pb \<Longrightarrow> valid s' \<and> (s' = Attach p h flag # s) \<longrightarrow> |
199 |
(if Info_flow_shm s pa pb then True else |
|
200 |
(if (pa = p \<and> flag = SHM_RDWR) |
|
201 |
then (\<exists> p' flagb. (p', flagb) \<in> procs_of_shm s h \<and> Info_flow_shm s p' pb) |
|
202 |
else if (pb = p) |
|
203 |
then (\<exists> p'. (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s pa p') |
|
204 |
else (\<exists> p' flag'. Info_flow_shm s pa p \<and> flag = SHM_RDWR \<and> (p', flag') \<in> procs_of_shm s h \<and> |
|
205 |
Info_flow_shm s p' pb) \<or> |
|
206 |
(\<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) |
|
207 |
) )" |
|
208 |
proof (induct rule:Info_flow_shm.induct) |
|
209 |
case (ifs_self proc \<tau>) |
|
210 |
show ?case |
|
211 |
proof (rule impI) |
|
212 |
assume pre: "valid \<tau> \<and> \<tau> = Attach p h flag # s" |
|
213 |
hence p1: "p \<in> current_procs s" and p2: "valid s" by (auto intro:vd_cons dest:vt_grant_os) |
|
214 |
hence p3: "Info_flow_shm s p p" by (auto intro:Info_flow_shm.intros) |
|
215 |
from ifs_self pre have "proc \<in> current_procs s" by simp |
|
216 |
hence p4: "Info_flow_shm s proc proc" by (auto intro:Info_flow_shm.intros) |
|
217 |
show "if Info_flow_shm s proc proc then True |
|
218 |
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 |
|
219 |
else if proc = p then \<exists>p'. (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s proc p' |
|
220 |
else (\<exists>p' flag'. Info_flow_shm s proc p \<and> |
|
221 |
flag = SHM_RDWR \<and> (p', flag') \<in> procs_of_shm s h \<and> Info_flow_shm s p' proc) \<or> |
|
222 |
(\<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 |
|
223 |
qed |
|
224 |
next |
|
225 |
case (ifs_flow \<tau> pa pb h' pc) |
|
226 |
thus ?case |
|
227 |
proof (rule_tac impI) |
|
228 |
assume p1:"Info_flow_shm \<tau> pa pb" and p2: "valid \<tau> \<and> \<tau> = Attach p h flag # s \<longrightarrow> |
|
229 |
(if Info_flow_shm s pa pb then True |
|
230 |
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 |
|
231 |
else if pb = p then \<exists>p'. (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s pa p' |
|
232 |
else (\<exists>p' flag'. Info_flow_shm s pa p \<and> |
|
233 |
flag = SHM_RDWR \<and> (p', flag') \<in> procs_of_shm s h \<and> Info_flow_shm s p' pb) \<or> |
|
234 |
(\<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))" |
|
235 |
and p3: "one_flow_shm \<tau> h' pb pc" and p4: "valid \<tau> \<and> \<tau> = Attach p h flag # s" |
|
236 |
||
237 |
from p2 and p4 have p2': "(if Info_flow_shm s pa pb then True |
|
238 |
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 |
|
239 |
else if pb = p then \<exists>p'. (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s pa p' |
|
240 |
else (\<exists>p' flag'. Info_flow_shm s pa p \<and> |
|
241 |
flag = SHM_RDWR \<and> (p', flag') \<in> procs_of_shm s h \<and> Info_flow_shm s p' pb) \<or> |
|
242 |
(\<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))" |
|
243 |
by (erule_tac impE, simp) |
|
244 |
from p4 have p5: "valid s" and p6: "os_grant s (Attach p h flag)" by (auto intro:vd_cons dest:vt_grant_os) |
|
245 |
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) |
|
246 |
from p3 p4 have p8: "if (h' = h) |
|
247 |
then (pb = p \<and> pc \<noteq> p \<and> flag = SHM_RDWR \<and> (\<exists> flagb. (pc, flagb) \<in> procs_of_shm s h)) \<or> |
|
248 |
(pc = p \<and> pb \<noteq> p \<and> (pb, SHM_RDWR) \<in> procs_of_shm s h) \<or> |
|
249 |
(one_flow_shm s h pb pc) |
|
250 |
else one_flow_shm s h' pb pc " by (auto simp add:one_flow_shm_attach) |
|
251 |
||
252 |
have "\<And> flagb. (pc, flagb) \<in> procs_of_shm s h |
|
253 |
\<Longrightarrow> \<exists> p' flagb. (p', flagb) \<in> procs_of_shm s h \<and> Info_flow_shm s p' pc" |
|
254 |
apply (rule_tac x= pc in exI, rule_tac x = flagb in exI, frule procs_of_shm_prop2) |
|
255 |
by (simp add:p5, simp add:Info_flow_shm.intros(1)) |
|
256 |
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> |
|
257 |
Info_flow_shm s pa pc" |
|
258 |
using p2' p7 p8 p5 |
|
259 |
by (auto split:if_splits dest:Info_flow_shm.intros(2)) |
|
260 |
(* apply (rule_tac x = pb in exI, simp add:one_flow_flows, rule_tac x = flagb in exI, simp)+ *) |
|
261 |
moreover have "pc = p \<Longrightarrow> (\<exists> p'. (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s pa p') |
|
262 |
\<or> Info_flow_shm s pa pc" |
|
263 |
using p2' p7 p8 p5 |
|
264 |
by (auto split:if_splits intro:Info_flow_shm_intro3 simp:one_flow_shm_def) |
|
265 |
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> |
|
266 |
flag = SHM_RDWR \<and> (p', flag') \<in> procs_of_shm s h \<and> Info_flow_shm s p' pc) \<or> |
|
267 |
(\<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> |
|
268 |
Info_flow_shm s pa pc" |
|
269 |
using p2' p7 p8 p5 |
|
270 |
apply (auto split:if_splits intro:Info_flow_shm_intro3 simp:one_flow_shm_def) |
|
271 |
apply (rule_tac x = pc in exI, simp add:Info_flow_shm_intro4) |
|
272 |
apply (rule_tac x = flagb in exI, simp) |
|
273 |
done |
|
274 |
ultimately show "if Info_flow_shm s pa pc then True |
|
275 |
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 |
|
276 |
else if pc = p then \<exists>p'. (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s pa p' |
|
277 |
else (\<exists>p' flag'. Info_flow_shm s pa p \<and> |
|
278 |
flag = SHM_RDWR \<and> (p', flag') \<in> procs_of_shm s h \<and> Info_flow_shm s p' pc) \<or> |
|
279 |
(\<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)" |
|
280 |
using p7 by auto |
|
281 |
qed |
|
282 |
qed |
|
283 |
||
28 | 284 |
lemma Info_flow_shm_attach1: |
285 |
"\<lbrakk>valid (Attach p h flag # s); Info_flow_shm (Attach p h flag # s) pa pb\<rbrakk> |
|
286 |
\<Longrightarrow> (if Info_flow_shm s pa pb then True else |
|
287 |
(if (pa = p \<and> flag = SHM_RDWR) |
|
288 |
then (\<exists> p' flagb. (p', flagb) \<in> procs_of_shm s h \<and> Info_flow_shm s p' pb) |
|
289 |
else if (pb = p) |
|
290 |
then (\<exists> p'. (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s pa p') |
|
291 |
else (\<exists> p' flag'. Info_flow_shm s pa p \<and> flag = SHM_RDWR \<and> (p', flag') \<in> procs_of_shm s h \<and> |
|
292 |
Info_flow_shm s p' pb) \<or> |
|
293 |
(\<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) |
|
294 |
) )" |
|
295 |
apply (drule_tac p = p and h = h and flag = flag in Info_flow_shm_attach1_aux) |
|
296 |
by auto |
|
27 | 297 |
|
28 | 298 |
lemma Info_flow_shm_attach_aux[rule_format]: |
299 |
"Info_flow_shm s pa pb \<Longrightarrow> valid (Attach p h flag # s) \<longrightarrow> Info_flow_shm (Attach p h flag # s) pa pb" |
|
300 |
apply (erule Info_flow_shm.induct) |
|
301 |
apply (rule impI, rule Info_flow_shm.intros(1), simp) |
|
302 |
apply (rule impI, simp, rule_tac h = ha in Info_flow_shm.intros(2), simp) |
|
303 |
apply (auto simp add:one_flow_shm_simps) |
|
304 |
done |
|
27 | 305 |
|
28 | 306 |
lemma Info_flow_shm_attach2: |
307 |
"\<lbrakk>valid (Attach p h flag # s); if Info_flow_shm s pa pb then True else |
|
308 |
(if (pa = p \<and> flag = SHM_RDWR) |
|
309 |
then (\<exists> p' flagb. (p', flagb) \<in> procs_of_shm s h \<and> Info_flow_shm s p' pb) |
|
310 |
else if (pb = p) |
|
311 |
then (\<exists> p'. (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s pa p') |
|
312 |
else (\<exists> p' flag'. Info_flow_shm s pa p \<and> flag = SHM_RDWR \<and> (p', flag') \<in> procs_of_shm s h \<and> |
|
313 |
Info_flow_shm s p' pb) \<or> |
|
314 |
(\<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))\<rbrakk> |
|
315 |
\<Longrightarrow> Info_flow_shm (Attach p h flag # s) pa pb" |
|
316 |
apply (frule vt_grant_os, frule vd_cons) |
|
317 |
apply (auto split:if_splits intro:Info_flow_shm_intro3 simp:one_flow_shm_def intro:Info_flow_shm_attach_aux) |
|
318 |
apply (rule_tac p' = p' in Info_flow_trans) |
|
319 |
apply (rule_tac p' = p and h = h in Info_flow_shm.intros(2)) |
|
320 |
apply (rule Info_flow_shm.intros(1), simp) |
|
321 |
apply (simp add:one_flow_shm_simps, simp add:one_flow_shm_def) |
|
322 |
apply (rule conjI, rule notI, simp, rule_tac x = flagb in exI, simp) |
|
323 |
apply (simp add:Info_flow_shm_attach_aux) |
|
27 | 324 |
|
28 | 325 |
apply (rule_tac p' = p' in Info_flow_trans) |
326 |
apply (rule_tac p' = p in Info_flow_trans) |
|
327 |
apply (simp add:Info_flow_shm_attach_aux) |
|
328 |
apply (rule_tac p' = p and h = h in Info_flow_shm.intros(2)) |
|
329 |
apply (rule Info_flow_shm.intros(1), simp) |
|
330 |
apply (simp add:one_flow_shm_simps, simp add:one_flow_shm_def) |
|
331 |
apply (rule conjI, rule notI, simp, rule_tac x = flag' in exI, simp) |
|
332 |
apply (simp add:Info_flow_shm_attach_aux) |
|
27 | 333 |
|
28 | 334 |
apply (rule_tac p' = p in Info_flow_trans) |
335 |
apply (rule_tac p' = p' in Info_flow_trans) |
|
336 |
apply (simp add:Info_flow_shm_attach_aux) |
|
337 |
apply (rule_tac p' = p' and h = h in Info_flow_shm.intros(2)) |
|
338 |
apply (rule Info_flow_shm.intros(1), simp add:procs_of_shm_prop2) |
|
339 |
apply (simp add:one_flow_shm_simps, simp add:one_flow_shm_def) |
|
340 |
apply (rule notI, simp) |
|
341 |
apply (simp add:Info_flow_shm_attach_aux) |
|
27 | 342 |
|
28 | 343 |
apply (rule_tac p' = p in Info_flow_trans) |
344 |
apply (rule_tac p' = p' in Info_flow_trans) |
|
345 |
apply (simp add:Info_flow_shm_attach_aux) |
|
346 |
apply (rule_tac p' = p' and h = h in Info_flow_shm.intros(2)) |
|
347 |
apply (rule Info_flow_shm.intros(1), simp add:procs_of_shm_prop2) |
|
348 |
apply (simp add:one_flow_shm_simps, simp add:one_flow_shm_def) |
|
349 |
apply (rule notI, simp) |
|
350 |
apply (simp add:Info_flow_shm_attach_aux) |
|
351 |
done |
|
27 | 352 |
|
353 |
lemma Info_flow_shm_attach: |
|
354 |
"valid (Attach p h flag # s) \<Longrightarrow> Info_flow_shm (Attach p h flag # s) = (\<lambda> pa pb. |
|
28 | 355 |
Info_flow_shm s pa pb \<or> |
356 |
(if (pa = p \<and> flag = SHM_RDWR) |
|
357 |
then (\<exists> p' flagb. (p', flagb) \<in> procs_of_shm s h \<and> Info_flow_shm s p' pb) |
|
358 |
else if (pb = p) |
|
359 |
then (\<exists> p'. (p', SHM_RDWR) \<in> procs_of_shm s h \<and> Info_flow_shm s pa p') |
|
360 |
else (\<exists> p' flag'. Info_flow_shm s pa p \<and> flag = SHM_RDWR \<and> (p', flag') \<in> procs_of_shm s h \<and> |
|
361 |
Info_flow_shm s p' pb) \<or> |
|
362 |
(\<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) |
|
363 |
) )" |
|
27 | 364 |
apply (rule ext, rule ext, rule iffI) |
28 | 365 |
apply (drule_tac pa = pa and pb = pb in Info_flow_shm_attach1, simp) |
366 |
apply (auto split:if_splits)[1] |
|
367 |
apply (drule_tac pa = pa and pb = pb in Info_flow_shm_attach2) |
|
368 |
apply (auto split:if_splits) |
|
369 |
done |
|
27 | 370 |
|
26 | 371 |
|
372 |
lemma info_flow_shm_detach: |
|
373 |
"valid (Detach p h # s) \<Longrightarrow> info_flow_shm (Detach p h # s) = (\<lambda> pa pb. |
|
374 |
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> |
|
375 |
(pa \<noteq> p \<and> pb \<noteq> p \<and> info_flow_shm s pa pb) )" |
|
376 |
apply (rule ext, rule ext, frule vt_grant_os) |
|
377 |
by (auto simp:info_flow_shm_def one_flow_shm_def) |
|
378 |
||
379 |
lemma info_flow_shm_deleteshm: |
|
380 |
"valid (DeleteShM p h # s) \<Longrightarrow> info_flow_shm (DeleteShM p h # s) = (\<lambda> pa pb. |
|
381 |
self_shm s pa pb \<or> (\<exists> h'. h' \<noteq> h \<and> one_flow_shm s h' pa pb) )" |
|
382 |
apply (rule ext, rule ext, frule vt_grant_os) |
|
383 |
by (auto simp:info_flow_shm_def one_flow_shm_def) |
|
384 |
||
385 |
lemma info_flow_shm_clone: |
|
386 |
"valid (Clone p p' fds shms # s) \<Longrightarrow> info_flow_shm (Clone p p' fds shms # s) = (\<lambda> pa pb. |
|
387 |
(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> |
|
388 |
(pb = p' \<and> pa \<noteq> p' \<and> (\<exists> h \<in> shms. one_flow_shm s h pa p)) \<or> |
|
389 |
(pa \<noteq> p' \<and> pb \<noteq> p' \<and> info_flow_shm s pa pb))" |
|
390 |
apply (rule ext, rule ext, frule vt_grant_os, frule vd_cons, clarsimp) |
|
391 |
apply (frule_tac p = p' in procs_of_shm_prop2', simp) |
|
392 |
apply (auto simp:info_flow_shm_def one_flow_shm_def) |
|
393 |
done |
|
394 |
||
395 |
lemma info_flow_shm_execve: |
|
396 |
"valid (Execve p f fds # s) \<Longrightarrow> info_flow_shm (Execve p f fds # s) = (\<lambda> pa pb. |
|
397 |
(pa = p \<and> pb = p) \<or> (pa \<noteq> p \<and> pb \<noteq> p \<and> info_flow_shm s pa pb) )" |
|
398 |
apply (rule ext, rule ext, frule vt_grant_os, frule vd_cons) |
|
399 |
by (auto simp:info_flow_shm_def one_flow_shm_def) |
|
400 |
||
401 |
lemma info_flow_shm_kill: |
|
402 |
"valid (Kill p p' # s) \<Longrightarrow> info_flow_shm (Kill p p' # s) = (\<lambda> pa pb. |
|
403 |
pa \<noteq> p' \<and> pb \<noteq> p' \<and> info_flow_shm s pa pb )" |
|
404 |
apply (rule ext, rule ext, frule vt_grant_os, frule vd_cons) |
|
405 |
by (auto simp:info_flow_shm_def one_flow_shm_def) |
|
406 |
||
407 |
lemma info_flow_shm_exit: |
|
408 |
"valid (Exit p # s) \<Longrightarrow> info_flow_shm (Exit p # s) = (\<lambda> pa pb. |
|
409 |
pa \<noteq> p \<and> pb \<noteq> p \<and> info_flow_shm s pa pb )" |
|
410 |
apply (rule ext, rule ext, frule vt_grant_os, frule vd_cons) |
|
411 |
by (auto simp:info_flow_shm_def one_flow_shm_def) |
|
412 |
||
413 |
lemma info_flow_shm_other: |
|
414 |
"\<lbrakk>valid (e # s); |
|
415 |
\<forall> p h flag. e \<noteq> Attach p h flag; |
|
416 |
\<forall> p h. e \<noteq> Detach p h; |
|
417 |
\<forall> p h. e \<noteq> DeleteShM p h; |
|
418 |
\<forall> p p' fds shms. e \<noteq> Clone p p' fds shms; |
|
419 |
\<forall> p f fds. e \<noteq> Execve p f fds; |
|
420 |
\<forall> p p'. e \<noteq> Kill p p'; |
|
421 |
\<forall> p. e \<noteq> Exit p |
|
422 |
\<rbrakk> \<Longrightarrow> info_flow_shm (e # s) = info_flow_shm s" |
|
423 |
apply (rule ext, rule ext, frule vt_grant_os, frule vd_cons) |
|
424 |
apply (case_tac e, auto simp:info_flow_shm_def one_flow_shm_def dest:procs_of_shm_prop2) |
|
425 |
apply (erule_tac x = h in allE, simp) |
|
426 |
apply (drule procs_of_shm_prop1, auto) |
|
427 |
done |
|
428 |
||
429 |
||
430 |
(* |
|
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
|
431 |
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
|
432 |
"\<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
|
433 |
\<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
|
434 |
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
|
435 |
|
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
|
436 |
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
|
437 |
"\<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
|
438 |
\<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
|
439 |
(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
|
440 |
\<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
|
441 |
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
|
442 |
|
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
|
443 |
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
|
444 |
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
|
445 |
"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
|
446 |
|
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 |
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
|
448 |
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
|
449 |
"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
|
450 |
| "\<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
|
451 |
|
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 |
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
|
453 |
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
|
454 |
"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
|
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 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
|
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 |
"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
|
459 |
|
26 | 460 |
inductive flowed_shm:: "t_state \<Rightarrow> t_process \<Rightarrow> t_shm set" |
461 |
||
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
|
462 |
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
|
463 |
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
|
464 |
"Info_flow_shm [] = (\<lambda> p. {p'. flows_shm [] p p'})" |
26 | 465 |
| "Info_flow_shm (Attach p h flag # s) = (\<lambda> p'. |
466 |
if (p' = p) then flowed_procs s h |
|
467 |
else if () |
|
468 |
" |
|
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
|
469 |
|
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 |
|
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 |
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
|
472 |
"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
|
473 |
(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
|
474 |
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
|
475 |
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
|
476 |
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
|
477 |
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
|
478 |
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
|
479 |
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
|
480 |
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
|
481 |
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
|
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 |
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
|
484 |
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
|
485 |
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
|
486 |
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
|
487 |
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
|
488 |
pr 5 |
26 | 489 |
*) |
490 |
lemmas info_flow_shm_simps = info_flow_shm_other info_flow_shm_attach info_flow_shm_detach info_flow_shm_deleteshm |
|
491 |
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
|
492 |
|
19 | 493 |
lemma has_same_inode_in_current: |
494 |
"\<lbrakk>has_same_inode s f f'; valid s\<rbrakk> \<Longrightarrow> f \<in> current_files s \<and> f' \<in> current_files s" |
|
495 |
by (auto simp add:has_same_inode_def current_files_def) |
|
496 |
||
497 |
lemma has_same_inode_prop1: |
|
498 |
"\<lbrakk>has_same_inode s f f'; is_file s f; valid s\<rbrakk> \<Longrightarrow> is_file s f'" |
|
499 |
by (auto simp:has_same_inode_def is_file_def) |
|
500 |
||
501 |
lemma has_same_inode_prop1': |
|
502 |
"\<lbrakk>has_same_inode s f f'; is_file s f'; valid s\<rbrakk> \<Longrightarrow> is_file s f" |
|
503 |
by (auto simp:has_same_inode_def is_file_def) |
|
504 |
||
505 |
lemma has_same_inode_prop2: |
|
506 |
"\<lbrakk>has_same_inode s f f'; file_of_proc_fd s p fd = Some f; valid s\<rbrakk> \<Longrightarrow> is_file s f'" |
|
507 |
apply (drule has_same_inode_prop1) |
|
508 |
apply (simp add:file_of_pfd_is_file, simp+) |
|
509 |
done |
|
510 |
||
511 |
lemma has_same_inode_prop2': |
|
512 |
"\<lbrakk>has_same_inode s f f'; file_of_proc_fd s p fd = Some f'; valid s\<rbrakk> \<Longrightarrow> is_file s f" |
|
513 |
apply (drule has_same_inode_prop1') |
|
514 |
apply (simp add:file_of_pfd_is_file, simp+) |
|
515 |
done |
|
516 |
||
517 |
lemma tobj_in_init_alive: |
|
518 |
"tobj_in_init obj \<Longrightarrow> init_alive obj" |
|
519 |
by (case_tac obj, auto) |
|
520 |
||
521 |
lemma tobj_in_alive: |
|
522 |
"tobj_in_init obj \<Longrightarrow> alive [] obj" |
|
523 |
by (case_tac obj, auto simp:is_file_nil) |
|
524 |
||
18 | 525 |
end |
526 |
||
527 |
end |