sync with OpenBSD -current

This commit is contained in:
purplerain 2024-01-22 04:59:23 +00:00
parent cc6742f14d
commit f913a3fe74
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
59 changed files with 478 additions and 318 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: init.c,v 1.21 2024/01/19 14:15:51 deraadt Exp $ */
/* $OpenBSD: init.c,v 1.22 2024/01/21 17:18:13 kettenis Exp $ */
/*
* Copyright (c) 2014,2015 Philip Guenther <guenther@openbsd.org>
*
@ -129,7 +129,6 @@ _libc_preinit(int argc, char **argv, char **envp, dl_cb_cb *cb)
* Static non-PIE processes don't get an AUX vector,
* so find the phdrs through the ELF header
*/
_static_phdr_info.dlpi_addr = (Elf_Addr)__executable_start;
phdr = (void *)((char *)__executable_start +
__executable_start->e_phoff);
phnum = __executable_start->e_phnum;

View file

@ -1,4 +1,4 @@
.\" $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
@ -30,7 +30,7 @@
.\"
.\" @(#)madvise.2 8.1 (Berkeley) 6/9/93
.\"
.Dd $Mdocdate: December 26 2019 $
.Dd $Mdocdate: January 21 2024 $
.Dt MADVISE 2
.Os
.Sh NAME
@ -88,7 +88,31 @@ If successful, the
.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 ,
@ -98,6 +122,10 @@ The
.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

View file

@ -1,4 +1,4 @@
.\" $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.
@ -29,7 +29,7 @@
.\"
.\" @(#)mimmutable.2 8.1 (Berkeley) 6/9/93
.\"
.Dd $Mdocdate: January 20 2024 $
.Dd $Mdocdate: January 21 2024 $
.Dt MIMMUTABLE 2
.Os
.Sh NAME
@ -45,9 +45,12 @@ The
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 .
@ -71,8 +74,12 @@ The virtual address range specified by the
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

View file

@ -1,4 +1,4 @@
.\" $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.
@ -29,7 +29,7 @@
.\"
.\" @(#)minherit.2 8.1 (Berkeley) 6/9/93
.\"
.Dd $Mdocdate: January 11 2019 $
.Dd $Mdocdate: January 21 2024 $
.Dt MINHERIT 2
.Os
.Sh NAME
@ -73,6 +73,17 @@ The
.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
@ -86,6 +97,7 @@ argument is invalid.
.El
.Sh SEE ALSO
.Xr madvise 2 ,
.Xr mimmutable 2 ,
.Xr mprotect 2 ,
.Xr msync 2 ,
.Xr munmap 2

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: mprotect.2,v 1.27 2022/10/07 15:21:04 deraadt Exp $
.\" $OpenBSD: mprotect.2,v 1.28 2024/01/21 17:00:42 deraadt Exp $
.\" $NetBSD: mprotect.2,v 1.6 1995/10/12 15:41:08 jtc Exp $
.\"
.\" Copyright (c) 1991, 1993
@ -30,7 +30,7 @@
.\"
.\" @(#)mprotect.2 8.1 (Berkeley) 6/9/93
.\"
.Dd $Mdocdate: October 7 2022 $
.Dd $Mdocdate: January 21 2024 $
.Dt MPROTECT 2
.Os
.Sh NAME
@ -121,6 +121,7 @@ specify a region which contains at least one page marked immutable.
.El
.Sh SEE ALSO
.Xr madvise 2 ,
.Xr mimmutable 2 ,
.Xr msync 2 ,
.Xr munmap 2
.Sh STANDARDS

View file

@ -1,4 +1,4 @@
.\" $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
@ -30,7 +30,7 @@
.\"
.\" @(#)msync.2 8.1 (Berkeley) 6/9/93
.\"
.Dd $Mdocdate: June 30 2021 $
.Dd $Mdocdate: January 21 2024 $
.Dt MSYNC 2
.Os
.Sh NAME
@ -88,6 +88,12 @@ parameter was not page aligned or
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
@ -97,6 +103,7 @@ An I/O error occurred while writing.
.El
.Sh SEE ALSO
.Xr madvise 2 ,
.Xr mimmutable 2 ,
.Xr minherit 2 ,
.Xr mprotect 2 ,
.Xr munmap 2

View file

@ -1,4 +1,4 @@
.\" $OpenBSD: munmap.2,v 1.20 2022/10/07 15:21:04 deraadt Exp $
.\" $OpenBSD: munmap.2,v 1.21 2024/01/21 17:00:42 deraadt Exp $
.\" $NetBSD: munmap.2,v 1.5 1995/02/27 12:35:03 cgd Exp $
.\"
.\" Copyright (c) 1991, 1993
@ -30,7 +30,7 @@
.\"
.\" @(#)munmap.2 8.2 (Berkeley) 4/15/94
.\"
.Dd $Mdocdate: October 7 2022 $
.Dd $Mdocdate: January 21 2024 $
.Dt MUNMAP 2
.Os
.Sh NAME
@ -72,6 +72,7 @@ specify a region which contains at least one page marked immutable.
.El
.Sh SEE ALSO
.Xr madvise 2 ,
.Xr mimmutable 2 ,
.Xr mlock 2 ,
.Xr mlockall 2 ,
.Xr mmap 2 ,