Subject: Re: setrlimit(2) strange behaviour under compat_netbsd32
To: None <>
From: Christos Zoulas <>
List: current-users
Date: 11/21/2006 14:29:58
In article <>,
Nicolas Joly  <> wrote:
>On Mon, Nov 20, 2006 at 08:42:53PM +0100, Nicolas Joly wrote:
>> I just noticed a strange setrlimit(2) behaviour under compat_netbsd32
>> (and compat_linux32) on my -current amd64 workstation ...
>> It seems that 32bits programs, running under compat_netbsd32, using
>> setrlimit force all other programs to have their maximum data size
>> fixed at 3GB, where native 64bits apps used 8GB previously.
>I tracked this one to the `netbsd32_adjust_limits()' function (called
>when creating a new process under compat_netbsd32), where data and
>stack limits are set without checking for shared `p_limit' structure
>(p_limit->p_refcnt > 1). This explain the side effect where processes
>have their limits changed when a compat_netbsd32 (or compat_linux32)
>program is run.
>What about the attached patch, that use `dosetrlimit()' to ensure the
>needed copy-on-write behaviour for shared structure.

That patch looks great! Good catch.