Page MenuHomeFreeBSD

mmap(2): Document guard size and related EINVAL.
ClosedPublic

Authored by kib on Oct 21 2020, 5:48 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, May 8, 4:15 PM
Unknown Object (File)
Apr 21 2025, 3:29 PM
Unknown Object (File)
Apr 20 2025, 10:59 PM
Unknown Object (File)
Apr 20 2025, 5:26 PM
Unknown Object (File)
Apr 19 2025, 11:00 PM
Unknown Object (File)
Apr 15 2025, 12:43 AM
Unknown Object (File)
Feb 21 2025, 12:38 PM
Unknown Object (File)
Feb 21 2025, 10:04 AM
Subscribers

Details

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

kib requested review of this revision.Oct 21 2020, 5:48 PM
emaste added inline comments.
lib/libc/sys/mmap.2
354 ↗(On Diff #78559)

The size of the guard, in pages, ...

460 ↗(On Diff #78559)

less than or equal to

This revision is now accepted and ready to land.Oct 21 2020, 6:30 PM
kib marked 2 inline comments as done.

Handle Ed' notes.
Use .Dv for sysctl mib name.
Bump date.

This revision now requires review to proceed.Oct 21 2020, 6:37 PM
This revision is now accepted and ready to land.Oct 21 2020, 6:57 PM
lib/libc/sys/mmap.2
456 ↗(On Diff #78560)

Didn't the mailing list report mention ENOMEM?

markj added inline comments.
lib/libc/sys/mmap.2
456 ↗(On Diff #78560)

Sorry, I did not read the full thread.

head/lib/libc/sys/mmap.2
354–355

IMHO, we should be explicitly saying that the guard is carved out the specified stack size, reducing the effective size of the stack. Right now, I could infer that from reading the errors section, but I argue that I shouldn't have to infer it.

head/lib/libc/sys/mmap.2
354–355

good point, how's this:

Index: lib/libc/sys/mmap.2
===================================================================
--- lib/libc/sys/mmap.2 (revision 366945)
+++ lib/libc/sys/mmap.2 (working copy)
@@ -353,6 +353,8 @@
 stacks can grow without requiring mapping the whole stack in advance.
 The size of the guard, in pages, is specified by sysctl
 .Dv security.bsd.stack_guard_page .
+The guard region is placed at the starting address of the allocation,
+and the usable stack is reduced by the size of the guard.
 .El
 .Pp
 The