Re: [PATCH] kernel: limit a value of ns_last_pid to (0, max_pid)

2012-09-04 Thread Oleg Nesterov
On 09/04, Andrew Vagin wrote: > > The kernel doesn't check pid on a negative values, so if > you would try to write -2 in /proc/sys/kernel/ns_last_pid, > you will get a kernel panic. > > In this case the next pid is -1, and alloc_pidmap will try to access > to a nonexistent pidmap. > > map = &pid_n

[PATCH] kernel: limit a value of ns_last_pid to (0, max_pid)

2012-09-04 Thread Andrew Vagin
The kernel doesn't check pid on a negative values, so if you would try to write -2 in /proc/sys/kernel/ns_last_pid, you will get a kernel panic. In this case the next pid is -1, and alloc_pidmap will try to access to a nonexistent pidmap. map = &pid_ns->pidmap[pid/BITS_PER_PAGE]; Cc: Andrew Mort