From: Alex Musolino <alex@musolino.id.au>
To: 9front@9front.org
Subject: Re: [9front] Kernel memory leak
Date: Sun, 23 Aug 2020 12:06:27 +0930 [thread overview]
Message-ID: <9330C5163D51487B40061C6094EDB1B9@musolino.id.au> (raw)
In-Reply-To: <1C00BF7104B27D40F5297717986A81AD@felloff.net>
> 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
next prev parent reply other threads:[~2020-08-23 2:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-21 15:40 Alex Musolino
2020-08-23 1:20 ` [9front] " cinap_lenrek
2020-08-23 2:36 ` Alex Musolino [this message]
2020-08-23 3:07 ` cinap_lenrek
2020-08-23 3:16 ` Alex Musolino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9330C5163D51487B40061C6094EDB1B9@musolino.id.au \
--to=alex@musolino.id.au \
--cc=9front@9front.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).