Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F150474414
D16822.id47400.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
909 B
Referenced Files
None
Subscribers
None
D16822.id47400.diff
View Options
Index: lib/libvmmapi/vmmapi.c
===================================================================
--- lib/libvmmapi/vmmapi.c
+++ lib/libvmmapi/vmmapi.c
@@ -492,10 +492,22 @@
* adjoining guard regions.
*/
len2 = VM_MMAP_GUARD_SIZE + len + VM_MMAP_GUARD_SIZE;
- flags = MAP_PRIVATE | MAP_ANON | MAP_NOCORE | MAP_ALIGNED_SUPER;
- base = mmap(NULL, len2, PROT_NONE, flags, -1, 0);
+ flags = MAP_PRIVATE | MAP_ANON | MAP_NOCORE | MAP_ALIGNED_SUPER
+ | MAP_FIXED;
+
+ /*
+ * Map the entire region with MAP_GUARD first. Remap the
+ * device memory post-guard.
+ */
+ base = mmap(NULL, len2, PROT_NONE,
+ MAP_GUARD | MAP_ALIGNED_SUPER, -1, 0);
if (base == MAP_FAILED)
goto done;
+ if (mmap(base + VM_MMAP_GUARD_SIZE, len, PROT_NONE, flags, -1,
+ 0) == MAP_FAILED) {
+ munmap(base, len2);
+ goto done;
+ }
flags = MAP_SHARED | MAP_FIXED;
if ((ctx->memflags & VM_MEM_F_INCORE) == 0)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 2, 1:02 PM (12 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
30723461
Default Alt Text
D16822.id47400.diff (909 B)
Attached To
Mode
D16822: bhyve: Use MAP_GUARD guard pages
Attached
Detach File
Event Timeline
Log In to Comment