author | chunhan |
Mon, 30 Dec 2013 12:01:09 +0800 | |
changeset 84 | cebdef333899 |
parent 83 | e79e3a8a4ceb |
child 85 | 1d1aa5bdd37d |
permissions | -rw-r--r-- |
82 | 1 |
theory Enrich |
2 |
imports Main Flask Static Init_prop Valid_prop Tainted_prop Delete_prop Co2sobj_prop S2ss_prop S2ss_prop2 |
|
83 | 3 |
Temp Enrich Proc_fd_of_file_prop |
82 | 4 |
begin |
5 |
||
6 |
context tainting_s begin |
|
7 |
||
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
|
8 |
(* \<And> *) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
9 |
lemma current_proc_fds_in_curp: |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
10 |
"\<lbrakk>fd \<in> current_proc_fds s p; valid s\<rbrakk> \<Longrightarrow> p \<in> current_procs 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
|
11 |
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
|
12 |
apply (simp add:init_fds_of_proc_prop1) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
13 |
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
|
14 |
apply (case_tac a, auto split:if_splits option.splits) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
15 |
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
|
16 |
|
82 | 17 |
lemma get_parentfs_ctxts_prop: |
18 |
"\<lbrakk>get_parentfs_ctxts s (a # f) = Some ctxts; sectxt_of_obj s (O_dir f) = Some ctxt; valid s\<rbrakk> |
|
19 |
\<Longrightarrow> ctxt \<in> set (ctxts)" |
|
20 |
apply (induct f) |
|
21 |
apply (auto split:option.splits) |
|
22 |
done |
|
23 |
||
24 |
lemma search_check_allp_intro: |
|
25 |
"\<lbrakk>search_check s sp pf; get_parentfs_ctxts s pf = Some ctxts; valid s; is_dir s pf\<rbrakk> |
|
26 |
\<Longrightarrow> search_check_allp sp (set ctxts)" |
|
27 |
apply (case_tac pf) |
|
28 |
apply (simp split:option.splits if_splits add:search_check_allp_def) |
|
29 |
apply (rule ballI) |
|
30 |
apply (auto simp:search_check_ctxt_def search_check_dir_def split:if_splits option.splits) |
|
31 |
apply (auto simp:search_check_allp_def search_check_file_def) |
|
32 |
apply (frule is_dir_not_file, simp) |
|
33 |
done |
|
34 |
||
35 |
lemma search_check_leveling_f: |
|
36 |
"\<lbrakk>search_check s sp pf; parent f = Some pf; is_file s f; valid s; |
|
37 |
sectxt_of_obj s (O_file f) = Some fctxt; search_check_file sp fctxt\<rbrakk> |
|
38 |
\<Longrightarrow> search_check s sp f" |
|
39 |
apply (case_tac f, simp+) |
|
40 |
apply (auto split:option.splits simp:search_check_ctxt_def) |
|
41 |
apply (frule parentf_is_dir_prop2, simp) |
|
42 |
apply (erule get_pfs_secs_prop, simp) |
|
43 |
apply (erule_tac search_check_allp_intro, simp_all) |
|
44 |
apply (simp add:parentf_is_dir_prop2) |
|
45 |
done |
|
46 |
||
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
|
47 |
lemma enrich_proc_dup_ffds': |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
48 |
"\<lbrakk>fd \<notin> current_proc_fds (enrich_proc s p p') p'; is_created_proc s p; p' \<notin> all_procs s; no_del_event s; valid s\<rbrakk> |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
49 |
\<Longrightarrow> fd \<notin> proc_file_fds s p \<and> file_of_proc_fd s p fd = None" |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
50 |
apply (auto simp:enrich_proc_dup_ffds_eq_fds) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
51 |
apply (simp add:proc_file_fds_def) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
52 |
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
|
53 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
54 |
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
|
55 |
"\<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
|
56 |
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
|
57 |
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
|
58 |
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
|
59 |
apply (case_tac a, auto) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
60 |
apply (auto split:option.splits simp del:grant.simps) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
61 |
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
|
62 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
63 |
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
|
64 |
"\<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
|
65 |
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
|
66 |
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
|
67 |
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
|
68 |
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
|
69 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
70 |
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
|
71 |
"\<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
|
72 |
\<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
|
73 |
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
|
74 |
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
|
75 |
apply (frule vd_cons, frule vt_grant_os) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
76 |
apply (case_tac a, auto split:option.splits simp:not_all_procs_sock) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
77 |
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
|
78 |
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
|
79 |
apply (drule filefd_socket_conflict, simp_all add:current_sockets_def) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
80 |
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
|
81 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
82 |
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
|
83 |
"\<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
|
84 |
\<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
|
85 |
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
|
86 |
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
|
87 |
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
|
88 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
89 |
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
|
90 |
"\<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
|
91 |
\<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
|
92 |
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
|
93 |
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
|
94 |
apply (frule vd_cons, frule vt_grant_os) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
95 |
apply (case_tac a, auto split:option.splits t_socket_type.splits) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
96 |
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
|
97 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
98 |
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
|
99 |
"\<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
|
100 |
\<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
|
101 |
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
|
102 |
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
|
103 |
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
|
104 |
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
|
105 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
106 |
lemma 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
|
107 |
"\<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
|
108 |
\<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
|
109 |
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
|
110 |
apply (auto simp add:is_udp_sock_def enrich_proc_cur_itag enrich_proc_cur_inos |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
111 |
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
|
112 |
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
|
113 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
114 |
lemma enrich_proc_cur_msgqs: |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
115 |
"valid s \<Longrightarrow> current_msgqs (enrich_proc s p p') = current_msgqs s" |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
116 |
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
|
117 |
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
|
118 |
apply (case_tac a, auto) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
119 |
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
|
120 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
121 |
lemma enrich_proc_cur_msgs: |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
122 |
"valid s \<Longrightarrow> msgs_of_queue (enrich_proc s p p') q = msgs_of_queue s q " |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
123 |
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
|
124 |
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
|
125 |
apply (case_tac a, auto) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
126 |
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
|
127 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
128 |
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
|
129 |
"\<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
|
130 |
\<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
|
131 |
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
|
132 |
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
|
133 |
apply (case_tac a, auto simp:is_created_proc_simps) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
134 |
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
|
135 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
136 |
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
|
137 |
"\<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
|
138 |
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
|
139 |
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
|
140 |
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
|
141 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
142 |
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
|
143 |
"\<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
|
144 |
\<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
|
145 |
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
|
146 |
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
|
147 |
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
|
148 |
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
|
149 |
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
|
150 |
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
|
151 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
152 |
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
|
153 |
"\<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
|
154 |
\<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
|
155 |
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
|
156 |
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
|
157 |
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
|
158 |
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
|
159 |
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
|
160 |
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
|
161 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
162 |
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
|
163 |
"\<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
|
164 |
\<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
|
165 |
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
|
166 |
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
|
167 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
168 |
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
|
169 |
"\<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
|
170 |
\<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
|
171 |
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
|
172 |
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
|
173 |
enrich_proc_cur_msgqs enrich_proc_cur_msgs enrich_proc_cur_fds) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
174 |
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
|
175 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
176 |
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
|
177 |
"\<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
|
178 |
\<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
|
179 |
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
|
180 |
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
|
181 |
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
|
182 |
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
|
183 |
apply (auto simp:is_created_proc_simps dest:proc_fd_in_procs split:if_splits) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
184 |
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
|
185 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
186 |
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
|
187 |
"\<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
|
188 |
\<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
|
189 |
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
|
190 |
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
|
191 |
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
|
192 |
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
|
193 |
apply (auto simp:is_created_proc_simps dest:proc_fd_in_procs current_fflag_has_ffd split:if_splits option.splits) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
194 |
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
|
195 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
196 |
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
|
197 |
"\<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
|
198 |
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
|
199 |
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
|
200 |
apply (case_tac a, auto simp:files_hung_by_del.simps) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
201 |
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
|
202 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
203 |
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
|
204 |
"\<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
|
205 |
\<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
|
206 |
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
|
207 |
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
|
208 |
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
|
209 |
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
|
210 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
211 |
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
|
212 |
"\<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
|
213 |
\<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
|
214 |
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
|
215 |
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
|
216 |
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
|
217 |
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
|
218 |
|
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
219 |
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
|
220 |
"\<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
|
221 |
\<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
|
222 |
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
|
223 |
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
|
224 |
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
|
225 |
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
|
226 |
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
|
227 |
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
|
228 |
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
|
229 |
|
82 | 230 |
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
|
231 |
"\<lbrakk>valid s; is_created_proc s p; p' \<notin> all_procs s; no_del_event s\<rbrakk> |
82 | 232 |
\<Longrightarrow> valid (enrich_proc s p p') \<and> |
233 |
(\<forall> tp. tp \<in> current_procs s \<longrightarrow> cp2sproc (enrich_proc s p p') tp = cp2sproc s tp) \<and> |
|
234 |
(\<forall> f. f \<in> current_files s \<longrightarrow> cf2sfile (enrich_proc s p p') f = cf2sfile s f) \<and> |
|
235 |
(\<forall> q. q \<in> current_msgqs s \<longrightarrow> cq2smsgq (enrich_proc s p p') q = cq2smsgq s q) \<and> |
|
236 |
(\<forall> tp fd. fd \<in> proc_file_fds s tp \<longrightarrow> cfd2sfd (enrich_proc s p p') tp fd = cfd2sfd s tp fd) \<and> |
|
237 |
(cp2sproc (enrich_proc s p p') p' = cp2sproc s p) \<and> |
|
238 |
(\<forall> fd. fd \<in> proc_file_fds s p \<longrightarrow> cfd2sfd (enrich_proc s p p') p' fd = cfd2sfd s p fd)" |
|
239 |
proof (induct s) |
|
240 |
case Nil |
|
241 |
thus ?case by (auto simp:is_created_proc_def) |
|
242 |
next |
|
243 |
case (Cons e s) |
|
83 | 244 |
hence vd_cons': "valid (e # s)" and created_cons: "is_created_proc (e # s) p" |
82 | 245 |
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
|
246 |
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
|
247 |
and nodel_cons: "no_del_event (e # s)" |
83 | 248 |
by (auto dest:vd_cons' vt_grant_os vt_grant) |
82 | 249 |
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
|
250 |
from nodel_cons have nodel: "no_del_event s" by (case_tac e, auto) |
82 | 251 |
from Cons have pre: "is_created_proc s p \<Longrightarrow> valid (enrich_proc s p p') \<and> |
252 |
(\<forall>tp. tp \<in> current_procs s \<longrightarrow> cp2sproc (enrich_proc s p p') tp = cp2sproc s tp) \<and> |
|
253 |
(\<forall>f. f \<in> current_files s \<longrightarrow> cf2sfile (enrich_proc s p p') f = cf2sfile s f) \<and> |
|
254 |
(\<forall>q. q \<in> current_msgqs s \<longrightarrow> cq2smsgq (enrich_proc s p p') q = cq2smsgq s q) \<and> |
|
255 |
(\<forall>tp fd. fd \<in> proc_file_fds s tp \<longrightarrow> cfd2sfd (enrich_proc s p p') tp fd = cfd2sfd s tp fd) \<and> |
|
256 |
(cp2sproc (enrich_proc s p p') p' = cp2sproc s p) \<and> |
|
257 |
(\<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
|
258 |
using vd all_procs nodel by auto |
82 | 259 |
have vd_enrich_cons: "valid (enrich_proc (e # s) p p')" |
260 |
proof- |
|
261 |
from pre have pre': "is_created_proc s p \<Longrightarrow> valid (enrich_proc s p p')" by simp |
|
262 |
have "is_created_proc s p \<Longrightarrow> valid (e # enrich_proc s p p')" |
|
263 |
apply (frule pre') |
|
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
|
264 |
apply (erule_tac s = s and obj' = "E_proc p'" in enrich_valid_intro_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
|
265 |
apply (simp_all add: pre nodel_cons all_procs_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
|
266 |
apply (clarsimp simp:enrich_proc_alive nodel all_procs vd) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
267 |
apply (rule allI, rule impI, erule 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
|
268 |
apply (simp_all add:nodel all_procs vd enrich_proc_hungs enrich_proc_cur_msgs) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
269 |
apply ((rule allI| rule impI)+, erule 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
|
270 |
apply (simp_all add:nodel all_procs vd) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
271 |
apply ((rule allI| rule impI)+, erule 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
|
272 |
apply (simp_all add:nodel all_procs vd) |
cebdef333899
cfd2sfd, OF_create flag should not be in the sfd, cause all-duplicated sfd could not have this flag
chunhan
parents:
83
diff
changeset
|
273 |
done |
82 | 274 |
moreover have "\<And>f fds. \<lbrakk>valid (Execve p f fds # enrich_proc s p p'); is_created_proc s p; |
275 |
valid (Execve p f fds # s); p' \<notin> all_procs s\<rbrakk> |
|
276 |
\<Longrightarrow> valid (Execve p' f (fds \<inter> proc_file_fds s p) # Execve p f fds # enrich_proc s p p')" |
|
277 |
proof- |
|
278 |
fix f fds |
|
279 |
assume a1: "valid (Execve p f fds # enrich_proc s p p')" and a2: "is_created_proc s p" |
|
280 |
and a3: "valid (Execve p f fds # s)" and a0: "p' \<notin> all_procs s" |
|
281 |
have cp2sp: "\<forall> tp. tp \<in> current_procs s \<longrightarrow> cp2sproc (enrich_proc s p p') tp = cp2sproc s tp" |
|
282 |
and cf2sf: "\<forall> tf. tf \<in> current_files s \<longrightarrow> cf2sfile (enrich_proc s p p') tf = cf2sfile s tf" |
|
283 |
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" |
|
284 |
and dup_sp: "cp2sproc (enrich_proc s p p') p' = cp2sproc s p" |
|
285 |
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
|
286 |
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
|
287 |
by auto |
82 | 288 |
show "valid (Execve p' f (fds \<inter> proc_file_fds s p) # Execve p f fds # enrich_proc s p p')" |
289 |
proof- |
|
290 |
from a0 a3 have a0': "p' \<noteq> p" by (auto dest!:vt_grant_os not_all_procs_prop3) |
|
291 |
from a3 have grant: "grant s (Execve p f fds)" and os: "os_grant s (Execve p f fds)" |
|
292 |
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
|
293 |
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
|
294 |
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
|
295 |
by (auto dest:vt_grant_os simp:enrich_proc_is_file) |
82 | 296 |
moreover have a5: "proc_file_fds s p \<subseteq> proc_file_fds (Execve p f fds # enrich_proc s p p') p'" |
297 |
using a3 a0' |
|
298 |
apply (frule_tac vt_grant_os) |
|
299 |
apply (auto simp:proc_file_fds_def) |
|
300 |
apply (rule_tac x = fa in exI) |
|
301 |
apply (erule enrich_proc_dup_ffd) |
|
302 |
apply (simp_all add:vd all_procs a2) |
|
303 |
done |
|
304 |
ultimately have "os_grant (Execve p f fds # enrich_proc s p p') (Execve p' f (fds \<inter> proc_file_fds s p))" |
|
305 |
apply (auto simp:is_file_simps enrich_proc_dup_in a2 vd all_procs a1 enrich_proc_dup_ffds) |
|
306 |
done |
|
307 |
moreover have "grant (Execve p f fds # enrich_proc s p p') (Execve p' f (fds \<inter> proc_file_fds s p))" |
|
308 |
proof- |
|
309 |
from grant obtain up rp tp uf rf tf |
|
310 |
where p1: "sectxt_of_obj s (O_proc p) = Some (up, rp, tp)" |
|
311 |
and p2: "sectxt_of_obj s (O_file f) = Some (uf, rf, tf)" |
|
312 |
by (simp split:option.splits, blast) |
|
313 |
with grant obtain pu nr nt where p3: "npctxt_execve (up, rp, tp) (uf, rf, tf) = Some (pu, nr, nt)" |
|
314 |
by (simp split:option.splits del:npctxt_execve.simps, blast) |
|
315 |
have p1': "sectxt_of_obj (Execve p f fds # enrich_proc s p p') (O_proc p') = Some (up, rp, tp)" |
|
316 |
using p1 dup_sp a1 a0' |
|
317 |
apply (simp add:sectxt_of_obj_simps) |
|
318 |
by (simp add:cp2sproc_def split:option.splits) |
|
319 |
from os have f_in': "is_file s f" by simp |
|
320 |
from vd os have "\<exists> sf. cf2sfile s f = Some sf" |
|
321 |
by (auto dest!:is_file_in_current current_file_has_sfile) |
|
322 |
hence p2': "sectxt_of_obj (Execve p f fds # enrich_proc s p p') (O_file f) = Some (uf, rf, tf)" |
|
323 |
using f_in p2 cf2sf os a1 |
|
324 |
apply (erule_tac x = f in allE) |
|
325 |
apply (auto dest:is_file_in_current simp:cf2sfile_def sectxt_of_obj_simps split:option.splits) |
|
326 |
apply (case_tac f, simp) |
|
327 |
apply (drule_tac s = s in root_is_dir', simp add:vd, simp+) |
|
328 |
done |
|
329 |
from dup_sfd a5 have "\<forall>fd. fd \<in> proc_file_fds s p \<longrightarrow> |
|
330 |
cfd2sfd (Execve p f fds # enrich_proc s p p') p' fd = cfd2sfd s p fd" |
|
331 |
apply (rule_tac allI) |
|
332 |
apply (erule_tac x = fd in allE, clarsimp) |
|
333 |
apply (drule set_mp, simp) |
|
334 |
apply (auto simp:cfd2sfd_execve proc_file_fds_def a1) |
|
335 |
done |
|
336 |
hence "inherit_fds_check (Execve p f fds # enrich_proc s p p') (up, nr, nt) p' (fds \<inter> proc_file_fds s p)" |
|
337 |
using grant os p1 p2 p3 vd |
|
338 |
apply (clarsimp) |
|
339 |
apply (rule_tac s = s and p = p and fds = fds in enrich_inherit_fds_check_dup) |
|
340 |
apply simp_all |
|
341 |
done |
|
342 |
moreover have "search_check (Execve p f fds # enrich_proc s p p') (up, rp, tp) f" |
|
343 |
using p1 p2 p2' vd cf2sf f_in f_in' grant p3 f_in a1 |
|
344 |
apply (rule_tac s = s in enrich_search_check) |
|
345 |
apply (simp_all add:is_file_simps) |
|
346 |
apply (rule allI, rule impI, erule_tac x = fa in allE, simp) |
|
347 |
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
|
348 |
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
|
349 |
done |
82 | 350 |
ultimately show ?thesis |
351 |
using p1' p2' p3 |
|
352 |
apply (simp split:option.splits) |
|
353 |
using grant p1 p2 |
|
354 |
apply simp |
|
355 |
done |
|
356 |
qed |
|
357 |
ultimately show ?thesis using a1 |
|
358 |
by (erule_tac valid.intros(2), auto) |
|
359 |
qed |
|
360 |
qed |
|
361 |
moreover have "\<And>tp fds. \<lbrakk>valid (Clone tp p fds # s); p' \<noteq> p; p' \<notin> all_procs s\<rbrakk> \<Longrightarrow> |
|
362 |
valid (Clone tp p' (fds \<inter> proc_file_fds s tp) # Clone tp p fds # s)" |
|
363 |
apply (frule vt_grant_os, frule vt_grant, drule not_all_procs_prop3) |
|
364 |
apply (rule valid.intros(2)) |
|
365 |
apply (simp_all split:option.splits add:sectxt_of_obj_simps) |
|
366 |
apply (auto simp add:proc_file_fds_def)[1] |
|
367 |
apply (auto simp:inherit_fds_check_def sectxt_of_obj_simps sectxts_of_fds_def inherit_fds_check_ctxt_def) |
|
368 |
done |
|
369 |
moreover have "\<And>f flags fd opt. \<lbrakk>valid (Open p f flags fd opt # enrich_proc s p p'); |
|
370 |
is_created_proc s p; valid (Open p f flags fd opt # s); p' \<notin> all_procs s\<rbrakk> |
|
371 |
\<Longrightarrow> valid (Open p' f (remove_create_flag flags) fd None # Open p f flags fd opt # enrich_proc s p p')" |
|
372 |
proof- |
|
373 |
fix f flags fd opt |
|
374 |
assume a1: "valid (Open p f flags fd opt # enrich_proc s p p')" and a2: "is_created_proc s p" |
|
375 |
and a3: "valid (Open p f flags fd opt # s)" and a4: "p' \<notin> all_procs s" |
|
376 |
have cp2sp: "\<forall> tp. tp \<in> current_procs s \<longrightarrow> cp2sproc (enrich_proc s p p') tp = cp2sproc s tp" |
|
377 |
and cf2sf: "\<forall> tf. tf \<in> current_files s \<longrightarrow> cf2sfile (enrich_proc s p p') tf = cf2sfile s tf" |
|
378 |
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" |
|
379 |
and dup_sp: "cp2sproc (enrich_proc s p p') p' = cp2sproc s p" |
|
380 |
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" |
|
381 |
using pre a2 by auto |
|
382 |
from a4 a3 have a0: "p' \<noteq> p" by (auto dest!:vt_grant_os not_all_procs_prop3 split:option.splits) |
|
383 |
have a5: "p' \<in> current_procs (enrich_proc s p p')" |
|
384 |
using a2 a3 vd |
|
385 |
apply (erule_tac enrich_proc_dup_in) |
|
386 |
by (simp_all add:vd a4) |
|
387 |
have a6: "is_file (Open p f flags fd opt # enrich_proc s p p') f" |
|
388 |
using a1 a3 |
|
389 |
by (auto simp:is_file_open dest:vt_grant_os) |
|
390 |
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
|
391 |
using a2 a4 vd nodel |
82 | 392 |
apply (simp add:enrich_proc_dup_ffds_eq_fds) |
393 |
apply (rule notI) |
|
394 |
apply (drule_tac p = p in file_fds_subset_pfds) |
|
395 |
apply (drule set_mp, simp) |
|
396 |
using a3 |
|
397 |
apply (drule_tac vt_grant_os) |
|
398 |
apply (auto split:option.splits) |
|
399 |
done |
|
400 |
from a1 have a8: "valid (enrich_proc s p p')" by (erule_tac valid.cases, auto) |
|
401 |
from a3 have grant: "grant s (Open p f flags fd opt)" and os: "os_grant s (Open p f flags fd opt)" |
|
402 |
by (auto dest:vt_grant_os vt_grant) |
|
403 |
show "valid (Open p' f (remove_create_flag flags) fd None # Open p f flags fd opt # enrich_proc s p p')" |
|
404 |
proof (cases opt) |
|
405 |
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
|
406 |
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
|
407 |
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
|
408 |
by (auto dest:vt_grant_os simp:enrich_proc_is_file) |
82 | 409 |
from grant None obtain up rp tp uf rf tf |
410 |
where p1: "sectxt_of_obj s (O_proc p) = Some (up, rp, tp)" |
|
411 |
and p2: "sectxt_of_obj s (O_file f) = Some (uf, rf, tf)" |
|
412 |
apply (simp split:option.splits) |
|
413 |
by (case_tac a, case_tac aa, blast) |
|
414 |
have p1': "sectxt_of_obj (Open p f flags fd opt # enrich_proc s p p') (O_proc p') = Some (up, rp, tp)" |
|
415 |
using p1 dup_sp a1 |
|
416 |
apply (simp add:sectxt_of_obj_simps) |
|
417 |
by (simp add:cp2sproc_def split:option.splits) |
|
418 |
from os None have f_in': "is_file s f" by simp |
|
419 |
from vd os None have "\<exists> sf. cf2sfile s f = Some sf" |
|
420 |
by (auto dest!:is_file_in_current current_file_has_sfile) |
|
421 |
hence p2': "sectxt_of_obj (Open p f flags fd opt # enrich_proc s p p') (O_file f) = Some (uf, rf, tf)" |
|
422 |
using p2 cf2sf os a1 None f_in' vd f_in |
|
423 |
apply (erule_tac x = f in allE) |
|
424 |
apply (auto dest:is_file_in_current simp:cf2sfile_def sectxt_of_obj_simps split:option.splits) |
|
425 |
apply (case_tac f, simp) |
|
426 |
apply (drule_tac s = s in root_is_dir', simp add:vd, simp+) |
|
427 |
done |
|
428 |
have "search_check (Open p f flags fd opt # enrich_proc s p p') (up, rp, tp) f" |
|
429 |
using p1 p2 p2' vd cf2sf f_in f_in' grant f_in a1 None |
|
430 |
apply (rule_tac s = s in enrich_search_check) |
|
431 |
apply (simp_all add:is_file_simps) |
|
432 |
apply (rule allI, rule impI, erule_tac x = fa in allE, simp) |
|
433 |
apply (simp add:cf2sfile_open_none) |
|
434 |
done |
|
435 |
thus ?thesis using a0 a5 a6 a7 None a1 |
|
436 |
apply (rule_tac valid.intros(2)) |
|
437 |
apply (simp_all add:a1) |
|
438 |
apply (case_tac flags, simp add:is_creat_excl_flag_def) |
|
439 |
using p1' p2' |
|
440 |
apply simp |
|
441 |
using grant p1 p2 |
|
442 |
apply (simp add:oflags_check_remove_create) |
|
443 |
done |
|
444 |
next |
|
445 |
case (Some inum) |
|
446 |
with os obtain pf where parent: "parent f = Some pf" by auto |
|
447 |
with grant Some obtain pu rp pt pfu pfr pft where |
|
448 |
p1: "sectxt_of_obj s (O_proc p) = Some (pu, rp, pt)" |
|
449 |
and p2: "sectxt_of_obj s (O_dir pf) = Some (pfu, pfr, pft)" |
|
450 |
apply (simp split:option.splits) |
|
451 |
apply (case_tac a, case_tac aa, blast) |
|
452 |
done |
|
453 |
from p1 have p1': "sectxt_of_obj (enrich_proc s p p') (O_proc p) = Some (pu, rp, pt)" |
|
454 |
using cp2sp os |
|
455 |
apply (erule_tac x = p in allE) |
|
456 |
apply (auto split:option.splits simp:cp2sproc_def) |
|
457 |
done |
|
458 |
from os parent Some |
|
459 |
have pf_in: "is_dir s pf" by auto |
|
460 |
hence "\<exists> sf. cf2sfile s pf = Some sf" using vd |
|
461 |
by (auto dest!:is_dir_in_current current_file_has_sfile) |
|
462 |
from a1 parent Some have pf_in': "is_dir (enrich_proc s p p') pf" |
|
463 |
apply (frule_tac vt_grant_os) |
|
464 |
by (clarsimp) |
|
465 |
have p2': "sectxt_of_obj (enrich_proc s p p') (O_dir pf) = Some (pfu, pfr, pft)" |
|
466 |
proof- |
|
467 |
have "cf2sfile (enrich_proc s p p') pf = cf2sfile s pf" |
|
468 |
using cf2sf pf_in |
|
469 |
apply (drule_tac is_dir_in_current) |
|
470 |
apply (erule_tac x = pf in allE) |
|
471 |
by simp |
|
472 |
with pf_in pf_in' p2 vd Some a8 |
|
473 |
show ?thesis |
|
474 |
apply (frule_tac is_dir_not_file) |
|
475 |
apply (frule_tac s = "enrich_proc s p p'" in is_dir_not_file) |
|
476 |
apply (simp add:cf2sfile_def) |
|
477 |
apply (case_tac pf, simp) |
|
478 |
apply (simp add:sroot_def root_sec_remains) |
|
479 |
by (auto split:option.splits dest!:current_has_sec' get_pfs_secs_prop' dest:parentf_is_dir_prop1) |
|
480 |
qed |
|
481 |
from p1 have dup: "sectxt_of_obj (Open p f flags fd (Some inum) # enrich_proc s p p') (O_proc p') |
|
482 |
= Some (pu, rp, pt)" |
|
483 |
using a1 Some |
|
484 |
apply (simp add:sec_open) |
|
485 |
using dup_sp |
|
486 |
apply (auto split:option.splits if_splits simp:cp2sproc_def) |
|
487 |
done |
|
488 |
have nsf: "sectxt_of_obj (Open p f flags fd (Some inum) # enrich_proc s p p') (O_file f) |
|
489 |
= Some (pu, R_object, type_transition pt pft C_file True)" |
|
490 |
using a1 Some p1 p2 parent p2' p1' |
|
491 |
by (simp add:sec_open) |
|
492 |
have "search_check (Open p f flags fd (Some inum) # enrich_proc s p p') (pu, rp, pt) f" |
|
493 |
proof- |
|
494 |
have "search_check (Open p f flags fd (Some inum) # enrich_proc s p p') (pu, rp, pt) pf" |
|
495 |
using grant Some parent p1 p2 vd a1 pf_in pf_in' p2' |
|
496 |
apply simp |
|
497 |
apply (rule_tac s = s in enrich_search_check') |
|
498 |
apply (simp_all add:is_dir_simps sectxt_of_obj_simps) |
|
499 |
apply (rule allI, rule impI) |
|
500 |
apply (case_tac "fa = f") |
|
501 |
using os Some |
|
502 |
apply simp |
|
503 |
apply (drule_tac f' = fa in cf2sfile_open) |
|
504 |
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
|
505 |
using enrich_proc_cur_files a2 nodel |
82 | 506 |
apply simp |
507 |
apply simp |
|
508 |
using cf2sf |
|
509 |
apply simp |
|
510 |
done |
|
511 |
moreover have "is_file (Open p f flags fd (Some inum) # enrich_proc s p p') f" |
|
512 |
using a1 Some |
|
513 |
by (simp add:is_file_open) |
|
514 |
ultimately |
|
515 |
show ?thesis |
|
516 |
using parent a1 Some nsf |
|
517 |
apply (erule_tac search_check_leveling_f) |
|
518 |
apply (simp_all) |
|
519 |
apply (simp add:search_check_file_def) |
|
520 |
apply (simp add:permission_check.simps) |
|
521 |
sorry |
|
522 |
qed |
|
523 |
thus ?thesis using a0 a5 a6 a7 a1 Some |
|
524 |
apply (rule_tac valid.intros(2)) |
|
525 |
apply (simp add:a1) |
|
526 |
apply simp |
|
527 |
apply (case_tac flags, simp add:is_creat_excl_flag_def) |
|
528 |
using grant p1 p2 parent dup nsf |
|
529 |
apply (simp add:oflags_check_remove_create) |
|
530 |
done |
|
531 |
qed |
|
532 |
qed |
|
533 |
moreover have "\<And>fd. \<lbrakk>valid (CloseFd p fd # enrich_proc s p p'); is_created_proc s p; |
|
534 |
valid (CloseFd p fd # s); p' \<notin> all_procs s; fd \<in> proc_file_fds s p\<rbrakk> |
|
535 |
\<Longrightarrow> valid (CloseFd p' fd # CloseFd p fd # enrich_proc s p p')" |
|
536 |
proof- |
|
537 |
fix fd |
|
538 |
assume a1: "valid (CloseFd p fd # enrich_proc s p p')" and a2: "is_created_proc s p" |
|
539 |
and a3: "p' \<notin> all_procs s" and a4: "valid (CloseFd p fd # s)" |
|
540 |
and a5: "fd \<in> proc_file_fds s p" |
|
541 |
from a4 a3 have a0: "p' \<noteq> p" by (auto dest!:vt_grant_os not_all_procs_prop3) |
|
542 |
have "p' \<in> current_procs (enrich_proc s p p')" |
|
543 |
using a2 a3 vd |
|
544 |
by (auto intro:enrich_proc_dup_in) |
|
545 |
moreover have "fd \<in> 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
|
546 |
using a5 a2 a3 vd pre' nodel |
82 | 547 |
apply (simp) |
548 |
apply (drule_tac s = "enrich_proc s p p'" and p = p' in file_fds_subset_pfds) |
|
549 |
apply (erule set_mp) |
|
550 |
apply (simp add:enrich_proc_dup_ffds) |
|
551 |
done |
|
552 |
ultimately show "valid (CloseFd p' fd # CloseFd p fd # enrich_proc s p p')" |
|
553 |
apply (rule_tac valid.intros(2)) |
|
554 |
apply (simp_all add:a1 a0 a2 pre') |
|
555 |
done |
|
556 |
qed |
|
557 |
moreover have "\<And> fd. \<lbrakk>valid (ReadFile p fd # enrich_proc s p p'); |
|
558 |
is_created_proc s p; valid (ReadFile p fd # s); p' \<notin> all_procs s\<rbrakk> |
|
559 |
\<Longrightarrow> valid (ReadFile p' fd # ReadFile p fd # enrich_proc s p p')" |
|
560 |
proof- |
|
561 |
fix fd |
|
562 |
assume a1: "valid (ReadFile p fd # enrich_proc s p p')" and a2: "is_created_proc s p" |
|
563 |
and a3: "valid (ReadFile p fd # s)" and a4: "p' \<notin> all_procs s" |
|
564 |
from a3 have os: "os_grant s (ReadFile p fd)" and grant: "grant s (ReadFile p fd)" |
|
565 |
by (auto dest:vt_grant_os vt_grant) |
|
566 |
have cp2sp: "\<forall> tp. tp \<in> current_procs s \<longrightarrow> cp2sproc (enrich_proc s p p') tp = cp2sproc s tp" |
|
567 |
and cf2sf: "\<forall> tf. tf \<in> current_files s \<longrightarrow> cf2sfile (enrich_proc s p p') tf = cf2sfile s tf" |
|
568 |
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" |
|
569 |
and dup_sp: "cp2sproc (enrich_proc s p p') p' = cp2sproc s p" |
|
570 |
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" |
|
571 |
using pre a2 by auto |
|
572 |
have vd_enrich: "valid (enrich_proc s p p')" using a1 by (auto dest:valid.cases) |
|
573 |
show "valid (ReadFile p' fd # ReadFile p fd # enrich_proc s p p')" |
|
574 |
proof- |
|
575 |
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
|
576 |
using a1 a2 a4 vd os nodel |
82 | 577 |
apply (clarsimp simp:current_files_simps enrich_proc_dup_in enrich_proc_dup_ffds_eq_fds) |
578 |
apply (simp add:proc_file_fds_def) |
|
579 |
apply (rule conjI) |
|
580 |
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
|
581 |
using enrich_proc_cur_files |
82 | 582 |
apply (simp) |
583 |
apply (drule enrich_proc_dup_fflags) |
|
584 |
apply simp_all |
|
585 |
apply (erule disjE) |
|
586 |
apply auto |
|
587 |
apply (simp add:is_read_flag_def) |
|
588 |
done |
|
589 |
moreover have "grant (ReadFile p fd # enrich_proc s p p') (ReadFile p' fd)" |
|
590 |
proof- |
|
591 |
from grant obtain f sp sfd sf where p1: "file_of_proc_fd s p fd = Some f" |
|
592 |
and p2: "sectxt_of_obj s (O_proc p) = Some sp" |
|
593 |
and p3: "sectxt_of_obj s (O_fd p fd) = Some sfd" |
|
594 |
and p4: "sectxt_of_obj s (O_file f) = Some sf" |
|
595 |
by (auto split:option.splits) |
|
596 |
from os obtain flag where p0: "flags_of_proc_fd s p fd = Some flag" |
|
597 |
by auto |
|
598 |
from os have f_in_s: "f \<in> current_files s" using p1 by simp |
|
599 |
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
|
600 |
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
|
601 |
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
|
602 |
by (auto simp:enrich_proc_is_file) |
82 | 603 |
from p0 obtain flag' where p0': "flags_of_proc_fd (enrich_proc s p p') p' fd = Some flag'" |
604 |
and p0'': "(flag' = flag) \<or> (flag' = remove_create_flag flag)" |
|
605 |
using a2 a4 vd |
|
606 |
apply (drule_tac enrich_proc_dup_fflags) |
|
607 |
apply auto |
|
608 |
apply (case_tac flag, auto) |
|
609 |
apply (case_tac flag, auto) |
|
610 |
done |
|
611 |
from p1 have p1': "file_of_proc_fd (enrich_proc s p p') p' fd = Some f" |
|
612 |
using a2 a4 vd |
|
613 |
by (simp add:enrich_proc_dup_ffd) |
|
614 |
from p2 have p2': "sectxt_of_obj (enrich_proc s p p') (O_proc p') = Some sp" |
|
615 |
using dup_sp |
|
616 |
by (auto simp:cp2sproc_def split:option.splits) |
|
617 |
from p3 p1 p1' p0 p0' os have p3': "sectxt_of_obj (enrich_proc s p p') (O_fd p' fd) = Some sfd" |
|
618 |
using dup_sfd |
|
619 |
apply (erule_tac x = fd in allE) |
|
620 |
apply (auto simp:proc_file_fds_def cfd2sfd_def split:option.splits) |
|
621 |
apply (drule current_file_has_sfile') |
|
622 |
apply (simp add:vd, simp) |
|
623 |
apply (drule current_file_has_sfile') |
|
624 |
apply (simp add:vd, simp) |
|
625 |
done |
|
626 |
from p4 have p4': "sectxt_of_obj (enrich_proc s p p') (O_file f) = Some sf" |
|
627 |
using f_in_s cf2sf isfile_s isfile_s' a1 vd_enrich vd |
|
628 |
apply (erule_tac x = f in allE) |
|
629 |
apply (simp) |
|
630 |
apply (auto simp:cf2sfile_def split:option.splits |
|
631 |
dest!:current_has_sec' get_pfs_secs_prop' dest:parentf_is_dir is_file_in_current) |
|
632 |
apply (case_tac f, simp, drule root_is_dir', simp, simp, simp) |
|
633 |
done |
|
634 |
show ?thesis using p1' p2' p3' p4' a1 |
|
635 |
apply (simp add:sectxt_of_obj_simps) |
|
636 |
using grant p1 p2 p3 p4 |
|
637 |
apply simp |
|
638 |
done |
|
639 |
qed |
|
640 |
ultimately show ?thesis |
|
641 |
using a1 |
|
642 |
by (erule_tac valid.intros(2), simp+) |
|
643 |
qed |
|
644 |
qed |
|
645 |
ultimately show ?thesis |
|
83 | 646 |
using created_cons vd_cons' all_procs_cons |
82 | 647 |
apply (case_tac e) |
648 |
apply (auto simp:is_created_proc_simps split:if_splits) |
|
649 |
done |
|
650 |
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
|
651 |
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
|
652 |
cfd2sfd (enrich_proc (e # s) p p') tp fd = cfd2sfd (e # s) tp fd" |
83 | 653 |
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
|
654 |
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
|
655 |
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
|
656 |
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
|
657 |
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
|
658 |
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
|
659 |
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
|
660 |
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
|
661 |
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
|
662 |
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
|
663 |
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
|
664 |
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
|
665 |
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
|
666 |
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
|
667 |
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
|
668 |
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
|
669 |
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
|
670 |
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
|
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 |
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
|
673 |
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
|
674 |
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
|
675 |
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
|
676 |
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
|
677 |
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
|
678 |
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
|
679 |
\<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
|
680 |
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
|
681 |
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
|
682 |
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
|
683 |
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
|
684 |
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
|
685 |
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
|
686 |
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
|
687 |
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
|
688 |
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
|
689 |
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
|
690 |
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
|
691 |
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
|
692 |
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
|
693 |
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
|
694 |
\<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
|
695 |
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
|
696 |
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
|
697 |
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
|
698 |
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
|
699 |
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
|
700 |
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
|
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 |
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
|
703 |
\<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
|
704 |
apply (simp 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
|
705 |
thm cfd2sfd_open |
cebdef333899
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 |
sorry |
cebdef333899
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 |
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
|
708 |
\<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
|
709 |
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
|
710 |
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
|
711 |
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
|
712 |
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
|
713 |
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
|
714 |
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
|
715 |
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
|
716 |
done |
83 | 717 |
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
|
718 |
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
|
719 |
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
|
720 |
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
|
721 |
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
|
722 |
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
|
723 |
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
|
724 |
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
|
725 |
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
|
726 |
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
|
727 |
qed |
82 | 728 |
moreover have "\<forall>tp. tp \<in> current_procs (e # s) \<longrightarrow> cp2sproc (enrich_proc (e # s) p p') tp = cp2sproc (e # s) tp" |
729 |
sorry |
|
730 |
moreover have "\<forall>f. f \<in> current_files (e # s) \<longrightarrow> cf2sfile (enrich_proc (e # s) p p') f = cf2sfile (e # s) f" |
|
731 |
sorry |
|
732 |
moreover have "\<forall>q. q \<in> current_msgqs (e # s) \<longrightarrow> cq2smsgq (enrich_proc (e # s) p p') q = cq2smsgq (e # s) q" |
|
733 |
sorry |
|
734 |
moreover have "cp2sproc (enrich_proc (e # s) p p') p' = cp2sproc (e # s) p" |
|
735 |
proof- |
|
736 |
from pre have b0: "is_created_proc s p \<Longrightarrow> cp2sproc (enrich_proc s p p') p' = cp2sproc s p" by simp |
|
737 |
have b1: "\<And> tp f fds. \<lbrakk>valid (enrich_proc (Execve tp f fds # s) p p'); valid (Execve tp f fds # s); |
|
738 |
is_created_proc (Execve tp f fds # s) p; p' \<notin> all_procs (Execve tp f fds # s)\<rbrakk> |
|
739 |
\<Longrightarrow> cp2sproc (enrich_proc (Execve tp f fds # s) p p') p' = cp2sproc (Execve tp f fds # s) p" |
|
740 |
proof- |
|
741 |
fix tp f fds |
|
742 |
assume a1: "valid (enrich_proc (Execve tp f fds # s) p p')" |
|
743 |
and a2: "valid (Execve tp f fds # s)" and a3: "is_created_proc (Execve tp f fds # s) p" |
|
744 |
and a4: "p' \<notin> all_procs (Execve tp f fds # s)" |
|
745 |
show "cp2sproc (enrich_proc (Execve tp f fds # s) p p') p' = cp2sproc (Execve tp f fds # s) p" |
|
746 |
proof (cases "tp = p") |
|
747 |
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
|
748 |
show ?thesis using True a1 a2 a3 a4 b0 vd |
82 | 749 |
thm not_all_procs_prop3 |
83 | 750 |
apply (frule_tac not_all_procs_prop2) |
751 |
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
|
752 |
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
|
753 |
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
|
754 |
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
|
755 |
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
|
756 |
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
|
757 |
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
|
758 |
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
|
759 |
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
|
760 |
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
|
761 |
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
|
762 |
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
|
763 |
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
|
764 |
|
cebdef333899
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 |
|
83 | 766 |
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
|
767 |
*) |
82 | 768 |
sorry |
769 |
next |
|
770 |
case False |
|
771 |
show ?thesis sorry |
|
772 |
qed |
|
773 |
qed |
|
774 |
have b2: "\<And> tp fd. cp2sproc (enrich_proc (ReadFile tp fd # s) p p') p' = cp2sproc (ReadFile tp fd # s) p" |
|
775 |
sorry |
|
776 |
have b3: "\<And> tp. cp2sproc (enrich_proc (Exit tp # s) p p') p' = cp2sproc (Exit tp # s) p" |
|
777 |
sorry |
|
778 |
have b4: "\<And> tp tp'. cp2sproc (enrich_proc (Kill tp tp' # s) p p') p' = cp2sproc (Kill tp tp' # s) p" |
|
779 |
sorry |
|
780 |
have b5: "\<And> tp tp' fds. cp2sproc (enrich_proc (Clone tp tp' fds # s) p p') p' = |
|
781 |
cp2sproc (Clone tp tp' fds # s) p" |
|
782 |
sorry |
|
783 |
have b6: "\<And> tp f flags fd opt. cp2sproc (enrich_proc (Open tp f flags fd opt # s) p p') p' = |
|
784 |
cp2sproc (Open tp f flags fd opt # s) p" |
|
785 |
sorry |
|
786 |
have b7: "\<And> tp fd. cp2sproc (enrich_proc (CloseFd tp fd # s) p p') p' = cp2sproc (CloseFd tp fd # s) p" |
|
787 |
sorry |
|
788 |
show ?thesis using vd_enrich_cons |
|
789 |
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
|
790 |
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
|
791 |
apply (auto intro!:b1 b2 b3 b4 b5 b6 b7 simp del:enrich_proc.simps) |
83 | 792 |
using created_cons vd_enrich_cons vd_cons' b0 |
82 | 793 |
apply (auto simp:cp2sproc_other is_created_proc_def) |
794 |
done |
|
795 |
qed |
|
796 |
moreover have "\<forall> fd. fd \<in> proc_file_fds (e # s) p \<longrightarrow> |
|
797 |
cfd2sfd (enrich_proc (e # s) p p') p' fd = cfd2sfd (e # s) p fd" |
|
798 |
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
|
799 |
ultimately show ?case using vd_enrich_cons |
82 | 800 |
by simp |
801 |
qed |
|
802 |
||
803 |
||
804 |
lemma enrich_proc_valid: |
|
805 |
"\<lbrakk>valid s; is_created_proc s p; p' \<notin> all_procs s\<rbrakk> \<Longrightarrow> valid (enrich_proc s p p')" |
|
806 |
by (auto dest:enrich_proc_prop) |
|
807 |
||
808 |
lemma enrich_proc_valid: |
|
809 |
"\<lbrakk>valid s; is_created_proc s p; p' \<notin> all_procs s\<rbrakk> \<Longrightarrow> " |
|
810 |
||
811 |
lemma enrich_proc_tainted: |
|
812 |
"\<lbrakk>is_created_proc s p; p' \<notin> all_procs s; valid s\<rbrakk> |
|
813 |
\<Longrightarrow> tainted (enrich_proc s p p') = (if (O_proc p \<in> tainted s) |
|
814 |
then tainted s \<union> {O_proc p'} else tainted s)" |
|
815 |
apply (induct s) |
|
816 |
apply (simp add:is_created_proc_def) |
|
817 |
apply (frule vt_grant_os, frule vd_cons, simp) |
|
818 |
apply (frule enrich_proc_dup_in, simp+) |
|
819 |
apply (frule not_all_procs_prop3) |
|
820 |
apply (case_tac a) |
|
821 |
prefer 3 |
|
822 |
apply (simp split:if_splits) |
|
823 |
apply (rule impI|rule conjI)+ |
|
824 |
apply (simp add:is_created_proc_def) |
|
825 |
apply (auto simp:is_created_proc_def split:if_splits dest:tainted_in_current)[1] |
|
826 |
apply (simp add:is_created_proc_def) |
|
827 |
||
828 |
prefer 4 |
|
829 |
apply (simp split:if_splits) |
|
830 |
apply (rule impI|rule conjI)+ |
|
831 |
apply (simp add:is_created_proc_def) |
|
832 |
apply (auto simp:is_created_proc_def split:if_splits dest:tainted_in_current)[1] |
|
833 |
apply (simp add:is_created_proc_def) |
|
834 |
||
835 |
prefer 4 |
|
836 |
apply (auto simp:is_created_proc_def split:if_splits option.splits dest:tainted_in_current)[1] |
|
837 |
||
838 |
prefer 4 |
|
839 |
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] |
|
840 |
||
841 |
||
842 |
||
843 |
lemma enrich_proc_dup_tainted: |
|
844 |
"\<lbrakk>is_created_proc s p; p' \<notin> all_procs s; valid s\<rbrakk> |
|
845 |
\<Longrightarrow> (O_proc p' \<in> tainted (enrich_proc s p p')) = (O_proc p \<in> tainted s)" |
|
846 |
apply (induct s) |
|
847 |
apply (simp add:is_created_proc_def) |
|
848 |
apply (frule vt_grant_os, frule vd_cons) |
|
849 |
apply (case_tac a) |
|
850 |
apply (auto simp:is_created_proc_def)[1] |
|
851 |
||
852 |
||
853 |
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
|
854 |
|
82 | 855 |
|
856 |
||
857 |
end |
|
858 |
||
859 |
end |