From owner-cvs-sys Wed Jan 29 11:22:43 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id LAA16574 for cvs-sys-outgoing; Wed, 29 Jan 1997 11:22:43 -0800 (PST) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id LAA16380; Wed, 29 Jan 1997 11:17:37 -0800 (PST) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.3/8.6.9) id GAA10699; Thu, 30 Jan 1997 06:11:38 +1100 Date: Thu, 30 Jan 1997 06:11:38 +1100 From: Bruce Evans Message-Id: <199701291911.GAA10699@godzilla.zeta.org.au> To: bde@zeta.org.au, swallace@ece.uci.edu Subject: Re: cvs commit: src/sys/i386/linux imgact_linux.c Cc: cvs-all@freefall.freebsd.org, CVS-committers@freefall.freebsd.org, cvs-sys@freefall.freebsd.org, dyson@freebsd.org, jkh@freefall.freebsd.org Sender: owner-cvs-sys@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >>> Modified: sys/i386/linux imgact_linux.c >>> Log: >>> *Ahem* - opt_rlimit.h does not exist in the LKM case. This was another >>> 2.2 build-breaker.. :( >> ... >> The correct fix seems to be particularly easy in this case. Old code: >> ... >> Just remove the bogus check against MAXDSIZ. The correct limit (rlim_cur) >> is already checked. rlim_cur <= MAXDSIZ, so checking against MAXDSIZ is >> currently a no-op. >Bruce, no one has done anything about this "wrong" fix of Jordan's. >Do you want to implement your idea? It's still in 2.2R. I just fixed it locally. Since it's cosmetic, I won't commit it for a while. imgact_aout.c and imgact_gzip.c also do the unnecssary check and have to include the options file for it. Fixed. I noticed several related non-cosmetic problems: - imgact_elf.c and imgact_coff.c don't seem to limit the text or data sections at all. An executable with a too-large data section will probably crash early when it tries to extend the break. - the text limit of MAXTSIZ is not configurable either statically or with setrlimit(). It's default of 16M is rather small. It seems to be only used in imgact_aout.c and imgact_aout.c. More executable pages can be allocated using mmap(). - mmap() doesn't honor the data limit either. The only effective memory limits are the RSS limit and the size of swap. This is demonstrated by the enclosed program. It uses all of swap. read-only and MAP_SHARED variations of it demonstrate panics and nfs paging bugs. BTW, how do you generate files from the linux syscalls.master? There should be a makefile as in /sys/kern. Bruce #include #include #include #include int main(void) { int fd, i; caddr_t p; fd = open("zz", O_RDWR); if (fd == -1) perror("open"); while (1) { p = mmap(NULL, 128 * 4096, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, (off_t)0); if (p == MAP_FAILED) perror("mmap"); printf("%p %p\n", sbrk(0), p); for (i = 0; i < 128 * 4096; i += 4096) *(volatile int *)((char *)p + i) = 1; } }