Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2706522ybi; Mon, 17 Jun 2019 09:15:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqwCsmrCkugJeFQ+s9498b1SsICFPHw5vFYD0AM1IA075r6dF3EFJslxN2qBcc1QHNCzMeWh X-Received: by 2002:a63:2c02:: with SMTP id s2mr21662621pgs.173.1560788135858; Mon, 17 Jun 2019 09:15:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560788135; cv=none; d=google.com; s=arc-20160816; b=d5CGtkJfulu2TmdE8gBLkenX6IdvvT8wgO+xOTWF/lC8/nNjFkNLuAPYNXhGVhvdU7 wBPkJr61ZW+xPgB3JJqPI4DX8DOkSFDlqiB8DKS/LTRujElLiPrpV1Ax792wIOZRw9Ms qu/QfytO7aP05YGKswFtfIU10f3Rn0GiXFAxQR8t7M81w8RXx2QI+s4P7D6szkDaIU+m RXtHfU4G7Luj26DXDYkNvtZS8X4Y1KsO2z2GoDnmLoYRFF+3IBU24C1BtO3vie/ZzY1E 9EjmlKb90NjAaJ2fA203X/i1DppEl7Xeh+zSyi64DzGFdtWPCOULhW/M45qVnfZJVeMg 79pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Bg8ht0VYJFjynacTGcfN8uFoIRVey1NJkX8qLdcDQJs=; b=fMT8kEhaenmjNBW0E4uAqgVhrTNYPSec24cELdifqWU+gIY47HQgxlcS5NRsnFfm9Q nFbQoc0TabZTVOfXgz4aUgcu2o+uCd4C3Zz3viLCwlGKVR8Rx0jsy57+2VidyXGQRIeL TTkoEfzM19G24nmtpiyEvmGXpEj1faQ7BN/L/3RmFIaLb4FcTbxjZdVzMxPeqPz8fjL8 HR5CHm7l+vNkmbgklI/MMiISXhM+IADUjDhyBmJ//FCzir9kIs3VDAnNMjQshPvWMkbq yzCIXELi4/0abAkVPMzuPbq9CPYzumHxOj9+zJeUT7QUCBOSP9bPGnxHtubDEA/uke9r y+IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=u0yPsNKY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u67si10667796pfu.154.2019.06.17.09.15.20; Mon, 17 Jun 2019 09:15:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=u0yPsNKY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728241AbfFQQPF (ORCPT + 99 others); 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-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.