bounds6.c
up: index
prev: bounds5.c
next: bounds7.c
#include <cheriintrin.h>
#include <stdio.h>
#include "capprint.h"
int main()
{
char buf[1024];
char *x = buf;
char *y = cheri_bounds_set(x, 10);
fprintf(stderr,"Original: %" PTR_FMT "\n", sptr((void*)x));
fprintf(stderr,"Modified: %" PTR_FMT "\n", sptr((void*)y));
*(x+100) = 10; // OK
if(x==y)
{
fprintf(stderr,"x==y\n");
*(y+100) = 10; // Not allowed
}
fprintf(stderr,"passed\n");
}
Experimental data (what does this mean?)
cerberus-cheri-no-pnvi
cerberus-cheri-revocation-no-pnvi
cerberus-cheri-cornucopia-no-pnvi Original: (@disabled, 0xffffe304 [rwRW,0xffffe304-0xffffe704])
Modified: (@disabled, 0xffffe304 [rwRW,0xffffe304-0xffffe30e])
x==y
passed
cerberus-cheri
cerberus-cheri-revocation
cerberus-cheri-cornucopia Original: (@83, 0xffffe304 [rwRW,0xffffe304-0xffffe704])
Modified: (@83, 0xffffe304 [rwRW,0xffffe304-0xffffe30e])
x==y
passed
clang-riscv-O0-bounds-subobject-safe
clang-riscv-O0-bounds-aggressive
clang-riscv-O0-bounds-very-aggressive
clang-riscv-O0-bounds-everywhere-unsafe exit codes: compile 0 / execute 1
Program received signal SIGPROT, CHERI protection violation.
Capability bounds fault caused by register ca1.
0x00000000001020d2 in main () at tests/cheri/bounds6.c:17
17 *(y+100) = 10; // Not allowed
#0 0x00000000001020d2 in main () at tests/cheri/bounds6.c:17
buf = '\000' <repeats 36 times>, "hE\020@\000\000\000\000\001\202\207\001\000\000\177\321\n", '\000' <repeats 15 times>, "\060E\020@\000\000\000\000\001\202\207\001\000\000\177\321XG\020@\000\000\000\000\001\202\207\001\000\000\177\321\n", '\000' <repeats 15 times>, "\304G\020@\000\000\000\000\001\202\207\001\000\000\177\321\033\000\000\000\000\000\000\000\006\000\000\000\001\000\000\000\a\000\000\000\032\000\000\000\033\000\000\000\000\000\000\000\220F\020@\000\000\000\000\001\202\207\001\000\000\177\321\320F\020@\000\000\000\000\001\202\207\001\000\000\177\321\344F\020@"...
x = 0x3fffdffb5c [rwRW,0x3fffdffb5c-0x3fffdfff5c] ""
y = 0x3fffdffb5c [rwRW,0x3fffdffb5c-0x3fffdffb66] ""
Original: 0x3fffdffb5c [rwRW,0x3fffdffb5c-0x3fffdfff5c]
Modified: 0x3fffdffb5c [rwRW,0x3fffdffb5c-0x3fffdffb66]
x==y
clang-riscv-O3-bounds-conservative
clang-riscv-O3-bounds-subobject-safe Original: 0x3fffdffb20 [rwRW,0x3fffdffb20-0x3fffdfff20]
Modified: 0x3fffdffb20 [rwRW,0x3fffdffb20-0x3fffdffb2a]
x==y
passed
clang-riscv-O0-bounds-conservative
clang-riscv-O0-bounds-references-only exit codes: compile 0 / execute 1
Program received signal SIGPROT, CHERI protection violation.
Capability bounds fault caused by register ca1.
0x0000000000102092 in main () at tests/cheri/bounds6.c:17
17 *(y+100) = 10; // Not allowed
#0 0x0000000000102092 in main () at tests/cheri/bounds6.c:17
buf = '\000' <repeats 36 times>, "hE\020@\000\000\000\000\001\202\207\001\000\000\177\321\n", '\000' <repeats 15 times>, "\060E\020@\000\000\000\000\001\202\207\001\000\000\177\321XG\020@\000\000\000\000\001\202\207\001\000\000\177\321\n", '\000' <repeats 15 times>, "\304G\020@\000\000\000\000\001\202\207\001\000\000\177\321\033\000\000\000\000\000\000\000\006\000\000\000\001\000\000\000\a\000\000\000\032\000\000\000\033\000\000\000\000\000\000\000\220F\020@\000\000\000\000\001\202\207\001\000\000\177\321\320F\020@\000\000\000\000\001\202\207\001\000\000\177\321\344F\020@"...
x = 0x3fffdffb5c [rwRW,0x3fffdffb5c-0x3fffdfff5c] ""
y = 0x3fffdffb5c [rwRW,0x3fffdffb5c-0x3fffdffb66] ""
Original: 0x3fffdffb5c [rwRW,0x3fffdffb5c-0x3fffdfff5c]
Modified: 0x3fffdffb5c [rwRW,0x3fffdffb5c-0x3fffdffb66]
x==y
clang-morello-O3-bounds-subobject-safe Original: 0xfffffff7fae0 [rwRW,0xfffffff7fae0-0xfffffff7fee0]
Modified: 0xfffffff7fae0 [rwRW,0xfffffff7fae0-0xfffffff7faea]
x==y
passed
clang-morello-O0-bounds-subobject-safe
clang-morello-O0-bounds-aggressive
clang-morello-O0-bounds-very-aggressive
clang-morello-O0-bounds-everywhere-unsafe exit codes: compile 0 / execute 1
Program received signal SIGPROT, CHERI protection violation.
Capability bounds fault.
0x0000000000110f48 in main () at tests/cheri/bounds6.c:17
17 *(y+100) = 10; // Not allowed
#0 0x0000000000110f48 in main () at tests/cheri/bounds6.c:17
buf = "\000\300]\260\220\375\367\377\377\377\000\000\377\277\375?\000@]\334\351\326\024@\000\000\000\000\003\061O\205\000\300]\260\001", '\000' <repeats 16 times>, "\367\177}\203%]\373\000\000\000\000\000\000\000\000p\373\367\377\377\377\000\000\377\277\375?\000@]\334p\373\367\377\377\377\000\000p\373\200}\000@]\334\n\220\030@\000\000\000\000@\220PU\000@]\334H", '\000' <repeats 15 times>, "p\373\367\377\377\377\000\000p\373\200}\000@]\334p@\030@\000\000\000\000p@\200@\000\300]\334", '\000' <repeats 80 times>...
x = 0xfffffff7fb4c [rwRW,0xfffffff7fb4c-0xfffffff7ff4c] ""
y = 0xfffffff7fb4c [rwRW,0xfffffff7fb4c-0xfffffff7fb56] ""
Original: 0xfffffff7fb4c [rwRW,0xfffffff7fb4c-0xfffffff7ff4c]
Modified: 0xfffffff7fb4c [rwRW,0xfffffff7fb4c-0xfffffff7fb56]
x==y
clang-morello-O3-bounds-conservative Original: 0xfffffff7fb00 [rwRW,0xfffffff7fb00-0xfffffff7ff00]
Modified: 0xfffffff7fb00 [rwRW,0xfffffff7fb00-0xfffffff7fb0a]
x==y
passed
clang-morello-O0-bounds-conservative
clang-morello-O0-bounds-references-only exit codes: compile 0 / execute 1
Program received signal SIGPROT, CHERI protection violation.
Capability bounds fault.
0x0000000000110f08 in main () at tests/cheri/bounds6.c:17
17 *(y+100) = 10; // Not allowed
#0 0x0000000000110f08 in main () at tests/cheri/bounds6.c:17
buf = "\000\300]\260\220\375\367\377\377\377\000\000\377\277\375?\000@]\334\351\326\024@\000\000\000\000\003\061O\205\000\300]\260\001", '\000' <repeats 16 times>, "\367\177}\203%]\373\000\000\000\000\000\000\000\000p\373\367\377\377\377\000\000\377\277\375?\000@]\334p\373\367\377\377\377\000\000p\373\200}\000@]\334\n\220\030@\000\000\000\000@\220PU\000@]\334H", '\000' <repeats 15 times>, "p\373\367\377\377\377\000\000p\373\200}\000@]\334p@\030@\000\000\000\000p@\200@\000\300]\334", '\000' <repeats 80 times>...
x = 0xfffffff7fb4c [rwRW,0xfffffff7fb4c-0xfffffff7ff4c] ""
y = 0xfffffff7fb4c [rwRW,0xfffffff7fb4c-0xfffffff7fb56] ""
Original: 0xfffffff7fb4c [rwRW,0xfffffff7fb4c-0xfffffff7ff4c]
Modified: 0xfffffff7fb4c [rwRW,0xfffffff7fb4c-0xfffffff7fb56]
x==y
gcc-morello-O3 exit codes: compile 0 / execute 137
Original: 0x7ffffbe0 [rwRW,0x7ffffbe0-0x7fffffe0]
Modified: 0x7ffffbe0 [rwRW,0x7ffffbe0-0x7ffffbea]
x==y
gcc-morello-O0 exit codes: compile 0 / execute 137
Original: 0x7ffffbc0 [rwRW,0x7ffffbc0-0x7fffffc0]
Modified: 0x7ffffbc0 [rwRW,0x7ffffbc0-0x7ffffbca]
x==y