Index: lib/libc/sys/mmap.2 =================================================================== --- lib/libc/sys/mmap.2 +++ lib/libc/sys/mmap.2 @@ -28,7 +28,7 @@ .\" @(#)mmap.2 8.4 (Berkeley) 5/11/95 .\" $FreeBSD$ .\" -.Dd February 4, 2017 +.Dd June 22, 2017 .Dt MMAP 2 .Os .Sh NAME @@ -199,6 +199,24 @@ .Dv MAP_EXCL is specified, the request will fail if a mapping already exists within the range. +.It Dv MAP_GUARD +Instead of a mapping, create a guard of the specified size. +.Fa mmap +will not create mappings in the address range of a guard unless +the request specifies +.Dv MAP_FIXED . +Guards can be destroyed with +.Xr munmap 2 . +Any memory access to the guarded range results in the delivery of a +.Dv SIGSEGV +signal to the thread. +.Pp +Guards allow a process to create reservations in its address space, which +can be replaced by the actual mappings later. +For instance, the system uses guards to prevent the inadvertent use of +regions into which stacks created with +.Dv MAP_STACK +will automatically grow, without mapping the whole stack in advance. .It Dv MAP_HASSEMAPHORE Notify the kernel that the region may contain semaphores and that special handling may be necessary. Index: lib/libc/sys/munmap.2 =================================================================== --- lib/libc/sys/munmap.2 +++ lib/libc/sys/munmap.2 @@ -28,7 +28,7 @@ .\" @(#)munmap.2 8.3 (Berkeley) 5/27/94 .\" $FreeBSD$ .\" -.Dd May 27, 1994 +.Dd June 22, 2017 .Dt MUNMAP 2 .Os .Sh NAME @@ -44,7 +44,7 @@ The .Fn munmap system call -deletes the mappings for the specified address range, +deletes the mappings and guards for the specified address range, and causes further references to addresses within the range to generate invalid memory references. .Sh RETURN VALUES