Page MenuHomeFreeBSD

sysvshm: Fix locking in shm_prison_set()
ClosedPublic

Authored by markj on Fri, Sep 25, 6:09 PM.
Tags
None
Referenced Files
F173527900: D60030.id187713.diff
Sat, Sep 26, 3:08 PM
F173514776: D60030.id.diff
Sat, Sep 26, 12:34 PM
F173506792: D60030.diff
Sat, Sep 26, 11:04 AM
F173485867: D60030.id187698.diff
Sat, Sep 26, 7:15 AM
F173480898: D60030.id187698.diff
Sat, Sep 26, 6:22 AM
F173472212: D60030.id187698.diff
Sat, Sep 26, 4:52 AM
F173471676: D60030.diff
Sat, Sep 26, 4:48 AM
F173470234: D60030.id187713.diff
Sat, Sep 26, 4:38 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 Not Applicable
Unit
Tests Not Applicable

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.