Current_prop.thy
author chunhan
Mon, 30 Dec 2013 23:41:58 +0800
changeset 86 690636b7b6f1
parent 65 6f9a588bcfc4
permissions -rw-r--r--
find bug: a created proc can be tainted by a message, which cannot remain and maynot be duplicated
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
19
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
     1
(*<*)
18
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
     2
theory Current_prop
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
     3
imports Main Flask_type Flask My_list_prefix Init_prop Valid_prop Delete_prop
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
     4
begin
19
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
     5
(*>*)
18
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
     6
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
     7
context flask begin
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
     8
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
     9
lemma procs_of_shm_prop1: "\<lbrakk> p_flag \<in> procs_of_shm s h; valid s\<rbrakk> \<Longrightarrow> h \<in> current_shms s"
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    10
apply (induct s arbitrary:p_flag)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    11
apply (case_tac p_flag, simp, drule init_procs_has_shm, simp)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    12
apply (frule vd_cons, frule vt_grant_os)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    13
apply (case_tac a, auto split:if_splits option.splits)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    14
done
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    15
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    16
lemma procs_of_shm_prop2: "\<lbrakk>(p, flag) \<in> procs_of_shm s h; valid s\<rbrakk> \<Longrightarrow> p \<in> current_procs s"
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    17
apply (induct s arbitrary:p flag)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    18
apply (simp, drule init_procs_has_shm, simp)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    19
apply (frule vd_cons, frule vt_grant_os)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    20
apply (case_tac a, auto split:if_splits option.splits)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    21
done
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    22
26
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
    23
lemma procs_of_shm_prop2':
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
    24
  "\<lbrakk>p \<notin> current_procs s; valid s\<rbrakk> \<Longrightarrow> \<forall> flag h. (p, flag) \<notin> procs_of_shm s h"
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
    25
by (auto dest:procs_of_shm_prop2)
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
    26
