no_shm_selinux/Static.thy
changeset 87 8d18cfc845dd
parent 85 1d1aa5bdd37d
child 92 d9dc04c3ea90
equal deleted inserted replaced
86:690636b7b6f1 87:8d18cfc845dd
    75 (* acient files of init-file 
    75 (* acient files of init-file 
    76 definition init_o2s_afs :: "t_file \<Rightarrow> security_context_t set"
    76 definition init_o2s_afs :: "t_file \<Rightarrow> security_context_t set"
    77 where
    77 where
    78   "init_o2s_afs f \<equiv> {sec. \<exists> f'. f' \<preceq> f \<and> init_sectxt_of_obj (O_dir f') = Some sec}" *)
    78   "init_o2s_afs f \<equiv> {sec. \<exists> f'. f' \<preceq> f \<and> init_sectxt_of_obj (O_dir f') = Some sec}" *)
    79 
    79 
       
    80 (*
    80 definition init_cm2smsg :: "t_msgq \<Rightarrow> t_msg \<Rightarrow> t_smsg option"
    81 definition init_cm2smsg :: "t_msgq \<Rightarrow> t_msg \<Rightarrow> t_smsg option"
    81 where
    82 where
    82   "init_cm2smsg q m \<equiv> (case (init_sectxt_of_obj (O_msg q m)) of 
    83   "init_cm2smsg q m \<equiv> (case (init_sectxt_of_obj (O_msg q m)) of 
    83                          Some sec \<Rightarrow> Some (Init m, sec, (O_msg q m) \<in> seeds)
    84                          Some sec \<Rightarrow> Some (Init m, sec, (O_msg q m) \<in> seeds)
    84                        | _ \<Rightarrow> None)"
    85                        | _ \<Rightarrow> None)"
    94 definition init_cq2smsgq :: "t_msgq \<Rightarrow> t_smsgq option"
    95 definition init_cq2smsgq :: "t_msgq \<Rightarrow> t_smsgq option"
    95 where
    96 where
    96   "init_cq2smsgq q \<equiv> (case (init_sectxt_of_obj (O_msgq q), init_cqm2sms q (init_msgs_of_queue q)) of 
    97   "init_cq2smsgq q \<equiv> (case (init_sectxt_of_obj (O_msgq q), init_cqm2sms q (init_msgs_of_queue q)) of 
    97        (Some sec, Some sms) \<Rightarrow> Some (Init q, sec, sms)
    98        (Some sec, Some sms) \<Rightarrow> Some (Init q, sec, sms)
    98      | _ \<Rightarrow> None)"
    99      | _ \<Rightarrow> None)"
       
   100 *)
    99 
   101 
   100 fun init_obj2sobj :: "t_object \<Rightarrow> t_sobject option"
   102 fun init_obj2sobj :: "t_object \<Rightarrow> t_sobject option"
   101 where
   103 where
   102   "init_obj2sobj (O_proc p) = 
   104   "init_obj2sobj (O_proc p) = 
   103      (case (init_cp2sproc p) of 
   105      (case (init_cp2sproc p) of 
   108                   (\<exists> f'. f' \<in> (init_same_inode_files f) \<and> O_file f \<in> seeds))"
   110                   (\<exists> f'. f' \<in> (init_same_inode_files f) \<and> O_file f \<in> seeds))"
   109 | "init_obj2sobj (O_dir f) = 
   111 | "init_obj2sobj (O_dir f) = 
   110      (case (init_cf2sfile f) of
   112      (case (init_cf2sfile f) of
   111            Some sf \<Rightarrow> Some (S_dir sf) 
   113            Some sf \<Rightarrow> Some (S_dir sf) 
   112          | _ \<Rightarrow> None)"
   114          | _ \<Rightarrow> None)"
   113 | "init_obj2sobj (O_msgq q) = 
   115 | "init_obj2sobj (O_msgq q) = None"
       
   116 
       
   117 (*
   114      (case (init_cq2smsgq q) of
   118      (case (init_cq2smsgq q) of
   115        Some sq \<Rightarrow> Some (S_msgq sq)
   119        Some sq \<Rightarrow> Some (S_msgq sq)
   116      | _ \<Rightarrow> None)"
   120      | _ \<Rightarrow> None)"
   117 (*
   121 
   118 | "init_obj2sobj (O_shm h) = 
   122 | "init_obj2sobj (O_shm h) = 
   119      (case (init_ch2sshm h) of 
   123      (case (init_ch2sshm h) of 
   120        Some sh \<Rightarrow> Some (S_shm sh)
   124        Some sh \<Rightarrow> Some (S_shm sh)
   121      | _       \<Rightarrow> None)"  
   125      | _       \<Rightarrow> None)"  
   122 | "init_obj2sobj (O_msg q m) = 
   126 | "init_obj2sobj (O_msg q m) = 
   182                      Some sec \<Rightarrow> 
   186                      Some sec \<Rightarrow> 
   183  Some (if (\<not> died (O_proc p) s \<and> p \<in> init_procs) then Init p else Created, sec, 
   187  Some (if (\<not> died (O_proc p) s \<and> p \<in> init_procs) then Init p else Created, sec, 
   184        cpfd2sfds s p)
   188        cpfd2sfds s p)
   185                    | _ \<Rightarrow> None)"
   189                    | _ \<Rightarrow> None)"
   186 
   190 
       
   191 (*
   187 definition cm2smsg :: "t_state \<Rightarrow> t_msgq \<Rightarrow> t_msg \<Rightarrow> t_smsg option"
   192 definition cm2smsg :: "t_state \<Rightarrow> t_msgq \<Rightarrow> t_msg \<Rightarrow> t_smsg option"
   188 where
   193 where
   189   "cm2smsg s q m \<equiv> (case (sectxt_of_obj s (O_msg q m)) of 
   194   "cm2smsg s q m \<equiv> (case (sectxt_of_obj s (O_msg q m)) of 
   190                       Some sec \<Rightarrow>
   195                       Some sec \<Rightarrow>
   191  Some (if (\<not> died (O_msg q m) s \<and> m \<in> set (init_msgs_of_queue q)) then Init m else Created,
   196  Some (if (\<not> died (O_msg q m) s \<and> m \<in> set (init_msgs_of_queue q)) then Init m else Created,
   192        sec, O_msg q m \<in> tainted s)
   197        sec, O_msg q m \<in> tainted s)
       
   198                     | _ \<Rightarrow> None)"
       
   199 *)
       
   200 
       
   201 definition cm2smsg :: "t_state \<Rightarrow> t_msgq \<Rightarrow> t_msg \<Rightarrow> t_smsg option"
       
   202 where
       
   203   "cm2smsg s q m \<equiv> (case (sectxt_of_obj s (O_msg q m)) of 
       
   204                       Some sec \<Rightarrow> Some (Created, sec, O_msg q m \<in> tainted s)
   193                     | _ \<Rightarrow> None)"
   205                     | _ \<Rightarrow> None)"
   194 
   206 
   195 fun cqm2sms:: "t_state \<Rightarrow> t_msgq \<Rightarrow> t_msg list \<Rightarrow> (t_smsg list) option"
   207 fun cqm2sms:: "t_state \<Rightarrow> t_msgq \<Rightarrow> t_msg list \<Rightarrow> (t_smsg list) option"
   196 where 
   208 where 
   197   "cqm2sms s q [] = Some []"
   209   "cqm2sms s q [] = Some []"
   198 | "cqm2sms s q (m#ms) = 
   210 | "cqm2sms s q (m#ms) = 
   199      (case (cqm2sms s q ms, cm2smsg s q m) of 
   211      (case (cqm2sms s q ms, cm2smsg s q m) of 
   200        (Some sms, Some sm) \<Rightarrow> Some (sm#sms) 
   212        (Some sms, Some sm) \<Rightarrow> Some (sm#sms) 
   201      | _ \<Rightarrow> None)"
   213      | _ \<Rightarrow> None)"
   202 
   214 (*
   203 definition cq2smsgq :: "t_state \<Rightarrow> t_msgq \<Rightarrow> t_smsgq option"
   215 definition cq2smsgq :: "t_state \<Rightarrow> t_msgq \<Rightarrow> t_smsgq option"
   204 where
   216 where
   205   "cq2smsgq s q \<equiv> (case (sectxt_of_obj s (O_msgq q), cqm2sms s q (msgs_of_queue s q)) of 
   217   "cq2smsgq s q \<equiv> (case (sectxt_of_obj s (O_msgq q), cqm2sms s q (msgs_of_queue s q)) of 
   206                      (Some sec, Some sms) \<Rightarrow> 
   218                      (Some sec, Some sms) \<Rightarrow> 
   207  Some (if (\<not> died (O_msgq q) s \<and> q \<in> init_msgqs) then Init q else Created,
   219  Some (if (\<not> died (O_msgq q) s \<and> q \<in> init_msgqs) then Init q else Created,
   208        sec, sms)
   220        sec, sms)
       
   221                    | _ \<Rightarrow> None)"
       
   222 *)
       
   223 
       
   224 definition cq2smsgq :: "t_state \<Rightarrow> t_msgq \<Rightarrow> t_smsgq option"
       
   225 where
       
   226   "cq2smsgq s q \<equiv> (case (sectxt_of_obj s (O_msgq q), cqm2sms s q (msgs_of_queue s q)) of 
       
   227                      (Some sec, Some sms) \<Rightarrow> Some (Created, sec, sms)
   209                    | _ \<Rightarrow> None)"
   228                    | _ \<Rightarrow> None)"
   210 
   229 
   211 fun co2sobj :: "t_state \<Rightarrow> t_object \<Rightarrow> t_sobject option"
   230 fun co2sobj :: "t_state \<Rightarrow> t_object \<Rightarrow> t_sobject option"
   212 where
   231 where
   213   "co2sobj s (O_proc p) = 
   232   "co2sobj s (O_proc p) = 
   264 fun is_many_sproc :: "t_sproc \<Rightarrow> bool"
   283 fun is_many_sproc :: "t_sproc \<Rightarrow> bool"
   265 where
   284 where
   266   "is_many_sproc (Created, sec,fds) = True"
   285   "is_many_sproc (Created, sec,fds) = True"
   267 | "is_many_sproc _                       = False"
   286 | "is_many_sproc _                       = False"
   268 
   287 
       
   288 (*
   269 fun is_many_smsg :: "t_smsg \<Rightarrow> bool"
   289 fun is_many_smsg :: "t_smsg \<Rightarrow> bool"
   270 where
   290 where
   271   "is_many_smsg (Created,sec,tag) = True"
   291   "is_many_smsg (Created,sec,tag) = True"
   272 | "is_many_smsg _                 = False"
   292 | "is_many_smsg _                 = False"
   273 
   293 *)
   274 (* wrong def 
   294 (* wrong def 
   275 fun is_many_smsgq :: "t_smsgq \<Rightarrow> bool"
   295 fun is_many_smsgq :: "t_smsgq \<Rightarrow> bool"
   276 where
   296 where
   277   "is_many_smsgq (Created,sec,sms) = (True \<and> (\<forall> sm \<in> (set sms). is_many_smsg sm))"
   297   "is_many_smsgq (Created,sec,sms) = (True \<and> (\<forall> sm \<in> (set sms). is_many_smsg sm))"
   278 | "is_many_smsgq _                 = False"
   298 | "is_many_smsgq _                 = False"
   279 *)
   299 *)
   280 
   300 (*
   281 fun is_many_smsgq :: "t_smsgq \<Rightarrow> bool"
   301 fun is_many_smsgq :: "t_smsgq \<Rightarrow> bool"
   282 where
   302 where
   283   "is_many_smsgq (Created,sec,sms) = True"
   303   "is_many_smsgq (Created,sec,sms) = True"
   284 | "is_many_smsgq _                 = False"
   304 | "is_many_smsgq _                 = False"
       
   305 *)
   285 (*
   306 (*
   286 fun is_many_sshm :: "t_sshm \<Rightarrow> bool"
   307 fun is_many_sshm :: "t_sshm \<Rightarrow> bool"
   287 where
   308 where
   288   "is_many_sshm (Created, sec) = True"
   309   "is_many_sshm (Created, sec) = True"
   289 | "is_many_sshm _              = False"
   310 | "is_many_sshm _              = False"
   291 fun is_many :: "t_sobject \<Rightarrow> bool"
   312 fun is_many :: "t_sobject \<Rightarrow> bool"
   292 where
   313 where
   293   "is_many (S_proc sp   tag) = is_many_sproc sp"
   314   "is_many (S_proc sp   tag) = is_many_sproc sp"
   294 | "is_many (S_file sfs  tag) = (\<forall> sf \<in> sfs. is_many_sfile sf)"
   315 | "is_many (S_file sfs  tag) = (\<forall> sf \<in> sfs. is_many_sfile sf)"
   295 | "is_many (S_dir  sf      ) = is_many_sfile sf"
   316 | "is_many (S_dir  sf      ) = is_many_sfile sf"
   296 | "is_many (S_msgq sq      ) = is_many_smsgq sq"
   317 | "is_many (S_msgq sq      ) = True"
   297 (*
   318 (*
   298 | "is_many (S_shm  sh      ) = is_many_sshm  sh"
   319 | "is_many (S_shm  sh      ) = is_many_sshm  sh"
   299 *)
   320 *)
   300 
   321 
       
   322 (*
   301 fun is_init_smsgq :: "t_smsgq \<Rightarrow> bool"
   323 fun is_init_smsgq :: "t_smsgq \<Rightarrow> bool"
   302 where
   324 where
   303   "is_init_smsgq (Init q,sec,sms) = True"
   325   "is_init_smsgq (Init q,sec,sms) = True"
   304 | "is_init_smsgq _                = False"
   326 | "is_init_smsgq _                = False"
   305 
   327 *)
   306 (*
   328 (*
   307 fun is_init_sshm :: "t_sshm \<Rightarrow> bool"
   329 fun is_init_sshm :: "t_sshm \<Rightarrow> bool"
   308 where
   330 where
   309   "is_init_sshm (Init h,sec) = True"
   331   "is_init_sshm (Init h,sec) = True"
   310 | "is_init_sshm _            = False"
   332 | "is_init_sshm _            = False"
   312 fun is_init_sobj :: "t_sobject \<Rightarrow> bool"
   334 fun is_init_sobj :: "t_sobject \<Rightarrow> bool"
   313 where
   335 where
   314   "is_init_sobj (S_proc sp tag ) = is_init_sproc sp"
   336   "is_init_sobj (S_proc sp tag ) = is_init_sproc sp"
   315 | "is_init_sobj (S_file sfs tag) = (\<exists> sf \<in> sfs. is_init_sfile sf)"
   337 | "is_init_sobj (S_file sfs tag) = (\<exists> sf \<in> sfs. is_init_sfile sf)"
   316 | "is_init_sobj (S_dir  sf     ) = is_init_sfile sf"
   338 | "is_init_sobj (S_dir  sf     ) = is_init_sfile sf"
   317 | "is_init_sobj (S_msgq sq     ) = is_init_smsgq sq"
   339 | "is_init_sobj (S_msgq sq     ) = False"
   318 (*
   340 (*
   319 | "is_init_sobj (S_shm  sh     ) = is_init_sshm sh"
   341 | "is_init_sobj (S_shm  sh     ) = is_init_sshm sh"
   320 *)
   342 *)
   321 (*
   343 (*
   322 fun update_ss_sp:: "t_static_state \<Rightarrow> t_sobject \<Rightarrow> t_sobject \<Rightarrow> t_static_state"
   344 fun update_ss_sp:: "t_static_state \<Rightarrow> t_sobject \<Rightarrow> t_sobject \<Rightarrow> t_static_state"