* [folded-merged] pid-replace-pid-bitmap-implementation-with-idr-api-v6-fix.patch removed from -mm tree
@ 2017-11-17 22:29 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2017-11-17 22:29 UTC (permalink / raw)
To: avagin, gs051095, oleg, mm-commits
The patch titled
Subject: pid: restore the old behaviour of the ns_last_pid sysctl
has been removed from the -mm tree. Its filename was
pid-replace-pid-bitmap-implementation-with-idr-api-v6-fix.patch
This patch was dropped because it was folded into pid-replace-pid-bitmap-implementation-with-idr-api.patch
------------------------------------------------------
From: Andrei Vagin <avagin@openvz.org>
Subject: pid: restore the old behaviour of the ns_last_pid sysctl
CRIU uses ns_last_pid to fork a process with a specified pid. For
example, if we need to create a process with the pid of 10000, we write
9999 into /proc/sys/kernel/ns_last_pid
$ echo 9999 > /proc/sys/kernel/ns_last_pid; sh -c 'echo $$'
10000
This behaviour has been broken and now if we write 9999 to ns_last_pid,
a process will get the pid 9999. This patch restores the old behaviour.
v2: make code a bit more readable // Oleg
Link: http://lkml.kernel.org/r/20171106183144.16368-1-avagin@openvz.org
fixes: ("pid: replace pid bitmap implementation with IDR API")
Signed-off-by: Andrei Vagin <avagin@openvz.org>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Cc: Gargi Sharma <gs051095@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
kernel/pid_namespace.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff -puN kernel/pid_namespace.c~pid-replace-pid-bitmap-implementation-with-idr-api-v6-fix kernel/pid_namespace.c
--- a/kernel/pid_namespace.c~pid-replace-pid-bitmap-implementation-with-idr-api-v6-fix
+++ a/kernel/pid_namespace.c
@@ -287,6 +287,7 @@ static int pid_ns_ctl_handler(struct ctl
{
struct pid_namespace *pid_ns = task_active_pid_ns(current);
struct ctl_table tmp = *table;
+ int ret, next;
if (write && !ns_capable(pid_ns->user_ns, CAP_SYS_ADMIN))
return -EPERM;
@@ -297,8 +298,14 @@ static int pid_ns_ctl_handler(struct ctl
* it should synchronize its usage with external means.
*/
- tmp.data = &pid_ns->idr.idr_next;
- return proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
+ next = idr_get_cursor(&pid_ns->idr) - 1;
+
+ tmp.data = &next;
+ ret = proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos);
+ if (!ret && write)
+ idr_set_cursor(&pid_ns->idr, next + 1);
+
+ return ret;
}
extern int pid_max;
_
Patches currently in -mm which might be from avagin@openvz.org are
pid-replace-pid-bitmap-implementation-with-idr-api.patch
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-11-17 22:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-17 22:29 [folded-merged] pid-replace-pid-bitmap-implementation-with-idr-api-v6-fix.patch removed from -mm tree akpm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).