Skip to content

Fragmentation could be non-memory-safe #14014

Closed

Description

@pcwalton

It passes FlowRefs around in layout. This is forbidden, as it can lead to races. These races can cause exploitable use-after-frees.

cc @SimonSapin

Activity

  1. added
    I-safety
    B-high-value
    on Nov 1, 2016
  2. notriddle commented on Nov 3, 2016

    @notriddle
    Contributor

    FlowRef is an Arc, so the underlying Flow won't be freed until all FlowRefs go away. How could this result in use-after-free?

  3. pcwalton commented on Nov 3, 2016

    @pcwalton
    ContributorAuthor

    Because somebody could clone the FlowRef, stash it somewhere, call deref_mut on it, and then race with others. These races can cause use after free. For example, consider one thread pushing onto a Vec, causing reallocation, while another thread accesses that Vec.

  4. pcwalton commented on Nov 3, 2016

    @pcwalton
    ContributorAuthor

    Layout must not have direct access to FlowRef. It must only interact with borrowed Flows.

  5. notriddle commented on Nov 3, 2016

    @notriddle
    Contributor

    That makes sense.

  6. added 2 commits that reference this issue on Nov 3, 2016
    064760c
    2b8a488
  7. self-assigned this
    on Nov 3, 2016
  8. added 2 commits that reference this issue on Nov 4, 2016
    89c7997
    2b4a7b0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-layout/blockB-high-valueI-safety

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions