-.\" $OpenBSD: madvise.2,v 1.22 2019/12/26 01:01:06 jsg Exp $
+.\" $OpenBSD: madvise.2,v 1.23 2024/01/21 17:46:03 deraadt Exp $
.\" $NetBSD: madvise.2,v 1.7 1995/12/27 21:17:02 jtc Exp $
.\"
.\" Copyright (c) 1991, 1993
.\"
.\" @(#)madvise.2 8.1 (Berkeley) 6/9/93
.\"
-.Dd $Mdocdate: December 26 2019 $
+.Dd $Mdocdate: January 21 2024 $
.Dt MADVISE 2
.Os
.Sh NAME
.Fn posix_madvise
function will return zero.
Otherwise an error number will be returned to indicate the error.
+.Sh ERRORS
+.Fn madvise
+will fail if:
+.Bl -tag -width Er
+.It Bq Er EINVAL
+The specified
+.Fa behav
+argument was invalid.
+.It Bq Er EINVAL
+The
+.Fa addr
+parameter was not page aligned or
+.Fa addr
+and
+.Fa size
+specify a region that would extend beyond the end of the address space.
+.It Bq Er EPERM
+The
+.Fa addr
+and
+.Fa len
+parameters specify a region which contains at least one page marked immutable.
+.El
.Sh SEE ALSO
+.Xr mimmutable 2 ,
.Xr minherit 2 ,
.Xr mprotect 2 ,
.Xr msync 2 ,
.Fn posix_madvise
system call conforms to
.St -p1003.1-2008 .
+.Pp
+The
+.Er EPERM
+failure conditions described are an extension to this specification.
.Sh HISTORY
The
.Fn madvise
-.\" $OpenBSD: mimmutable.2,v 1.4 2024/01/20 13:19:37 deraadt Exp $
+.\" $OpenBSD: mimmutable.2,v 1.5 2024/01/21 17:46:03 deraadt Exp $
.\"
.\" Copyright (c) 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" @(#)mimmutable.2 8.1 (Berkeley) 6/9/93
.\"
-.Dd $Mdocdate: January 20 2024 $
+.Dd $Mdocdate: January 21 2024 $
.Dt MIMMUTABLE 2
.Os
.Sh NAME
system call
changes currently mapped pages in the region to be marked immutable,
which means their protection or mapping may not be changed in the future.
+Most requests to
+.Xr madvise 2 ,
+.Xr minherit 2 ,
.Xr mmap 2 ,
.Xr mprotect 2 ,
-and
+.Xr msync 2 , and
.Xr munmap 2
to pages marked immutable will return with error
.Er EPERM .
and
.Fa len
arguments is not valid.
+.It Bq Er EPERM
+At least one page has inheritance of
+.Dv MAP_INHERIT_ZERO .
.El
.Sh SEE ALSO
+.Xr minherit 2 ,
.Xr mmap 2 ,
.Xr mprotect 2 ,
.Xr munmap 2
-.\" $OpenBSD: minherit.2,v 1.16 2019/01/11 18:46:30 deraadt Exp $
+.\" $OpenBSD: minherit.2,v 1.17 2024/01/21 17:46:03 deraadt Exp $
.\"
.\" Copyright (c) 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"
.\" @(#)minherit.2 8.1 (Berkeley) 6/9/93
.\"
-.Dd $Mdocdate: January 11 2019 $
+.Dd $Mdocdate: January 21 2024 $
.Dt MINHERIT 2
.Os
.Sh NAME
.Fn minherit
system call will fail if:
.Bl -tag -width Er
+.It Bq Er EPERM
+The
+.Fa addr
+and
+.Fa len
+parameters specify a region that contains
+at least one page which is immutable, or
+.Dv MAP_INHERIT_ZERO
+is being requested on a page without
+.Dv PROT_WRITE
+permission.
.It Bq Er EINVAL
The virtual address range specified by the
.Fa addr
.El
.Sh SEE ALSO
.Xr madvise 2 ,
+.Xr mimmutable 2 ,
.Xr mprotect 2 ,
.Xr msync 2 ,
.Xr munmap 2
-.\" $OpenBSD: msync.2,v 1.29 2021/06/30 18:46:49 schwarze Exp $
+.\" $OpenBSD: msync.2,v 1.30 2024/01/21 17:46:03 deraadt Exp $
.\" $NetBSD: msync.2,v 1.8 1995/10/12 15:41:09 jtc Exp $
.\"
.\" Copyright (c) 1991, 1993
.\"
.\" @(#)msync.2 8.1 (Berkeley) 6/9/93
.\"
-.Dd $Mdocdate: June 30 2021 $
+.Dd $Mdocdate: January 21 2024 $
.Dt MSYNC 2
.Os
.Sh NAME
and
.Fa size
specify a region that would extend beyond the end of the address space.
+.It Bq Er EPERM
+The
+.Fa addr
+and
+.Fa len
+parameters specify a region which contains at least one page marked immutable.
.It Bq Er ENOMEM
Addresses in the specified region are outside the range allowed
for the address space of the process, or specify one or more pages
.El
.Sh SEE ALSO
.Xr madvise 2 ,
+.Xr mimmutable 2 ,
.Xr minherit 2 ,
.Xr mprotect 2 ,
.Xr munmap 2