Skip to content

Proper support for mutex type PTHREAD_MUTEX_ERRORCHECK checking return types #658

@sim642

Description

@sim642

With the revival of deadlock analysis (#655), it becomes more and more important that we handle behavior specific to mutex types.

Via pthread_mutexattr_settype there are the following possibilities:

  • PTHREAD_MUTEX_DEFAULT – misuse is undefined behavior
  • PTHREAD_MUTEX_NORMAL – relocking deadlocks, other misuse is undefined behavior
  • PTHREAD_MUTEX_ERRORCHECK – misuse returns errors
  • PTHREAD_MUTEX_RECURSIVE – relocking allowed, other misuse returns errors

Additionally:

  • We don't do anything smart with read-write locks (pthread_rwlock_rdlock, pthread_rwlock_wrlock). (Fix read-write lock access handling #661)
  • Since some of the types are about differences in return values, we should also consider those, instead of completely ignoring them.

The different mutex types affect multiple features:

  • Race detection
  • Deadlock detection
  • Base and Apron privatization

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions