From: Andreas Gruenbacher <agruen@suse.de>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Marcelo Tosatti <marcelo@conectiva.com.br>,
Alan Cox <alan@lxorguk.ukuu.org.uk>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] 2.4: Fix steal_locks race
Date: 09 Aug 2003 05:30:16 +0200 [thread overview]
Message-ID: <1060399816.1798.38.camel@bree.suse.de> (raw)
In-Reply-To: <20030809031945.GA12102@gondor.apana.org.au>
On Sat, 2003-08-09 at 05:19, Herbert Xu wrote:
> On Sat, Aug 09, 2003 at 05:13:52AM +0200, Andreas Gruenbacher wrote:
> > On Sat, 9 Aug 2003, Herbert Xu wrote:
> >
> > > On Sat, Aug 09, 2003 at 04:04:53AM +0200, Andreas Gruenbacher wrote:
> > > >
> > > > > My patch is buggy too. If a file is closed by another clone between
> > > > > the two steal_locks calls the lock will again be lost. Fortunately
> > > > > this much harder to trigger than the previous bug.
> > > >
> > > > I think this is not a strict bug---this scenario is not covered by POSIX
> > > > in the first place. Unless lock stealing is done atomically with
> > > > unshare_files there is a window of oportunity between unshare_files() and
> > > > steal_locks(), so locks can still get lost.
> > >
> > > It's not a standard compliance issue. In this case the lock will never
> > > be released and it will eventually lead to a crash when someone reads
> > > /proc/locks.
> >
> > I don't see how this would happen. Could you please elaborate?
>
> Suppose that A and B share current->files and fd has a POSIX lock on it.
>
> A B
> unshare_files
> steal_locks
> close(fd)
> exec fails
> steal_locks
> put_files_struct
>
> The close in B fails to release the lock as it has been stolen by the
> new files structure. The second steal_locks sets the fl_owner back to
> the original files structure which no longer has fd in it and hence can
> never release that lock. The put_files_struct doesn't release the lock
> either since it is now owned by the original file structure.
In the patch I've sent there is no stealing back of locks, so that case
does not exist.
Cheers,
--
Andreas Gruenbacher <agruen@suse.de>
SuSE Labs, SuSE Linux AG <http://www.suse.de/>
next prev parent reply other threads:[~2003-08-09 3:28 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-08 10:53 Herbert Xu
2003-08-09 1:07 ` Herbert Xu
2003-08-09 1:11 ` [PATCH] 2.4: Restore current->files in flush_old_exec Herbert Xu
2003-08-09 1:48 ` Andreas Gruenbacher
2003-08-09 1:48 ` Herbert Xu
2003-08-09 2:20 ` Andreas Gruenbacher
2003-08-09 2:53 ` Herbert Xu
2003-08-09 3:01 ` Andreas Gruenbacher
2003-08-09 3:19 ` Andreas Gruenbacher
[not found] ` <Pine.LNX.4.53.0308090554160.18879@Chaos.suse.de>
[not found] ` <20030809100518.GA14688@gondor.apana.org.au>
2003-08-09 10:41 ` Andreas Gruenbacher
2003-08-09 1:46 ` [PATCH] 2.4: Fix steal_locks race Andreas Gruenbacher
2003-08-09 2:04 ` Andreas Gruenbacher
2003-08-09 2:52 ` Herbert Xu
2003-08-09 3:13 ` Andreas Gruenbacher
2003-08-09 3:19 ` Herbert Xu
2003-08-09 3:30 ` Andreas Gruenbacher [this message]
2003-08-09 2:59 ` Andreas Gruenbacher
2003-08-09 3:04 ` Herbert Xu
2003-08-09 3:17 ` Andreas Gruenbacher
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=1060399816.1798.38.camel@bree.suse.de \
--to=agruen@suse.de \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo@conectiva.com.br \
/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
all inboxes | Powered by JetHome®