Skip to content

epoll-wait induces too much synchronization #3944

Closed
@RalfJung

Description

@RalfJung

Let's consider the following testcase:

  • We have two pipes, A and B, and some global static mut S
  • The main thead sets up an epoll for both of these pipes' read ends
  • We spawn a sub-thread that writes to pipe A, then mutates S, then writes to pipe B
  • The main thread yields, and we have miri-preemption-rate=0, so this will fully run the sub-thread
  • The main thread waits on both pipes with epoll, but only wants to receive a single event
  • The main thread asserts that it was informed about pipe A, not B
  • Then the main thread reads from S

This should report UB due to a data race.

However, I think what will happen here is that the main thread will receive the notification for pipe A, but because we call acquire_clock on the ready_list.clock, we acquire the clock for all events. This means we miss the UB as the main thread read of S seems to happen-after the sub-thread write of S.

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