Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
M
mio
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2
    • Issues 2
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • redox-os
  • mio
  • Issues
  • #1

Closed
Open
Opened Nov 01, 2019 by Boqin Qin@BurtonQin

Possible data race using Overlapped

https://gitlab.redox-os.org/redox-os/mio/blob/master/src/sys/windows/selector.rs#L493

Struct Overlapped implements Sync trait so as to be shared across threads by reference. It contains a UnsafeCell, and its method as_mut_ptr will return a mutable ptr to the inner data.

This may cause a crash if one thread writes the data while another is accessing it, all by immutable reference of the struct and will bypass compiler checking. It is rather unsafe but we marked it as safe!!!

I searched for a ref-counting version of this struct, which is much safer.

https://github.com/tokio-rs/mio/blob/master/src/sys/windows/selector.rs#L81

My suggestion is to replace the current Overlapped with this version.

Edited Nov 01, 2019 by Boqin Qin
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: redox-os/mio#1