Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp2306757pxu; Sat, 17 Oct 2020 20:37:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyN3+64cNcCDPADX0UM3cA7hZl3GWhwMWbVtRwMMRBRdjvzpZgNYxAEoqJf9fy0SSOaBgEx X-Received: by 2002:a17:906:2894:: with SMTP id o20mr10911429ejd.221.1602992246146; Sat, 17 Oct 2020 20:37:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602992246; cv=none; d=google.com; s=arc-20160816; b=dXpfFUxybJyTQwBhLG3OtyqI9bVl6r4U2hIGbi3KaEsscDmYb0s8AD6Di0E/zYH18U JepnfxUv0b/nKnKvekiTUxqAW0wbeV9QwGcow5KfIOW81rdeIIoAHIKnmc63mnhFAGwz MWZXjvb1pkqsoTyw3cvcRALCqMqz/c2t0vlaA8pgXtK9gXbJoe+FiLXTjxZpYJEeiUeU Tn1B5NwhNBar8Oj+NESjBEkfZlSDrGNyaDczmSnqAX4UQ4QQbyINEQ/dXDVdwGCSTAYk 8jBOD8l6ULJnnwFJ1jTYEkIX4qFtbyu52ZWAIL5VoKy6cY/TJ23HgrrbBUIALfXwBD/Q eGZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=EoL7d0lHzdswPEFGsAEJJdNfE07sA8igVy5PEUcTbDQ=; b=T7OezhrqmeGA4sYNwdtp8MM7SJaje/5oHS+QDmqSmOPKGyAKcUY4WYGNTNmsfljuZR fbsTi7XRRm1UCNvOOZffk+PErWXz7ZWvpcJABT/kfYkLIP4/yaz6SmzUFipOejMmoupm EhM1NPTGR9Amgv+x8w+Gl7WncdE15eJK/XsX8Hjv2iMhDrqZE5qvKSkomyGyrvjVDity 2hSLlpNwfSNDSfNhC1CcBddamIoyGbEFU3eqZL+Tf9rXVMUQ13hmG3o89xvozNPJmjOS ViDHiuqHBubB89cdBH385OB1VhE4dSvXyyQ6JdgNbUCMQtTkmazhod+3m1eTc1w4d6Yp f/vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=JYBvkmsN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dm9si5404249edb.76.2020.10.17.20.37.03; Sat, 17 Oct 2020 20:37:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=JYBvkmsN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2439921AbgJRCId (ORCPT + 99 others); Sat, 17 Oct 2020 22:08:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2439906AbgJRCId (ORCPT ); Sat, 17 Oct 2020 22:08:33 -0400 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18199C0613CE for ; Sat, 17 Oct 2020 19:08:33 -0700 (PDT) Received: by mail-lj1-x241.google.com with SMTP id a4so7213574lji.12 for ; Sat, 17 Oct 2020 19:08:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=EoL7d0lHzdswPEFGsAEJJdNfE07sA8igVy5PEUcTbDQ=; b=JYBvkmsN9RysEeFQRgQMS2IGgQheKP8WCpVEITeoShBcDrScb2YzXJWCS9fBQBrxMO n86hAFDTEQHXskSLJ578m/TKYBOiwMg0z/aLu4hSKM9fzy3Bml2AtFnKiNFHXmC81ou5 oLgoTyjjd7m8dU7zn1iDkaLBmUIFwukS3W1degboeUcB5xxmHAwJ7X7ZJjY5qLq4Uevz 9565oX51vhmKmr/jiZRuPNAZjyZvYkS6kUYo9TyvCsqYY8xkBsy/gcixSZeElDfa4GKl lQjC5lLseYNii8XoYpb7znRj1djIzK3pwUzl9c71Hf2cfPLya0ovLXiar856omGyFgtc cBdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=EoL7d0lHzdswPEFGsAEJJdNfE07sA8igVy5PEUcTbDQ=; b=pgpyUatk6FkLf4vRT3725rRerkzzcSIZMldqz0rx+8GcED8lwKf4goSQ3hGQol6amd 6o8pTG+SZoW2eq3Y4iFQwPnP+YKFrJn5LzNJ1CZbSzoGLBLQQdqHfht466+Gr2VsA0Le izq/N0pgyjJzqzrpcTkJvTmduTiEQA8FuLsBEb7AEQa/72z1rn7zmO7opalJowf1LXR7 R9LQGixRkmh8A+nVqB2ASe/glRdyq2/h3I4KDpIQr7B5FloGelgeCrByhppEnmMoyGk8 8h1NtFo4XWzxb0EDJQZd5Oefk7cymUmrY83wCmHZIu/XHVPsFAPjDdjSXjA+zIXZ7qzY ZlFA== X-Gm-Message-State: AOAM533n/9NkOIcRzVzySNWAK7dlQPV6zhJ6sGL+MdcicDJb86XKzpus Sf3X7kxKW4LpAf/yGBIye/kRdhYrwZXwX37XPYc+HA== X-Received: by 2002:a05:651c:1313:: with SMTP id u19mr1073920lja.47.1602986911177; Sat, 17 Oct 2020 19:08:31 -0700 (PDT) MIME-Version: 1.0 References: <788878CE-2578-4991-A5A6-669DCABAC2F2@amazon.com> <20201017033606.GA14014@1wt.eu> <6CC3DB03-27BA-4F5E-8ADA-BE605D83A85C@amazon.com> <20201017053712.GA14105@1wt.eu> <20201017064442.GA14117@1wt.eu> In-Reply-To: From: Jann Horn Date: Sun, 18 Oct 2020 04:08:04 +0200 Message-ID: Subject: Re: [PATCH] drivers/virt: vmgenid: add vm generation id driver To: Alexander Graf Cc: "Jason A. Donenfeld" , Willy Tarreau , Colm MacCarthaigh , "Catangiu, Adrian Costin" , Andy Lutomirski , "Theodore Y. Ts'o" , Eric Biggers , "open list:DOCUMENTATION" , kernel list , "open list:VIRTIO GPU DRIVER" , "Woodhouse, David" , bonzini@gnu.org, "Singh, Balbir" , "Weiss, Radu" , oridgar@gmail.com, ghammer@redhat.com, Jonathan Corbet , Greg Kroah-Hartman , "Michael S. Tsirkin" , Qemu Developers , KVM list , Michal Hocko , "Rafael J. Wysocki" , Pavel Machek , Linux API , Christian Borntraeger , Michael Ellerman Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Oct 17, 2020 at 8:09 PM Alexander Graf wrote: > There are applications way beyond that though. What do you do with > applications that already consumed randomness? For example a cached pool > of SSL keys. Or a higher level language primitive that consumes > randomness and caches its seed somewhere in an internal data structure. For deterministic protection, those would also have to poll some memory location that tells them whether the VmGenID changed: 1. between reading entropy from their RNG pool and using it 2. between collecting data from external sources (user input, clock, ...) and encrypting it and synchronously shoot down the connection if a change happened. If e.g. an application inside the VM has an AES-GCM-encrypted TLS connection and, directly after the VM is restored, triggers an application-level timeout that sends some fixed message across the connection, then the TLS library must guarantee that either the VM was already committed to sending exactly that message before the VM was forked or the message will be blocked. If we don't do that, an attacker who captures both a single packet from the forked VM and traffic from the old VM can decrypt the next message from the old VM after the fork (because AES-GCM is like AES-CTR plus an authenticator, and CTR means that when keystream reuse occurs and one of the plaintexts is known, the attacker can simply recover the other plaintext using XOR). (Or maybe, in disaster failover environments, TLS 1.3 servers could get away with rekeying the connection instead of shooting it down? Ask your resident friendly cryptographer whether that would be secure, I am not one.) I don't think a mechanism based around asynchronously telling the application and waiting for it to confirm the rotation at a later point is going to cut it; we should have some hard semantics on when an application needs to poll this value. > Or even worse: your system's host ssh key. Mmmh... I think I normally would not want a VM to reset its host ssh key after merely restoring a snapshot though? And more importantly, Microsoft's docs say that they also change the VmGenID on disaster failover. I think you very much wouldn't want your server to lose its host key every time disaster failover happens. On the other hand, after importing a public VM image, it might be a good idea. I guess you could push that responsibility on the user, by adding an option to the sshd_config that tells OpenSSH whether the host key should be rotated on an ID change or not... but that still would not be particularly pretty. Ideally we would have the host tell us what type of events happened to the VM, or something like that... or maybe even get the host VM management software to ask the user whether they're importing a public image... I really feel like with Microsoft's current protocol, we don't get enough information to figure out what we should do about private long-term authentication keys.