HomeFreeBSD

CHERI: make mem{cpy,move}(9) CHERI compatible

Description

CHERI: make mem{cpy,move}(9) CHERI compatible

  • Use intptr_t in place of long as the word type in the core copying loop where aligned words a copied. This preserved the provenance of any copied pointers.
  • When working with the address of src or dst use ptraddr_t rather than uintptr_t. This avoid ambigious provenance in expressions involving multiple addresses.

As a minor tweak, rename the function to memmove since that is the
interface it implements (overlapping src and dst are permitted) and make
memcpy the alias rather than the other way around.

Reviewed by: kib, markj
Effort: CHERI upstreaming
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D57965

Details

Provenance
brooksAuthored on Jul 1 2026, 11:46 AM
Reviewer
kib
Differential Revision
D57965: CHERI: make mem{cpy,move}(9) CHERI compatible
Parents
rGf14bdfefa41c: CHERI: add sooptcopyinptr to preserve pointer provenance
Branches
Unknown
Tags
Unknown