Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Aug 2012 02:06:12 -0700 (PDT)
From:      Don Lewis <truckman@FreeBSD.org>
To:        zont@FreeBSD.org
Cc:        alc@FreeBSD.org, alan.l.cox@gmail.com, freebsd-arch@FreeBSD.org, avg@FreeBSD.org, bryan@shatow.net
Subject:   Re: [patch] unprivileged mlock(2)
Message-ID:  <201208290906.q7T96C9j032802@gw.catspoiler.org>
In-Reply-To: <503DD433.2030108@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 29 Aug, Andrey Zonov wrote:

> But can we do better and don't lock process's memory in sysctl handlers?

It is necessary to wire the userland buffer to make sure that the sysctl
handler doesn't page fault while it is copying data into or out of the
buffer.  The handler may be holding a mutex that protects the kernel
data structure that it is accessing, in which case the handler is not
allowed to block on a page fault.

If the handler allocated a buffer in kernel memory before grabbing the
mutex, the it would be possible to avoid wiring the userland buffer, but
this would tie up just as much non-pageable memory and an extra data
copy would be required.





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