The MAP_NORESERVE flag to mmap() has never been implemented in FreeBSD and

is being removed.  No portrev bump needed since the kernel will continue to
accept this flag for old binaries even after support for it in new binaries
is removed.

PR:		193961
Approved by:	portmgr (antoine)
This commit is contained in:
John Baldwin 2014-10-18 12:20:42 +00:00
parent b133042d6c
commit 1ebd0e3345
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=371117
17 changed files with 355 additions and 8 deletions

View file

@ -0,0 +1,11 @@
--- galerautils/src/gu_mmap.cpp.orig 2014-10-15 11:08:26.000000000 -0400
+++ galerautils/src/gu_mmap.cpp 2014-10-15 11:09:06.000000000 -0400
@@ -21,7 +21,7 @@
:
size (fd.size()),
ptr (mmap (NULL, size, PROT_READ|PROT_WRITE,
- MAP_SHARED|MAP_NORESERVE, fd.get(), 0)),
+ MAP_SHARED, fd.get(), 0)),
mapped (ptr != GU_MAP_FAILED)
{
if (!mapped)

View file

@ -0,0 +1,12 @@
--- tests/mapper.c.orig 2014-10-06 14:46:27.000000000 -0400
+++ tests/mapper.c 2014-10-06 14:47:00.000000000 -0400
@@ -39,6 +39,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DE
#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
# define MAP_ANONYMOUS MAP_ANON
#endif
+#if !defined(MAP_NORESERVE)
+# define MAP_NORESERVE 0
+#endif
int
main (void)

View file

@ -0,0 +1,11 @@
--- vmem_mmap.c.orig 2014-10-06 15:04:33.000000000 -0400
+++ vmem_mmap.c 2014-10-06 15:08:36.000000000 -0400
@@ -48,7 +48,7 @@
#define FREE_PROT PROT_NONE
#define ALLOC_FLAGS MAP_PRIVATE | MAP_ANON
-#define FREE_FLAGS MAP_PRIVATE | MAP_ANON | MAP_NORESERVE
+#define FREE_FLAGS MAP_PRIVATE | MAP_ANON
#ifdef MAP_ALIGN
#define CHUNKSIZE (64*1024) /* 64 kilobytes */

View file

@ -0,0 +1,11 @@
--- util/cairo-sphinx/sphinx.c.orig 2014-10-06 15:22:24.000000000 -0400
+++ util/cairo-sphinx/sphinx.c 2014-10-06 15:23:04.000000000 -0400
@@ -1325,7 +1325,7 @@ client_shm (const char *shm_path)
base = mmap (NULL, DATA_SIZE,
PROT_READ | PROT_WRITE,
- MAP_SHARED | MAP_NORESERVE,
+ MAP_SHARED,
fd, 0);
close (fd);

View file

@ -1460,7 +1460,16 @@
// Add the appropriate client or server subdir
len = strlen(buf);
@@ -2817,7 +2941,7 @@
@@ -2752,7 +2876,7 @@
if (::write(fd, "", 1) == 1) {
mmap(base, size,
PROT_READ|PROT_WRITE|PROT_EXEC,
- MAP_PRIVATE|MAP_FIXED|MAP_NORESERVE, fd, 0);
+ MAP_PRIVATE|MAP_FIXED, fd, 0);
}
}
::close(fd);
@@ -2815,7 +2939,7 @@
}
void os::free_memory(char *addr, size_t bytes, size_t alignment_hint) {
@ -1469,7 +1478,23 @@
}
void os::numa_make_global(char *addr, size_t bytes) {
@@ -2997,9 +3121,10 @@
@@ -2962,7 +3086,7 @@
return ::mprotect(addr, size, PROT_NONE) == 0;
#else
uintptr_t res = (uintptr_t) ::mmap(addr, size, PROT_NONE,
- MAP_PRIVATE|MAP_FIXED|MAP_NORESERVE|MAP_ANONYMOUS, -1, 0);
+ MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0);
return res != (uintptr_t) MAP_FAILED;
#endif
}
@@ -2989,15 +3113,16 @@
char * addr;
int flags;
- flags = MAP_PRIVATE | MAP_NORESERVE | MAP_ANONYMOUS;
+ flags = MAP_PRIVATE | MAP_ANONYMOUS;
if (fixed) {
assert((uintptr_t)requested_addr % os::Bsd::page_size() == 0, "unaligned address");
flags |= MAP_FIXED;
}

