author | chunhan |
Sun, 16 Jun 2013 08:05:37 +0800 | |
changeset 24 | 566b0d1c3669 |
parent 23 | 25e55731ed01 |
child 25 | 259a50be4381 |
permissions | -rw-r--r-- |
18 | 1 |
theory Tainted_prop |
19 | 2 |
imports Main Flask Flask_type Init_prop Current_files_prop Current_sockets_prop Delete_prop Proc_fd_of_file_prop Current_prop |
18 | 3 |
begin |
4 |
||
5 |
context tainting begin |
|
6 |
||
22 | 7 |
fun Tainted :: "t_state \<Rightarrow> t_object set" |
8 |
where |
|
9 |
"Tainted [] = seeds" |
|
10 |
| "Tainted (Clone p p' fds shms # s) = |
|
11 |
(if (O_proc p) \<in> Tainted s then Tainted s \<union> {O_proc p'} else Tainted s)" |
|
12 |
| "Tainted (Execve p f fds # s) = |
|
13 |
(if (O_file f) \<in> Tainted s then Tainted s \<union> {O_proc p} else Tainted s)" |
|
14 |
| "Tainted (Kill p p' # s) = Tainted s - {O_proc p'}" |
|
15 |
| "Tainted (Ptrace p p' # s) = |
|
16 |
(if (O_proc p) \<in> Tainted s |
|
17 |
then Tainted s \<union> {O_proc p'' | p''. info_flow_shm s p' p''} |
|
18 |
else if (O_proc p') \<in> Tainted s |
|
19 |
then Tainted s \<union> {O_proc p'' | p''. info_flow_shm s p p''} |
|
20 |
else Tainted s)" |
|
21 |
| "Tainted (Exit p # s) = Tainted s - {O_proc p}" |
|
22 |
| "Tainted (Open p f flags fd opt # s) = |
|
23 |
(case opt of |
|
24 |
Some inum \<Rightarrow> (if (O_proc p) \<in> Tainted s |
|
25 |
then Tainted s \<union> {O_file f} |
|
26 |
else Tainted s) |
|
27 |
| _ \<Rightarrow> Tainted s)" |
|
28 |
| "Tainted (ReadFile p fd # s) = |
|
29 |
(case (file_of_proc_fd s p fd) of |
|
30 |
Some f \<Rightarrow> if (O_file f) \<in> Tainted s |
|
31 |
then Tainted s \<union> {O_proc p' | p'. info_flow_shm s p p'} |
|
32 |
else Tainted s |
|
33 |
| None \<Rightarrow> Tainted s)" |
|
34 |
| "Tainted (WriteFile p fd # s) = |
|
35 |
(case (file_of_proc_fd s p fd) of |
|
36 |
Some f \<Rightarrow> if (O_proc p) \<in> Tainted s |
|
37 |
then Tainted s \<union> {O_file f' | f'. has_same_inode s f f'} |
|
38 |
else Tainted s |
|
39 |
| None \<Rightarrow> Tainted s)" |
|
40 |
| "Tainted (CloseFd p fd # s) = |
|
41 |
(case (file_of_proc_fd s p fd) of |
|
42 |
Some f \<Rightarrow> ( if ((proc_fd_of_file s f = {(p,fd)}) \<and> (f \<in> files_hung_by_del s)) |
|
43 |
then Tainted s - {O_file f} else Tainted s ) |
|
44 |
| _ \<Rightarrow> Tainted s)" |
|
23
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
45 |
| "Tainted (UnLink p f # s) = |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
46 |
(if (proc_fd_of_file s f = {}) then Tainted s - {O_file f} else Tainted s)" |
22 | 47 |
| "Tainted (LinkHard p f f' # s) = |
48 |
(if (O_file f \<in> Tainted s) then Tainted s \<union> {O_file f'} else Tainted s)" |
|
49 |
| "Tainted (Truncate p f len # s) = |
|
50 |
(if (len > 0 \<and> O_proc p \<in> Tainted s) |
|
51 |
then Tainted s \<union> {O_file f' | f'. has_same_inode s f f'} |
|
52 |
else Tainted s)" |
|
53 |
| "Tainted (SendMsg p q m # s) = |
|
54 |
(if (O_proc p \<in> Tainted s) then Tainted s \<union> {O_msg q m} else Tainted s)" |
|
55 |
| "Tainted (RecvMsg p q m # s) = |
|
56 |
(if (O_msg q m \<in> Tainted s) |
|
23
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
57 |
then (Tainted s \<union> {O_proc p' | p'. info_flow_shm s p p'}) - {O_msg q m} |
22 | 58 |
else Tainted s)" |
59 |
| "Tainted (RemoveMsgq p q # s) = Tainted s - {O_msg q m| m. O_msg q m \<in> Tainted s}" |
|
60 |
| "Tainted (e # s) = Tainted s" |
|
61 |
||
62 |
lemma valid_Tainted_obj: |
|
63 |
"\<lbrakk>obj \<in> Tainted s; valid s\<rbrakk> \<Longrightarrow> (\<forall> f. obj \<noteq> O_dir f) \<and> (\<forall> q. obj \<noteq> O_msgq q) \<and> (\<forall> h. obj \<noteq> O_shm h) \<and> (\<forall> p fd. obj \<noteq> O_fd p fd) \<and> (\<forall> s. obj \<noteq> O_tcp_sock s) \<and> (\<forall> s. obj \<noteq> O_udp_sock s)" |
|
64 |
apply (induct s, simp, drule seeds_in_init, case_tac obj, simp+) |
|
65 |
apply (frule vd_cons, frule vt_grant_os, case_tac a) |
|
66 |
apply (auto split:if_splits option.splits) |
|
67 |
done |
|
68 |
||
69 |
lemma Tainted_in_current: |
|
70 |
"\<lbrakk>obj \<in> Tainted s; valid s\<rbrakk> \<Longrightarrow> alive s obj" |
|
71 |
apply (induct s, simp) |
|
72 |
apply (drule seeds_in_init, case_tac obj, simp_all add:is_file_nil) |
|
73 |
apply (frule vd_cons, frule valid_Tainted_obj, simp, frule vt_grant_os, case_tac a) |
|
23
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
74 |
apply (auto simp:alive_simps split:if_splits option.splits t_object.splits |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
75 |
intro:has_same_inode_prop2 has_same_inode_prop1 dest:info_shm_flow_in_procs) |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
76 |
done |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
77 |
|
24
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
78 |
lemma Tainted_proc_in_current: |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
79 |
"\<lbrakk>O_proc p \<in> Tainted s; valid s\<rbrakk> \<Longrightarrow> p \<in> current_procs s" |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
80 |
by (drule Tainted_in_current, simp+) |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
81 |
|
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
82 |
lemma has_inode_tainted_aux: |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
83 |
"O_file f \<in> tainted s \<Longrightarrow> \<forall> f'. has_same_inode s f f' \<longrightarrow> O_file f' \<in> tainted s" |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
84 |
apply (erule tainted.induct) |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
85 |
apply (auto intro:tainted.intros simp:has_same_inode_def) |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
86 |
(*?? need simpset for tainted *) |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
87 |
|
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
88 |
|
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
89 |
sorry |
23
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
90 |
|
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
91 |
lemma has_inode_Tainted_aux: |
24
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
92 |
"\<lbrakk>O_file f \<in> Tainted s; has_same_inode s f f'\<rbrakk> \<Longrightarrow> O_file f' \<in> Tainted s" |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
93 |
apply (induct s, auto) |
23
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
94 |
apply (auto intro:tainted.intros simp:has_same_inode_def) |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
95 |
(*?? need simpset for tainted *) |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
96 |
sorry |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
97 |
|
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
98 |
lemma info_flow_shm_Tainted: |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
99 |
"\<lbrakk>O_proc p \<in> Tainted s; info_flow_shm s p p'; valid s\<rbrakk> \<Longrightarrow> O_proc p' \<in> Tainted s" |
24
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
100 |
proof (induct s arbitrary:p p') |
23
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
101 |
case Nil |
24
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
102 |
thus ?case by (simp add:flow_shm_in_seeds) |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
103 |
next |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
104 |
case (Cons e s) |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
105 |
hence p1: "O_proc p \<in> Tainted (e # s)" and p2: "info_flow_shm (e # s) p p'" and p3: "valid (e # s)" |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
106 |
and p4: "\<And> p p'. \<lbrakk>O_proc p \<in> Tainted s; info_flow_shm s p p'\<rbrakk> \<Longrightarrow> O_proc p' \<in> Tainted s" |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
107 |
and p5: "valid s" and p6: "os_grant s e" |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
108 |
by (auto dest:vd_cons intro:vd_cons vt_grant_os) |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
109 |
have p4': |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
110 |
"\<And> p p' h flag. \<lbrakk>O_proc p \<in> Tainted s; (p, SHM_RDWR) \<in> procs_of_shm s h; (p', flag) \<in> procs_of_shm s h\<rbrakk> |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
111 |
\<Longrightarrow> O_proc p' \<in> Tainted s" |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
112 |
by (rule p4, auto simp:info_flow_shm_def) |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
113 |
from p2 p3 have p7: "p \<in> current_procs (e # s)" and p8: "p' \<in> current_procs (e # s)" |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
114 |
by (auto dest:info_shm_flow_in_procs) |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
115 |
show ?case |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
116 |
proof (cases "p = p'") |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
117 |
case True with p1 show ?thesis by simp |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
118 |
next |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
119 |
case False |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
120 |
with p1 p2 p5 p6 p7 p8 p3 show ?thesis |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
121 |
apply (case_tac e) |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
122 |
prefer 7 |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
123 |
apply (simp add:info_flow_shm_def split:if_splits option.splits) |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
124 |
apply (rule allI|rule impI|rule conjI)+ |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
125 |
apply (erule disjE, drule_tac p = p and p' = p' in p4', simp+) |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
126 |
apply (erule disjE, rule disjI2, rule disjI2, rule_tac x = h in exI, simp, rule_tac x= toflag in exI, simp) |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
127 |
apply ((erule exE|erule conjE)+) |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
128 |
|
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
129 |
|
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
130 |
apply (auto simp:info_flow_shm_def dest:p4' |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
131 |
procs_of_shm_prop2 Tainted_in_current split:if_splits option.splits)[1] |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
132 |
apply (drule_tac p = p and p' = p' in p4') |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
133 |
apply (erule_tac x = ha in allE, simp) |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
134 |
apply (drule_tac p = "nat1" and p' = p' in p4') |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
135 |
apply (auto dest:p4'[where p = nat1 and p' = p']) |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
136 |
|
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
137 |
apply (induct s) (* |
23
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
138 |
apply simp defer |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
139 |
apply (frule vd_cons, frule vt_grant_os, case_tac a) |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
140 |
apply (auto simp:info_flow_shm_def elim!:disjE) |
24
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
141 |
sorry *) |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
142 |
sorry |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
143 |
next |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
144 |
case (Cons e s) |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
145 |
show ?case |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
146 |
sorry |
566b0d1c3669
info_flow_shm is wrongly defined: p -flow-> p'; p' -flow-> p'' ==> p -flow-> p'', this property cannot be infered by current definition. we should use inductive
chunhan
parents:
23
diff
changeset
|
147 |
qed |
23
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
148 |
|
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
149 |
lemma tainted_imp_Tainted: |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
150 |
"obj \<in> tainted s \<Longrightarrow> obj \<in> Tainted s" |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
151 |
apply (induct rule:tainted.induct) |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
152 |
apply (auto intro:info_flow_shm_Tainted dest:vd_cons) |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
153 |
apply (case_tac e, auto split:option.splits if_splits simp:alive_simps) |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
154 |
done |
22 | 155 |
|
156 |
lemma Tainted_imp_tainted: |
|
157 |
"\<lbrakk>obj \<in> Tainted s; valid s\<rbrakk> \<Longrightarrow> obj \<in> tainted s" |
|
23
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
158 |
proof (induct s arbitrary:obj) |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
159 |
case Nil |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
160 |
thus ?case by (auto intro:t_init) |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
161 |
next |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
162 |
case (Cons e s) |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
163 |
hence p1: "\<And> obj. obj \<in> Tainted s \<Longrightarrow> obj \<in> tainted s" |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
164 |
and p2: "obj \<in> Tainted (e # s)" and p3: "valid (e # s)" |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
165 |
and p4: "valid s" and p5: "os_grant s e" |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
166 |
by (auto dest:vd_cons intro:vd_cons vt_grant_os) |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
167 |
from p1 have p6: "" |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
168 |
apply (frule vd_cons, frule vt_grant_os, frule valid_Tainted_obj, simp) |
22 | 169 |
apply (case_tac a) |
170 |
apply (auto intro!:t_init t_clone t_execve t_cfile t_read t_write t_link t_trunc t_sendmsg t_recvmsg |
|
23
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
171 |
intro:t_remain |
25e55731ed01
locale of tainting for seeds when same shm/inode bugs
chunhan
parents:
22
diff
changeset
|
172 |
split:if_splits option.splits dest:Tainted_in_current) |
22 | 173 |
pr 25 |
174 |
||
175 |
lemma tainted_imp_Tainted: |
|
176 |
"obj \<in> tainted s \<Longrightarrow> obj \<in> Tainted s" |
|
177 |
||
178 |
||
179 |
||
180 |
||
181 |
||
182 |
||
18 | 183 |
lemma tainted_in_current: |
19 | 184 |
"obj \<in> tainted s \<Longrightarrow> alive s obj" |
185 |
apply (erule tainted.induct, auto dest:vt_grant_os vd_cons simp:is_file_simps) |
|
186 |
apply (drule seeds_in_init, simp add:tobj_in_alive) |
|
187 |
apply (erule has_same_inode_prop2, simp, simp add:vd_cons) |
|
188 |
apply (frule vt_grant_os, simp) |
|
189 |
apply (erule has_same_inode_prop1, simp, simp add:vd_cons) |
|
190 |
done |
|
191 |
||
192 |
lemma tainted_is_valid: |
|
193 |
"obj \<in> tainted s \<Longrightarrow> valid s" |
|
194 |
by (erule tainted.induct, auto intro:valid.intros) |
|
18 | 195 |
|
19 | 196 |
lemma t_remain_app: |
197 |
"\<lbrakk>obj \<in> tainted s; \<not> deleted obj (s' @ s); valid (s' @ s)\<rbrakk> |
|
198 |
\<Longrightarrow> obj \<in> tainted (s' @ s)" |
|
199 |
apply (induct s', simp) |
|
200 |
apply (simp (no_asm) only:cons_app_simp_aux, rule t_remain) |
|
201 |
apply (simp_all add:not_deleted_cons_D vd_cons) |
|
202 |
apply (drule tainted_in_current, simp add:not_deleted_imp_alive_cons) |
|
203 |
done |
|
18 | 204 |
|
19 | 205 |
lemma valid_tainted_obj: |
22 | 206 |
"obj \<in> tainted s \<Longrightarrow> (\<forall> f. obj \<noteq> O_dir f) \<and> (\<forall> q. obj \<noteq> O_msgq q) \<and> (\<forall> h. obj \<noteq> O_shm h) \<and> (\<forall> p fd. obj \<noteq> O_fd p fd) \<and> (\<forall> s. obj \<noteq> O_tcp_sock s) \<and> (\<forall> s. obj \<noteq> O_udp_sock s)" |
19 | 207 |
apply (erule tainted.induct) |
208 |
apply (drule seeds_in_init) |
|
209 |
by auto |
|
18 | 210 |
|
19 | 211 |
lemma dir_not_tainted: "O_dir f \<in> tainted s \<Longrightarrow> False" |
212 |
by (auto dest:valid_tainted_obj) |
|
213 |
||
214 |
lemma msgq_not_tainted: "O_msgq q \<in> tainted s \<Longrightarrow> False" |
|
215 |
by (auto dest:valid_tainted_obj) |
|
216 |
||
217 |
lemma shm_not_tainted: "O_shm h \<in> tainted s \<Longrightarrow> False" |
|
218 |
by (auto dest:valid_tainted_obj) |
|
18 | 219 |
|
220 |
end |
|
221 |
||
19 | 222 |
end |