Skip to content

Commit

Permalink
CN VIP: Clarify tests
Browse files Browse the repository at this point in the history
Some of the tests rely on ignoring the (demonic) address allocation
non-determinism which means that technically that have UB but in
practice they are there to exercise particular bits of the memory
object model.
  • Loading branch information
dc-mak committed Dec 9, 2024
1 parent fe99f7d commit 3a7897a
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 2 deletions.
7 changes: 6 additions & 1 deletion tests/cn_vip_testsuite/pointer_from_integer_1i.annot.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "cn_lemmas.h"
void f(uintptr_t i) {
int j=5;
/*@ apply assert_equal(i, (u64)&j); @*/
/*CN_VIP*//*@ apply assert_equal(i, (u64)&j); @*/
#if defined(ANNOT)
int *p = copy_alloc_id(i, &j);
#else
Expand All @@ -20,3 +20,8 @@ int main() {
uintptr_t j = ADDRESS_PFI_1I;
f(j);
}

// The evaluation table in the appendix of the VIP paper is misleading.
// This file has UB under PNVI-ae-udi without annotations because
// of allocation address non-determinism (demonic).
// I emulate the same behaviour by asserting the addresses are equal.
7 changes: 6 additions & 1 deletion tests/cn_vip_testsuite/pointer_from_integer_1ie.annot.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
void f(uintptr_t i) {
int j=5;
uintptr_t k = (uintptr_t)&j;
/*@ apply assert_equal(i, k); @*/
/*CN_VIP*//*@ apply assert_equal(i, k); @*/
#if defined(ANNOT)
int *p = copy_alloc_id(i, &j);
#else
Expand All @@ -21,3 +21,8 @@ int main() {
uintptr_t j = ADDRESS_PFI_1I;
f(j);
}

// The evaluation table in the appendix of the VIP paper is misleading.
// This file has UB under PNVI-ae-udi without annotations because
// of allocation address non-determinism (demonic)
// The desired behaviour can be obtained by asserting the addresses are equal.
5 changes: 5 additions & 0 deletions tests/cn_vip_testsuite/pointer_from_integer_1ig.annot.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ int main() {
uintptr_t j = ADDRESS_PFI_1IG;
f(j);
}

// The evaluation table in the appendix of the VIP paper is misleading.
// This file has UB under PNVI-ae-udi without annotations because
// of allocation address non-determinism (demonic)
// The desired behaviour can be obtained by asserting the addresses are equal.
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,8 @@ int main() {
/*CN_VIP*//*@ assert(x == 1i32 && y == 11i32 && *p == 11i32 && *q == 11i32); @*/
}
}

// The evaluation table in the appendix of the VIP paper is misleading.
// This file has UB under PNVI-ae-udi without annotations because
// of allocation address non-determinism (demonic)
// The desired behaviour can be obtained by asserting the addresses are adjacent.
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,8 @@ int main()
/*CN_VIP*//*@ assert(x == 1i32 && y == 11i32 && *p == 11i32 && *q == 11i32); @*/
}
}

// The evaluation table in the appendix of the VIP paper is misleading.
// This file has UB under PNVI-ae-udi without annotations because
// of allocation address non-determinism (demonic)
// The desired behaviour can be obtained by asserting the addresses are adjacent.
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ int main() {
/*CN_VIP*//*@ assert (b == 1u8); @*/
return 0;
}

// The evaluation table in the appendix of the VIP paper is misleading.
// This file has UB under PNVI-ae-udi without annotations because
// of allocation address non-determinism (demonic)
// The desired behaviour can be obtained by asserting the addresses are adjacent.
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@ int main() {
/*CN_VIP*//*@ assert (b == 1u8); @*/
return 0;
}

// The evaluation table in the appendix of the VIP paper is misleading.
// This file has UB under PNVI-ae-udi without annotations because
// of allocation address non-determinism (demonic)
// The desired behaviour can be obtained by asserting the addresses are adjacent.
5 changes: 5 additions & 0 deletions tests/cn_vip_testsuite/provenance_lost_escape_1.annot.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,8 @@ int main()
/*CN_VIP*//*@ assert(x == 11i32 && *p == 11i32 && *q == 11i32); @*/
}
}

// The evaluation table in the appendix of the VIP paper is misleading.
// This file has UB under PNVI-ae-udi without annotations because
// of allocation address non-determinism (demonic)
// The desired behaviour can be obtained by asserting the addresses are equal.

0 comments on commit 3a7897a

Please sign in to comment.