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.\" 18dad0f566SMike Pritchard.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 19dad0f566SMike Pritchard.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20dad0f566SMike Pritchard.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21dad0f566SMike Pritchard.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE 22dad0f566SMike Pritchard.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23dad0f566SMike Pritchard.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24dad0f566SMike Pritchard.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25dad0f566SMike Pritchard.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26dad0f566SMike Pritchard.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27dad0f566SMike Pritchard.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28dad0f566SMike Pritchard.\" POSSIBILITY OF SUCH DAMAGE. 29dad0f566SMike Pritchard.\" 30dad0f566SMike Pritchard.Dd June 16, 1996 311e133bd4SMike Pritchard.Dt KERNACC 9 323d45e180SRuslan Ermilov.Os 33dad0f566SMike Pritchard.Sh NAME 34dad0f566SMike Pritchard.Nm kernacc , 35dad0f566SMike Pritchard.Nm useracc 36dad0f566SMike Pritchard.Nd check memory regions for accessibility 37dad0f566SMike Pritchard.Sh SYNOPSIS 38f16b3c0dSChad David.In sys/param.h 39f16b3c0dSChad David.In sys/proc.h 4032eef9aeSRuslan Ermilov.In vm/vm.h 4132eef9aeSRuslan Ermilov.In vm/vm_extern.h 42dad0f566SMike Pritchard.Ft int 43c3dfdfd1SAlfred Perlstein.Fn kernacc "void *addr" "int len" "int rw" 44dad0f566SMike Pritchard.Ft int 45c3dfdfd1SAlfred Perlstein.Fn useracc "void *addr" "int len" "int rw" 46dad0f566SMike Pritchard.Sh DESCRIPTION 47dad0f566SMike PritchardThe 48dad0f566SMike Pritchard.Fn kernacc 49dad0f566SMike Pritchardand 50dad0f566SMike Pritchard.Fn useracc 51dad0f566SMike Pritchardfunctions check whether operations of the type specified in 52dad0f566SMike Pritchard.Fa rw 53dad0f566SMike Pritchardare permitted in the range of virtual addresses given by 54dad0f566SMike Pritchard.Fa addr 55dad0f566SMike Pritchardand 56dad0f566SMike Pritchard.Fa len . 57dad0f566SMike PritchardThe possible values of 58dad0f566SMike Pritchard.Fa rw 5902c58685SPoul-Henning Kampare any bitwise combination of 6002c58685SPoul-Henning Kamp.Dv VM_PROT_READ , 6102c58685SPoul-Henning Kamp.Dv VM_PROT_WRITE 62dad0f566SMike Pritchardand 6302c58685SPoul-Henning Kamp.Dv VM_PROT_EXECUTE . 64dad0f566SMike Pritchard.Fn kernacc 65dad0f566SMike Pritchardchecks addresses in the kernel address space, while 66dad0f566SMike Pritchard.Fn useracc 67dad0f566SMike Pritchardconsiders 68dad0f566SMike Pritchard.Fa addr 691111b49cSSheldon Hearnto represent an user space address. 701111b49cSSheldon HearnThe process context to use for this 71dad0f566SMike Pritchardoperation is taken from the global variable 72dad0f566SMike Pritchard.Va curproc . 73dad0f566SMike Pritchard.Sh RETURN VALUES 7402c58685SPoul-Henning KampBoth functions return boolean true if the type of access specified 7502c58685SPoul-Henning Kampby 76dad0f566SMike Pritchard.Fa rw 771111b49cSSheldon Hearnis permitted. 781111b49cSSheldon HearnOtherwise boolean false is returned. 79dad0f566SMike Pritchard.Sh BUGS 8002c58685SPoul-Henning KampThe process pointer should be passed in as an argument to 8102c58685SPoul-Henning Kamp.Fn useracc . 82