| author | chunhan | 
| Wed, 04 Sep 2013 09:07:39 +0800 | |
| changeset 39 | 13bba99ca090 | 
| parent 38 | 9dfc8c72565a | 
| child 41 | db15ef2ee18c | 
| permissions | -rw-r--r-- | 
| 32 | 1  | 
(*<*)  | 
2  | 
theory S2ss_prop  | 
|
3  | 
imports Main Flask Flask_type Static Static_type Init_prop Tainted_prop Valid_prop Alive_prop Co2sobj_prop  | 
|
4  | 
begin  | 
|
5  | 
(*>*)  | 
|
6  | 
||
| 
33
 
6884b3c9284b
fix bug of static.thy for the static of recvmsg case
 
chunhan 
parents: 
32 
diff
changeset
 | 
7  | 
context tainting_s begin  | 
| 
 
6884b3c9284b
fix bug of static.thy for the static of recvmsg case
 
chunhan 
parents: 
32 
diff
changeset
 | 
8  | 
|
| 
35
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
9  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
10  | 
lemma current_proc_has_sp:  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
11  | 
"\<lbrakk>p \<in> current_procs s; valid s\<rbrakk> \<Longrightarrow> \<exists> sp. cp2sproc s p = Some sp"  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
12  | 
by (auto simp:cp2sproc_def split:option.splits dest!:current_has_sec')  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
13  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
14  | 
lemma current_proc_has_sp':  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
15  | 
"\<lbrakk>cp2sproc s p = None; valid s\<rbrakk> \<Longrightarrow> p \<notin> current_procs s"  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
16  | 
by (auto dest:current_proc_has_sp)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
17  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
18  | 
lemma is_dir_has_sdir':  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
19  | 
"\<lbrakk>is_dir s f; valid s\<rbrakk> \<Longrightarrow> \<exists> sf. cf2sfile s f = Some sf"  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
20  | 
apply (case_tac f)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
21  | 
apply (rule_tac x = sroot in exI)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
22  | 
apply (simp add:sroot_only)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
23  | 
apply (drule is_dir_has_sfile, auto)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
24  | 
done  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
25  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
26  | 
lemma is_file_has_sfile':  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
27  | 
"\<lbrakk>is_file s f; valid s\<rbrakk> \<Longrightarrow> \<exists> sf. cf2sfile s f = Some sf"  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
28  | 
by (drule is_file_has_sfile, auto)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
29  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
30  | 
(* simpset for same_inode_files: Current_files_prop.thy *)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
31  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
32  | 
lemma same_inode_files_nil:  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
33  | 
"same_inode_files [] = init_same_inode_files"  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
34  | 
by (rule ext, simp add:same_inode_files_def init_same_inode_files_def is_file_nil)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
35  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
36  | 
lemma iof's_im_in_cim': "Some im = inum_of_file \<tau> f \<Longrightarrow> im \<in> current_inode_nums \<tau>"  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
37  | 
by (auto simp add:current_inode_nums_def current_file_inums_def)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
38  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
39  | 
lemma same_inode_files_open:  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
40  | 
"valid (Open p f flags fd opt # s) \<Longrightarrow> same_inode_files (Open p f flags fd opt # s) = (\<lambda> f'.  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
41  | 
     if (f' = f \<and> opt \<noteq> None) then {f} else same_inode_files s f')"
 | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
42  | 
apply (frule vt_grant_os, frule vd_cons, rule ext)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
43  | 
apply (auto simp:same_inode_files_def is_file_simps split:if_splits option.splits  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
44  | 
dest:iof's_im_in_cim iof's_im_in_cim')  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
45  | 
apply (drule is_file_in_current)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
46  | 
apply (simp add:current_files_def)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
47  | 
done  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
48  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
49  | 
lemma same_inode_files_linkhard:  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
50  | 
"valid (LinkHard p oldf f # s) \<Longrightarrow> same_inode_files (LinkHard p oldf f # s) = (\<lambda> f'.  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
51  | 
if (f' = f \<or> f' \<in> same_inode_files s oldf)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
52  | 
     then same_inode_files s oldf \<union> {f}
 | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
53  | 
else same_inode_files s f')"  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
54  | 
apply (frule vt_grant_os, frule vd_cons, rule ext)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
55  | 
apply (auto simp:same_inode_files_def is_file_simps split:if_splits option.splits  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
56  | 
dest:iof's_im_in_cim iof's_im_in_cim')  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
57  | 
apply (drule is_file_in_current)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
58  | 
apply (simp add:current_files_def is_file_def)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
59  | 
apply (simp add:is_file_def)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
60  | 
done  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
61  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
62  | 
lemma inum_of_file_none_prop:  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
63  | 
"\<lbrakk>inum_of_file s f = None; valid s\<rbrakk> \<Longrightarrow> f \<notin> current_files s"  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
64  | 
by (simp add:current_files_def)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
65  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
66  | 
lemma same_inode_files_closefd:  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
67  | 
"\<lbrakk>valid (CloseFd p fd # s); f' \<in> current_files (CloseFd p fd # s)\<rbrakk> \<Longrightarrow>  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
68  | 
same_inode_files (CloseFd p fd # s) f' = (  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
69  | 
case (file_of_proc_fd s p fd) of  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
70  | 
       Some f \<Rightarrow> (if ((proc_fd_of_file s f = {(p, fd)}) \<and> (f \<in> files_hung_by_del s))
 | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
71  | 
                 then same_inode_files s f' - {f}
 | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
72  | 
else same_inode_files s f' )  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
73  | 
| None \<Rightarrow> same_inode_files s f' )"  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
74  | 
apply (frule vt_grant_os, frule vd_cons)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
75  | 
apply (auto simp:same_inode_files_def is_file_closefd current_files_closefd  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
76  | 
split:if_splits option.splits  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
77  | 
dest:iof's_im_in_cim iof's_im_in_cim' inum_of_file_none_prop)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
78  | 
done  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
79  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
80  | 
lemma same_inode_files_unlink:  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
81  | 
"\<lbrakk>valid (UnLink p f # s); f' \<in> current_files (UnLink p f # s)\<rbrakk>  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
82  | 
\<Longrightarrow> same_inode_files (UnLink p f # s) f' = (  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
83  | 
     if (proc_fd_of_file s f = {}) 
 | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
84  | 
     then same_inode_files s f' - {f}
 | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
85  | 
else same_inode_files s f')"  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
86  | 
apply (frule vt_grant_os, frule vd_cons)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
87  | 
apply (auto simp:same_inode_files_def is_file_unlink current_files_unlink  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
88  | 
split:if_splits option.splits  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
89  | 
dest:iof's_im_in_cim iof's_im_in_cim' inum_of_file_none_prop)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
90  | 
done  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
91  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
92  | 
lemma same_inode_files_mkdir:  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
93  | 
"valid (Mkdir p f inum # s) \<Longrightarrow> same_inode_files (Mkdir p f inum # s) = (same_inode_files s)"  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
94  | 
apply (frule vt_grant_os, frule vd_cons, rule ext)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
95  | 
apply (auto simp:same_inode_files_def is_file_simps current_files_simps  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
96  | 
split:if_splits option.splits  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
97  | 
dest:iof's_im_in_cim iof's_im_in_cim' inum_of_file_none_prop is_file_in_current)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
98  | 
apply (simp add:current_files_def is_file_def)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
99  | 
done  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
100  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
101  | 
lemma same_inode_files_other:  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
102  | 
"\<lbrakk>valid (e # s);  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
103  | 
\<forall> p f flag fd opt. e \<noteq> Open p f flag fd opt;  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
104  | 
\<forall> p fd. e \<noteq> CloseFd p fd;  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
105  | 
\<forall> p f. e \<noteq> UnLink p f;  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
106  | 
\<forall> p f f'. e \<noteq> LinkHard p f f'\<rbrakk> \<Longrightarrow> same_inode_files (e # s) = same_inode_files s"  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
107  | 
apply (frule vt_grant_os, frule vd_cons, rule ext, case_tac e)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
108  | 
apply (auto simp:same_inode_files_def is_file_simps current_files_simps dir_is_empty_def  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
109  | 
split:if_splits option.splits  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
110  | 
dest:iof's_im_in_cim iof's_im_in_cim' inum_of_file_none_prop is_file_not_dir)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
111  | 
apply (simp add:is_file_def is_dir_def current_files_def split:option.splits t_inode_tag.splits)+  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
112  | 
done  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
113  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
114  | 
lemmas same_inode_files_simps = same_inode_files_nil same_inode_files_open same_inode_files_linkhard  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
115  | 
same_inode_files_closefd same_inode_files_unlink same_inode_files_mkdir same_inode_files_other  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
116  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
117  | 
lemma same_inode_files_prop1:  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
118  | 
"f \<in> same_inode_files s f' \<Longrightarrow> f \<in> current_files s"  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
119  | 
by (simp add:same_inode_files_def is_file_def current_files_def split:if_splits option.splits)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
120  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
121  | 
lemma same_inode_files_prop2:  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
122  | 
"\<lbrakk>f \<in> same_inode_files s f'; f'' \<notin> current_files s\<rbrakk> \<Longrightarrow> f \<noteq> f''"  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
123  | 
by (auto dest:same_inode_files_prop1)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
124  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
125  | 
lemma same_inode_files_prop3:  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
126  | 
"\<lbrakk>f \<in> same_inode_files s f'; is_dir s f''\<rbrakk> \<Longrightarrow> f \<noteq> f''"  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
127  | 
apply (rule notI)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
128  | 
apply (simp add:same_inode_files_def is_file_def is_dir_def  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
129  | 
split:if_splits option.splits t_inode_tag.splits)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
130  | 
done  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
131  | 
|
| 36 | 132  | 
lemma same_inode_files_prop4:  | 
133  | 
"\<lbrakk>f' \<in> same_inode_files s f; f'' \<in> same_inode_files s f'\<rbrakk> \<Longrightarrow> f'' \<in> same_inode_files s f"  | 
|
134  | 
by (auto simp:same_inode_files_def split:if_splits)  | 
|
135  | 
||
136  | 
lemma same_inode_files_prop5:  | 
|
137  | 
"f' \<in> same_inode_files s f \<Longrightarrow> f \<in> same_inode_files s f'"  | 
|
138  | 
by (auto simp:same_inode_files_def is_file_def split:if_splits)  | 
|
139  | 
||
| 
38
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
140  | 
lemma same_inode_files_prop6:  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
141  | 
"f' \<in> same_inode_files s f \<Longrightarrow> same_inode_files s f' = same_inode_files s f"  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
142  | 
by (auto simp:same_inode_files_def is_file_def split:if_splits)  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
143  | 
|
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
144  | 
lemma same_inode_files_prop7:  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
145  | 
"f' \<in> same_inode_files s f \<Longrightarrow> has_same_inode s f f'"  | 
| 39 | 146  | 
by (auto simp:same_inode_files_def is_file_def has_same_inode_def split:if_splits option.splits)  | 
| 
38
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
147  | 
|
| 39 | 148  | 
lemma same_inode_files_prop8:  | 
149  | 
"f' \<in> same_inode_files s f \<Longrightarrow> has_same_inode s f' f"  | 
|
150  | 
by (auto simp:same_inode_files_def is_file_def has_same_inode_def split:if_splits option.splits)  | 
|
| 
38
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
151  | 
|
| 
35
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
152  | 
(* simpset for cf2sfiles *)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
153  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
154  | 
lemma cf2sfiles_open:  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
155  | 
"\<lbrakk>valid (Open p f flag fd opt # s); f' \<in> current_files (Open p f flag fd opt # s)\<rbrakk>  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
156  | 
\<Longrightarrow> cf2sfiles (Open p f flag fd opt # s) f' = (  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
157  | 
if (f' = f \<and> opt \<noteq> None)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
158  | 
then (case cf2sfile (Open p f flag fd opt # s) f of  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
159  | 
             Some sf \<Rightarrow> {sf}  
 | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
160  | 
           | _       \<Rightarrow> {} )
 | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
161  | 
else cf2sfiles s f')"  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
162  | 
apply (frule vt_grant_os, frule vd_cons)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
163  | 
apply (auto simp:cf2sfiles_def cf2sfile_open_none cf2sfile_simps same_inode_files_open  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
164  | 
split:if_splits option.splits dest!:current_file_has_sfile' dest:cf2sfile_open)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
165  | 
apply (rule_tac x = "f'a" in bexI, drule same_inode_files_prop1, simp add:cf2sfile_open_some1, simp)+  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
166  | 
done  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
167  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
168  | 
lemma cf2sfiles_other:  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
169  | 
"\<lbrakk>valid (e # s);  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
170  | 
\<forall> p f flag fd opt. e \<noteq> Open p f flag fd opt;  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
171  | 
\<forall> p fd. e \<noteq> CloseFd p fd;  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
172  | 
\<forall> p f. e \<noteq> UnLink p f;  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
173  | 
\<forall> p f f'. e \<noteq> LinkHard p f f'\<rbrakk> \<Longrightarrow> cf2sfiles (e # s) = cf2sfiles s"  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
174  | 
apply (frule vt_grant_os, frule vd_cons, rule ext)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
175  | 
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
176  | 
apply (drule Set.CollectD, erule bexE, rule CollectI)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
177  | 
apply (rule_tac x = f' in bexI, case_tac e)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
178  | 
apply (auto simp:cf2sfiles_def cf2sfile_simps same_inode_files_simps current_files_simps  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
179  | 
split:if_splits option.splits dest!:current_file_has_sfile' dest:same_inode_files_prop1 cf2sfile_other')  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
180  | 
apply (drule_tac f' = f' in cf2sfile_rmdir)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
181  | 
apply (simp add:current_files_simps same_inode_files_prop1 same_inode_files_prop3 dir_is_empty_def)+  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
182  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
183  | 
apply (rule_tac x = f' in bexI, case_tac e)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
184  | 
apply (auto simp:cf2sfiles_def cf2sfile_simps same_inode_files_simps current_files_simps  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
185  | 
split:if_splits option.splits dest!:current_file_has_sfile' dest:same_inode_files_prop1 cf2sfile_other')  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
186  | 
apply (drule_tac f' = f' in cf2sfile_rmdir)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
187  | 
apply (simp add:current_files_simps same_inode_files_prop1 same_inode_files_prop3 dir_is_empty_def)+  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
188  | 
done  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
189  | 
|
| 36 | 190  | 
lemma cf2sfile_linkhard1':  | 
191  | 
"\<lbrakk>valid (LinkHard p oldf f # s); f' \<in> same_inode_files s f''\<rbrakk>  | 
|
192  | 
\<Longrightarrow> cf2sfile (LinkHard p oldf f# s) f' = cf2sfile s f'"  | 
|
193  | 
apply (drule same_inode_files_prop1)  | 
|
194  | 
by (simp add:cf2sfile_linkhard1)  | 
|
195  | 
||
| 
35
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
196  | 
lemma cf2sfiles_linkhard:  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
197  | 
"valid (LinkHard p oldf f # s) \<Longrightarrow> cf2sfiles (LinkHard p oldf f # s) = (\<lambda> f'.  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
198  | 
if (f' = f \<or> f' \<in> same_inode_files s oldf)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
199  | 
then (case (cf2sfile (LinkHard p oldf f # s) f) of  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
200  | 
             Some sf \<Rightarrow> cf2sfiles s oldf \<union> {sf}
 | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
201  | 
           | _       \<Rightarrow> {})
 | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
202  | 
else cf2sfiles s f')"  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
203  | 
apply (frule vt_grant_os, frule vd_cons, rule ext)  | 
| 36 | 204  | 
apply (auto simp:cf2sfiles_def cf2sfile_linkhard1' same_inode_files_linkhard current_files_linkhard  | 
205  | 
split:if_splits option.splits dest!:current_file_has_sfile' current_has_sec' dest:same_inode_files_prop1)  | 
|
206  | 
done  | 
|
207  | 
||
208  | 
lemma cf2sfile_unlink':  | 
|
209  | 
"\<lbrakk>valid (UnLink p f # s); f' \<in> same_inode_files (UnLink p f # s) f''\<rbrakk>  | 
|
210  | 
\<Longrightarrow> cf2sfile (UnLink p f # s) f' = cf2sfile s f'"  | 
|
211  | 
apply (drule same_inode_files_prop1)  | 
|
212  | 
by (simp add:cf2sfile_unlink)  | 
|
| 
35
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
213  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
214  | 
lemma cf2sfiles_unlink:  | 
| 36 | 215  | 
"\<lbrakk>valid (UnLink p f # s); f' \<in> current_files (UnLink p f # s)\<rbrakk> \<Longrightarrow> cf2sfiles (UnLink p f # s) f' = (  | 
216  | 
     if (f' \<in> same_inode_files s f \<and> proc_fd_of_file s f = {} \<and> 
 | 
|
217  | 
(\<forall> f'' \<in> same_inode_files s f. f'' \<noteq> f \<longrightarrow> cf2sfile s f'' \<noteq> cf2sfile s f)) then  | 
|
218  | 
(case (cf2sfile s f) of  | 
|
219  | 
           Some sf \<Rightarrow> cf2sfiles s f' - {sf}
 | 
|
220  | 
         | _       \<Rightarrow> {})
 | 
|
221  | 
else cf2sfiles s f')"  | 
|
222  | 
apply (frule vt_grant_os, frule vd_cons, simp add:current_files_simps split:if_splits)  | 
|
223  | 
apply (rule conjI, clarify, frule is_file_has_sfile', simp, erule exE, simp)  | 
|
224  | 
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD)  | 
|
225  | 
apply (erule bexE, frule_tac f' = f' in same_inode_files_unlink)  | 
|
226  | 
apply (simp add:current_files_unlink, simp, erule conjE)  | 
|
227  | 
apply (erule_tac x = f'a in ballE, frule_tac f' = "f'a" in cf2sfile_unlink)  | 
|
228  | 
apply (simp add:current_files_unlink same_inode_files_prop1, simp)  | 
|
229  | 
apply (rule_tac x = f'a in bexI, simp, simp)  | 
|
230  | 
apply (drule_tac f = f and f' = f' and f'' = f'a in same_inode_files_prop4, simp+)  | 
|
231  | 
apply (erule conjE|erule exE|erule bexE)+  | 
|
232  | 
apply (case_tac "f'a = f", simp)  | 
|
233  | 
apply (frule_tac f' = f' in same_inode_files_unlink, simp add:current_files_unlink)  | 
|
234  | 
apply (frule_tac f' = f'a in cf2sfile_unlink, simp add:current_files_unlink same_inode_files_prop1)  | 
|
235  | 
apply (rule_tac x = f'a in bexI, simp, simp)  | 
|
236  | 
||
237  | 
apply (rule impI)+  | 
|
238  | 
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD)  | 
|
239  | 
apply (erule bexE, frule_tac f' = f' in same_inode_files_unlink)  | 
|
240  | 
apply (simp add:current_files_unlink, simp, (erule conjE)+)  | 
|
241  | 
apply (rule_tac x = f'a in bexI, frule_tac f' = "f'a" in cf2sfile_unlink)  | 
|
242  | 
apply (simp add:current_files_unlink same_inode_files_prop1, simp, simp)  | 
|
243  | 
apply (drule CollectD, erule bexE, frule_tac f' = f' in same_inode_files_unlink)  | 
|
244  | 
apply (simp add:current_files_unlink, simp)  | 
|
245  | 
apply (case_tac "f'a = f", simp)  | 
|
246  | 
apply (frule_tac f = f' and f' = f in same_inode_files_prop5, simp)  | 
|
247  | 
apply (erule bexE, erule conjE)  | 
|
248  | 
apply (rule_tac x = f'' in bexI)  | 
|
249  | 
apply (drule_tac f' = f'' in cf2sfile_unlink, simp add:current_files_unlink same_inode_files_prop1)  | 
|
250  | 
apply (simp, simp, erule same_inode_files_prop4, simp)  | 
|
251  | 
apply (rule_tac x = f'a in bexI)  | 
|
252  | 
apply (drule_tac f' = f'a in cf2sfile_unlink, simp add:current_files_unlink same_inode_files_prop1)  | 
|
253  | 
apply (simp, simp)  | 
|
254  | 
||
255  | 
||
256  | 
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD)  | 
|
257  | 
apply (erule bexE, frule_tac f' = f' in same_inode_files_unlink)  | 
|
258  | 
apply (simp add:current_files_unlink, simp)  | 
|
259  | 
apply (rule_tac x = f'a in bexI)  | 
|
260  | 
apply (frule_tac f' = f'a in cf2sfile_unlink)  | 
|
261  | 
apply (simp add:same_inode_files_prop1 current_files_unlink, simp, simp)  | 
|
262  | 
apply (drule CollectD, erule bexE, frule_tac f' = f' in same_inode_files_unlink)  | 
|
263  | 
apply (simp add:current_files_unlink, simp)  | 
|
264  | 
apply (rule_tac x = f'a in bexI)  | 
|
265  | 
apply (frule_tac f' = f'a in cf2sfile_unlink)  | 
|
266  | 
apply (simp add:same_inode_files_prop1 current_files_unlink, simp, simp)  | 
|
267  | 
done  | 
|
| 
35
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
268  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
269  | 
lemma cf2sfiles_closefd:  | 
| 36 | 270  | 
"\<lbrakk>valid (CloseFd p fd # s); f' \<in> current_files (CloseFd p fd # s)\<rbrakk> \<Longrightarrow> cf2sfiles (CloseFd p fd # s) f' = (  | 
271  | 
case (file_of_proc_fd s p fd) of  | 
|
272  | 
       Some f \<Rightarrow> if (f' \<in> same_inode_files s f \<and> proc_fd_of_file s f = {(p, fd)} \<and> f \<in> files_hung_by_del s \<and> 
 | 
|
273  | 
(\<forall> f'' \<in> same_inode_files s f. f'' \<noteq> f \<longrightarrow> cf2sfile s f'' \<noteq> cf2sfile s f))  | 
|
274  | 
then (case (cf2sfile s f) of  | 
|
275  | 
                         Some sf \<Rightarrow> cf2sfiles s f' - {sf}
 | 
|
276  | 
                       | _       \<Rightarrow> {})
 | 
|
277  | 
else cf2sfiles s f'  | 
|
278  | 
| _ \<Rightarrow> cf2sfiles s f')"  | 
|
279  | 
||
280  | 
apply (frule vt_grant_os, frule vd_cons, case_tac "file_of_proc_fd s p fd")  | 
|
281  | 
apply (simp_all add:current_files_simps split:if_splits)  | 
|
282  | 
||
283  | 
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD)  | 
|
284  | 
apply (erule bexE, frule_tac f' = f' in same_inode_files_closefd)  | 
|
285  | 
apply (simp add:current_files_closefd, simp)  | 
|
286  | 
apply (rule_tac x = f'a in bexI)  | 
|
287  | 
apply (frule_tac f = f'a in cf2sfile_closefd)  | 
|
288  | 
apply (simp add:same_inode_files_prop1 current_files_closefd, simp, simp)  | 
|
289  | 
apply (drule CollectD, erule bexE, frule_tac f' = f' in same_inode_files_closefd)  | 
|
290  | 
apply (simp add:current_files_closefd, simp)  | 
|
291  | 
apply (rule_tac x = f'a in bexI)  | 
|
292  | 
apply (frule_tac f = f'a in cf2sfile_closefd)  | 
|
293  | 
apply (simp add:same_inode_files_prop1 current_files_closefd, simp, simp)  | 
|
294  | 
||
295  | 
apply (rule conjI, clarify, frule file_of_pfd_is_file, simp)  | 
|
296  | 
apply (frule is_file_has_sfile', simp, erule exE, simp)  | 
|
297  | 
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD)  | 
|
298  | 
apply (erule bexE, frule_tac f' = f' in same_inode_files_closefd)  | 
|
299  | 
apply (simp add:current_files_closefd, simp, erule conjE)  | 
|
300  | 
apply (erule_tac x = f'a in ballE, frule_tac f = "f'a" in cf2sfile_closefd)  | 
|
301  | 
apply (simp add:current_files_closefd same_inode_files_prop1, simp)  | 
|
302  | 
apply (rule_tac x = f'a in bexI, simp, simp)  | 
|
303  | 
apply (drule_tac f = a and f' = f' and f'' = f'a in same_inode_files_prop4, simp+)  | 
|
304  | 
apply (erule conjE|erule exE|erule bexE)+  | 
|
305  | 
apply (case_tac "f'a = a", simp)  | 
|
306  | 
apply (frule_tac f' = f' in same_inode_files_closefd, simp add:current_files_closefd, simp)  | 
|
307  | 
apply (frule_tac f = f'a in cf2sfile_closefd, simp add:current_files_closefd same_inode_files_prop1)  | 
|
308  | 
apply (rule_tac x = f'a in bexI, simp, simp)  | 
|
309  | 
||
310  | 
apply (rule impI)+  | 
|
311  | 
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD)  | 
|
312  | 
apply (erule bexE, frule_tac f' = f' in same_inode_files_closefd)  | 
|
313  | 
apply (simp add:current_files_closefd, simp, (erule conjE)+)  | 
|
314  | 
apply (rule_tac x = f'a in bexI, frule_tac f = f'a in cf2sfile_closefd)  | 
|
315  | 
apply (simp add:current_files_closefd same_inode_files_prop1, simp, simp)  | 
|
316  | 
apply (drule CollectD, erule bexE, frule_tac f' = f' in same_inode_files_closefd)  | 
|
317  | 
apply (simp add:current_files_closefd, simp)  | 
|
318  | 
apply (case_tac "f'a = a", simp)  | 
|
319  | 
apply (frule_tac f = f' and f' = a in same_inode_files_prop5, simp)  | 
|
320  | 
apply (erule bexE, erule conjE)  | 
|
321  | 
apply (rule_tac x = f'' in bexI)  | 
|
322  | 
apply (drule_tac f = f'' in cf2sfile_closefd, simp add:current_files_closefd same_inode_files_prop1)  | 
|
323  | 
apply (simp, simp, erule same_inode_files_prop4, simp)  | 
|
324  | 
apply (rule_tac x = f'a in bexI)  | 
|
325  | 
apply (drule_tac f = f'a in cf2sfile_closefd, simp add:current_files_closefd same_inode_files_prop1)  | 
|
326  | 
apply (simp, simp)  | 
|
327  | 
||
328  | 
apply (rule conjI, clarify)  | 
|
329  | 
||
330  | 
apply (rule impI)  | 
|
331  | 
apply (case_tac "a \<in> files_hung_by_del s", simp_all)  | 
|
332  | 
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD)  | 
|
333  | 
apply (erule bexE, frule_tac f' = f' in same_inode_files_closefd)  | 
|
334  | 
apply (simp add:current_files_closefd, simp)  | 
|
335  | 
apply (rule_tac x = f'a in bexI)  | 
|
336  | 
apply (frule_tac f = f'a in cf2sfile_closefd)  | 
|
337  | 
apply (simp add:same_inode_files_prop1 current_files_closefd, simp, simp)  | 
|
338  | 
apply (drule CollectD, erule bexE, frule_tac f' = f' in same_inode_files_closefd)  | 
|
339  | 
apply (simp add:current_files_closefd, simp)  | 
|
340  | 
apply (rule_tac x = f'a in bexI)  | 
|
341  | 
apply (frule_tac f = f'a in cf2sfile_closefd)  | 
|
342  | 
apply (simp add:same_inode_files_prop1 current_files_closefd, simp, simp)  | 
|
343  | 
apply (simp add:cf2sfiles_def, rule set_eqI, rule iffI, drule CollectD)  | 
|
344  | 
apply (erule bexE, frule_tac f' = f' in same_inode_files_closefd)  | 
|
345  | 
apply (simp add:current_files_closefd, simp)  | 
|
346  | 
apply (rule_tac x = f'a in bexI)  | 
|
347  | 
apply (frule_tac f = f'a in cf2sfile_closefd)  | 
|
348  | 
apply (simp add:same_inode_files_prop1 current_files_closefd, simp, simp)  | 
|
349  | 
apply (drule CollectD, erule bexE, frule_tac f' = f' in same_inode_files_closefd)  | 
|
350  | 
apply (simp add:current_files_closefd, simp)  | 
|
351  | 
apply (rule_tac x = f'a in bexI)  | 
|
352  | 
apply (frule_tac f = f'a in cf2sfile_closefd)  | 
|
353  | 
apply (simp add:same_inode_files_prop1 current_files_closefd, simp, simp)  | 
|
354  | 
done  | 
|
| 
35
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
355  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
356  | 
lemmas cf2sfiles_simps = cf2sfiles_open cf2sfiles_linkhard cf2sfiles_other  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
357  | 
cf2sfiles_unlink cf2sfiles_closefd  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
358  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
359  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
360  | 
(* simpset for co2sobj *)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
361  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
362  | 
lemma co2sobj_execve:  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
363  | 
"\<lbrakk>valid (Execve p f fds # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (Execve p f fds # s) obj = (  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
364  | 
if (obj = O_proc p)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
365  | 
then (case (cp2sproc (Execve p f fds # s) p) of  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
366  | 
Some sp \<Rightarrow> Some (S_proc sp (O_proc p \<in> Tainted s \<or> O_file f \<in> Tainted s))  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
367  | 
| _ \<Rightarrow> None)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
368  | 
else co2sobj s obj )"  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
369  | 
apply (frule vt_grant_os, frule vd_cons, case_tac obj)  | 
| 
38
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
370  | 
apply (simp_all add:current_files_simps cf2sfiles_other ch2sshm_other cq2smsgq_other tainted_eq_Tainted)  | 
| 
35
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
371  | 
apply (case_tac "cp2sproc (Execve p f fds # s) p")  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
372  | 
apply (drule current_proc_has_sp', simp, simp)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
373  | 
apply (simp (no_asm_simp) add:cp2sproc_execve tainted_eq_Tainted split:option.splits)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
374  | 
apply (frule_tac s = s in is_dir_has_sdir', simp, erule exE, simp)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
375  | 
apply (frule_tac ff = list in cf2sfile_other', simp_all)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
376  | 
apply (simp add:is_dir_in_current)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
377  | 
done  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
378  | 
|
| 
37
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
379  | 
lemma co2sobj_clone:  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
380  | 
"\<lbrakk>valid (Clone p p' fds shms # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (Clone p p' fds shms # s) obj = (  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
381  | 
if (obj = O_proc p')  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
382  | 
then (case (cp2sproc (Clone p p' fds shms # s) p') of  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
383  | 
Some sp \<Rightarrow> Some (S_proc sp (O_proc p \<in> Tainted s))  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
384  | 
| _ \<Rightarrow> None)  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
385  | 
else co2sobj s obj )"  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
386  | 
apply (frule vt_grant_os, frule vd_cons, case_tac obj)  | 
| 
38
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
387  | 
apply (simp_all add:current_files_simps cf2sfiles_other ch2sshm_other cq2smsgq_other tainted_eq_Tainted)  | 
| 
37
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
388  | 
apply (case_tac "cp2sproc (Clone p p' fds shms # s) p'")  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
389  | 
apply (drule current_proc_has_sp', simp, simp)  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
390  | 
apply ((erule conjE)+, frule_tac p = p in current_proc_has_sec, simp, erule exE, simp)  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
391  | 
apply (rule conjI, rule impI, simp)  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
392  | 
apply (simp (no_asm_simp) add:cp2sproc_clone tainted_eq_Tainted split:option.splits)  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
393  | 
|
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
394  | 
apply (frule_tac s = s in is_dir_has_sdir', simp, erule exE, simp)  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
395  | 
apply (frule_tac ff = list in cf2sfile_other', simp_all)  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
396  | 
apply (simp add:is_dir_in_current)  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
397  | 
done  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
398  | 
|
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
399  | 
lemma co2sobj_ptrace:  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
400  | 
"\<lbrakk>valid (Ptrace p p' # s); alive s obj\<rbrakk>\<Longrightarrow> co2sobj (Ptrace p p' # s) obj = (  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
401  | 
case obj of  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
402  | 
O_proc p'' \<Rightarrow> if (info_flow_shm s p' p'')  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
403  | 
then (case (cp2sproc s p'') of  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
404  | 
Some sp \<Rightarrow> Some (S_proc sp (O_proc p'' \<in> Tainted s \<or> O_proc p \<in> Tainted s))  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
405  | 
| _ \<Rightarrow> None)  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
406  | 
else if (info_flow_shm s p p'')  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
407  | 
then (case (cp2sproc s p'') of  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
408  | 
Some sp \<Rightarrow> Some (S_proc sp (O_proc p'' \<in> Tainted s \<or> O_proc p' \<in> Tainted s))  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
409  | 
| _ \<Rightarrow> None)  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
410  | 
else co2sobj s (O_proc p'')  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
411  | 
| _ \<Rightarrow> co2sobj s obj)"  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
412  | 
apply (frule vt_grant_os, frule vd_cons, case_tac obj)  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
413  | 
apply (simp_all add:current_files_simps ch2sshm_other cq2smsgq_other cf2sfiles_other tainted_eq_Tainted)  | 
| 
38
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
414  | 
|
| 
37
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
415  | 
apply (auto simp:cp2sproc_other tainted_eq_Tainted split:option.splits  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
416  | 
dest!:current_proc_has_sec' current_proc_has_sp' intro:info_flow_shm_Tainted)[1]  | 
| 36 | 417  | 
|
| 
37
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
418  | 
apply (frule_tac s = s in is_dir_has_sdir', simp, erule exE, simp)  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
419  | 
apply (frule_tac ff = list in cf2sfile_other', simp_all)  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
420  | 
apply (simp add:is_dir_in_current)  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
421  | 
done  | 
| 36 | 422  | 
|
| 
37
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
423  | 
lemma co2sobj_open:  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
424  | 
"\<lbrakk>valid (Open p f flag fd opt # s); alive (Open p f flag fd opt # s) obj\<rbrakk>  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
425  | 
\<Longrightarrow> co2sobj (Open p f flag fd opt # s) obj = (case obj of  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
426  | 
O_file f' \<Rightarrow> if (f' = f \<and> opt \<noteq> None)  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
427  | 
then (case (cf2sfile (Open p f flag fd opt # s) f) of  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
428  | 
                          Some sf \<Rightarrow> Some (S_file {sf} (O_proc p \<in> Tainted s))
 | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
429  | 
| _ \<Rightarrow> None)  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
430  | 
else co2sobj s (O_file f')  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
431  | 
| O_proc p' \<Rightarrow> if (p' = p)  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
432  | 
then (case (cp2sproc (Open p f flag fd opt # s) p) of  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
433  | 
Some sp \<Rightarrow> Some (S_proc sp (O_proc p \<in> Tainted s))  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
434  | 
| _ \<Rightarrow> None)  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
435  | 
else co2sobj s (O_proc p')  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
436  | 
| _ \<Rightarrow> co2sobj s obj )"  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
437  | 
apply (frule vt_grant_os, frule vd_cons, case_tac obj)  | 
| 
38
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
438  | 
apply (auto simp:cp2sproc_simps tainted_eq_Tainted split:option.splits  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
439  | 
dest!:current_proc_has_sp' intro:info_flow_shm_Tainted)[1]  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
440  | 
|
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
441  | 
apply (simp split:if_splits t_object.splits)  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
442  | 
apply (rule conjI, rule impI, erule conjE, erule exE, simp, (erule exE|erule conjE)+)  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
443  | 
apply (case_tac "cf2sfile (Open p f flag fd (Some y) # s) f")  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
444  | 
apply (drule current_file_has_sfile', simp, simp add:current_files_simps, simp)  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
445  | 
apply (frule_tac f' = f in cf2sfiles_open, simp add:current_files_simps)  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
446  | 
apply (simp add:tainted_eq_Tainted)  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
447  | 
apply (rule impI, rule notI, drule Tainted_in_current, simp, simp add:is_file_in_current)  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
448  | 
apply (rule impI, simp add:tainted_eq_Tainted cf2sfiles_open is_file_in_current split:option.splits)  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
449  | 
|
| 
37
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
450  | 
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)  | 
| 
38
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
451  | 
|
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
452  | 
apply (frule is_dir_in_current)  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
453  | 
apply (frule_tac f' = list in cf2sfile_open)  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
454  | 
apply (simp add:current_files_simps split:option.splits)  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
455  | 
apply (simp split:if_splits option.splits)  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
456  | 
done  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
457  | 
|
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
458  | 
lemma co2sobj_readfile:  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
459  | 
"\<lbrakk>valid (ReadFile p fd # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (ReadFile p fd # s) obj = (  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
460  | 
case obj of  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
461  | 
O_proc p' \<Rightarrow> (case (file_of_proc_fd s p fd) of  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
462  | 
Some f \<Rightarrow> (if (info_flow_shm s p p' \<and> O_file f \<in> Tainted s)  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
463  | 
then (case (cp2sproc s p') of  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
464  | 
Some sp \<Rightarrow> Some (S_proc sp True)  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
465  | 
| _ \<Rightarrow> None)  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
466  | 
else co2sobj s obj)  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
467  | 
| _ \<Rightarrow> None)  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
468  | 
| _ \<Rightarrow> co2sobj s obj)"  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
469  | 
apply (frule vt_grant_os, frule vd_cons, case_tac obj)  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
470  | 
apply (auto simp:cp2sproc_simps tainted_eq_Tainted split:option.splits  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
471  | 
dest!:current_proc_has_sp' intro:info_flow_shm_Tainted)[1]  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
472  | 
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
473  | 
|
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
474  | 
apply (auto split:if_splits option.splits dest!:current_file_has_sfile'  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
475  | 
simp:current_files_simps cf2sfiles_simps cf2sfile_simps  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
476  | 
dest:is_file_in_current is_dir_in_current)  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
477  | 
done  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
478  | 
|
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
479  | 
lemma co2sobj_writefile:  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
480  | 
"\<lbrakk>valid (WriteFile p fd # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (WriteFile p fd # s) obj = (  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
481  | 
case obj of  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
482  | 
O_file f' \<Rightarrow> (case (file_of_proc_fd s p fd) of  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
483  | 
Some f \<Rightarrow> (if (f \<in> same_inode_files s f')  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
484  | 
then Some (S_file (cf2sfiles s f')  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
485  | 
(O_file f' \<in> Tainted s \<or> O_proc p \<in> Tainted s))  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
486  | 
else co2sobj s obj)  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
487  | 
| _ \<Rightarrow> None)  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
488  | 
| _ \<Rightarrow> co2sobj s obj)"  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
489  | 
apply (frule vt_grant_os, frule vd_cons, case_tac obj)  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
490  | 
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
491  | 
|
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
492  | 
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp'  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
493  | 
simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
494  | 
same_inode_files_prop6  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
495  | 
dest:is_file_in_current is_dir_in_current)  | 
| 39 | 496  | 
|
497  | 
(* should delete has_same_inode !?!?*)  | 
|
498  | 
by (auto simp:same_inode_files_def is_file_def has_same_inode_def split:if_splits option.splits)  | 
|
| 
38
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
499  | 
|
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
500  | 
lemma co2sobj_closefd:  | 
| 39 | 501  | 
"\<lbrakk>valid (CloseFd p fd # s); alive (CloseFd p fd # s) obj\<rbrakk> \<Longrightarrow> co2sobj (CloseFd p fd # s) obj = (  | 
| 
38
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
502  | 
case obj of  | 
| 
 
9dfc8c72565a
found a bug: has_same_inode is a redundant concept of same_inode_files, which is the general form, has_same_inode should be deleted
 
chunhan 
parents: 
37 
diff
changeset
 | 
503  | 
O_file f' \<Rightarrow> (case (file_of_proc_fd s p fd) of  | 
| 39 | 504  | 
                        Some f \<Rightarrow> (if (f' \<in> same_inode_files s f \<and> proc_fd_of_file s f = {(p, fd)} \<and>
 | 
505  | 
f \<in> files_hung_by_del s \<and> (\<forall> f'' \<in> same_inode_files s f.  | 
|
506  | 
f'' \<noteq> f \<longrightarrow> cf2sfile s f'' \<noteq> cf2sfile s f))  | 
|
507  | 
then (case (cf2sfile s f, co2sobj s (O_file f')) of  | 
|
508  | 
                                           (Some sf, Some (S_file sfs b)) \<Rightarrow> Some (S_file (sfs - {sf}) b)
 | 
|
509  | 
| _ \<Rightarrow> None)  | 
|
510  | 
else co2sobj s obj)  | 
|
511  | 
| _ \<Rightarrow> co2sobj s obj)  | 
|
512  | 
| O_proc p' \<Rightarrow> (if (p = p')  | 
|
513  | 
then (case (cp2sproc (CloseFd p fd # s) p) of  | 
|
514  | 
Some sp \<Rightarrow> Some (S_proc sp (O_proc p \<in> Tainted s))  | 
|
515  | 
| _ \<Rightarrow> None)  | 
|
516  | 
else co2sobj s obj)  | 
|
517  | 
| _ \<Rightarrow> co2sobj s obj) "  | 
|
518  | 
apply (frule vt_grant_os, frule vd_cons, case_tac obj)  | 
|
519  | 
apply (simp_all add:current_files_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)  | 
|
520  | 
apply (auto simp:cp2sproc_simps tainted_eq_Tainted split:option.splits if_splits  | 
|
521  | 
dest!:current_proc_has_sp' intro:info_flow_shm_Tainted)[1]  | 
|
522  | 
||
523  | 
apply (frule is_file_in_current)  | 
|
524  | 
apply (case_tac "file_of_proc_fd s p fd")  | 
|
525  | 
apply (simp add:tainted_eq_Tainted)  | 
|
526  | 
apply (drule_tac f' = list in cf2sfiles_closefd, simp add:current_files_closefd, simp)  | 
|
527  | 
apply (frule_tac f' = list in cf2sfiles_closefd, simp)  | 
|
528  | 
apply (simp add:is_file_simps current_files_simps)  | 
|
529  | 
apply (auto simp add:tainted_eq_Tainted cf2sfile_closefd split:if_splits option.splits  | 
|
530  | 
dest!:current_file_has_sfile' dest:hung_file_in_current)[1]  | 
|
531  | 
||
532  | 
apply (simp add:is_dir_simps, frule is_dir_in_current)  | 
|
533  | 
apply (frule_tac f = list in cf2sfile_closefd)  | 
|
534  | 
apply (clarsimp simp:current_files_closefd split:option.splits)  | 
|
535  | 
apply (drule file_of_pfd_is_file', simp+)  | 
|
536  | 
done  | 
|
537  | 
||
538  | 
lemma co2sobj_unlink:  | 
|
539  | 
"\<lbrakk>valid (UnLink p f # s); alive (UnLink p f # s) obj\<rbrakk> \<Longrightarrow> co2sobj (UnLink p f # s) obj = (  | 
|
540  | 
case obj of  | 
|
541  | 
        O_file f' \<Rightarrow> if (f' \<in> same_inode_files s f \<and> proc_fd_of_file s f = {} \<and> 
 | 
|
542  | 
(\<forall> f'' \<in> same_inode_files s f. f'' \<noteq> f \<longrightarrow> cf2sfile s f'' \<noteq> cf2sfile s f))  | 
|
543  | 
then (case (cf2sfile s f, co2sobj s (O_file f')) of  | 
|
544  | 
                             (Some sf, Some (S_file sfs b)) \<Rightarrow> Some (S_file (sfs - {sf}) b)
 | 
|
545  | 
| _ \<Rightarrow> None)  | 
|
546  | 
else co2sobj s obj  | 
|
547  | 
| _ \<Rightarrow> co2sobj s obj)"  | 
|
548  | 
apply (frule vt_grant_os, frule vd_cons, case_tac obj)  | 
|
549  | 
apply (simp_all add:current_files_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)  | 
|
550  | 
apply (auto simp:cp2sproc_simps tainted_eq_Tainted split:option.splits if_splits  | 
|
551  | 
dest!:current_proc_has_sp' intro:info_flow_shm_Tainted)[1]  | 
|
552  | 
apply (frule is_file_in_current)  | 
|
553  | 
apply (frule_tac f' = list in cf2sfile_unlink, simp)  | 
|
554  | 
apply (frule_tac f' = list in cf2sfiles_unlink, simp)  | 
|
555  | 
apply (simp add:is_file_simps current_files_simps)  | 
|
556  | 
apply (auto simp add:tainted_eq_Tainted is_file_in_current split:if_splits option.splits  | 
|
557  | 
dest!:current_file_has_sfile')[1]  | 
|
558  | 
||
559  | 
apply (simp add:is_dir_simps, frule is_dir_in_current)  | 
|
560  | 
apply (frule_tac f' = list in cf2sfile_unlink)  | 
|
561  | 
apply (clarsimp simp:current_files_unlink split:option.splits)  | 
|
562  | 
apply (drule file_dir_conflict, simp+)  | 
|
563  | 
done  | 
|
564  | 
||
565  | 
lemma co2sobj_rmdir:  | 
|
566  | 
"\<lbrakk>valid (Rmdir p f # s); alive (Rmdir p f # s) obj\<rbrakk> \<Longrightarrow> co2sobj (Rmdir p f # s) obj = co2sobj s obj"  | 
|
567  | 
apply (frule vt_grant_os, frule vd_cons, case_tac obj)  | 
|
568  | 
apply (simp_all add:current_files_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)  | 
|
569  | 
apply (auto simp:cp2sproc_simps tainted_eq_Tainted split:option.splits if_splits  | 
|
570  | 
dest!:current_proc_has_sp' intro:info_flow_shm_Tainted)[1]  | 
|
571  | 
apply (simp add:is_file_simps dir_is_empty_def)  | 
|
572  | 
apply (case_tac "f = list", drule file_dir_conflict, simp, simp)  | 
|
573  | 
apply (simp add:cf2sfiles_other)  | 
|
574  | 
apply (auto simp:cf2sfile_simps dest:is_dir_in_current)  | 
|
575  | 
done  | 
|
576  | 
||
577  | 
lemma co2sobj_mkdir:  | 
|
578  | 
"\<lbrakk>valid (Mkdir p f i # s); alive (Mkdir p f i # s) obj\<rbrakk> \<Longrightarrow> co2sobj (Mkdir p f i # s) obj = (  | 
|
579  | 
if (obj = O_dir f)  | 
|
580  | 
then (case (cf2sfile (Mkdir p f i # s) f) of  | 
|
581  | 
Some sf \<Rightarrow> Some (S_dir sf)  | 
|
582  | 
| _ \<Rightarrow> None)  | 
|
583  | 
else co2sobj s obj)"  | 
|
584  | 
apply (frule vt_grant_os, frule vd_cons, case_tac obj)  | 
|
585  | 
apply (simp_all add:current_files_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)  | 
|
586  | 
apply (auto simp:cp2sproc_simps tainted_eq_Tainted split:option.splits if_splits  | 
|
587  | 
dest!:current_proc_has_sp' intro:info_flow_shm_Tainted)[1]  | 
|
588  | 
apply (frule_tac cf2sfiles_other, simp+)  | 
|
589  | 
apply (frule is_dir_in_current, rule impI, simp add:current_files_mkdir)  | 
|
590  | 
apply (frule current_file_has_sfile, simp, erule exE, simp)  | 
|
591  | 
apply (drule cf2sfile_mkdir1, simp+)  | 
|
592  | 
done  | 
|
593  | 
||
594  | 
lemma same_inodes_Tainted:  | 
|
595  | 
"\<lbrakk>f \<in> same_inode_files s f'; valid s\<rbrakk> \<Longrightarrow> (O_file f \<in> Tainted s) = (O_file f' \<in> Tainted s)"  | 
|
596  | 
apply (frule same_inode_files_prop8, frule same_inode_files_prop7)  | 
|
597  | 
apply (auto intro:has_same_inode_Tainted)  | 
|
598  | 
done  | 
|
599  | 
||
600  | 
lemma co2sobj_linkhard:  | 
|
601  | 
"\<lbrakk>valid (LinkHard p oldf f # s); alive (LinkHard p oldf f # s) obj\<rbrakk>  | 
|
602  | 
\<Longrightarrow> co2sobj (LinkHard p oldf f # s) obj = (  | 
|
603  | 
case obj of  | 
|
604  | 
O_file f' \<Rightarrow> if (f' = f \<or> f' \<in> same_inode_files s oldf)  | 
|
605  | 
then (case (cf2sfile (LinkHard p oldf f # s) f) of  | 
|
606  | 
                           Some sf \<Rightarrow> Some (S_file (cf2sfiles s oldf \<union> {sf}) (O_file oldf \<in> Tainted s))
 | 
|
607  | 
| _ \<Rightarrow> None)  | 
|
608  | 
else co2sobj s obj  | 
|
609  | 
| _ \<Rightarrow> co2sobj s obj)"  | 
|
610  | 
apply (frule vt_grant_os, frule vd_cons, case_tac obj)  | 
|
611  | 
apply (simp_all add:current_files_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)  | 
|
612  | 
apply (auto simp:cp2sproc_simps tainted_eq_Tainted split:option.splits if_splits  | 
|
613  | 
dest!:current_proc_has_sp' intro:info_flow_shm_Tainted)[1]  | 
|
614  | 
apply (frule_tac cf2sfiles_linkhard, simp+)  | 
|
615  | 
apply (frule_tac f' = f in cf2sfile_linkhard, simp add:current_files_linkhard)  | 
|
616  | 
apply (auto simp:is_file_simps sectxt_of_obj_simps current_files_simps is_file_in_current same_inodes_Tainted  | 
|
617  | 
split:option.splits if_splits dest:Tainted_in_current  | 
|
618  | 
dest!:current_has_sec' current_file_has_sfile')[1]  | 
|
619  | 
||
620  | 
apply (frule is_dir_in_current, simp add:current_files_linkhard is_dir_simps is_dir_in_current)  | 
|
621  | 
apply (frule is_dir_in_current)  | 
|
622  | 
apply (frule current_file_has_sfile, simp)  | 
|
623  | 
apply (drule cf2sfile_linkhard1, simp+)  | 
|
624  | 
done  | 
|
625  | 
||
626  | 
lemma co2sobj_truncate:  | 
|
627  | 
"\<lbrakk>valid (Truncate p f len # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (Truncate p f len # s) obj = (  | 
|
628  | 
case obj of  | 
|
629  | 
O_file f' \<Rightarrow> if (f' \<in> same_inode_files s f \<and> len > 0)  | 
|
630  | 
then Some (S_file (cf2sfiles s f') (O_file f' \<in> Tainted s \<or> O_proc p \<in> Tainted s))  | 
|
631  | 
else co2sobj s obj  | 
|
632  | 
| _ \<Rightarrow> co2sobj s obj)"  | 
|
633  | 
apply (frule vt_grant_os, frule vd_cons, case_tac obj)  | 
|
634  | 
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)  | 
|
635  | 
||
636  | 
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp'  | 
|
637  | 
simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted  | 
|
638  | 
same_inode_files_prop6  | 
|
639  | 
dest:is_file_in_current is_dir_in_current)  | 
|
640  | 
||
641  | 
(* should delete has_same_inode !?!?*)  | 
|
642  | 
by (auto simp:same_inode_files_def is_file_def has_same_inode_def split:if_splits option.splits)  | 
|
643  | 
||
644  | 
lemma co2sobj_kill:  | 
|
645  | 
"\<lbrakk>valid (Kill p p' # s); alive (Kill p p' # s) obj\<rbrakk> \<Longrightarrow> co2sobj (Kill p p' # s) obj = co2sobj s obj"  | 
|
646  | 
apply (frule vt_grant_os, frule vd_cons, case_tac obj)  | 
|
647  | 
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)  | 
|
648  | 
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp'  | 
|
649  | 
simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted  | 
|
650  | 
same_inode_files_prop6  | 
|
651  | 
dest:is_file_in_current is_dir_in_current)  | 
|
652  | 
done  | 
|
653  | 
||
654  | 
lemma co2sobj_exit:  | 
|
655  | 
"\<lbrakk>valid (Exit p # s); alive (Exit p # s) obj\<rbrakk> \<Longrightarrow> co2sobj (Exit p # s) obj = co2sobj s obj"  | 
|
656  | 
apply (frule vt_grant_os, frule vd_cons, case_tac obj)  | 
|
657  | 
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)  | 
|
658  | 
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp'  | 
|
659  | 
simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted  | 
|
660  | 
same_inode_files_prop6  | 
|
661  | 
dest:is_file_in_current is_dir_in_current)  | 
|
662  | 
done  | 
|
663  | 
||
664  | 
lemma co2sobj_createmsgq:  | 
|
665  | 
"\<lbrakk>valid (CreateMsgq p q # s); alive (CreateMsgq p q # s) obj\<rbrakk> \<Longrightarrow> co2sobj (CreateMsgq p q # s) obj = (  | 
|
666  | 
case obj of  | 
|
667  | 
O_msgq q' \<Rightarrow> if (q' = q) then (case (cq2smsgq (CreateMsgq p q # s) q) of  | 
|
668  | 
Some sq \<Rightarrow> Some (S_msgq sq)  | 
|
669  | 
| _ \<Rightarrow> None)  | 
|
670  | 
else co2sobj s obj  | 
|
671  | 
| _ \<Rightarrow> co2sobj s obj)"  | 
|
672  | 
apply (frule vt_grant_os, frule vd_cons, case_tac obj)  | 
|
673  | 
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)  | 
|
674  | 
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp'  | 
|
675  | 
simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted  | 
|
676  | 
same_inode_files_prop6  | 
|
677  | 
dest!:current_has_smsgq'  | 
|
678  | 
dest:is_file_in_current is_dir_in_current cq2smsg_createmsgq)  | 
|
679  | 
done  | 
|
680  | 
||
681  | 
lemma co2sobj_sendmsg:  | 
|
682  | 
"\<lbrakk>valid (SendMsg p q m # s); alive (SendMsg p q m # s) obj\<rbrakk> \<Longrightarrow> co2sobj (SendMsg p q m # s) obj = (  | 
|
683  | 
case obj of  | 
|
684  | 
O_msgq q' \<Rightarrow> if (q' = q) then (case (cq2smsgq (SendMsg p q m # s) q) of  | 
|
685  | 
Some sq \<Rightarrow> Some (S_msgq sq)  | 
|
686  | 
| _ \<Rightarrow> None)  | 
|
687  | 
else co2sobj s obj  | 
|
688  | 
| _ \<Rightarrow> co2sobj s obj)"  | 
|
689  | 
apply (frule vt_grant_os, frule vd_cons, case_tac obj)  | 
|
690  | 
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)  | 
|
691  | 
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp'  | 
|
692  | 
simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted  | 
|
693  | 
same_inode_files_prop6  | 
|
694  | 
dest!:current_has_smsgq'  | 
|
695  | 
dest:is_file_in_current is_dir_in_current cq2smsg_sendmsg)  | 
|
696  | 
done  | 
|
697  | 
||
698  | 
lemma co2sobj_recvmsg:  | 
|
699  | 
"\<lbrakk>valid (RecvMsg p q m # s); alive (RecvMsg p q m # s) obj\<rbrakk> \<Longrightarrow> co2sobj (RecvMsg p q m # s) obj = (  | 
|
700  | 
case obj of  | 
|
701  | 
O_msgq q' \<Rightarrow> if (q' = q) then (case (cq2smsgq (RecvMsg p q m # s) q) of  | 
|
702  | 
Some sq \<Rightarrow> Some (S_msgq sq)  | 
|
703  | 
| _ \<Rightarrow> None)  | 
|
704  | 
else co2sobj s obj  | 
|
705  | 
| O_proc p' \<Rightarrow> if (info_flow_shm s p p' \<and> O_msg q m \<in> Tainted s)  | 
|
706  | 
then (case (cp2sproc s p') of  | 
|
707  | 
Some sp \<Rightarrow> Some (S_proc sp True)  | 
|
708  | 
| _ \<Rightarrow> None)  | 
|
709  | 
else co2sobj s obj  | 
|
710  | 
| _ \<Rightarrow> co2sobj s obj)"  | 
|
711  | 
apply (frule vt_grant_os, frule vd_cons, case_tac obj)  | 
|
712  | 
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)  | 
|
713  | 
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp'  | 
|
714  | 
simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted  | 
|
715  | 
same_inode_files_prop6  | 
|
716  | 
dest!:current_has_smsgq'  | 
|
717  | 
dest:is_file_in_current is_dir_in_current cq2smsg_recvmsg)  | 
|
718  | 
done  | 
|
719  | 
||
720  | 
lemma co2sobj_removemsgq:  | 
|
721  | 
"\<lbrakk>valid (RemoveMsgq p q # s); alive (RemoveMsgq p q # s) obj\<rbrakk>  | 
|
722  | 
\<Longrightarrow> co2sobj (RemoveMsgq p q # s) obj = co2sobj s obj"  | 
|
723  | 
apply (frule vt_grant_os, frule vd_cons, case_tac obj)  | 
|
724  | 
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)  | 
|
725  | 
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp'  | 
|
726  | 
simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted  | 
|
727  | 
same_inode_files_prop6  | 
|
728  | 
dest!:current_has_smsgq'  | 
|
729  | 
dest:is_file_in_current is_dir_in_current cq2smsg_removemsgq)  | 
|
730  | 
done  | 
|
731  | 
||
732  | 
lemma co2sobj_createshm:  | 
|
733  | 
"\<lbrakk>valid (CreateShM p h # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (CreateShM p h # s) obj = co2sobj s obj"  | 
|
734  | 
apply (frule vt_grant_os, frule vd_cons, case_tac obj)  | 
|
735  | 
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)  | 
|
736  | 
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp'  | 
|
737  | 
simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted  | 
|
738  | 
same_inode_files_prop6 ch2sshm_simps  | 
|
739  | 
dest!:current_shm_has_sh'  | 
|
740  | 
dest:is_file_in_current is_dir_in_current)  | 
|
741  | 
done  | 
|
742  | 
||
743  | 
lemma co2sobj_detach:  | 
|
744  | 
"\<lbrakk>valid (Detach p h # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (Detach p h # s) obj = (  | 
|
745  | 
case obj of  | 
|
746  | 
O_proc p' \<Rightarrow> if (p' = p) then (case (cp2sproc (Detach p h # s) p) of  | 
|
747  | 
Some sp \<Rightarrow> Some (S_proc sp (O_proc p \<in> Tainted s))  | 
|
748  | 
| _ \<Rightarrow> None)  | 
|
749  | 
else co2sobj s obj  | 
|
750  | 
| _ \<Rightarrow> co2sobj s obj)"  | 
|
751  | 
apply (frule vt_grant_os, frule vd_cons, case_tac obj)  | 
|
752  | 
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)  | 
|
753  | 
||
754  | 
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp'  | 
|
755  | 
simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted  | 
|
756  | 
same_inode_files_prop6 ch2sshm_simps  | 
|
757  | 
dest!:current_shm_has_sh'  | 
|
758  | 
dest:is_file_in_current is_dir_in_current)  | 
|
759  | 
done  | 
|
760  | 
||
761  | 
lemma co2sobj_deleteshm:  | 
|
762  | 
"\<lbrakk>valid (DeleteShM p h # s); alive (DeleteShM p h # s) obj\<rbrakk> \<Longrightarrow> co2sobj (DeleteShM p h # s) obj = (  | 
|
763  | 
case obj of  | 
|
764  | 
O_proc p' \<Rightarrow> (case (cp2sproc (DeleteShM p h # s) p') of  | 
|
765  | 
Some sp \<Rightarrow> Some (S_proc sp (O_proc p' \<in> Tainted s))  | 
|
766  | 
| _ \<Rightarrow> None)  | 
|
767  | 
| _ \<Rightarrow> co2sobj s obj)"  | 
|
768  | 
apply (frule vt_grant_os, frule vd_cons, case_tac obj)  | 
|
769  | 
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)  | 
|
770  | 
||
771  | 
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp'  | 
|
772  | 
simp:current_files_simps cf2sfiles_simps cf2sfile_simps tainted_eq_Tainted  | 
|
773  | 
same_inode_files_prop6 ch2sshm_simps  | 
|
774  | 
dest!:current_shm_has_sh'  | 
|
775  | 
dest:is_file_in_current is_dir_in_current)  | 
|
776  | 
done  | 
|
777  | 
||
778  | 
lemma co2sobj_attach:  | 
|
779  | 
"\<lbrakk>valid (Attach p h flag # s); alive s obj\<rbrakk> \<Longrightarrow> co2sobj (Attach p h flag # s) obj = (  | 
|
780  | 
case obj of  | 
|
781  | 
O_proc p' \<Rightarrow> if (p' = p)  | 
|
782  | 
then (case (cp2sproc (Attach p h flag # s) p) of  | 
|
783  | 
Some sp \<Rightarrow> Some (S_proc sp (O_proc p \<in> Tainted s \<or>  | 
|
784  | 
(\<exists> p'. O_proc p' \<in> Tainted s \<and> (p', SHM_RDWR) \<in> procs_of_shm s h)))  | 
|
785  | 
| _ \<Rightarrow> None)  | 
|
786  | 
else if (\<exists> flag'. (p', flag') \<in> procs_of_shm s h)  | 
|
787  | 
then (case (cp2sproc s p') of  | 
|
788  | 
Some sp \<Rightarrow> Some (S_proc sp (O_proc p' \<in> Tainted s \<or>  | 
|
789  | 
(O_proc p \<in> Tainted s \<and> flag = SHM_RDWR)))  | 
|
790  | 
| _ \<Rightarrow> None)  | 
|
791  | 
else co2sobj s obj  | 
|
792  | 
| _ \<Rightarrow> co2sobj s obj)"  | 
|
793  | 
apply (frule vt_grant_os, frule vd_cons, case_tac obj)  | 
|
794  | 
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)  | 
|
795  | 
||
796  | 
apply (rule conjI|rule impI|erule exE)+  | 
|
797  | 
apply (simp split:option.splits)  | 
|
798  | 
apply (rule impI, frule current_proc_has_sp, simp)  | 
|
799  | 
apply ((erule exE)+, auto simp:cp2sproc_attach tainted_eq_Tainted)[1]  | 
|
800  | 
apply (rule impI|rule conjI)+  | 
|
801  | 
apply (subgoal_tac "p \<in> current_procs (Attach p h flag # s)")  | 
|
802  | 
apply (drule_tac p = p in current_proc_has_sp, simp, erule exE)  | 
|
803  | 
apply (auto simp:tainted_eq_Tainted)[1]  | 
|
804  | 
apply (simp, rule impI)  | 
|
805  | 
apply (subgoal_tac "nat \<in> current_procs (Attach p h flag # s)")  | 
|
806  | 
apply (drule_tac p = nat in current_proc_has_sp, simp, erule exE)  | 
|
807  | 
apply (drule_tac p = nat in current_proc_has_sp, simp, erule exE)  | 
|
808  | 
apply (auto simp:cp2sproc_attach tainted_eq_Tainted)[1]  | 
|
809  | 
apply simp  | 
|
810  | 
||
811  | 
apply (auto split:if_splits option.splits dest!:current_file_has_sfile'  | 
|
812  | 
simp:current_files_simps cf2sfiles_simps cf2sfile_simps tainted_eq_Tainted  | 
|
813  | 
same_inode_files_prop6  | 
|
814  | 
dest:is_file_in_current is_dir_in_current)  | 
|
815  | 
done  | 
|
816  | 
||
| 
37
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
817  | 
|
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
818  | 
lemma co2sobj_other:  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
819  | 
"\<lbrakk>valid (e # s); alive (e # s) obj;  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
820  | 
\<forall> p f fds. e \<noteq> Execve p f fds;  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
821  | 
\<forall> p p' fds shms. e \<noteq> Clone p p' fds shms;  | 
| 
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
822  | 
\<forall> p p'. e \<noteq> Ptrace p p';  | 
| 39 | 823  | 
\<forall> p f flags fd opt. e \<noteq> Open p f flags fd opt;  | 
824  | 
\<forall> p fd. e \<noteq> ReadFile p fd;  | 
|
825  | 
\<forall> p fd. e \<noteq> WriteFile p fd;  | 
|
826  | 
\<forall> p fd. e \<noteq> CloseFd p fd;  | 
|
827  | 
\<forall> p f. e \<noteq> UnLink p f;  | 
|
828  | 
\<forall> p f. e \<noteq> Rmdir p f;  | 
|
829  | 
\<forall> p f i. e \<noteq> Mkdir p f i;  | 
|
830  | 
\<forall> p f f'. e \<noteq> LinkHard p f f';  | 
|
831  | 
\<forall> p f len. e \<noteq> Truncate p f len;  | 
|
832  | 
\<forall> p q. e \<noteq> CreateMsgq p q;  | 
|
833  | 
\<forall> p q m. e \<noteq> SendMsg p q m;  | 
|
834  | 
\<forall> p q m. e \<noteq> RecvMsg p q m;  | 
|
835  | 
\<forall> p q. e \<noteq> RemoveMsgq p q;  | 
|
836  | 
\<forall> p h. e \<noteq> CreateShM p h;  | 
|
837  | 
\<forall> p h flag. e \<noteq> Attach p h flag;  | 
|
838  | 
\<forall> p h. e \<noteq> Detach p h;  | 
|
839  | 
\<forall> p h. e \<noteq> DeleteShM p h  | 
|
| 
37
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
840  | 
\<rbrakk> \<Longrightarrow> co2sobj (e # s) obj = co2sobj s obj"  | 
| 39 | 841  | 
apply (frule vt_grant, case_tac e)  | 
842  | 
apply (auto intro:co2sobj_kill co2sobj_exit)  | 
|
843  | 
done  | 
|
| 
37
 
029cccce84b4
remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties
 
chunhan 
parents: 
36 
diff
changeset
 | 
844  | 
|
| 39 | 845  | 
lemmas co2sobj_simps = co2sobj_execve co2sobj_clone co2sobj_ptrace co2sobj_open co2sobj_readfile  | 
846  | 
co2sobj_writefile co2sobj_closefd co2sobj_unlink co2sobj_rmdir co2sobj_mkdir co2sobj_linkhard  | 
|
847  | 
co2sobj_truncate co2sobj_kill co2sobj_exit co2sobj_createmsgq co2sobj_sendmsg co2sobj_recvmsg  | 
|
848  | 
co2sobj_removemsgq co2sobj_attach co2sobj_detach co2sobj_createshm co2sobj_deleteshm  | 
|
| 
35
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
849  | 
|
| 
33
 
6884b3c9284b
fix bug of static.thy for the static of recvmsg case
 
chunhan 
parents: 
32 
diff
changeset
 | 
850  | 
(* simpset for s2ss*)  | 
| 
 
6884b3c9284b
fix bug of static.thy for the static of recvmsg case
 
chunhan 
parents: 
32 
diff
changeset
 | 
851  | 
|
| 
 
6884b3c9284b
fix bug of static.thy for the static of recvmsg case
 
chunhan 
parents: 
32 
diff
changeset
 | 
852  | 
lemma s2ss_execve:  | 
| 34 | 853  | 
"valid (Execve p f fds # s) \<Longrightarrow> s2ss (Execve p f fds # s) = (  | 
854  | 
if (\<exists> p'. p' \<noteq> p \<and> p' \<in> current_procs s \<and> co2sobj s (O_proc p') = co2sobj s (O_proc p))  | 
|
| 
35
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
855  | 
then (case (cp2sproc (Execve p f fds # s) p) of  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
856  | 
             Some sp \<Rightarrow> s2ss s \<union> {S_proc sp (O_proc p \<in> Tainted s \<or> O_file f \<in> Tainted s)}
 | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
857  | 
| _ \<Rightarrow> s2ss s)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
858  | 
else (case (cp2sproc (Execve p f fds # s) p) of  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
859  | 
             Some sp \<Rightarrow> s2ss s - {S_proc sp (O_proc p \<in> Tainted s)}
 | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
860  | 
                              \<union> {S_proc sp (O_proc p \<in> Tainted s \<or> O_file f \<in> Tainted s)}
 | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
861  | 
| _ \<Rightarrow> s2ss s) )"  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
862  | 
apply (frule vd_cons, frule vt_grant_os, simp split:if_splits)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
863  | 
apply (rule conjI, clarify)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
864  | 
apply (frule_tac p = p in current_proc_has_sp, simp, erule exE)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
865  | 
apply (frule_tac p = p' in current_proc_has_sp, simp, erule exE)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
866  | 
apply (simp, (erule conjE)+)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
867  | 
apply (split option.splits, rule conjI, rule impI, drule current_proc_has_sp', simp, simp)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
868  | 
apply (rule allI, rule impI)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
869  | 
apply (rule set_eqI, rule iffI)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
870  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
871  | 
apply (simp split:option.splits)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
872  | 
apply (frule_tac p = p and s = "Execve p f fds # s" in current_proc_has_sp)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
873  | 
thm current_proc_has_sp  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
874  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
875  | 
|
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
876  | 
apply (simp split:option.splits)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
877  | 
apply (drule current_proc_has_sp', simp, simp)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
878  | 
apply (rule conjI, rule impI, drule current_proc_has_sp', simp, simp)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
879  | 
apply (simp add:s2ss_def)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
880  | 
apply (rule allI|rule impI)+  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
881  | 
apply (rule set_eqI, rule iffI)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
882  | 
apply (auto simp:alive_simps)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
883  | 
apply (case_tac obj, auto split:option.splits simp:cp2sproc_execve)  | 
| 
 
f2e620d799cf
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
 
chunhan 
parents: 
34 
diff
changeset
 | 
884  | 
apply (auto split:if_splits)  |