no_shm_selinux/Enrich.thy
author chunhan
Tue, 17 Dec 2013 13:30:21 +0800
changeset 77 6f7b9039715f
child 78 030643fab8a1
permissions -rw-r--r--
update
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
77
chunhan
parents:
diff changeset
     1
theory Enrich
chunhan
parents:
diff changeset
     2
imports Main Flask Static Init_prop Valid_prop Tainted_prop Delete_prop Co2sobj_prop S2ss_prop S2ss_prop2
chunhan
parents:
diff changeset
     3
 Temp
chunhan
parents:
diff changeset
     4
begin
chunhan
parents:
diff changeset
     5
chunhan
parents:
diff changeset
     6
context tainting_s begin
chunhan
parents:
diff changeset
     7
chunhan
parents:
diff changeset
     8
(* enrich s target_proc duplicated_pro *)
chunhan
parents:
diff changeset
     9
fun enrich_proc :: "t_state \<Rightarrow> t_process \<Rightarrow> t_process \<Rightarrow> t_state"
chunhan
parents:
diff changeset
    10
where 
chunhan
parents:
diff changeset
    11
  "enrich_proc [] tp dp = []"
chunhan
parents:
diff changeset
    12
| "enrich_proc (Execve p f fds # s) tp dp = (
chunhan
parents:
diff changeset
    13
     if (tp = p) 
chunhan
parents:
diff changeset
    14
     then Execve dp f (fds \<inter> proc_file_fds s p) # Execve p f fds # (enrich_proc s tp dp)
chunhan
parents:
diff changeset
    15
     else Execve p f fds # (enrich_proc s tp dp))"
chunhan
parents:
diff changeset
    16
