You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Requested feature: API to generate pointers non-deterministically
Use case: Currently, to generate arbitrary pointers we are either using the PointerGenerator API or generating a non-deterministic variable and getting a reference to that. For example we are doing one of the following:
let val:u32 = kani::any();let ptr:*constu32 = &val;
But both of these do not cover the entire address space that a pointer can take. This is important for functions concerned with pointer arithmetic as they do not care about the values within. So, we can have something like:
let ptr:*constu32 = kani::any_alloc_status()
Right now, one way I can think of generating an allocated ptr that can cover the entire address space in the harness is by doing the following:
let val: $type = kani::any::<$type>();// pointer can be of any addresslet ptr1 = kani::any::<usize>()as*mut $type;// write_unaligned requires non-overlapping src and dest// val's address should not overlap with the object ptr1 is pointing to
kani::assume((ptr1 asusize) > (&val as*const $type asusize));
kani::assume((ptr1 asusize).checked_add(size_of::<$type>()).is_some());
kani::assume((ptr1 asusize + size_of::<$type>()) < (&val as*const $type asusize));unsafe{ ptr1.write_unaligned(val)}
Requested feature: API to generate pointers non-deterministically
Use case: Currently, to generate arbitrary pointers we are either using the PointerGenerator API or generating a non-deterministic variable and getting a reference to that. For example we are doing one of the following:
OR
But both of these do not cover the entire address space that a pointer can take. This is important for functions concerned with pointer arithmetic as they do not care about the values within. So, we can have something like:
Right now, one way I can think of generating an allocated ptr that can cover the entire address space in the harness is by doing the following:
@feliperodri
The text was updated successfully, but these errors were encountered: