Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Apr 2014 09:30:32 GMT
From:      "Ivan A. Kosarev" <ikosarev@accesssoftek.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/188911: sysctl(KERN_PROC_VMMAP) takes too long
Message-ID:  <201404230930.s3N9UWV2088429@cgiserv.freebsd.org>
Resent-Message-ID: <201404230940.s3N9e1Fw026466@freefall.freebsd.org>

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

>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@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:



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