From owner-freebsd-stable@freebsd.org Tue Dec 18 09:16:39 2018 Return-Path: Delivered-To: freebsd-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 547B21348983 for ; Tue, 18 Dec 2018 09:16:39 +0000 (UTC) (envelope-from alexander.lochmann@tu-dortmund.de) Received: from unimail.uni-dortmund.de (mx1.hrz.uni-dortmund.de [129.217.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "unimail.tu-dortmund.de", Issuer "TU Dortmund CA - G01" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id D05D7890A5 for ; Tue, 18 Dec 2018 09:16:38 +0000 (UTC) (envelope-from alexander.lochmann@tu-dortmund.de) Received: from [129.217.43.49] (limnos.cs.uni-dortmund.de [129.217.43.49]) (authenticated bits=0) by unimail.uni-dortmund.de (8.16.0.29/8.16.0.29) with ESMTPSA id wBI9Ga28025792 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 18 Dec 2018 10:16:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tu-dortmund.de; s=unimail; t=1545124596; bh=JTPfYK5NCzyKKTrOybYp8dJ5b3SDKsmc1cFjwSuvPow=; h=To:Cc:References:From:Subject:Date:In-Reply-To; b=JAqd4V87E/R6XTTwPB6r/Xzt0rjlU1iTDPFFv6aDDjfxJmWJVu4g12Gg8ePwchb+3 0nsFpA6Mv6yAKPlr252PjUxNX6Mm4c1jtDfCNKFyjaclXbEBI8Ezapu6/5rPgEcqy1 7gKhaQPnkIJqDHMX/nofzqCCgwFq3DoP+MsnGoZQ= To: Konstantin Belousov Cc: freebsd-stable@freebsd.org, Horst Schirmeier References: <38ad0d50-c776-9deb-d56b-db8db548cefc@tu-dortmund.de> <20181218052738.GZ60291@kib.kiev.ua> From: Alexander Lochmann Openpgp: preference=signencrypt Autocrypt: addr=alexander.lochmann@tu-dortmund.de; prefer-encrypt=mutual; keydata= mQINBFQIyUEBEADZ+x+Ssg/46SiU66zm2lPGYAdqYfmXVv+sf/23+/KSj0FQHZKywzWjsmgR vWZZVlGJolwcW3MJ/g6ctZeOpfYiZVpzbZwNgKU0ETGjUmqmlq5/o5KnENKOimZzaKSaNn9p IC+EIeWXvu7pQjW0w1bK/RVVNw0p1Iz82W4Z+vKtD8CS+YJLAcZ6YoZMvQEg84O9odlV2Ryp oVj9EzHH40TWEdtgd4pQkaOks01PEr19sJXUjnP0VxLfs91AZjRnmGJKnI4HcrOKwquoQEeL DtHCxK0VNeoXCWkz33uBxSL5cicQ7D09hxjWthMilUpDZT94x0K452q4nybQ1TSLTYC8mlW+ xKUvJmqfHZbITJ10dTgjNvOe0kLbpXeQ1789lNmnA9bkQAK5Cefo55WbXmr1Mo3PV7y0XCib OaiijPlZo/Isc03EOK3lHPK8NuY8G+ftvphO4RyXCUWXw/o01cDnPaIEcTWkUbXvMhf/6ltP 1QWEfkguzGVjTw7Xssm9YuokC+P+49JKRyZzyCJZ022OxMlsX6c1BNZ4+cWUNmn6xr1xRNse SglpMLL1m3K1KuLf1hdAor6PBzFLiLa33lUhsWtg1ACFhpfZZOQRVas2McXTYUUpmCzOYI5F +km5q6cZStr9m7O3Y3DDGotiaJDpLtATwZ4MIM4ADbg/xl6ZgwARAQABtDZBbGV4YW5kZXIg TG9jaG1hbm4gPGFsZXhhbmRlci5sb2NobWFubkB0dS1kb3J0bXVuZC5kZT6JAj4EEwECACgF AlQIyUECGyMFCQlmAYAGCwkIBwMCBhUIAgkKCwQWAgMBAh4BAheAAAoJEFk+7QW8Pvb9I34Q AIEGy9Pt1nK8r+0baVF5KBXzoZuQIQ7ZfxJ0MFrCQSvRYEWevm2a0p5lBDOpb/VL8VtYMVO2 xZewerWoXyWMIeWmmCeSuVGdLDT/YV6BA54KzJkptmXxQaUVdiY+Fl0jxFODA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nPppcKVAf6qZqu5Yfc31q/OY n19WyGIhwK3MuuVmjatxMmGgkSxzgTTP3jFQ008qymPcgrvgOR+MECCIpXjOMfenOhhsKnhu F7hxUS/6JtYKsEMEwJXVN509sNhJiEzSY9q+VYn9IArHSBMmpi5l6XvI1iwPD9HRNursPxKV lfi8lQsC7zxuTQARAQABiQIlBBgBAgAPBQJUCMlBAhsMBQkJZgGAAAoJEFk+7QW8Pvb9EkkP /2LyGWWOoTAGBhzvgKiYzarS3WQNZCuFHSfB/XXg4SRSX3NsxGVZWdLvVVgzWo1+tC1Qk6wO IVQSSw20wQXe8boZ8yiB8eM4ohfS0lySO9gOkQLYLijWg3JIYwTbqyK2X8LpbCs7eUTXM9NO 6pmVtoc3LBBIXQElX8ir0BZZ19OCSConTkyVHYK6IbEJ11PxjJG5ZS7anI4FQt0muzykZrhk bmf5IV3DtJ/KUfhQjnJa2B/KoT7F6vpTCoyPtaBUHQXEAb2NaZVwF06WXsqfX4yleym3Jlfx Rfa4+BOJ4Gf2EFd3wYCsIb33ulaXBLWa8w3A/FdQSW9NBM4iYlPxRg+5eXn+oajpyKqPLetH WRNMN4NSHVSpu+JRqRlTDO3HCn/peQ0OB/Iaf3HN3DLZdbjtZY40xl1iR9TMgD2fn2MlAFy3 dSKfjeCAQYP9can1MgebE729MI7QhtzuUYdHy+iJO/ENNlSgFo5DLwRqssEGqWag0xWPgcni UAERITTzHJeevSeZh5ThHyD173Pwn+tIhR4bK5RFy/gnzwqHckl8Hw7o06m51yI4dUVeatNT mAiNrmW3iQnvehjLZOYXOXx4ovsWdvQn01dUo3gCXdEWQ5yQLOQRGTCcrq1hzCEd//viy9oT spNrcZJf1pbo3EKkCwUPAltq51ramtYzOu4K Subject: Re: Address Collision using i386 4G/4G Memory Split Message-ID: <40f4db11-84cb-9b8d-2eb5-5882ad01d1d8@tu-dortmund.de> Date: Tue, 18 Dec 2018 10:16:35 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181218052738.GZ60291@kib.kiev.ua> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="cTvFxoptKgcF0SORpRrj8xT3hvXxmkGAJ" X-Rspamd-Queue-Id: D05D7890A5 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-7.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-1.00)[-0.999,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Dec 2018 09:16:39 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --cTvFxoptKgcF0SORpRrj8xT3hvXxmkGAJ Content-Type: multipart/mixed; boundary="bYRlaA01VG42Vk5msddPSHh0YaFiE92Os"; protected-headers="v1" From: Alexander Lochmann To: Konstantin Belousov Cc: freebsd-stable@freebsd.org, Horst Schirmeier 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--