[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m1sk7qu5dl.fsf@fess.ebiederm.org>
Date: Tue, 23 Mar 2010 13:53:26 -0700
From: ebiederm@...ssion.com (Eric W. Biederman)
To: Oleg Nesterov <oleg@...hat.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Alexey Dobriyan <adobriyan@...il.com>,
Roland McGrath <roland@...hat.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH -mm 0/3] proc: task->signal can't be NULL
Oleg Nesterov <oleg@...hat.com> writes:
> On 03/22, Eric W. Biederman wrote:
>>
>> Oleg Nesterov <oleg@...hat.com> writes:
>
> If a bad user passes the large f_pos > nr_threads then this check
> eliminates the unneeded while_each_thread() loop, yes. But it can use
> f_pos == nr_threads and provoke the same loop?
>
> Or. just do rewinddir() + readdir(big_count). Now we walk through the
> list and call proc_task_fill_cache() for each entry.
>
> IOW, I don't understand how this check can help from the DOS pov.
It can't. I just want it to be able to ;)
>> However:
>> proc_task_getattr uses get_nr_threads to get it's nlink count correct.
>
> Yes. But we don't need the exactly precise number here if we are
> racing with fork/exit ?
>
>> Not walking the thread list to get the number of threads seems like an
>> important cpu time saving measure.
>
> Not sure I understand... Also, first_tid() could use sig->sigcnt (the
> reference counter) instead of sig->count. This is not the same, but I
> think in practice this is fine.
We need a value that can be computed in constant time, and is not correct
except when the number of threads is actively changing.
> OK. Let's keep this counter as "int nr_thread".
>
> Besides, when I tried to re-implement get_nr_threads() using signal->live
> I got the really ugly result ;)
Sounds good.
Eric
--
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