Skip to content

Commit 71e7dcc

Browse files
Thomas SewellThomas Sewell
Thomas Sewell
authored and
Thomas Sewell
committed
Fix Access, InfoFlow and DRefine.
1 parent 9b01fad commit 71e7dcc

36 files changed

+202
-261
lines changed

proof/access-control/ADT_AC.thy

+4-5
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ lemma objs_valid_tcb_vtable:
4141
"\<lbrakk>valid_objs s; get_tcb t s = Some tcb\<rbrakk> \<Longrightarrow> s \<turnstile> tcb_vtable tcb"
4242
apply (clarsimp simp: get_tcb_def split: option.splits Structures_A.kernel_object.splits)
4343
apply (erule cte_wp_valid_cap[rotated])
44-
apply (rule cte_wp_at_tcbI[where t="(a, b)" for a b, where b="tcb_cnode_index 1"])
44+
apply (rule cte_wp_at_tcbI[where t="(a, b)" for a b, where b3="tcb_cnode_index 1"])
4545
apply fastforce+
4646
done
4747

@@ -52,10 +52,9 @@ lemma pd_of_thread_page_directory_at:
5252
apply (clarsimp simp: get_pd_of_thread_def
5353
split: option.splits kernel_object.splits cap.splits arch_cap.splits
5454
if_splits)
55-
apply (subgoal_tac "s \<turnstile> ArchObjectCap (PageDirectoryCap word (Some aa))")
56-
apply (fastforce simp: valid_cap_def2 valid_cap_ref_def)
57-
apply (cut_tac s=s and t=tcb and tcb=tcb_ext in objs_valid_tcb_vtable)
58-
apply (simp add: invs_valid_objs get_tcb_def)+
55+
apply (frule_tac t=tcb in objs_valid_tcb_vtable[OF invs_valid_objs])
56+
apply (simp add: get_tcb_def)
57+
apply (fastforce simp: valid_cap_def2 valid_cap_ref_def)
5958
done
6059

6160
lemma ptr_offset_in_ptr_range:

proof/access-control/Access.thy

