[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110817120405.GA10709@redhat.com>
Date: Wed, 17 Aug 2011 14:04:05 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Matt Fleming <matt@...sole-pimps.org>
Cc: linux-kernel@...r.kernel.org, Petr Vandrovec <petr@...drovec.name>,
Al Viro <viro@...iv.linux.org.uk>,
Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCH 40/41] ncpfs: Use set_current_blocked()
On 08/16, Matt Fleming wrote:
>
> On Tue, 2011-08-16 at 19:56 +0200, Oleg Nesterov wrote:
> > On 08/11, Matt Fleming wrote:
> > >
> > > As described in e6fa16ab ("signal: sigprocmask() should do
> > > retarget_shared_pending()") the modification of current->blocked is
> > > incorrect as we need to check whether the signal we're about to block
> > > is pending in the shared queue.
> >
> > I'd wish I could understand this code but this seems impossible ;)
>
> Yeah, I gave up after staring at it for about twenty minutes. I couldn't
> fathom the logic behind it.
>
> > IOW, "This doesn't seem right at all." looks reasonable, and the
> > PF_EXITING adds even more confusion.
>
> Definitely. If I was more confident in this area of the kernel I would
> have just deleted it ;-)
Same here ;)
> Because the thread doesn't hold ->siglock over do_ncp_rpc_call() another
> thread could change the signal handler for SIGINT or SIGQUIT mid-call.
> Which makes the code under "if (server->m.flags & NCP_MOUNT_INTR)"
> pointless.
(indeed, and see below)
> > Why do we take ->siglock in the first place?
> >
> > I think it is not needed. We can calculate mask/blocked lockless and
> > use set_task_blocked(). This also makes sense because __set_task_blocked
> > is not exported ;)
>
> Eek! Sorry, I didn't realise this didn't compile.
>
> > the sighand->action[] checks are racy anyway in the mt case, siglock
> > can't help.
>
> Hmm.. really? I thought that ->siglock serialised modifications to
> sighand->action[] even in the mt case, no?
Sure. But another thread can change sighand->action[] right after we
drop ->siglock. So how can this lock help? We simply read the word,
this is atomic and doesn't need the locking.
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