From owner-freebsd-stable Sun Jun 13 23:34:47 1999 Delivered-To: freebsd-stable@freebsd.org Received: from sturm.canonware.com (canonware.com [204.107.140.54]) by hub.freebsd.org (Postfix) with ESMTP id CA10E14C30 for ; Sun, 13 Jun 1999 23:34:45 -0700 (PDT) (envelope-from jasone@canonware.com) Received: from localhost (jasone@localhost) by sturm.canonware.com (8.8.8/8.8.8) with ESMTP id XAA13204 for ; Sun, 13 Jun 1999 23:24:10 -0700 (PDT) (envelope-from jasone@canonware.com) Date: Sun, 13 Jun 1999 23:24:10 -0700 (PDT) From: Jason Evans To: freebsd-stable@freebsd.org Subject: Kernel panic with mmap() and VM_STACK Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG While experimenting with growable stacks in libc_r, I discovered that the following program reliably causes a panic in vm_map_stack() for -stable as of today and 3.2-release (but it works fine for -current as of yesterday). I've looked through the code, and with my less than adequate knowledge of the VM, guessed that the problem is actually occurring in the call to vm_map_insert(). However, I'm having difficulties getting remote debugging to work, ddb is a mystery to me, and the weekend is over, so maybe someone else can take a look at this. The stack trace is: panic ("Bad entry start/end for new stack entry") vm_map_stack vm_mmap mmap syscall A related question: why does mmap() fail with MAP_STACK if a NULL pointer is specified? I'm guessing that it's because pages aren't actually committed for the mapping until they are faulted, thus it's the user's responsibility to choose a location that doesn't cause conflicts with other mappings. The program: ------ #include #include #include #include int main() { void * addr; addr = mmap((void *) 0x280e2000, 8192, PROT_READ | PROT_WRITE, MAP_STACK, -1, 0); if (MAP_FAILED == addr) { printf("mmap() error: %s\n", strerror(errno)); } else { printf("mmap() returned space at %p\n", addr); } return 0; } ------ Jason Jason Evans http://www.canonware.com/~jasone Home phone: (650) 856-8204 Work phone: (415) 808-8742 "I once knew a happy medium. Her name was Zohar." - James Foster To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message