Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Aug 2018 17:45:50 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r337429 - stable/11/sys/vm
Message-ID:  <201808071745.w77Hjoc4061987@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808071745.w77Hjoc4061987>