Skip to content

Commit 3a7897a

Browse files
committed
CN VIP: Clarify tests
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.
1 parent fe99f7d commit 3a7897a

8 files changed

+42
-2
lines changed

tests/cn_vip_testsuite/pointer_from_integer_1i.annot.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "cn_lemmas.h"
77
void f(uintptr_t i) {
88
int j=5;
9-
/*@ apply assert_equal(i, (u64)&j); @*/
9+
/*CN_VIP*//*@ apply assert_equal(i, (u64)&j); @*/
1010
#if defined(ANNOT)
1111
int *p = copy_alloc_id(i, &j);
1212
#else
@@ -20,3 +20,8 @@ int main() {
2020
uintptr_t j = ADDRESS_PFI_1I;
2121
f(j);
2222
}
23+
24+
// The evaluation table in the appendix of the VIP paper is misleading.
25+
// This file has UB under PNVI-ae-udi without annotations because
26+
// of allocation address non-determinism (demonic).
27+
// I emulate the same behaviour by asserting the addresses are equal.

tests/cn_vip_testsuite/pointer_from_integer_1ie.annot.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
void f(uintptr_t i) {
88
int j=5;
99
uintptr_t k = (uintptr_t)&j;
10-
/*@ apply assert_equal(i, k); @*/
10+
/*CN_VIP*//*@ apply assert_equal(i, k); @*/
1111
#if defined(ANNOT)
1212
int *p = copy_alloc_id(i, &j);
1313
#else
@@ -21,3 +21,8 @@ int main() {
2121
uintptr_t j = ADDRESS_PFI_1I;
2222
f(j);
2323
}
24+
25+
// The evaluation table in the appendix of the VIP paper is misleading.
26+
// This file has UB under PNVI-ae-udi without annotations because
27+
// of allocation address non-determinism (demonic)
28+
// The desired behaviour can be obtained by asserting the addresses are equal.

tests/cn_vip_testsuite/pointer_from_integer_1ig.annot.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ int main() {
2222
uintptr_t j = ADDRESS_PFI_1IG;
2323
f(j);
2424
}
25+
26+
// The evaluation table in the appendix of the VIP paper is misleading.
27+
// This file has UB under PNVI-ae-udi without annotations because
28+
// of allocation address non-determinism (demonic)
29+
// The desired behaviour can be obtained by asserting the addresses are equal.

tests/cn_vip_testsuite/provenance_basic_using_uintptr_t_auto_yx.annot.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,8 @@ int main() {
3939
/*CN_VIP*//*@ assert(x == 1i32 && y == 11i32 && *p == 11i32 && *q == 11i32); @*/
4040
}
4141
}
42+
43+
// The evaluation table in the appendix of the VIP paper is misleading.
44+
// This file has UB under PNVI-ae-udi without annotations because
45+
// of allocation address non-determinism (demonic)
46+
// The desired behaviour can be obtained by asserting the addresses are adjacent.

tests/cn_vip_testsuite/provenance_basic_using_uintptr_t_global_yx.annot.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,8 @@ int main()
3939
/*CN_VIP*//*@ assert(x == 1i32 && y == 11i32 && *p == 11i32 && *q == 11i32); @*/
4040
}
4141
}
42+
43+
// The evaluation table in the appendix of the VIP paper is misleading.
44+
// This file has UB under PNVI-ae-udi without annotations because
45+
// of allocation address non-determinism (demonic)
46+
// The desired behaviour can be obtained by asserting the addresses are adjacent.

tests/cn_vip_testsuite/provenance_equality_uintptr_t_auto_yx.pass.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@ int main() {
1313
/*CN_VIP*//*@ assert (b == 1u8); @*/
1414
return 0;
1515
}
16+
17+
// The evaluation table in the appendix of the VIP paper is misleading.
18+
// This file has UB under PNVI-ae-udi without annotations because
19+
// of allocation address non-determinism (demonic)
20+
// The desired behaviour can be obtained by asserting the addresses are adjacent.

tests/cn_vip_testsuite/provenance_equality_uintptr_t_global_yx.pass.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@ int main() {
1313
/*CN_VIP*//*@ assert (b == 1u8); @*/
1414
return 0;
1515
}
16+
17+
// The evaluation table in the appendix of the VIP paper is misleading.
18+
// This file has UB under PNVI-ae-udi without annotations because
19+
// of allocation address non-determinism (demonic)
20+
// The desired behaviour can be obtained by asserting the addresses are adjacent.

tests/cn_vip_testsuite/provenance_lost_escape_1.annot.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,8 @@ int main()
3232
/*CN_VIP*//*@ assert(x == 11i32 && *p == 11i32 && *q == 11i32); @*/
3333
}
3434
}
35+
36+
// The evaluation table in the appendix of the VIP paper is misleading.
37+
// This file has UB under PNVI-ae-udi without annotations because
38+
// of allocation address non-determinism (demonic)
39+
// The desired behaviour can be obtained by asserting the addresses are equal.

0 commit comments

Comments
 (0)