bounds8.c
up: index
prev: bounds7.c
next: perms1.c
#include <cheriintrin.h>
#include <stdio.h>
#include "capprint.h"
int main()
{
char buf[1024];
char *x = buf;
char *y = cheri_tag_clear(x);
char *z = cheri_bounds_set(y, 10);
fprintf(stderr,"Original: %" PTR_FMT "\n", sptr((void*)x));
fprintf(stderr,"Modified: %" PTR_FMT "\n", sptr((void*)z));
}
Experimental data (what does this mean?)
cerberus-cheri-no-pnvi
cerberus-cheri-revocation-no-pnvi
cerberus-cheri-cornucopia-no-pnvi Original: (@disabled, 0xffffe314 [rwRW,0xffffe314-0xffffe714])
Modified: (@disabled, 0xffffe314 [rwRW,0xffffe314-0xffffe31e] (invalid))
cerberus-cheri
cerberus-cheri-revocation
cerberus-cheri-cornucopia Original: (@81, 0xffffe314 [rwRW,0xffffe314-0xffffe714])
Modified: (@81, 0xffffe314 [rwRW,0xffffe314-0xffffe31e] (invalid))
clang-riscv-O3-bounds-subobject-safe exit codes: compile 0 / execute 1
Program received signal SIGPROT, CHERI protection violation.
Capability tag fault caused by register ca1.
0x0000000000102036 in main () at tests/cheri/capprint.h:83
#0 0x0000000000102036 in main () at tests/cheri/capprint.h:83
buf = "\345\001", '\000' <repeats 14 times>, "\240\204\020@\000\000\000\000\001\202\207\001\000\000\177\321\250a", '\000' <repeats 46 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\033", '\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"...
z = <optimized out>
y = 0x3fffdffb30 [rwRW,0x3fffdffb30-0x3fffdfff30] (invalid) "\345\001"
x = <optimized out>
Original: 0x3fffdffb30 [rwRW,0x3fffdffb30-0x3fffdfff30]
83 tests/cheri/capprint.h: No such file or directory.
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 tag fault caused by register ca1.
0x0000000000101fa6 in main () at tests/cheri/bounds8.c:10
10 char *z = cheri_bounds_set(y, 10);
#0 0x0000000000101fa6 in main () at tests/cheri/bounds8.c:10
buf = '\000' <repeats 32 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\033", '\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@\000\000\000\000"...
x = 0x3fffdffb60 [rwRW,0x3fffdffb60-0x3fffdfff60] ""
y = 0x3fffdffb60 [rwRW,0x3fffdffb60-0x3fffdfff60] (invalid) ""
z = 0x1e5 <error: Cannot access memory at address 0x1e5>
clang-riscv-O3-bounds-conservative exit codes: compile 0 / execute 1
Program received signal SIGPROT, CHERI protection violation.
Capability tag fault caused by register ca0.
0x000000000010203c in main () at tests/cheri/capprint.h:79
#0 0x000000000010203c in main () at tests/cheri/capprint.h:79
buf = "\345\001", '\000' <repeats 14 times>, "\240\204\020@\000\000\000\000\001\202\207\001\000\000\177\321\250a", '\000' <repeats 46 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\033", '\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"...
z = <optimized out>
y = 0x3fffdffb30 [rwRW,0x3fffdffb30-0x3fffdfff30] (invalid) "\345\001"
x = 0x3fffdffb30 [rwRW,0x3fffdffb30-0x3fffdfff30] "\345\001"
Original: 0x3fffdffb30 [rwRW,0x3fffdffb30-0x3fffdfff30]
79 tests/cheri/capprint.h: No such file or directory.
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 tag fault caused by register ca1.
0x0000000000101f82 in main () at tests/cheri/bounds8.c:10
10 char *z = cheri_bounds_set(y, 10);
#0 0x0000000000101f82 in main () at tests/cheri/bounds8.c:10
buf = '\000' <repeats 32 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\033", '\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@\000\000\000\000"...
x = 0x3fffdffb60 [rwRW,0x3fffdffb60-0x3fffdfff60] ""
y = 0x3fffdffb60 [rwRW,0x3fffdffb60-0x3fffdfff60] (invalid) ""
z = 0x1e5 <error: Cannot access memory at address 0x1e5>
clang-morello-O3-bounds-subobject-safe Original: 0xfffffff7faf0 [rwRW,0xfffffff7faf0-0xfffffff7fef0]
Modified: 0xfffffff7faf0 [rwRW,0xfffffff7faf0-0xfffffff7fafa] (invalid)
clang-morello-O3-bounds-conservative Original: 0xfffffff7fb10 [rwRW,0xfffffff7fb10-0xfffffff7ff10]
Modified: 0xfffffff7fb10 [rwRW,0xfffffff7fb10-0xfffffff7fb1a] (invalid)
clang-morello-O0-bounds-conservative
clang-morello-O0-bounds-references-only
clang-morello-O0-bounds-subobject-safe
clang-morello-O0-bounds-aggressive
clang-morello-O0-bounds-very-aggressive
clang-morello-O0-bounds-everywhere-unsafe Original: 0xfffffff7fb50 [rwRW,0xfffffff7fb50-0xfffffff7ff50]
Modified: 0xfffffff7fb50 [rwRW,0xfffffff7fb50-0xfffffff7fb5a] (invalid)
gcc-morello-O3 Original: 0x7ffffbe0 [rwRW,0x7ffffbe0-0x7fffffe0]
Modified: 0x7ffffbe0 [rwRW,0x7ffffbe0-0x7ffffbea] (invalid)
gcc-morello-O0 Original: 0x7ffffbb0 [rwRW,0x7ffffbb0-0x7fffffb0]
Modified: 0x7ffffbb0 [rwRW,0x7ffffbb0-0x7ffffbba] (invalid)