18
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    27
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>
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    28
  \<Longrightarrow> flag = flag'"
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    29
apply (induct s arbitrary:p flag flag')
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    30
apply (simp, drule_tac flag = flag in init_procs_has_shm, drule_tac flag = flag' in init_procs_has_shm, simp)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    31
apply (frule vd_cons, frule vt_grant_os)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    32
apply (case_tac a, auto split:if_splits option.splits dest:procs_of_shm_prop2)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    33
done
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    34
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    35
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"
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    36
apply (induct s arbitrary:p flag)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    37
apply (simp, drule init_procs_has_shm, simp)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    38
apply (frule vd_cons, frule vt_grant_os)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    39
apply (case_tac a, auto split:if_splits option.splits dest:procs_of_shm_prop2)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    40
done
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    41
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    42
lemma procs_of_shm_prop4':
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    43
  "\<lbrakk>flag_of_proc_shm s p h = None; valid s\<rbrakk> \<Longrightarrow> \<forall> flag. (p, flag) \<notin> procs_of_shm s h"
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    44
by (auto dest:procs_of_shm_prop4)
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    45
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    46
lemma not_init_intro_proc:
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    47
  "\<lbrakk>p \<notin> current_procs s; valid s\<rbrakk> \<Longrightarrow> deleted (O_proc p) s \<or> p \<notin> init_procs"
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    48
using not_deleted_init_proc by auto
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    49
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    50
lemma not_init_intro_proc':
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    51
  "\<lbrakk>p \<notin> current_procs s; valid s\<rbrakk> \<Longrightarrow> \<not> (\<not> deleted (O_proc p) s \<and> p \<in> init_procs)"
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    52
using not_deleted_init_proc by auto
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
    53
23
25e55731ed01 locale of tainting for seeds when same shm/inode bugs
chunhan
parents: 19
diff changeset
    54
lemma info_shm_flow_in_procs:
25e55731ed01 locale of tainting for seeds when same shm/inode bugs
chunhan
parents: 19
diff changeset
    55
  "\<lbrakk>info_flow_shm s p p'; valid s\<rbrakk> \<Longrightarrow> p \<in> current_procs s \<and> p' \<in> current_procs s"
26
b6333712cb02 finished info_flow_shm(simple def) simpset
chunhan
parents: 25
diff changeset
    56
by (auto intro:procs_of_shm_prop2 simp:info_flow_shm_def one_flow_shm_def)
25
259a50be4381 wrong of info-flow-shm, it is a inductive(transitive) notion, not a simple relation just between 2 nodes, more information, see 5.7 of ideas_of_selinux.txt
chunhan
parents: 23
diff changeset
    57
27
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    58
lemma flag_of_proc_shm_prop1:
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    59
  "\<lbrakk>flag_of_proc_shm s p h = Some flag; valid s\<rbrakk> \<Longrightarrow> (p, flag) \<in> procs_of_shm s h"
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    60
apply (induct s arbitrary:p flag)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    61
apply (simp, drule init_shmflag_has_proc, simp)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    62
apply (frule vd_cons, frule vt_grant_os)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    63
apply (case_tac a, auto split:if_splits option.splits dest:procs_of_shm_prop2)
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    64
done
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    65
fc749f19b894 Info_flow_shm_attach_prop
chunhan
parents: 26
diff changeset
    66
23
25e55731ed01 locale of tainting for seeds when same shm/inode bugs
chunhan
parents: 19
diff changeset
    67
19
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    68
lemma has_same_inode_in_current:
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    69
  "\<lbrakk>has_same_inode s f f'; valid s\<rbrakk> \<Longrightarrow> f \<in> current_files s \<and> f' \<in> current_files s"
65
chunhan
parents: 34
diff changeset
    70
by (auto simp add:has_same_inode_def current_files_def same_inode_files_def 
chunhan
parents: 34
diff changeset
    71
  is_file_def split:if_splits option.splits)
chunhan
parents: 34
diff changeset
    72
19
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    73
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    74
lemma has_same_inode_prop1:
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    75
  "\<lbrakk>has_same_inode s f f'; is_file s f; valid s\<rbrakk> \<Longrightarrow> is_file s f'"
65
chunhan
parents: 34
diff changeset
    76
by (auto simp:has_same_inode_def same_inode_files_def is_file_def)
19
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    77
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    78
lemma has_same_inode_prop1':
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    79
  "\<lbrakk>has_same_inode s f f'; is_file s f'; valid s\<rbrakk> \<Longrightarrow> is_file s f"
65
chunhan
parents: 34
diff changeset
    80
by (auto simp:has_same_inode_def is_file_def same_inode_files_def 
chunhan
parents: 34
diff changeset
    81
 split:if_splits option.splits)
19
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    82
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    83
lemma has_same_inode_prop2:
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    84
  "\<lbrakk>has_same_inode s f f'; file_of_proc_fd s p fd = Some f; valid s\<rbrakk> \<Longrightarrow> is_file s f'"
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    85
apply (drule has_same_inode_prop1)
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    86
apply (simp add:file_of_pfd_is_file, simp+)
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    87
done
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    88
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    89
lemma has_same_inode_prop2':
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    90
  "\<lbrakk>has_same_inode s f f'; file_of_proc_fd s p fd = Some f'; valid s\<rbrakk> \<Longrightarrow> is_file s f"
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    91
apply (drule has_same_inode_prop1')
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    92
apply (simp add:file_of_pfd_is_file, simp+)
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    93
done
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    94
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    95
lemma tobj_in_init_alive:
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    96
  "tobj_in_init obj \<Longrightarrow> init_alive obj"
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    97
by (case_tac obj, auto)
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    98
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
    99
lemma tobj_in_alive:
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   100
  "tobj_in_init obj \<Longrightarrow> alive [] obj"
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   101
by (case_tac obj, auto simp:is_file_nil)
ced0fcfbcf8e reprove the top-level dynamic2static
chunhan
parents: 18
diff changeset
   102
18
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
   103
end
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
   104
9b42765ce554 info_flow did NOT guarantee in current_procs
chunhan
parents:
diff changeset
   105
end