# HG changeset patch # User chunhan # Date 1378164339 -28800 # Node ID 029cccce84b4c44f2faabf588fc3013fccb7ca82 # Parent 1397b2a763ab0176215870d55083896d9b02ac2a remove in-current constrains from co2sobj, alive already does this job in co2sobj's properties diff -r 1397b2a763ab -r 029cccce84b4 S2ss_prop.thy --- a/S2ss_prop.thy Mon Sep 02 11:12:42 2013 +0800 +++ b/S2ss_prop.thy Tue Sep 03 07:25:39 2013 +0800 @@ -365,10 +365,84 @@ apply (simp add:is_dir_in_current) done -lemma co2sobj_ +lemma co2sobj_clone: + "\valid (Clone p p' fds shms # s); alive s obj\ \ co2sobj (Clone p p' fds shms # s) obj = ( + if (obj = O_proc p') + then (case (cp2sproc (Clone p p' fds shms # s) p') of + Some sp \ Some (S_proc sp (O_proc p \ Tainted s)) + | _ \ None) + else co2sobj s obj )" +apply (frule vt_grant_os, frule vd_cons, case_tac obj) +apply (simp_all add:current_files_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted) +apply (case_tac "cp2sproc (Clone p p' fds shms # s) p'") +apply (drule current_proc_has_sp', simp, simp) +apply ((erule conjE)+, frule_tac p = p in current_proc_has_sec, simp, erule exE, simp) +apply (rule conjI, rule impI, simp) +apply (simp (no_asm_simp) add:cp2sproc_clone tainted_eq_Tainted split:option.splits) + +apply (rule impI, simp add:cf2sfiles_other) +apply (frule_tac s = s in is_dir_has_sdir', simp, erule exE, simp) +apply (frule_tac ff = list in cf2sfile_other', simp_all) +apply (simp add:is_dir_in_current) +done + +lemma co2sobj_ptrace: + "\valid (Ptrace p p' # s); alive s obj\\ co2sobj (Ptrace p p' # s) obj = ( + case obj of + O_proc p'' \ if (info_flow_shm s p' p'') + then (case (cp2sproc s p'') of + Some sp \ Some (S_proc sp (O_proc p'' \ Tainted s \ O_proc p \ Tainted s)) + | _ \ None) + else if (info_flow_shm s p p'') + then (case (cp2sproc s p'') of + Some sp \ Some (S_proc sp (O_proc p'' \ Tainted s \ O_proc p' \ Tainted s)) + | _ \ None) + else co2sobj s (O_proc p'') + | _ \ co2sobj s obj)" +apply (frule vt_grant_os, frule vd_cons, case_tac obj) +apply (simp_all add:current_files_simps ch2sshm_other cq2smsgq_other cf2sfiles_other tainted_eq_Tainted) +apply (auto simp:cp2sproc_other tainted_eq_Tainted split:option.splits + dest!:current_proc_has_sec' current_proc_has_sp' intro:info_flow_shm_Tainted)[1] +apply (frule_tac s = s in is_dir_has_sdir', simp, erule exE, simp) +apply (frule_tac ff = list in cf2sfile_other', simp_all) +apply (simp add:is_dir_in_current) +done -end +lemma co2sobj_open: + "\valid (Open p f flag fd opt # s); alive (Open p f flag fd opt # s) obj\ + \ co2sobj (Open p f flag fd opt # s) obj = (case obj of + O_file f' \ if (f' = f \ opt \ None) + then (case (cf2sfile (Open p f flag fd opt # s) f) of + Some sf \ Some (S_file {sf} (O_proc p \ Tainted s)) + | _ \ None) + else co2sobj s (O_file f') + | O_proc p' \ if (p' = p) + then (case (cp2sproc (Open p f flag fd opt # s) p) of + Some sp \ Some (S_proc sp (O_proc p \ Tainted s)) + | _ \ None) + else co2sobj s (O_proc p') + | _ \ co2sobj s obj )" +apply (frule vt_grant_os, frule vd_cons, case_tac obj) +apply (auto simp:cp2sproc_simps cf2sfiles_simps cf2sfile_simps current_files_simps +is_file_simps tainted_eq_Tainted split:option.splits + dest!:current_proc_has_sp' intro:info_flow_shm_Tainted) +apply (simp_all add:current_files_simps is_dir_simps ch2sshm_other cq2smsgq_other tainted_eq_Tainted) +apply (auto simp:cp2sproc_simps cf2sfiles_simps cf2sfile_simps current_files_simps +is_file_simps tainted_eq_Tainted split:option.splits + dest!:current_proc_has_sp' current_file_has_sfile' intro:info_flow_shm_Tainted) +apply ( +apply + +lemma co2sobj_other: + "\valid (e # s); alive (e # s) obj; + \ p f fds. e \ Execve p f fds; + \ p p' fds shms. e \ Clone p p' fds shms; + \ p p'. e \ Ptrace p p'; + \ + \ \ co2sobj (e # s) obj = co2sobj s obj" + +lemmas co2sobj_simps = co2sobj_execve co2sobj_clone co2sobj_ptrace (* simpset for s2ss*) diff -r 1397b2a763ab -r 029cccce84b4 Static.thy --- a/Static.thy Mon Sep 02 11:12:42 2013 +0800 +++ b/Static.thy Tue Sep 03 07:25:39 2013 +0800 @@ -99,16 +99,12 @@ Some sp \ Some (S_proc sp (O_proc p \ seeds)) | _ \ None)" | "init_obj2sobj (O_file f) = - (if (f \ init_files \ is_init_file f) - then Some (S_file (init_cf2sfiles f) - (\ f'. f' \ (init_same_inode_files f) \ O_file f \ seeds)) - else None)" -| "init_obj2sobj (O_dir f) = - (if (is_init_dir f) then - (case (init_cf2sfile f) of - Some sf \ Some (S_dir sf) - | _ \ None) - else None)" + Some (S_file (init_cf2sfiles f) + (\ f'. f' \ (init_same_inode_files f) \ O_file f \ seeds))" +| "init_obj2sobj (O_dir f) = + (case (init_cf2sfile f) of + Some sf \ Some (S_dir sf) + | _ \ None)" | "init_obj2sobj (O_msgq q) = (case (init_cq2smsgq q) of Some sq \ Some (S_msgq sq) @@ -773,9 +769,7 @@ Some sp \ Some (S_proc sp (O_proc p \ tainted s)) | _ \ None)" | "co2sobj s (O_file f) = - (if (f \ current_files s) then - Some (S_file (cf2sfiles s f) (O_file f \ tainted s)) - else None)" + Some (S_file (cf2sfiles s f) (O_file f \ tainted s))" | "co2sobj s (O_dir f) = (case (cf2sfile s f) of Some sf \ Some (S_dir sf)