Re: [RFC][PATCH] ps command race fix take2 [4/4] proc_pid_readdir

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On 22 Aug 2006 13:11:30 +0200
Andi Kleen <[email protected]> wrote:

> KAMEZAWA Hiroyuki <[email protected]> writes:
> > proc_pid_readdir() by list_token.
> > 
> > Remember 'where we are reading' by inserting a token in the list.
> > It seems a bit complicated because of RCU but what we do is very simple.
> > 
> What happens when you have multiple readers at the same time? Can't
> the tokens then be mixed up?
multiple readers will insert their own token to a list. And list_next_rcu_skiptoken()
skips all token (not-data). it's used by next_task().

> >+		/* this small kmalloc() can fail in rare case, but readdir()
> >+		 * is not allowed to return ENOMEM. retrying is reasonable. */
> Who disallows this? Such retry loops are normally discouraged 
> because they can lead to deadlocks in OOM situations.
> I think it would be better to just return ENOMEM.

Hmm, to be honest, not disallowed. but not allowed. The apps don't expect
readdir(3) failed with -ENOMEM. 
But yes, ps command or ls /proc may be caught in the kernel for some time.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at
Please read the FAQ at

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux