[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130604173500.GB22223@redhat.com>
Date: Tue, 4 Jun 2013 19:35:00 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Al Viro <viro@...IV.linux.org.uk>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Michal Hocko <mhocko@...e.cz>,
Sergey Dyasly <dserrg@...il.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 4/4] proc: avoid ->f_pos overflows in
proc_task_readdir() paths
On 06/04, Al Viro wrote:
>
> On Mon, Jun 03, 2013 at 09:07:05PM +0200, Oleg Nesterov wrote:
> > 1. proc_task_readdir() truncates f_pos to long, this can lead
> > to wrong result on 32bit.
> >
> > 2. first_tid() truncates f_pos to int, this is wrong even on
> > 64bit.
> >
> > We could check that f_pos < PID_MAX or even INT_MAX in
> > proc_task_readdir(), but this patch simply checks the
> > potential overflow in first_tid(), this check is nop on
> > 64bit. We do not care if it was negative and the new
> > unsigned value is huge, all we need to ensure is that we
> > never wrongly return !NULL.
> >
> > 3. Remove the 2nd "nr != 0" check before get_nr_threads(),
> > nr_threads == 0 is not distinguishable from !pid_task()
> > above.
>
> Oleg, please take a look at the series in vfs.git#experimental; at the very
> least, we don't want to access file->f_pos in any foo_readdir() - it's too
> messy and race-prone. It's pretty much independent from the issues you
> are dealing with, but let's avoid creating pointless conflicts...
Yes, thanks.
Sadly, 3/4 conflicts with 08c35e10 too. I'll rediff/resend this
cleanup later then.
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