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