modptr5.c
up: index
prev: modptr4a.c
next: modptr6.c
#include <stdio.h>
#include "capprint.h"
void func(int x) { }
void (*fptr)(int) = &func;
int main(void)
{
fprintf(stderr,"Original: %" PTR_FMT "\n", sptr((void*)fptr));
unsigned char *p = (unsigned char*) &fptr;
p[0] = 42;
fprintf(stderr,"Modified: %" PTR_FMT "\n", sptr((void*)fptr));
}
Experimental data (what does this mean?)
cerberus-cheri-no-pnvi
cerberus-cheri-revocation-no-pnvi
cerberus-cheri-cornucopia-no-pnvi Original: (@disabled, 0x100000386 [rxR,0x100000386-0x100000388] (sentry))
Modified: (@disabled, 0x10000032a [rxR,0x100000386-0x100000388] (notag,sentry))
cerberus-cheri
cerberus-cheri-revocation
cerberus-cheri-cornucopia Original: (@empty, 0x100000386 [rxR,0x100000386-0x100000388] (sentry))
Modified: (@empty, 0x10000032a [rxR,0x100000386-0x100000388] (notag,sentry))
clang-riscv-O3-bounds-subobject-safe Original: 0x101ffc [rxR,0x100000-0x1044c0] (sentry,capmode)
Modified: 0x101f2a [rxR,0x100000-0x1044c0] (invalid,sentry,capmode)
clang-riscv-O0-bounds-subobject-safe
clang-riscv-O0-bounds-aggressive
clang-riscv-O0-bounds-very-aggressive
clang-riscv-O0-bounds-everywhere-unsafe Original: 0x101fda [rxR,0x100000-0x104480] (sentry,capmode)
Modified: 0x101f2a [rxR,0x100000-0x104480] (invalid,sentry,capmode)
clang-riscv-O3-bounds-conservative Original: 0x102016 [rxR,0x100000-0x1044e0] (sentry,capmode)
Modified: 0x10202a [rxR,0x100000-0x1044e0] (invalid,sentry,capmode)
clang-riscv-O0-bounds-conservative
clang-riscv-O0-bounds-references-only Original: 0x101fba [rxR,0x100000-0x104440] (sentry,capmode)
Modified: 0x101f2a [rxR,0x100000-0x104440] (invalid,sentry,capmode)
clang-morello-O3-bounds-subobject-safe Original: 0x111011 [rxR,0x100000-0x1315c0] (sentry)
Modified: 0x11102a [rxR,0x100000-0x1315c0] (invalid,sentry)
clang-morello-O0-bounds-subobject-safe
clang-morello-O0-bounds-aggressive
clang-morello-O0-bounds-very-aggressive
clang-morello-O0-bounds-everywhere-unsafe Original: 0x110e41 [rxR,0x100000-0x131380] (sentry)
Modified: 0x110e2a [rxR,0x100000-0x131380] (invalid,sentry)
clang-morello-O3-bounds-conservative Original: 0x111051 [rxR,0x100000-0x131600] (sentry)
Modified: 0x11102a [rxR,0x100000-0x131600] (invalid,sentry)
clang-morello-O0-bounds-conservative
clang-morello-O0-bounds-references-only Original: 0x110e21 [rxR,0x100000-0x131340] (sentry)
Modified: 0x110e2a [rxR,0x100000-0x131340] (invalid,sentry)
gcc-morello-O3 tests/cheri/modptr5.c: In function 'main':
tests/cheri/modptr5.c:10:53: warning: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]
10 | fprintf(stderr,"Original: %" PTR_FMT "\n", sptr((void*)fptr));
| ^
tests/cheri/modptr5.c:13:53: warning: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]
13 | fprintf(stderr,"Modified: %" PTR_FMT "\n", sptr((void*)fptr));
| ^
Original: 0x402fa1 [rxRE,0x400000-0x4271c0] (sentry)
Modified: 0x402f2a [rxRE,0x400000-0x4271c0] (invalid,sentry)
gcc-morello-O0 tests/cheri/modptr5.c: In function 'main':
tests/cheri/modptr5.c:10:53: warning: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]
10 | fprintf(stderr,"Original: %" PTR_FMT "\n", sptr((void*)fptr));
| ^
tests/cheri/modptr5.c:13:53: warning: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]
13 | fprintf(stderr,"Modified: %" PTR_FMT "\n", sptr((void*)fptr));
| ^
Original: 0x403805 [rxRE,0x400000-0x427600] (sentry)
Modified: 0x40382a [rxRE,0x400000-0x427600] (invalid,sentry)