Date: Sun, 13 Jun 1999 23:24:10 -0700 (PDT) From: Jason Evans <jasone@canonware.com> To: freebsd-stable@freebsd.org Subject: Kernel panic with mmap() and VM_STACK Message-ID: <Pine.BSF.4.05.9906132302340.13149-100000@sturm.canonware.com>
next in thread | raw e-mail | index | archive | help
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 <stdio.h> #include <sys/types.h> #include <sys/mman.h> #include <errno.h> 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 <jasone@canonware.com> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.05.9906132302340.13149-100000>