diff options
| author | William Lee Irwin III <wli@holomorphy.com> | 2004-10-18 18:10:55 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-10-18 18:10:55 -0700 |
| commit | b29bc67075152ce361292cd3f923d7faee1eeef7 (patch) | |
| tree | 5c4981efe7c00731d8235f19320c534c03c8d2cd /kernel/pid.c | |
| parent | 7c11d7fc7017101d6910ef2fe03c83149513c29f (diff) | |
[PATCH] pidhashing: enforce PID_MAX_LIMIT in sysctls
The pid_max sysctl doesn't enforce PID_MAX_LIMIT or sane lower bounds.
RESERVED_PIDS + 1 is the minimum pid_max that won't break alloc_pidmap(), and
PID_MAX_LIMIT may not be aligned to 8*PAGE_SIZE boundaries for unusual values
of PAGE_SIZE, so this also rounds up PID_MAX_LIMIT to it.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel/pid.c')
| -rw-r--r-- | kernel/pid.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/pid.c b/kernel/pid.c index 382c9b2b1f36..21024b7ae37c 100644 --- a/kernel/pid.c +++ b/kernel/pid.c @@ -36,7 +36,10 @@ int last_pid; #define RESERVED_PIDS 300 -#define PIDMAP_ENTRIES (PID_MAX_LIMIT/PAGE_SIZE/8) +int pid_max_min = RESERVED_PIDS + 1; +int pid_max_max = PID_MAX_LIMIT; + +#define PIDMAP_ENTRIES ((PID_MAX_LIMIT + 8*PAGE_SIZE - 1)/PAGE_SIZE/8) #define BITS_PER_PAGE (PAGE_SIZE*8) #define BITS_PER_PAGE_MASK (BITS_PER_PAGE-1) #define mk_pid(map, off) (((map) - pidmap_array)*BITS_PER_PAGE + (off)) |
