tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: resource leak in linux emulation?
In article <201405040936.21907.mark%ecs.vuw.ac.nz@localhost>,
Mark Davies <mark%ecs.vuw.ac.nz@localhost> wrote:
>On Thu, 24 Apr 2014 07:18:10 David Laight wrote:
>> > To fix, this should be added somewhere, probably at
>> > sys/kern/kern_exit.c:487 (but I'm not sure if there's a better
>> > location):
>> > if ((l->l_pflag & LP_PIDLID) != 0 && l->l_lid != p->p_pid) {
>> >
>> > proc_free_pid(l->l_lid);
>> >
>> > }
>>
>> That doesn't look like the right place.
>> I think it should be further down (and with proc_lock held).
>
>So can someone suggest where exactly the patch should go. And isn't proc_lock
>held at this point (entered at line 344, exit at line 569)?
How about this?
christos
Index: kern_exit.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_exit.c,v
retrieving revision 1.243
diff -u -u -r1.243 kern_exit.c
--- kern_exit.c 9 Jun 2013 01:13:47 -0000 1.243
+++ kern_exit.c 4 May 2014 21:26:00 -0000
@@ -541,12 +541,10 @@
*/
pcu_discard_all(l);
- /*
- * Remaining lwp resources will be freed in lwp_exit2() once we've
- * switch to idle context; at that point, we will be marked as a
- * full blown zombie.
- */
mutex_enter(p->p_lock);
+ /* Free the linux lwp id */
+ if ((l->l_pflag & LP_PIDLID) != 0 && l->l_lid != p->p_pid)
+ proc_free_pid(l->l_lid);
lwp_drainrefs(l);
lwp_lock(l);
l->l_prflag &= ~LPR_DETACHED;
Home |
Main Index |
Thread Index |
Old Index