S2ss_prop.thy
author chunhan
Sat, 31 Aug 2013 00:35:36 +0800
changeset 35 f2e620d799cf
parent 34 e7f850d1e08e
child 36 1397b2a763ab
permissions -rw-r--r--
in the middle of building simpset for co2sobj, therefore we can deal with s2ss
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
32
705e1e41faf7 add event-trace simpset for s2ss
chunhan
parents:
diff changeset
     1
(*<*)
705e1e41faf7 add event-trace simpset for s2ss
chunhan
parents:
diff changeset
     2
theory S2ss_prop
705e1e41faf7 add event-trace simpset for s2ss
chunhan
parents:
diff changeset
     3
imports Main Flask Flask_type Static Static_type Init_prop Tainted_prop Valid_prop Alive_prop Co2sobj_prop
705e1e41faf7 add event-trace simpset for s2ss
chunhan
parents:
diff changeset
     4
begin
705e1e41faf7 add event-trace simpset for s2ss
chunhan
parents:
diff changeset
     5
(*>*)
705e1e41faf7 add event-trace simpset for s2ss
chunhan
parents:
diff changeset
     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
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   132
(* simpset for cf2sfiles *)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   133
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   134
lemma cf2sfiles_open:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   135
  "\<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
   136
   \<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
   137
     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
   138
     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
   139
             Some sf \<Rightarrow> {sf}  
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   140
           | _       \<Rightarrow> {} )
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   141
     else cf2sfiles s f')"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   142
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
   143
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
   144
  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
   145
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
   146
done
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   147
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   148
lemma cf2sfiles_other:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   149
  "\<lbrakk>valid (e # s);
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   150
    \<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
   151
    \<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
   152
    \<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
   153
    \<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
   154
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
   155
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
   156
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
   157
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
   158
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
   159
  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
   160
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
   161
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
   162
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   163
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
   164
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
   165
  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
   166
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
   167
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
   168
done
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   169
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   170
lemma cf2sfiles_linkhard:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   171
  "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
   172
     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
   173
     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
   174
             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
   175
           | _       \<Rightarrow> {})
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   176
     else cf2sfiles s f')"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   177
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
   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)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   180
apply (simp add:cf2sfiles_def)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   181
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   182
lemma cf2sfiles_unlink:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   183
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   184
lemma cf2sfiles_closefd:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   185
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   186
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
   187
  cf2sfiles_unlink cf2sfiles_closefd
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   188
  
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   189
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   190
(* simpset for co2sobj *)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   191
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   192
lemma co2sobj_execve:
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   193
  "\<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
   194
      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
   195
      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
   196
              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
   197
            | _       \<Rightarrow> None) 
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   198
      else co2sobj s obj )"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   199
apply (frule vt_grant_os, frule vd_cons, case_tac obj)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   200
apply (simp_all add:current_files_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   201
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
   202
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
   203
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
   204
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   205
apply (rule impI, simp add:cf2sfiles_def) defer
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   206
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   207
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
   208
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
   209
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
   210
done
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   211
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   212
end
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   213
33
6884b3c9284b fix bug of static.thy for the static of recvmsg case
chunhan
parents: 32
diff changeset
   214
(* simpset for s2ss*)
6884b3c9284b fix bug of static.thy for the static of recvmsg case
chunhan
parents: 32
diff changeset
   215
6884b3c9284b fix bug of static.thy for the static of recvmsg case
chunhan
parents: 32
diff changeset
   216
lemma s2ss_execve:
34
e7f850d1e08e remove O_msg from co2sobj/init_obj2sobj
chunhan
parents: 33
diff changeset
   217
  "valid (Execve p f fds # s) \<Longrightarrow> s2ss (Execve p f fds # s) = (
e7f850d1e08e remove O_msg from co2sobj/init_obj2sobj
chunhan
parents: 33
diff changeset
   218
     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
   219
     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
   220
             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
   221
           | _ \<Rightarrow> s2ss s)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   222
     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
   223
             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
   224
                              \<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
   225
           | _ \<Rightarrow> s2ss s) )"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   226
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
   227
apply (rule conjI, clarify)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   228
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
   229
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
   230
apply (simp, (erule conjE)+)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   231
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
   232
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
   233
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
   234
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   235
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
   236
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
   237
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
   238
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   239
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
   240
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
   241
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
   242
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
   243
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
   244
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
   245
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
   246
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
   247
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
   248
apply (auto split:if_splits)