Page MenuHomeFreeBSD

sysvshm: Fix locking in shm_prison_set()
ClosedPublic

Authored by markj on Fri, Sep 25, 6:09 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Sep 26, 9:51 PM
Unknown Object (File)
Sat, Sep 26, 9:39 PM
Unknown Object (File)
Sat, Sep 26, 7:51 PM
Unknown Object (File)
Sat, Sep 26, 3:08 PM
Unknown Object (File)
Sat, Sep 26, 12:34 PM
Unknown Object (File)
Sat, Sep 26, 11:04 AM
Unknown Object (File)
Sat, Sep 26, 7:15 AM
Unknown Object (File)
Sat, Sep 26, 6:22 AM
Subscribers

Details

Summary

We were not acquiring the global sysvshm lock when handling cleanup of
sysvshm segments. Acquire the lock in shm_prison_cleanup() instead, to
be consistent with the sysv semaphore code.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 77337
Build 74220: arc lint + arc unit

Event Timeline

markj requested review of this revision.Fri, Sep 25, 6:09 PM

Look good. I was hesitant because it's an sx lock, but I don't see any mutexes held when it's locked. I suspect that hesitance was why I didn't do it tthe same as sysv_sem and sysv_msg in the first place, but that was a while ago and has totally escaped my memory.

This revision is now accepted and ready to land.Fri, Sep 25, 7:51 PM

Look good. I was hesitant because it's an sx lock, but I don't see any mutexes held when it's locked. I suspect that hesitance was why I didn't do it tthe same as sysv_sem and sysv_msg in the first place, but that was a while ago and has totally escaped my memory.

For what it's worth I tested this a bit (and confirmed as well that the bug is there, since shm_deallocate_segment() asserts that the global lock is held) and didn't see any warnings from witness either.

This revision was automatically updated to reflect the committed changes.