[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090701144816.GA26536@redhat.com>
Date: Wed, 1 Jul 2009 16:48:16 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Neil Horman <nhorman@...driver.com>
Cc: linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
earl_chew@...lent.com, Alan Cox <alan@...rguk.ukuu.org.uk>,
Andi Kleen <andi@...stfloor.org>
Subject: Re: [PATCH 3/3] exec: Allow do_coredump to wait for user space
pipe readers to complete (v4)
On 07/01, Neil Horman wrote:
>
> On Wed, Jul 01, 2009 at 02:25:33PM +0200, Oleg Nesterov wrote:
> > On 07/01, Neil Horman wrote:
> > >
> > > On Wed, Jul 01, 2009 at 07:52:57AM +0200, Oleg Nesterov wrote:
> > > > > This extra count is reclaimed in
> > > > > + * wait_for_dump_helpers
> > > > > + */
> > > > > + pipe = file->f_path.dentry->d_inode->i_pipe;
> > > > > + pipe_lock(pipe);
> > > > > + pipe->readers++;
> > > > > + pipe_unlock(pipe);
> > > >
> > > > why should we inc ->readers in advance?
> > > >
> > > Read the comment immediately above it and look at the filp_close path. We inc
> > > ->readers in advance so as to prevent pipe_inode_info getting freed between the
> > > time we write out the core file and the time we wait on the pipe.
> >
> > Can't understand.
> >
> > call_usermodehelper_stdinpipe() creates 2 files, both share the same
> > inode/pipe_inode_info (->f_path actually).
> >
> > Until we close the file returned by call_usermodehelper_pipe(),
> > pipe_inode_info can't go away.
> >
> > > If the
> > > userspace helper exits in between those points we inode->i_pipe will be null by
> > > the time we get to wait_for_dump_helpers.
> >
> > See above. Can't understand how this can happen.
> >
> Yes, I apologize, in reviewing that code, I don't see how it could happen
> either. I think that I must have changed to things at once and gotten erroneous
> results in my testing (most likely I did the wait_for_dump_helpers after the
> filp_close and that cause the race).
Yes, this can explain the bug you hit.
Anyway. I appiled my patch and tested it with "!/bin/true" in
proc/sys/core_pattern. It works even if I add
schedule_timeout_interruptible(3*HZ) before binfmt->core_dump()
to make sure core_pattern task exits before we start to wait.
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists