Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Sep 2014 22:20:09 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        John Baldwin <jhb@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Andriy Gapon <avg@freebsd.org>, freebsd-java@freebsd.org
Subject:   Re: svn commit: r271635 - in head: lib/libc/sys sys/vm
Message-ID:  <20140917192009.GH2161@kib.kiev.ua>
In-Reply-To: <45601526.3eIXIxKgkH@ralph.baldwin.cx>
References:  <201409151720.s8FHKDFs099885@svn.freebsd.org> <54183D4D.3050907@FreeBSD.org> <45601526.3eIXIxKgkH@ralph.baldwin.cx>

next in thread | previous in thread | raw e-mail | index | archive | help

--YrlhzR9YrZtruaFS
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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
> > >=20
> > > 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
> > >  =20
> > >     mappings.
> >=20
> > This broke Java, at least java/openjdk7, for me:
> >=20
> >  25323 java     CALL
> > mmap(0,0x3000000,0x3<PROT_READ|PROT_WRITE>,0x1042<MAP_PRIVATE|MAP_NORES=
ERVE|
> > 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"
> >=20
> > 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 rem=
oved
> > as well given that we do not actually implement it.
>=20
> 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.

--YrlhzR9YrZtruaFS
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBAgAGBQJUGd7oAAoJEJDCuSvBvK1BnIUP/1dZAk7ipEmgmAKNA7RCtcRc
j1HCTMkvtFKh+PTtlXDBYlVFOf69EVx6wXsyfkt0EHlJDSH37n5YRiGNFjzYPBdE
3lP8dTWGZsIRBvCDG36ujVsDzqlEhD/K0/HTmUCVwcfkzbXVRJH+fchWbN3zra1s
v66Khg3Y2h8vQOLv/4nUf1Nam+u9dVgd61TH4zS2PS88wKo8EOQoKlalJMeO0xIr
uuO33eK2p/nGK9bXfsUd5ggDyP99iIbNy639ZTmKQC/eEHF7g1D69kN0Ia3+af+v
hz6/uUJAlwLs/lmRTnieMBGQDZCRHR94saj0lf9rcgZZL9kUVjVgzDMAqMfwxEaC
mUomkh4k4bJ1bdorQP3l8JML4fh/p3Mdp5kj2NflGz/C7nHBgCd++KWiD6Sk9HZe
evomK6bgacKh10dFN8r2hLllfnWsUojawg7sJpHYdVKAE6C3M+M75bXRIFpzdi+/
HbwMwTdqBxZI4orqGujGWSP2cvBgsAS4IRfuOACuvz8Q3TSK5CKdRTlhbnC8lamj
zfEeUktLb85v3kAQq6KSnv3TMoLQQMTgw+cBtGO0LdFdJKRlzAAE4lyWaHmVib2K
Je80p7wjfDw33Wgh3x2yLrnhtCQm9TrgSCAmoJZFNCtDIWYoJTDadtpdZwGSVPG6
rKWLnhCttRhklgPcZDif
=PnEK
-----END PGP SIGNATURE-----

--YrlhzR9YrZtruaFS--



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