Message ID | 20240712-asi-rfc-24-v1-23-144b319a40d8@google.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90CECC3DA45 for <linux-mm@archiver.kernel.org>; Fri, 12 Jul 2024 17:02:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AE7A86B00BA; Fri, 12 Jul 2024 13:02:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A716F6B00BB; Fri, 12 Jul 2024 13:02:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8C42B6B00BC; Fri, 12 Jul 2024 13:02:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 628156B00BA for <linux-mm@kvack.org>; Fri, 12 Jul 2024 13:02:03 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0D53780B88 for <linux-mm@kvack.org>; Fri, 12 Jul 2024 17:02:03 +0000 (UTC) X-FDA: 82331718126.17.1CD364E Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by imf16.hostedemail.com (Postfix) with ESMTP id 3750918000D for <linux-mm@kvack.org>; Fri, 12 Jul 2024 17:02:01 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=Y5edYKPZ; spf=pass (imf16.hostedemail.com: domain of 3iGGRZggKCMs0rt13r4sx55x2v.t532z4BE-331Crt1.58x@flex--jackmanb.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3iGGRZggKCMs0rt13r4sx55x2v.t532z4BE-331Crt1.58x@flex--jackmanb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720803704; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=tumXnPtU8b3obH923+Z5afsvMmdmRsZkkH9VAm+WVDk=; b=UFgaQzWAq/up8s6PGW/sVAbm0brgyOwTG7P2Er9A/G+fYAWplnNYVGB7JGTziX8Sg3mJ38 Yg+TVv8iyaLp39qHwch4yvADgUz48VBNvkalVt5ffYZX0Yzoswh/mE9GXmKIAPswDr4iz9 iib1RU5r9ar01Eur6/9jTwdKY16zAek= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=Y5edYKPZ; spf=pass (imf16.hostedemail.com: domain of 3iGGRZggKCMs0rt13r4sx55x2v.t532z4BE-331Crt1.58x@flex--jackmanb.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3iGGRZggKCMs0rt13r4sx55x2v.t532z4BE-331Crt1.58x@flex--jackmanb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720803704; a=rsa-sha256; cv=none; b=7CHkKU9Ozh+PkICJuFm9VEh1EoRwtQmLRLh1jZwjPj08ybLundl9Pn8x7KwWh2vtw13LfG rHvl7k+0MkLrDa3o04JXhu3MMFsttZJS4uEJ4zwVZl9Sbw0XOUHcyjVo4u4wI34xqsONe5 BaoY3urNQ9CN+7lUGXtFecdMWR52P7w= Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-64b9800b377so41517397b3.0 for <linux-mm@kvack.org>; Fri, 12 Jul 2024 10:02:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1720803720; x=1721408520; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=tumXnPtU8b3obH923+Z5afsvMmdmRsZkkH9VAm+WVDk=; b=Y5edYKPZcfX7orr5bir4eTVjnNpYu6/3/bIw331H5lycvAnDb0B4Qux5QxwJa7O1yV 8h0YX1zBDVfP8s4jFx2bN9jBX9PY3Q7LOAjFzGsmjCxJrpeh0xd4LCvUbQCPNtfx5u4c iPBYYYRA8f3yH9F4xEoIfK7+oAVbqHDOmnmLxscLoqYdsgtF8G8PCplPJPIk/toljMTf F1PEsXcKZw4Jqhq86Db1Kton9zkhG65rdP87I2RgcJFEDTxJhWOJZycpslUgbKPmyGWL 9qocYxaigf0arYKx9mNWlaRyGowa9qY0DEVuYzwd7JRa16PfJW7SBBG+J17QUgucS7oF SUvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720803720; x=1721408520; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=tumXnPtU8b3obH923+Z5afsvMmdmRsZkkH9VAm+WVDk=; b=hCLZhgk92UKWsq+nPOIfWONdke5gQoyITO9MET3XAxQsejvDcbWnvK5NPW8ZztlSxz ClsMJBLKL9bhuldwcVBRcv0DNMIF+zGMR+3peZT+Wrs4Jo5N7mhv9iDl4Tjl52VJMNKx SUq4cLPsfrI1mhSxq2NSgu6WqW8sDM/AieqAVgJhOsKpmbagjGc78uaXqV8M0wxZcHKc L6faLcOJWSWlEvsrUUile4W5hW7UcozyFWtVjja2gNNg25ruqYQQfMgPgJsTT7yqrZH4 5B1qOUsWsjuhuUsEtqN0BFTa6ONW0SaFrl/6JWIl2fUnoJh+DOTwccFEb/lGITY4Iknc by4g== X-Forwarded-Encrypted: i=1; AJvYcCVNq2tNLGRmE2+1puANT4KJCtSxNaLQXtpt6FMTtb0/DoHE6UrClUVh7R7V3eHSnuMFSyflOPxxyMKpjKLaDy9VmPA= X-Gm-Message-State: AOJu0YyDxtzGxoWWukGQPHxeYoxtK15DX+uVzl0uBtMc1HI/UNUVQzZT SzmZX6hz0SExMw1AYRUG6aBgSk+TzSLmtlMMLMJZ2Xmi6OFU17F1dkqIMS5uOycCFNZaf74LHlq yEpKEbw2NTQ== X-Google-Smtp-Source: AGHT+IEh5KZMBf6CBGJRGFZI0bbM06TYxceB64wgc/tD6lYzumVKZafd3yatQIPYK79nMgLcMRU8yR72H65XJA== X-Received: from beeg.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:11db]) (user=jackmanb job=sendgmr) by 2002:a05:6902:1892:b0:e03:3c8c:e80f with SMTP id 3f1490d57ef6-e058a86d9bamr152146276.1.1720803720133; Fri, 12 Jul 2024 10:02:00 -0700 (PDT) Date: Fri, 12 Jul 2024 17:00:41 +0000 In-Reply-To: <20240712-asi-rfc-24-v1-0-144b319a40d8@google.com> Mime-Version: 1.0 References: <20240712-asi-rfc-24-v1-0-144b319a40d8@google.com> X-Mailer: b4 0.14-dev Message-ID: <20240712-asi-rfc-24-v1-23-144b319a40d8@google.com> Subject: [PATCH 23/26] mm: asi: Stabilize CR3 in switch_mm_irqs_off() From: Brendan Jackman <jackmanb@google.com> To: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, "H. Peter Anvin" <hpa@zytor.com>, Andy Lutomirski <luto@kernel.org>, Peter Zijlstra <peterz@infradead.org>, Sean Christopherson <seanjc@google.com>, Paolo Bonzini <pbonzini@redhat.com>, Alexandre Chartre <alexandre.chartre@oracle.com>, Liran Alon <liran.alon@oracle.com>, Jan Setje-Eilers <jan.setjeeilers@oracle.com>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, Mark Rutland <mark.rutland@arm.com>, Andrew Morton <akpm@linux-foundation.org>, Mel Gorman <mgorman@suse.de>, Lorenzo Stoakes <lstoakes@gmail.com>, David Hildenbrand <david@redhat.com>, Vlastimil Babka <vbabka@suse.cz>, Michal Hocko <mhocko@kernel.org>, Khalid Aziz <khalid.aziz@oracle.com>, Juri Lelli <juri.lelli@redhat.com>, Vincent Guittot <vincent.guittot@linaro.org>, Dietmar Eggemann <dietmar.eggemann@arm.com>, Steven Rostedt <rostedt@goodmis.org>, Valentin Schneider <vschneid@redhat.com>, Paul Turner <pjt@google.com>, Reiji Watanabe <reijiw@google.com>, Junaid Shahid <junaids@google.com>, Ofir Weisse <oweisse@google.com>, Yosry Ahmed <yosryahmed@google.com>, Patrick Bellasi <derkling@google.com>, KP Singh <kpsingh@google.com>, Alexandra Sandulescu <aesa@google.com>, Matteo Rizzo <matteorizzo@google.com>, Jann Horn <jannh@google.com> Cc: x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kvm@vger.kernel.org, Brendan Jackman <jackmanb@google.com> Content-Type: text/plain; charset="utf-8" X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 3750918000D X-Stat-Signature: ca3b1kjgj8suw9rsfnt3oyejtkw7fnbk X-HE-Tag: 1720803720-752784 X-HE-Meta: U2FsdGVkX1/PR9fh5NbkFAvx9x9/sJoT0JeBjTGqc5K1mQ0BknAqwzx38wiRwxez1AWgruQpbPziUCZ6B61v1y/LJGisIedLGyozjsdC5FKgLzr9dxgAeQDPIVKzLoU8v6SLlwdvjM6zUZbC4dkJkLddMyod/uKMSqnNdko7kNfwp1rl5FnOT5hFMLup8N/7fgElLlYrvFVRwAHpd+xcC1nspAYFY7i9HVXNUbtiGrhQUXbPVkaxVL4FHVmdjHO21003LTAx7Ck7z25WIemrDd1GASzGmnug+f10jnBreO2WfiE5Wm+ld1rJ1HupAQjC2UtmPDxe5YfIh3pIwnKY+P8XsPWJgFzw+qxNjfOaZXUOtaTheYmrPwihZZYoPxHN9Nouo0WWO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pII8B5/2IWHsZgWwA6/ZCT0Lg/wq3CpYOABH9gqAe0SHoE+a+AvVGtDVV6HO3vQA/G54UKPXBK5pCXjlnFmARknuXDxKAMo65NJLU6WFCKUn/4fYWqk4Nv902rjRs= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
Address Space Isolation (ASI) 2024
|
expand
|
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c index 36087d6238e6..a9804274049e 100644 --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c @@ -534,6 +534,9 @@ void switch_mm_irqs_off(struct mm_struct *unused, struct mm_struct *next, bool need_flush; u16 new_asid; + /* Stabilize CR3, before reading or writing CR3 */ + asi_exit(); + /* We don't want flush_tlb_func() to run concurrently with us. */ if (IS_ENABLED(CONFIG_PROVE_LOCKING)) WARN_ON_ONCE(!irqs_disabled());
An ASI-restricted CR3 is unstable as interrupts can cause ASI-exits. Although we already unconditionally ASI-exit during context-switch, and before returning from the VM-run path, it's still possible to reach switch_mm_irqs_off() in a restricted context, because KVM code updates static keys, which requires using a temporary mm. Signed-off-by: Brendan Jackman <jackmanb@google.com> --- arch/x86/mm/tlb.c | 3 +++ 1 file changed, 3 insertions(+)