unrep2.c
up: index
prev: unrep1a.c
next: exponent1.c
#include <stdint.h>
#include <stdio.h>
#include "capprint.h"
int main()
{
int x=42;
intptr_t ip = (intptr_t)&x;
fprintf(stderr,"ip=%" PTR_FMT "\n", sptr((void*)ip));
intptr_t ip1 = ~ip; //may be non-representable
fprintf(stderr,"~ip=%" PTR_FMT "\n", sptr((void*)ip1));
intptr_t ip2 = ~ip1;
fprintf(stderr,"~~ip=%" PTR_FMT "\n", sptr((void*)ip2));
return *((int*)ip2);
}
Experimental data (what does this mean?)
cerberus-cheri-no-pnvi
cerberus-cheri-revocation-no-pnvi
cerberus-cheri-cornucopia-no-pnvi exit codes: compile 0 / execute 1
Undefined {ub: "UB_CHERI_UndefinedTag", loc: "<14:12--14:24>"}
ip=(@disabled, 0xffffe710 [rwRW,0xffffe710-0xffffe714])
~ip=(@disabled, 0xffffffff000018ef [?-?] (notag))
~~ip=(@disabled, 0xffffe710 [?-?] (notag))
cerberus-cheri
cerberus-cheri-revocation
cerberus-cheri-cornucopia exit codes: compile 0 / execute 1
Undefined {ub: "UB_CHERI_UndefinedTag", loc: "<14:12--14:24>"}
ip=(@82, 0xffffe710 [rwRW,0xffffe710-0xffffe714])
~ip=(@empty, 0xffffffff000018ef [?-?] (notag))
~~ip=(@82, 0xffffe710 [?-?] (notag))
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 cfp.
main () at tests/cheri/unrep2.c:14
14 return *((int*)ip2);
#0 main () at tests/cheri/unrep2.c:14
x = <optimized out>
ip = <optimized out>
ip1 = <optimized out>
ip2 = <optimized out>
ip=0x3fffdfff1c [rwRW,0x3fffdfff1c-0x3fffdfff20]
~ip=0xffffffc0002000e3 [rwRW,0xffffffc0001fff1c-0xffffffc0001fff20] (invalid)
~~ip=0x3fffdfff1c [rwRW,0x3fffdfff1c-0x3fffdfff20] (invalid)
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 ca0.
0x00000000001020c6 in main () at tests/cheri/unrep2.c:14
14 return *((int*)ip2);
#0 0x00000000001020c6 in main () at tests/cheri/unrep2.c:14
x = 42
ip = -61824678692143347711240626813121069208
ip1 = -61824678692143347692793883289163136873
ip2 = -61824678692143347711240626813121069208
ip=0x3fffdfff68 [rwRW,0x3fffdfff68-0x3fffdfff6c]
~ip=0xffffffc000200097 [rwRW,0xffffffc0001fff68-0xffffffc0001fff6c] (invalid)
~~ip=0x3fffdfff68 [rwRW,0x3fffdfff68-0x3fffdfff6c] (invalid)
clang-riscv-O3-bounds-conservative exit codes: compile 0 / execute 1
Program received signal SIGPROT, CHERI protection violation.
Capability tag fault caused by register cfp.
main () at tests/cheri/unrep2.c:14
14 return *((int*)ip2);
#0 main () at tests/cheri/unrep2.c:14
x = <optimized out>
ip1 = <optimized out>
ip2 = <optimized out>
ip = <optimized out>
ip=0x3fffdfff1c [rwRW,0x3fffdfff1c-0x3fffdfff20]
~ip=0xffffffc0002000e3 [rwRW,0xffffffc0001fff1c-0xffffffc0001fff20] (invalid)
~~ip=0x3fffdfff1c [rwRW,0x3fffdfff1c-0x3fffdfff20] (invalid)
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 ca0.
0x000000000010207e in main () at tests/cheri/unrep2.c:14
14 return *((int*)ip2);
#0 0x000000000010207e in main () at tests/cheri/unrep2.c:14
x = 42
ip = -61824678692143347711240626813121069208
ip1 = -61824678692143347692793883289163136873
ip2 = -61824678692143347711240626813121069208
ip=0x3fffdfff68 [rwRW,0x3fffdfff68-0x3fffdfff6c]
~ip=0xffffffc000200097 [rwRW,0xffffffc0001fff68-0xffffffc0001fff6c] (invalid)
~~ip=0x3fffdfff68 [rwRW,0x3fffdfff68-0x3fffdfff6c] (invalid)
clang-morello-O3-bounds-subobject-safe exit codes: compile 0 / execute 1
Program received signal SIGPROT, CHERI protection violation.
Capability tag fault.
main () at tests/cheri/unrep2.c:14
14 return *((int*)ip2);
#0 main () at tests/cheri/unrep2.c:14
x = 42
ip = 0xfffffff7feec [rwRW,0xfffffff7feec-0xfffffff7fef0]
ip1 = 0xffff000000080113 [rwRW,0xffff00000007feec-0xffff00000007fef0] (invalid)
ip2 = 0xfffffff7feec [rwRW,0xfffffff7feec-0xfffffff7fef0] (invalid)
ip=0xfffffff7feec [rwRW,0xfffffff7feec-0xfffffff7fef0]
~ip=0xffff000000080113 [rwRW,0xffff00000007feec-0xffff00000007fef0] (invalid)
~~ip=0xfffffff7feec [rwRW,0xfffffff7feec-0xfffffff7fef0] (invalid)
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 tag fault.
0x0000000000110f3c in main () at tests/cheri/unrep2.c:14
14 return *((int*)ip2);
#0 0x0000000000110f3c in main () at tests/cheri/unrep2.c:14
x = 42
ip = 0xfffffff7ff58 [rwRW,0xfffffff7ff58-0xfffffff7ff5c]
ip1 = 0xffff0000000800a7 [rwRW,0xffff00000007ff58-0xffff00000007ff5c] (invalid)
ip2 = 0xfffffff7ff58 [rwRW,0xfffffff7ff58-0xfffffff7ff5c] (invalid)
ip=0xfffffff7ff58 [rwRW,0xfffffff7ff58-0xfffffff7ff5c]
~ip=0xffff0000000800a7 [rwRW,0xffff00000007ff58-0xffff00000007ff5c] (invalid)
~~ip=0xfffffff7ff58 [rwRW,0xfffffff7ff58-0xfffffff7ff5c] (invalid)
clang-morello-O3-bounds-conservative exit codes: compile 0 / execute 1
Program received signal SIGPROT, CHERI protection violation.
Capability tag fault.
main () at tests/cheri/unrep2.c:14
14 return *((int*)ip2);
#0 main () at tests/cheri/unrep2.c:14
x = 42
ip = <optimized out>
ip1 = 0xffff0000000800f3 [rwRW,0xffff00000007ff0c-0xffff00000007ff10] (invalid)
ip2 = 0xfffffff7ff0c [rwRW,0xfffffff7ff0c-0xfffffff7ff10] (invalid)
ip=0xfffffff7ff0c [rwRW,0xfffffff7ff0c-0xfffffff7ff10]
~ip=0xffff0000000800f3 [rwRW,0xffff00000007ff0c-0xffff00000007ff10] (invalid)
~~ip=0xfffffff7ff0c [rwRW,0xfffffff7ff0c-0xfffffff7ff10] (invalid)
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 tag fault.
0x0000000000110ef4 in main () at tests/cheri/unrep2.c:14
14 return *((int*)ip2);
#0 0x0000000000110ef4 in main () at tests/cheri/unrep2.c:14
x = 42
ip = 0xfffffff7ff58 [rwRW,0xfffffff7ff58-0xfffffff7ff5c]
ip1 = 0xffff0000000800a7 [rwRW,0xffff00000007ff58-0xffff00000007ff5c] (invalid)
ip2 = 0xfffffff7ff58 [rwRW,0xfffffff7ff58-0xfffffff7ff5c] (invalid)
ip=0xfffffff7ff58 [rwRW,0xfffffff7ff58-0xfffffff7ff5c]
~ip=0xffff0000000800a7 [rwRW,0xffff00000007ff58-0xffff00000007ff5c] (invalid)
~~ip=0xfffffff7ff58 [rwRW,0xfffffff7ff58-0xfffffff7ff5c] (invalid)
gcc-morello-O3 exit codes: compile 0 / execute 42
ip=0x7fffffdc [rwRW,0x7fffffdc-0x7fffffe0]
~ip=0xffffffff80000023 [rwRW,0xffffffff7fffffdc-0xffffffff7fffffe0] (invalid)
~~ip=0x7fffffdc [rwRW,0x7fffffdc-0x7fffffe0]
gcc-morello-O0 exit codes: compile 0 / execute 137
ip=0x7fffffac [rwRW,0x7fffffac-0x7fffffb0]
~ip=0xffffffff80000053 [rwRW,0xffffffff7fffffac-0xffffffff7fffffb0] (invalid)
~~ip=0x7fffffac [rwRW,0x7fffffac-0x7fffffb0] (invalid)