S2ss_prop.thy
author chunhan
Wed, 04 Sep 2013 15:13:54 +0800
changeset 41 db15ef2ee18c
parent 39 13bba99ca090
child 42 021672ec28f5
permissions -rw-r--r--
fixed bugs in co2sobj
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
41
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
     9
(* simpset for s2ss*)
39
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
    10
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
    11
lemma co2sobj_createshm:
41
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    12
  "\<lbrakk>valid (CreateShM p h # s); alive (CreateShM p h # s) obj\<rbrakk> \<Longrightarrow> co2sobj (CreateShM p h # s) obj = (
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    13
      case obj of 
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    14
        O_shm h' \<Rightarrow> if (h' = h) then (case (ch2sshm (CreateShM p h # s) h) of
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    15
                                        Some sh \<Rightarrow> Some (S_shm sh)
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    16
                                      | _       \<Rightarrow> None)
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    17
                    else co2sobj s obj
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    18
      | _        \<Rightarrow> co2sobj s obj)"
39
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
    19
apply (frule vt_grant_os, frule vd_cons, case_tac obj)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
    20
apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
    21
apply (auto split:if_splits option.splits dest!:current_file_has_sfile' current_proc_has_sp'
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
    22
             simp:current_files_simps cf2sfiles_simps cf2sfile_simps cp2sproc_simps tainted_eq_Tainted
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
    23
                  same_inode_files_prop6 ch2sshm_simps
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
    24
             dest!:current_shm_has_sh'
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
    25
             dest:is_file_in_current is_dir_in_current)
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
    26
done
13bba99ca090 done with co2sobj_simps
chunhan
parents: 38
diff changeset
    27
33
6884b3c9284b fix bug of static.thy for the static of recvmsg case
chunhan
parents: 32
diff changeset
    28
lemma s2ss_execve:
34
e7f850d1e08e remove O_msg from co2sobj/init_obj2sobj
chunhan
parents: 33
diff changeset
    29
  "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
    30
     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
    31
     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
    32
             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
    33
           | _ \<Rightarrow> s2ss s)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    34
     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
    35
             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
    36
                              \<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
    37
           | _ \<Rightarrow> s2ss s) )"
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    38
apply (frule vd_cons, frule vt_grant_os, simp split:if_splits)
41
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    39
apply (rule conjI, rule impI, (erule exE|erule conjE)+)
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    40
apply (frule_tac p = p in current_proc_has_sp, simp, erule exE)
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    41
apply (frule_tac p = p' in current_proc_has_sp, simp, erule exE, simp)
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    42
apply (subgoal_tac "p \<in> current_procs (Execve p f fds # s)")
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    43
apply (drule_tac p = p and s = "Execve p f fds # s" in current_proc_has_sp, simp)
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    44
apply (erule exE, simp)
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    45
apply (simp add:s2ss_def, rule set_eqI, rule iffI)
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    46
apply (drule CollectD, (erule exE|erule conjE)+)
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    47
apply (case_tac "obj = O_proc p")
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    48
apply (simp add:co2sobj_execve tainted_eq_Tainted split:if_splits)
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    49
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    50
apply (case_tac obj, simp_all add:co2sobj_execve alive_simps)
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    51
thm alive_execve
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    52
thm co2sobj_execve
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    53
apply (simp add:co2sobj_execve, rule disjI2)
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    54
apply (rule_tac x = obj in exI, simp split:t_object.splits)
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    55
thm co2sobj_execve
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    56
apply (case_tac obj, auto simp:co2sobj_execve alive_simps tainted_eq_Tainted split:option.splits dest!:current_proc_has_sp')[1]
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    57
apply (simp add:co2sobj_execve)
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    58
apply clarsimp
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    59
thm current_proc_has_sp
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    60
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    61
apply (auto simp:s2ss_def co2sobj_execve split:option.splits)
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    62
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    63
db15ef2ee18c fixed bugs in co2sobj
chunhan
parents: 39
diff changeset
    64
35
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    65
apply (rule conjI, clarify)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    66
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
    67
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
    68
apply (simp, (erule conjE)+)
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    69
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
    70
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
    71
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
    72
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    73
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
    74
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
    75
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
    76
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    77
f2e620d799cf in the middle of building simpset for co2sobj, therefore we can deal with s2ss
chunhan
parents: 34
diff changeset
    78
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
    79
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
    80
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
    81
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
    82
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
    83
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
    84
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
    85
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
    86
apply (auto split:if_splits)