Subject: Re: limit problems
To: None <current-users@NetBSD.ORG>
From: John F. Woods <jfw@jfwhome.funhouse.com>
List: current-users
Date: 02/14/1997 10:25:42
Someone whose name I've lost hypothesized that csh's "limit stack 512"
was calculating the limit in bytes, rather than kbytes (causing
programs not to function thereafter).  It's more interesting than
that.  csh does, in fact, multiply numbers without explicit units by
the appropriate unit, but it also adds a fuzz factor since it's using
floating point numbers, so it ends up setting the stack limit to (512
+ 0.5) * 1024, or 524800 bytes.  This ends up causing exec'ed programs
to generate an abort trap.

It turns out that *any* stack limit which is not a multiple of 4K
causes this.  (Try 513k, with the k!)  I believe that kern_resource.c
is properly doing the page-round when it figures out what to do to
the memory map, but that exec_aout.c does the calculations without
the appropriate page rounding.  (I didn't spend enough time reading
exec_aout to identify the incorrect code, though.)