[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: race condition in libports
From: |
Samuel Thibault |
Subject: |
Re: race condition in libports |
Date: |
Sat, 6 Jan 2018 02:03:11 +0100 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
Hello,
Brent W. Baccala, on ven. 05 janv. 2018 19:47:37 -0500, wrote:
> Well, in that case, perhaps it should work by checking to see if the port is
> in
> the hash, rather than by looking at how many weak references it's got.
> Something more like this:
>
> if ((refcounts_hard_references(&i->pi.refcounts) == 0)
> && (* i->id_hashloc == i))
> {
> /* Nobody got a send right in between, we can remove from the hash. */
> hurd_ihash_locp_remove (&idhash, i->id_hashloc);
> ports_port_deref_weak (&i->pi);
> }
You can't afford dereferencing id_hashloc like that: it could have
gotten away in between.
Could you try the attached patch instead?
> Also, what documentation? The hurd texinfo file? That's the only place that
> I
> know of where this is documented.
Yes: “If nonzero, @var{dropweak_routine} will be called to request
weak references to be dropped.” It doesn't say "one weak reference", but
"weak references".
Samuel
patch
Description: Text document