From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7A61C31E5C for ; Mon, 17 Jun 2019 16:15:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9C67E20B1F for ; Mon, 17 Jun 2019 16:15:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560788106; bh=JVZ01VQ9q2BY9LSCSpDeGenC0gNyM0CCxXIGe7cpTRk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=ZsOxbIjJYDie5B6HUP/L57z4zmZIzUqBs6qUQpXKXXpLKMHJyJxWG5qOY0r9v4bNQ y3UYXcCzSDWs38eGSQqL2hPGWKFwz2si37mXcHtTiewg93XEzHLfCmKVAgfyonAtyc zx59bELd+bAbCvLoA0nssCEXvYBJA1fyLri3RpME= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728279AbfFQQPF (ORCPT ); Mon, 17 Jun 2019 12:15:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:55040 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728193AbfFQQPE (ORCPT ); Mon, 17 Jun 2019 12:15:04 -0400 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 58F4C2182B for ; Mon, 17 Jun 2019 16:15:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560788103; bh=JVZ01VQ9q2BY9LSCSpDeGenC0gNyM0CCxXIGe7cpTRk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=u0yPsNKYjsVDPjixo7eGt49hpgnj9Qzul0OjSRqTnkpQP/9jPpaQD4omedpzMB2lr 9051sf80GG3JB8m+1Z2RCtEy/6xh2uXK0IsU7wtiqF8+FXMLdRKWfssLvW2hnqbCzC 6R4kLuNGpy6jCcaZPdNYXNItJBk70On/mmPqEBsE= Received: by mail-wr1-f41.google.com with SMTP id p11so10634206wre.7 for ; Mon, 17 Jun 2019 09:15:03 -0700 (PDT) X-Gm-Message-State: APjAAAWpACEn3Gvq9T5EkLVVh2od68uyQBUUjkGcOAaJM/FZURaBA+FK lzedXZVpN/kRSMfAewordas5vJEM0urtIfcgzXrbVw== X-Google-Smtp-Source: APXvYqw+aKjGo1oOpxFBQkSUulEn15Px0suva6OwH4jzhCqa52shTOhsLX33dxRlw1A3thzjVwlJh2/YrXPs9J0TKOY= X-Received: by 2002:adf:cc85:: with SMTP id p5mr16200961wrj.47.1560788101765; Mon, 17 Jun 2019 09:15:01 -0700 (PDT) MIME-Version: 1.0 References: <20190612170834.14855-1-mhillenb@amazon.de> <58788f05-04c3-e71c-12c3-0123be55012c@amazon.com> <63b1b249-6bc7-ffd9-99db-d36dd3f1a962@intel.com> <698ca264-123d-46ae-c165-ed62ea149896@intel.com> In-Reply-To: <698ca264-123d-46ae-c165-ed62ea149896@intel.com> From: Andy Lutomirski Date: Mon, 17 Jun 2019 09:14:50 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC 00/10] Process-local memory allocations for hiding KVM secrets To: Dave Hansen Cc: Andy Lutomirski , Alexander Graf , Thomas Gleixner , Marius Hillenbrand , kvm list , LKML , Kernel Hardening , Linux-MM , Alexander Graf , David Woodhouse , "the arch/x86 maintainers" , Peter Zijlstra Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 17, 2019 at 9:09 AM Dave Hansen wrote: > > On 6/17/19 8:54 AM, Andy Lutomirski wrote: > >>> Would that mean that with Meltdown affected CPUs we open speculation > >>> attacks against the mmlocal memory from KVM user space? > >> Not necessarily. There would likely be a _set_ of local PGDs. We could > >> still have pair of PTI PGDs just like we do know, they'd just be a local > >> PGD pair. > >> > > Unfortunately, this would mean that we need to sync twice as many > > top-level entries when we context switch. > > Yeah, PTI sucks. :) > > For anyone following along at home, I'm going to go off into crazy > per-cpu-pgds speculation mode now... Feel free to stop reading now. :) > > But, I was thinking we could get away with not doing this on _every_ > context switch at least. For instance, couldn't 'struct tlb_context' > have PGD pointer (or two with PTI) in addition to the TLB info? That > way we only do the copying when we change the context. Or does that tie > the implementation up too much with PCIDs? Hmm, that seems entirely reasonable. I think the nasty bit would be figuring out all the interactions with PV TLB flushing. PV TLB flushes already don't play so well with PCID tracking, and this will make it worse. We probably need to rewrite all that code regardless.