OpenBSD cvs log

created 2021-12-12T20:17:59Z
begin 2021-12-07T00:00:00Z
end 2021-12-07T01:19:47Z
path src/sys
commits 1

date 2021-12-07T01:19:47Z
author mvs
files src/sys/kern/uipc_usrreq.c log diff annotate
src/sys/sys/unpcb.h log diff annotate
message Make `unp_msgcount' and `unp_file' protection with `unp_gc_lock'
rwlock(9).

This save us from from races provided by unlocked access to the `f_count'
which cause false marking alive socket as dead. We always modify `f_count'
and `unp_msgcount' together so the `f_count' modification should also pass
the `unp_gc_rwlock' before `unp_msgcount' increment and after
`unp_msgcount' decrement. The locked `unp_file' assignment avoids us from
drain unp_gc() run.

This moves unp_gc() locking back when these wariables were protected with
the same lock which was taken for all garbage collector run but uses
another lock not `unp_lock'.

ok kettenis@ bluhm@