Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 14 Sep 1996 12:26:11 -0700 (PDT)
From:      dillon@backplane.com
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   kern/1610: mmap() of unassociated memory + mlock() can == kernel panic
Message-ID:  <199609141926.MAA25882@apollo.backplane.com>
Resent-Message-ID: <199609141930.MAA03116@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         1610
>Category:       kern
>Synopsis:       mmap() of unassociated memory + mlock() can == kernel panic
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Sep 14 12:30:00 PDT 1996
>Last-Modified:
>Originator:     Matthew Dillon
>Organization:
self
>Release:        FreeBSD 2.1-STABLE i386
>Environment:

	Pentium class machine, 64 MBytes of ram, Adaptec PCI SCSI

>Description:

	If I use mmap() to map a large (16 or 32 MBytes) amount of
	unassociated memory, then use mlock() to lock it, touching
	the memory will result in a kernel panic... something about
	a page directory missing (sorry, don't have the exact error).

	However, if I touch the memory BEFORE locking it, I can then
	lock the memory and use it normally.

	I believe the problem may be due to mmap() mapping the pages
	as zero-fill.  When you allocate more then one segment's worth
	of memory, the page table sharing is probably generating
	a condition that the system cannot handle when the memory
	is touched for the first time AFTER being locked.

>How-To-Repeat:

	mmap a large shared read-write area, unassociated with any file,
	that is larger then or equal to 16 MBytes on an unloaded
	machine.

	do not touch the allocated memory yet.

	lock the entire memory (make sure your resource limits are set
	such that it allows you to lock the entire area).

	write to a random page or pages in the memory area.  The kernel
	will panic with a missing page directory fault or something
	similiar.

>Fix:
	
	

>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199609141926.MAA25882>