View file

@ -1,8 +1,8 @@
$FreeBSD$
--- hotspot/src/os/bsd/vm/os_bsd.cpp.orig 2010-02-21 20:07:54.000000000 -0800
+++ hotspot/src/os/bsd/vm/os_bsd.cpp 2010-02-21 20:08:41.000000000 -0800
@@ -358,7 +358,7 @@
--- hotspot/src/os/bsd/vm/os_bsd.cpp.orig 2014-10-06 17:10:00.000000000 -0400
+++ hotspot/src/os/bsd/vm/os_bsd.cpp 2014-10-08 10:23:14.000000000 -0400
@@ -458,7 +458,7 @@
* 7: The default directories, normally /lib and /usr/lib.
*/
#ifndef DEFAULT_LIBPATH
@ -11,3 +11,30 @@ $FreeBSD$
#endif
#define EXTENSIONS_DIR "/lib/ext"
@@ -2947,7 +2947,7 @@
if (::write(fd, "", 1) == 1) {
mmap(base, size,
PROT_READ|PROT_WRITE|PROT_EXEC,
- MAP_PRIVATE|MAP_FIXED|MAP_NORESERVE, fd, 0);
+ MAP_PRIVATE|MAP_FIXED, fd, 0);
}
}
::close(fd);
@@ -3196,7 +3196,7 @@
return ::mprotect(addr, size, PROT_NONE) == 0;
#else
uintptr_t res = (uintptr_t) ::mmap(addr, size, PROT_NONE,
- MAP_PRIVATE|MAP_FIXED|MAP_NORESERVE|MAP_ANONYMOUS, -1, 0);
+ MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0);
return res != (uintptr_t) MAP_FAILED;
#endif
}
@@ -3223,7 +3223,7 @@
char * addr;
int flags;
- flags = MAP_PRIVATE | MAP_NORESERVE | MAP_ANONYMOUS;
+ flags = MAP_PRIVATE | MAP_ANONYMOUS;
if (fixed) {
assert((uintptr_t)requested_addr % os::Bsd::page_size() == 0, "unaligned address");
flags |= MAP_FIXED;

View file

@ -941,7 +941,34 @@
SEM_INIT(_semaphore, 0);
}
@@ -2746,6 +2813,7 @@
@@ -2128,7 +2195,7 @@
if (::write(fd, "", 1) == 1) {
mmap(base, size,
PROT_READ|PROT_WRITE|PROT_EXEC,
- MAP_PRIVATE|MAP_FIXED|MAP_NORESERVE, fd, 0);
+ MAP_PRIVATE|MAP_FIXED, fd, 0);
}
}
::close(fd);
@@ -2238,7 +2305,7 @@
return ::mprotect(addr, size, PROT_NONE) == 0;
#else
uintptr_t res = (uintptr_t) ::mmap(addr, size, PROT_NONE,
- MAP_PRIVATE|MAP_FIXED|MAP_NORESERVE|MAP_ANONYMOUS, -1, 0);
+ MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0);
return res != (uintptr_t) MAP_FAILED;
#endif
}
@@ -2265,7 +2332,7 @@
char * addr;
int flags;
- flags = MAP_PRIVATE | MAP_NORESERVE | MAP_ANONYMOUS;
+ flags = MAP_PRIVATE | MAP_ANONYMOUS;
if (fixed) {
assert((uintptr_t)requested_addr % os::Bsd::page_size() == 0, "unaligned address");
flags |= MAP_FIXED;
@@ -2743,6 +2810,7 @@
return OS_OK;
#elif defined(__FreeBSD__)
int ret = pthread_setprio(thread->osthread()->pthread_id(), newpri);

View file

@ -0,0 +1,29 @@
--- lisp-kernel/memory.c.orig 2014-10-08 10:40:13.000000000 -0400
+++ lisp-kernel/memory.c 2014-10-08 10:41:19.000000000 -0400
@@ -89,7 +89,7 @@ ReserveMemoryForHeap(LogicalAddress want
start = mmap((void *)want,
totalsize + heap_segment_size,
PROT_NONE,
- MAP_PRIVATE | MAP_ANON | MAP_NORESERVE,
+ MAP_PRIVATE | MAP_ANON,
-1,
0);
if (start == MAP_FAILED) {
@@ -99,7 +99,7 @@ ReserveMemoryForHeap(LogicalAddress want
if (start != want) {
munmap(start, totalsize+heap_segment_size);
start = (void *)((((natural)start)+heap_segment_size-1) & ~(heap_segment_size-1));
- if(mmap(start, totalsize, PROT_NONE, MAP_PRIVATE | MAP_ANON | MAP_FIXED | MAP_NORESERVE, -1, 0) != start) {
+ if(mmap(start, totalsize, PROT_NONE, MAP_PRIVATE | MAP_ANON | MAP_FIXED, -1, 0) != start) {
return NULL;
}
}
@@ -877,7 +877,7 @@ ReserveMemory(natural size)
PAGE_NOACCESS);
return p;
#else
- p = mmap(NULL,size,PROT_NONE,MAP_PRIVATE|MAP_ANON|MAP_NORESERVE,-1,0);
+ p = mmap(NULL,size,PROT_NONE,MAP_PRIVATE|MAP_ANON,-1,0);
if (p == MAP_FAILED) {
return NULL;
}

View file

@ -0,0 +1,29 @@
--- src/platform-freebsd.cc.orig 2014-06-03 04:52:11.000000000 -0400
+++ src/platform-freebsd.cc 2014-10-08 11:16:08.000000000 -0400
@@ -189,7 +189,7 @@ VirtualMemory::VirtualMemory(size_t size
void* reservation = mmap(OS::GetRandomMmapAddr(),
request_size,
PROT_NONE,
- MAP_PRIVATE | MAP_ANON | MAP_NORESERVE,
+ MAP_PRIVATE | MAP_ANON,
kMmapFd,
kMmapFdOffset);
if (reservation == MAP_FAILED) return;
@@ -261,7 +261,7 @@ void* VirtualMemory::ReserveRegion(size_
void* result = mmap(OS::GetRandomMmapAddr(),
size,
PROT_NONE,
- MAP_PRIVATE | MAP_ANON | MAP_NORESERVE,
+ MAP_PRIVATE | MAP_ANON,
kMmapFd,
kMmapFdOffset);
@@ -289,7 +289,7 @@ bool VirtualMemory::UncommitRegion(void*
return mmap(base,
size,
PROT_NONE,
- MAP_PRIVATE | MAP_ANON | MAP_NORESERVE | MAP_FIXED,
+ MAP_PRIVATE | MAP_ANON | MAP_FIXED,
kMmapFd,
kMmapFdOffset) != MAP_FAILED;
}

View file

@ -0,0 +1,29 @@
--- src/platform-freebsd.cc.orig 2014-10-08 11:14:11.000000000 -0400
+++ src/platform-freebsd.cc 2014-10-08 11:14:30.000000000 -0400
@@ -371,7 +371,7 @@ VirtualMemory::VirtualMemory(size_t size
void* reservation = mmap(OS::GetRandomMmapAddr(),
request_size,
PROT_NONE,
- MAP_PRIVATE | MAP_ANON | MAP_NORESERVE,
+ MAP_PRIVATE | MAP_ANON,
kMmapFd,
kMmapFdOffset);
if (reservation == MAP_FAILED) return;
@@ -443,7 +443,7 @@ void* VirtualMemory::ReserveRegion(size_
void* result = mmap(OS::GetRandomMmapAddr(),
size,
PROT_NONE,
- MAP_PRIVATE | MAP_ANON | MAP_NORESERVE,
+ MAP_PRIVATE | MAP_ANON,
kMmapFd,
kMmapFdOffset);
@@ -473,7 +473,7 @@ bool VirtualMemory::UncommitRegion(void*
return mmap(base,
size,
PROT_NONE,
- MAP_PRIVATE | MAP_ANON | MAP_NORESERVE | MAP_FIXED,
+ MAP_PRIVATE | MAP_ANON | MAP_FIXED,
kMmapFd,
kMmapFdOffset) != MAP_FAILED;
}

View file

@ -1,5 +1,5 @@
--- annoyance-filter.cc.orig Thu Sep 25 01:56:54 2003
+++ annoyance-filter.cc Fri Jan 2 02:51:57 2004
--- annoyance-filter.cc.orig 2004-08-04 16:28:36.000000000 -0400
+++ annoyance-filter.cc 2014-10-08 12:04:20.000000000 -0400
@@ -114,7 +114,7 @@
#define __GNU_LIBRARY__
#undef __GETOPT_H__
@ -9,3 +9,21 @@
#include "statlib.h"
/*237:*/
@@ -2675,7 +2675,7 @@
fileLength= lseek(fileHandle,0,2);
lseek(fileHandle,0,0);
dp= static_cast<char*> (mmap((caddr_t)0,fileLength,
-PROT_READ,MAP_SHARED|MAP_NORESERVE,
+PROT_READ,MAP_SHARED,
fileHandle,0));
istrstream is(dp,fileLength);
#else
@@ -7332,7 +7332,7 @@
long fileLength= lseek(fileHandle,0,2);
lseek(fileHandle,0,0);
char*dp= static_cast<char*> (mmap((caddr_t)0,fileLength,
-PROT_READ,MAP_SHARED|MAP_NORESERVE,
+PROT_READ,MAP_SHARED,
fileHandle,0));
istrstream is(dp,fileLength);
#else

View file

@ -0,0 +1,11 @@
--- common.c.orig 2014-10-08 12:07:33.000000000 -0400
+++ common.c 2014-10-08 12:07:45.000000000 -0400
@@ -109,7 +109,7 @@
if(file_size > 0)
{
- buffer = mmap(NULL, file_size, PROT_READ, (MAP_SHARED | MAP_NORESERVE), fd, 0);
+ buffer = mmap(NULL, file_size, PROT_READ, MAP_SHARED, fd, 0);
if(buffer == MAP_FAILED)
{
perror("mmap");

View file

@ -32,3 +32,30 @@
} while (buffer[bytes_read] != '\n');
buffer[bytes_read] = 0;
// Ignore mappings that are not executable.
@@ -187,7 +187,7 @@
void* reservation = mmap(OS::GetRandomMmapAddr(),
request_size,
PROT_NONE,
- MAP_PRIVATE | MAP_ANON | MAP_NORESERVE,
+ MAP_PRIVATE | MAP_ANON,
kMmapFd,
kMmapFdOffset);
if (reservation == MAP_FAILED) return;
@@ -259,7 +259,7 @@
void* result = mmap(OS::GetRandomMmapAddr(),
size,
PROT_NONE,
- MAP_PRIVATE | MAP_ANON | MAP_NORESERVE,
+ MAP_PRIVATE | MAP_ANON,
kMmapFd,
kMmapFdOffset);
@@ -287,7 +287,7 @@
return mmap(base,
size,
PROT_NONE,
- MAP_PRIVATE | MAP_ANON | MAP_NORESERVE | MAP_FIXED,
+ MAP_PRIVATE | MAP_ANON | MAP_FIXED,
kMmapFd,
kMmapFdOffset) != MAP_FAILED;
}

View file

@ -0,0 +1,29 @@
--- deps/v8/src/platform-freebsd.cc.orig 2014-05-01 20:49:51.000000000 -0400
+++ deps/v8/src/platform-freebsd.cc 2014-10-08 13:34:09.000000000 -0400
@@ -213,7 +213,7 @@
void* reservation = mmap(OS::GetRandomMmapAddr(),
request_size,
PROT_NONE,
- MAP_PRIVATE | MAP_ANON | MAP_NORESERVE,
+ MAP_PRIVATE | MAP_ANON,
kMmapFd,
kMmapFdOffset);
if (reservation == MAP_FAILED) return;
@@ -285,7 +285,7 @@
void* result = mmap(OS::GetRandomMmapAddr(),
size,
PROT_NONE,
- MAP_PRIVATE | MAP_ANON | MAP_NORESERVE,
+ MAP_PRIVATE | MAP_ANON,
kMmapFd,
kMmapFdOffset);
@@ -313,7 +313,7 @@
return mmap(base,
size,
PROT_NONE,
- MAP_PRIVATE | MAP_ANON | MAP_NORESERVE | MAP_FIXED,
+ MAP_PRIVATE | MAP_ANON | MAP_FIXED,
kMmapFd,
kMmapFdOffset) != MAP_FAILED;
}

View file

@ -0,0 +1,29 @@
--- deps/v8/src/platform-freebsd.cc.orig 2014-09-16 18:47:52.000000000 -0400
+++ deps/v8/src/platform-freebsd.cc 2014-10-08 13:23:25.000000000 -0400
@@ -343,7 +343,7 @@
void* reservation = mmap(OS::GetRandomMmapAddr(),
request_size,
PROT_NONE,
- MAP_PRIVATE | MAP_ANON | MAP_NORESERVE,
+ MAP_PRIVATE | MAP_ANON,
kMmapFd,
kMmapFdOffset);
if (reservation == MAP_FAILED) return;
@@ -415,7 +415,7 @@
void* result = mmap(OS::GetRandomMmapAddr(),
size,
PROT_NONE,
- MAP_PRIVATE | MAP_ANON | MAP_NORESERVE,
+ MAP_PRIVATE | MAP_ANON,
kMmapFd,
kMmapFdOffset);
@@ -445,7 +445,7 @@
return mmap(base,
size,
PROT_NONE,
- MAP_PRIVATE | MAP_ANON | MAP_NORESERVE | MAP_FIXED,
+ MAP_PRIVATE | MAP_ANON | MAP_FIXED,
kMmapFd,
kMmapFdOffset) != MAP_FAILED;
}

View file

@ -0,0 +1,11 @@
--- lib/ts/Compatability.h.orig 2014-10-08 13:41:39.000000000 -0400
+++ lib/ts/Compatability.h 2014-10-08 13:42:29.000000000 -0400
@@ -55,7 +55,7 @@
#if defined(linux)
#define NEED_ALTZONE_DEFINED
#define MAP_SHARED_MAP_NORESERVE (MAP_SHARED)
-#elif defined(darwin)
+#elif defined(darwin) || defined(__FreeBSD__)
#define MAP_SHARED_MAP_NORESERVE (MAP_SHARED)
#elif defined(solaris)
#define NEED_ALTZONE_DEFINED

View file

@ -0,0 +1,11 @@
--- tools/jtest/jtest.cc.orig 2014-10-08 13:50:58.000000000 -0400
+++ tools/jtest/jtest.cc 2014-10-08 13:51:12.000000000 -0400
@@ -2689,7 +2689,7 @@
ink_assert( !ftruncate(fd,numbytes) );
bytes = (unsigned char *)
mmap(NULL,numbytes,PROT_READ|PROT_WRITE,
- MAP_SHARED|MAP_NORESERVE,
+ MAP_SHARED,
fd, 0);
if (bytes == (unsigned char*)MAP_FAILED || !bytes)
panic("unable to map URL Hash file\n");