Skip to content

Commit

Permalink
validForDeref_ptrval w/o provenance
Browse files Browse the repository at this point in the history
  • Loading branch information
vzaliva committed Jul 20, 2023
1 parent 64bcb78 commit 8be9579
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions coq/CheriMemory/CheriMemory.v
Original file line number Diff line number Diff line change
Expand Up @@ -2814,13 +2814,12 @@ Module CheriMemory
match ptrval with
| PV _ (PVfunction _) => ret false
| (PV Prov_device (PVconcrete c_value)) as ptrval =>
if cap_is_null c_value then
ret false
else
isWellAligned_ptrval ref_ty ptrval
if cap_is_null c_value
then ret false
else isWellAligned_ptrval ref_ty ptrval
| PV (Prov_symbolic iota) (PVconcrete c_value) =>
if cap_is_null c_value then
ret false
if cap_is_null c_value
then ret false
else
lookup_iota iota >>=
(fun x =>
Expand All @@ -2837,7 +2836,18 @@ Module CheriMemory
if cap_is_null c_value
then ret false
else do_test alloc_id
| PV Prov_none _ => ret false
| PV Prov_none (PVconcrete c_value) =>
if CoqSwitches.is_PNVI (SW.get_switches tt)
then ret false
else if cap_is_null c_value
then ret false
else
find_overlaping (cap_to_Z c_value) >>= fun x =>
match x with
| NoAlloc => fail Loc_unknown (MerrAccess LoadAccess OutOfBoundPtr)
| DoubleAlloc _ _ => fail Loc_unknown (MerrInternal "DoubleAlloc without PNVI")
| SingleAlloc alloc_id => isWellAligned_ptrval ref_ty ptrval
end
end.

Definition add_iota
Expand Down

0 comments on commit 8be9579

Please sign in to comment.