author | chunhan |
Mon, 30 Dec 2013 23:41:58 +0800 | |
changeset 86 | 690636b7b6f1 |
parent 84 | cebdef333899 |
child 87 | 8d18cfc845dd |
permissions | -rw-r--r-- |
77 | 1 |
theory Enrich |
2 |
imports Main Flask Static Init_prop Valid_prop Tainted_prop Delete_prop Co2sobj_prop S2ss_prop S2ss_prop2 |
|
3 |
Temp |
|
4 |
begin |
|
5 |
||
83 | 6 |
(* objects that need dynamic indexing, all nature-numbers *) |
78 | 7 |
datatype t_enrich_obj = |
8 |
E_proc "t_process" |
|
9 |
| E_file "t_file" |
|
10 |
| E_fd "t_process" "t_fd" |
|
11 |
| E_inum "nat" |
|
12 |
| E_msgq "t_msgq" |
|
13 |
| E_msg "t_msgq" "t_msg" |
|
14 |
||
77 | 15 |
context tainting_s begin |
16 |
||
83 | 17 |
fun no_del_event:: "t_event list \<Rightarrow> bool" |
18 |
where |
|
19 |
"no_del_event [] = True" |
|
20 |
| "no_del_event (Kill p p' # \<tau>) = False" |
|
21 |
| "no_del_event (Exit p # s) = False" |
|
22 |
| "no_del_event (CloseFd p fd # \<tau>) = False" |
|
23 |
| "no_del_event (UnLink p f # \<tau>) = False" |
|
24 |
| "no_del_event (Rmdir p f # \<tau>) = False" |
|
25 |
(* |
|
26 |
| "no_del_event (Rename p f f' # \<tau>) = False" |
|
27 |
*) |
|
28 |
| "no_del_event (RemoveMsgq p q # \<tau>) = False" |
|
29 |
(* |
|
30 |
| "no_del_event (RecvMsg p q m # \<tau>) = False" |
|
31 |
*) |
|
32 |
| "no_del_event (_ # \<tau>) = no_del_event \<tau>" |
|
33 |
||
34 |
fun all_inums :: "t_state \<Rightarrow> t_inode_num set" |
|
35 |
where |
|
36 |
"all_inums [] = current_inode_nums []" |
|
37 |
| "all_inums (Open p f flags fd opt # s) = ( |
|
38 |
case opt of |
|
39 |
None \<Rightarrow> all_inums s |
|
40 |
| Some i \<Rightarrow> all_inums s \<union> {i} )" |
|
41 |
| "all_inums (Mkdir p f i # s) = (all_inums s \<union> {i})" |
|
42 |
| "all_inums (CreateSock p af st fd i # s) = (all_inums s \<union> {i})" |
|
43 |
| "all_inums (Accept p fd addr lport fd' i # s) = (all_inums s \<union> {i})" |
|
44 |
| "all_inums (_ # s) = all_inums s" |
|
45 |
||
46 |
fun all_fds :: "t_state \<Rightarrow> t_process \<Rightarrow> t_fd set" |
|
47 |
where |
|
48 |
"all_fds [] = init_fds_of_proc" |
|
49 |
| "all_fds (Open p f flags fd ipt # s) = (all_fds s) (p := all_fds s p \<union> {fd})" |
|
50 |
| "all_fds (CreateSock p sf st fd i # s) = (all_fds s) (p := all_fds s p \<union> {fd})" |
|
51 |
| "all_fds (Accept p fd' raddr port fd i # s) = (all_fds s) (p := all_fds s p \<union> {fd})" |
|
52 |
| "all_fds (Clone p p' fds # s) = (all_fds s) (p' := fds)" |
|
53 |
| "all_fds (_ # s) = all_fds s" |
|
54 |
||
55 |
fun all_msgqs:: "t_state \<Rightarrow> t_msgq set" |
|
56 |
where |
|
57 |
"all_msgqs [] = init_msgqs" |
|
58 |
| "all_msgqs (CreateMsgq p q # s) = all_msgqs s \<union> {q}" |
|
59 |
| "all_msgqs (e # s) = all_msgqs s" |
|
60 |
||
61 |
fun all_msgs:: "t_state \<Rightarrow> t_msgq \<Rightarrow> t_msg set" |
|
62 |
where |
|
63 |
"all_msgs [] q = set (init_msgs_of_queue q)" |
|
64 |
| "all_msgs (CreateMsgq p q # s) q' = (if q' = q then {} else all_msgs s q')" |
|
65 |
| "all_msgs (SendMsg p q m # s) q' = (if q' = q then all_msgs s q \<union> {m} else all_msgs s q')" |
|
66 |
| "all_msgs (_ # s) q' = all_msgs s q'" |
|
67 |
||
68 |
fun all_files:: "t_state \<Rightarrow> t_file set" |
|
69 |
where |
|
70 |
"all_files [] = init_files " |
|
71 |
| "all_files (Open p f flags fd opt # s) = (if opt = None then all_files s else (all_files s \<union> {f}))" |
|
72 |
| "all_files (Mkdir p f inum # s) = all_files s \<union> {f}" |
|
73 |
| "all_files (LinkHard p f f' # s) = all_files s \<union> {f'}" |
|
74 |
| "all_files (e # s) = all_files s" |
|
75 |
||
76 |
fun notin_all:: "t_state \<Rightarrow> t_enrich_obj \<Rightarrow> bool" |
|
77 |
where |
|
78 |
"notin_all s (E_proc p) = (p \<notin> all_procs s)" |
|
79 |
| "notin_all s (E_file f) = (f \<notin> all_files s \<and> (\<exists> pf. parent f = Some pf \<and> is_dir s pf))" |
|
80 |
| "notin_all s (E_fd p fd) = (fd \<notin> all_fds s p)" |
|
81 |
| "notin_all s (E_inum i) = (i \<notin> all_inums s)" |
|
82 |
| "notin_all s (E_msgq q) = (q \<notin> all_msgqs s)" |
|
83 |
| "notin_all s (E_msg q m) = (m \<notin> all_msgs s q)" |
|
84 |
||
85 |
lemma not_all_procs_cons: |
|
86 |
"p \<notin> all_procs (e # s) \<Longrightarrow> p \<notin> all_procs s" |
|
87 |
by (case_tac e, auto) |
|
88 |
||
89 |
lemma not_all_procs_prop: |
|
90 |
"\<lbrakk>p' \<notin> all_procs s; p \<in> current_procs s; valid s\<rbrakk> \<Longrightarrow> p' \<noteq> p" |
|
91 |
apply (induct s, rule notI, simp) |
|
92 |
apply (frule vt_grant_os, frule vd_cons, frule not_all_procs_cons, simp, rule notI) |
|
93 |
apply (case_tac a, auto) |
|
94 |
done |
|
95 |
||
96 |
lemma not_all_procs_prop2: |
|
97 |
"p' \<notin> all_procs s \<Longrightarrow> p' \<notin> init_procs" |
|
98 |
apply (induct s, simp) |
|
99 |
by (case_tac a, auto) |
|
100 |
||
101 |
lemma not_all_procs_prop3: |
|
102 |
"p' \<notin> all_procs s \<Longrightarrow> p' \<notin> current_procs s" |
|
103 |
apply (induct s, simp) |
|
104 |
by (case_tac a, auto) |
|
105 |
||
84
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
106 |
lemma not_all_msgqs_cons: |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
107 |
"p \<notin> all_msgqs (e # s) \<Longrightarrow> p \<notin> all_msgqs s" |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
108 |
by (case_tac e, auto) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
109 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
110 |
lemma not_all_msgqs_prop: |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
111 |
"\<lbrakk>p' \<notin> all_msgqs s; p \<in> current_msgqs s; valid s\<rbrakk> \<Longrightarrow> p' \<noteq> p" |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
112 |
apply (induct s, rule notI, simp) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
113 |
apply (frule vt_grant_os, frule vd_cons, frule not_all_msgqs_cons, simp, rule notI) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
114 |
apply (case_tac a, auto) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
115 |
done |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
116 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
117 |
lemma not_all_msgqs_prop2: |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
118 |
"p' \<notin> all_msgqs s \<Longrightarrow> p' \<notin> init_msgqs" |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
119 |
apply (induct s, simp) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
120 |
by (case_tac a, auto) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
121 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
122 |
lemma not_all_msgqs_prop3: |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
123 |
"p' \<notin> all_msgqs s \<Longrightarrow> p' \<notin> current_msgqs s" |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
124 |
apply (induct s, simp) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
125 |
by (case_tac a, auto) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
126 |
|
83 | 127 |
fun enrich_not_alive :: "t_state \<Rightarrow> t_enrich_obj \<Rightarrow> t_enrich_obj \<Rightarrow> bool" |
128 |
where |
|
84
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
129 |
"enrich_not_alive s obj (E_file f) = (f \<notin> current_files s \<and> obj \<noteq> E_file f)" |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
130 |
| "enrich_not_alive s obj (E_proc p) = (p \<notin> current_procs s \<and> obj \<noteq> E_proc p)" |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
131 |
| "enrich_not_alive s obj (E_fd p fd) = |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
132 |
((p \<in> current_procs s \<longrightarrow> fd \<notin> current_proc_fds s p) \<and> obj \<noteq> E_fd p fd \<and> obj \<noteq> E_proc p)" |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
133 |
| "enrich_not_alive s obj (E_msgq q) = (q \<notin> current_msgqs s \<and> obj \<noteq> E_msgq q)" |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
134 |
| "enrich_not_alive s obj (E_inum i) = (i \<notin> current_inode_nums s \<and> obj \<noteq> E_inum i)" |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
135 |
| "enrich_not_alive s obj (E_msg q m) = |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
136 |
((q \<in> current_msgqs s \<longrightarrow> m \<notin> set (msgs_of_queue s q)) \<and> obj \<noteq> E_msg q m \<and> obj \<noteq> E_msgq q)" |
83 | 137 |
|
138 |
lemma file_has_parent: "\<lbrakk>is_file s f; valid s\<rbrakk> \<Longrightarrow> \<exists> pf. is_dir s pf \<and> parent f = Some pf" |
|
139 |
apply (case_tac f) |
|
140 |
apply (simp, drule root_is_dir', simp+) |
|
141 |
apply (simp add:parentf_is_dir_prop2) |
|
142 |
done |
|
143 |
||
77 | 144 |
(* enrich s target_proc duplicated_pro *) |
145 |
fun enrich_proc :: "t_state \<Rightarrow> t_process \<Rightarrow> t_process \<Rightarrow> t_state" |
|
146 |
where |
|
147 |
"enrich_proc [] tp dp = []" |
|
148 |
| "enrich_proc (Execve p f fds # s) tp dp = ( |
|
149 |
if (tp = p) |
|
150 |
then Execve dp f (fds \<inter> proc_file_fds s p) # Execve p f fds # (enrich_proc s tp dp) |
|
151 |
else Execve p f fds # (enrich_proc s tp dp))" |
|
152 |
| "enrich_proc (Clone p p' fds # s) tp dp = ( |
|
153 |
if (tp = p') |
|
154 |
then Clone p dp (fds \<inter> proc_file_fds s p) # Clone p p' fds # s |
|
155 |
else Clone p p' fds # (enrich_proc s tp dp))" |
|
156 |
| "enrich_proc (Open p f flags fd opt # s) tp dp = ( |
|
157 |
if (tp = p) |
|
81 | 158 |
then Open dp f (remove_create_flag flags) fd None # Open p f flags fd opt # (enrich_proc s tp dp) |
77 | 159 |
else Open p f flags fd opt # (enrich_proc s tp dp))" |
81 | 160 |
| "enrich_proc (ReadFile p fd # s) tp dp = ( |
161 |
if (tp = p) |
|
162 |
then ReadFile dp fd # ReadFile p fd # (enrich_proc s tp dp) |
|
163 |
else ReadFile p fd # (enrich_proc s tp dp))" |
|
83 | 164 |
(* |
77 | 165 |
| "enrich_proc (CloseFd p fd # s) tp dp = ( |
80 | 166 |
if (tp = p \<and> fd \<in> proc_file_fds s p) |
77 | 167 |
then CloseFd dp fd # CloseFd p fd # (enrich_proc s tp dp) |
168 |
else CloseFd p fd # (enrich_proc s tp dp))" |
|
83 | 169 |
*) |
77 | 170 |
(* |
171 |
| "enrich_proc (Attach p h flag # s) tp dp = ( |
|
172 |
if (tp = p) |
|
173 |
then Attach dp h flag # Attach p h flag # (enrich_proc s tp dp) |
|
174 |
else Attach p h flag # (enrich_proc s tp dp))" |
|
175 |
| "enrich_proc (Detach p h # s) tp dp = ( |
|
176 |
if (tp = p) |
|
177 |
then Detach dp h # Detach p h # (enrich_proc s tp dp) |
|
178 |
else Detach p h # (enrich_proc s tp dp))" |
|
179 |
*) |
|
83 | 180 |
(* |
77 | 181 |
| "enrich_proc (Kill p p' # s) tp dp = ( |
79 | 182 |
if (tp = p') then Kill p p' # s |
77 | 183 |
else Kill p p' # (enrich_proc s tp dp))" |
184 |
| "enrich_proc (Exit p # s) tp dp = ( |
|
185 |
if (tp = p) then Exit p # s |
|
186 |
else Exit p # (enrich_proc s tp dp))" |
|
83 | 187 |
*) |
77 | 188 |
| "enrich_proc (e # s) tp dp = e # (enrich_proc s tp dp)" |
189 |
||
83 | 190 |
definition is_created_proc:: "t_state \<Rightarrow> t_process \<Rightarrow> bool" |
191 |
where |
|
192 |
"is_created_proc s p \<equiv> p \<in> current_procs s \<and> (p \<in> init_procs \<longrightarrow> died (O_proc p) s)" |
|
193 |
||
194 |
definition is_created_proc':: "t_state \<Rightarrow> t_process \<Rightarrow> bool" |
|
195 |
where |
|
196 |
"is_created_proc' s p \<equiv> p \<in> current_procs s \<and> p \<notin> init_procs" |
|
197 |
||
198 |
lemma no_del_died: |
|
199 |
"\<lbrakk>no_del_event s; died obj s\<rbrakk> \<Longrightarrow> (\<exists> p fd. obj = O_fd p fd \<or> obj = O_tcp_sock (p, fd) \<or> obj = O_udp_sock (p, fd)) |
|
200 |
\<or> (\<exists> q m. obj = O_msg q m) " |
|
201 |
apply (induct s) |
|
202 |
apply simp |
|
203 |
apply (case_tac a) |
|
204 |
apply (auto split:option.splits) |
|
205 |
done |
|
206 |
||
207 |
lemma no_del_created_eq: |
|
208 |
"no_del_event s \<Longrightarrow> is_created_proc s p = is_created_proc' s p" |
|
209 |
apply (induct s) |
|
210 |
apply (simp add:is_created_proc_def is_created_proc'_def) |
|
211 |
apply (case_tac a) |
|
212 |
apply (auto simp add:is_created_proc_def is_created_proc'_def dest:no_del_died) |
|
213 |
done |
|
214 |
||
77 | 215 |
lemma enrich_search_check: |
216 |
assumes grant: "search_check s (up, rp, tp) f" |
|
217 |
and cf2sf: "\<forall> f. f \<in> current_files s \<longrightarrow> cf2sfile s' f = cf2sfile s f" |
|
218 |
and vd: "valid s" and f_in: "is_file s f" and f_in': "is_file s' f" |
|
219 |
and sec: "sectxt_of_obj s' (O_file f) = sectxt_of_obj s (O_file f)" |
|
220 |
shows "search_check s' (up, rp, tp) f" |
|
221 |
proof (cases f) |
|
222 |
case Nil |
|
223 |
with f_in vd have "False" |
|
224 |
by (auto dest:root_is_dir') |
|
225 |
thus ?thesis by simp |
|
226 |
next |
|
227 |
case (Cons n pf) |
|
228 |
from vd f_in obtain sf where sf: "cf2sfile s f = Some sf" |
|
229 |
apply (drule_tac is_file_in_current, drule_tac current_file_has_sfile, simp) |
|
230 |
apply (erule exE, simp) |
|
231 |
done |
|
232 |
then obtain psfs where psfs: "get_parentfs_ctxts s pf = Some psfs" using Cons |
|
233 |
by (auto simp:cf2sfile_def split:option.splits if_splits) |
|
234 |
from sf cf2sf f_in have sf': "cf2sfile s' f = Some sf" by (auto dest:is_file_in_current) |
|
235 |
then obtain psfs' where psfs': "get_parentfs_ctxts s' pf = Some psfs'"using Cons |
|
236 |
by (auto simp:cf2sfile_def split:option.splits if_splits) |
|
237 |
with sf sf' psfs have psfs_eq: "set psfs' = set psfs" using Cons f_in f_in' |
|
238 |
apply (simp add:cf2sfile_def split:option.splits) |
|
239 |
apply (case_tac sf, simp) |
|
240 |
done |
|
241 |
show ?thesis using grant f_in f_in' psfs psfs' psfs_eq sec |
|
242 |
apply (simp add:Cons split:option.splits) |
|
243 |
by (case_tac a, simp) |
|
244 |
qed |
|
245 |
||
78 | 246 |
lemma enrich_search_check': |
247 |
assumes grant: "search_check s (up, rp, tp) f" |
|
248 |
and cf2sf: "\<forall> f. f \<in> current_files s \<longrightarrow> cf2sfile s' f = cf2sfile s f" |
|
249 |
and vd: "valid s" and vd': "valid s'" and f_in: "is_dir s f" and f_in': "is_dir s' f" |
|
250 |
and sec: "sectxt_of_obj s' (O_dir f) = sectxt_of_obj s (O_dir f)" |
|
251 |
shows "search_check s' (up, rp, tp) f" |
|
252 |
proof (cases f) |
|
253 |
case Nil |
|
254 |
have "sectxt_of_obj s' (O_dir []) = sectxt_of_obj s (O_dir [])" |
|
255 |
using cf2sf |
|
256 |
apply (erule_tac x = "[]" in allE) |
|
257 |
by (auto simp:cf2sfile_def root_sec_remains vd vd') |
|
258 |
thus ?thesis using grant Nil |
|
259 |
by auto |
|
260 |
next |
|
261 |
case (Cons n pf) |
|
262 |
from vd f_in obtain sf where sf: "cf2sfile s f = Some sf" |
|
263 |
apply (drule_tac is_dir_in_current, drule_tac current_file_has_sfile, simp) |
|
264 |
apply (erule exE, simp) |
|
265 |
done |
|
266 |
then obtain psfs where psfs: "get_parentfs_ctxts s pf = Some psfs" using Cons |
|
267 |
by (auto simp:cf2sfile_def split:option.splits if_splits) |
|
268 |
from sf cf2sf f_in have sf': "cf2sfile s' f = Some sf" by (auto dest:is_dir_in_current) |
|
269 |
then obtain psfs' where psfs': "get_parentfs_ctxts s' pf = Some psfs'"using Cons |
|
270 |
by (auto simp:cf2sfile_def split:option.splits if_splits) |
|
271 |
with sf sf' psfs have psfs_eq: "set psfs' = set psfs" using Cons f_in f_in' |
|
272 |
apply (drule_tac is_dir_not_file) |
|
273 |
apply (drule is_dir_not_file) |
|
274 |
apply (simp add:cf2sfile_def split:option.splits) |
|
275 |
apply (case_tac sf, simp) |
|
276 |
done |
|
277 |
show ?thesis using grant f_in f_in' psfs psfs' psfs_eq sec |
|
278 |
apply (drule_tac is_dir_not_file) |
|
279 |
apply (drule_tac is_dir_not_file) |
|
280 |
apply (simp add:Cons split:option.splits) |
|
281 |
by (case_tac a, simp) |
|
282 |
qed |
|
283 |
||
77 | 284 |
lemma proc_filefd_has_sfd: "\<lbrakk>fd \<in> proc_file_fds s p; valid s\<rbrakk> \<Longrightarrow> \<exists> sfd. cfd2sfd s p fd = Some sfd" |
285 |
apply (simp add:proc_file_fds_def) |
|
286 |
apply (auto dest: current_filefd_has_sfd) |
|
287 |
done |
|
288 |
||
289 |
lemma enrich_inherit_fds_check: |
|
290 |
assumes grant: "inherit_fds_check s (up, nr, nt) p fds" and vd: "valid s" |
|
291 |
and cfd2sfd: "\<forall> p fd. fd \<in> proc_file_fds s p\<longrightarrow> cfd2sfd s' p fd = cfd2sfd s p fd" |
|
292 |
and fd_in: "fds \<subseteq> proc_file_fds s p" and fd_in': "fds \<subseteq> proc_file_fds s' p" |
|
293 |
shows "inherit_fds_check s' (up, nr, nt) p fds" |
|
294 |
proof- |
|
295 |
have "\<And> fd. fd \<in> fds \<Longrightarrow> sectxt_of_obj s' (O_fd p fd) = sectxt_of_obj s (O_fd p fd)" |
|
296 |
proof- |
|
297 |
fix fd |
|
298 |
assume fd_in_fds: "fd \<in> fds" |
|
299 |
hence fd_in_cfds: "fd \<in> proc_file_fds s p" |
|
300 |
and fd_in_cfds': "fd \<in> proc_file_fds s' p" |
|
301 |
using fd_in fd_in' by auto |
|
302 |
with cfd2sfd |
|
303 |
have cfd_eq: "cfd2sfd s' p fd = cfd2sfd s p fd" by auto |
|
304 |
from fd_in_cfds obtain f where ffd: "file_of_proc_fd s p fd = Some f" |
|
305 |
by (auto simp:proc_file_fds_def) |
|
306 |
moreover have "flags_of_proc_fd s p fd \<noteq> None" |
|
307 |
using ffd vd by (auto dest:current_filefd_has_flags) |
|
308 |
moreover have "sectxt_of_obj s (O_fd p fd) \<noteq> None" |
|
309 |
using fd_in_cfds vd |
|
310 |
apply (rule_tac notI) |
|
311 |
by (auto dest!:current_has_sec' file_fds_subset_pfds[where p = p] intro:vd) |
|
312 |
moreover have "cf2sfile s f \<noteq> None" |
|
313 |
apply (rule notI) |
|
314 |
apply (drule current_file_has_sfile') |
|
315 |
using ffd |
|
316 |
by (auto simp:vd is_file_in_current dest:file_of_pfd_is_file) |
|
317 |
ultimately show "sectxt_of_obj s' (O_fd p fd) = sectxt_of_obj s (O_fd p fd)" |
|
318 |
using cfd_eq |
|
319 |
by (auto simp:cfd2sfd_def split:option.splits) |
|
320 |
qed |
|
321 |
hence "sectxts_of_fds s' p fds = sectxts_of_fds s p fds" |
|
322 |
by (simp add:sectxts_of_fds_def) |
|
323 |
thus ?thesis using grant |
|
324 |
by (simp add:inherit_fds_check_def) |
|
325 |
qed |
|
326 |
||
80 | 327 |
|
328 |
lemma enrich_inherit_fds_check_dup: |
|
329 |
assumes grant: "inherit_fds_check s (up, nr, nt) p fds" and vd: "valid s" |
|
330 |
and cfd2sfd: "\<forall> fd. fd \<in> proc_file_fds s p \<longrightarrow> cfd2sfd s' p' fd = cfd2sfd s p fd" |
|
331 |
and fd_in: "fds' \<subseteq> fds \<inter> proc_file_fds s p" |
|
332 |
shows "inherit_fds_check s' (up, nr, nt) p' fds'" |
|
333 |
proof- |
|
334 |
have "sectxts_of_fds s' p' fds' \<subseteq> sectxts_of_fds s p fds" |
|
335 |
proof- |
|
336 |
have "\<And> fd sfd. \<lbrakk>fd \<in> fds'; sectxt_of_obj s' (O_fd p' fd) = Some sfd\<rbrakk> |
|
337 |
\<Longrightarrow> \<exists> fd \<in> fds. sectxt_of_obj s (O_fd p fd) = Some sfd" |
|
338 |
proof- |
|
339 |
fix fd sfd |
|
340 |
assume fd_in_fds': "fd \<in> fds'" |
|
341 |
and sec: "sectxt_of_obj s' (O_fd p' fd) = Some sfd" |
|
342 |
from fd_in_fds' fd_in |
|
343 |
have fd_in_fds: "fd \<in> fds" and fd_in_cfds: "fd \<in> proc_file_fds s p" |
|
344 |
by auto |
|
345 |
from fd_in_cfds obtain f where ffd: "file_of_proc_fd s p fd = Some f" |
|
346 |
by (auto simp:proc_file_fds_def) |
|
347 |
moreover have "flags_of_proc_fd s p fd \<noteq> None" |
|
348 |
using ffd vd by (auto dest:current_filefd_has_flags) |
|
349 |
moreover have "cf2sfile s f \<noteq> None" |
|
350 |
apply (rule notI) |
|
351 |
apply (drule current_file_has_sfile') |
|
352 |
using ffd |
|
353 |
by (auto simp:vd is_file_in_current dest:file_of_pfd_is_file) |
|
354 |
moreover have "sectxt_of_obj s (O_fd p fd) \<noteq> None" |
|
355 |
using fd_in_cfds vd |
|
356 |
apply (rule_tac notI) |
|
357 |
by (auto dest!:current_has_sec' file_fds_subset_pfds[where p = p] intro:vd) |
|
358 |
ultimately |
|
359 |
have "sectxt_of_obj s (O_fd p fd) = Some sfd" |
|
360 |
using fd_in_cfds cfd2sfd sec |
|
361 |
apply (erule_tac x = fd in allE) |
|
362 |
apply (auto simp:cfd2sfd_def split:option.splits) |
|
363 |
done |
|
364 |
thus "\<exists> fd \<in> fds. sectxt_of_obj s (O_fd p fd) = Some sfd" |
|
365 |
using fd_in_fds |
|
366 |
by (rule_tac x = fd in bexI, auto) |
|
367 |
qed |
|
368 |
thus ?thesis by (auto simp:sectxts_of_fds_def) |
|
369 |
qed |
|
370 |
thus ?thesis using grant |
|
371 |
by (auto simp:inherit_fds_check_def inherit_fds_check_ctxt_def) |
|
372 |
qed |
|
373 |
||
77 | 374 |
|
375 |
lemma enrich_valid_intro_cons: |
|
83 | 376 |
assumes vs': "valid s'" and vd': "valid (e # s)" |
77 | 377 |
and alive: "\<forall> obj. alive s obj \<longrightarrow> alive s' obj" |
83 | 378 |
and alive': "\<forall> obj. enrich_not_alive s obj' obj \<longrightarrow> enrich_not_alive s' obj' obj" |
78 | 379 |
and hungs: "files_hung_by_del s' = files_hung_by_del s" |
77 | 380 |
and cp2sp: "\<forall> p. p \<in> current_procs s \<longrightarrow> cp2sproc s' p = cp2sproc s p" |
381 |
and cf2sf: "\<forall> f. f \<in> current_files s \<longrightarrow> cf2sfile s' f = cf2sfile s f" |
|
78 | 382 |
and cq2sq: "\<forall> q. q \<in> current_msgqs s \<longrightarrow> cq2smsgq s' q = cq2smsgq s q" |
77 | 383 |
and ffd_remain: "\<forall> p fd f. file_of_proc_fd s p fd = Some f \<longrightarrow> file_of_proc_fd s' p fd = Some f" |
78 | 384 |
and fflags_remain: "\<forall> p fd flags. flags_of_proc_fd s p fd = Some flags \<longrightarrow> flags_of_proc_fd s' p fd = Some flags" |
385 |
and sms_remain: "\<forall> q. msgs_of_queue s' q = msgs_of_queue s q" |
|
386 |
(* and empty_remain: "\<forall> f. dir_is_empty s f \<longrightarrow> dir_is_empty s' f" *) |
|
77 | 387 |
and cfd2sfd: "\<forall> p fd. fd \<in> proc_file_fds s p \<longrightarrow> cfd2sfd s' p fd = cfd2sfd s p fd" |
83 | 388 |
and nodel: "no_del_event (e # s)" |
389 |
and notin_all: "notin_all (e # s) obj'" |
|
77 | 390 |
shows "valid (e # s')" |
83 | 391 |
proof- |
392 |
from vd' have os: "os_grant s e" and grant: "grant s e" and vd: "valid s" |
|
393 |
by (auto dest:vt_grant_os vt_grant vd_cons) |
|
78 | 394 |
show ?thesis |
83 | 395 |
proof (cases e) |
396 |
case (Execve p f fds) |
|
78 | 397 |
have p_in: "p \<in> current_procs s'" using os alive |
398 |
apply (erule_tac x = "O_proc p" in allE) |
|
83 | 399 |
by (auto simp:Execve) |
78 | 400 |
have f_in: "is_file s' f" using os alive |
401 |
apply (erule_tac x = "O_file f" in allE) |
|
83 | 402 |
by (auto simp:Execve) |
403 |
have fd_in: "fds \<subseteq> proc_file_fds s' p" using os alive ffd_remain |
|
404 |
by (auto simp:Execve proc_file_fds_def) |
|
405 |
have "os_grant s' e" using p_in f_in fd_in by (simp add:Execve) |
|
406 |
moreover have "grant s' e" |
|
78 | 407 |
proof- |
408 |
from grant obtain up rp tp uf rf tf |
|
409 |
where p1: "sectxt_of_obj s (O_proc p) = Some (up, rp, tp)" |
|
410 |
and p2: "sectxt_of_obj s (O_file f) = Some (uf, rf, tf)" |
|
83 | 411 |
by (simp add:Execve split:option.splits, blast) |
412 |
with grant obtain pu nr nt where p3: "npctxt_execve (up, rp, tp) (uf, rf, tf) = Some (pu, nr, nt)" |
|
413 |
by (simp add:Execve split:option.splits del:npctxt_execve.simps, blast) |
|
78 | 414 |
from p1 have p1': "sectxt_of_obj s' (O_proc p) = Some (up, rp, tp)" |
415 |
using os cp2sp |
|
416 |
apply (erule_tac x = p in allE) |
|
83 | 417 |
by (auto simp:Execve co2sobj.simps cp2sproc_def split:option.splits) |
418 |
from os have f_in': "is_file s f" by (simp add:Execve) |
|
78 | 419 |
from vd os have "\<exists> sf. cf2sfile s f = Some sf" |
83 | 420 |
by (auto dest!:is_file_in_current current_file_has_sfile simp:Execve) |
78 | 421 |
hence p2': "sectxt_of_obj s' (O_file f) = Some (uf, rf, tf)" using f_in f_in' p2 cf2sf |
422 |
apply (erule_tac x = f in allE) |
|
423 |
apply (auto dest:is_file_in_current simp:cf2sfile_def split:option.splits) |
|
424 |
apply (case_tac f, simp) |
|
425 |
apply (drule_tac s = s in root_is_dir', simp add:vd, simp+) |
|
426 |
done |
|
83 | 427 |
have "inherit_fds_check s' (pu, nr, nt) p fds" |
428 |
proof- |
|
429 |
have "fds \<subseteq> proc_file_fds s' p" using os ffd_remain Execve |
|
430 |
by (auto simp:proc_file_fds_def) |
|
431 |
thus ?thesis using Execve grant vd cfd2sfd p1 p2 p3 os |
|
432 |
apply (rule_tac s = s in enrich_inherit_fds_check) |
|
433 |
by (simp_all split:option.splits) |
|
434 |
qed |
|
435 |
moreover have "search_check s' (pu, rp, tp) f" |
|
436 |
using p1 p2 p2' vd cf2sf f_in' grant Execve p3 f_in |
|
78 | 437 |
apply (rule_tac s = s in enrich_search_check) |
438 |
by (simp_all split:option.splits) |
|
83 | 439 |
ultimately show ?thesis using p1' p2' p3 |
440 |
apply (simp add:Execve split:option.splits) |
|
441 |
using grant Execve p1 p2 |
|
442 |
by (simp add:Execve grant p1 p2) |
|
443 |
qed |
|
444 |
ultimately show ?thesis using vs' |
|
445 |
by (erule_tac valid.intros(2), simp+) |
|
446 |
next |
|
447 |
case (Clone p p' fds) |
|
448 |
have p_in: "p \<in> current_procs s'" using os alive |
|
449 |
apply (erule_tac x = "O_proc p" in allE) |
|
450 |
by (auto simp:Clone) |
|
451 |
have p'_not_in: "p' \<notin> current_procs s'" using alive' notin_all os Clone |
|
452 |
apply (erule_tac x = "E_proc p'" in allE) |
|
453 |
apply (auto dest:not_all_procs_prop3) |
|
454 |
done |
|
455 |
have fd_in: "fds \<subseteq> proc_file_fds s' p" using os alive ffd_remain |
|
456 |
by (auto simp:Clone proc_file_fds_def) |
|
457 |
have "os_grant s' e" using p_in p'_not_in fd_in by (simp add:Clone) |
|
458 |
moreover have "grant s' e" |
|
459 |
proof- |
|
460 |
from grant obtain up rp tp |
|
461 |
where p1: "sectxt_of_obj s (O_proc p) = Some (up, rp, tp)" |
|
462 |
apply (simp add:Clone split:option.splits) |
|
463 |
by (case_tac a, auto) |
|
464 |
from p1 have p1': "sectxt_of_obj s' (O_proc p) = Some (up, rp, tp)" |
|
465 |
using os cp2sp |
|
466 |
apply (erule_tac x = p in allE) |
|
467 |
by (auto simp:Clone co2sobj.simps cp2sproc_def split:option.splits) |
|
468 |
have p2: "inherit_fds_check s' (up, rp, tp) p fds" |
|
469 |
proof- |
|
470 |
have "fds \<subseteq> proc_file_fds s' p" using os ffd_remain Clone |
|
471 |
by (auto simp:proc_file_fds_def) |
|
472 |
thus ?thesis using Clone grant vd cfd2sfd p1 os |
|
473 |
apply (rule_tac s = s in enrich_inherit_fds_check) |
|
474 |
by (simp_all split:option.splits) |
|
475 |
qed |
|
476 |
show ?thesis using p1 p2 p1' grant |
|
477 |
by (simp add:Clone) |
|
478 |
qed |
|
479 |
ultimately show ?thesis using vs' |
|
480 |
by (erule_tac valid.intros(2), simp+) |
|
481 |
next |
|
482 |
case (Kill p p') |
|
483 |
have p_in: "p \<in> current_procs s'" using os alive |
|
484 |
apply (erule_tac x = "O_proc p" in allE) |
|
485 |
by (auto simp:Kill) |
|
486 |
have p'_in: "p' \<in> current_procs s'" using os alive |
|
487 |
apply (erule_tac x = "O_proc p'" in allE) |
|
488 |
by (auto simp:Kill) |
|
489 |
have "os_grant s' e" using p_in p'_in by (simp add:Kill) |
|
490 |
moreover have "grant s' e" |
|
491 |
proof- |
|
492 |
from grant obtain up rp tp up' rp' tp' |
|
493 |
where p1: "sectxt_of_obj s (O_proc p) = Some (up, rp, tp)" |
|
494 |
and p'1: "sectxt_of_obj s (O_proc p') = Some (up', rp', tp')" |
|
495 |
apply (simp add:Kill split:option.splits) |
|
496 |
by (case_tac a, case_tac aa, blast) |
|
497 |
from p1 have p1': "sectxt_of_obj s' (O_proc p) = Some (up, rp, tp)" |
|
498 |
using os cp2sp |
|
499 |
apply (erule_tac x = p in allE) |
|
500 |
by (auto simp:Kill co2sobj.simps cp2sproc_def split:option.splits) |
|
501 |
from p'1 have p'1': "sectxt_of_obj s' (O_proc p') = Some (up', rp', tp')" |
|
502 |
using os cp2sp |
|
503 |
apply (erule_tac x = p' in allE) |
|
504 |
by (auto simp:Kill co2sobj.simps cp2sproc_def split:option.splits) |
|
505 |
show ?thesis using p1 p'1 p1' p'1' grant |
|
506 |
by (simp add:Kill) |
|
507 |
qed |
|
508 |
ultimately show ?thesis using vs' |
|
509 |
by (erule_tac valid.intros(2), simp+) |
|
510 |
next |
|
511 |
case (Ptrace p p') |
|
512 |
have p_in: "p \<in> current_procs s'" using os alive |
|
513 |
apply (erule_tac x = "O_proc p" in allE) |
|
514 |
by (auto simp:Ptrace) |
|
515 |
have p'_in: "p' \<in> current_procs s'" using os alive |
|
516 |
apply (erule_tac x = "O_proc p'" in allE) |
|
517 |
by (auto simp:Ptrace) |
|
518 |
have "os_grant s' e" using p_in p'_in by (simp add:Ptrace) |
|
519 |
moreover have "grant s' e" |
|
520 |
proof- |
|
521 |
from grant obtain up rp tp up' rp' tp' |
|
522 |
where p1: "sectxt_of_obj s (O_proc p) = Some (up, rp, tp)" |
|
523 |
and p'1: "sectxt_of_obj s (O_proc p') = Some (up', rp', tp')" |
|
524 |
apply (simp add:Ptrace split:option.splits) |
|
525 |
by (case_tac a, case_tac aa, blast) |
|
526 |
from p1 have p1': "sectxt_of_obj s' (O_proc p) = Some (up, rp, tp)" |
|
527 |
using os cp2sp |
|
528 |
apply (erule_tac x = p in allE) |
|
529 |
by (auto simp:Ptrace co2sobj.simps cp2sproc_def split:option.splits) |
|
530 |
from p'1 have p'1': "sectxt_of_obj s' (O_proc p') = Some (up', rp', tp')" |
|
531 |
using os cp2sp |
|
532 |
apply (erule_tac x = p' in allE) |
|
533 |
by (auto simp:Ptrace co2sobj.simps cp2sproc_def split:option.splits) |
|
534 |
show ?thesis using p1 p'1 p1' p'1' grant |
|
535 |
by (simp add:Ptrace) |
|
536 |
qed |
|
537 |
ultimately show ?thesis using vs' |
|
538 |
by (erule_tac valid.intros(2), simp+) |
|
539 |
next |
|
540 |
case (Exit p) |
|
541 |
have p_in: "p \<in> current_procs s'" using os alive |
|
542 |
apply (erule_tac x = "O_proc p" in allE) |
|
543 |
by (auto simp:Exit) |
|
544 |
have "os_grant s' e" using p_in by (simp add:Exit) |
|
545 |
moreover have "grant s' e" |
|
546 |
by (simp add:Exit) |
|
547 |
ultimately show ?thesis using vs' |
|
548 |
by (erule_tac valid.intros(2), simp+) |
|
549 |
next |
|
550 |
case (Open p f flags fd opt) |
|
551 |
show ?thesis |
|
552 |
proof (cases opt) |
|
553 |
case None |
|
554 |
have p_in: "p \<in> current_procs s'" using os alive |
|
555 |
apply (erule_tac x = "O_proc p" in allE) |
|
556 |
by (auto simp:Open None) |
|
557 |
have f_in: "is_file s' f" using os alive |
|
558 |
apply (erule_tac x = "O_file f" in allE) |
|
559 |
by (auto simp:Open None) |
|
560 |
have fd_not_in: "fd \<notin> current_proc_fds s' p" |
|
561 |
using os alive' p_in notin_all Open None |
|
562 |
apply (erule_tac x = "E_fd p fd" in allE) |
|
563 |
apply (case_tac obj') |
|
84
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
564 |
apply (auto dest:not_all_procs_prop3) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
565 |
done |
83 | 566 |
have "os_grant s' e" using p_in f_in fd_not_in os |
567 |
by (simp add:Open None) |
|
568 |
moreover have "grant s' e" |
|
569 |
proof- |
|
570 |
from grant obtain up rp tp uf rf tf |
|
571 |
where p1: "sectxt_of_obj s (O_proc p) = Some (up, rp, tp)" |
|
572 |
and p2: "sectxt_of_obj s (O_file f) = Some (uf, rf, tf)" |
|
573 |
apply (simp add:Open None split:option.splits) |
|
574 |
by (case_tac a, case_tac aa, blast) |
|
575 |
from p1 have p1': "sectxt_of_obj s' (O_proc p) = Some (up, rp, tp)" |
|
576 |
using os cp2sp |
|
577 |
apply (erule_tac x = p in allE) |
|
578 |
by (auto simp:Open None co2sobj.simps cp2sproc_def split:option.splits) |
|
579 |
from os have f_in': "is_file s f" by (simp add:Open None) |
|
580 |
from vd os have "\<exists> sf. cf2sfile s f = Some sf" |
|
581 |
by (auto dest!:is_file_in_current current_file_has_sfile simp:Open None) |
|
582 |
hence p2': "sectxt_of_obj s' (O_file f) = Some (uf, rf, tf)" using f_in f_in' p2 cf2sf |
|
583 |
apply (erule_tac x = f in allE) |
|
584 |
apply (auto dest:is_file_in_current simp:cf2sfile_def split:option.splits) |
|
585 |
apply (case_tac f, simp) |
|
586 |
apply (drule_tac s = s in root_is_dir', simp add:vd, simp+) |
|
587 |
done |
|
588 |
have "search_check s' (up, rp, tp) f" |
|
589 |
using p1 p2 p2' vd cf2sf f_in' grant Open None f_in |
|
590 |
apply (rule_tac s = s in enrich_search_check) |
|
591 |
by (simp_all split:option.splits) |
|
592 |
thus ?thesis using p1' p2' |
|
593 |
apply (simp add:Open None split:option.splits) |
|
594 |
using grant Open None p1 p2 |
|
595 |
by simp |
|
596 |
qed |
|
597 |
ultimately show ?thesis using vs' |
|
598 |
by (erule_tac valid.intros(2), simp+) |
|
599 |
next |
|
600 |
case (Some inum) |
|
601 |
from os obtain pf where pf_in_s: "is_dir s pf" and parent: "parent f = Some pf" |
|
602 |
by (auto simp:Open Some) |
|
603 |
have pf_in: "is_dir s' pf" using pf_in_s alive |
|
604 |
apply (erule_tac x = "O_dir pf" in allE) |
|
605 |
by simp |
|
606 |
have p_in: "p \<in> current_procs s'" using os alive |
|
607 |
apply (erule_tac x = "O_proc p" in allE) |
|
608 |
by (auto simp:Open Some) |
|
609 |
have f_not_in: "f \<notin> current_files s'" using os alive' Open Some notin_all |
|
610 |
apply (erule_tac x = "E_file f" in allE) |
|
611 |
apply (case_tac obj') |
|
612 |
by auto |
|
613 |
have fd_not_in: "fd \<notin> current_proc_fds s' p" |
|
614 |
using os alive' p_in Open Some notin_all |
|
615 |
apply (erule_tac x = "E_fd p fd" in allE) |
|
84
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
616 |
apply (case_tac obj', auto dest:not_all_procs_prop3) |
83 | 617 |
done |
618 |
have inum_not_in: "inum \<notin> current_inode_nums s'" |
|
619 |
using os alive' Open Some notin_all |
|
620 |
apply (erule_tac x = "E_inum inum" in allE) |
|
621 |
by (case_tac obj', auto) |
|
622 |
have "os_grant s' e" using p_in pf_in parent f_not_in fd_not_in inum_not_in os |
|
623 |
by (simp add:Open Some hungs) |
|
624 |
moreover have "grant s' e" |
|
625 |
proof- |
|
626 |
from grant parent obtain up rp tp uf rf tf |
|
627 |
where p1: "sectxt_of_obj s (O_proc p) = Some (up, rp, tp)" |
|
628 |
and p2: "sectxt_of_obj s (O_dir pf) = Some (uf, rf, tf)" |
|
629 |
apply (simp add:Open Some split:option.splits) |
|
630 |
by (case_tac a, case_tac aa, blast) |
|
631 |
from p1 have p1': "sectxt_of_obj s' (O_proc p) = Some (up, rp, tp)" |
|
632 |
using os cp2sp |
|
633 |
apply (erule_tac x = p in allE) |
|
634 |
by (auto simp:Open Some co2sobj.simps cp2sproc_def split:option.splits) |
|
635 |
from vd os pf_in_s have "\<exists> sf. cf2sfile s pf = Some sf" |
|
636 |
by (auto dest!:is_dir_in_current current_file_has_sfile simp:Open Some) |
|
637 |
hence p2': "sectxt_of_obj s' (O_dir pf) = Some (uf, rf, tf)" using p2 cf2sf pf_in pf_in_s |
|
638 |
apply (erule_tac x = pf in allE) |
|
639 |
apply (erule exE, frule_tac s = s in is_dir_in_current, simp) |
|
640 |
apply (drule is_dir_not_file, drule is_dir_not_file) |
|
641 |
apply (auto simp:cf2sfile_def split:option.splits) |
|
642 |
apply (case_tac pf, simp_all) |
|
643 |
by (simp add:sroot_def root_sec_remains vd vs') |
|
644 |
have "search_check s' (up, rp, tp) pf" |
|
645 |
using p1 p2 p2' vd cf2sf pf_in grant Open Some pf_in_s parent vs' |
|
646 |
apply (rule_tac s = s in enrich_search_check') |
|
647 |
by (simp_all split:option.splits) |
|
648 |
thus ?thesis using p1' p2' parent |
|
649 |
apply (simp add:Open Some split:option.splits) |
|
650 |
using grant Open Some p1 p2 |
|
651 |
by simp |
|
652 |
qed |
|
653 |
ultimately show ?thesis using vs' |
|
654 |
by (erule_tac valid.intros(2), simp+) |
|
655 |
qed |
|
656 |
next |
|
657 |
case (ReadFile p fd) |
|
658 |
have p_in: "p \<in> current_procs s'" using os alive |
|
659 |
apply (erule_tac x = "O_proc p" in allE) |
|
660 |
by (auto simp:ReadFile) |
|
661 |
have fd_in: "fd \<in> current_proc_fds s' p" using os alive |
|
662 |
apply (erule_tac x = "O_fd p fd" in allE) |
|
663 |
by (auto simp:ReadFile) |
|
664 |
obtain f where ffd: "file_of_proc_fd s p fd = Some f" |
|
665 |
using os ReadFile by auto |
|
666 |
hence f_in_s: "is_file s f" using vd |
|
667 |
by (auto intro:file_of_pfd_is_file) |
|
668 |
obtain flags where fflag: "flags_of_proc_fd s p fd = Some flags" |
|
669 |
using os ReadFile by auto |
|
670 |
have ffd_in: "file_of_proc_fd s' p fd = Some f" |
|
671 |
using ffd_remain ffd by auto |
|
672 |
hence f_in: "is_file s' f" using vs' |
|
673 |
by (auto intro:file_of_pfd_is_file) |
|
674 |
have flags_in: "flags_of_proc_fd s' p fd = Some flags" |
|
675 |
using fflags_remain fflag by auto |
|
676 |
have "os_grant s' e" using p_in fd_in ffd_in flags_in fflag os f_in |
|
677 |
by (auto simp add:ReadFile is_file_in_current) |
|
678 |
moreover have "grant s' e" |
|
679 |
proof- |
|
680 |
from grant ffd obtain up rp tp uf rf tf ufd rfd tfd |
|
681 |
where p1: "sectxt_of_obj s (O_proc p) = Some (up, rp, tp)" |
|
682 |
and p2: "sectxt_of_obj s (O_file f) = Some (uf, rf, tf)" |
|
683 |
and p3: "sectxt_of_obj s (O_fd p fd) = Some (ufd, rfd, tfd)" |
|
684 |
apply (simp add:ReadFile split:option.splits) |
|
685 |
by (case_tac a, case_tac aa, case_tac ab, blast) |
|
686 |
from p1 have p1': "sectxt_of_obj s' (O_proc p) = Some (up, rp, tp)" |
|
687 |
using os cp2sp |
|
688 |
apply (erule_tac x = p in allE) |
|
689 |
by (auto simp:ReadFile co2sobj.simps cp2sproc_def split:option.splits) |
|
690 |
from vd f_in_s have "\<exists> sf. cf2sfile s f = Some sf" |
|
691 |
by (auto dest!:is_file_in_current current_file_has_sfile) |
|
692 |
hence p2': "sectxt_of_obj s' (O_file f) = Some (uf, rf, tf)" using f_in f_in_s p2 cf2sf |
|
693 |
apply (erule_tac x = f in allE) |
|
694 |
apply (auto dest:is_file_in_current simp:cf2sfile_def split:option.splits) |
|
695 |
apply (case_tac f, simp) |
|
696 |
apply (drule_tac s = s in root_is_dir', simp add:vd, simp+) |
|
697 |
done |
|
698 |
have p3': "sectxt_of_obj s' (O_fd p fd) = Some (ufd, rfd, tfd)" |
|
699 |
using cfd2sfd ffd_in ffd p3 f_in f_in_s vd |
|
700 |
apply (erule_tac x = p in allE) |
|
701 |
apply (erule_tac x = fd in allE) |
|
702 |
apply (simp add:proc_file_fds_def) |
|
703 |
apply (auto simp:cfd2sfd_def fflag flags_in p3 split:option.splits |
|
704 |
dest!:current_file_has_sfile' simp:is_file_in_current) |
|
705 |
done |
|
706 |
show ?thesis using p1' p2' p3' ffd_in ffd |
|
707 |
apply (simp add:ReadFile split:option.splits) |
|
708 |
using grant p1 p2 p3 ReadFile |
|
78 | 709 |
by simp |
710 |
qed |
|
711 |
ultimately show ?thesis using vs' |
|
712 |
by (erule_tac valid.intros(2), simp+) |
|
713 |
next |
|
83 | 714 |
case (WriteFile p fd) |
715 |
have p_in: "p \<in> current_procs s'" using os alive |
|
716 |
apply (erule_tac x = "O_proc p" in allE) |
|
717 |
by (auto simp:WriteFile) |
|
718 |
have fd_in: "fd \<in> current_proc_fds s' p" using os alive |
|
719 |
apply (erule_tac x = "O_fd p fd" in allE) |
|
720 |
by (auto simp:WriteFile) |
|
721 |
obtain f where ffd: "file_of_proc_fd s p fd = Some f" |
|
722 |
using os WriteFile by auto |
|
723 |
hence f_in_s: "is_file s f" using vd |
|
724 |
by (auto intro:file_of_pfd_is_file) |
|
725 |
obtain flags where fflag: "flags_of_proc_fd s p fd = Some flags" |
|
726 |
using os WriteFile by auto |
|
727 |
have ffd_in: "file_of_proc_fd s' p fd = Some f" |
|
728 |
using ffd_remain ffd by auto |
|
729 |
hence f_in: "is_file s' f" using vs' |
|
730 |
by (auto intro:file_of_pfd_is_file) |
|
731 |
have flags_in: "flags_of_proc_fd s' p fd = Some flags" |
|
732 |
using fflags_remain fflag by auto |
|
733 |
have "os_grant s' e" using p_in fd_in ffd_in flags_in fflag os f_in |
|
734 |
by (auto simp add:WriteFile is_file_in_current) |
|
735 |
moreover have "grant s' e" |
|
736 |
proof- |
|
737 |
from grant ffd obtain up rp tp uf rf tf ufd rfd tfd |
|
738 |
where p1: "sectxt_of_obj s (O_proc p) = Some (up, rp, tp)" |
|
739 |
and p2: "sectxt_of_obj s (O_file f) = Some (uf, rf, tf)" |
|
740 |
and p3: "sectxt_of_obj s (O_fd p fd) = Some (ufd, rfd, tfd)" |
|
741 |
apply (simp add:WriteFile split:option.splits) |
|
742 |
by (case_tac a, case_tac aa, case_tac ab, blast) |
|
743 |
from p1 have p1': "sectxt_of_obj s' (O_proc p) = Some (up, rp, tp)" |
|
744 |
using os cp2sp |
|
745 |
apply (erule_tac x = p in allE) |
|
746 |
by (auto simp:WriteFile co2sobj.simps cp2sproc_def split:option.splits) |
|
747 |
from vd f_in_s have "\<exists> sf. cf2sfile s f = Some sf" |
|
748 |
by (auto dest!:is_file_in_current current_file_has_sfile) |
|
749 |
hence p2': "sectxt_of_obj s' (O_file f) = Some (uf, rf, tf)" using f_in f_in_s p2 cf2sf |
|
750 |
apply (erule_tac x = f in allE) |
|
751 |
apply (auto dest:is_file_in_current simp:cf2sfile_def split:option.splits) |
|
752 |
apply (case_tac f, simp) |
|
753 |
apply (drule_tac s = s in root_is_dir', simp add:vd, simp+) |
|
754 |
done |
|
755 |
have p3': "sectxt_of_obj s' (O_fd p fd) = Some (ufd, rfd, tfd)" |
|
756 |
using cfd2sfd ffd_in ffd p3 f_in f_in_s vd |
|
757 |
apply (erule_tac x = p in allE) |
|
758 |
apply (erule_tac x = fd in allE) |
|
759 |
apply (simp add:proc_file_fds_def) |
|
760 |
apply (auto simp:cfd2sfd_def fflag flags_in p3 split:option.splits |
|
761 |
dest!:current_file_has_sfile' simp:is_file_in_current) |
|
762 |
done |
|
763 |
show ?thesis using p1' p2' p3' ffd_in ffd |
|
764 |
apply (simp add:WriteFile split:option.splits) |
|
765 |
using grant p1 p2 p3 WriteFile |
|
766 |
by simp |
|
767 |
qed |
|
768 |
ultimately show ?thesis using vs' |
|
769 |
by (erule_tac valid.intros(2), simp+) |
|
770 |
next |
|
771 |
case (CloseFd p fd) |
|
772 |
have p_in: "p \<in> current_procs s'" using os alive |
|
773 |
apply (erule_tac x = "O_proc p" in allE) |
|
774 |
by (auto simp:CloseFd) |
|
775 |
have fd_in: "fd \<in> current_proc_fds s' p" using os alive |
|
776 |
apply (erule_tac x = "O_fd p fd" in allE) |
|
777 |
by (auto simp:CloseFd) |
|
778 |
have "os_grant s' e" using p_in fd_in |
|
779 |
by (auto simp add:CloseFd) |
|
780 |
moreover have "grant s' e" |
|
781 |
by(simp add:CloseFd) |
|
782 |
ultimately show ?thesis using vs' |
|
783 |
by (erule_tac valid.intros(2), simp+) |
|
784 |
next |
|
785 |
case (UnLink p f) |
|
786 |
have p_in: "p \<in> current_procs s'" using os alive |
|
787 |
apply (erule_tac x = "O_proc p" in allE) |
|
788 |
by (auto simp:UnLink) |
|
789 |
have f_in: "is_file s' f" using os alive |
|
790 |
apply (erule_tac x = "O_file f" in allE) |
|
791 |
by (auto simp:UnLink) |
|
792 |
from os vd obtain pf where pf_in_s: "is_dir s pf" |
|
793 |
and parent: "parent f = Some pf" |
|
794 |
by (auto simp:UnLink dest!:file_has_parent) |
|
795 |
from pf_in_s alive have pf_in: "is_dir s' pf" |
|
796 |
apply (erule_tac x = "O_dir pf" in allE) |
|
797 |
by (auto simp:UnLink) |
|
798 |
have "os_grant s' e" using p_in f_in os |
|
799 |
by (simp add:UnLink hungs) |
|
800 |
moreover have "grant s' e" |
|
801 |
proof- |
|
802 |
from grant parent obtain up rp tp uf rf tf upf rpf tpf |
|
803 |
where p1: "sectxt_of_obj s (O_proc p) = Some (up, rp, tp)" |
|
804 |
and p2: "sectxt_of_obj s (O_file f) = Some (uf, rf, tf)" |
|
805 |
and p3: "sectxt_of_obj s (O_dir pf) = Some (upf, rpf, tpf)" |
|
806 |
apply (simp add:UnLink split:option.splits) |
|
807 |
by (case_tac a, case_tac aa, case_tac ab, blast) |
|
808 |
from p1 have p1': "sectxt_of_obj s' (O_proc p) = Some (up, rp, tp)" |
|
809 |
using os cp2sp |
|
810 |
apply (erule_tac x = p in allE) |
|
811 |
by (auto simp:UnLink co2sobj.simps cp2sproc_def split:option.splits) |
|
812 |
from vd os pf_in_s have "\<exists> sf. cf2sfile s f = Some sf" |
|
813 |
by (auto dest!:is_file_in_current current_file_has_sfile simp:UnLink) |
|
814 |
hence p2': "sectxt_of_obj s' (O_file f) = Some (uf, rf, tf)" |
|
815 |
using p2 cf2sf f_in os parent |
|
816 |
apply (erule_tac x = f in allE) |
|
817 |
apply (erule exE, clarsimp simp:UnLink) |
|
818 |
apply (frule_tac s = s in is_file_in_current, simp) |
|
819 |
by (auto simp:cf2sfile_def split:option.splits) |
|
820 |
from vd os pf_in_s have "\<exists> sf. cf2sfile s pf = Some sf" |
|
821 |
by (auto dest!:is_dir_in_current current_file_has_sfile simp:UnLink) |
|
822 |
hence p3': "sectxt_of_obj s' (O_dir pf) = Some (upf, rpf, tpf)" using p3 cf2sf pf_in pf_in_s |
|
823 |
apply (erule_tac x = pf in allE) |
|
824 |
apply (erule exE, frule_tac s = s in is_dir_in_current, simp) |
|
825 |
apply (drule is_dir_not_file, drule is_dir_not_file) |
|
826 |
apply (auto simp:cf2sfile_def split:option.splits) |
|
827 |
apply (case_tac pf, simp_all) |
|
828 |
by (simp add:sroot_def root_sec_remains vd vs') |
|
829 |
have "search_check s' (up, rp, tp) f" |
|
830 |
using p1 p2 p2' vd cf2sf f_in grant UnLink os parent vs' |
|
831 |
apply (rule_tac s = s in enrich_search_check) |
|
832 |
by (simp_all split:option.splits) |
|
833 |
thus ?thesis using p1' p2' p3' parent |
|
834 |
apply (simp add:UnLink split:option.splits) |
|
835 |
using grant UnLink p1 p2 p3 |
|
836 |
by simp |
|
837 |
qed |
|
838 |
ultimately show ?thesis using vs' |
|
839 |
by (erule_tac valid.intros(2), simp+) |
|
840 |
next |
|
841 |
case (Rmdir p f) |
|
842 |
have p_in: "p \<in> current_procs s'" using os alive |
|
843 |
apply (erule_tac x = "O_proc p" in allE) |
|
844 |
by (auto simp:Rmdir) |
|
845 |
have f_in: "is_dir s' f" using os alive |
|
846 |
apply (erule_tac x = "O_dir f" in allE) |
|
847 |
by (auto simp:Rmdir dir_is_empty_def) |
|
848 |
have not_root: "f \<noteq> []" using os |
|
849 |
by (auto simp:Rmdir) |
|
850 |
from os vd obtain pf where pf_in_s: "is_dir s pf" |
|
851 |
and parent: "parent f = Some pf" |
|
852 |
apply (auto simp:Rmdir dir_is_empty_def) |
|
853 |
apply (case_tac f, simp+) |
|
854 |
apply (drule parentf_is_dir_prop1, auto) |
|
855 |
done |
|
856 |
from pf_in_s alive have pf_in: "is_dir s' pf" |
|
857 |
apply (erule_tac x = "O_dir pf" in allE) |
|
858 |
by (auto simp:Rmdir) |
|
859 |
have empty_in: "dir_is_empty s' f" using os Rmdir notin_all |
|
860 |
apply (clarsimp simp add:dir_is_empty_def f_in) |
|
861 |
using alive' |
|
862 |
apply (erule_tac x = "E_file f'" in allE) |
|
863 |
apply simp |
|
864 |
apply (erule disjE) |
|
865 |
apply (erule_tac x = f' in allE, simp) |
|
866 |
apply (case_tac obj', simp_all) |
|
867 |
apply (clarsimp) |
|
868 |
apply (drule_tac f' = f in parent_ancen) |
|
869 |
apply (simp, rule notI, simp add:noJ_Anc) |
|
870 |
apply (case_tac "f = pf") |
|
871 |
using vd' Rmdir |
|
872 |
apply (simp_all add:is_dir_rmdir) |
|
873 |
apply (erule_tac x = pf in allE) |
|
874 |
apply (drule_tac f = pf in is_dir_in_current) |
|
875 |
apply (simp add:noJ_Anc) |
|
876 |
done |
|
877 |
have "os_grant s' e" using p_in f_in os empty_in |
|
878 |
by (simp add:Rmdir hungs) |
|
879 |
moreover have "grant s' e" |
|
880 |
proof- |
|
881 |
from grant parent obtain up rp tp uf rf tf upf rpf tpf |
|
882 |
where p1: "sectxt_of_obj s (O_proc p) = Some (up, rp, tp)" |
|
883 |
and p2: "sectxt_of_obj s (O_dir f) = Some (uf, rf, tf)" |
|
884 |
and p3: "sectxt_of_obj s (O_dir pf) = Some (upf, rpf, tpf)" |
|
885 |
apply (simp add:Rmdir split:option.splits) |
|
886 |
by (case_tac a, case_tac aa, case_tac ab, blast) |
|
887 |
from p1 have p1': "sectxt_of_obj s' (O_proc p) = Some (up, rp, tp)" |
|
888 |
using os cp2sp |
|
889 |
apply (erule_tac x = p in allE) |
|
890 |
by (auto simp:Rmdir co2sobj.simps cp2sproc_def split:option.splits) |
|
891 |
from vd os pf_in_s have "\<exists> sf. cf2sfile s f = Some sf" |
|
892 |
by (auto dest!:is_dir_in_current current_file_has_sfile simp:dir_is_empty_def Rmdir) |
|
893 |
hence p2': "sectxt_of_obj s' (O_dir f) = Some (uf, rf, tf)" |
|
894 |
using p2 cf2sf f_in os parent |
|
895 |
apply (erule_tac x = f in allE) |
|
896 |
apply (erule exE, clarsimp simp:Rmdir dir_is_empty_def) |
|
897 |
apply (frule_tac s = s in is_dir_in_current, simp) |
|
898 |
apply (drule is_dir_not_file, drule is_dir_not_file) |
|
899 |
by (auto simp:cf2sfile_def split:option.splits) |
|
900 |
from vd os pf_in_s have "\<exists> sf. cf2sfile s pf = Some sf" |
|
901 |
by (auto dest!:is_dir_in_current current_file_has_sfile simp:Rmdir) |
|
902 |
hence p3': "sectxt_of_obj s' (O_dir pf) = Some (upf, rpf, tpf)" using p3 cf2sf pf_in pf_in_s |
|
903 |
apply (erule_tac x = pf in allE) |
|
904 |
apply (erule exE, frule_tac s = s in is_dir_in_current, simp) |
|
905 |
apply (drule is_dir_not_file, drule is_dir_not_file) |
|
906 |
apply (auto simp:cf2sfile_def split:option.splits) |
|
907 |
apply (case_tac pf, simp_all) |
|
908 |
by (simp add:sroot_def root_sec_remains vd vs') |
|
909 |
have "search_check s' (up, rp, tp) f" |
|
910 |
using p1 p2 p2' vd cf2sf f_in grant Rmdir os parent vs' |
|
911 |
apply (rule_tac s = s in enrich_search_check') |
|
912 |
by (simp_all add:dir_is_empty_def split:option.splits) |
|
913 |
thus ?thesis using p1' p2' p3' parent |
|
914 |
apply (simp add:Rmdir split:option.splits) |
|
915 |
using grant Rmdir p1 p2 p3 |
|
916 |
by simp |
|
917 |
qed |
|
918 |
ultimately show ?thesis using vs' |
|
919 |
by (erule_tac valid.intros(2), simp+) |
|
920 |
next |
|
921 |
case (Mkdir p f inum) |
|
78 | 922 |
from os obtain pf where pf_in_s: "is_dir s pf" and parent: "parent f = Some pf" |
83 | 923 |
by (auto simp:Mkdir) |
78 | 924 |
have pf_in: "is_dir s' pf" using pf_in_s alive |
925 |
apply (erule_tac x = "O_dir pf" in allE) |
|
926 |
by simp |
|
927 |
have p_in: "p \<in> current_procs s'" using os alive |
|
928 |
apply (erule_tac x = "O_proc p" in allE) |
|
83 | 929 |
by (auto simp:Mkdir) |
930 |
have f_not_in: "f \<notin> current_files s'" using os alive' Mkdir notin_all |
|
78 | 931 |
apply (erule_tac x = "E_file f" in allE) |
83 | 932 |
by (auto) |
78 | 933 |
have inum_not_in: "inum \<notin> current_inode_nums s'" |
83 | 934 |
using os alive' Mkdir notin_all |
78 | 935 |
apply (erule_tac x = "E_inum inum" in allE) |
83 | 936 |
by (auto) |
937 |
have "os_grant s' e" using p_in pf_in parent f_not_in os inum_not_in |
|
938 |
by (simp add:Mkdir hungs) |
|
78 | 939 |
moreover have "grant s' e" |
940 |
proof- |
|
941 |
from grant parent obtain up rp tp uf rf tf |
|
942 |
where p1: "sectxt_of_obj s (O_proc p) = Some (up, rp, tp)" |
|
943 |
and p2: "sectxt_of_obj s (O_dir pf) = Some (uf, rf, tf)" |
|
83 | 944 |
apply (simp add:Mkdir split:option.splits) |
78 | 945 |
by (case_tac a, case_tac aa, blast) |
946 |
from p1 have p1': "sectxt_of_obj s' (O_proc p) = Some (up, rp, tp)" |
|
947 |
using os cp2sp |
|
948 |
apply (erule_tac x = p in allE) |
|
83 | 949 |
by (auto simp:Mkdir co2sobj.simps cp2sproc_def split:option.splits) |
78 | 950 |
from vd os pf_in_s have "\<exists> sf. cf2sfile s pf = Some sf" |
83 | 951 |
by (auto dest!:is_dir_in_current current_file_has_sfile simp:Mkdir) |
78 | 952 |
hence p2': "sectxt_of_obj s' (O_dir pf) = Some (uf, rf, tf)" using p2 cf2sf pf_in pf_in_s |
953 |
apply (erule_tac x = pf in allE) |
|
954 |
apply (erule exE, frule_tac s = s in is_dir_in_current, simp) |
|
955 |
apply (drule is_dir_not_file, drule is_dir_not_file) |
|
956 |
apply (auto simp:cf2sfile_def split:option.splits) |
|
957 |
apply (case_tac pf, simp_all) |
|
958 |
by (simp add:sroot_def root_sec_remains vd vs') |
|
959 |
have "search_check s' (up, rp, tp) pf" |
|
83 | 960 |
using p1 p2 p2' vd cf2sf pf_in grant Mkdir pf_in_s parent vs' |
78 | 961 |
apply (rule_tac s = s in enrich_search_check') |
83 | 962 |
apply (simp_all split:option.splits) |
963 |
done |
|
964 |
thus ?thesis using p1' p2' parent |
|
965 |
apply (simp add:Mkdir split:option.splits) |
|
966 |
using grant Mkdir p1 p2 |
|
967 |
apply simp |
|
968 |
done |
|
969 |
qed |
|
970 |
ultimately show ?thesis using vs' |
|
971 |
by (erule_tac valid.intros(2), simp+) |
|
972 |
next |
|
973 |
case (LinkHard p f f') |
|
974 |
from os obtain pf where pf_in_s: "is_dir s pf" and parent: "parent f' = Some pf" |
|
975 |
by (auto simp:LinkHard) |
|
976 |
have pf_in: "is_dir s' pf" using pf_in_s alive |
|
977 |
apply (erule_tac x = "O_dir pf" in allE) |
|
978 |
by simp |
|
979 |
have p_in: "p \<in> current_procs s'" using os alive |
|
980 |
apply (erule_tac x = "O_proc p" in allE) |
|
981 |
by (auto simp:LinkHard) |
|
982 |
have f'_not_in: "f' \<notin> current_files s'" using os alive' LinkHard notin_all |
|
983 |
apply (erule_tac x = "E_file f'" in allE) |
|
984 |
by (auto simp:LinkHard) |
|
985 |
have f_in: "is_file s' f" using os alive |
|
986 |
apply (erule_tac x = "O_file f" in allE) |
|
987 |
by (auto simp:LinkHard) |
|
988 |
have "os_grant s' e" using p_in pf_in parent os f_in f'_not_in |
|
989 |
by (simp add:LinkHard hungs) |
|
990 |
moreover have "grant s' e" |
|
991 |
proof- |
|
992 |
from grant parent obtain up rp tp uf rf tf upf rpf tpf |
|
993 |
where p1: "sectxt_of_obj s (O_proc p) = Some (up, rp, tp)" |
|
994 |
and p2: "sectxt_of_obj s (O_file f) = Some (uf, rf, tf)" |
|
995 |
and p3: "sectxt_of_obj s (O_dir pf) = Some (upf, rpf, tpf)" |
|
996 |
apply (simp add:LinkHard split:option.splits) |
|
997 |
by (case_tac a, case_tac aa, case_tac ab, blast) |
|
998 |
from p1 have p1': "sectxt_of_obj s' (O_proc p) = Some (up, rp, tp)" |
|
999 |
using os cp2sp |
|
1000 |
apply (erule_tac x = p in allE) |
|
1001 |
by (auto simp:LinkHard co2sobj.simps cp2sproc_def split:option.splits) |
|
1002 |
from vd os pf_in_s have "\<exists> sf. cf2sfile s f = Some sf" |
|
1003 |
by (auto dest!:is_file_in_current current_file_has_sfile simp:LinkHard) |
|
1004 |
hence p2': "sectxt_of_obj s' (O_file f) = Some (uf, rf, tf)" |
|
1005 |
using p2 cf2sf f_in os parent |
|
1006 |
apply (erule_tac x = f in allE) |
|
1007 |
apply (erule exE, clarsimp simp:LinkHard) |
|
1008 |
apply (frule_tac s = s in is_file_in_current, simp) |
|
1009 |
apply (auto simp:cf2sfile_def split:option.splits) |
|
1010 |
apply (case_tac f, simp) |
|
1011 |
by (drule_tac s = s in root_is_dir', simp add:vd, simp+) |
|
1012 |
from vd os pf_in_s have "\<exists> sf. cf2sfile s pf = Some sf" |
|
1013 |
by (auto dest!:is_dir_in_current current_file_has_sfile simp:LinkHard) |
|
1014 |
hence p3': "sectxt_of_obj s' (O_dir pf) = Some (upf, rpf, tpf)" using p3 cf2sf pf_in pf_in_s |
|
1015 |
apply (erule_tac x = pf in allE) |
|
1016 |
apply (erule exE, frule_tac s = s in is_dir_in_current, simp) |
|
1017 |
apply (drule is_dir_not_file, drule is_dir_not_file) |
|
1018 |
apply (auto simp:cf2sfile_def split:option.splits) |
|
1019 |
apply (case_tac pf, simp_all) |
|
1020 |
by (simp add:sroot_def root_sec_remains vd vs') |
|
1021 |
have "search_check s' (up, rp, tp) f" |
|
1022 |
using p1 p2 p2' vd cf2sf f_in grant LinkHard os parent vs' |
|
1023 |
apply (rule_tac s = s in enrich_search_check) |
|
78 | 1024 |
by (simp_all split:option.splits) |
83 | 1025 |
moreover have "search_check s' (up, rp, tp) pf" |
1026 |
using p1 p3 p3' vd cf2sf pf_in grant LinkHard os parent vs' |
|
1027 |
apply (rule_tac s = s in enrich_search_check') |
|
1028 |
apply (simp_all split:option.splits) |
|
1029 |
done |
|
1030 |
ultimately show ?thesis using p1' p2' p3' parent |
|
1031 |
apply (simp add:LinkHard split:option.splits) |
|
1032 |
using grant LinkHard p1 p2 p3 |
|
1033 |
apply simp |
|
1034 |
done |
|
1035 |
qed |
|
1036 |
ultimately show ?thesis using vs' |
|
1037 |
by (erule_tac valid.intros(2), simp+) |
|
1038 |
next |
|
1039 |
case (Truncate p f len) |
|
1040 |
have p_in: "p \<in> current_procs s'" using os alive |
|
1041 |
apply (erule_tac x = "O_proc p" in allE) |
|
1042 |
by (auto simp:Truncate) |
|
1043 |
have f_in: "is_file s' f" using os alive |
|
1044 |
apply (erule_tac x = "O_file f" in allE) |
|
1045 |
by (auto simp:Truncate) |
|
1046 |
have "os_grant s' e" using p_in f_in by (simp add:Truncate) |
|
1047 |
moreover have "grant s' e" |
|
1048 |
proof- |
|
1049 |
from grant obtain up rp tp uf rf tf |
|
1050 |
where p1: "sectxt_of_obj s (O_proc p) = Some (up, rp, tp)" |
|
1051 |
and p2: "sectxt_of_obj s (O_file f) = Some (uf, rf, tf)" |
|
1052 |
apply (simp add:Truncate split:option.splits) |
|
1053 |
by (case_tac a, case_tac aa, blast) |
|
1054 |
from p1 have p1': "sectxt_of_obj s' (O_proc p) = Some (up, rp, tp)" |
|
1055 |
using os cp2sp |
|
1056 |
apply (erule_tac x = p in allE) |
|
1057 |
by (auto simp:Truncate co2sobj.simps cp2sproc_def split:option.splits) |
|
1058 |
from os have f_in': "is_file s f" by (simp add:Truncate) |
|
1059 |
from vd os have "\<exists> sf. cf2sfile s f = Some sf" |
|
1060 |
by (auto dest!:is_file_in_current current_file_has_sfile simp:Truncate) |
|
1061 |
hence p2': "sectxt_of_obj s' (O_file f) = Some (uf, rf, tf)" using f_in f_in' p2 cf2sf |
|
1062 |
apply (erule_tac x = f in allE) |
|
1063 |
apply (auto dest:is_file_in_current simp:cf2sfile_def split:option.splits) |
|
1064 |
apply (case_tac f, simp) |
|
1065 |
apply (drule_tac s = s in root_is_dir', simp add:vd, simp+) |
|
1066 |
done |
|
1067 |
have "search_check s' (up, rp, tp) f" |
|
1068 |
using p1 p2 p2' vd cf2sf f_in' grant Truncate f_in |
|
1069 |
apply (rule_tac s = s in enrich_search_check) |
|
1070 |
by (simp_all split:option.splits) |
|
1071 |
thus ?thesis using p1' p2' |
|
1072 |
apply (simp add:Truncate split:option.splits) |
|
1073 |
using grant Truncate p1 p2 |
|
1074 |
by (simp add:Truncate grant p1 p2) |
|
1075 |
qed |
|
1076 |
ultimately show ?thesis using vs' |
|
1077 |
by (erule_tac valid.intros(2), simp+) |
|
1078 |
next |
|
1079 |
case (CreateMsgq p q) |
|
1080 |
have p_in: "p \<in> current_procs s'" using os alive |
|
1081 |
apply (erule_tac x = "O_proc p" in allE) |
|
1082 |
by (auto simp:CreateMsgq) |
|
1083 |
have q_not_in: "q \<notin> current_msgqs s'" using os alive' CreateMsgq notin_all |
|
1084 |
apply (erule_tac x = "E_msgq q" in allE) |
|
1085 |
by auto |
|
1086 |
have "os_grant s' e" using p_in q_not_in by (simp add:CreateMsgq) |
|
1087 |
moreover have "grant s' e" |
|
1088 |
proof- |
|
1089 |
from grant obtain up rp tp |
|
1090 |
where p1: "sectxt_of_obj s (O_proc p) = Some (up, rp, tp)" |
|
1091 |
apply (simp add:CreateMsgq split:option.splits) |
|
1092 |
by (case_tac a, blast) |
|
1093 |
from p1 have p1': "sectxt_of_obj s' (O_proc p) = Some (up, rp, tp)" |
|
1094 |
using os cp2sp |
|
1095 |
apply (erule_tac x = p in allE) |
|
1096 |
by (auto simp:CreateMsgq co2sobj.simps cp2sproc_def split:option.splits) |
|
1097 |
show ?thesis using p1' |
|
1098 |
apply (simp add:CreateMsgq split:option.splits) |
|
1099 |
using grant CreateMsgq p1 |
|
78 | 1100 |
by simp |
1101 |
qed |
|
1102 |
ultimately show ?thesis using vs' |
|
1103 |
by (erule_tac valid.intros(2), simp+) |
|
83 | 1104 |
next |
1105 |
case (RemoveMsgq p q) |
|
1106 |
have p_in: "p \<in> current_procs s'" using os alive |
|
1107 |
apply (erule_tac x = "O_proc p" in allE) |
|
1108 |
by (auto simp:RemoveMsgq) |
|
1109 |
have q_in: "q \<in> current_msgqs s'" using os alive |
|
1110 |
apply (erule_tac x = "O_msgq q" in allE) |
|
78 | 1111 |
by (simp add:RemoveMsgq) |
83 | 1112 |
have "os_grant s' e" using p_in q_in by (simp add:RemoveMsgq) |
1113 |
moreover have "grant s' e" |
|
1114 |
proof- |
|
1115 |
from grant obtain up rp tp uq rq tq |
|
1116 |
where p1: "sectxt_of_obj s (O_proc p) = Some (up, rp, tp)" |
|
1117 |
and p2: "sectxt_of_obj s (O_msgq q) = Some (uq, rq, tq)" |
|
1118 |
apply (simp add:RemoveMsgq split:option.splits) |
|
1119 |
by (case_tac a, case_tac aa, blast) |
|
1120 |
from p1 have p1': "sectxt_of_obj s' (O_proc p) = Some (up, rp, tp)" |
|
1121 |
using os cp2sp |
|
1122 |
apply (erule_tac x = p in allE) |
|
1123 |
by (auto simp:RemoveMsgq co2sobj.simps cp2sproc_def split:option.splits) |
|
1124 |
from p2 have p2': "sectxt_of_obj s' (O_msgq q) = Some (uq, rq, tq)" |
|
1125 |
using os cq2sq vd |
|
1126 |
apply (erule_tac x = q in allE) |
|
1127 |
by (auto simp:RemoveMsgq co2sobj.simps cq2smsgq_def dest!:current_has_sms' split:option.splits) |
|
1128 |
show ?thesis using p1' p2' grant p1 p2 |
|
1129 |
by (simp add:RemoveMsgq) |
|
1130 |
qed |
|
1131 |
ultimately show ?thesis using vs' |
|
1132 |
by (erule_tac valid.intros(2), simp+) |
|
1133 |
next |
|
1134 |
case (SendMsg p q m) |
|
1135 |
have p_in: "p \<in> current_procs s'" using os alive |
|
1136 |
apply (erule_tac x = "O_proc p" in allE) |
|
1137 |
by (auto simp:SendMsg) |
|
1138 |
have q_in: "q \<in> current_msgqs s'" using os alive |
|
1139 |
apply (erule_tac x = "O_msgq q" in allE) |
|
1140 |
by (simp add:SendMsg) |
|
1141 |
have m_not_in: "m \<notin> set (msgs_of_queue s' q)" using os alive' notin_all SendMsg q_in |
|
1142 |
apply (erule_tac x = "E_msg q m" in allE) |
|
84
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
1143 |
apply (case_tac obj', auto dest:not_all_msgqs_prop3) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
1144 |
done |
83 | 1145 |
have "os_grant s' e" using p_in q_in m_not_in |
78 | 1146 |
by (simp add:SendMsg) |
83 | 1147 |
moreover have "grant s' e" |
1148 |
proof- |
|
1149 |
from grant obtain up rp tp uq rq tq |
|
1150 |
where p1: "sectxt_of_obj s (O_proc p) = Some (up, rp, tp)" |
|
1151 |
and p2: "sectxt_of_obj s (O_msgq q) = Some (uq, rq, tq)" |
|
1152 |
apply (simp add:SendMsg split:option.splits) |
|
1153 |
by (case_tac a, case_tac aa, blast) |
|
1154 |
from p1 have p1': "sectxt_of_obj s' (O_proc p) = Some (up, rp, tp)" |
|
1155 |
using os cp2sp |
|
1156 |
apply (erule_tac x = p in allE) |
|
1157 |
by (auto simp:SendMsg co2sobj.simps cp2sproc_def split:option.splits) |
|
1158 |
from p2 have p2': "sectxt_of_obj s' (O_msgq q) = Some (uq, rq, tq)" |
|
1159 |
using os cq2sq vd |
|
1160 |
apply (erule_tac x = q in allE) |
|
1161 |
by (auto simp:SendMsg co2sobj.simps cq2smsgq_def dest!:current_has_sms' split:option.splits) |
|
1162 |
show ?thesis using p1' p2' grant p1 p2 |
|
1163 |
by (simp add:SendMsg) |
|
1164 |
qed |
|
1165 |
ultimately show ?thesis using vs' |
|
1166 |
by (erule_tac valid.intros(2), simp+) |
|
1167 |
next |
|
1168 |
case (RecvMsg p q m) |
|
1169 |
have p_in: "p \<in> current_procs s'" using os alive |
|
1170 |
apply (erule_tac x = "O_proc p" in allE) |
|
1171 |
by (auto simp:RecvMsg) |
|
1172 |
have q_in: "q \<in> current_msgqs s'" using os alive |
|
1173 |
apply (erule_tac x = "O_msgq q" in allE) |
|
1174 |
by (simp add:RecvMsg) |
|
1175 |
have m_in: "m = hd (msgs_of_queue s' q)" |
|
1176 |
and sms_not_empty: "msgs_of_queue s' q \<noteq> []" |
|
1177 |
using os sms_remain |
|
1178 |
by (auto simp:RecvMsg) |
|
1179 |
have "os_grant s' e" using p_in q_in m_in sms_not_empty os |
|
78 | 1180 |
by (simp add:RecvMsg) |
83 | 1181 |
moreover have "grant s' e" |
1182 |
proof- |
|
1183 |
from grant obtain up rp tp uq rq tq um rm tm |
|
1184 |
where p1: "sectxt_of_obj s (O_proc p) = Some (up, rp, tp)" |
|
1185 |
and p2: "sectxt_of_obj s (O_msgq q) = Some (uq, rq, tq)" |
|
1186 |
and p3: "sectxt_of_obj s (O_msg q m) = Some (um, rm, tm)" |
|
1187 |
apply (simp add:RecvMsg split:option.splits) |
|
1188 |
by (case_tac a, case_tac aa, case_tac ab, blast) |
|
1189 |
from p1 have p1': "sectxt_of_obj s' (O_proc p) = Some (up, rp, tp)" |
|
1190 |
using os cp2sp |
|
1191 |
apply (erule_tac x = p in allE) |
|
1192 |
by (auto simp:RecvMsg co2sobj.simps cp2sproc_def split:option.splits) |
|
1193 |
from p2 have p2': "sectxt_of_obj s' (O_msgq q) = Some (uq, rq, tq)" |
|
1194 |
using os cq2sq vd |
|
1195 |
apply (erule_tac x = q in allE) |
|
1196 |
by (auto simp:RecvMsg co2sobj.simps cq2smsgq_def dest!:current_has_sms' split:option.splits) |
|
1197 |
from p3 have p3': "sectxt_of_obj s' (O_msg q m) = Some (um, rm, tm)" |
|
1198 |
using sms_remain cq2sq vd os p2 p2' p3 |
|
1199 |
apply (erule_tac x = q in allE) |
|
1200 |
apply (erule_tac x = q in allE) |
|
1201 |
apply (clarsimp simp:RecvMsg) |
|
1202 |
apply (simp add:cq2smsgq_def split:option.splits if_splits) |
|
1203 |
apply (drule current_has_sms', simp, simp) |
|
1204 |
apply (case_tac "msgs_of_queue s q", simp) |
|
1205 |
apply (simp add:cqm2sms.simps split:option.splits) |
|
1206 |
apply (auto simp add:cm2smsg_def split:option.splits if_splits)[1] |
|
1207 |
apply (case_tac "msgs_of_queue s q", simp) |
|
1208 |
apply (simp add:cqm2sms.simps split:option.splits) |
|
1209 |
apply (auto simp add:cm2smsg_def split:option.splits if_splits)[1] |
|
1210 |
done |
|
1211 |
show ?thesis using p1' p2' p3' grant p1 p2 p3 |
|
1212 |
by (simp add:RecvMsg) |
|
1213 |
qed |
|
1214 |
ultimately show ?thesis using vs' |
|
1215 |
by (erule_tac valid.intros(2), simp+) |
|
1216 |
next |
|
1217 |
case (CreateSock p af st fd inum) |
|
1218 |
show ?thesis using grant |
|
1219 |
by (simp add:CreateSock) |
|
1220 |
next |
|
1221 |
case (Bind p fd addr) |
|
1222 |
show ?thesis using grant |
|
1223 |
by (simp add:Bind) |
|
1224 |
next |
|
1225 |
case (Connect p fd addr) |
|
1226 |
show ?thesis using grant |
|
1227 |
by (simp add:Connect) |
|
1228 |
next |
|
1229 |
case (Listen p fd) |
|
1230 |
show ?thesis using grant |
|
1231 |
by (simp add:Listen) |
|
1232 |
next |
|
1233 |
case (Accept p fd addr port fd' inum) |
|
1234 |
show ?thesis using grant |
|
1235 |
by (simp add:Accept) |
|
1236 |
next |
|
1237 |
case (SendSock p fd) |
|
1238 |
show ?thesis using grant |
|
1239 |
by (simp add:SendSock) |
|
1240 |
next |
|
1241 |
case (RecvSock p fd) |
|
1242 |
show ?thesis using grant |
|
1243 |
by (simp add:RecvSock) |
|
1244 |
next |
|
1245 |
case (Shutdown p fd how) |
|
1246 |
show ?thesis using grant |
|
1247 |
by (simp add:Shutdown) |
|
1248 |
qed |
|
1249 |
qed |
|
79 | 1250 |
|
1251 |
lemma created_proc_clone: |
|
1252 |
"valid (Clone p p' fds # s) \<Longrightarrow> |
|
1253 |
is_created_proc (Clone p p' fds # s) tp = (if (tp = p') then True else is_created_proc s tp)" |
|
1254 |
apply (drule vt_grant_os) |
|
1255 |
apply (auto simp:is_created_proc_def dest:not_all_procs_prop2) |
|
1256 |
using not_died_init_proc |
|
1257 |
by auto |
|
1258 |
||
1259 |
lemma created_proc_exit: |
|
1260 |
"is_created_proc (Exit p # s) tp = (if (tp = p) then False else is_created_proc s tp)" |
|
1261 |
by (simp add:is_created_proc_def) |
|
1262 |
||
1263 |
lemma created_proc_kill: |
|
1264 |
"is_created_proc (Kill p p' # s) tp = (if (tp = p') then False else is_created_proc s tp)" |
|
1265 |
by (simp add:is_created_proc_def) |
|
1266 |
||
1267 |
lemma created_proc_other: |
|
1268 |
"\<lbrakk>\<And> p p' fds. e \<noteq> Clone p p' fds; |
|
1269 |
\<And> p. e \<noteq> Exit p; |
|
1270 |
\<And> p p'. e \<noteq> Kill p p'\<rbrakk> \<Longrightarrow> is_created_proc (e # s) tp = is_created_proc s tp" |
|
1271 |
by (case_tac e, auto simp:is_created_proc_def) |
|
1272 |
||
1273 |
lemmas is_created_proc_simps = created_proc_clone created_proc_exit created_proc_kill created_proc_other |
|
1274 |
(* |
|
77 | 1275 |
|
1276 |
||
1277 |
||
1278 |
||
79 | 1279 |
(p \<in> current_procs s \<longrightarrow> co2sobj (enrich_proc s p p') (O_proc p') = co2sobj (enrich_proc s p p') (O_proc p)) \<and> |
1280 |
(\<forall> obj. alive s obj \<longrightarrow> alive (enrich_proc s p p') obj) \<and> |
|
1281 |
(\<forall> p'. p' \<in> current_procs s \<longrightarrow> cp2sproc (enrich_proc s p p') p' = cp2sproc s p) \<and> |
|
1282 |
(\<forall> f. f \<in> current_files s \<longrightarrow> cf2sfile (enrich_proc s p p') f = cf2sfile s f) \<and> |
|
1283 |
(Tainted (enrich_proc s p p') = (Tainted s \<union> (if (O_proc p \<in> Tainted s) then {O_proc p'} else {})))"*) |
|
1284 |
||
1285 |
lemma enrich_proc_dup_in: |
|
1286 |
"\<lbrakk>is_created_proc s p; p' \<notin> all_procs s; valid s\<rbrakk> |
|
1287 |
\<Longrightarrow> p' \<in> current_procs (enrich_proc s p p')" |
|
1288 |
apply (induct s, simp add:is_created_proc_def) |
|
1289 |
apply (frule vt_grant_os, frule vd_cons) |
|
1290 |
apply (case_tac a, auto simp:is_created_proc_def dest:not_all_procs_prop3) |
|
1291 |
done |
|
1292 |
||
1293 |
lemma enrich_proc_dup_ffd: |
|
1294 |
"\<lbrakk>file_of_proc_fd s p fd = Some f; is_created_proc s p; p' \<notin> all_procs s; valid s\<rbrakk> |
|
1295 |
\<Longrightarrow> file_of_proc_fd (enrich_proc s p p') p' fd = Some f" |
|
1296 |
apply (induct s, simp add:is_created_proc_def) |
|
1297 |
apply (frule vt_grant_os, frule vd_cons) |
|
1298 |
apply (case_tac a, auto simp:is_created_proc_def proc_file_fds_def |
|
1299 |
dest:not_all_procs_prop3 split:if_splits option.splits) |
|
1300 |
done |
|
1301 |
||
80 | 1302 |
lemma enrich_proc_dup_ffd': |
83 | 1303 |
"\<lbrakk>file_of_proc_fd (enrich_proc s p p') p' fd = Some f; is_created_proc s p; p' \<notin> all_procs s; |
1304 |
no_del_event s; valid s\<rbrakk> |
|
80 | 1305 |
\<Longrightarrow> file_of_proc_fd s p fd = Some f" |
1306 |
apply (induct s, simp add:is_created_proc_def) |
|
1307 |
apply (frule vt_grant_os, frule vd_cons) |
|
1308 |
apply (case_tac a, auto simp:is_created_proc_def proc_file_fds_def |
|
1309 |
dest:not_all_procs_prop3 split:if_splits option.splits) |
|
1310 |
done |
|
1311 |
||
83 | 1312 |
lemma enrich_proc_dup_ffd_eq: |
1313 |
"\<lbrakk>is_created_proc s p; p' \<notin> all_procs s; no_del_event s; valid s\<rbrakk> |
|
1314 |
\<Longrightarrow> file_of_proc_fd (enrich_proc s p p') p' fd = file_of_proc_fd s p fd" |
|
1315 |
apply (case_tac "file_of_proc_fd s p fd") |
|
1316 |
apply (case_tac[!] "file_of_proc_fd (enrich_proc s p p') p' fd") |
|
1317 |
apply (auto dest:enrich_proc_dup_ffd enrich_proc_dup_ffd') |
|
1318 |
done |
|
1319 |
||
79 | 1320 |
lemma current_fflag_in_fds: |
1321 |
"\<lbrakk>flags_of_proc_fd s p fd = Some flag; valid s\<rbrakk> \<Longrightarrow> fd \<in> current_proc_fds s p" |
|
1322 |
apply (induct s arbitrary:p) |
|
1323 |
apply (simp add:flags_of_proc_fd.simps file_of_proc_fd.simps init_oflags_prop2) |
|
1324 |
apply (frule vd_cons, frule vt_grant_os, case_tac a) |
|
1325 |
apply (auto split:if_splits option.splits dest:proc_fd_in_fds) |
|
80 | 1326 |
done |
79 | 1327 |
|
1328 |
lemma current_fflag_has_ffd: |
|
1329 |
"\<lbrakk>flags_of_proc_fd s p fd = Some flag; valid s\<rbrakk> \<Longrightarrow> \<exists> f. file_of_proc_fd s p fd = Some f" |
|
1330 |
apply (induct s arbitrary:p) |
|
1331 |
apply (simp add: file_of_proc_fd.simps init_fileflag_valid) |
|
1332 |
apply (frule vd_cons, frule vt_grant_os, case_tac a) |
|
1333 |
apply (auto split:if_splits option.splits dest:proc_fd_in_fds) |
|
80 | 1334 |
done |
79 | 1335 |
|
1336 |
lemma enrich_proc_dup_fflags: |
|
80 | 1337 |
"\<lbrakk>flags_of_proc_fd s p fd = Some flag; is_created_proc s p; p' \<notin> all_procs s; valid s\<rbrakk> |
1338 |
\<Longrightarrow> flags_of_proc_fd (enrich_proc s p p') p' fd = Some (remove_create_flag flag) \<or> |
|
1339 |
flags_of_proc_fd (enrich_proc s p p') p' fd = Some flag" |
|
1340 |
apply (induct s arbitrary:p, simp add:is_created_proc_def) |
|
79 | 1341 |
apply (frule vt_grant_os, frule vd_cons) |
80 | 1342 |
apply (case_tac a, auto simp:is_created_proc_def proc_file_fds_def is_creat_flag_def |
79 | 1343 |
dest:not_all_procs_prop3 split:if_splits option.splits) |
80 | 1344 |
done |
1345 |
||
1346 |
lemma enrich_proc_dup_ffds: |
|
83 | 1347 |
"\<lbrakk>is_created_proc s p; p' \<notin> all_procs s; no_del_event s; valid s\<rbrakk> |
80 | 1348 |
\<Longrightarrow> proc_file_fds (enrich_proc s p p') p' = proc_file_fds s p" |
1349 |
apply (auto simp:proc_file_fds_def) |
|
1350 |
apply (rule_tac x = f in exI) |
|
1351 |
apply (erule enrich_proc_dup_ffd', simp+) |
|
1352 |
apply (rule_tac x = f in exI) |
|
1353 |
apply (erule enrich_proc_dup_ffd, simp+) |
|
1354 |
done |
|
77 | 1355 |
|
82 | 1356 |
lemma enrich_proc_dup_ffds_eq_fds: |
83 | 1357 |
"\<lbrakk>is_created_proc s p; p' \<notin> all_procs s; no_del_event s; valid s\<rbrakk> |
82 | 1358 |
\<Longrightarrow> current_proc_fds (enrich_proc s p p') p' = proc_file_fds s p" |
1359 |
apply (induct s arbitrary:p) |
|
1360 |
apply (simp add: is_created_proc_def) |
|
1361 |
apply (frule not_all_procs_prop3) |
|
1362 |
apply (frule vd_cons, frule vt_grant_os, case_tac a) |
|
1363 |
apply (auto split:if_splits option.splits dest:proc_fd_in_fds set_mp not_all_procs_prop3 |
|
1364 |
simp:proc_file_fds_def is_created_proc_def) |
|
1365 |
done |
|
81 | 1366 |
|
82 | 1367 |
lemma oflags_check_remove_create: |
1368 |
"oflags_check flags sp sf \<Longrightarrow> oflags_check (remove_create_flag flags) sp sf" |
|
1369 |
apply (case_tac flags) |
|
1370 |
apply (auto simp:oflags_check_def perms_of_flags_def perm_of_oflag_def split:bool.splits) |
|
1371 |
done |
|
81 | 1372 |
|
82 | 1373 |
end |
77 | 1374 |
|
82 | 1375 |
end |