Date: Tue, 18 Dec 2018 10:16:35 +0100 From: Alexander Lochmann <alexander.lochmann@tu-dortmund.de> To: Konstantin Belousov <kostikbel@gmail.com> Cc: freebsd-stable@freebsd.org, Horst Schirmeier <horst.schirmeier@tu-dortmund.de> Subject: Re: Address Collision using i386 4G/4G Memory Split Message-ID: <40f4db11-84cb-9b8d-2eb5-5882ad01d1d8@tu-dortmund.de> In-Reply-To: <20181218052738.GZ60291@kib.kiev.ua> References: <38ad0d50-c776-9deb-d56b-db8db548cefc@tu-dortmund.de> <20181218052738.GZ60291@kib.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --cTvFxoptKgcF0SORpRrj8xT3hvXxmkGAJ Content-Type: multipart/mixed; boundary="bYRlaA01VG42Vk5msddPSHh0YaFiE92Os"; protected-headers="v1" From: Alexander Lochmann <alexander.lochmann@tu-dortmund.de> To: Konstantin Belousov <kostikbel@gmail.com> Cc: freebsd-stable@freebsd.org, Horst Schirmeier <horst.schirmeier@tu-dortmund.de> Message-ID: <40f4db11-84cb-9b8d-2eb5-5882ad01d1d8@tu-dortmund.de> Subject: Re: Address Collision using i386 4G/4G Memory Split References: <38ad0d50-c776-9deb-d56b-db8db548cefc@tu-dortmund.de> <20181218052738.GZ60291@kib.kiev.ua> In-Reply-To: <20181218052738.GZ60291@kib.kiev.ua> --bYRlaA01VG42Vk5msddPSHh0YaFiE92Os Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable Am 18.12.18 um 06:27 schrieb Konstantin Belousov: > On Mon, Dec 17, 2018 at 02:51:48PM +0100, Alexander Lochmann wrote: >> Hi folks! >> >> According to git commit e3089a (https://reviews.freebsd.org/D1463) >> FreeBSD 12.0 i386 uses separate address spaces for kernel and user >> space. So basically two memory areas, one in each space, can have the >> same address. >> Is this possible with FreeBSD 12.0? Is this likely to happen? > The feature was added to HEAD during this summer, before stable/12 was > branched. Mhmkay. But how likely is it that two memory areas will get the same address? Does the kernel, for example, start in the high memory region and the user space starts in the mid region? This would reduce the likelihood of two memory areas starting at the same virtual address. Some context: We are doing VM-based tracing in the FreeBSD kernel. For that, we observe parts of the kernel memory (allocations, accesses,...). Before 12.0 we simply knew that kernel addresses that we logged were unique. Moreover, when a memory access to a region of interest happened we knew that could only be kernel memory. We know have to ensure that we only record memory accesses that happen within the kernel. Our approach is to record the kernels value for the CR3 register, and record memory accesses if the CR3 registers holds the aforementioned valu= e. >=20 >> >> On my opinion, this is also very expensive in terms of performance. >> Any copy{in,out} has to flush the TLB. >> (http://fxr.watson.org/fxr/source/i386/i386/copyout_fast.s#L91) >> Why are you still using this 4G/4G approach? > Because it is needed for i386 to self-host, in modern world 1G KVA > is too small, and because it provides Meltdown mitigation. >=20 --=20 Technische Universit=C3=A4t Dortmund Alexander Lochmann PGP key: 0xBC3EF6FD Otto-Hahn-Str. 16 phone: +49.231.7556141 D-44227 Dortmund fax: +49.231.7556116 http://ess.cs.tu-dortmund.de/Staff/al --bYRlaA01VG42Vk5msddPSHh0YaFiE92Os-- --cTvFxoptKgcF0SORpRrj8xT3hvXxmkGAJ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEElhZsUHzVP0dbkjCRWT7tBbw+9v0FAlwYuvMACgkQWT7tBbw+ 9v1t/Q//SS+4EMseCnBZNY2LYpENpgHLe3nlUr4U1XH9g2fvZuEmJ2i7A/SeGtGv BT3wBy6swC5Xjf52YTxoFuvXg2bJyRyFkJhE2Qp3EVlczQ5jNaOgNJMGmtj2NUoS wwRGaDXDXYNdrLj/7mjCgxpD9X8fg1EoT55Bqla4FBb+RrM6ypWfJpOJBrwLp3D7 qSozyAHUqi+Yok7R3zud7jIHCuIlTmFtnAEdaTpTM7LWI32RlKirN+G0KQIqoN9g ppxqaPmt0NFf2DGxLgOAkx5zoTLSjE+8Rs1tDbAHCjznGaicLUSKfk5phm9m/Fiy 57lcVOc6KE6p0+fhE96jVLYZTs2zFvrma8CHFOrq4qGDlCKBwUC8/J6mb22pBWC7 b3GTwIF/fcIS+MOof2yBbMeH3+wPdzs9O2NBfku7G0kRx6U+vGRpF0QkqVTesjWD QC+mhlffJbdoGeUUYha+Mlb8cpRZvhlWVVhIHA4V9kcJCYvxq891NqqiLuD8hKD9 aA9rUenrpUbvJ1UTVi3dlnGrNVEucDRkxlHPW4FUUFkiyLbLGIp78yuqkhOKx3l7 N4m4mE2iS0G+p7FrW5/v06v6n4gHEXd5XQVOPqtD1SBquPbvto21Db92EqbRCG3S oBThUO9HWNhsv5FgympASv9kfBK2SLdR86drrAXVUf9R7yp03w4= =YQn5 -----END PGP SIGNATURE----- --cTvFxoptKgcF0SORpRrj8xT3hvXxmkGAJ--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?40f4db11-84cb-9b8d-2eb5-5882ad01d1d8>