no_shm_selinux/Current_prop.thy
author chunhan
Tue, 17 Dec 2013 13:30:21 +0800
changeset 77 6f7b9039715f
child 88 e832378a2ff2
permissions -rw-r--r--
update
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
77
chunhan
parents:
diff changeset
     1
(*<*)
chunhan
parents:
diff changeset
     2
theory Current_prop
chunhan
parents:
diff changeset
     3
imports Main Flask_type Flask My_list_prefix Init_prop Valid_prop Delete_prop
chunhan
parents:
diff changeset
     4
begin
chunhan
parents:
diff changeset
     5
(*>*)
chunhan
parents:
diff changeset
     6
chunhan
parents:
diff changeset
     7
context tainting begin
chunhan
parents:
diff changeset
     8
chunhan
parents:
diff changeset
     9
(*
chunhan
parents:
diff changeset
    10
lemma procs_of_shm_prop1: "\<lbrakk> p_flag \<in> procs_of_shm s h; valid s\<rbrakk> \<Longrightarrow> h \<in> current_shms s"
chunhan
parents:
diff changeset
    11
apply (induct s arbitrary:p_flag)
chunhan
parents:
diff changeset
    12
apply (case_tac p_flag, simp, drule init_procs_has_shm, simp)
chunhan
parents:
diff changeset
    13
apply (frule vd_cons, frule vt_grant_os)
chunhan
parents:
diff changeset
    14
apply (case_tac a, auto split:if_splits option.splits)
chunhan
parents:
diff changeset
    15
done
chunhan
parents:
diff changeset
    16
chunhan
parents:
diff changeset
    17
lemma procs_of_shm_prop2: "\<lbrakk>(p, flag) \<in> procs_of_shm s h; valid s\<rbrakk> \<Longrightarrow> p \<in> current_procs s"
chunhan
parents:
diff changeset
    18
apply (induct s arbitrary:p flag)
chunhan
parents:
diff changeset
    19
apply (simp, drule init_procs_has_shm, simp)
chunhan
parents:
diff changeset
    20
apply (frule vd_cons, frule vt_grant_os)
chunhan
parents:
diff changeset
    21
apply (case_tac a, auto split:if_splits option.splits)
chunhan
parents:
diff changeset
    22
done
chunhan
parents:
diff changeset
    23
chunhan
parents:
diff changeset
    24
lemma procs_of_shm_prop2':
chunhan
parents:
diff changeset
    25
  "\<lbrakk>p \<notin> current_procs s; valid s\<rbrakk> \<Longrightarrow> \<forall> flag h. (p, flag) \<notin> procs_of_shm s h"
chunhan
parents:
diff changeset
    26
by (auto dest:procs_of_shm_prop2)
chunhan
parents:
diff changeset
    27
chunhan
parents:
diff changeset
    28
lemma procs_of_shm_prop3: "\<lbrakk>(p, flag) \<in> procs_of_shm s h; (p, flag') \<in> procs_of_shm s h; valid s\<rbrakk>
chunhan
parents:
diff changeset
    29
  \<Longrightarrow> flag = flag'"
chunhan
parents:
diff changeset
    30
apply (induct s arbitrary:p flag flag')
chunhan
parents:
diff changeset
    31
apply (simp, drule_tac flag = flag in init_procs_has_shm, drule_tac flag = flag' in init_procs_has_shm, simp)
chunhan
parents:
diff changeset
    32
apply (frule vd_cons, frule vt_grant_os)
chunhan
parents:
diff changeset
    33
apply (case_tac a, auto split:if_splits option.splits dest:procs_of_shm_prop2)
chunhan
parents:
diff changeset
    34
done
chunhan
parents:
diff changeset
    35
chunhan
parents:
diff changeset
    36
lemma procs_of_shm_prop4: "\<lbrakk>(p, flag) \<in> procs_of_shm s h; valid s\<rbrakk> \<Longrightarrow> flag_of_proc_shm s p h = Some flag"
chunhan
parents:
diff changeset
    37
apply (induct s arbitrary:p flag)
chunhan
parents:
diff changeset
    38
apply (simp, drule init_procs_has_shm, simp)
chunhan
parents:
diff changeset
    39
apply (frule vd_cons, frule vt_grant_os)
chunhan
parents:
diff changeset
    40
apply (case_tac a, auto split:if_splits option.splits dest:procs_of_shm_prop2)
chunhan
parents:
diff changeset
    41
done
chunhan
parents:
diff changeset
    42
chunhan
parents:
diff changeset
    43
lemma procs_of_shm_prop4':
chunhan
parents:
diff changeset
    44
  "\<lbrakk>flag_of_proc_shm s p h = None; valid s\<rbrakk> \<Longrightarrow> \<forall> flag. (p, flag) \<notin> procs_of_shm s h"
chunhan
parents:
diff changeset
    45
by (auto dest:procs_of_shm_prop4)
chunhan
parents:
diff changeset
    46
*)
chunhan
parents:
diff changeset
    47
chunhan
parents:
diff changeset
    48
lemma not_init_intro_proc:
chunhan
parents:
diff changeset
    49
  "\<lbrakk>p \<notin> current_procs s; valid s\<rbrakk> \<Longrightarrow> died (O_proc p) s \<or> p \<notin> init_procs"
chunhan
parents:
diff changeset
    50
using not_died_init_proc by auto
chunhan
parents:
diff changeset
    51
chunhan
parents:
diff changeset
    52
lemma not_init_intro_proc':
chunhan
parents:
diff changeset
    53
  "\<lbrakk>p \<notin> current_procs s; valid s\<rbrakk> \<Longrightarrow> \<not> (\<not> died (O_proc p) s \<and> p \<in> init_procs)"
chunhan
parents:
diff changeset
    54
using not_died_init_proc by auto
chunhan
parents:
diff changeset
    55
chunhan
parents:
diff changeset
    56
(*
chunhan
parents:
diff changeset
    57
lemma info_shm_flow_in_procs:
chunhan
parents:
diff changeset
    58
  "\<lbrakk>info_flow_shm s p p'; valid s\<rbrakk> \<Longrightarrow> p \<in> current_procs s \<and> p' \<in> current_procs s"
chunhan
parents:
diff changeset
    59
by (auto intro:procs_of_shm_prop2 simp:info_flow_shm_def one_flow_shm_def)
chunhan
parents:
diff changeset
    60
chunhan
parents:
diff changeset
    61
lemma flag_of_proc_shm_prop1:
chunhan
parents:
diff changeset
    62
  "\<lbrakk>flag_of_proc_shm s p h = Some flag; valid s\<rbrakk> \<Longrightarrow> (p, flag) \<in> procs_of_shm s h"
chunhan
parents:
diff changeset
    63
apply (induct s arbitrary:p flag)
chunhan
parents:
diff changeset
    64
apply (simp, drule init_shmflag_has_proc, simp)
chunhan
parents:
diff changeset
    65
apply (frule vd_cons, frule vt_grant_os)
chunhan
parents:
diff changeset
    66
apply (case_tac a, auto split:if_splits option.splits dest:procs_of_shm_prop2)
chunhan
parents:
diff changeset
    67
done
chunhan
parents:
diff changeset
    68
*)
chunhan
parents:
diff changeset
    69
chunhan
parents:
diff changeset
    70
lemma has_same_inode_in_current:
chunhan
parents:
diff changeset
    71
  "\<lbrakk>has_same_inode s f f'; valid s\<rbrakk> \<Longrightarrow> f \<in> current_files s \<and> f' \<in> current_files s"
chunhan
parents:
diff changeset
    72
by (auto simp add:has_same_inode_def current_files_def same_inode_files_def 
chunhan
parents:
diff changeset
    73
  is_file_def split:if_splits option.splits)
chunhan
parents:
diff changeset
    74
chunhan
parents:
diff changeset
    75
chunhan
parents:
diff changeset
    76
lemma has_same_inode_prop1:
chunhan
parents:
diff changeset
    77
  "\<lbrakk>has_same_inode s f f'; is_file s f; valid s\<rbrakk> \<Longrightarrow> is_file s f'"
chunhan
parents:
diff changeset
    78
by (auto simp:has_same_inode_def same_inode_files_def is_file_def)
chunhan
parents:
diff changeset
    79
chunhan
parents:
diff changeset
    80
lemma has_same_inode_prop1':
chunhan
parents:
diff changeset
    81
  "\<lbrakk>has_same_inode s f f'; is_file s f'; valid s\<rbrakk> \<Longrightarrow> is_file s f"
chunhan
parents:
diff changeset
    82
by (auto simp:has_same_inode_def is_file_def same_inode_files_def 
chunhan
parents:
diff changeset
    83
 split:if_splits option.splits)
chunhan
parents:
diff changeset
    84
chunhan
parents:
diff changeset
    85
lemma has_same_inode_prop2:
chunhan
parents:
diff changeset
    86
  "\<lbrakk>has_same_inode s f f'; file_of_proc_fd s p fd = Some f; valid s\<rbrakk> \<Longrightarrow> is_file s f'"
chunhan
parents:
diff changeset
    87
apply (drule has_same_inode_prop1)
chunhan
parents:
diff changeset
    88
apply (simp add:file_of_pfd_is_file, simp+)
chunhan
parents:
diff changeset
    89
done
chunhan
parents:
diff changeset
    90
chunhan
parents:
diff changeset
    91
lemma has_same_inode_prop2':
chunhan
parents:
diff changeset
    92
  "\<lbrakk>has_same_inode s f f'; file_of_proc_fd s p fd = Some f'; valid s\<rbrakk> \<Longrightarrow> is_file s f"
chunhan
parents:
diff changeset
    93
apply (drule has_same_inode_prop1')
chunhan
parents:
diff changeset
    94
apply (simp add:file_of_pfd_is_file, simp+)
chunhan
parents:
diff changeset
    95
done
chunhan
parents:
diff changeset
    96
chunhan
parents:
diff changeset
    97
lemma tobj_in_init_alive:
chunhan
parents:
diff changeset
    98
  "tobj_in_init obj \<Longrightarrow> init_alive obj"
chunhan
parents:
diff changeset
    99
by (case_tac obj, auto)
chunhan
parents:
diff changeset
   100
chunhan
parents:
diff changeset
   101
lemma tobj_in_alive:
chunhan
parents:
diff changeset
   102
  "tobj_in_init obj \<Longrightarrow> alive [] obj"
chunhan
parents:
diff changeset
   103
by (case_tac obj, auto simp:is_file_nil)
chunhan
parents:
diff changeset
   104
chunhan
parents:
diff changeset
   105
end
chunhan
parents:
diff changeset
   106
chunhan
parents:
diff changeset
   107
end