Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Jun 2017 09:23:33 -0400
From:      Shawn Webb <shawn.webb@hardenedbsd.org>
To:        Konstantin Belousov <kib@FreeBSD.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r320430 - head/sys/vm
Message-ID:  <20170629132333.pl6nk5bsw3fkevdx@mutt-hbsd>
In-Reply-To: <20170628223238.v456h4t4huwbqt6f@mutt-hbsd>
References:  <201706280402.v5S42bQx089187@repo.freebsd.org> <20170628223238.v456h4t4huwbqt6f@mutt-hbsd>

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

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

On Wed, Jun 28, 2017 at 06:32:38PM -0400, Shawn Webb wrote:
> On Wed, Jun 28, 2017 at 04:02:37AM +0000, Konstantin Belousov wrote:
> > Author: kib
> > Date: Wed Jun 28 04:02:36 2017
> > New Revision: 320430
> > URL: https://svnweb.freebsd.org/changeset/base/320430
> >=20
> > Log:
> >   Treat the addr argument for mmap(2) request without MAP_FIXED flag as
> >   a hint.
> >  =20
> >   Right now, for non-fixed mmap(2) calls, addr is de-facto interpreted
> >   as the absolute minimal address of the range where the mapping is
> >   created.  The VA allocator only allocates in the range [addr,
> >   VM_MAXUSER_ADDRESS].  This is too restrictive, the mmap(2) call might
> >   unduly fail if there is no free addresses above addr but a lot of
> >   usable space below it.
> >  =20
> >   Lift this implementation limitation by allocating VA in two passes.
> >   First, try to allocate above addr, as before.  If that fails, do the
> >   second pass with less restrictive constraints for the start of
> >   allocation by specifying minimal allocation address at the max bss
> >   end, if this limit is less than addr.
> >  =20
> >   One important case where this change makes a difference is the
> >   allocation of the stacks for new threads in libthr.  Under some
> >   configuration conditions, libthr tries to hint kernel to reuse the
> >   main thread stack grow area for the new stacks.  This cannot work by
> >   design now after grow area is converted to stack, and there is no
> >   unallocated VA above the main stack.  Interpreting requested stack
> >   base address as the hint provides compatibility with old libthr and
> >   with (mis-)configured current libthr.
> >  =20
> >   Reviewed by:	alc
> >   Tested by:	dim (previous version)
> >   Sponsored by:	The FreeBSD Foundation
> >   MFC after:	1 week
> >=20
> > Modified:
> >   head/sys/vm/vm_map.c
> >   head/sys/vm/vm_map.h
> >   head/sys/vm/vm_mmap.c
>=20
> Hey Kostik,
>=20
> This commit breaks both xorg and shutting down/rebooting. Reverting this
> commit makes my laptop happy again.

Thnking out loud: would these issues arise due to HardenedBSD using
SafeStack, which relies on libthr's stack code?

Thanks,

--=20
Shawn Webb
Cofounder and Security Engineer
HardenedBSD

GPG Key ID:          0x6A84658F52456EEE
GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE

--zdzlncmx3plci7qg
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEKrq2ve9q9Ia+iT2eaoRlj1JFbu4FAllU/1MACgkQaoRlj1JF
bu4QVRAAjR20fRt6KlzxDIDzGILImR2JxX0lrX/Cl7tccUcIigJNWlYnYmYm2UyH
qgILf4NELCJoLZ2b1wA54DXu5T+h9DeXHpL5UTPWwWnqK4PJHuOmrk0wMOjGA09q
V6vx9a7HmJ2jdpzk0pgH8Ed1XR5z6EBIcJIkuuRV1sUbc9mzQpRKU3Ot961b00vX
8SkavhWIvU2iTU4jVjj+GpUQTgWUG/5vA/KUMLJibelKu5PIvmd8nCY8b7UYt7Qw
IWvijRly5nrcjmuimq/zC9DOz9dJtjFZV85o/2CRAg3LZoKT0BL2YqDQ95ZaSdgL
Drn9YhnvBgFS/C9f7kGq9afjJXjozItq+bFH2Fe3PzOxZkYuOlnwz5D7QW93diVu
pMKqQZbyFjBOvziPrK74aKZNOqJrIoiczTI+AYuZc/VkKV2a+S6ylEy9a9jjUS5q
p//Eohs3kJ2x/D/vQbP0nax/6zvQNBIcxezxazBcMzJ2f6fvIScpmasisfHBNdsB
Pk5R8aK6lp5WMVdqs6nSjv2yUyYn65NJwAyqXU2VqA/GsQ3DeMtrce42zzWZeoZm
oOal0UnombPF/3QGfAKSBnSjYt7jMu40bUSUvgw71/PFUTBemEOpdf/Uc6jtdKQb
CJvTeO9UBBZAZpB6F96EZ4Ge6N/2Ho08R+AquA3q+lG5OaJzfEE=
=BGoy
-----END PGP SIGNATURE-----

--zdzlncmx3plci7qg--



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