+ pid-delete-reserved_pids.patch added to -mm tree

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

 



The patch titled
     Subject: pid: delete RESERVED_PIDS
has been added to the -mm tree.  Its filename is
     pid-delete-reserved_pids.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/pid-delete-reserved_pids.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/pid-delete-reserved_pids.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Alexey Dobriyan <adobriyan@xxxxxxxxx>
Subject: pid: delete RESERVED_PIDS

RESERVED_PIDS had a noble goal: to protect root from PID exhaustion since
at least ~2.5.40 except it never did that because there was no capability
or uid checks.

Allow small pids to be allocated after rollover, there is nothing sacred
about them.

Resource exhaustion should be handled by rlimits and/or kernel memory
accounting.

Link: http://lkml.kernel.org/r/20170909202629.GA4791@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@xxxxxxxxx>
Cc: "Eric W. Biederman" <ebiederm@xxxxxxxxxxxx>
Cc: Kees Cook <keescook@xxxxxxxxxxxx>
Cc: Oleg Nesterov <oleg@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 kernel/pid.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff -puN kernel/pid.c~pid-delete-reserved_pids kernel/pid.c
--- a/kernel/pid.c~pid-delete-reserved_pids
+++ a/kernel/pid.c
@@ -48,9 +48,7 @@ struct pid init_struct_pid = INIT_STRUCT
 
 int pid_max = PID_MAX_DEFAULT;
 
-#define RESERVED_PIDS		300
-
-int pid_max_min = RESERVED_PIDS + 1;
+int pid_max_min = 301;
 int pid_max_max = PID_MAX_LIMIT;
 
 static inline int mk_pid(struct pid_namespace *pid_ns,
@@ -157,13 +155,13 @@ static int alloc_pidmap(struct pid_names
 
 	pid = last + 1;
 	if (pid >= pid_max)
-		pid = RESERVED_PIDS;
+		pid = 1;
 	offset = pid & BITS_PER_PAGE_MASK;
 	map = &pid_ns->pidmap[pid/BITS_PER_PAGE];
 	/*
 	 * If last_pid points into the middle of the map->page we
 	 * want to scan this bitmap block twice, the second time
-	 * we start with offset == 0 (or RESERVED_PIDS).
+	 * we start with offset == 0.
 	 */
 	max_scan = DIV_ROUND_UP(pid_max, BITS_PER_PAGE) - !offset;
 	for (i = 0; i <= max_scan; ++i) {
@@ -203,7 +201,7 @@ static int alloc_pidmap(struct pid_names
 			offset = 0;
 		} else {
 			map = &pid_ns->pidmap[0];
-			offset = RESERVED_PIDS;
+			offset = 1;
 			if (unlikely(last == offset))
 				break;
 		}
_

Patches currently in -mm which might be from adobriyan@xxxxxxxxx are

proc-uninline-name_to_int.patch
proc-use-do-while-in-name_to_int.patch
seq_file-delete-small-value-optimization.patch
pid-delete-reserved_pids.patch
pid-delete-struct-pidmap-nr_free.patch

--
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux