svn commit: r363966 - head/sys/vm

Brooks Davis brooks at FreeBSD.org
Thu Aug 6 16:20:21 UTC 2020


Author: brooks
Date: Thu Aug  6 16:20:20 2020
New Revision: 363966
URL: https://svnweb.freebsd.org/changeset/base/363966

Log:
  Preserve ASLR vm_map flags across fork
  
  In the most common case (fork+execve) this doesn't matter, but further
  attempts to apply entropy would fail in (e.g.) a pre-fork server.
  
  Reported by:	Alfredo Mazzinghi
  Reviewed by:	kib, markj
  Obtained from:	CheriBSD
  MFC after:	3 days
  Differential Revision:	https://reviews.freebsd.org/D25966

Modified:
  head/sys/vm/vm_map.c

Modified: head/sys/vm/vm_map.c
==============================================================================
--- head/sys/vm/vm_map.c	Thu Aug  6 16:14:43 2020	(r363965)
+++ head/sys/vm/vm_map.c	Thu Aug  6 16:20:20 2020	(r363966)
@@ -4109,6 +4109,7 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_c
 	}
 
 	new_map->anon_loc = old_map->anon_loc;
+	new_map->flags |= old_map->flags & (MAP_ASLR | MAP_ASLR_IGNSTART);
 
 	VM_MAP_ENTRY_FOREACH(old_entry, old_map) {
 		if ((old_entry->eflags & MAP_ENTRY_IS_SUB_MAP) != 0)


More information about the svn-src-all mailing list