From a2fe33404146426e1a7690061969a6457a791670 Mon Sep 17 00:00:00 2001 From: deraadt Date: Fri, 15 Dec 1995 02:25:39 +0000 Subject: [PATCH] clamp maxproc to not exceed pt space --- sys/arch/mvme68k/mvme68k/pmap.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sys/arch/mvme68k/mvme68k/pmap.c b/sys/arch/mvme68k/mvme68k/pmap.c index d1bc4bf8819..8860f17b7b3 100644 --- a/sys/arch/mvme68k/mvme68k/pmap.c +++ b/sys/arch/mvme68k/mvme68k/pmap.c @@ -1,4 +1,4 @@ -/* $Id: pmap.c,v 1.3 1995/11/28 20:43:19 deraadt Exp $ */ +/* $Id: pmap.c,v 1.4 1995/12/15 02:25:39 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -474,7 +474,17 @@ bogons: * map where we want it. */ addr = M68K_PTBASE; - s = min(M68K_PTMAXSIZE, maxproc*M68K_MAX_PTSIZE); + if ((M68K_PTMAXSIZE / M68K_MAX_PTSIZE) < maxproc) { + s = M68K_PTMAXSIZE; + /* + * XXX We don't want to hang when we run out of + * page tables, so we lower maxproc so that fork() + * will fail instead. Note that root could still raise + * this value via sysctl(2). + */ + maxproc = (M68K_PTMAXSIZE / M68K_MAX_PTSIZE); + } else + s = (maxproc * M68K_MAX_PTSIZE); addr2 = addr + s; rv = vm_map_find(kernel_map, NULL, 0, &addr, s, TRUE); if (rv != KERN_SUCCESS) -- 2.20.1