| "enrich_proc (Clone p p' fds # s) tp dp = (
chunhan
parents:
diff changeset
    17
     if (tp = p') 
chunhan
parents:
diff changeset
    18
     then Clone p dp (fds \<inter> proc_file_fds s p) # Clone p p' fds # s
chunhan
parents:
diff changeset
    19
     else Clone p p' fds # (enrich_proc s tp dp))"
chunhan
parents:
diff changeset
    20
| "enrich_proc (Open p f flags fd opt # s) tp dp = (
chunhan
parents:
diff changeset
    21
     if (tp = p)
chunhan
parents:
diff changeset
    22
     then Open dp f (remove_create_flag flags) fd opt # Open p f flags fd opt # (enrich_proc s tp dp)
chunhan
parents:
diff changeset
    23
     else Open p f flags fd opt # (enrich_proc s tp dp))"
chunhan
parents:
diff changeset
    24
| "enrich_proc (CloseFd p fd # s) tp dp = (
chunhan
parents:
diff changeset
    25
     if (tp = p)
chunhan
parents:
diff changeset
    26
     then CloseFd dp fd # CloseFd p fd # (enrich_proc s tp dp)
chunhan
parents:
diff changeset
    27
     else CloseFd p fd # (enrich_proc s tp dp))"
chunhan
parents:
diff changeset
    28
(*
chunhan
parents:
diff changeset
    29
| "enrich_proc (Attach p h flag # s) tp dp = (
chunhan
parents:
diff changeset
    30
     if (tp = p)
chunhan
parents:
diff changeset
    31
     then Attach dp h flag # Attach p h flag # (enrich_proc s tp dp)
chunhan
parents:
diff changeset
    32
     else Attach p h flag # (enrich_proc s tp dp))"
chunhan
parents:
diff changeset
    33
| "enrich_proc (Detach p h # s) tp dp = (
chunhan
parents:
diff changeset
    34
     if (tp = p) 
chunhan
parents:
diff changeset
    35
     then Detach dp h # Detach p h # (enrich_proc s tp dp)
chunhan
parents:
diff changeset
    36
     else Detach p h # (enrich_proc s tp dp))"
chunhan
parents:
diff changeset
    37
*)
chunhan
parents:
diff changeset
    38
| "enrich_proc (Kill p p' # s) tp dp = (
chunhan
parents:
diff changeset
    39
     if (tp = p) then Kill p p' # s
chunhan
parents:
diff changeset
    40
     else Kill p p' # (enrich_proc s tp dp))"
chunhan
parents:
diff changeset
    41
| "enrich_proc (Exit p # s) tp dp = (
chunhan
parents:
diff changeset
    42
     if (tp = p) then Exit p # s
chunhan
parents:
diff changeset
    43
     else Exit p # (enrich_proc s tp dp))"
chunhan
parents:
diff changeset
    44
| "enrich_proc (e # s) tp dp = e # (enrich_proc s tp dp)"
chunhan
parents:
diff changeset
    45
chunhan
parents:
diff changeset
    46
definition is_created_proc:: "t_state \<Rightarrow> t_process \<Rightarrow> bool"
chunhan
parents:
diff changeset
    47
where
chunhan
parents:
diff changeset
    48
  "is_created_proc s p \<equiv> p \<in> init_procs \<longrightarrow> died (O_proc p) s"
chunhan
parents:
diff changeset
    49
chunhan
parents:
diff changeset
    50
lemma enrich_search_check:
chunhan
parents:
diff changeset
    51
  assumes grant: "search_check s (up, rp, tp) f"
chunhan
parents:
diff changeset
    52
  and cf2sf: "\<forall> f. f \<in> current_files s \<longrightarrow> cf2sfile s' f = cf2sfile s f"
chunhan
parents:
diff changeset
    53
  and vd: "valid s" and f_in: "is_file s f"  and f_in': "is_file s' f"
chunhan
parents:
diff changeset
    54
  and sec: "sectxt_of_obj s' (O_file f) = sectxt_of_obj s (O_file f)"
chunhan
parents:
diff changeset
    55
  shows "search_check s' (up, rp, tp) f"
chunhan
parents:
diff changeset
    56
proof (cases f)
chunhan
parents:
diff changeset
    57
  case Nil
chunhan
parents:
diff changeset
    58
  with f_in vd have "False" 
chunhan
parents:
diff changeset
    59
    by (auto dest:root_is_dir') 
chunhan
parents:
diff changeset
    60
  thus ?thesis by simp
chunhan
parents:
diff changeset
    61
next
chunhan
parents:
diff changeset
    62
  case (Cons n pf)
chunhan
parents:
diff changeset
    63
  from vd f_in obtain sf where sf: "cf2sfile s f = Some sf"
chunhan
parents:
diff changeset
    64
    apply (drule_tac is_file_in_current, drule_tac current_file_has_sfile, simp)
chunhan
parents:
diff changeset
    65
    apply (erule exE, simp)
chunhan
parents:
diff changeset
    66
    done
chunhan
parents:
diff changeset
    67
  then obtain psfs where psfs: "get_parentfs_ctxts s pf = Some psfs" using Cons
chunhan
parents:
diff changeset
    68
    by (auto simp:cf2sfile_def split:option.splits if_splits)
chunhan
parents:
diff changeset
    69
  from sf cf2sf f_in have sf': "cf2sfile s' f = Some sf" by (auto dest:is_file_in_current)
chunhan
parents:
diff changeset
    70
  then obtain psfs' where psfs': "get_parentfs_ctxts s' pf = Some psfs'"using Cons
chunhan
parents:
diff changeset
    71
    by (auto simp:cf2sfile_def split:option.splits if_splits)
chunhan
parents:
diff changeset
    72
  with sf sf' psfs have psfs_eq: "set psfs' = set psfs" using Cons f_in f_in'
chunhan
parents:
diff changeset
    73
    apply (simp add:cf2sfile_def split:option.splits)
chunhan
parents:
diff changeset
    74
    apply (case_tac sf, simp)
chunhan
parents:
diff changeset
    75
    done
chunhan
parents:
diff changeset
    76
  show ?thesis using grant f_in f_in' psfs psfs' psfs_eq sec
chunhan
parents:
diff changeset
    77
    apply (simp add:Cons split:option.splits)
chunhan
parents:
diff changeset
    78
    by (case_tac a, simp)
chunhan
parents:
diff changeset
    79
qed
chunhan
parents:
diff changeset
    80
chunhan
parents:
diff changeset
    81
lemma proc_filefd_has_sfd: "\<lbrakk>fd \<in> proc_file_fds s p; valid s\<rbrakk> \<Longrightarrow> \<exists> sfd. cfd2sfd s p fd = Some sfd"
chunhan
parents:
diff changeset
    82
apply (simp add:proc_file_fds_def)
chunhan
parents:
diff changeset
    83
apply (auto dest: current_filefd_has_sfd)
chunhan
parents:
diff changeset
    84
done
chunhan
parents:
diff changeset
    85
chunhan
parents:
diff changeset
    86
lemma enrich_inherit_fds_check:
chunhan
parents:
diff changeset
    87
  assumes grant: "inherit_fds_check s (up, nr, nt) p fds"  and vd: "valid s"
chunhan
parents:
diff changeset
    88
  and cfd2sfd: "\<forall> p fd. fd \<in> proc_file_fds s p\<longrightarrow> cfd2sfd s' p fd = cfd2sfd s p fd"
chunhan
parents:
diff changeset
    89
  and fd_in: "fds \<subseteq> proc_file_fds s p" and fd_in': "fds \<subseteq> proc_file_fds s' p"
chunhan
parents:
diff changeset
    90
  shows "inherit_fds_check s' (up, nr, nt) p fds"
chunhan
parents:
diff changeset
    91
proof-
chunhan
parents:
diff changeset
    92
  have "\<And> fd. fd \<in> fds \<Longrightarrow> sectxt_of_obj s' (O_fd p fd) = sectxt_of_obj s (O_fd p fd)"
chunhan
parents:
diff changeset
    93
  proof-
chunhan
parents:
diff changeset
    94
    fix fd
chunhan
parents:
diff changeset
    95
    assume fd_in_fds: "fd \<in> fds"
chunhan
parents:
diff changeset
    96
    hence fd_in_cfds: "fd \<in> proc_file_fds s p" 
chunhan
parents:
diff changeset
    97
      and fd_in_cfds': "fd \<in> proc_file_fds s' p" 
chunhan
parents:
diff changeset
    98
      using fd_in fd_in' by auto
chunhan
parents:
diff changeset
    99
    with cfd2sfd
chunhan
parents:
diff changeset
   100
    have cfd_eq: "cfd2sfd s' p fd = cfd2sfd s p fd" by auto
chunhan
parents:
diff changeset
   101
    from fd_in_cfds obtain f where ffd: "file_of_proc_fd s p fd = Some f"
chunhan
parents:
diff changeset
   102
      by (auto simp:proc_file_fds_def)
chunhan
parents:
diff changeset
   103
    moreover have "flags_of_proc_fd s p fd \<noteq> None"
chunhan
parents:
diff changeset
   104
      using ffd vd by (auto dest:current_filefd_has_flags)
chunhan
parents:
diff changeset
   105
    moreover have "sectxt_of_obj s (O_fd p fd) \<noteq> None"
chunhan
parents:
diff changeset
   106
      using fd_in_cfds vd
chunhan
parents:
diff changeset
   107
      apply (rule_tac notI)
chunhan
parents:
diff changeset
   108
      by (auto dest!:current_has_sec' file_fds_subset_pfds[where p = p] intro:vd)
chunhan
parents:
diff changeset
   109
    moreover have "cf2sfile s f \<noteq> None"
chunhan
parents:
diff changeset
   110
      apply (rule notI)
chunhan
parents:
diff changeset
   111
      apply (drule current_file_has_sfile')
chunhan
parents:
diff changeset
   112
      using ffd
chunhan
parents:
diff changeset
   113
      by (auto simp:vd is_file_in_current dest:file_of_pfd_is_file)
chunhan
parents:
diff changeset
   114
    ultimately show "sectxt_of_obj s' (O_fd p fd) = sectxt_of_obj s (O_fd p fd)"
chunhan
parents:
diff changeset
   115
      using cfd_eq
chunhan
parents:
diff changeset
   116
      by (auto simp:cfd2sfd_def split:option.splits)
chunhan
parents:
diff changeset
   117
  qed
chunhan
parents:
diff changeset
   118
  hence "sectxts_of_fds s' p fds = sectxts_of_fds s p fds"
chunhan
parents:
diff changeset
   119
    by (simp add:sectxts_of_fds_def)
chunhan
parents:
diff changeset
   120
  thus ?thesis using grant
chunhan
parents:
diff changeset
   121
    by (simp add:inherit_fds_check_def)
chunhan
parents:
diff changeset
   122
qed
chunhan
parents:
diff changeset
   123
chunhan
parents:
diff changeset
   124
lemma not_all_procs_cons:
chunhan
parents:
diff changeset
   125
  "p \<notin> all_procs (e # s) \<Longrightarrow> p \<notin> all_procs s"
chunhan
parents:
diff changeset
   126
by (case_tac e, auto)
chunhan
parents:
diff changeset
   127
chunhan
parents:
diff changeset
   128
lemma not_all_procs_prop:
chunhan
parents:
diff changeset
   129
  "\<lbrakk>p' \<notin> all_procs s; p \<in> current_procs s; valid s\<rbrakk> \<Longrightarrow> p' \<noteq> p"
chunhan
parents:
diff changeset
   130
apply (induct s, rule notI, simp)
chunhan
parents:
diff changeset
   131
apply (frule vt_grant_os, frule vd_cons, frule not_all_procs_cons, simp, rule notI)
chunhan
parents:
diff changeset
   132
apply (case_tac a, auto)
chunhan
parents:
diff changeset
   133
done
chunhan
parents:
diff changeset
   134
chunhan
parents:
diff changeset
   135
fun enrich_not_alive :: "t_state \<Rightarrow> t_object \<Rightarrow> bool"
chunhan
parents:
diff changeset
   136
where
chunhan
parents:
diff changeset
   137
  "enrich_not_alive s (O_file f) = (f \<notin> current_files s)"
chunhan
parents:
diff changeset
   138
| "enrich_not_alive s (O_dir  f) = (f \<notin> current_files s)"
chunhan
parents:
diff changeset
   139
| "enrich_not_alive s (O_proc p) = (p \<notin> current_procs s)"
chunhan
parents:
diff changeset
   140
| "enrich_not_alive s (O_fd p fd) = (fd \<notin> current_proc_fds s p)"
chunhan
parents:
diff changeset
   141
| "enrich_not_alive s (O_msgq q) = (q \<notin> current_msgqs s)"
chunhan
parents:
diff changeset
   142
| "enrich_not_alive s (O_msg q m) = (m \<notin> set (msgs_of_queue s q) \<or> q \<notin> current_msgqs s)"
chunhan
parents:
diff changeset
   143
| "enrich_not_alive s _ = True"
chunhan
parents:
diff changeset
   144
chunhan
parents:
diff changeset
   145
lemma enrich_valid_intro_cons:
chunhan
parents:
diff changeset
   146
  assumes vs': "valid s'"
chunhan
parents:
diff changeset
   147
    and os: "os_grant s e" and grant: "grant s e" and vd: "valid s"
chunhan
parents:
diff changeset
   148
    and alive: "\<forall> obj. alive s obj \<longrightarrow> alive s' obj"
chunhan
parents:
diff changeset
   149
    and alive': "\<forall> obj. enrich_not_alive s obj \<longrightarrow> enrich_not_alive s' obj"
chunhan
parents:
diff changeset
   150
    and cp2sp: "\<forall> p. p \<in> current_procs s \<longrightarrow> cp2sproc s' p = cp2sproc s p"
chunhan
parents:
diff changeset
   151
    and cf2sf: "\<forall> f. f \<in> current_files s \<longrightarrow> cf2sfile s' f = cf2sfile s f"
chunhan
parents:
diff changeset
   152
    and ffd_remain: "\<forall> p fd f. file_of_proc_fd s p fd = Some f \<longrightarrow> file_of_proc_fd s' p fd = Some f"
chunhan
parents:
diff changeset
   153
    and cfd2sfd: "\<forall> p fd. fd \<in> proc_file_fds s p \<longrightarrow> cfd2sfd s' p fd = cfd2sfd s p fd"
chunhan
parents:
diff changeset
   154
  shows "valid (e # s')"
chunhan
parents:
diff changeset
   155
proof (cases e)
chunhan
parents:
diff changeset
   156
  case (Execve p f fds)
chunhan
parents:
diff changeset
   157
  have p_in: "p \<in> current_procs s'" using os alive
chunhan
parents:
diff changeset
   158
    apply (erule_tac x = "O_proc p" in allE)
chunhan
parents:
diff changeset
   159
    by (auto simp:Execve)
chunhan
parents:
diff changeset
   160
  have f_in: "is_file s' f" using os alive
chunhan
parents:
diff changeset
   161
    apply (erule_tac x = "O_file f" in allE)
chunhan
parents:
diff changeset
   162
    by (auto simp:Execve)
chunhan
parents:
diff changeset
   163
  have fd_in: "fds \<subseteq> proc_file_fds s' p" using os alive ffd_remain
chunhan
parents:
diff changeset
   164
    by (auto simp:Execve proc_file_fds_def)
chunhan
parents:
diff changeset
   165
  have "os_grant s' e" using p_in f_in fd_in by (simp add:Execve)
chunhan
parents:
diff changeset
   166
  moreover have "grant s' e"
chunhan
parents:
diff changeset
   167
  proof-
chunhan
parents:
diff changeset
   168
    from grant obtain up rp tp uf rf tf 
chunhan
parents:
diff changeset
   169
      where p1: "sectxt_of_obj s (O_proc p) = Some (up, rp, tp)"
chunhan
parents:
diff changeset
   170
      and p2: "sectxt_of_obj s (O_file f) = Some (uf, rf, tf)" 
chunhan
parents:
diff changeset
   171
      by (simp add:Execve split:option.splits, blast)
chunhan
parents:
diff changeset
   172
    with grant obtain pu nr nt where p3: "npctxt_execve (up, rp, tp) (uf, rf, tf) = Some (pu, nr, nt)"
chunhan
parents:
diff changeset
   173
      by (simp add:Execve split:option.splits del:npctxt_execve.simps, blast)
chunhan
parents:
diff changeset
   174
    from p1 have p1': "sectxt_of_obj s' (O_proc p) = Some (up, rp, tp)"
chunhan
parents:
diff changeset
   175
      using os cp2sp
chunhan
parents:
diff changeset
   176
      apply (erule_tac x = p in allE)
chunhan
parents:
diff changeset
   177
      by (auto simp:Execve co2sobj.simps cp2sproc_def split:option.splits)
chunhan
parents:
diff changeset
   178
    from os have f_in': "is_file s f" by (simp add:Execve)
chunhan
parents:
diff changeset
   179
    from vd os have "\<exists> sf. cf2sfile s f = Some sf"
chunhan
parents:
diff changeset
   180
      by (auto dest!:is_file_in_current current_file_has_sfile simp:Execve)
chunhan
parents:
diff changeset
   181
    hence p2': "sectxt_of_obj s' (O_file f) = Some (uf, rf, tf)" using f_in f_in' p2 cf2sf
chunhan
parents:
diff changeset
   182
      apply (erule_tac x = f in allE)
chunhan
parents:
diff changeset
   183
      apply (auto dest:is_file_in_current simp:cf2sfile_def split:option.splits)
chunhan
parents:
diff changeset
   184
      apply (case_tac f, simp)
chunhan
parents:
diff changeset
   185
      apply (drule_tac s = s in root_is_dir', simp add:vd, simp+)
chunhan
parents:
diff changeset
   186
      done
chunhan
parents:
diff changeset
   187
    have "inherit_fds_check s' (pu, nr, nt) p fds"
chunhan
parents:
diff changeset
   188
    proof-
chunhan
parents:
diff changeset
   189
      have "fds \<subseteq> proc_file_fds s' p" using os ffd_remain Execve
chunhan
parents:
diff changeset
   190
        by (auto simp:proc_file_fds_def)
chunhan
parents:
diff changeset
   191
      thus ?thesis using Execve grant vd cfd2sfd p1 p2 p3 os
chunhan
parents:
diff changeset
   192
        apply (rule_tac s = s in enrich_inherit_fds_check)
chunhan
parents:
diff changeset
   193
        by (simp_all split:option.splits)
chunhan
parents:
diff changeset
   194
    qed
chunhan
parents:
diff changeset
   195
    moreover have "search_check s' (pu, rp, tp) f"
chunhan
parents:
diff changeset
   196
      using p1 p2 p2' vd cf2sf f_in' grant Execve p3 f_in
chunhan
parents:
diff changeset
   197
      apply (rule_tac s = s in enrich_search_check)
chunhan
parents:
diff changeset
   198
      by (simp_all split:option.splits)
chunhan
parents:
diff changeset
   199
    ultimately show ?thesis using p1' p2' p3
chunhan
parents:
diff changeset
   200
      apply (simp add:Execve split:option.splits) 
chunhan
parents:
diff changeset
   201
      using grant Execve p1 p2
chunhan
parents:
diff changeset
   202
      by (simp add:Execve grant p1 p2)
chunhan
parents:
diff changeset
   203
  qed
chunhan
parents:
diff changeset
   204
  ultimately show ?thesis using vs'
chunhan
parents:
diff changeset
   205
    by (erule_tac valid.intros(2), simp+)
chunhan
parents:
diff changeset
   206
next
chunhan
parents:
diff changeset
   207
  case (Clone p p' fds)
chunhan
parents:
diff changeset
   208
  have p_in: "p \<in> current_procs s'" using os alive
chunhan
parents:
diff changeset
   209
    apply (erule_tac x = "O_proc p" in allE)
chunhan
parents:
diff changeset
   210
    by (auto simp:Clone)
chunhan
parents:
diff changeset
   211
  have p'_not_in: "p' \<notin> current_procs s'" using os alive'
chunhan
parents:
diff changeset
   212
    apply (erule_tac x = "O_proc p'" in allE)
chunhan
parents:
diff changeset
   213
    by (auto simp:Clone)
chunhan
parents:
diff changeset
   214
  have fd_in: "fds \<subseteq> proc_file_fds s' p" using os alive ffd_remain
chunhan
parents:
diff changeset
   215
    by (auto simp:Clone proc_file_fds_def)
chunhan
parents:
diff changeset
   216
  have "os_grant s' e" using p_in p'_not_in fd_in by (simp add:Clone)
chunhan
parents:
diff changeset
   217
  moreover have "grant s' e" 
chunhan
parents:
diff changeset
   218
  proof-
chunhan
parents:
diff changeset
   219
    from grant obtain up rp tp 
chunhan
parents:
diff changeset
   220
      where p1: "sectxt_of_obj s (O_proc p) = Some (up, rp, tp)"
chunhan
parents:
diff changeset
   221
      apply (simp add:Clone split:option.splits)
chunhan
parents:
diff changeset
   222
      by (case_tac a, auto)
chunhan
parents:
diff changeset
   223
    from p1 have p1': "sectxt_of_obj s' (O_proc p) = Some (up, rp, tp)"
chunhan
parents:
diff changeset
   224
      using os cp2sp
chunhan
parents:
diff changeset
   225
      apply (erule_tac x = p in allE)
chunhan
parents:
diff changeset
   226
      by (auto simp:Clone co2sobj.simps cp2sproc_def split:option.splits)
chunhan
parents:
diff changeset
   227
    have p2: "inherit_fds_check s' (up, rp, tp) p fds"
chunhan
parents:
diff changeset
   228
    proof-
chunhan
parents:
diff changeset
   229
      have "fds \<subseteq> proc_file_fds s' p" using os ffd_remain Clone
chunhan
parents:
diff changeset
   230
        by (auto simp:proc_file_fds_def)
chunhan
parents:
diff changeset
   231
      thus ?thesis using Clone grant vd cfd2sfd p1 os
chunhan
parents:
diff changeset
   232
        apply (rule_tac s = s in enrich_inherit_fds_check)
chunhan
parents:
diff changeset
   233
        by (simp_all split:option.splits)
chunhan
parents:
diff changeset
   234
    qed
chunhan
parents:
diff changeset
   235
    show ?thesis using p1 p2 p1' grant
chunhan
parents:
diff changeset
   236
      by (simp add:Clone)
chunhan
parents:
diff changeset
   237
  qed
chunhan
parents:
diff changeset
   238
  ultimately show ?thesis using vs'
chunhan
parents:
diff changeset
   239
    by (erule_tac valid.intros(2), simp+)
chunhan
parents:
diff changeset
   240
next
chunhan
parents:
diff changeset
   241
  
chunhan
parents:
diff changeset
   242
chunhan
parents:
diff changeset
   243
chunhan
parents:
diff changeset
   244
chunhan
parents:
diff changeset
   245
chunhan
parents:
diff changeset
   246
chunhan
parents:
diff changeset
   247
    
chunhan
parents:
diff changeset
   248
chunhan
parents:
diff changeset
   249
lemma enrich_proc_prop:
chunhan
parents:
diff changeset
   250
  "\<lbrakk>valid s; is_created_proc s p; p' \<notin> all_procs s\<rbrakk>
chunhan
parents:
diff changeset
   251
   \<Longrightarrow> valid (enrich_proc s p p') \<and> 
chunhan
parents:
diff changeset
   252
       (p \<in> current_procs s \<longrightarrow> co2sobj (enrich_proc s p p') (O_proc p') = co2sobj (enrich_proc s p p') (O_proc p)) \<and>
chunhan
parents:
diff changeset
   253
       (\<forall> obj. alive s obj \<longrightarrow> alive (enrich_proc s p p')  obj) \<and> 
chunhan
parents:
diff changeset
   254
       (\<forall> p'. p' \<in> current_procs s \<longrightarrow> cp2sproc (enrich_proc s p p') p' = cp2sproc s p) \<and>
chunhan
parents:
diff changeset
   255
       (\<forall> f. f \<in> current_files s \<longrightarrow> cf2sfile (enrich_proc s p p') f = cf2sfile s f) \<and>
chunhan
parents:
diff changeset
   256
       (Tainted (enrich_proc s p p') = (Tainted s \<union> (if (O_proc p \<in> Tainted s) then {O_proc p'} else {})))"
chunhan
parents:
diff changeset
   257
proof (induct s)
chunhan
parents:
diff changeset
   258
  case Nil
chunhan
parents:
diff changeset
   259
  thus ?case by (auto simp:is_created_proc_def)
chunhan
parents:
diff changeset
   260
next
chunhan
parents:
diff changeset
   261
  case (Cons e s)
chunhan
parents:
diff changeset
   262
  hence p1: "\<lbrakk>valid s; is_created_proc s p; p' \<notin> all_procs s\<rbrakk>
chunhan
parents:
diff changeset
   263
  \<Longrightarrow> valid (enrich_proc s p p') \<and>
chunhan
parents:
diff changeset
   264
     (p \<in> current_procs s \<longrightarrow> co2sobj (enrich_proc s p p') (O_proc p') = co2sobj (enrich_proc s p p') (O_proc p)) \<and>
chunhan
parents:
diff changeset
   265
     (alive s obj \<longrightarrow> alive (enrich_proc s p p') obj \<and> co2sobj (enrich_proc s p p') obj = co2sobj s obj)"
chunhan
parents:
diff changeset
   266
    and p2: "valid (e # s)" and p3: "is_created_proc (e # s) p" and p4: "p' \<notin> all_procs (e # s)"
chunhan
parents:
diff changeset
   267
    by auto
chunhan
parents:
diff changeset
   268
  from p2 have vd: "valid s" and os: "os_grant s e" and grant: "grant s e"
chunhan
parents:
diff changeset
   269
    by (auto dest:vd_cons vt_grant vt_grant_os)
chunhan
parents:
diff changeset
   270
  from p4 have p4': "p' \<notin> all_procs s" by (case_tac e, auto)
chunhan
parents:
diff changeset
   271
  from p1 p4' have a1: "is_created_proc s p \<Longrightarrow> valid (enrich_proc s p p')" by (auto simp:vd)
chunhan
parents:
diff changeset
   272
  have c1: "valid (enrich_proc (e # s) p p')"
chunhan
parents:
diff changeset
   273
    apply (case_tac e)
chunhan
parents:
diff changeset
   274
    using a1 os p3
chunhan
parents:
diff changeset
   275
    apply (auto simp:is_created_proc_def)
chunhan
parents:
diff changeset
   276
    sorry
chunhan
parents:
diff changeset
   277
  moreover have c2: "p' \<in> current_procs (enrich_proc (e # s) p p')"
chunhan
parents:
diff changeset
   278
    sorry
chunhan
parents:
diff changeset
   279
  moreover have c3: "co2sobj (enrich_proc (e # s) p p') (O_proc p') = co2sobj (enrich_proc (e # s) p p') (O_proc p)"
chunhan
parents:
diff changeset
   280
    sorry
chunhan
parents:
diff changeset
   281
  moreover have c4: "alive (e # s) obj \<longrightarrow>
chunhan
parents:
diff changeset
   282
     alive (enrich_proc (e # s) p p') obj \<and> co2sobj (enrich_proc (e # s) p p') obj = co2sobj (e # s) obj"
chunhan
parents:
diff changeset
   283
    sorry
chunhan
parents:
diff changeset
   284
  ultimately show ?case by auto
chunhan
parents:
diff changeset
   285
qed
chunhan
parents:
diff changeset
   286