+2-2
Original file line numberDiff line numberDiff line change
@@ -773,7 +773,7 @@ where
773773
lemma caps_of_state_tcb:
774774
"\<lbrakk> get_tcb p s = Some tcb; option_map fst (tcb_cap_cases idx) = Some getF \<rbrakk> \<Longrightarrow> caps_of_state s (p, idx) = Some (getF tcb)"
775775
apply (drule get_tcb_SomeD)
776-
apply (clarsimp simp: option_map_eq_Some)
776+
apply (clarsimp simp: map_option_eq_Some)
777777
apply (drule (1) cte_wp_at_tcbI [where t = "(p, idx)" and P = "op = (getF tcb)", simplified])
778778
apply simp
779779
apply (clarsimp simp: cte_wp_at_caps_of_state)
@@ -1495,7 +1495,7 @@ next
14951495
apply (intro range_subsetI)
14961496
apply (rule is_aligned_no_wrap' [OF al xsz])
14971497
apply (simp only: add_diff_eq[symmetric])
1498-
apply (subst add.commute add.left_commute, rule word_plus_mono_right)
1498+
apply (subst add.assoc, rule word_plus_mono_right)
14991499
apply (subst iffD1 [OF le_m1_iff_lt])
15001500
apply (simp add: p2_gt_0 word_bits_conv)
15011501
apply (rule is_aligned_add_less_t2n[OF al' _ szv xsz])

proof/access-control/CNode_AC.thy

+2-4
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ lemma decode_cnode_inv_authorised:
198198
apply (rule hoare_pre)
199199
apply (wp hoare_vcg_all_lift hoare_vcg_const_imp_lift_R hoare_vcg_all_lift_R
200200
get_cap_prop_imp[where Q=has_recycle_rights] lsfco_cte_at
201-
| simp only: simp_thms if_simps fst_conv snd_conv Invocations_A.cnode_invocation.cases
201+
| simp only: simp_thms if_simps fst_conv snd_conv Invocations_A.cnode_invocation.simps
202202
| wpc
203203
| wp_once hoare_drop_imps)+
204204
apply clarsimp
@@ -406,9 +406,7 @@ lemma set_irq_state_respects[wp]:
406406
crunch respects[wp]: deleted_irq_handler "integrity aag X st"
407407

408408
lemmas cases_simp_options
409-
= cases_simp_option cases_simp_option[where 'a="'b \<times> 'c", simplified, standard]
410-
411-
409+
= cases_simp_option cases_simp_option[where 'a="'b \<times> 'c", simplified]
412410

413411
lemma empty_slointegrity_spec:
414412
notes split_paired_All[simp del]

proof/access-control/Deterministic_AC.thy

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ lemma empty_slot_list_integrity:
120120
apply (simp add: empty_slot_ext_def split del: split_if)
121121
apply (wp update_cdt_list_wp)
122122
apply (intro impI conjI allI | simp add: list_filter_replace_list list_filter_remove split: option.splits | elim conjE | simp add: list_integ_def)+
123-
apply (drule_tac x=a in spec)
123+
apply (drule_tac x="the slot_p" in spec)
124124
apply (elim disjE)
125125
apply (simp add: all_children_def valid_list_2_def list_filter_replace_list)+
126126
done

proof/access-control/Finalise_AC.thy

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ apply (simp add: tcb_sched_action_def)
2020
apply wp
2121
apply (clarsimp simp: integrity_def integrity_ready_queues_def pas_refined_def tcb_domain_map_wellformed_aux_def etcb_at_def get_etcb_def
2222
split: option.splits)
23-
apply (erule_tac x="(thread, tcb_domain a)" in ballE)
23+
apply (erule_tac x="(thread, tcb_domain (the (ekheap s thread)))" in ballE)
2424
apply (auto intro: domtcbs)
2525
done
2626

@@ -43,7 +43,7 @@ apply (simp add: tcb_sched_action_def)
4343
apply wp
4444
apply (clarsimp simp: integrity_def integrity_ready_queues_def pas_refined_def tcb_domain_map_wellformed_aux_def etcb_at_def get_etcb_def
4545
split: option.splits)
46-
apply (erule_tac x="(thread, tcb_domain a)" in ballE)
46+
apply (erule_tac x="(thread, tcb_domain (the (ekheap s thread)))" in ballE)
4747
apply (auto intro: domtcbs)
4848
done
4949

@@ -437,7 +437,7 @@ proof (induct arbitrary: st rule: rec_del.induct,
437437
apply (rule spec_valid_conj_liftE1, rule valid_validE_R, rule rec_del_valid_list, rule preemption_point_inv')
438438
apply simp
439439
apply simp
440-
apply (rule "1.hyps"[simplified rec_del_call.cases slot_rdcall.simps])
440+
apply (rule "1.hyps"[simplified rec_del_call.simps slot_rdcall.simps])
441441
apply auto
442442
done
443443

@@ -504,7 +504,7 @@ next
504504
by (clarsimp simp: replicate_not_True)
505505
case (3 ptr bits n slot s)
506506
show ?case
507-
apply (simp add: rec_del_call.cases simp_thms spec_validE_def)
507+
apply (simp add: rec_del_call.simps simp_thms spec_validE_def)
508508
apply (rule hoare_pre, wp static_imp_wp)
509509
apply clarsimp
510510
done

proof/access-control/Ipc_AC.thy

+4-6
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ lemma receive_async_ipc_pas_refined:
5959
apply (simp add: receive_async_ipc_def)
6060
apply (cases cap, simp_all)
6161
apply (rule hoare_seq_ext [OF _ get_aep_sp])
62-
apply clarsimp
6362
apply (rule hoare_pre)
6463
apply (wp set_async_ep_pas_refined set_thread_state_pas_refined
6564
| wpc)+
@@ -237,7 +236,6 @@ lemma receive_async_ipc_integrity_autarch:
237236
apply (simp add: receive_async_ipc_def)
238237
apply (cases cap, simp_all)
239238
apply (rule hoare_seq_ext [OF _ get_aep_sp])
240-
apply clarsimp
241239
apply (rule hoare_pre)
242240
apply (wp set_async_ep_respects[where auth=Receive] set_thread_state_integrity_autarch
243241
do_async_transfer_integrity_autarch
@@ -817,12 +815,12 @@ lemma send_ipc_pas_refined:
817815
apply (wp set_thread_state_pas_refined
818816
| wpc
819817
| simp add: hoare_if_r_and)+
820-
apply (rule_tac Q="\<lambda>rv. pas_refined aag and K (can_grant \<longrightarrow> is_subject aag a)" in hoare_strengthen_post[rotated])
818+
apply (rule_tac Q="\<lambda>rv. pas_refined aag and K (can_grant \<longrightarrow> is_subject aag (hd list))" in hoare_strengthen_post[rotated])
821819
apply (clarsimp simp: cli_no_irqs pas_refined_refl aag_cap_auth_def clas_no_asid)
822820
apply (wp set_thread_state_pas_refined do_ipc_transfer_pas_refined static_imp_wp
823821
| wpc
824822
| simp add: hoare_if_r_and)+
825-
apply (rule_tac Q="\<lambda>rv. valid_objs and pas_refined aag and K (can_grant \<longrightarrow> is_subject aag a)" in hoare_strengthen_post[rotated])
823+
apply (rule_tac Q="\<lambda>rv. valid_objs and pas_refined aag and K (can_grant \<longrightarrow> is_subject aag (hd list))" in hoare_strengthen_post[rotated])
826824
apply (clarsimp simp: cli_no_irqs pas_refined_refl aag_cap_auth_def clas_no_asid)
827825
apply (wp set_thread_state_pas_refined do_ipc_transfer_pas_refined static_imp_wp
828826
| wpc
@@ -1700,7 +1698,7 @@ lemma send_ipc_integrity_autarch:
17001698
apply (rule hoare_pre)
17011699
apply (wp setup_caller_cap_integrity_autarch set_thread_state_integrity_autarch thread_get_wp'
17021700
| wpc)+
1703-
apply (rule_tac Q="\<lambda>rv s. integrity aag X st s\<and> (can_grant \<longrightarrow> is_subject aag a)" in hoare_strengthen_post[rotated])
1701+
apply (rule_tac Q="\<lambda>rv s. integrity aag X st s\<and> (can_grant \<longrightarrow> is_subject aag (hd list))" in hoare_strengthen_post[rotated])
17041702
apply simp+
17051703
apply (wp set_thread_state_integrity_autarch thread_get_wp' do_ipc_transfer_integrity_autarch
17061704
hoare_vcg_all_lift hoare_drop_imps set_endpoinintegrity
@@ -1723,7 +1721,7 @@ lemma send_ipc_integrity_autarch:
17231721
apply (wp set_endpoinintegrity set_thread_state_integrity_autarch setup_caller_cap_integrity_autarch
17241722
hoare_vcg_ex_lift sts_typ_ats thread_get_wp'
17251723
| wpc)+
1726-
apply (rule_tac Q="\<lambda>rv sa. integrity aag X s sa \<and> (can_grant \<longrightarrow> is_subject aag a)" in hoare_strengthen_post[rotated])
1724+
apply (rule_tac Q="\<lambda>rv sa. integrity aag X s sa \<and> (can_grant \<longrightarrow> is_subject aag (hd list))" in hoare_strengthen_post[rotated])
17271725
apply simp+
17281726
apply (wp thread_get_inv put_wp get_object_wp get_endpoint_wp thread_get_wp'
17291727
set_thread_state_running_respects_in_ipc[where epptr=epptr]

proof/access-control/Retype_AC.thy

+3-2
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,7 @@ lemma use_retype_region_proofs_ext':
759759
done
760760

761761
lemmas use_retype_region_proofs_ext
762-
= use_retype_region_proofs_ext'[where Q="\<lambda>_. Q" and P=Q for Q, simplified, OF _ _ _ _ TrueI]
762+
= use_retype_region_proofs_ext'[where Q="\<lambda>_. Q" and P=Q, simplified, OF _ _ _ _ TrueI] for Q
763763

764764
lemma (in is_extended) pas_refined_tcb_domain_map_wellformed':
765765
assumes tdmw: "\<lbrace>tcb_domain_map_wellformed aag and P\<rbrace> f \<lbrace>\<lambda>_. tcb_domain_map_wellformed aag\<rbrace>"
@@ -797,6 +797,7 @@ lemma retype_region_pas_refined:
797797
\<lbrace>\<lambda>rv. pas_refined aag\<rbrace>"
798798
apply (rule hoare_gen_asm)
799799
apply (rule hoare_pre)
800+
thm use_retype_region_proofs_ext
800801
apply(rule use_retype_region_proofs_ext)
801802
apply(erule (1) retype_region_proofs'.pas_refined[OF retype_region_proofs'.intro])
802803
apply (wp retype_region_ext_pas_refined)
@@ -893,7 +894,7 @@ lemma freeMemory_vms:
893894
apply (clarsimp simp: valid_machine_state_def
894895
disj_commute[of "in_user_frame p s" for p s])
895896
apply (drule_tac x=p in spec, simp)
896-
apply (drule_tac P="\<lambda>m'. underlying_memory m' p = 0"
897+
apply (drule_tac P4="\<lambda>m'. underlying_memory m' p = 0"
897898
in use_valid[where P=P and Q="\<lambda>_. P" for P], simp_all)
898899
apply (simp add: freeMemory_def machine_op_lift_def
899900
machine_rest_lift_def split_def)

proof/access-control/Syscall_AC.thy

+2-3
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ lemma set_thread_state_authorised[wp]:
219219
hoare_vcg_ex_lift sts_obj_at_impossible
220220
set_thread_state_authorised_untyped_inv_state
221221
| simp)+
222-
apply clarsimp
223222
apply (case_tac tcb_invocation, simp_all)
224223
apply (wp hoare_case_option_wp sts_typ_ats set_thread_state_cte_wp_at
225224
hoare_vcg_conj_lift static_imp_wp
@@ -891,15 +890,15 @@ lemma schedule_integrity:
891890
apply (clarsimp simp: valid_sched_def valid_sched_action_def weak_valid_sched_action_2_def switch_in_cur_domain_2_def in_cur_domain_2_def valid_etcbs_def invs_def valid_etcbs_def etcb_at_def st_tcb_at_def obj_at_def is_etcb_at_def split: option.splits)
892891
apply force
893892
apply (clarsimp simp: pas_refined_def tcb_domain_map_wellformed_aux_def)
894-
apply (drule_tac x="(x, tcb_domain a)" in bspec)
893+
apply (drule_tac x="(x, cur_domain s)" in bspec)
895894
apply (force intro: domtcbs)
896895
apply force
897896
prefer 10
898897
(* direct clag *)
899898
apply (clarsimp simp: valid_sched_def valid_sched_action_def weak_valid_sched_action_2_def switch_in_cur_domain_2_def in_cur_domain_2_def valid_etcbs_def invs_def valid_etcbs_def etcb_at_def st_tcb_at_def obj_at_def is_etcb_at_def split: option.splits)
900899
apply force
901900
apply (clarsimp simp: pas_refined_def tcb_domain_map_wellformed_aux_def)
902-
apply (drule_tac x="(x, tcb_domain a)" in bspec)
901+
apply (drule_tac x="(x, cur_domain s)" in bspec)
903902
apply (force intro: domtcbs)
904903
apply force
905904
apply (auto simp: obj_at_def st_tcb_at_def not_cur_thread_2_def valid_sched_def)

proof/access-control/Tcb_AC.thy

+16-16
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ lemmas itr_wps = restart_integrity_autarch as_user_integrity_autarch thread_set_
7979
option_update_thread_integrity_autarch thread_set_pas_refined_triv
8080
cap_insert_integrity_autarch cap_insert_pas_refined
8181
hoare_vcg_all_liftE hoare_weak_lift_impE hoare_weak_lift_imp hoare_vcg_all_lift
82-
check_cap_inv[where P="valid_cap c", standard]
83-
check_cap_inv[where P="tcb_cap_valid c p", standard]
84-
check_cap_inv[where P="cte_at p0", standard]
85-
check_cap_inv[where P="tcb_at p0", standard]
86-
check_cap_inv[where P="ex_cte_cap_wp_to P p", standard]
87-
check_cap_inv[where P="ex_nonz_cap_to p", standard]
88-
check_cap_inv2[where Q="\<lambda>_. integrity aag X st", standard]
89-
check_cap_inv2[where Q="\<lambda>_. pas_refined aag", standard]
82+
check_cap_inv[where P="valid_cap c" for c]
83+
check_cap_inv[where P="tcb_cap_valid c p" for c p]
84+
check_cap_inv[where P="cte_at p0" for p0]
85+
check_cap_inv[where P="tcb_at p0" for p0]
86+
check_cap_inv[where P="ex_cte_cap_wp_to P p" for P p]
87+
check_cap_inv[where P="ex_nonz_cap_to p" for p]
88+
check_cap_inv2[where Q="\<lambda>_. integrity aag X st" for aag X st]
89+
check_cap_inv2[where Q="\<lambda>_. pas_refined aag" for aag]
9090
checked_insert_no_cap_to cap_insert_ex_cap
9191
cap_delete_valid_cap cap_delete_deletes
9292
hoare_case_option_wp thread_set_valid_cap
@@ -166,7 +166,7 @@ lemma set_priority_pas_refined[wp]:
166166
apply (simp add: tcb_sched_action_def | wp)+
167167
apply (clarsimp simp: etcb_at_def pas_refined_def tcb_domain_map_wellformed_aux_def
168168
split: option.splits)
169-
apply (erule_tac x="(aa, b)" in ballE)
169+
apply (erule_tac x="(a, b)" in ballE)
170170
apply simp
171171
apply (erule domains_of_state_aux.cases)
172172
apply (force intro: domtcbs split: split_if_asm)
@@ -247,13 +247,13 @@ lemma invoke_tcb_tc_respects_aag:
247247
thread_set_tcb_ipc_buffer_cap_cleared_invs
248248
thread_set_invs_trivial[OF ball_tcb_cap_casesI]
249249
hoare_vcg_all_lift thread_set_valid_cap out_emptyable
250-
check_cap_inv [where P="valid_cap c", standard]
251-
check_cap_inv [where P="tcb_cap_valid c p", standard]
252-
check_cap_inv[where P="cte_at p0", standard]
253-
check_cap_inv[where P="tcb_at p0", standard]
254-
check_cap_inv[where P="simple_sched_action", standard]
255-
check_cap_inv[where P="valid_list", standard]
256-
check_cap_inv[where P="valid_sched", standard]
250+
check_cap_inv [where P="valid_cap c" for c]
251+
check_cap_inv [where P="tcb_cap_valid c p" for c p]
252+
check_cap_inv[where P="cte_at p0" for p0]
253+
check_cap_inv[where P="tcb_at p0" for p0]
254+
check_cap_inv[where P="simple_sched_action"]
255+
check_cap_inv[where P="valid_list"]
256+
check_cap_inv[where P="valid_sched"]
257257
thread_set_cte_at
258258
thread_set_cte_wp_at_trivial[where Q="\<lambda>x. x", OF ball_tcb_cap_casesI]
259259
thread_set_no_cap_to_trivial[OF ball_tcb_cap_casesI]

proof/drefine/Arch_DR.thy

+5-8
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ proof -
289289

290290

291291
show ?thesis using pdid vp_aligned
292-
apply clarsimp
292+
apply hypsubst_thin
293293
proof (induct pgsz)
294294
case ARMSmallPage
295295
show ?case using ARMSmallPage.prems
@@ -445,7 +445,7 @@ proof -
445445
apply (cut_tac less_kernel_base_mapping_slots[OF kb pd_aligned])
446446
apply (drule_tac x="ucast (lookup_pd_slot pd_ptr vptr && mask pd_bits >> 2)" in bspec)
447447
apply simp
448-
apply (drule sym, simp)
448+
apply (drule_tac t="pda ?v" in sym, simp)
449449
apply (clarsimp simp: obj_at_def a_type_def del: disjCI)
450450
apply (clarsimp split: Structures_A.kernel_object.split_asm split_if_asm
451451
arch_kernel_obj.split_asm del: disjCI)
@@ -487,7 +487,7 @@ proof -
487487
apply (cut_tac less_kernel_base_mapping_slots[OF kb pd_aligned])
488488
apply (drule_tac x="ucast (lookup_pd_slot pd_ptr vptr && mask pd_bits >> 2)" in bspec)
489489
apply simp
490-
apply (drule sym, simp)
490+
apply (drule_tac t="pda ?v" in sym, simp)
491491
apply (clarsimp simp: obj_at_def a_type_def del: disjCI)
492492
apply (clarsimp split: Structures_A.kernel_object.split_asm split_if_asm
493493
arch_kernel_obj.split_asm del: disjCI)
@@ -764,7 +764,7 @@ next
764764
apply (clarsimp simp: neq_Nil_conv valid_cap_simps obj_at_def
765765
opt_object_page_directory invs_valid_idle label_to_flush_type_def InvocationLabels_H.isPageFlush_def
766766
dest!: a_type_pdD)+
767-
apply (rule_tac r'=dc and P'="?I" and Q'="\<lambda>rv. ?I and (\<exists>\<rhd> (lookup_pd_slot rv a && ~~ mask pd_bits))"
767+
apply (rule_tac r'=dc and P'="?I" and Q'="\<lambda>rv. ?I and (\<exists>\<rhd> (lookup_pd_slot rv x21 && ~~ mask pd_bits))"
768768
in corres_alternative_throw_splitE[OF _ _ returnOk_wp[where x="()"], simplified])
769769
apply (rule corres_from_rdonly, simp_all)[1]
770770
apply (wp | simp)+
@@ -849,7 +849,6 @@ next
849849
translate_arch_invocation_def transform_page_inv_def)
850850
apply (clarsimp)
851851
apply (rule corres_from_rdonly)
852-
apply (clarsimp)
853852
apply (wp, clarsimp)
854853
apply ( simp only: Let_unfold, wp, clarsimp, rule valid_validE, wp whenE_inv, clarsimp, wp)
855854
apply (assumption)
@@ -861,7 +860,6 @@ next
861860
apply blast
862861
apply (metis flush.exhaust)
863862
apply (rule corres_from_rdonly)
864-
apply (clarsimp)
865863
apply (wp, clarsimp)
866864
apply ( simp only: Let_unfold, wp, clarsimp, rule valid_validE, wp whenE_inv, clarsimp, wp)
867865
apply (assumption)
@@ -873,7 +871,6 @@ next
873871
apply blast
874872
apply (metis flush.exhaust)
875873
apply (rule corres_from_rdonly)
876-
apply (clarsimp)
877874
apply (wp, clarsimp)
878875
apply ( simp only: Let_unfold, wp, clarsimp, rule valid_validE, wp whenE_inv, clarsimp, wp)
879876
apply (assumption)
@@ -885,7 +882,6 @@ next
885882
apply blast
886883
apply (metis flush.exhaust)
887884
apply (rule corres_from_rdonly)
888-
apply (clarsimp)
889885
apply (wp, clarsimp)
890886
apply ( simp only: Let_unfold, wp, clarsimp, rule valid_validE, wp whenE_inv, clarsimp, wp)
891887
apply (assumption)
@@ -1888,6 +1884,7 @@ proof -
18881884
apply (clarsimp simp:perform_asid_control_invocation_def)
18891885
apply (simp add:arch_invocation_relation_def translate_arch_invocation_def)
18901886
apply (cases asid_inv, clarsimp)
1887+
apply hypsubst_thin
18911888
apply (drule sym)
18921889
apply (drule sym)
18931890
apply (drule sym)

0 commit comments

Comments
 (0)