author | chunhan |
Thu, 16 Jan 2014 11:04:04 +0800 | |
changeset 95 | b7fd75d104bf |
parent 94 | 042e1e7fd505 |
permissions | -rw-r--r-- |
88 | 1 |
theory Enrich2 |
82 | 2 |
imports Main Flask Static Init_prop Valid_prop Tainted_prop Delete_prop Co2sobj_prop S2ss_prop S2ss_prop2 |
95 | 3 |
Temp Enrich Proc_fd_of_file_prop New_obj_prop |
82 | 4 |
begin |
5 |
||
95 | 6 |
fun assoc :: "('a \<times> 'b) list \<Rightarrow> 'a \<Rightarrow> 'b option" |
7 |
where |
|
8 |
"assoc [] a = None" |
|
9 |
| "assoc (e # l) a = (if (fst e = a) then Some (snd e) else assoc l a)" |
|
10 |
||
11 |
context flask begin |
|
12 |
||
13 |
lemma sock_inum_eq_prop: |
|
14 |
"\<lbrakk>inum_of_socket s (p, fd) = Some im; inum_of_socket s (p', fd') = Some im; valid s\<rbrakk> |
|
15 |
\<Longrightarrow> (p' = p \<and> fd' = fd)" |
|
16 |
apply (induct s arbitrary:p p') |
|
17 |
apply (simp) defer |
|
18 |
apply (frule vd_cons, frule vt_grant_os, case_tac a) |
|
19 |
apply (auto split:if_splits option.splits simp:proc_file_fds_def) |
|
20 |
sorry |
|
21 |
||
22 |
lemma inums_execve: |
|
23 |
"valid (Execve p f fds # s) \<Longrightarrow> |
|
24 |
current_inode_nums (Execve p f fds # s) = current_inode_nums s - |
|
25 |
{inum. \<exists> fd. inum_of_socket s (p, fd) = Some inum}" |
|
26 |
apply (frule vt_grant_os, frule vd_cons) |
|
27 |
apply (auto simp:current_inode_nums_def current_sock_inums_def current_file_inums_def proc_file_fds_def |
|
28 |
dest:filefd_socket_conflict fim_noninter_sim' dest:fim_noninter_sim'' sock_inum_eq_prop) |
|
29 |
apply (drule set_mp, simp, simp, erule exE, drule filefd_socket_conflict, |
|
30 |
simp add:current_sockets_def, simp, simp)+ |
|
31 |
apply (case_tac "a = p", simp) |
|
32 |
apply (auto) |
|
33 |
done |
|
34 |
||
35 |
lemma inums_clone: |
|
36 |
"valid (Clone p p' fds # s) \<Longrightarrow> |
|
37 |
current_inode_nums (Clone p p' fds # s) = current_inode_nums s" |
|
38 |
apply (frule vt_grant_os, frule vd_cons) |
|
39 |
apply (auto simp:current_inode_nums_def current_sock_inums_def current_file_inums_def proc_file_fds_def |
|
40 |
dest:filefd_socket_conflict fim_noninter_sim' dest:fim_noninter_sim'' sock_inum_eq_prop) |
|
41 |
apply (case_tac "a = p'") |
|
42 |
apply (subgoal_tac "(p', b) \<in> current_sockets s") |
|
43 |
apply (drule cn_in_curp, simp, simp, simp add:current_sockets_def) |
|
44 |
apply auto |
|
45 |
done |
|
46 |
||
47 |
lemma inums_kill: |
|
48 |
"valid (Kill p p' # s) \<Longrightarrow> current_inode_nums (Kill p p' # s) = current_inode_nums s - |
|
49 |
{inum. \<exists> fd. inum_of_socket s (p', fd) = Some inum}" |
|
50 |
apply (frule vt_grant_os, frule vd_cons) |
|
51 |
apply (auto simp:current_inode_nums_def current_sock_inums_def current_file_inums_def proc_file_fds_def |
|
52 |
dest:filefd_socket_conflict fim_noninter_sim' fim_noninter_sim'' sock_inum_eq_prop) |
|
53 |
done |
|
54 |
||
55 |
lemma inums_exit: |
|
56 |
"valid (Exit p # s) \<Longrightarrow> current_inode_nums (Exit p # s) = current_inode_nums s - |
|
57 |
{inum. \<exists> fd. inum_of_socket s (p, fd) = Some inum}" |
|
58 |
apply (frule vt_grant_os, frule vd_cons) |
|
59 |
apply (auto simp:current_inode_nums_def current_sock_inums_def current_file_inums_def proc_file_fds_def |
|
60 |
dest:filefd_socket_conflict fim_noninter_sim' fim_noninter_sim'' sock_inum_eq_prop) |
|
61 |
done |
|
62 |
||
63 |
lemma inums_ptrace: |
|
64 |
"current_inode_nums (Ptrace p p' # s) = current_inode_nums s" |
|
65 |
apply (auto simp:current_inode_nums_def current_sock_inums_def current_file_inums_def proc_file_fds_def |
|
66 |
dest:filefd_socket_conflict fim_noninter_sim' fim_noninter_sim'' sock_inum_eq_prop) |
|
67 |
done |
|
68 |
||
69 |
lemma inums_open: |
|
70 |
"valid (Open p f flags fd opt # s) \<Longrightarrow> |
|
71 |
current_inode_nums (Open p f flags fd opt # s) = ( |
|
72 |
case opt of |
|
73 |
None \<Rightarrow> current_inode_nums s |
|
74 |
| Some i \<Rightarrow> current_inode_nums s \<union> {i})" |
|
75 |
apply (frule vt_grant_os, frule vd_cons) |
|
76 |
apply (auto simp:current_inode_nums_def current_sock_inums_def current_file_inums_def proc_file_fds_def |
|
77 |
dest:filefd_socket_conflict fim_noninter_sim' fim_noninter_sim'' sock_inum_eq_prop split:option.splits) |
|
78 |
apply (case_tac "fa = f", simp add:current_files_def) |
|
79 |
apply (rule_tac x = fa in exI, auto) |
|
80 |
done |
|
81 |
||
82 |
lemma inums_readfile: |
|
83 |
"current_inode_nums (ReadFile p fd # s) = current_inode_nums s" |
|
84 |
apply (auto simp:current_inode_nums_def current_sock_inums_def current_file_inums_def proc_file_fds_def) |
|
85 |
done |
|
86 |
||
87 |
lemma inums_writefile: |
|
88 |
"current_inode_nums (WriteFile p fd # s) = current_inode_nums s" |
|
89 |
apply (auto simp:current_inode_nums_def current_sock_inums_def current_file_inums_def proc_file_fds_def) |
|
90 |
done |
|
91 |
||
92 |
lemma inums_mkdir: |
|
93 |
"valid (Mkdir p f inum # s) \<Longrightarrow> current_inode_nums (Mkdir p f inum # s) = current_inode_nums s \<union> {inum}" |
|
94 |
apply (frule vt_grant_os, frule vd_cons) |
|
95 |
apply (auto simp:current_inode_nums_def current_sock_inums_def current_file_inums_def proc_file_fds_def |
|
96 |
dest:filefd_socket_conflict fim_noninter_sim' fim_noninter_sim'' sock_inum_eq_prop split:option.splits) |
|
97 |
apply (case_tac "fa = f", simp add:current_files_def) |
|
98 |
apply (rule_tac x = fa in exI, auto) |
|
99 |
done |
|
100 |
||
101 |
lemma inums_linkhard: |
|
102 |
"valid (LinkHard p f f' # s) \<Longrightarrow> current_inode_nums (LinkHard p f f' # s) = current_inode_nums s" |
|
103 |
apply (frule vt_grant_os, frule vd_cons) |
|
104 |
apply (auto simp:current_inode_nums_def current_sock_inums_def current_file_inums_def proc_file_fds_def |
|
105 |
dest:filefd_socket_conflict fim_noninter_sim' fim_noninter_sim'' sock_inum_eq_prop split:option.splits) |
|
106 |
apply (case_tac "fa = f'", simp add:current_files_def) |
|
107 |
apply (rule_tac x = fa in exI, auto) |
|
108 |
done |
|
109 |
||
110 |
lemma inums_truncate: |
|
111 |
"current_inode_nums (Truncate p f len # s) = current_inode_nums s" |
|
112 |
apply (auto simp:current_inode_nums_def current_sock_inums_def current_file_inums_def proc_file_fds_def) |
|
113 |
done |
|
114 |
||
115 |
lemma inums_createmsgq: |
|
116 |
"current_inode_nums (CreateMsgq p q # s) = current_inode_nums s" |
|
117 |
by (auto simp:current_inode_nums_def current_sock_inums_def current_file_inums_def) |
|
118 |
||
119 |
lemma inums_sendmsg: |
|
120 |
"current_inode_nums (SendMsg p q m # s) = current_inode_nums s" |
|
121 |
by (auto simp:current_inode_nums_def current_sock_inums_def current_file_inums_def) |
|
122 |
||
123 |
lemma inums_recvmsg: |
|
124 |
"current_inode_nums (RecvMsg p q m # s) = current_inode_nums s" |
|
125 |
by (auto simp:current_inode_nums_def current_sock_inums_def current_file_inums_def) |
|
126 |
||
127 |
lemma inums_removemsgq: |
|
128 |
"current_inode_nums (RemoveMsgq p q # s) = current_inode_nums s" |
|
129 |
by (auto simp:current_inode_nums_def current_sock_inums_def current_file_inums_def) |
|
130 |
||
131 |
lemma inums_bind: |
|
132 |
"valid (Bind p fd addr # s) \<Longrightarrow> current_inode_nums (Bind p fd addr # s) = current_inode_nums s" |
|
133 |
by (auto dest:vt_grant) |
|
134 |
||
135 |
lemma inums_connect: |
|
136 |
"valid (Connect p fd addr # s) \<Longrightarrow> current_inode_nums (Connect p fd addr # s) = current_inode_nums s" |
|
137 |
by (auto dest:vt_grant) |
|
138 |
||
139 |
lemma inums_listen: |
|
140 |
"valid (Listen p fd # s) \<Longrightarrow> current_inode_nums (Listen p fd # s) = current_inode_nums s" |
|
141 |
by (auto dest:vt_grant) |
|
142 |
||
143 |
lemma inums_sendsock: |
|
144 |
"valid (SendSock p fd # s) \<Longrightarrow> current_inode_nums (SendSock p fd # s) = current_inode_nums s" |
|
145 |
by (auto dest:vt_grant) |
|
146 |
||
147 |
lemma inums_recvsock: |
|
148 |
"valid (RecvSock p fd # s) \<Longrightarrow> current_inode_nums (RecvSock p fd # s) = current_inode_nums s" |
|
149 |
by (auto dest:vt_grant) |
|
150 |
||
151 |
lemma inums_shutdown: |
|
152 |
"valid (Shutdown p fd how # s) \<Longrightarrow> current_inode_nums (Shutdown p fd how # s) = current_inode_nums s" |
|
153 |
by (auto dest:vt_grant) |
|
154 |
||
155 |
lemma inums_createsock: |
|
156 |
"valid (CreateSock p af st fd inum # s) \<Longrightarrow> current_inode_nums (CreateSock p af st fd inum # s) = |
|
157 |
current_inode_nums s" |
|
158 |
by (auto dest:vt_grant) |
|
159 |
||
160 |
lemma inums_accept: |
|
161 |
"valid (Accept p fd addr port fd inum # s) \<Longrightarrow> current_inode_nums (Accept p fd addr port fd inum # s) = |
|
162 |
current_inode_nums s" |
|
163 |
by (auto dest:vt_grant) |
|
164 |
||
165 |
lemmas current_inode_nums_simps = inums_execve inums_open inums_mkdir |
|
166 |
inums_linkhard inums_createmsgq inums_sendmsg |
|
167 |
inums_createsock inums_accept inums_clone inums_kill inums_ptrace inums_exit inums_readfile |
|
168 |
inums_writefile inums_truncate inums_recvmsg inums_removemsgq |
|
169 |
inums_bind inums_connect inums_listen inums_sendsock |
|
170 |
inums_recvsock inums_shutdown |
|
171 |
||
172 |
end |
|
173 |
||
82 | 174 |
context tainting_s begin |
175 |
||
95 | 176 |
fun new_cf :: "t_file set \<Rightarrow> t_file \<Rightarrow> t_file" |
94 | 177 |
where |
95 | 178 |
"new_cf fs [] = []" |
179 |
| "new_cf fs (f#pf) = new_childf_general pf fs" |
|
94 | 180 |
|
95 | 181 |
lemma new_cf_notin_fs: |
182 |
"\<lbrakk>finite fs; f \<noteq> []\<rbrakk> \<Longrightarrow> new_cf fs f \<notin> fs" |
|
183 |
apply (case_tac f, simp) |
|
184 |
apply (auto simp:ncf_notin_curf_general) |
|
185 |
done |
|
186 |
||
187 |
fun enrich_dufs:: "t_state \<Rightarrow> t_file set \<Rightarrow> t_file set \<Rightarrow> (t_file \<times> t_file) list" |
|
87 | 188 |
where |
95 | 189 |
"enrich_dufs [] sames curfs = []" |
190 |
| "enrich_dufs (Open p f flags fd opt # s) sames curfs = |
|
191 |
(if (f \<in> sames \<and> opt \<noteq> None) |
|
192 |
then (f, new_cf (curfs \<union> set (map snd (enrich_dufs s sames curfs))) f) # enrich_dufs s sames curfs |
|
193 |
else enrich_dufs s sames curfs)" |
|
194 |
| "enrich_dufs (LinkHard p f f' # s) sames curfs = |
|
195 |
(if (f' \<in> sames) |
|
196 |
then (f', new_cf (curfs \<union> set (map snd (enrich_dufs s sames curfs))) f') # enrich_dufs s sames curfs |
|
197 |
else enrich_dufs s sames curfs)" |
|
198 |
| "enrich_dufs (_ # s) sames curfs = enrich_dufs s sames curfs" |
|
199 |
||
200 |
lemma enrich_dufs_sameinodes1: |
|
201 |
"set (map fst (enrich_dufs s sames curfs)) \<subseteq> sames" |
|
202 |
apply (induct s, simp) |
|
203 |
by (case_tac a, auto) |
|
94 | 204 |
|
205 |
lemma enrich_dufs_sameinodes: |
|
95 | 206 |
"\<lbrakk>valid s; \<forall> f \<in> sames. f \<notin> init_files; no_del_event s\<rbrakk> |
207 |
\<Longrightarrow> set (map fst (enrich_dufs s sames curfs)) = sames \<inter> {f. is_file s f} " |
|
208 |
apply (induct s) |
|
209 |
apply (auto simp:is_file_nil is_init_file_props current_files_simps)[1] |
|
210 |
apply (frule vt_grant_os, frule vd_cons, case_tac a) |
|
211 |
apply (auto simp:is_file_simps is_file_in_current current_files_simps |
|
212 |
same_inode_files_simps split:option.splits if_splits) |
|
213 |
done |
|
214 |
||
215 |
lemma finite_enrich_nfs: |
|
216 |
"finite (snd ` set (enrich_dufs s sames curfs))" |
|
217 |
by (auto) |
|
94 | 218 |
|
95 | 219 |
lemma new_cf_enrich: |
220 |
"\<lbrakk>finite curfs; f \<noteq> []\<rbrakk> \<Longrightarrow> new_cf (curfs \<union> snd ` set (enrich_dufs s sames curfs)) f \<notin> curfs \<union> snd ` set (enrich_dufs s sames curfs)" |
|
221 |
using finite_enrich_nfs[where s = s and sames =sames and curfs = curfs] |
|
222 |
apply (drule_tac F = curfs and G = "snd ` set (enrich_dufs s sames curfs)" in finite_UnI, simp) |
|
223 |
apply (rule new_cf_notin_fs, simp+) |
|
224 |
done |
|
225 |
||
226 |
lemma enrich_dufs_nfs: |
|
227 |
"\<lbrakk>finite curfs; [] \<notin> sames\<rbrakk> |
|
228 |
\<Longrightarrow> set (map snd (enrich_dufs s sames curfs)) \<inter> curfs = {}" |
|
229 |
apply (induct s) |
|
230 |
apply (simp) |
|
231 |
apply ( case_tac a) |
|
232 |
apply (auto simp:is_file_in_current) |
|
233 |
apply (drule_tac f = list and sames = sames and curfs = curfs and s = s in new_cf_enrich) |
|
234 |
apply (rule notI, simp+) |
|
235 |
apply (drule_tac f = list2 and sames = sames and curfs = curfs and s = s in new_cf_enrich) |
|
236 |
apply (rule notI, simp+) |
|
237 |
done |
|
238 |
||
239 |
lemma pair_list_set: "(a, b) \<in> set l \<Longrightarrow> b \<in> snd ` set l" |
|
240 |
by (induct l, auto) |
|
94 | 241 |
|
95 | 242 |
lemma enrich_dufs_nfs_distinct: |
243 |
"\<lbrakk>finite curfs; [] \<notin> sames\<rbrakk> \<Longrightarrow> distinct (map snd (enrich_dufs s sames curfs))" |
|
244 |
apply (induct s, simp) |
|
245 |
apply (case_tac a, auto) |
|
246 |
apply (drule pair_list_set) |
|
247 |
apply (drule_tac f = list and s = s and sames = sames and curfs = curfs in new_cf_enrich) |
|
248 |
apply (rule notI, simp, simp) |
|
249 |
apply (drule pair_list_set) |
|
250 |
apply (drule_tac f = list2 and s = s and sames = sames and curfs = curfs in new_cf_enrich) |
|
251 |
apply (rule notI, simp, simp) |
|
252 |
done |
|
253 |
||
254 |
fun all_fds :: "t_state \<Rightarrow> t_process \<Rightarrow> t_fd set" |
|
94 | 255 |
where |
95 | 256 |
"all_fds [] = init_fds_of_proc" |
257 |
| "all_fds (Open p f flags fd ipt # s) = (all_fds s) (p := all_fds s p \<union> {fd})" (* |
|
258 |
| "all_fds (CreateSock p sf st fd i # s) = (all_fds s) (p := all_fds s p \<union> {fd})" |
|
259 |
| "all_fds (Accept p fd' raddr port fd i # s) = (all_fds s) (p := all_fds s p \<union> {fd})" *) |
|
260 |
| "all_fds (Clone p p' fds # s) = (all_fds s) (p' := fds)" |
|
261 |
| "all_fds (_ # s) = all_fds s" |
|
262 |
||
263 |
fun enrich_dufds :: "t_state \<Rightarrow> t_file set \<Rightarrow> (t_process \<Rightarrow> t_fd set) \<Rightarrow> (t_state \<times> t_fd) list" |
|
264 |
where |
|
265 |
"enrich_dufds [] sames allpfds = []" |
|
266 |
| "enrich_dufds (Open p f flags fd opt # s) sames allpfds = |
|
267 |
(if (f \<in> sames) |
|
268 |
then (Open p f flags fd opt # s, next_nat (allpfds p \<union> set (map snd (enrich_dufds s sames allpfds)))) # |
|
269 |
(enrich_dufds s sames allpfds) |
|
270 |
else enrich_dufds s sames allpfds)" |
|
271 |
| "enrich_dufds (e # s) sames allpfds = enrich_dufds s sames allpfds" |
|
272 |
||
273 |
fun index_fd :: "t_state \<Rightarrow> t_process \<Rightarrow> t_fd \<Rightarrow> t_state" |
|
274 |
where |
|
275 |
"index_fd [] p fd = []" |
|
276 |
| "index_fd (Open p f flags fd opt # s) p' fd' = |
|
277 |
(if (p' = p \<and> fd' = fd) then Open p f flags fd opt # s |
|
278 |
else index_fd s p' fd')" |
|
279 |
| "index_fd (e # s) p fd = index_fd s p fd" |
|
280 |
||
281 |
definition enrich_fdset :: "t_state \<Rightarrow> (t_state \<times> t_fd) list \<Rightarrow> t_process \<Rightarrow> t_fd set \<Rightarrow> t_fd set" |
|
282 |
where |
|
283 |
"enrich_fdset s dufds p fds \<equiv> |
|
284 |
fds \<union> {fd'. \<exists> fd \<in> fds. assoc dufds (index_fd s p fd) = Some fd'}" |
|
92 | 285 |
|
286 |
||
95 | 287 |
fun enrich_file :: "t_state \<Rightarrow> t_inode_num \<Rightarrow> (t_file \<times> t_file) list |
288 |
\<Rightarrow> ((t_file \<times> t_process \<times> t_fd) \<times> t_fd) list \<Rightarrow> t_state" |
|
289 |
where |
|
290 |
"enrich_file [] inum dufs dufds = []" |
|
291 |
| "enrich_file (Open p f flags fd None # s) inum dufs dufds = |
|
292 |
(case (assoc dufds (Open p f flags fd None # s), assoc dufs f) of |
|
293 |
(Some fd', Some f') \<Rightarrow> Open p f' flags fd' None # Open p f flags fd None # enrich_file s inum dufs dufds |
|
294 |
| _ \<Rightarrow> Open p f flags fd None # (enrich_file s inum dufs dufds))" |
|
295 |
| "enrich_file (Open p f flags fd (Some inum) # s) inum' dufs dufds = |
|
296 |
(case (assoc dufs f, assoc dufds (f, p, fd)) of |
|
297 |
(Some f', Some fd') \<Rightarrow> Open p f' flags fd' (Some inum') # Open p f flags fd (Some inum) # |
|
298 |
enrich_file s inum dufs dufds |
|
299 |
| _ \<Rightarrow> Open p f flags fd (Some inum) # enrich_file s inum dufs dufds)" |
|
300 |
| "enrich_file (LinkHard p f f' # s) inum dufs dufds = |
|
301 |
(case (assoc dufs f, assoc dufs f') of |
|
302 |
(Some df, Some df') \<Rightarrow> LinkHard p df df' # LinkHard p f f' # enrich_file s inum dufs dufds |
|
303 |
| _ \<Rightarrow> LinkHard p f f' # enrich_file s inum dufs dufds)" |
|
304 |
| "enrich_file (Clone p p' fds # s) inum dufs dufds = |
|
305 |
Clone p p' (enrich_fdset s dufds p fds) # (enrich_file s inum dufs dufds)" |
|
306 |
| "enrich_file (Execve p f fds # s) inum dufs dufds = |
|
307 |
Execve p f (enrich_fdset s dufds p fds) # (enrich_file s inum dufs dufds)" |
|
308 |
| "enrich_file (WriteFile p fd # s) inum dufs dufds = |
|
309 |
(case (file_of_proc_fd s p fd) of |
|
310 |
Some f \<Rightarrow> (case (assoc dufds (f, p, fd)) of |
|
311 |
Some fd' \<Rightarrow> WriteFile p fd' # WriteFile p fd # enrich_file s inum dufs dufds |
|
312 |
| _ \<Rightarrow> WriteFile p fd # enrich_file s inum dufs dufds) |
|
313 |
| _ \<Rightarrow> [])" |
|
314 |
| "enrich_file (e # s) inum dufs dufds = e # enrich_file s inum dufs dufds" |
|
315 |
||
316 |
definition same_inodes_list :: "t_state \<Rightarrow> t_file list \<Rightarrow> bool" |
|
317 |
where |
|
318 |
"same_inodes_list s flist \<equiv> flist \<noteq> [] \<and> set flist = same_inode_files s (hd flist)" |
|
319 |
||
320 |
lemma assoc_dufs_prop1: |
|
321 |
"\<lbrakk>\<forall> f \<in> set (map snd dufs). f \<notin> current_files s; assoc dufs f = Some f'\<rbrakk> \<Longrightarrow> f' \<notin> current_files s" |
|
322 |
apply (erule_tac x = "f'" in ballE) |
|
323 |
apply auto |
|
324 |
apply (induct dufs, auto split:if_splits) |
|
325 |
done |
|
326 |
||
327 |
||
328 |
lemma enrich_file_dufs_inode_aux1: |
|
329 |
"\<lbrakk>no_del_event s; valid s; f \<in> current_files s; \<And> f f'. assoc dufs f = Some f' \<Longrightarrow> f' \<notin> current_files s\<rbrakk> |
|
330 |
\<Longrightarrow> inum_of_file (enrich_file s inum dufs) f = inum_of_file s f" |
|
331 |
apply (induct s arbitrary:f, simp) |
|
332 |
apply (frule vt_grant_os, frule vd_cons, case_tac a) |
|
333 |
apply (auto split:option.splits simp:current_files_simps dest:is_file_in_current is_dir_in_current) |
|
334 |
done |
|
335 |
||
336 |
lemma enrich_file_dufs_inode1: |
|
337 |
"\<lbrakk>no_del_event s; valid s; f \<in> current_files s; \<forall> f \<in> set (map snd dufs). f \<notin> current_files s\<rbrakk> |
|
338 |
\<Longrightarrow> inum_of_file (enrich_file s inum dufs) f = inum_of_file s f" |
|
339 |
apply (erule enrich_file_dufs_inode_aux1) |
|
340 |
apply (simp, simp) |
|
341 |
apply (erule assoc_dufs_prop1, simp+) |
|
342 |
done |
|
343 |
||
344 |
lemma enrich_file_dufs_inode2: |
|
345 |
"\<lbrakk>no_del_event s; valid s; is_file s f; f \<notin> init_files; assoc dufs f = Some f'; |
|
346 |
\<And> f f'. assoc dufs f = Some f' \<Longrightarrow> f' \<notin> current_files s; |
|
347 |
\<And> f f'. assoc dufs f = Some f' \<Longrightarrow> inum_of_file s f' = None\<rbrakk> |
|
348 |
\<Longrightarrow> inum_of_file (enrich_file s inum dufs) f' = Some inum" |
|
349 |
apply (induct s arbitrary:f f', simp) defer |
|
350 |
apply(frule vt_grant_os, frule vd_cons, case_tac a) |
|
351 |
apply (auto split:option.splits if_splits |
|
352 |
simp:current_files_simps current_inode_nums_simps is_file_simps |
|
353 |
dest:is_file_in_current is_dir_in_current) |
|
354 |
||
355 |
||
356 |
lemma enrich_file_dufs_sameinodes: |
|
357 |
"\<lbrakk>same_inodes_list s (map fst dufs); \<forall> f \<in> set (map fst dufs). f \<notin> init_files; inum \<notin> current_inode_nums s; |
|
358 |
distinct (map snd dufs); \<forall> f \<in> set (map snd dufs). f \<notin> current_files s; valid s\<rbrakk> |
|
359 |
\<Longrightarrow> same_inodes_list (enrich_file s inum dufs) (map snd dufs)" |
|
360 |
apply (induct s) apply (simp add:same_inodes_list_def same_inode_files_simps) |
|
361 |
defer |
|
362 |
apply (frule vd_cons, frule vt_grant_os, case_tac a) |
|
363 |
apply (auto simp:same_inodes_list_def same_inode_files_simps) |
|
364 |
||
365 |
||
366 |
||
367 |
lemma enrich_dufs_fst: |
|
368 |
"\<lbrakk>valid s; " |
|
90 | 369 |
|
91
1a1df29d3507
enrich msgq done; but find bugs of s2ss, it should only considerate 'appropriate' objects, not including msg/fd ...
chunhan
parents:
90
diff
changeset
|
370 |
|
1a1df29d3507
enrich msgq done; but find bugs of s2ss, it should only considerate 'appropriate' objects, not including msg/fd ...
chunhan
parents:
90
diff
changeset
|
371 |
lemma enrich_msgq_s2ss: |
1a1df29d3507
enrich msgq done; but find bugs of s2ss, it should only considerate 'appropriate' objects, not including msg/fd ...
chunhan
parents:
90
diff
changeset
|
372 |
"" |
1a1df29d3507
enrich msgq done; but find bugs of s2ss, it should only considerate 'appropriate' objects, not including msg/fd ...
chunhan
parents:
90
diff
changeset
|
373 |
|
1a1df29d3507
enrich msgq done; but find bugs of s2ss, it should only considerate 'appropriate' objects, not including msg/fd ...
chunhan
parents:
90
diff
changeset
|
374 |
|
90 | 375 |
thm cp2sproc_def |
376 |
||
87 | 377 |
(* enrich s target_proc duplicated_pro *) |
89 | 378 |
fun enrich_proc :: "t_state \<Rightarrow> t_process \<Rightarrow> t_process \<Rightarrow> nat \<Rightarrow> t_state" |
87 | 379 |
where |
89 | 380 |
"enrich_proc [] tp dp n = []" |
381 |
| "enrich_proc (Execve p f fds # s) tp dp n = ( |
|
87 | 382 |
if (tp = p) |
89 | 383 |
then Execve dp f (fds \<inter> proc_file_fds s p) # Execve p f fds # (enrich_proc s tp dp n) |
384 |
else Execve p f fds # (enrich_proc s tp dp n))" |
|
385 |
| "enrich_proc (Clone p p' fds # s) tp dp n = ( |
|
87 | 386 |
if (tp = p') |
387 |
then Clone p dp (fds \<inter> proc_file_fds s p) # Clone p p' fds # s |
|
89 | 388 |
else Clone p p' fds # (enrich_proc s tp dp n))" |
389 |
| "enrich_proc (Open p f flags fd opt # s) tp dp n= ( |
|
87 | 390 |
if (tp = p) |
89 | 391 |
then Open dp f (remove_create_flag flags) fd None # Open p f flags fd opt # (enrich_proc s tp dp n) |
392 |
else Open p f flags fd opt # (enrich_proc s tp dp n))" |
|
393 |
| "enrich_proc (ReadFile p fd # s) tp dp n = ( |
|
87 | 394 |
if (tp = p) |
89 | 395 |
then ReadFile dp fd # ReadFile p fd # (enrich_proc s tp dp n) |
396 |
else ReadFile p fd # (enrich_proc s tp dp n))" |
|
397 |
| "enrich_proc (RecvMsg p q m # s) tp dp n = ( |
|
88 | 398 |
if (tp = p) |
89 | 399 |
then RecvMsg dp n m # RecvMsg p q m # (enrich_msgq (enrich_proc s tp dp (n+1)) q n) |
400 |
else RecvMsg p q m # (enrich_proc s tp dp n))" |
|
87 | 401 |
(* |
402 |
| "enrich_proc (CloseFd p fd # s) tp dp = ( |
|
403 |
if (tp = p \<and> fd \<in> proc_file_fds s p) |
|
404 |
then CloseFd dp fd # CloseFd p fd # (enrich_proc s tp dp) |
|
405 |
else CloseFd p fd # (enrich_proc s tp dp))" |
|
406 |
*) |
|
407 |
(* |
|
408 |
| "enrich_proc (Attach p h flag # s) tp dp = ( |
|
409 |
if (tp = p) |
|
410 |
then Attach dp h flag # Attach p h flag # (enrich_proc s tp dp) |
|
411 |
else Attach p h flag # (enrich_proc s tp dp))" |
|
412 |
| "enrich_proc (Detach p h # s) tp dp = ( |
|
413 |
if (tp = p) |
|
414 |
then Detach dp h # Detach p h # (enrich_proc s tp dp) |
|
415 |
else Detach p h # (enrich_proc s tp dp))" |
|
416 |
*) |
|
417 |
(* |
|
418 |
| "enrich_proc (Kill p p' # s) tp dp = ( |
|
419 |
if (tp = p') then Kill p p' # s |
|
420 |
else Kill p p' # (enrich_proc s tp dp))" |
|
421 |
| "enrich_proc (Exit p # s) tp dp = ( |
|
422 |
if (tp = p) then Exit p # s |
|
423 |
else Exit p # (enrich_proc s tp dp))" |
|
424 |
*) |
|
89 | 425 |
| "enrich_proc (e # s) tp dp n = e # (enrich_proc s tp dp n)" |
87 | 426 |
|
427 |
definition is_created_proc:: "t_state \<Rightarrow> t_process \<Rightarrow> bool" |
|
428 |
where |
|
429 |
"is_created_proc s p \<equiv> p \<in> current_procs s \<and> (p \<in> init_procs \<longrightarrow> died (O_proc p) s)" |
|
430 |
||
431 |
definition is_created_proc':: "t_state \<Rightarrow> t_process \<Rightarrow> bool" |
|
432 |
where |
|
433 |
"is_created_proc' s p \<equiv> p \<in> current_procs s \<and> p \<notin> init_procs" |
|
434 |
||
435 |
lemma created_proc_clone: |
|
436 |
"valid (Clone p p' fds # s) \<Longrightarrow> |
|
437 |
is_created_proc (Clone p p' fds # s) tp = (if (tp = p') then True else is_created_proc s tp)" |
|
438 |
apply (drule vt_grant_os) |
|
439 |
apply (auto simp:is_created_proc_def dest:not_all_procs_prop2) |
|
440 |
using not_died_init_proc |
|
441 |
by auto |
|
442 |
||
443 |
lemma created_proc_exit: |
|
444 |
"is_created_proc (Exit p # s) tp = (if (tp = p) then False else is_created_proc s tp)" |
|
445 |
by (simp add:is_created_proc_def) |
|
446 |
||
447 |
lemma created_proc_kill: |
|
448 |
"is_created_proc (Kill p p' # s) tp = (if (tp = p') then False else is_created_proc s tp)" |
|
449 |
by (simp add:is_created_proc_def) |
|
450 |
||
451 |
lemma created_proc_other: |
|
452 |
"\<lbrakk>\<And> p p' fds. e \<noteq> Clone p p' fds; |
|
453 |
\<And> p. e \<noteq> Exit p; |
|
454 |
\<And> p p'. e \<noteq> Kill p p'\<rbrakk> \<Longrightarrow> is_created_proc (e # s) tp = is_created_proc s tp" |
|
455 |
by (case_tac e, auto simp:is_created_proc_def) |
|
456 |
||
457 |
lemmas is_created_proc_simps = created_proc_clone created_proc_exit created_proc_kill created_proc_other |
|
458 |
||
459 |
lemma no_del_died: |
|
460 |
"\<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)) |
|
461 |
\<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
|
462 |
apply (induct s) |
87 | 463 |
apply simp |
464 |
apply (case_tac a) |
|
82 | 465 |
apply (auto split:option.splits) |
466 |
done |
|
467 |
||
87 | 468 |
lemma no_del_created_eq: |
469 |
"no_del_event s \<Longrightarrow> is_created_proc s p = is_created_proc' s p" |
|
470 |
apply (induct s) |
|
471 |
apply (simp add:is_created_proc_def is_created_proc'_def) |
|
472 |
apply (case_tac a) |
|
473 |
apply (auto simp add:is_created_proc_def is_created_proc'_def dest:no_del_died) |
|
474 |
done |
|
475 |
||
476 |
lemma enrich_proc_dup_in: |
|
89 | 477 |
"\<lbrakk>is_created_proc s p; p' \<notin> all_procs s; no_del_event s; valid s\<rbrakk> |
478 |
\<Longrightarrow> p' \<in> current_procs (enrich_proc s p p' i)" |
|
87 | 479 |
apply (induct s, simp add:is_created_proc_def) |
480 |
apply (frule vt_grant_os, frule vd_cons) |
|
89 | 481 |
apply (case_tac a) |
482 |
apply ( auto simp:is_created_proc_def Let_def enrich_msgq_cur_procs |
|
483 |
dest:not_all_procs_prop3) |
|
484 |
sorry |
|
82 | 485 |
|
87 | 486 |
lemma enrich_proc_dup_ffd: |
487 |
"\<lbrakk>file_of_proc_fd s p fd = Some f; is_created_proc s p; p' \<notin> all_procs s; valid s\<rbrakk> |
|
89 | 488 |
\<Longrightarrow> file_of_proc_fd (enrich_proc s p p' i) p' fd = Some f" |
87 | 489 |
apply (induct s, simp add:is_created_proc_def) |
490 |
apply (frule vt_grant_os, frule vd_cons) |
|
89 | 491 |
apply (case_tac a, auto simp:is_created_proc_def proc_file_fds_def Let_def |
87 | 492 |
dest:not_all_procs_prop3 split:if_splits option.splits) |
89 | 493 |
sorry |
87 | 494 |
|
495 |
lemma enrich_proc_dup_ffd': |
|
89 | 496 |
"\<lbrakk>file_of_proc_fd (enrich_proc s p p' i) p' fd = Some f; is_created_proc s p; p' \<notin> all_procs s; |
87 | 497 |
no_del_event s; valid s\<rbrakk> |
498 |
\<Longrightarrow> file_of_proc_fd s p fd = Some f" |
|
499 |
apply (induct s, simp add:is_created_proc_def) |
|
500 |
apply (frule vt_grant_os, frule vd_cons) |
|
89 | 501 |
apply (case_tac a, auto simp:is_created_proc_def proc_file_fds_def Let_def |
87 | 502 |
dest:not_all_procs_prop3 split:if_splits option.splits) |
89 | 503 |
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
|
504 |
|
87 | 505 |
lemma enrich_proc_dup_ffd_eq: |
506 |
"\<lbrakk>is_created_proc s p; p' \<notin> all_procs s; no_del_event s; valid s\<rbrakk> |
|
89 | 507 |
\<Longrightarrow> file_of_proc_fd (enrich_proc s p p' i) p' fd = file_of_proc_fd s p fd" |
87 | 508 |
apply (case_tac "file_of_proc_fd s p fd") |
89 | 509 |
apply (case_tac[!] "file_of_proc_fd (enrich_proc s p p' i) p' fd") |
87 | 510 |
apply (auto dest:enrich_proc_dup_ffd enrich_proc_dup_ffd') |
89 | 511 |
apply (drule_tac i = i in enrich_proc_dup_ffd, simp+) |
87 | 512 |
done |
513 |
||
89 | 514 |
lemma enrich_proc_cur_msgqs: |
515 |
"\<lbrakk>valid s\<rbrakk> \<Longrightarrow> current_msgqs (enrich_proc s p p' i) = current_msgqs s \<union> {q'. q' \<ge> new_msgq s \<and> q' \<le> new_msgq s + (nums_of_recvmsg s p) - 1}" |
|
516 |
apply (induct s, simp) |
|
517 |
apply (auto)[1] |
|
518 |
apply (drule new_msgq_1, simp, simp) |
|
519 |
apply (frule vt_grant_os, frule vd_cons) |
|
520 |
sorry |
|
521 |
||
522 |
lemma enrich_proc_not_alive: |
|
523 |
"\<lbrakk>enrich_not_alive s (E_proc p' (new_msgq s) (new_msgq s + (nums_of_recvmsg s p) - 1)) obj; |
|
524 |
is_created_proc s p; p' \<notin> all_procs s; no_del_event s; valid s\<rbrakk> |
|
525 |
\<Longrightarrow> enrich_not_alive (enrich_proc s p p' (new_msgq s)) (E_proc p' (new_msgq s) (new_msgq s + (nums_of_recvmsg s p) - 1)) obj" |
|
526 |
apply (case_tac obj, simp_all) |
|
527 |
prefer 5 |
|
528 |
apply (simp add:enrich_proc_cur_msgqs) |
|
529 |
apply (rule impI, rule notI) |
|
530 |
apply simp |
|
531 |
apply (auto)[1] |
|
532 |
defer |
|
533 |
apply simp |
|
534 |
apply (rule impI, rule notI) |
|
535 |
defer |
|
536 |
apply (subgoal_tac "new_msgq s \<noteq> 0") |
|
537 |
apply simp |
|
538 |
apply arith |
|
539 |
apply (simp_all add:enrich_proc_cur_procs enrich_proc_cur_files enrich_proc_cur_inums |
|
540 |
enrich_proc_cur_msgqs enrich_proc_cur_msgs enrich_proc_cur_fds) |
|
541 |
defer |
|
542 |
apply (rule impI, rule notI) |
|
543 |
sorry |
|
544 |
||
87 | 545 |
|
546 |
lemma enrich_proc_dup_fflags: |
|
547 |
"\<lbrakk>flags_of_proc_fd s p fd = Some flag; is_created_proc s p; p' \<notin> all_procs s; valid s\<rbrakk> |
|
548 |
\<Longrightarrow> flags_of_proc_fd (enrich_proc s p p') p' fd = Some (remove_create_flag flag) \<or> |
|
549 |
flags_of_proc_fd (enrich_proc s p p') p' fd = Some flag" |
|
550 |
apply (induct s arbitrary:p, simp add:is_created_proc_def) |
|
551 |
apply (frule vt_grant_os, frule vd_cons) |
|
89 | 552 |
apply (case_tac a, auto simp:is_created_proc_def proc_file_fds_def is_creat_flag_def Let_def |
87 | 553 |
dest:not_all_procs_prop3 split:if_splits option.splits) |
89 | 554 |
sorry |
87 | 555 |
|
556 |
lemma enrich_proc_dup_ffds: |
|
557 |
"\<lbrakk>is_created_proc s p; p' \<notin> all_procs s; no_del_event s; valid s\<rbrakk> |
|
558 |
\<Longrightarrow> proc_file_fds (enrich_proc s p p') p' = proc_file_fds s p" |
|
559 |
apply (auto simp:proc_file_fds_def) |
|
560 |
apply (rule_tac x = f in exI) |
|
561 |
apply (erule enrich_proc_dup_ffd', simp+) |
|
562 |
apply (rule_tac x = f in exI) |
|
563 |
apply (erule enrich_proc_dup_ffd, simp+) |
|
564 |
done |
|
565 |
||
566 |
lemma enrich_proc_dup_ffds_eq_fds: |
|
567 |
"\<lbrakk>is_created_proc s p; p' \<notin> all_procs s; no_del_event s; valid s\<rbrakk> |
|
568 |
\<Longrightarrow> current_proc_fds (enrich_proc s p p') p' = proc_file_fds s p" |
|
569 |
apply (induct s arbitrary:p) |
|
570 |
apply (simp add: is_created_proc_def) |
|
571 |
apply (frule not_all_procs_prop3) |
|
572 |
apply (frule vd_cons, frule vt_grant_os, case_tac a) |
|
573 |
apply (auto split:if_splits option.splits dest:proc_fd_in_fds set_mp not_all_procs_prop3 |
|
89 | 574 |
simp:proc_file_fds_def is_created_proc_def Let_def) |
575 |
sorry |
|
576 |
||
577 |
lemma enrich_proc_dup_ffds': |
|
578 |
"\<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> |
|
579 |
\<Longrightarrow> fd \<notin> proc_file_fds s p \<and> file_of_proc_fd s p fd = None" |
|
580 |
apply (auto simp:enrich_proc_dup_ffds_eq_fds) |
|
581 |
apply (simp add:proc_file_fds_def) |
|
87 | 582 |
done |
583 |
||
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
|
584 |
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
|
585 |
"\<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
|
586 |
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
|
587 |
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
|
588 |
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
|
589 |
apply (case_tac a, auto) |
89 | 590 |
apply (auto split:option.splits simp del:grant.simps simp add:Let_def) |
591 |
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
|
592 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
593 |
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
|
594 |
"\<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
|
595 |
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
|
596 |
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
|
597 |
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
|
598 |
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
|
599 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
600 |
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
|
601 |
"\<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
|
602 |
\<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
|
603 |
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
|
604 |
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
|
605 |
apply (frule vd_cons, frule vt_grant_os) |
89 | 606 |
apply (case_tac a, auto split:option.splits simp:not_all_procs_sock Let_def) |
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
|
607 |
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
|
608 |
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
|
609 |
apply (drule filefd_socket_conflict, simp_all add:current_sockets_def) |
89 | 610 |
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
|
611 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
612 |
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
|
613 |
"\<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
|
614 |
\<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
|
615 |
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
|
616 |
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
|
617 |
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
|
618 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
619 |
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
|
620 |
"\<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
|
621 |
\<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
|
622 |
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
|
623 |
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
|
624 |
apply (frule vd_cons, frule vt_grant_os) |
89 | 625 |
apply (case_tac a, auto split:option.splits t_socket_type.splits simp:Let_def) |
626 |
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
|
627 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
628 |
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
|
629 |
"\<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
|
630 |
\<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
|
631 |
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
|
632 |
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
|
633 |
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
|
634 |
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
|
635 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
636 |
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
|
637 |
"\<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
|
638 |
\<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
|
639 |
apply (rule ext, case_tac x) |
89 | 640 |
apply (auto simp add:is_udp_sock_def enrich_proc_cur_itag enrich_proc_cur_inos |
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
|
641 |
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
|
642 |
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
|
643 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
644 |
lemma enrich_proc_cur_msgqs: |
89 | 645 |
"\<lbrakk>q \<in> current_msgqs s; valid s\<rbrakk> \<Longrightarrow> q \<in> current_msgqs (enrich_proc s 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
|
646 |
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
|
647 |
apply (frule vt_grant_os, frule vd_cons) |
89 | 648 |
apply (case_tac a, auto simp:Let_def) |
649 |
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
|
650 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
651 |
lemma enrich_proc_cur_msgs: |
89 | 652 |
"\<lbrakk>q \<in> current_msgqs s; valid s\<rbrakk> \<Longrightarrow> msgs_of_queue (enrich_proc s p p') q = msgs_of_queue s q" |
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
|
653 |
apply (induct s, simp) |
89 | 654 |
apply (frule_tac p = p and p' = p' in enrich_proc_cur_msgqs, 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
|
655 |
apply (frule vt_grant_os, frule vd_cons) |
89 | 656 |
apply (case_tac a, auto simp:Let_def) |
657 |
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
|
658 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
659 |
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
|
660 |
"\<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
|
661 |
\<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
|
662 |
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
|
663 |
apply (frule vt_grant_os, frule vd_cons) |
89 | 664 |
apply (case_tac a, auto simp:is_created_proc_simps Let_def) |
665 |
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
|
666 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
667 |
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
|
668 |
"\<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
|
669 |
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
|
670 |
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
|
671 |
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
|
672 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
673 |
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
|
674 |
"\<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
|
675 |
\<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
|
676 |
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
|
677 |
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
|
678 |
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
|
679 |
apply (case_tac a) |
89 | 680 |
sorry |
681 |
(* |
|
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
|
682 |
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
|
683 |
done |
89 | 684 |
*) |
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
|
685 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
686 |
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
|
687 |
"\<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
|
688 |
\<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
|
689 |
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
|
690 |
apply (frule vt_grant_os, frule vd_cons) |
89 | 691 |
apply (frule not_all_procs_prop3) 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
|
692 |
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
|
693 |
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
|
694 |
done |
89 | 695 |
*) |
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
|
696 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
697 |
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
|
698 |
"\<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
|
699 |
\<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
|
700 |
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
|
701 |
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
|
702 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
703 |
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
|
704 |
"\<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
|
705 |
\<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
|
706 |
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
|
707 |
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
|
708 |
enrich_proc_cur_msgqs enrich_proc_cur_msgs enrich_proc_cur_fds) |
89 | 709 |
defer |
710 |
apply (rule impI, rule notI) |
|
711 |
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
|
712 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
713 |
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
|
714 |
"\<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
|
715 |
\<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
|
716 |
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
|
717 |
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
|
718 |
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
|
719 |
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
|
720 |
apply (auto simp:is_created_proc_simps dest:proc_fd_in_procs split:if_splits) |
89 | 721 |
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
|
722 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
723 |
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
|
724 |
"\<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
|
725 |
\<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
|
726 |
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
|
727 |
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
|
728 |
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
|
729 |
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
|
730 |
apply (auto simp:is_created_proc_simps dest:proc_fd_in_procs current_fflag_has_ffd split:if_splits option.splits) |
89 | 731 |
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
|
732 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
733 |
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
|
734 |
"\<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
|
735 |
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
|
736 |
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
|
737 |
apply (case_tac a, auto simp:files_hung_by_del.simps) |
89 | 738 |
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
|
739 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
740 |
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
|
741 |
"\<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
|
742 |
\<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
|
743 |
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
|
744 |
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
|
745 |
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
|
746 |
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
|
747 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
748 |
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
|
749 |
"\<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
|
750 |
\<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
|
751 |
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
|
752 |
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
|
753 |
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
|
754 |
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
|
755 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
756 |
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
|
757 |
"\<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
|
758 |
\<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
|
759 |
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
|
760 |
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
|
761 |
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
|
762 |
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
|
763 |
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
|
764 |
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
|
765 |
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
|
766 |
|
82 | 767 |
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
|
768 |
"\<lbrakk>valid s; is_created_proc s p; p' \<notin> all_procs s; no_del_event s\<rbrakk> |
82 | 769 |
\<Longrightarrow> valid (enrich_proc s p p') \<and> |
770 |
(\<forall> tp. tp \<in> current_procs s \<longrightarrow> cp2sproc (enrich_proc s p p') tp = cp2sproc s tp) \<and> |
|
771 |
(\<forall> f. f \<in> current_files s \<longrightarrow> cf2sfile (enrich_proc s p p') f = cf2sfile s f) \<and> |
|
772 |
(\<forall> q. q \<in> current_msgqs s \<longrightarrow> cq2smsgq (enrich_proc s p p') q = cq2smsgq s q) \<and> |
|
773 |
(\<forall> tp fd. fd \<in> proc_file_fds s tp \<longrightarrow> cfd2sfd (enrich_proc s p p') tp fd = cfd2sfd s tp fd) \<and> |
|
774 |
(cp2sproc (enrich_proc s p p') p' = cp2sproc s p) \<and> |
|
775 |
(\<forall> fd. fd \<in> proc_file_fds s p \<longrightarrow> cfd2sfd (enrich_proc s p p') p' fd = cfd2sfd s p fd)" |
|
776 |
proof (induct s) |
|
777 |
case Nil |
|
778 |
thus ?case by (auto simp:is_created_proc_def) |
|
779 |
next |
|
780 |
case (Cons e s) |
|
83 | 781 |
hence vd_cons': "valid (e # s)" and created_cons: "is_created_proc (e # s) p" |
82 | 782 |
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
|
783 |
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
|
784 |
and nodel_cons: "no_del_event (e # s)" |
83 | 785 |
by (auto dest:vd_cons' vt_grant_os vt_grant) |
82 | 786 |
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
|
787 |
from nodel_cons have nodel: "no_del_event s" by (case_tac e, auto) |
82 | 788 |
from Cons have pre: "is_created_proc s p \<Longrightarrow> valid (enrich_proc s p p') \<and> |
789 |
(\<forall>tp. tp \<in> current_procs s \<longrightarrow> cp2sproc (enrich_proc s p p') tp = cp2sproc s tp) \<and> |
|
790 |
(\<forall>f. f \<in> current_files s \<longrightarrow> cf2sfile (enrich_proc s p p') f = cf2sfile s f) \<and> |
|
791 |
(\<forall>q. q \<in> current_msgqs s \<longrightarrow> cq2smsgq (enrich_proc s p p') q = cq2smsgq s q) \<and> |
|
792 |
(\<forall>tp fd. fd \<in> proc_file_fds s tp \<longrightarrow> cfd2sfd (enrich_proc s p p') tp fd = cfd2sfd s tp fd) \<and> |
|
793 |
(cp2sproc (enrich_proc s p p') p' = cp2sproc s p) \<and> |
|
794 |
(\<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
|
795 |
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
|
796 |
|
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 |
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
|
798 |
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
|
799 |
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
|
800 |
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
|
801 |
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
|
802 |
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
|
803 |
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
|
804 |
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
|
805 |
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
|
806 |
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
|
807 |
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
|
808 |
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
|
809 |
done |
82 | 810 |
have vd_enrich_cons: "valid (enrich_proc (e # s) p p')" |
811 |
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
|
812 |
have "\<And>f fds. \<lbrakk>valid (Execve p f fds # enrich_proc s p p'); is_created_proc s p; |
82 | 813 |
valid (Execve p f fds # s); p' \<notin> all_procs s\<rbrakk> |
814 |
\<Longrightarrow> valid (Execve p' f (fds \<inter> proc_file_fds s p) # Execve p f fds # enrich_proc s p p')" |
|
815 |
proof- |
|
816 |
fix f fds |
|
817 |
assume a1: "valid (Execve p f fds # enrich_proc s p p')" and a2: "is_created_proc s p" |
|
818 |
and a3: "valid (Execve p f fds # s)" and a0: "p' \<notin> all_procs s" |
|
819 |
have cp2sp: "\<forall> tp. tp \<in> current_procs s \<longrightarrow> cp2sproc (enrich_proc s p p') tp = cp2sproc s tp" |
|
820 |
and cf2sf: "\<forall> tf. tf \<in> current_files s \<longrightarrow> cf2sfile (enrich_proc s p p') tf = cf2sfile s tf" |
|
821 |
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" |
|
822 |
and dup_sp: "cp2sproc (enrich_proc s p p') p' = cp2sproc s p" |
|
823 |
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
|
824 |
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
|
825 |
by auto |
82 | 826 |
show "valid (Execve p' f (fds \<inter> proc_file_fds s p) # Execve p f fds # enrich_proc s p p')" |
827 |
proof- |
|
828 |
from a0 a3 have a0': "p' \<noteq> p" by (auto dest!:vt_grant_os not_all_procs_prop3) |
|
829 |
from a3 have grant: "grant s (Execve p f fds)" and os: "os_grant s (Execve p f fds)" |
|
830 |
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
|
831 |
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
|
832 |
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
|
833 |
by (auto dest:vt_grant_os simp:enrich_proc_is_file) |
82 | 834 |
moreover have a5: "proc_file_fds s p \<subseteq> proc_file_fds (Execve p f fds # enrich_proc s p p') p'" |
835 |
using a3 a0' |
|
836 |
apply (frule_tac vt_grant_os) |
|
837 |
apply (auto simp:proc_file_fds_def) |
|
838 |
apply (rule_tac x = fa in exI) |
|
839 |
apply (erule enrich_proc_dup_ffd) |
|
840 |
apply (simp_all add:vd all_procs a2) |
|
841 |
done |
|
842 |
ultimately have "os_grant (Execve p f fds # enrich_proc s p p') (Execve p' f (fds \<inter> proc_file_fds s p))" |
|
843 |
apply (auto simp:is_file_simps enrich_proc_dup_in a2 vd all_procs a1 enrich_proc_dup_ffds) |
|
844 |
done |
|
845 |
moreover have "grant (Execve p f fds # enrich_proc s p p') (Execve p' f (fds \<inter> proc_file_fds s p))" |
|
846 |
proof- |
|
847 |
from grant obtain up rp tp uf rf tf |
|
848 |
where p1: "sectxt_of_obj s (O_proc p) = Some (up, rp, tp)" |
|
849 |
and p2: "sectxt_of_obj s (O_file f) = Some (uf, rf, tf)" |
|
850 |
by (simp split:option.splits, blast) |
|
851 |
with grant obtain pu nr nt where p3: "npctxt_execve (up, rp, tp) (uf, rf, tf) = Some (pu, nr, nt)" |
|
852 |
by (simp split:option.splits del:npctxt_execve.simps, blast) |
|
853 |
have p1': "sectxt_of_obj (Execve p f fds # enrich_proc s p p') (O_proc p') = Some (up, rp, tp)" |
|
854 |
using p1 dup_sp a1 a0' |
|
855 |
apply (simp add:sectxt_of_obj_simps) |
|
856 |
by (simp add:cp2sproc_def split:option.splits) |
|
857 |
from os have f_in': "is_file s f" by simp |
|
858 |
from vd os have "\<exists> sf. cf2sfile s f = Some sf" |
|
859 |
by (auto dest!:is_file_in_current current_file_has_sfile) |
|
860 |
hence p2': "sectxt_of_obj (Execve p f fds # enrich_proc s p p') (O_file f) = Some (uf, rf, tf)" |
|
861 |
using f_in p2 cf2sf os a1 |
|
862 |
apply (erule_tac x = f in allE) |
|
863 |
apply (auto dest:is_file_in_current simp:cf2sfile_def sectxt_of_obj_simps split:option.splits) |
|
864 |
apply (case_tac f, simp) |
|
865 |
apply (drule_tac s = s in root_is_dir', simp add:vd, simp+) |
|
866 |
done |
|
867 |
from dup_sfd a5 have "\<forall>fd. fd \<in> proc_file_fds s p \<longrightarrow> |
|
868 |
cfd2sfd (Execve p f fds # enrich_proc s p p') p' fd = cfd2sfd s p fd" |
|
869 |
apply (rule_tac allI) |
|
870 |
apply (erule_tac x = fd in allE, clarsimp) |
|
871 |
apply (drule set_mp, simp) |
|
872 |
apply (auto simp:cfd2sfd_execve proc_file_fds_def a1) |
|
873 |
done |
|
874 |
hence "inherit_fds_check (Execve p f fds # enrich_proc s p p') (up, nr, nt) p' (fds \<inter> proc_file_fds s p)" |
|
875 |
using grant os p1 p2 p3 vd |
|
876 |
apply (clarsimp) |
|
877 |
apply (rule_tac s = s and p = p and fds = fds in enrich_inherit_fds_check_dup) |
|
878 |
apply simp_all |
|
879 |
done |
|
880 |
moreover have "search_check (Execve p f fds # enrich_proc s p p') (up, rp, tp) f" |
|
881 |
using p1 p2 p2' vd cf2sf f_in f_in' grant p3 f_in a1 |
|
882 |
apply (rule_tac s = s in enrich_search_check) |
|
883 |
apply (simp_all add:is_file_simps) |
|
884 |
apply (rule allI, rule impI, erule_tac x = fa in allE, simp) |
|
885 |
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
|
886 |
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
|
887 |
done |
82 | 888 |
ultimately show ?thesis |
889 |
using p1' p2' p3 |
|
890 |
apply (simp split:option.splits) |
|
891 |
using grant p1 p2 |
|
892 |
apply simp |
|
893 |
done |
|
894 |
qed |
|
895 |
ultimately show ?thesis using a1 |
|
896 |
by (erule_tac valid.intros(2), auto) |
|
897 |
qed |
|
898 |
qed |
|
899 |
moreover have "\<And>tp fds. \<lbrakk>valid (Clone tp p fds # s); p' \<noteq> p; p' \<notin> all_procs s\<rbrakk> \<Longrightarrow> |
|
900 |
valid (Clone tp p' (fds \<inter> proc_file_fds s tp) # Clone tp p fds # s)" |
|
901 |
apply (frule vt_grant_os, frule vt_grant, drule not_all_procs_prop3) |
|
902 |
apply (rule valid.intros(2)) |
|
903 |
apply (simp_all split:option.splits add:sectxt_of_obj_simps) |
|
904 |
apply (auto simp add:proc_file_fds_def)[1] |
|
905 |
apply (auto simp:inherit_fds_check_def sectxt_of_obj_simps sectxts_of_fds_def inherit_fds_check_ctxt_def) |
|
906 |
done |
|
907 |
moreover have "\<And>f flags fd opt. \<lbrakk>valid (Open p f flags fd opt # enrich_proc s p p'); |
|
908 |
is_created_proc s p; valid (Open p f flags fd opt # s); p' \<notin> all_procs s\<rbrakk> |
|
909 |
\<Longrightarrow> valid (Open p' f (remove_create_flag flags) fd None # Open p f flags fd opt # enrich_proc s p p')" |
|
910 |
proof- |
|
911 |
fix f flags fd opt |
|
912 |
assume a1: "valid (Open p f flags fd opt # enrich_proc s p p')" and a2: "is_created_proc s p" |
|
913 |
and a3: "valid (Open p f flags fd opt # s)" and a4: "p' \<notin> all_procs s" |
|
914 |
have cp2sp: "\<forall> tp. tp \<in> current_procs s \<longrightarrow> cp2sproc (enrich_proc s p p') tp = cp2sproc s tp" |
|
915 |
and cf2sf: "\<forall> tf. tf \<in> current_files s \<longrightarrow> cf2sfile (enrich_proc s p p') tf = cf2sfile s tf" |
|
916 |
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" |
|
917 |
and dup_sp: "cp2sproc (enrich_proc s p p') p' = cp2sproc s p" |
|
918 |
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" |
|
919 |
using pre a2 by auto |
|
920 |
from a4 a3 have a0: "p' \<noteq> p" by (auto dest!:vt_grant_os not_all_procs_prop3 split:option.splits) |
|
921 |
have a5: "p' \<in> current_procs (enrich_proc s p p')" |
|
922 |
using a2 a3 vd |
|
923 |
apply (erule_tac enrich_proc_dup_in) |
|
924 |
by (simp_all add:vd a4) |
|
925 |
have a6: "is_file (Open p f flags fd opt # enrich_proc s p p') f" |
|
926 |
using a1 a3 |
|
927 |
by (auto simp:is_file_open dest:vt_grant_os) |
|
928 |
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
|
929 |
using a2 a4 vd nodel |
82 | 930 |
apply (simp add:enrich_proc_dup_ffds_eq_fds) |
931 |
apply (rule notI) |
|
932 |
apply (drule_tac p = p in file_fds_subset_pfds) |
|
933 |
apply (drule set_mp, simp) |
|
934 |
using a3 |
|
935 |
apply (drule_tac vt_grant_os) |
|
936 |
apply (auto split:option.splits) |
|
937 |
done |
|
938 |
from a1 have a8: "valid (enrich_proc s p p')" by (erule_tac valid.cases, auto) |
|
939 |
from a3 have grant: "grant s (Open p f flags fd opt)" and os: "os_grant s (Open p f flags fd opt)" |
|
940 |
by (auto dest:vt_grant_os vt_grant) |
|
941 |
show "valid (Open p' f (remove_create_flag flags) fd None # Open p f flags fd opt # enrich_proc s p p')" |
|
942 |
proof (cases opt) |
|
943 |
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
|
944 |
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
|
945 |
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
|
946 |
by (auto dest:vt_grant_os simp:enrich_proc_is_file) |
82 | 947 |
from grant None obtain up rp tp uf rf tf |
948 |
where p1: "sectxt_of_obj s (O_proc p) = Some (up, rp, tp)" |
|
949 |
and p2: "sectxt_of_obj s (O_file f) = Some (uf, rf, tf)" |
|
950 |
apply (simp split:option.splits) |
|
951 |
by (case_tac a, case_tac aa, blast) |
|
952 |
have p1': "sectxt_of_obj (Open p f flags fd opt # enrich_proc s p p') (O_proc p') = Some (up, rp, tp)" |
|
953 |
using p1 dup_sp a1 |
|
954 |
apply (simp add:sectxt_of_obj_simps) |
|
955 |
by (simp add:cp2sproc_def split:option.splits) |
|
956 |
from os None have f_in': "is_file s f" by simp |
|
957 |
from vd os None have "\<exists> sf. cf2sfile s f = Some sf" |
|
958 |
by (auto dest!:is_file_in_current current_file_has_sfile) |
|
959 |
hence p2': "sectxt_of_obj (Open p f flags fd opt # enrich_proc s p p') (O_file f) = Some (uf, rf, tf)" |
|
960 |
using p2 cf2sf os a1 None f_in' vd f_in |
|
961 |
apply (erule_tac x = f in allE) |
|
962 |
apply (auto dest:is_file_in_current simp:cf2sfile_def sectxt_of_obj_simps split:option.splits) |
|
963 |
apply (case_tac f, simp) |
|
964 |
apply (drule_tac s = s in root_is_dir', simp add:vd, simp+) |
|
965 |
done |
|
966 |
have "search_check (Open p f flags fd opt # enrich_proc s p p') (up, rp, tp) f" |
|
967 |
using p1 p2 p2' vd cf2sf f_in f_in' grant f_in a1 None |
|
968 |
apply (rule_tac s = s in enrich_search_check) |
|
969 |
apply (simp_all add:is_file_simps) |
|
970 |
apply (rule allI, rule impI, erule_tac x = fa in allE, simp) |
|
971 |
apply (simp add:cf2sfile_open_none) |
|
972 |
done |
|
973 |
thus ?thesis using a0 a5 a6 a7 None a1 |
|
974 |
apply (rule_tac valid.intros(2)) |
|
975 |
apply (simp_all add:a1) |
|
976 |
apply (case_tac flags, simp add:is_creat_excl_flag_def) |
|
977 |
using p1' p2' |
|
978 |
apply simp |
|
979 |
using grant p1 p2 |
|
980 |
apply (simp add:oflags_check_remove_create) |
|
981 |
done |
|
982 |
next |
|
983 |
case (Some inum) |
|
984 |
with os obtain pf where parent: "parent f = Some pf" by auto |
|
985 |
with grant Some obtain pu rp pt pfu pfr pft where |
|
986 |
p1: "sectxt_of_obj s (O_proc p) = Some (pu, rp, pt)" |
|
987 |
and p2: "sectxt_of_obj s (O_dir pf) = Some (pfu, pfr, pft)" |
|
988 |
apply (simp split:option.splits) |
|
989 |
apply (case_tac a, case_tac aa, blast) |
|
990 |
done |
|
991 |
from p1 have p1': "sectxt_of_obj (enrich_proc s p p') (O_proc p) = Some (pu, rp, pt)" |
|
992 |
using cp2sp os |
|
993 |
apply (erule_tac x = p in allE) |
|
994 |
apply (auto split:option.splits simp:cp2sproc_def) |
|
995 |
done |
|
996 |
from os parent Some |
|
997 |
have pf_in: "is_dir s pf" by auto |
|
998 |
hence "\<exists> sf. cf2sfile s pf = Some sf" using vd |
|
999 |
by (auto dest!:is_dir_in_current current_file_has_sfile) |
|
1000 |
from a1 parent Some have pf_in': "is_dir (enrich_proc s p p') pf" |
|
1001 |
apply (frule_tac vt_grant_os) |
|
1002 |
by (clarsimp) |
|
1003 |
have p2': "sectxt_of_obj (enrich_proc s p p') (O_dir pf) = Some (pfu, pfr, pft)" |
|
1004 |
proof- |
|
1005 |
have "cf2sfile (enrich_proc s p p') pf = cf2sfile s pf" |
|
1006 |
using cf2sf pf_in |
|
1007 |
apply (drule_tac is_dir_in_current) |
|
1008 |
apply (erule_tac x = pf in allE) |
|
1009 |
by simp |
|
1010 |
with pf_in pf_in' p2 vd Some a8 |
|
1011 |
show ?thesis |
|
1012 |
apply (frule_tac is_dir_not_file) |
|
1013 |
apply (frule_tac s = "enrich_proc s p p'" in is_dir_not_file) |
|
1014 |
apply (simp add:cf2sfile_def) |
|
1015 |
apply (case_tac pf, simp) |
|
1016 |
apply (simp add:sroot_def root_sec_remains) |
|
1017 |
by (auto split:option.splits dest!:current_has_sec' get_pfs_secs_prop' dest:parentf_is_dir_prop1) |
|
1018 |
qed |
|
1019 |
from p1 have dup: "sectxt_of_obj (Open p f flags fd (Some inum) # enrich_proc s p p') (O_proc p') |
|
1020 |
= Some (pu, rp, pt)" |
|
1021 |
using a1 Some |
|
1022 |
apply (simp add:sec_open) |
|
1023 |
using dup_sp |
|
1024 |
apply (auto split:option.splits if_splits simp:cp2sproc_def) |
|
1025 |
done |
|
1026 |
have nsf: "sectxt_of_obj (Open p f flags fd (Some inum) # enrich_proc s p p') (O_file f) |
|
1027 |
= Some (pu, R_object, type_transition pt pft C_file True)" |
|
1028 |
using a1 Some p1 p2 parent p2' p1' |
|
1029 |
by (simp add:sec_open) |
|
1030 |
have "search_check (Open p f flags fd (Some inum) # enrich_proc s p p') (pu, rp, pt) f" |
|
1031 |
proof- |
|
1032 |
have "search_check (Open p f flags fd (Some inum) # enrich_proc s p p') (pu, rp, pt) pf" |
|
1033 |
using grant Some parent p1 p2 vd a1 pf_in pf_in' p2' |
|
1034 |
apply simp |
|
1035 |
apply (rule_tac s = s in enrich_search_check') |
|
1036 |
apply (simp_all add:is_dir_simps sectxt_of_obj_simps) |
|
1037 |
apply (rule allI, rule impI) |
|
1038 |
apply (case_tac "fa = f") |
|
1039 |
using os Some |
|
1040 |
apply simp |
|
1041 |
apply (drule_tac f' = fa in cf2sfile_open) |
|
1042 |
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
|
1043 |
using enrich_proc_cur_files a2 nodel |
82 | 1044 |
apply simp |
1045 |
apply simp |
|
1046 |
using cf2sf |
|
1047 |
apply simp |
|
1048 |
done |
|
1049 |
moreover have "is_file (Open p f flags fd (Some inum) # enrich_proc s p p') f" |
|
1050 |
using a1 Some |
|
1051 |
by (simp add:is_file_open) |
|
1052 |
ultimately |
|
1053 |
show ?thesis |
|
1054 |
using parent a1 Some nsf |
|
1055 |
apply (erule_tac search_check_leveling_f) |
|
1056 |
apply (simp_all) |
|
1057 |
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
|
1058 |
(* create new file, grant only check pf's SEARCH permission, not newfile itself, so we make assumptions of this case in the locale *) |
82 | 1059 |
apply (simp add:permission_check.simps) |
1060 |
sorry |
|
1061 |
qed |
|
1062 |
thus ?thesis using a0 a5 a6 a7 a1 Some |
|
1063 |
apply (rule_tac valid.intros(2)) |
|
1064 |
apply (simp add:a1) |
|
1065 |
apply simp |
|
1066 |
apply (case_tac flags, simp add:is_creat_excl_flag_def) |
|
1067 |
using grant p1 p2 parent dup nsf |
|
1068 |
apply (simp add:oflags_check_remove_create) |
|
1069 |
done |
|
1070 |
qed |
|
1071 |
qed |
|
1072 |
moreover have "\<And>fd. \<lbrakk>valid (CloseFd p fd # enrich_proc s p p'); is_created_proc s p; |
|
1073 |
valid (CloseFd p fd # s); p' \<notin> all_procs s; fd \<in> proc_file_fds s p\<rbrakk> |
|
1074 |
\<Longrightarrow> valid (CloseFd p' fd # CloseFd p fd # enrich_proc s p p')" |
|
1075 |
proof- |
|
1076 |
fix fd |
|
1077 |
assume a1: "valid (CloseFd p fd # enrich_proc s p p')" and a2: "is_created_proc s p" |
|
1078 |
and a3: "p' \<notin> all_procs s" and a4: "valid (CloseFd p fd # s)" |
|
1079 |
and a5: "fd \<in> proc_file_fds s p" |
|
1080 |
from a4 a3 have a0: "p' \<noteq> p" by (auto dest!:vt_grant_os not_all_procs_prop3) |
|
1081 |
have "p' \<in> current_procs (enrich_proc s p p')" |
|
1082 |
using a2 a3 vd |
|
1083 |
by (auto intro:enrich_proc_dup_in) |
|
1084 |
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
|
1085 |
using a5 a2 a3 vd pre_vd nodel |
82 | 1086 |
apply (simp) |
1087 |
apply (drule_tac s = "enrich_proc s p p'" and p = p' in file_fds_subset_pfds) |
|
1088 |
apply (erule set_mp) |
|
1089 |
apply (simp add:enrich_proc_dup_ffds) |
|
1090 |
done |
|
1091 |
ultimately show "valid (CloseFd p' fd # CloseFd p fd # enrich_proc s p p')" |
|
1092 |
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
|
1093 |
apply (simp_all add:a1 a0 a2 pre_vd) |
82 | 1094 |
done |
1095 |
qed |
|
1096 |
moreover have "\<And> fd. \<lbrakk>valid (ReadFile p fd # enrich_proc s p p'); |
|
1097 |
is_created_proc s p; valid (ReadFile p fd # s); p' \<notin> all_procs s\<rbrakk> |
|
1098 |
\<Longrightarrow> valid (ReadFile p' fd # ReadFile p fd # enrich_proc s p p')" |
|
1099 |
proof- |
|
1100 |
fix fd |
|
1101 |
assume a1: "valid (ReadFile p fd # enrich_proc s p p')" and a2: "is_created_proc s p" |
|
1102 |
and a3: "valid (ReadFile p fd # s)" and a4: "p' \<notin> all_procs s" |
|
1103 |
from a3 have os: "os_grant s (ReadFile p fd)" and grant: "grant s (ReadFile p fd)" |
|
1104 |
by (auto dest:vt_grant_os vt_grant) |
|
1105 |
have cp2sp: "\<forall> tp. tp \<in> current_procs s \<longrightarrow> cp2sproc (enrich_proc s p p') tp = cp2sproc s tp" |
|
1106 |
and cf2sf: "\<forall> tf. tf \<in> current_files s \<longrightarrow> cf2sfile (enrich_proc s p p') tf = cf2sfile s tf" |
|
1107 |
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" |
|
1108 |
and dup_sp: "cp2sproc (enrich_proc s p p') p' = cp2sproc s p" |
|
1109 |
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" |
|
1110 |
using pre a2 by auto |
|
1111 |
have vd_enrich: "valid (enrich_proc s p p')" using a1 by (auto dest:valid.cases) |
|
1112 |
show "valid (ReadFile p' fd # ReadFile p fd # enrich_proc s p p')" |
|
1113 |
proof- |
|
1114 |
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
|
1115 |
using a1 a2 a4 vd os nodel |
82 | 1116 |
apply (clarsimp simp:current_files_simps enrich_proc_dup_in enrich_proc_dup_ffds_eq_fds) |
1117 |
apply (simp add:proc_file_fds_def) |
|
1118 |
apply (rule conjI) |
|
1119 |
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
|
1120 |
using enrich_proc_cur_files |
82 | 1121 |
apply (simp) |
1122 |
apply (drule enrich_proc_dup_fflags) |
|
1123 |
apply simp_all |
|
1124 |
apply (erule disjE) |
|
1125 |
apply auto |
|
1126 |
apply (simp add:is_read_flag_def) |
|
1127 |
done |
|
1128 |
moreover have "grant (ReadFile p fd # enrich_proc s p p') (ReadFile p' fd)" |
|
1129 |
proof- |
|
1130 |
from grant obtain f sp sfd sf where p1: "file_of_proc_fd s p fd = Some f" |
|
1131 |
and p2: "sectxt_of_obj s (O_proc p) = Some sp" |
|
1132 |
and p3: "sectxt_of_obj s (O_fd p fd) = Some sfd" |
|
1133 |
and p4: "sectxt_of_obj s (O_file f) = Some sf" |
|
1134 |
by (auto split:option.splits) |
|
1135 |
from os obtain flag where p0: "flags_of_proc_fd s p fd = Some flag" |
|
1136 |
by auto |
|
1137 |
from os have f_in_s: "f \<in> current_files s" using p1 by simp |
|
1138 |
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
|
1139 |
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
|
1140 |
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
|
1141 |
by (auto simp:enrich_proc_is_file) |
82 | 1142 |
from p0 obtain flag' where p0': "flags_of_proc_fd (enrich_proc s p p') p' fd = Some flag'" |
1143 |
and p0'': "(flag' = flag) \<or> (flag' = remove_create_flag flag)" |
|
1144 |
using a2 a4 vd |
|
1145 |
apply (drule_tac enrich_proc_dup_fflags) |
|
1146 |
apply auto |
|
1147 |
apply (case_tac flag, auto) |
|
1148 |
apply (case_tac flag, auto) |
|
1149 |
done |
|
1150 |
from p1 have p1': "file_of_proc_fd (enrich_proc s p p') p' fd = Some f" |
|
1151 |
using a2 a4 vd |
|
1152 |
by (simp add:enrich_proc_dup_ffd) |
|
1153 |
from p2 have p2': "sectxt_of_obj (enrich_proc s p p') (O_proc p') = Some sp" |
|
1154 |
using dup_sp |
|
1155 |
by (auto simp:cp2sproc_def split:option.splits) |
|
1156 |
from p3 p1 p1' p0 p0' os have p3': "sectxt_of_obj (enrich_proc s p p') (O_fd p' fd) = Some sfd" |
|
1157 |
using dup_sfd |
|
1158 |
apply (erule_tac x = fd in allE) |
|
1159 |
apply (auto simp:proc_file_fds_def cfd2sfd_def split:option.splits) |
|
1160 |
apply (drule current_file_has_sfile') |
|
1161 |
apply (simp add:vd, simp) |
|
1162 |
apply (drule current_file_has_sfile') |
|
1163 |
apply (simp add:vd, simp) |
|
1164 |
done |
|
1165 |
from p4 have p4': "sectxt_of_obj (enrich_proc s p p') (O_file f) = Some sf" |
|
1166 |
using f_in_s cf2sf isfile_s isfile_s' a1 vd_enrich vd |
|
1167 |
apply (erule_tac x = f in allE) |
|
1168 |
apply (simp) |
|
1169 |
apply (auto simp:cf2sfile_def split:option.splits |
|
1170 |
dest!:current_has_sec' get_pfs_secs_prop' dest:parentf_is_dir is_file_in_current) |
|
1171 |
apply (case_tac f, simp, drule root_is_dir', simp, simp, simp) |
|
1172 |
done |
|
1173 |
show ?thesis using p1' p2' p3' p4' a1 |
|
1174 |
apply (simp add:sectxt_of_obj_simps) |
|
1175 |
using grant p1 p2 p3 p4 |
|
1176 |
apply simp |
|
1177 |
done |
|
1178 |
qed |
|
1179 |
ultimately show ?thesis |
|
1180 |
using a1 |
|
1181 |
by (erule_tac valid.intros(2), simp+) |
|
1182 |
qed |
|
1183 |
qed |
|
1184 |
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
|
1185 |
using vd_enrich created_cons vd_cons' all_procs_cons |
82 | 1186 |
apply (case_tac e) |
1187 |
apply (auto simp:is_created_proc_simps split:if_splits) |
|
1188 |
done |
|
1189 |
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
|
1190 |
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
|
1191 |
"\<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
|
1192 |
\<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
|
1193 |
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
|
1194 |
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
|
1195 |
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
|
1196 |
done |
85 | 1197 |
have sf_cons: |
1198 |
"\<forall>f. f \<in> current_files (e # s) \<longrightarrow> cf2sfile (enrich_proc (e # s) p p') f = cf2sfile (e # s) f" |
|
1199 |
proof clarify |
|
1200 |
fix f |
|
1201 |
assume a1: "f \<in> current_files (e # s)" |
|
1202 |
from pre have pre_sf: "\<And> f. \<lbrakk>f \<in> current_files s; is_created_proc s p\<rbrakk> |
|
1203 |
\<Longrightarrow> cf2sfile (enrich_proc s p p') f = cf2sfile s f" |
|
1204 |
by auto |
|
1205 |
from a1 have a1': "f \<in> current_files (enrich_proc (e # s) p p')" |
|
1206 |
using vd_cons' nodel_cons |
|
1207 |
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
|
1208 |
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
|
1209 |
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
|
1210 |
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
|
1211 |
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
|
1212 |
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
|
1213 |
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
|
1214 |
|
690636b7b6f1
find bug: a created proc can be tainted by a message, which cannot remain and maynot be duplicated
chunhan
parents:
85
diff
changeset
|
1215 |
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
|
1216 |
"\<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
|
1217 |
\<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
|
1218 |
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
|
1219 |
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
|
1220 |
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
|
1221 |
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
|
1222 |
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
|
1223 |
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
|
1224 |
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
|
1225 |
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
|
1226 |
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
|
1227 |
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
|
1228 |
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
|
1229 |
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
|
1230 |
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
|
1231 |
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
|
1232 |
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
|
1233 |
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
|
1234 |
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
|
1235 |
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
|
1236 |
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
|
1237 |
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
|
1238 |
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
|
1239 |
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
|
1240 |
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
|
1241 |
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
|
1242 |
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
|
1243 |
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
|
1244 |
"\<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
|
1245 |
\<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
|
1246 |
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
|
1247 |
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
|
1248 |
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
|
1249 |
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
|
1250 |
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
|
1251 |
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
|
1252 |
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
|
1253 |
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
|
1254 |
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
|
1255 |
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
|
1256 |
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
|
1257 |
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
|
1258 |
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
|
1259 |
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
|
1260 |
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
|
1261 |
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
|
1262 |
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
|
1263 |
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
|
1264 |
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
|
1265 |
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
|
1266 |
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
|
1267 |
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
|
1268 |
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
|
1269 |
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
|
1270 |
"\<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
|
1271 |
\<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
|
1272 |
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
|
1273 |
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
|
1274 |
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
|
1275 |
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
|
1276 |
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
|
1277 |
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
|
1278 |
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
|
1279 |
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
|
1280 |
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
|
1281 |
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
|
1282 |
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
|
1283 |
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
|
1284 |
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
|
1285 |
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
|
1286 |
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
|
1287 |
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
|
1288 |
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
|
1289 |
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
|
1290 |
from a1' vd have a5': "\<not> is_file (enrich_proc s p p') tf" by (simp add:is_dir_not_file) |
85 | 1291 |
|
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
|
1292 |
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
|
1293 |
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
|
1294 |
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
|
1295 |
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
|
1296 |
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
|
1297 |
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
|
1298 |
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
|
1299 |
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
|
1300 |
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
|
1301 |
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
|
1302 |
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
|
1303 |
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
|
1304 |
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
|
1305 |
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
|
1306 |
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
|
1307 |
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
|
1308 |
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
|
1309 |
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
|
1310 |
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
|
1311 |
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
|
1312 |
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
|
1313 |
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
|
1314 |
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
|
1315 |
\<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
|
1316 |
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
|
1317 |
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
|
1318 |
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
|
1319 |
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
|
1320 |
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
|
1321 |
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
|
1322 |
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
|
1323 |
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
|
1324 |
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
|
1325 |
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
|
1326 |
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
|
1327 |
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
|
1328 |
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
|
1329 |
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
|
1330 |
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
|
1331 |
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
|
1332 |
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
|
1333 |
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
|
1334 |
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
|
1335 |
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
|
1336 |
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
|
1337 |
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
|
1338 |
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
|
1339 |
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
|
1340 |
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
|
1341 |
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
|
1342 |
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
|
1343 |
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
|
1344 |
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
|
1345 |
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
|
1346 |
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
|
1347 |
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
|
1348 |
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
|
1349 |
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
|
1350 |
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
|
1351 |
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
|
1352 |
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
|
1353 |
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
|
1354 |
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
|
1355 |
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
|
1356 |
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
|
1357 |
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
|
1358 |
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
|
1359 |
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
|
1360 |
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
|
1361 |
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
|
1362 |
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
|
1363 |
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
|
1364 |
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
|
1365 |
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
|
1366 |
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
|
1367 |
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
|
1368 |
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
|
1369 |
\<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
|
1370 |
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
|
1371 |
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
|
1372 |
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
|
1373 |
|
690636b7b6f1
find bug: a created proc can be tainted by a message, which cannot remain and maynot be duplicated
chunhan
parents:
85
diff
changeset
|
1374 |
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
|
1375 |
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
|
1376 |
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
|
1377 |
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
|
1378 |
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
|
1379 |
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
|
1380 |
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
|
1381 |
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
|
1382 |
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
|
1383 |
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
|
1384 |
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
|
1385 |
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
|
1386 |
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
|
1387 |
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
|
1388 |
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
|
1389 |
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
|
1390 |
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
|
1391 |
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
|
1392 |
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
|
1393 |
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
|
1394 |
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
|
1395 |
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
|
1396 |
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
|
1397 |
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
|
1398 |
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
|
1399 |
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
|
1400 |
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
|
1401 |
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
|
1402 |
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
|
1403 |
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
|
1404 |
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
|
1405 |
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
|
1406 |
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
|
1407 |
\<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
|
1408 |
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
|
1409 |
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
|
1410 |
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
|
1411 |
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
|
1412 |
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
|
1413 |
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
|
1414 |
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
|
1415 |
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
|
1416 |
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
|
1417 |
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
|
1418 |
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
|
1419 |
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
|
1420 |
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
|
1421 |
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
|
1422 |
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
|
1423 |
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
|
1424 |
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
|
1425 |
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
|
1426 |
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
|
1427 |
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
|
1428 |
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
|
1429 |
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
|
1430 |
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
|
1431 |
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
|
1432 |
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
|
1433 |
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
|
1434 |
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
|
1435 |
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
|
1436 |
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
|
1437 |
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
|
1438 |
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
|
1439 |
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
|
1440 |
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
|
1441 |
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
|
1442 |
qed |
85 | 1443 |
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
|
1444 |
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
|
1445 |
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
|
1446 |
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
|
1447 |
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
|
1448 |
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
|
1449 |
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
|
1450 |
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
|
1451 |
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
|
1452 |
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
|
1453 |
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
|
1454 |
cfd2sfd (enrich_proc (e # s) p p') tp fd = cfd2sfd (e # s) tp fd" |
83 | 1455 |
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
|
1456 |
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
|
1457 |
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
|
1458 |
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
|
1459 |
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
|
1460 |
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
|
1461 |
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
|
1462 |
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
|
1463 |
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
|
1464 |
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
|
1465 |
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
|
1466 |
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
|
1467 |
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
|
1468 |
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
|
1469 |
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
|
1470 |
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
|
1471 |
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
|
1472 |
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
|
1473 |
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
|
1474 |
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
|
1475 |
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
|
1476 |
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
|
1477 |
done |
85 | 1478 |
have sec_proc: |
1479 |
"\<And> tp. \<lbrakk>tp \<in> current_procs s; is_created_proc s p\<rbrakk> |
|
1480 |
\<Longrightarrow> sectxt_of_obj (enrich_proc s p p') (O_proc tp) = sectxt_of_obj s (O_proc tp)" |
|
1481 |
using pre |
|
1482 |
apply (clarsimp) |
|
1483 |
apply (erule_tac x = tp in allE, auto simp:cp2sproc_def split:option.splits) |
|
1484 |
done |
|
1485 |
have sec_proc': |
|
1486 |
"\<And> tp. \<lbrakk>tp \<in> current_procs s; is_created_proc s p; p = tp\<rbrakk> |
|
1487 |
\<Longrightarrow> sectxt_of_obj (enrich_proc s tp p') (O_proc tp) = sectxt_of_obj s (O_proc tp)" |
|
1488 |
apply (drule_tac sec_proc, simp+) |
|
1489 |
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
|
1490 |
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
|
1491 |
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
|
1492 |
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
|
1493 |
\<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
|
1494 |
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
|
1495 |
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
|
1496 |
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
|
1497 |
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
|
1498 |
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
|
1499 |
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
|
1500 |
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
|
1501 |
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
|
1502 |
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
|
1503 |
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
|
1504 |
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
|
1505 |
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
|
1506 |
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
|
1507 |
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
|
1508 |
\<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
|
1509 |
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
|
1510 |
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
|
1511 |
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
|
1512 |
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
|
1513 |
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
|
1514 |
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
|
1515 |
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
|
1516 |
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
|
1517 |
\<Longrightarrow> cfd2sfd (enrich_proc (e # s) p p') tp fd = cfd2sfd (e # s) tp fd" |
85 | 1518 |
using a4 a1' vd_enrich_cons vd_cons' created_cons |
1519 |
apply (simp split:if_splits del:file_of_proc_fd.simps) |
|
1520 |
||
1521 |
apply (simp add:cfd2sfd_open sec_open is_created_proc_simps a2 del:file_of_proc_fd.simps) |
|
1522 |
apply (tactic {*my_clarify_tac 1*}) |
|
1523 |
apply (drule vd_cons) |
|
1524 |
apply (simp add:cfd2sfd_open sec_open a3 a2 split:if_splits) |
|
1525 |
apply (case_tac "proc \<in> current_procs s") |
|
1526 |
apply (simp add:sec_proc') |
|
1527 |
apply (case_tac "sectxt_of_obj s (O_proc proc)", simp+) |
|
1528 |
apply (case_tac "f \<in> current_files (e # s)") |
|
1529 |
apply (drule sf_cons[rule_format], simp) |
|
1530 |
using vd_enrich_cons |
|
1531 |
apply (simp add:cf2sfile_open_none) |
|
1532 |
using os |
|
1533 |
apply (simp add:current_files_simps is_file_in_current split:option.splits) |
|
1534 |
using os |
|
1535 |
apply (simp split:option.splits) |
|
1536 |
apply (rule impI) |
|
1537 |
apply (simp add:cfd2sfd_open sec_open a3 a2 split:if_splits) |
|
1538 |
apply (drule vd_cons) |
|
1539 |
apply (drule_tac p' = tp and fd' = fd and f' = f and s = "enrich_proc s proc p'" in cfd2sfd_open) |
|
1540 |
apply (simp, rule impI, simp) |
|
1541 |
apply (simp split:if_splits, rule conjI, rule impI, simp) |
|
1542 |
apply (drule pre_sfd', simp, simp) |
|
1543 |
||
1544 |
apply (simp add:cfd2sfd_open sec_open is_created_proc_simps a2 del:file_of_proc_fd.simps) |
|
1545 |
apply (case_tac "proc \<in> current_procs s") |
|
1546 |
apply (simp add:sec_proc) |
|
1547 |
apply (case_tac "f' \<in> current_files (e # s)") |
|
1548 |
apply (drule sf_cons[rule_format], simp) |
|
1549 |
apply (simp split:option.splits) |
|
1550 |
apply (rule impI|rule conjI)+ |
|
1551 |
apply (drule current_has_sec', simp add:vd, simp add:os) |
|
1552 |
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
|
1553 |
apply (simp split:if_splits) |
85 | 1554 |
apply (simp add:pre_sfd') |
1555 |
using os |
|
1556 |
apply (simp add:current_files_simps is_file_in_current split:option.splits) |
|
1557 |
using os |
|
1558 |
apply (simp split:option.splits) |
|
1559 |
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
|
1560 |
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
|
1561 |
\<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
|
1562 |
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
|
1563 |
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
|
1564 |
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
|
1565 |
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
|
1566 |
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
|
1567 |
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
|
1568 |
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
|
1569 |
done |
83 | 1570 |
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
|
1571 |
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
|
1572 |
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
|
1573 |
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
|
1574 |
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
|
1575 |
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
|
1576 |
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
|
1577 |
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
|
1578 |
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
|
1579 |
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
|
1580 |
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
|
1581 |
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
|
1582 |
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
|
1583 |
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
|
1584 |
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
|
1585 |
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
|
1586 |
\<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
|
1587 |
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
|
1588 |
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
|
1589 |
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
|
1590 |
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
|
1591 |
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
|
1592 |
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
|
1593 |
|
690636b7b6f1
find bug: a created proc can be tainted by a message, which cannot remain and maynot be duplicated
chunhan
parents:
85
diff
changeset
|
1594 |
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
|
1595 |
|
690636b7b6f1
find bug: a created proc can be tainted by a message, which cannot remain and maynot be duplicated
chunhan
parents:
85
diff
changeset
|
1596 |
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
|
1597 |
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
|
1598 |
thm cq2smsg_createmsgq |
82 | 1599 |
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
|
1600 |
moreover have "\<forall>tp. tp \<in> current_procs (e # s) \<longrightarrow> cp2sproc (enrich_proc (e # s) p p') tp = cp2sproc (e # s) tp" |
82 | 1601 |
sorry |
1602 |
moreover have "cp2sproc (enrich_proc (e # s) p p') p' = cp2sproc (e # s) p" |
|
1603 |
proof- |
|
1604 |
from pre have b0: "is_created_proc s p \<Longrightarrow> cp2sproc (enrich_proc s p p') p' = cp2sproc s p" by simp |
|
1605 |
have b1: "\<And> tp f fds. \<lbrakk>valid (enrich_proc (Execve tp f fds # s) p p'); valid (Execve tp f fds # s); |
|
1606 |
is_created_proc (Execve tp f fds # s) p; p' \<notin> all_procs (Execve tp f fds # s)\<rbrakk> |
|
1607 |
\<Longrightarrow> cp2sproc (enrich_proc (Execve tp f fds # s) p p') p' = cp2sproc (Execve tp f fds # s) p" |
|
1608 |
proof- |
|
1609 |
fix tp f fds |
|
1610 |
assume a1: "valid (enrich_proc (Execve tp f fds # s) p p')" |
|
1611 |
and a2: "valid (Execve tp f fds # s)" and a3: "is_created_proc (Execve tp f fds # s) p" |
|
1612 |
and a4: "p' \<notin> all_procs (Execve tp f fds # s)" |
|
1613 |
show "cp2sproc (enrich_proc (Execve tp f fds # s) p p') p' = cp2sproc (Execve tp f fds # s) p" |
|
1614 |
proof (cases "tp = p") |
|
1615 |
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
|
1616 |
show ?thesis using True a1 a2 a3 a4 b0 vd |
82 | 1617 |
thm not_all_procs_prop3 |
83 | 1618 |
apply (frule_tac not_all_procs_prop2) |
1619 |
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
|
1620 |
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
|
1621 |
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
|
1622 |
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
|
1623 |
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
|
1624 |
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
|
1625 |
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
|
1626 |
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
|
1627 |
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
|
1628 |
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
|
1629 |
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
|
1630 |
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
|
1631 |
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
|
1632 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
1633 |
|
83 | 1634 |
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
|
1635 |
*) |
82 | 1636 |
sorry |
1637 |
next |
|
1638 |
case False |
|
1639 |
show ?thesis sorry |
|
1640 |
qed |
|
1641 |
qed |
|
1642 |
have b2: "\<And> tp fd. cp2sproc (enrich_proc (ReadFile tp fd # s) p p') p' = cp2sproc (ReadFile tp fd # s) p" |
|
1643 |
sorry |
|
1644 |
have b3: "\<And> tp. cp2sproc (enrich_proc (Exit tp # s) p p') p' = cp2sproc (Exit tp # s) p" |
|
1645 |
sorry |
|
1646 |
have b4: "\<And> tp tp'. cp2sproc (enrich_proc (Kill tp tp' # s) p p') p' = cp2sproc (Kill tp tp' # s) p" |
|
1647 |
sorry |
|
1648 |
have b5: "\<And> tp tp' fds. cp2sproc (enrich_proc (Clone tp tp' fds # s) p p') p' = |
|
1649 |
cp2sproc (Clone tp tp' fds # s) p" |
|
1650 |
sorry |
|
1651 |
have b6: "\<And> tp f flags fd opt. cp2sproc (enrich_proc (Open tp f flags fd opt # s) p p') p' = |
|
1652 |
cp2sproc (Open tp f flags fd opt # s) p" |
|
1653 |
sorry |
|
1654 |
have b7: "\<And> tp fd. cp2sproc (enrich_proc (CloseFd tp fd # s) p p') p' = cp2sproc (CloseFd tp fd # s) p" |
|
1655 |
sorry |
|
1656 |
show ?thesis using vd_enrich_cons |
|
1657 |
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
|
1658 |
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
|
1659 |
apply (auto intro!:b1 b2 b3 b4 b5 b6 b7 simp del:enrich_proc.simps) |
83 | 1660 |
using created_cons vd_enrich_cons vd_cons' b0 |
82 | 1661 |
apply (auto simp:cp2sproc_other is_created_proc_def) |
1662 |
done |
|
1663 |
qed |
|
1664 |
moreover have "\<forall> fd. fd \<in> proc_file_fds (e # s) p \<longrightarrow> |
|
1665 |
cfd2sfd (enrich_proc (e # s) p p') p' fd = cfd2sfd (e # s) p fd" |
|
1666 |
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
|
1667 |
ultimately show ?case using vd_enrich_cons |
82 | 1668 |
by simp |
1669 |
qed |
|
1670 |
||
88 | 1671 |
lemma enrich_proc_s2ss: |
1672 |
"\<lbrakk>valid s; is_created_proc s p; p' \<notin> all_procs s\<rbrakk> \<Longrightarrow> s2ss (enrich_proc s p p') = s2ss s" |
|
82 | 1673 |
|
1674 |
lemma enrich_proc_valid: |
|
1675 |
"\<lbrakk>valid s; is_created_proc s p; p' \<notin> all_procs s\<rbrakk> \<Longrightarrow> valid (enrich_proc s p p')" |
|
1676 |
by (auto dest:enrich_proc_prop) |
|
1677 |
||
1678 |
lemma enrich_proc_valid: |
|
1679 |
"\<lbrakk>valid s; is_created_proc s p; p' \<notin> all_procs s\<rbrakk> \<Longrightarrow> " |
|
1680 |
||
1681 |
lemma enrich_proc_tainted: |
|
1682 |
"\<lbrakk>is_created_proc s p; p' \<notin> all_procs s; valid s\<rbrakk> |
|
1683 |
\<Longrightarrow> tainted (enrich_proc s p p') = (if (O_proc p \<in> tainted s) |
|
1684 |
then tainted s \<union> {O_proc p'} else tainted s)" |
|
1685 |
apply (induct s) |
|
1686 |
apply (simp add:is_created_proc_def) |
|
1687 |
apply (frule vt_grant_os, frule vd_cons, simp) |
|
1688 |
apply (frule enrich_proc_dup_in, simp+) |
|
1689 |
apply (frule not_all_procs_prop3) |
|
1690 |
apply (case_tac a) |
|
1691 |
prefer 3 |
|
1692 |
apply (simp split:if_splits) |
|
1693 |
apply (rule impI|rule conjI)+ |
|
1694 |
apply (simp add:is_created_proc_def) |
|
1695 |
apply (auto simp:is_created_proc_def split:if_splits dest:tainted_in_current)[1] |
|
1696 |
apply (simp add:is_created_proc_def) |
|
1697 |
||
1698 |
prefer 4 |
|
1699 |
apply (simp split:if_splits) |
|
1700 |
apply (rule impI|rule conjI)+ |
|
1701 |
apply (simp add:is_created_proc_def) |
|
1702 |
apply (auto simp:is_created_proc_def split:if_splits dest:tainted_in_current)[1] |
|
1703 |
apply (simp add:is_created_proc_def) |
|
1704 |
||
1705 |
prefer 4 |
|
1706 |
apply (auto simp:is_created_proc_def split:if_splits option.splits dest:tainted_in_current)[1] |
|
1707 |
||
1708 |
prefer 4 |
|
1709 |
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] |
|
1710 |
||
1711 |
||
1712 |
||
1713 |
lemma enrich_proc_dup_tainted: |
|
1714 |
"\<lbrakk>is_created_proc s p; p' \<notin> all_procs s; valid s\<rbrakk> |
|
1715 |
\<Longrightarrow> (O_proc p' \<in> tainted (enrich_proc s p p')) = (O_proc p \<in> tainted s)" |
|
1716 |
apply (induct s) |
|
1717 |
apply (simp add:is_created_proc_def) |
|
1718 |
apply (frule vt_grant_os, frule vd_cons) |
|
1719 |
apply (case_tac a) |
|
1720 |
apply (auto simp:is_created_proc_def)[1] |
|
1721 |
||
1722 |
||
1723 |
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
|
1724 |
|
82 | 1725 |
|
1726 |
||
1727 |
end |
|
1728 |
||
1729 |
end |