Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • G GLib
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 853
    • Issues 853
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 54
    • Merge requests 54
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • GLib
  • Merge requests
  • !3141

tests/slice-concurrent.c: avoid using rand() from multiple threads

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Alexander Richardson requested to merge arichardson/glib:concurrent-rand into main Dec 15, 2022
  • Overview 5
  • Commits 3
  • Pipelines 4
  • Changes 1

The rand() function is not thread safe, and calling it from multiple threads can result in data corruption (especially with weaker memory models such as Arm). I encountered this data corruption as a buffer overflow while running the tests on an Arm Morello system. It appears that this does not cause issues in most configurations since GLibc uses a global lock and most of the time these tests are run on architectures with stronger memory ordering.

See https://github.com/CTSRD-CHERI/cheribsd/issues/1584 for more details. Split out from !3135 (closed) (not CHERI specific, general fix)

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: concurrent-rand