1dad0f566SMike Pritchard.\" $NetBSD: access.9,v 1.1 1996/06/16 10:38:35 pk Exp $ 2dad0f566SMike Pritchard.\" 3dad0f566SMike Pritchard.\" Copyright (c) 1996 The NetBSD Foundation, Inc. 4dad0f566SMike Pritchard.\" All rights reserved. 5dad0f566SMike Pritchard.\" 6dad0f566SMike Pritchard.\" This code is derived from software contributed to The NetBSD Foundation 7dad0f566SMike Pritchard.\" by Paul Kranenburg. 8dad0f566SMike Pritchard.\" 9dad0f566SMike Pritchard.\" Redistribution and use in source and binary forms, with or without 10dad0f566SMike Pritchard.\" modification, are permitted provided that the following conditions 11dad0f566SMike Pritchard.\" are met: 12dad0f566SMike Pritchard.\" 1. Redistributions of source code must retain the above copyright 13dad0f566SMike Pritchard.\" notice, this list of conditions and the following disclaimer. 14dad0f566SMike Pritchard.\" 2. Redistributions in binary form must reproduce the above copyright 15dad0f566SMike Pritchard.\" notice, this list of conditions and the following disclaimer in the 16dad0f566SMike Pritchard.\" documentation and/or other materials provided with the distribution. 17dad0f566SMike Pritchard.\" 3. All advertising materials mentioning features or use of this software 18dad0f566SMike Pritchard.\" must display the following acknowledgement: 19dad0f566SMike Pritchard.\" This product includes software developed by the NetBSD 20dad0f566SMike Pritchard.\" Foundation, Inc. and its contributors. 21dad0f566SMike Pritchard.\" 4. Neither the name of The NetBSD Foundation nor the names of its 22dad0f566SMike Pritchard.\" contributors may be used to endorse or promote products derived 23dad0f566SMike Pritchard.\" from this software without specific prior written permission. 24dad0f566SMike Pritchard.\" 25dad0f566SMike Pritchard.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 26dad0f566SMike Pritchard.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 27dad0f566SMike Pritchard.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 28dad0f566SMike Pritchard.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE 29dad0f566SMike Pritchard.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30dad0f566SMike Pritchard.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31dad0f566SMike Pritchard.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32dad0f566SMike Pritchard.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33dad0f566SMike Pritchard.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34dad0f566SMike Pritchard.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35dad0f566SMike Pritchard.\" POSSIBILITY OF SUCH DAMAGE. 36dad0f566SMike Pritchard.\" 377f3dea24SPeter Wemm.\" $FreeBSD$ 385bf6ab83SNik Clayton.\" 39dad0f566SMike Pritchard.Dd June 16, 1996 401e133bd4SMike Pritchard.Dt KERNACC 9 413d45e180SRuslan Ermilov.Os 42dad0f566SMike Pritchard.Sh NAME 43dad0f566SMike Pritchard.Nm kernacc , 44dad0f566SMike Pritchard.Nm useracc 45dad0f566SMike Pritchard.Nd check memory regions for accessibility 46dad0f566SMike Pritchard.Sh SYNOPSIS 47f16b3c0dSChad David.In sys/param.h 48f16b3c0dSChad David.In sys/proc.h 4932eef9aeSRuslan Ermilov.In vm/vm.h 5032eef9aeSRuslan Ermilov.In vm/vm_extern.h 51dad0f566SMike Pritchard.Ft int 52dad0f566SMike Pritchard.Fn kernacc "caddr_t addr" "int len" "int rw" 53dad0f566SMike Pritchard.Ft int 54dad0f566SMike Pritchard.Fn useracc "caddr_t addr" "int len" "int rw" 55dad0f566SMike Pritchard.Sh DESCRIPTION 56dad0f566SMike PritchardThe 57dad0f566SMike Pritchard.Fn kernacc 58dad0f566SMike Pritchardand 59dad0f566SMike Pritchard.Fn useracc 60dad0f566SMike Pritchardfunctions check whether operations of the type specified in 61dad0f566SMike Pritchard.Fa rw 62dad0f566SMike Pritchardare permitted in the range of virtual addresses given by 63dad0f566SMike Pritchard.Fa addr 64dad0f566SMike Pritchardand 65dad0f566SMike Pritchard.Fa len . 66dad0f566SMike PritchardThe possible values of 67dad0f566SMike Pritchard.Fa rw 6802c58685SPoul-Henning Kampare any bitwise combination of 6902c58685SPoul-Henning Kamp.Dv VM_PROT_READ , 7002c58685SPoul-Henning Kamp.Dv VM_PROT_WRITE 71dad0f566SMike Pritchardand 7202c58685SPoul-Henning Kamp.Dv VM_PROT_EXECUTE . 73dad0f566SMike Pritchard.Fn kernacc 74dad0f566SMike Pritchardchecks addresses in the kernel address space, while 75dad0f566SMike Pritchard.Fn useracc 76dad0f566SMike Pritchardconsiders 77dad0f566SMike Pritchard.Fa addr 781111b49cSSheldon Hearnto represent an user space address. 791111b49cSSheldon HearnThe process context to use for this 80dad0f566SMike Pritchardoperation is taken from the global variable 81dad0f566SMike Pritchard.Va curproc . 82dad0f566SMike Pritchard.Sh RETURN VALUES 8302c58685SPoul-Henning KampBoth functions return boolean true if the type of access specified 8402c58685SPoul-Henning Kampby 85dad0f566SMike Pritchard.Fa rw 861111b49cSSheldon Hearnis permitted. 871111b49cSSheldon HearnOtherwise boolean false is returned. 88dad0f566SMike Pritchard.Sh BUGS 8902c58685SPoul-Henning KampThe process pointer should be passed in as an argument to 9002c58685SPoul-Henning Kamp.Fn useracc . 91