Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/sys/mprotect.2
Show All 22 Lines | |||||||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||||||
.\" SUCH DAMAGE. | .\" SUCH DAMAGE. | ||||||||
.\" | .\" | ||||||||
.\" @(#)mprotect.2 8.1 (Berkeley) 6/9/93 | .\" @(#)mprotect.2 8.1 (Berkeley) 6/9/93 | ||||||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||||||
.\" | .\" | ||||||||
.Dd September 3, 2021 | .Dd September 7, 2021 | ||||||||
.Dt MPROTECT 2 | .Dt MPROTECT 2 | ||||||||
.Os | .Os | ||||||||
.Sh NAME | .Sh NAME | ||||||||
.Nm mprotect | .Nm mprotect | ||||||||
.Nd control the protection of pages | .Nd control the protection of pages | ||||||||
.Sh LIBRARY | .Sh LIBRARY | ||||||||
.Lb libc | .Lb libc | ||||||||
.Sh SYNOPSIS | .Sh SYNOPSIS | ||||||||
.In sys/mman.h | .In sys/mman.h | ||||||||
.Ft int | .Ft int | ||||||||
.Fn mprotect "void *addr" "size_t len" "int prot" | .Fn mprotect "void *addr" "size_t len" "int prot" | ||||||||
.Sh DESCRIPTION | .Sh DESCRIPTION | ||||||||
The | The | ||||||||
.Fn mprotect | .Fn mprotect | ||||||||
system call | system call | ||||||||
changes the specified pages to have protection | changes the specified pages to have protection | ||||||||
.Fa prot . | .Fa prot . | ||||||||
.Pp | .Pp | ||||||||
Currently these protection bits are known, | The | ||||||||
which can be combined, OR'd together: | .Fa prot | ||||||||
argument shall be | |||||||||
.Dv PROT_NONE | |||||||||
(no permissions at all) | |||||||||
markjUnsubmitted Done Inline Actions
markj: | |||||||||
or the bitwise | |||||||||
.Em or | |||||||||
of one or more of the following values: | |||||||||
.Pp | .Pp | ||||||||
.Bl -tag -width ".Dv PROT_WRITE" -compact | .Bl -tag -width ".Dv PROT_WRITE" -compact | ||||||||
.It Dv PROT_NONE | |||||||||
No permissions at all. | |||||||||
.It Dv PROT_READ | .It Dv PROT_READ | ||||||||
Done Inline ActionsTechnically, the argument should be the bitwise OR of some subset of {READ, WRITE, EXEC} or PROT_NONE. ORing PROT_NONE with other flags does nothing. markj: Technically, the argument should be the bitwise OR of some subset of {READ, WRITE, EXEC} or… | |||||||||
The pages can be read. | The pages can be read. | ||||||||
.It Dv PROT_WRITE | .It Dv PROT_WRITE | ||||||||
The pages can be written. | The pages can be written. | ||||||||
.It Dv PROT_EXEC | .It Dv PROT_EXEC | ||||||||
The pages can be executed. | The pages can be executed. | ||||||||
.El | .El | ||||||||
.Pp | .Pp | ||||||||
In addition to these protection flags, | In addition to these standard protection flags, | ||||||||
the | |||||||||
.Fx | .Fx | ||||||||
implementation of | |||||||||
.Fn mprotect | |||||||||
provides the ability to set the maximum protection of a region | provides the ability to set the maximum protection of a region | ||||||||
(which prevents | (which prevents | ||||||||
.Nm | .Nm | ||||||||
from upgrading the permissions). | from adding to the permissions later). | ||||||||
Done Inline ActionsWhile we're here, I would suggest adding the word "later" here, i.e., saying, "... from later upgrading ..." Also, wouldn't "adding" be clearer than "upgrading"? alc: While we're here, I would suggest adding the word "later" here, i.e., saying, "... from later… | |||||||||
This is accomplished by | This is accomplished by bitwise | ||||||||
.Em or Ns 'ing | .Em or Ns 'ing | ||||||||
Done Inline ActionsAdd the word "bitwise" here, like above? alc: Add the word "bitwise" here, like above? | |||||||||
one or more | one or more | ||||||||
.Dv PROT_ | .Dv PROT_ | ||||||||
values wrapped in the | values wrapped in the | ||||||||
.Dv PROT_MAX() | .Dv PROT_MAX() | ||||||||
macro into the | macro into the | ||||||||
.Fa prot | .Fa prot | ||||||||
argument. | argument. | ||||||||
.Sh RETURN VALUES | .Sh RETURN VALUES | ||||||||
▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines |