Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[BoundsSafety] Provide unsafe memcpy/memset for migration #10636

Copy link
Copy link
Open
@mxms0

Description

@mxms0
Issue body actions

Proposal

Add __unsafe_memcpy/__unsafe_memset (and possibly others) to ptrcheck.h a la:

uint8_t* __unsafe_indexable __unsafe_memcpy(uint8_t* __unsafe_indexable dst, uint8_t* __unsafe_indexable src, size_t size) { 
  memcpy(__unsafe_forge_bidi_indexable(uint8_t*, dst, size),
         __unsafe_forge_bidi_indexable(uint8_t*, src, size),
         size);
}

Could also be a macro, I suppose :)

The general pattern I've been going with as part of adoption is to get everything building with -fbounds-safety by marking nearly everything ABI-changing as __unsafe_indexable. This makes it easier to make localized improvements while still being able to build and run tests.

They'd still be clearly marked as unsafe, and so they'd be easily searchable/identifiable.

This also makes #pragma clang abi_ptr_attr set(unsafe_indexable) more attainable, and easier to adopt on per-line, per-function, per-TU granularities.

This request is mostly an adoption/ergonomics proposal, and as mentioned in discord, a temporary workaround exists to put these unsafe functions in a local header for adoption.

Metadata

Metadata

Assignees

Labels

clang:bounds-safetyIssue relating to the experimental -fbounds-safety feature in ClangIssue relating to the experimental -fbounds-safety feature in Clang

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.