[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:04:59 +0100 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
Samuel Thibault, on sam. 06 janv. 2018 02:03:11 +0100, wrote:
> 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?
Actually that's what libdiskfs/node-cache.c does :)
Samuel