Skip to content

The percore macro can copy values that are not safely duplicable #49

Description

@balint-dobszay-arm
#[percore]
static VALUE: ExceptionLock<RefCell<T>> = ExceptionLock::new(RefCell::new(initial_value));

This creates one initialised value on the primary core, and then copies it byte-by-byte (ldp/stp) to each secondary core's percore area. However, there is no guarantee that it is sound to duplicate T.

E.g. if T = &'static mut u64, all cores will have their own RefCell instance, so all cores can successfully borrow it at the same time, and will have mutable access to the same memory location.

Note: Codex gave me the hint for this, while I was reviewing the integration of the new percore-derive feature in RF-A

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions