memcpy1.c
up: index
prev: arr2.c
next: memcpy2.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cheriintrin.h>
#include "capprint.h"
int main()
{
int x=42;
int *p0 = &x;
int **p1 = malloc(sizeof(int*));
memcpy(p1,&p0,sizeof(int*));
fprintf(stderr,"Original %" PTR_FMT "\n", sptr((void*)p0));
fprintf(stderr,"Pointer to copy %" PTR_FMT "\n", sptr((void*)p1));
fprintf(stderr,"Copy %" PTR_FMT "\n", sptr((void*)*p1));
fprintf(stderr,"Pointers are %s\n",
cheri_is_equal_exact(p0,*p1)?"exactly equal":"not equal");
}
Experimental data (what does this mean?)
cerberus-cheri-no-pnvi
cerberus-cheri-revocation-no-pnvi
cerberus-cheri-cornucopia-no-pnvi Original (@disabled, 0xffffe6dc [rwRW,0xffffe6dc-0xffffe6e0])
Pointer to copy (@disabled, 0xffffe690 [rwRW,0xffffe690-0xffffe6a0])
Copy (@disabled, 0xffffe6dc [rwRW,0xffffe6dc-0xffffe6e0])
Pointers are exactly equal
cerberus-cheri
cerberus-cheri-revocation
cerberus-cheri-cornucopia Original (@85, 0xffffe6dc [rwRW,0xffffe6dc-0xffffe6e0])
Pointer to copy (@89, 0xffffe690 [rwRW,0xffffe690-0xffffe6a0])
Copy (@85, 0xffffe6dc [rwRW,0xffffe6dc-0xffffe6e0])
Pointers are exactly equal
clang-riscv-O3-bounds-subobject-safe cheri-bound-allocas: Don't know how to handle intrinsic. Assuming bounds needed %15 = call i1 @llvm.cheri.cap.equal.exact(i8 addrspace(200)* %1, i8 addrspace(200)* %14), !dbg !57cheri-bound-allocas: Don't know how to handle intrinsic. Assuming bounds needed %15 = call i1 @llvm.cheri.cap.equal.exact(i8 addrspace(200)* %1, i8 addrspace(200)* %14), !dbg !57cheri-bound-allocas: Don't know how to handle intrinsic. Assuming bounds needed %16 = call i1 @llvm.cheri.cap.equal.exact(i8 addrspace(200)* %1, i8 addrspace(200)* %15), !dbg !57cheri-bound-allocas: Don't know how to handle intrinsic. Assuming bounds needed %15 = call i1 @llvm.cheri.cap.equal.exact(i8 addrspace(200)* %1, i8 addrspace(200)* %14), !dbg !56cheri-bound-allocas: Don't know how to handle intrinsic. Assuming bounds needed %19 = call i1 @llvm.cheri.cap.equal.exact(i8 addrspace(200)* %1, i8 addrspace(200)* %18), !dbg !99cheri-bound-allocas: Don't know how to handle intrinsic. Assuming bounds needed %19 = call i1 @llvm.cheri.cap.equal.exact(i8 addrspace(200)* %1, i8 addrspace(200)* %18), !dbg !99cheri-bound-allocas: Don't know how to handle intrinsic. Assuming bounds needed %19 = call i1 @llvm.cheri.cap.equal.exact(i8 addrspace(200)* %1, i8 addrspace(200)* %18), !dbg !99cheri-bound-allocas: Don't know how to handle intrinsic. Assuming bounds needed %19 = call i1 @llvm.cheri.cap.equal.exact(i8 addrspace(200)* %1, i8 addrspace(200)* %18), !dbg !99cheri-bound-allocas: Don't know how to handle intrinsic. Assuming bounds needed %19 = call i1 @llvm.cheri.cap.equal.exact(i8 addrspace(200)* %1, i8 addrspace(200)* %18), !dbg !99cheri-bound-allocas: Don't know how to handle intrinsic. Assuming bounds needed %19 = call i1 @llvm.cheri.cap.equal.exact(i8 addrspace(200)* %1, i8 addrspace(200)* %18), !dbg !99cheri-bound-allocas: Don't know how to handle intrinsic. Assuming bounds needed %19 = call i1 @llvm.cheri.cap.equal.exact(i8 addrspace(200)* %1, i8 addrspace(200)* %18), !dbg !99cheri-bound-allocas: Don't know how to handle intrinsic. Assuming bounds needed %19 = call i1 @llvm.cheri.cap.equal.exact(i8 addrspace(200)* %1, i8 addrspace(200)* %18), !dbg !99Original 0x3fffdfff1c [rwRW,0x3fffdfff1c-0x3fffdfff20]
Pointer to copy 0x40a1d000 [rwRW,0x40a1d000-0x40a1d010]
Copy 0x3fffdfff1c [rwRW,0x3fffdfff1c-0x3fffdfff20]
Pointers are exactly equal
clang-riscv-O3-bounds-conservative cheri-bound-allocas: Don't know how to handle intrinsic. Assuming bounds needed %9 = call i1 @llvm.cheri.cap.equal.exact(i8 addrspace(200)* nonnull %0, i8 addrspace(200)* %8), !dbg !85Original 0x3fffdfff0c [rwRW,0x3fffdfff0c-0x3fffdfff10]
Pointer to copy 0x40a1d000 [rwRW,0x40a1d000-0x40a1d010]
Copy 0x3fffdfff0c [rwRW,0x3fffdfff0c-0x3fffdfff10]
Pointers are exactly equal
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]
Pointer to copy 0x40a1d000 [rwRW,0x40a1d000-0x40a1d010]
Copy 0x3fffdfff6c [rwRW,0x3fffdfff6c-0x3fffdfff70]
Pointers are exactly equal
clang-morello-O3-bounds-subobject-safe Original 0xfffffff7feec [rwRW,0xfffffff7feec-0xfffffff7fef0]
Pointer to copy 0x40c1d000 [rwRW,0x40c1d000-0x40c1d010]
Copy 0xfffffff7feec [rwRW,0xfffffff7feec-0xfffffff7fef0]
Pointers are exactly equal
clang-morello-O3-bounds-conservative Original 0xfffffff7fefc [rwRW,0xfffffff7fefc-0xfffffff7ff00]
Pointer to copy 0x40c1d000 [rwRW,0x40c1d000-0x40c1d010]
Copy 0xfffffff7fefc [rwRW,0xfffffff7fefc-0xfffffff7ff00]
Pointers are exactly equal
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]
Pointer to copy 0x40c1d000 [rwRW,0x40c1d000-0x40c1d010]
Copy 0xfffffff7ff5c [rwRW,0xfffffff7ff5c-0xfffffff7ff60]
Pointers are exactly equal
gcc-morello-O3 Original 0x7fffffdc [rwRW,0x7fffffdc-0x7fffffe0]
Pointer to copy 0x40000010 [rwRW,0x40000010-0x40000020]
Copy 0x7fffffdc [rwRW,0x7fffffdc-0x7fffffe0]
Pointers are exactly equal
gcc-morello-O0 Original 0x7fffffcc [rwRW,0x7fffffcc-0x7fffffd0]
Pointer to copy 0x40000010 [rwRW,0x40000010-0x40000020]
Copy 0x7fffffcc [rwRW,0x7fffffcc-0x7fffffd0]
Pointers are exactly equal