Skip to content

Soundness of autorelease pools #540

@madsmtm

Description

@madsmtm

Autoreleasing objects using rc::autoreleasepool is unsound because we cannot ensure that the lifetime from an outer pool is not used inside an inner pool.

To help mitigate that, we provide the auto trait AutoreleaseSafe, which can be enabled with the "unstable-autoreleasesafe" feature (requires nightly, since auto traits are unstable).

Even with that, though, other libraries such as scoped-tls-hkt make assumptions that break our assumptions, see the code example provided here.

So we need some other way to make autorelease pools safe (or resort to marking them unsafe).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-objc2Affects the `objc2`, `objc2-exception-helper` and/or `objc2-encode` cratesI-unsoundA soundness hole, or affecting soundness

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions