Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp425808iob; Tue, 3 May 2022 01:06:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSJ7kVL9DLD2EMxyV0HK5aWZ/LN/9mJ/7SXPkt/JRnm2K/3Tp5oZ/cNrG8EDpm1suvqTYa X-Received: by 2002:a63:fb4d:0:b0:3c2:6049:6e22 with SMTP id w13-20020a63fb4d000000b003c260496e22mr3817655pgj.2.1651565177166; Tue, 03 May 2022 01:06:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651565177; cv=none; d=google.com; s=arc-20160816; b=mxrRZEPsVixYrUM9orPxSlxR6bn5dgpZhMa0zGP+ZFFbudc84uohu7NyCk48AG0WkA F49vGqt6kbCuIQsB39SLGhYODXTKHntRz33SbX5fhKf4ThuTsSsfA97XcU2ap3BY+IUG h2KMarHic3mq4b3QnLy+HLJVgtrgGZ9IlpxSn2HMcMQTTd41nT9radTLBAjQxqPfldvD a+F/PcaaxGh7/ww16phjJ2wwBcbfpl4HHHFmFXbt0LYhKADJLNQDwH2goqPbNap66zkm RCpZ+E1vwfN29xxalhVtfPCDUIFoQ3bjkAW8NTKcOWeQ9WPP94taWRacNNCnKMLtzNCk /Lyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=CPlvce7L69paNaqumub1F6Cfev7BGcRK2NlVfi0FscE=; b=HjnVnOsU8KOfj+aSRGSygYm4ecsnfFuVzCT6+/04W+x3pEBLd8cz4MAFClWGrStmcv 2d/11ES455+MUm5oFmUhk345Ja32tC1QSMhta3qE5V4Tn7O7nscXjXu4tSA8HbLl3XwX 4Yf6xdtRt71boVzPUxV6GPjggxVSIXaeF4wwvxnoZneN66+8njUIpwejvDFUsELP3gNx p4N8XNyRM1m4M4/TiP9VP4G1lGfdbIHDw+6k6luVp+V5d9dGNcNC/YfrbaC46e3zBZRS u4KEX9FshF71xNhwRt71+P++BTt2gns+cRAeFwIetWiXslyhVTqQttV95luI34KoL0lQ kqqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u11-20020a056a00158b00b0050e08cc8163si2011847pfk.165.2022.05.03.01.05.49; Tue, 03 May 2022 01:06:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232396AbiECHqR (ORCPT + 99 others); Tue, 3 May 2022 03:46:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230514AbiECHqQ (ORCPT ); Tue, 3 May 2022 03:46:16 -0400 Received: from gardel.0pointer.net (gardel.0pointer.net [85.214.157.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB92537BF0; Tue, 3 May 2022 00:42:43 -0700 (PDT) Received: from gardel-login.0pointer.net (gardel-mail [85.214.157.71]) by gardel.0pointer.net (Postfix) with ESMTP id 9CEF6E804AA; Tue, 3 May 2022 09:42:41 +0200 (CEST) Received: by gardel-login.0pointer.net (Postfix, from userid 1000) id C8309160011; Tue, 3 May 2022 09:42:40 +0200 (CEST) Date: Tue, 3 May 2022 09:42:40 +0200 From: Lennart Poettering To: "Jason A. Donenfeld" Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, Dominik Brodowski , Greg Kroah-Hartman , Theodore Ts'o , Alexander Graf , Colm MacCarthaigh , Torben Hansen , Jann Horn Subject: Re: [PATCH 2/2] random: add fork_event sysctl for polling VM forks Message-ID: References: <20220502140602.130373-1-Jason@zx2c4.com> <20220502140602.130373-2-Jason@zx2c4.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Mo, 02.05.22 20:04, Jason A. Donenfeld (Jason@zx2c4.com) wrote: > > I can just tell you, that in systemd we'd have a usecase for consuming > > such a generation counter: we try to provide stable MAC addresses for > > synthetic network interfaces managed by networkd, so we hash them from > > /etc/machine-id, but otoh people also want them to change when they > > clone their VMs. We could very nicely solve this if we had a > > generation counter easily accessible from userspace, that starts at 0 > > initially. Because then we can hash as we always did when the counter > > is zero, but otherwise use something else, possibly hashed from the > > generation counter. > > This doesn't work, because you could have memory-A split into memory-A.1 > and memory-A.2, and both A.2 and A.1 would ++counter, and wind up with > the same new value "2". Yes, that's why I as vague about what to switch to if the counter is non-zero, i.e. "something else, *possibly* hashed…". For this MAC address usecase it's entirely sufficient to be able to distinguish if the system was closed at all, i.e. if the counter is zero or is non-zero. Because that would already be great for a policy of "hash it in a stable way from /etc/machine-id, if counter == 0" + "use random MAC once counter > 0". Such a MAC address policy I think should probably even be the new default in networkd, if we could implement it. For that we'd need a single bit of info from the kernel, indicating whether the sysem was cloned at all. i.e. if the vmgenid uuid is different from the one the system booted up first. Lennart -- Lennart Poettering, Berlin