[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Regression with CET: [PATCH v1] x86/mm: avoid inadvertently degrading a TLB flush to local only


  • To: David Vrabel <dvrabel@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • Date: Wed, 27 Apr 2022 18:03:42 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4/xXnZrT2P5saFsPgvZKuPcLIfigjqJ+KiYXcZ7HJ5I=; b=CShnquIyHZp7/7mWA0K7yiP8yIdhZMj9LTaFzpg3kXOThq8JdBXsTkVokb3rfcH+A/SIrxDBqpfD+hRj3C20p1lgTXfzwldaQz0d+btxd+rUwRNqZTEaKa5QZKZE2FCHgCICCGniaBYDuyTKFRySVypyM5E+ttzLDIemspksIsNZRxJ/FlyLhFbvn/gNUIIa6RKWb6d+5NE0Z55fF2EU3DGwm7xJJWKiyiwen2v73BmOWJ3j6OAJ1Y4dheNIzT08hUlcFKNWy0IQ6EttaQGLjU8zFySLy0D2CECTp22wn4rLoCxv0STlyztKLSG4pL9KehWp/tEKz0s+xDBqquLBKQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MxKxBBZf75uWYVsD1dPur2gQJTudUljVdD1kCiJ0/hgQdl6tGqaf6tzhYMZUs7SAuRX73QyFbB47G33CRJzkAWeObetHbfe9loa1g6pJawcgDk5HFVVjdEWHbztHEzqbGNknaM9oyuzd728Twv7JYjoaXHyNvI4kEVmmFAidfwhNLvLgpSv7guyhcquZFg+JlxnK54MJFp9bMnM+MIouJtf117Nelz/+PP8fYDGdYPAfVtBy7BpYGY2LoCV9m0uWa1hcoNYvfMcazNVi0IY9VHuQ8x3BvvrRRyDizvsY9cEOzRNg+GCXcebMejPmcvMy2tdByVRejXDdZunOzKax0w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, David Vrabel <dvrabel@xxxxxxxxxxxx>
  • Delivery-date: Wed, 27 Apr 2022 18:03:55 +0000
  • Ironport-data: A9a23:TyCad6vTdOMxMpgrV4oJdgNDwufnVHNfMUV32f8akzHdYApBsoF/q tZmKT2AbKuPNjHzL9p2a9m+90kP6sPXytZjHQdpri8yFHhG+JbJXdiXEBz9bniYRiHhoOOLz Cm8hv3odp1coqr0/0/1WlTZhSAgk/nOHNIQMcacUsxLbVYMpBwJ1FQyw4bVvqYy2YLjW1/X5 ouryyHiEATNNwBcYzp8B52r8HuDjNyq0N/PlgVjDRzjlAa2e0g9VPrzF4noR5fLatA88tqBb /TC1NmEElbxpH/BPD8HfoHTKSXmSpaKVeSHZ+E/t6KK2nCurQRquko32WZ1he66RFxlkvgoo Oihu6BcRi8UO6/ioeUecCBkOCxmL59a1uDGYiSw5Jn7I03uKxMAwt1IJWRvZcgy3LkyBmtDs /sFNDoKcxaPwfqsx662QfVtgcJlK9T3OIQYuTdryjSx4fQOGMifBfmVo4AAmm5o2qiiHt6HD yYdQRNpYA7NfFtkPVAPBYhltOypmmP+Y3tTr1f9Sa8fvTmPklMtgeeF3Nz9fPfRG9wEsh6kt jie3mPFHhwEDtmQ1m/Qmp6rrqqV9c/hY6oeCqex/PNuqFaawHAaAlsQWEfTiem0jAuyVsxSL 2QQ+zEytu4i+UqzVN7/Uhak5nmesXY0WdBdDuk74wGl0bfP7kCSAW1sZiFFQMwrsokxXzNC/ lOXhdrjCDhHubicW3WbsLyT6y6xURX5NkcHbC4ACAEDvN/qpdhrigqVF44/VqmoktfyBDf8h SiQqzQzjKkSishN0Lin+VfAgHSnoZ2hohMJ2zg7l1mNtmtRDLNJraTxgbQHxZ6s9Lqkc2Q=
  • Ironport-hdrordr: A9a23:14Rz+6mpAjnjIvrV4wbZbXiDqxXpDfLW3DAbv31ZSRFFG/Fw9/ rCoB3U73/JYVcqKRUdcLW7UpVoLkmyyXcY2+cs1NSZLWzbUQmTXeJfBOLZqlWNJ8SXzIVgPM xbAspD4bPLbGSTjazBkXSF+9RL+qj6zEh/792usEuETmtRGt9dBx8SMHf9LqXvLjM2fqbQEv Cnl6x6jgvlQ1s7ROKhCEIIWuDSzue77q4PMXY9dmcaABDlt0LR1ILH
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHYU/6tz3jdg/qffEGRsGMfdOOu1q0EGkOA
  • Thread-topic: Regression with CET: [PATCH v1] x86/mm: avoid inadvertently degrading a TLB flush to local only

On 19/04/2022 16:03, David Vrabel wrote:
> From: David Vrabel <dvrabel@xxxxxxxxxxxx>
>
> If the direct map is incorrectly modified with interrupts disabled,
> the required TLB flushes are degraded to flushing the local CPU only.
>
> This could lead to very hard to diagnose problems as different CPUs will
> end up with different views of memory. Although, no such issues have yet
> been identified.
>
> Change the check in the flush_area() macro to look at system_state
> instead. This defers the switch from local to all later in the boot
> (see xen/arch/x86/setup.c:__start_xen()). This is fine because
> additional PCPUs are not brought up until after the system state is
> SYS_STATE_smp_boot.
>
> Signed-off-by: David Vrabel <dvrabel@xxxxxxxxxxxx>

This explodes on CET systems:

(XEN) Assertion 'local_irq_is_enabled()' failed at arch/x86/smp.c:265
(XEN) ----[ Xen-4.17.0-10.24-d  x86_64  debug=y  Not tainted ]----
(XEN) CPU:    0
(XEN) RIP:    e008:[<ffff82d040345300>] flush_area_mask+0x40/0x13e
<snip>
(XEN) Xen call trace:
(XEN)    [<ffff82d040345300>] R flush_area_mask+0x40/0x13e
(XEN)    [<ffff82d040338a40>] F modify_xen_mappings+0xc5/0x958
(XEN)    [<ffff82d0404474f9>] F
arch/x86/alternative.c#_alternative_instructions+0xb7/0xb9
(XEN)    [<ffff82d0404476cc>] F alternative_branches+0xf/0x12
(XEN)    [<ffff82d04044e37d>] F __start_xen+0x1ef4/0x2776
(XEN)    [<ffff82d040203344>] F __high_start+0x94/0xa0
(XEN)
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) Assertion 'local_irq_is_enabled()' failed at arch/x86/smp.c:265
(XEN) ****************************************
(XEN)

We really did want a local-only flush here, because we specifically
intended to make self-modifying changes before bringing secondary CPUs up.

~Andrew

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.