Skip to content

Our pthreads shims don't check for reentrancy #781

@RalfJung

Description

@RalfJung

libstd sets some flags on its pthreads locks that make pthreads check for reentrancy. Our shims for lock acquire/release don't do that though -- so code that should deadlock actually continues to run in Miri.

The following code demonstrates the issue:

use std::sync::Mutex;

fn main() {
    let m = Mutex::new(0);
    let _g1 = m.lock();
    let _g2 = m.lock();
    unreachable!();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-shimsArea: This affects the external function shimsC-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions