Example: intptr2.c

up: index
prev: null4.c
next: intptr3.c

    #include <stdint.h>
    #include <stdio.h>
    #include "capprint.h"
    
    int main()
    {
        int x=0;
        intptr_t ip;
        int *p = &x;
    
        fprintf(stderr,"Original %" PTR_FMT "\n", sptr((void*)p));
        ip=(intptr_t)p;
        p = (int*)ip;
        fprintf(stderr,"Recovered %" PTR_FMT "\n", sptr((void*)p));
    
        *p=42;
        fprintf(stderr,"x=%d\n",x);
    }
    

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 [rwRW,0xffffe710-0xffffe714])
x=42
 
cerberus-cheri
cerberus-cheri-revocation
cerberus-cheri-cornucopia
 Original (@82, 0xffffe710 [rwRW,0xffffe710-0xffffe714])
Recovered (@82, 0xffffe710 [rwRW,0xffffe710-0xffffe714])
x=42
 
clang-riscv-O3-bounds-subobject-safe Original 0x3fffdfff2c [rwRW,0x3fffdfff2c-0x3fffdfff30]
Recovered 0x3fffdfff2c [rwRW,0x3fffdfff2c-0x3fffdfff30]
x=42
 
clang-riscv-O3-bounds-conservative Original 0x3fffdfff3c [rwRW,0x3fffdfff3c-0x3fffdfff40]
Recovered 0x3fffdfff3c [rwRW,0x3fffdfff3c-0x3fffdfff40]
x=42
 
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
 Original 0x3fffdfff6c [rwRW,0x3fffdfff6c-0x3fffdfff70]
Recovered 0x3fffdfff6c [rwRW,0x3fffdfff6c-0x3fffdfff70]
x=42
 
clang-morello-O3-bounds-subobject-safe Original 0xfffffff7fefc [rwRW,0xfffffff7fefc-0xfffffff7ff00]
Recovered 0xfffffff7fefc [rwRW,0xfffffff7fefc-0xfffffff7ff00]
x=42
 
clang-morello-O3-bounds-conservative Original 0xfffffff7ff2c [rwRW,0xfffffff7ff2c-0xfffffff7ff30]
Recovered 0xfffffff7ff2c [rwRW,0xfffffff7ff2c-0xfffffff7ff30]
x=42
 
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 0xfffffff7ff5c [rwRW,0xfffffff7ff5c-0xfffffff7ff60]
Recovered 0xfffffff7ff5c [rwRW,0xfffffff7ff5c-0xfffffff7ff60]
x=42
 
gcc-morello-O3 Original 0x7fffffdc [rwRW,0x7fffffdc-0x7fffffe0]
Recovered 0x7fffffdc [rwRW,0x7fffffdc-0x7fffffe0]
x=42
 
gcc-morello-O0 Original 0x7fffffbc [rwRW,0x7fffffbc-0x7fffffc0]
Recovered 0x7fffffbc [rwRW,0x7fffffbc-0x7fffffc0]
x=42