Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Sep 2014 17:09:05 +0300
From:      Andriy Gapon <avg@FreeBSD.org>
To:        John Baldwin <jhb@FreeBSD.org>, freebsd-java@FreeBSD.org
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: svn commit: r271635 - in head: lib/libc/sys sys/vm
Message-ID:  <54184481.3060804@FreeBSD.org>
In-Reply-To: <54183D4D.3050907@FreeBSD.org>
References:  <201409151720.s8FHKDFs099885@svn.freebsd.org> <54183D4D.3050907@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 16/09/2014 16:38, Andriy Gapon wrote:
> On 15/09/2014 20:20, John Baldwin wrote:
>> Author: jhb
>> Date: Mon Sep 15 17:20:13 2014
>> New Revision: 271635
>> URL: http://svnweb.freebsd.org/changeset/base/271635
>>
>> Log:
>>   Add stricter checking of some mmap() arguments:
>>   - Fail with EINVAL if an invalid protection mask is passed to mmap().
>>   - Fail with EINVAL if an unknown flag is passed to mmap().
>>   - Fail with EINVAL if both MAP_PRIVATE and MAP_SHARED are passed to mmap().
>>   - Require one of either MAP_PRIVATE or MAP_SHARED for non-anonymous
>>     mappings.
> 
> This broke Java, at least java/openjdk7, for me:
> 
>  25323 java     CALL
> mmap(0,0x3000000,0x3<PROT_READ|PROT_WRITE>,0x1042<MAP_PRIVATE|MAP_NORESERVE|MAP_ANON>,0xffffffff,0)
>  25323 java     RET   mmap -1 errno 22 Invalid argument
>  25323 java     CALL  write(0x1,0x7fffffbfd450,0x2b)
>  25323 java     GIO   fd 1 wrote 43 bytes
>        "Error occurred during initialization of VM
>        "
>  25323 java     RET   write 43/0x2b
>  25323 java     CALL  write(0x1,0x80209a1e2,0x2d)
>  25323 java     GIO   fd 1 wrote 45 bytes
>        "Could not reserve enough space for code cache"
> 
> It seems that MAP_NORESERVE presence could be detected in sys/mman.h and then it
> is used for some reason.

No, it's not auto-detected, it's explicitly used in
hotspot/src/os/bsd/vm/os_bsd.cpp.

> I guess that the port can be easily fixed, but this commit breaks compatibility
> with older binaries.  Perhaps MAP_NORESERVE should be removed as well given that
> we do not actually implement it.
> 
>>   Reviewed by:	alc, kib
>>   MFC after:	2 weeks
>>   Differential Revision:	https://reviews.freebsd.org/D698
>>
>> Modified:
>>   head/lib/libc/sys/mmap.2
>>   head/sys/vm/vm_mmap.c

-- 
Andriy Gapon



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