Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • M mio
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2
    • Issues 2
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • redox-os
  • mio
  • Issues
  • #1
Closed
Open
Created 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
Time tracking