ip1.c
up: index
prev: const2a.c
next: ip2.c
#include <stdio.h>
#include "capprint.h"
int main()
{
int x = 42;
unsigned long long ix = (unsigned long long) &x;
int *px = (int*)ix;
fprintf(stderr,"Original: %" PTR_FMT "\n", sptr((void*) &x));
fprintf(stderr,"Recovered: %" PTR_FMT "\n", sptr((void*) px));
}
Experimental data (what does this mean?)
cerberus-cheri-no-pnvi
cerberus-cheri-revocation-no-pnvi
cerberus-cheri-cornucopia-no-pnvi Original: (@disabled, 0xffffe710 [rwRW,0xffffe710-0xffffe714])
Recovered: (@disabled, 0xffffe710)
cerberus-cheri
cerberus-cheri-revocation
cerberus-cheri-cornucopia Original: (@81, 0xffffe710 [rwRW,0xffffe710-0xffffe714])
Recovered: (@81, 0xffffe710)
clang-riscv-O3-bounds-conservative
clang-riscv-O3-bounds-subobject-safe tests/cheri/ip1.c:8:15: warning: cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced [-Wcheri-capability-misuse]
int *px = (int*)ix;
^
1 warning generated.
Original: 0x3fffdfff2c [rwRW,0x3fffdfff2c-0x3fffdfff30]
Recovered: 0x3fffdfff2c
clang-riscv-O0-bounds-conservative
clang-riscv-O0-bounds-references-only
clang-riscv-O0-bounds-subobject-safe
clang-riscv-O0-bounds-aggressive
clang-riscv-O0-bounds-very-aggressive
clang-riscv-O0-bounds-everywhere-unsafe tests/cheri/ip1.c:8:15: warning: cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced [-Wcheri-capability-misuse]
int *px = (int*)ix;
^
1 warning generated.
Original: 0x3fffdfff6c [rwRW,0x3fffdfff6c-0x3fffdfff70]
Recovered: 0x3fffdfff6c
clang-morello-O3-bounds-subobject-safe tests/cheri/ip1.c:8:15: warning: cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced [-Wcheri-capability-misuse]
int *px = (int*)ix;
^
1 warning generated.
Original: 0xfffffff7fefc [rwRW,0xfffffff7fefc-0xfffffff7ff00]
Recovered: 0xfffffff7fefc
clang-morello-O3-bounds-conservative tests/cheri/ip1.c:8:15: warning: cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced [-Wcheri-capability-misuse]
int *px = (int*)ix;
^
1 warning generated.
Original: 0xfffffff7ff1c [rwRW,0xfffffff7ff1c-0xfffffff7ff20]
Recovered: 0xfffffff7ff1c
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 tests/cheri/ip1.c:8:15: warning: cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced [-Wcheri-capability-misuse]
int *px = (int*)ix;
^
1 warning generated.
Original: 0xfffffff7ff5c [rwRW,0xfffffff7ff5c-0xfffffff7ff60]
Recovered: 0xfffffff7ff5c
gcc-morello-O3 tests/cheri/ip1.c: In function 'main':
tests/cheri/ip1.c:8:15: warning: cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced [-Wcheri-capability-misuse]
8 | int *px = (int*)ix;
| ^
tests/cheri/ip1.c:8:15: note: insert cast to intptr_t to silence this warning
Original: 0x7fffffdc [rwRW,0x7fffffdc-0x7fffffe0]
Recovered: 0x7fffffdc
gcc-morello-O0 tests/cheri/ip1.c: In function 'main':
tests/cheri/ip1.c:8:15: warning: cast from provenance-free integer type to pointer type will give pointer that can not be dereferenced [-Wcheri-capability-misuse]
8 | int *px = (int*)ix;
| ^
tests/cheri/ip1.c:8:15: note: insert cast to intptr_t to silence this warning
Original: 0x7fffffbc [rwRW,0x7fffffbc-0x7fffffc0]
Recovered: 0x7fffffbc