Subject: CVS commit: src/sys
To: None <>
From: Christos Zoulas <>
List: source-changes
Date: 11/21/2006 14:32:27
Module Name:	src
Committed By:	christos
Date:		Tue Nov 21 14:32:27 UTC 2006

Modified Files:
	src/sys/arch/amd64/amd64: netbsd32_machdep.c
	src/sys/arch/sparc64/sparc64: netbsd32_machdep.c
	src/sys/compat/linux32/arch/amd64: linux32_machdep.c
	src/sys/compat/netbsd32: netbsd32.h netbsd32_netbsd.c

Log Message:
From Nicolas Joly:

> 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.

The fix is to use `dosetrlimit()' to ensure the needed copy-on-write
behaviour for shared structure.

To generate a diff of this commit:
cvs rdiff -r1.28 -r1.29 src/sys/arch/amd64/amd64/netbsd32_machdep.c
cvs rdiff -r1.63 -r1.64 src/sys/arch/sparc64/sparc64/netbsd32_machdep.c
cvs rdiff -r1.1 -r1.2 src/sys/compat/linux32/arch/amd64/linux32_machdep.c
cvs rdiff -r1.54 -r1.55 src/sys/compat/netbsd32/netbsd32.h
cvs rdiff -r1.112 -r1.113 src/sys/compat/netbsd32/netbsd32_netbsd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.