svn commit: r337429 - stable/11/sys/vm

Konstantin Belousov kib at FreeBSD.org
Tue Aug 7 17:45:51 UTC 2018


Author: kib
Date: Tue Aug  7 17:45:49 2018
New Revision: 337429
URL: https://svnweb.freebsd.org/changeset/base/337429

Log:
  MFC r336987:
  For compat32, emulate the same wraparound check as occurs on the real
  ILP32 system.
  
  PR:	230162

Modified:
  stable/11/sys/vm/vm_mmap.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/vm/vm_mmap.c
==============================================================================
--- stable/11/sys/vm/vm_mmap.c	Tue Aug  7 17:44:36 2018	(r337428)
+++ stable/11/sys/vm/vm_mmap.c	Tue Aug  7 17:45:49 2018	(r337429)
@@ -596,6 +596,12 @@ kern_mprotect(struct thread *td, uintptr_t addr0, size
 	addr -= pageoff;
 	size += pageoff;
 	size = (vm_size_t) round_page(size);
+#ifdef COMPAT_FREEBSD32
+	if (SV_PROC_FLAG(td->td_proc, SV_ILP32)) {
+		if (((addr + size) & 0xffffffff) < addr)
+			return (EINVAL);
+	} else
+#endif
 	if (addr + size < addr)
 		return (EINVAL);
 


More information about the svn-src-all mailing list