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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8D95C4332F for ; Wed, 23 Feb 2022 16:36:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235928AbiBWQhQ (ORCPT ); Wed, 23 Feb 2022 11:37:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239792AbiBWQhO (ORCPT ); Wed, 23 Feb 2022 11:37:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C1603D48B; Wed, 23 Feb 2022 08:36:46 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1168AB81EB0; Wed, 23 Feb 2022 16:36:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D506C340F0; Wed, 23 Feb 2022 16:36:43 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="dBbUnj8Q" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1645634199; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=bHA9wsYJ+CM1DPnmNfQ6U6t4ARYsrAUZwd944SZ1sxQ=; b=dBbUnj8Ql1rn7FAM9tUx7QOeccnJ0Z+J90QA2NRMB22oXGOrYQ4THPe1b9gNNNzuDc2Rbg WFKaEvpmre/V326ePYzLARj899oTaO940Lp4D0jow0owG2+cfPO43/K8JgfsXjhbfX6w3C pTSz8qk0fkkwt5cQUp8mR9mxmGFUdSM= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 12a21bdc (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Wed, 23 Feb 2022 16:36:39 +0000 (UTC) Received: by mail-yw1-f181.google.com with SMTP id 00721157ae682-2d07ae0b1c4so217495627b3.11; Wed, 23 Feb 2022 08:36:36 -0800 (PST) X-Gm-Message-State: AOAM531ZzDp8T9MDua0yyllGNbHUpN0ZeGck1o7sIP1h4pYFj2M9G5Mx sWaLNfG8d1sE/I1Oz64kjt2fk4WE/OsZ6f/VtJQ= X-Google-Smtp-Source: ABdhPJxStncU0YhKj17fIfB92poX/i/hhH2go/+XupHLqAIG9vQtznWxOa4DHx+xY4+pyQBawqCM+CsOCCrLmtJDEw8= X-Received: by 2002:a81:184c:0:b0:2d7:607f:4b00 with SMTP id 73-20020a81184c000000b002d7607f4b00mr423650ywy.499.1645634196037; Wed, 23 Feb 2022 08:36:36 -0800 (PST) MIME-Version: 1.0 References: <20220223131231.403386-1-Jason@zx2c4.com> <20220223131231.403386-3-Jason@zx2c4.com> In-Reply-To: <20220223131231.403386-3-Jason@zx2c4.com> From: "Jason A. Donenfeld" Date: Wed, 23 Feb 2022 17:36:25 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH RFC v1 2/2] drivers/virt: add vmgenid driver for reinitializing RNG To: "K . Y . Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , linux-hyperv@vger.kernel.org Cc: "Woodhouse, David" , "Catangiu, Adrian Costin" , graf@amazon.com, Colm MacCarthaigh , "Singh, Balbir" , "Weiss, Radu" , Jann Horn , Greg Kroah-Hartman , "Theodore Ts'o" , Igor Mammedov , ehabkost@redhat.com, KVM list , adrian@parity.io, ben@skyportsystems.com, "Michael S. Tsirkin" , Linux Crypto Mailing List , lersek@redhat.com, linux-s390@vger.kernel.org, LKML , QEMU Developers Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Adding the Hyper-V people to this: On Wed, Feb 23, 2022 at 2:13 PM Jason A. Donenfeld wrote: > > VM Generation ID is a feature from Microsoft, described at > , and supported by > Hyper-V and QEMU. Its usage is described in Microsoft's RNG whitepaper, > , as: > > If the OS is running in a VM, there is a problem that most > hypervisors can snapshot the state of the machine and later rewind > the VM state to the saved state. This results in the machine running > a second time with the exact same RNG state, which leads to serious > security problems. To reduce the window of vulnerability, Windows > 10 on a Hyper-V VM will detect when the VM state is reset, retrieve > a unique (not random) value from the hypervisor, and reseed the root > RNG with that unique value. This does not eliminate the > vulnerability, but it greatly reduces the time during which the RNG > system will produce the same outputs as it did during a previous > instantiation of the same VM state. > > Linux has the same issue, and given that vmgenid is supported already by > multiple hypervisors, we can implement more or less the same solution. > So this commit wires up the vmgenid ACPI notification to the RNG's newly > added add_vmfork_randomness() function. > > This driver builds on prior work from Adrian Catangiu at Amazon, and it > is my hope that that team can resume maintenance of this driver. If any of you have some experience with the Hyper-V side of this protocol, could you take a look at this and see if it matches the way this is supposed to work? It appears to work fine with QEMU's behavior, at least, but I know Hyper-V has a lot of additional complexities. Thanks, Jason 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 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9CA93C433F5 for ; Wed, 23 Feb 2022 16:38:39 +0000 (UTC) Received: from localhost ([::1]:54744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nMuf0-0003Ns-Kr for qemu-devel@archiver.kernel.org; Wed, 23 Feb 2022 11:38:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:54374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMudF-0001e6-W4 for qemu-devel@nongnu.org; Wed, 23 Feb 2022 11:36:50 -0500 Received: from [2604:1380:4641:c500::1] (port=53878 helo=dfw.source.kernel.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMudD-0000x0-C1 for qemu-devel@nongnu.org; Wed, 23 Feb 2022 11:36:49 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 987866006F for ; Wed, 23 Feb 2022 16:36:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF603C340EB for ; Wed, 23 Feb 2022 16:36:44 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="edijnlfW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1645634198; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=bHA9wsYJ+CM1DPnmNfQ6U6t4ARYsrAUZwd944SZ1sxQ=; b=edijnlfWBr0NP8LwF9hwPw60rUhaJGCvwFzj3ZlG2AlKLTGyB8ojd1cW10gh+AkFaKRCFP EbUutuMeksjmo5CLVMeXBSboQR3N10auxwe+KaRFWYOZR5dIPtxgW8FC4iNHxOQMLGGSUZ grvJaqrDSQpwus7ykusVdu37UvXeaLI= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 6018f941 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for ; Wed, 23 Feb 2022 16:36:38 +0000 (UTC) Received: by mail-yw1-f179.google.com with SMTP id 00721157ae682-2d625082ae2so217435657b3.1 for ; Wed, 23 Feb 2022 08:36:37 -0800 (PST) X-Gm-Message-State: AOAM532E2bLx68CO+boX9VQgzhaArF1JB0DXONj1zTxniFQcxZd/axHB CI0mkMd0VmR9ZR/ZDeS+2cmuiUoQuEPQzebHOyQ= X-Google-Smtp-Source: ABdhPJxStncU0YhKj17fIfB92poX/i/hhH2go/+XupHLqAIG9vQtznWxOa4DHx+xY4+pyQBawqCM+CsOCCrLmtJDEw8= X-Received: by 2002:a81:184c:0:b0:2d7:607f:4b00 with SMTP id 73-20020a81184c000000b002d7607f4b00mr423650ywy.499.1645634196037; Wed, 23 Feb 2022 08:36:36 -0800 (PST) MIME-Version: 1.0 References: <20220223131231.403386-1-Jason@zx2c4.com> <20220223131231.403386-3-Jason@zx2c4.com> In-Reply-To: <20220223131231.403386-3-Jason@zx2c4.com> From: "Jason A. Donenfeld" Date: Wed, 23 Feb 2022 17:36:25 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH RFC v1 2/2] drivers/virt: add vmgenid driver for reinitializing RNG To: "K . Y . Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , linux-hyperv@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2604:1380:4641:c500::1 (failed) Received-SPF: pass client-ip=2604:1380:4641:c500::1; envelope-from=SRS0=pbN1=TG=zx2c4.com=Jason@kernel.org; helo=dfw.source.kernel.org X-Spam_score_int: -59 X-Spam_score: -6.0 X-Spam_bar: ------ X-Spam_report: (-6.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_HI=-5, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-s390@vger.kernel.org, "Michael S. Tsirkin" , Theodore Ts'o , ehabkost@redhat.com, KVM list , Jann Horn , QEMU Developers , Greg Kroah-Hartman , ben@skyportsystems.com, "Weiss, Radu" , lersek@redhat.com, adrian@parity.io, "Catangiu, Adrian Costin" , graf@amazon.com, Linux Crypto Mailing List , Igor Mammedov , LKML , Colm MacCarthaigh , "Singh, Balbir" , "Woodhouse, David" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Adding the Hyper-V people to this: On Wed, Feb 23, 2022 at 2:13 PM Jason A. Donenfeld wrote: > > VM Generation ID is a feature from Microsoft, described at > , and supported by > Hyper-V and QEMU. Its usage is described in Microsoft's RNG whitepaper, > , as: > > If the OS is running in a VM, there is a problem that most > hypervisors can snapshot the state of the machine and later rewind > the VM state to the saved state. This results in the machine running > a second time with the exact same RNG state, which leads to serious > security problems. To reduce the window of vulnerability, Windows > 10 on a Hyper-V VM will detect when the VM state is reset, retrieve > a unique (not random) value from the hypervisor, and reseed the root > RNG with that unique value. This does not eliminate the > vulnerability, but it greatly reduces the time during which the RNG > system will produce the same outputs as it did during a previous > instantiation of the same VM state. > > Linux has the same issue, and given that vmgenid is supported already by > multiple hypervisors, we can implement more or less the same solution. > So this commit wires up the vmgenid ACPI notification to the RNG's newly > added add_vmfork_randomness() function. > > This driver builds on prior work from Adrian Catangiu at Amazon, and it > is my hope that that team can resume maintenance of this driver. If any of you have some experience with the Hyper-V side of this protocol, could you take a look at this and see if it matches the way this is supposed to work? It appears to work fine with QEMU's behavior, at least, but I know Hyper-V has a lot of additional complexities. Thanks, Jason