From owner-freebsd-arch@FreeBSD.ORG Wed Aug 29 09:06:30 2012 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1F7F4106566B; Wed, 29 Aug 2012 09:06:30 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from gw.catspoiler.org (gw.catspoiler.org [75.1.14.242]) by mx1.freebsd.org (Postfix) with ESMTP id DC1308FC0C; Wed, 29 Aug 2012 09:06:29 +0000 (UTC) Received: from FreeBSD.org (mousie.catspoiler.org [192.168.101.2]) by gw.catspoiler.org (8.13.3/8.13.3) with ESMTP id q7T96C9j032802; Wed, 29 Aug 2012 02:06:16 -0700 (PDT) (envelope-from truckman@FreeBSD.org) Message-Id: <201208290906.q7T96C9j032802@gw.catspoiler.org> Date: Wed, 29 Aug 2012 02:06:12 -0700 (PDT) From: Don Lewis To: zont@FreeBSD.org In-Reply-To: <503DD433.2030108@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/plain; charset=us-ascii 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) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Aug 2012 09:06:30 -0000 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.