misc/188911: sysctl(KERN_PROC_VMMAP) takes too long
Ivan A. Kosarev
ikosarev at accesssoftek.com
Wed Apr 23 09:40:01 UTC 2014
>Number: 188911
>Category: misc
>Synopsis: sysctl(KERN_PROC_VMMAP) takes too long
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Apr 23 09:40:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator: Ivan A. Kosarev
>Release: 10.0
>Organization:
Access Softek, Inc
>Environment:
FreeBSD fbsd10.unicals.com 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260789: Thu Jan 16 22:34:59 UTC 2014 root at snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64
>Description:
With a mmap() call with a large 'size' parameter a subsequent sysctl(KERN_PROC_VMMAP) call takes too long to perform.
>How-To-Repeat:
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <dlfcn.h>
#include <fcntl.h>
#include <sys/sysctl.h>
#include <sys/user.h>
#include <sys/mman.h>
int main(void)
{
int mib[4];
size_t size;
int err;
void *p;
printf("#1\n");
p = mmap((void*) 0x3ffffffff000, 0x80000001000,
PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANON | MAP_FIXED | MAP_NORESERVE,
-1, 0);
assert(p != MAP_FAILED);
printf("#2\n");
mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
mib[2] = KERN_PROC_VMMAP;
mib[3] = getpid();
size = 0;
err = sysctl(mib, 4, NULL, &size, NULL, 0); /* takes about 40 seconds */
assert(err == 0);
printf("#3\n");
return EXIT_SUCCESS;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list