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 1ED29C433EF for ; Mon, 2 May 2022 16:12:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240025AbiEBQQG (ORCPT ); Mon, 2 May 2022 12:16:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1386111AbiEBQPl (ORCPT ); Mon, 2 May 2022 12:15:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CD9EBC93; Mon, 2 May 2022 09:12:12 -0700 (PDT) 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 27141B8187D; Mon, 2 May 2022 16:12:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAA36C385A4; Mon, 2 May 2022 16:12:08 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="ZTIUL47t" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1651507927; 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=JthCT2QbwaNt2DB/F/sxRyKukGJ0r6w86ZPxmmA4K2I=; b=ZTIUL47tvZtuvCUjjZMxKFfCRkY8sopVe/HQ8NTwyO2noS3cv31HHMJV6NvUrCSpQ5dHy8 EjGU0nc0qviHQVdS3wDIY9FPoGDdY52b6Axrn3EkE76PlJx6kWhx1v6LPgD05WgaAxEkV+ YSxaN3oHZ8Khpp6ZW3HdGY+r4UpC91k= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id d724f6c4 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Mon, 2 May 2022 16:12:06 +0000 (UTC) Date: Mon, 2 May 2022 18:12:03 +0200 From: "Jason A. Donenfeld" To: Lennart Poettering 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 In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 02, 2022 at 05:40:02PM +0200, Lennart Poettering wrote: > On Mo, 02.05.22 16:06, Jason A. Donenfeld (Jason@zx2c4.com) wrote: > > > In order to inform userspace of virtual machine forks, this commit adds > > a "fork_event" sysctl, which does not return any data, but allows > > userspace processes to poll() on it for notification of VM forks. > > > > It avoids exposing the actual vmgenid from the hypervisor to userspace, > > in case there is any randomness value in keeping it secret. Rather, > > userspace is expected to simply use getrandom() if it wants a fresh > > value. > > Wouldn't it make sense to expose a monotonic 64bit counter of detected > VM forks since boot through read()? It might be interesting to know > for userspace how many forks it missed the fork events for. Moreover it > might be interesting to userspace to know if any fork happened so far > *at* *all*, by checking if the counter is non-zero. "Might be interesting" is different from "definitely useful". I'm not going to add this without a clear use case. This feature is pretty narrowly scoped in its objectives right now, and I intend to keep it that way if possible. (And yes, I realize that is likely considerably different from your development philosophy.) > > (Ideally that counter file would even be mmapable...) You missed the last year of discussion about this and why we have wound up here as a first step. Check the archives for extensive discussion. Jason