From owner-freebsd-java@FreeBSD.ORG Wed Sep 17 20:12:33 2014 Return-Path: Delivered-To: freebsd-java@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 03E48A3B; Wed, 17 Sep 2014 20:12:33 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CC7991FC; Wed, 17 Sep 2014 20:12:32 +0000 (UTC) Received: from ralph.baldwin.cx (pool-173-70-85-31.nwrknj.fios.verizon.net [173.70.85.31]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id D3DF0B985; Wed, 17 Sep 2014 16:12:31 -0400 (EDT) From: John Baldwin To: Konstantin Belousov Subject: Re: svn commit: r271635 - in head: lib/libc/sys sys/vm Date: Wed, 17 Sep 2014 15:40:09 -0400 Message-ID: <8290503.DSlOKmYch9@ralph.baldwin.cx> User-Agent: KMail/4.10.5 (FreeBSD/10.0-STABLE; KDE/4.10.5; amd64; ; ) In-Reply-To: <20140917192009.GH2161@kib.kiev.ua> References: <201409151720.s8FHKDFs099885@svn.freebsd.org> <45601526.3eIXIxKgkH@ralph.baldwin.cx> <20140917192009.GH2161@kib.kiev.ua> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Wed, 17 Sep 2014 16:12:31 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andriy Gapon , freebsd-java@freebsd.org X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Sep 2014 20:12:33 -0000 On Wednesday, September 17, 2014 10:20:09 PM Konstantin Belousov wrote: > On Wed, Sep 17, 2014 at 11:03:29AM -0400, John Baldwin wrote: > > On Tuesday, September 16, 2014 04:38:21 PM 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,0x1042 > > RVE| 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. > > > 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. > > > > I've allowed it for now, but I do intend on removing it in 11. > > I think that the removal procedure should be as follows, in the single > commit: > 1. remove the defines from public headers, and move them to vm_mmap.c > 2. bump __FreeBSD_version > 3. allow the bits for older binaries by p_osrel. > > Might be, a comment in mman.h should be kept for the binary value > of MAP_NORESERVE so that person who decide to reuse the bit for > a useful flag would be not surprised. Yes, I had used MAP_UNUSED0020 similar to what was done for MAP_INHERIT and exactly this (P_OSREL_MAP_RENAME, etc.). Once the other fixes settle in I will publish this for review and also request an exp-run from ports so we can patch things to remove MAP_NORESERVE before this is committed. -- John Baldwin