From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from vultr.musolino.id.au ([45.76.123.158]) by ewsd; Sat Aug 22 22:37:04 EDT 2020 Received: from 58.170.204.252 ([58.170.204.252]) by vultr; Sun Aug 23 12:36:29 EST 2020 Message-ID: <9330C5163D51487B40061C6094EDB1B9@musolino.id.au> From: Alex Musolino Date: Sun, 23 Aug 2020 12:06:27 +0930 To: 9front@9front.org Subject: Re: [9front] Kernel memory leak In-Reply-To: <1C00BF7104B27D40F5297717986A81AD@felloff.net> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit List-ID: <9front.9front.org> List-Help: X-Glyph: ➈ X-Bullshit: responsive transactional framework HTTP over SVG blockchain-oriented storage > i think the cunique() would *ALWAYS* be required when we are going > to stuff something on the chan's umh, as otherwise we'd have a race > condition because the returned chan from domount() -> findmount() > is shared. Yeah, it makes more sense to do it at the same time/place as the umh update. I guess we do the same thing for the Aopen/Acreate case where we might also update the umh? We also change umh in devshr.c but I guess this is fine since it's only temporary. > can you check if this works? Works fine as far as I can tell. How about the following patch then? diff -r ec3da4e6c943 sys/src/9/port/chan.c --- a/sys/src/9/port/chan.c Fri Aug 21 10:06:22 2020 +0930 +++ b/sys/src/9/port/chan.c Sun Aug 23 12:01:46 2020 +0930 @@ -1410,7 +1410,11 @@ m = nil; if(!nomount) domount(&c, &m, nil); - putmhead(c->umh); + c = cunique(c); + if(c->umh != nil){ //BUG + print("bind umh\n"); + putmhead(c->umh); + } c->umh = m; break; @@ -1454,9 +1458,14 @@ c->umh = nil; } /* only save the mount head if it's a multiple element union */ - if(m != nil && m->mount != nil && m->mount->next != nil) + if(m != nil && m->mount != nil && m->mount->next != nil){ + c = cunique(c); + if(c->umh != nil){ //BUG + print("Aopen/Acreate umh\n"); + putmhead(c->umh); + } c->umh = m; - else + }else putmhead(m); /* save registers else error() in open has wrong value of c saved */ -- Cheers, Alex Musolino