memcpy3.c
up: index
prev: memcpy2.c
next: malloc0.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "capprint.h"
int main()
{
int x=42;
int *p0 = &x;
int **p1 = calloc(1, sizeof(int*));
memcpy(p1,&p0,sizeof(int*)-1);
fprintf(stderr,"Original %" PTR_FMT "\n", sptr((void*)p0));
fprintf(stderr,"Copy %" PTR_FMT "\n", sptr((void*)*p1));
fprintf(stderr,"Value: %d\n",**p1);
}
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: "<16:36--16:40>"}
Original (@disabled, 0xffffe710 [rwRW,0xffffe710-0xffffe714])
Copy (@disabled, 0xffffe710 [,0xffffe710-0xffffe714] (notag))
cerberus-cheri
cerberus-cheri-revocation
cerberus-cheri-cornucopia exit codes: compile 0 / execute 1
Undefined {ub: "UB_CHERI_UndefinedTag", loc: "<16:36--16:40>"}
Original (@82, 0xffffe710 [rwRW,0xffffe710-0xffffe714])
Copy (@82, 0xffffe710 [,0xffffe710-0xffffe714] (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 cs2.
0x0000000000102116 in main () at tests/cheri/memcpy3.c:16
16 fprintf(stderr,"Value: %d\n",**p1);
#0 0x0000000000102116 in main () at tests/cheri/memcpy3.c:16
x = <optimized out>
p0 = <optimized out>
p1 = <optimized out>
Original 0x3fffdfff1c [rwRW,0x3fffdfff1c-0x3fffdfff20]
Copy 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 ca2.
0x0000000000102114 in main () at tests/cheri/memcpy3.c:16
16 fprintf(stderr,"Value: %d\n",**p1);
#0 0x0000000000102114 in main () at tests/cheri/memcpy3.c:16
x = 42
p0 = 0x3fffdfff6c [rwRW,0x3fffdfff6c-0x3fffdfff70]
p1 = 0x40a1d000 [rwRW,0x40a1d000-0x40a1d010]
Original 0x3fffdfff6c [rwRW,0x3fffdfff6c-0x3fffdfff70]
Copy 0x3fffdfff6c [rwRW,0x3fffdfff6c-0x3fffdfff70] (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 cs2.
0x0000000000102142 in main () at tests/cheri/memcpy3.c:16
16 fprintf(stderr,"Value: %d\n",**p1);
#0 0x0000000000102142 in main () at tests/cheri/memcpy3.c:16
x = 42
p0 = <optimized out>
p1 = <optimized out>
Original 0x3fffdfff1c [rwRW,0x3fffdfff1c-0x3fffdfff20]
Copy 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 ca1.
0x00000000001020cc in main () at tests/cheri/memcpy3.c:16
16 fprintf(stderr,"Value: %d\n",**p1);
#0 0x00000000001020cc in main () at tests/cheri/memcpy3.c:16
x = 42
p0 = 0x3fffdfff6c [rwRW,0x3fffdfff6c-0x3fffdfff70]
p1 = 0x40a1d000 [rwRW,0x40a1d000-0x40a1d010]
Original 0x3fffdfff6c [rwRW,0x3fffdfff6c-0x3fffdfff70]
Copy 0x3fffdfff6c [rwRW,0x3fffdfff6c-0x3fffdfff70] (invalid)
clang-morello-O3-bounds-subobject-safe exit codes: compile 0 / execute 1
Program received signal SIGPROT, CHERI protection violation.
Capability tag fault.
0x0000000000111158 in main () at tests/cheri/memcpy3.c:16
16 fprintf(stderr,"Value: %d\n",**p1);
#0 0x0000000000111158 in main () at tests/cheri/memcpy3.c:16
x = 42
p0 = <optimized out>
p1 = <optimized out>
Original 0xfffffff7feec [rwRW,0xfffffff7feec-0xfffffff7fef0]
Copy 0xfffffff7feec [,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.
0x0000000000110f70 in main () at tests/cheri/memcpy3.c:16
16 fprintf(stderr,"Value: %d\n",**p1);
#0 0x0000000000110f70 in main () at tests/cheri/memcpy3.c:16
x = 42
p0 = 0xfffffff7ff5c [rwRW,0xfffffff7ff5c-0xfffffff7ff60]
p1 = 0x40c1d000 [rwRW,0x40c1d000-0x40c1d010]
Original 0xfffffff7ff5c [rwRW,0xfffffff7ff5c-0xfffffff7ff60]
Copy 0xfffffff7ff5c [,0xfffffff7ff5c-0xfffffff7ff60] (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/memcpy3.c:16
16 fprintf(stderr,"Value: %d\n",**p1);
#0 main () at tests/cheri/memcpy3.c:16
x = 42
p0 = <optimized out>
p1 = <optimized out>
Original 0xfffffff7ff0c [rwRW,0xfffffff7ff0c-0xfffffff7ff10]
Copy 0xfffffff7ff0c [,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.
0x0000000000110f28 in main () at tests/cheri/memcpy3.c:16
16 fprintf(stderr,"Value: %d\n",**p1);
#0 0x0000000000110f28 in main () at tests/cheri/memcpy3.c:16
x = 42
p0 = 0xfffffff7ff5c [rwRW,0xfffffff7ff5c-0xfffffff7ff60]
p1 = 0x40c1d000 [rwRW,0x40c1d000-0x40c1d010]
Original 0xfffffff7ff5c [rwRW,0xfffffff7ff5c-0xfffffff7ff60]
Copy 0xfffffff7ff5c [,0xfffffff7ff5c-0xfffffff7ff60] (invalid)
gcc-morello-O0
gcc-morello-O3 exit codes: compile 0 / execute 137
Original 0x7fffffcc [rwRW,0x7fffffcc-0x7fffffd0]
Copy 0x7fffffcc [,0x7fffffcc-0x7fffffd0] (invalid)