Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6591641rwd; Mon, 19 Jun 2023 09:18:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4+NDb/TIk0FxiWsp0lUucqyISRC1mHMmGZedYhjQ1IBTxXHLl/a3oNFsG6xw2NfVbtWp0v X-Received: by 2002:a92:d486:0:b0:340:d836:1f64 with SMTP id p6-20020a92d486000000b00340d8361f64mr9619729ilg.29.1687191509205; Mon, 19 Jun 2023 09:18:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687191509; cv=none; d=google.com; s=arc-20160816; b=tD7HFLX94+89cVVVuKv/b9GTzFHYa9TKrrL8AhkKEoIW+KCO67dwunFMXjUyHJj4SB 3xq1AA6RvvSfkK2OCLLTP2mS3UibQyqFnhglFjcRaWhLVNaXdjh/pzxCSpWawlrxpWO7 RoSAZGPzPF6j+/yFMKRouzdJAxHwm00Kd9TuaBvWrnCapnIXeaRu5673Mpq3I9YL4Ksz 3SHAdaWhIrbe5vtVpaYu2QzF87a1VU9J6AYfPWTE0HjI+pZ3mL7m664P5jRMhYEtBcQf khqxaP4PbSqWneOLGGblXjZWYZKxfD273fXBX2twFQU7rHuCKYqXnYXpCwNBWEdx4X3I iOOw== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=2m+t53oT2WrrpXP7VCEiXrD2UhHcnDAI8UpD9jRXpzw=; b=Z0KuIFz5rD2F/5MGxLwIvmoeAvTC1WHtcm9WRzLjcNCpWrfCmrG92w8nSHxyckZ4aW I4EAADr478/vRbzhexmsyoQ/5e3ybtDl3zYD2cKgEIeFFioP4VKQWt+JZX8OVzu8bTxM YqNBy6C+X/YLqx9jnaovj8Mj2Hy0/acK1tCMvW+oq9e9LgtFgJSnNv063trvn5M31VwG FSBYbylkhLmHpULVZfZMzEeBak1U1tZPzk4qZRfthHrkF71C2HeotKML3uwTUvJ9SGBM 6ZAdOuC0BgULnCbnnKyPFWhxzGgiObamj8i7t4MZt4We5cvm4byMfm0hdYyGW/K1Xf61 Atmg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-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 y7-20020a655287000000b0052cad187979si5801143pgp.147.2023.06.19.09.18.14; Mon, 19 Jun 2023 09:18:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231466AbjFSPsS (ORCPT + 99 others); Mon, 19 Jun 2023 11:48:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229825AbjFSPsR (ORCPT ); Mon, 19 Jun 2023 11:48:17 -0400 Received: from gardel.0pointer.net (gardel.0pointer.net [85.214.157.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77B2CA4 for ; Mon, 19 Jun 2023 08:48:11 -0700 (PDT) Received: from gardel-login.0pointer.net (gardel-mail [IPv6:2a01:238:43ed:c300:10c3:bcf3:3266:da74]) by gardel.0pointer.net (Postfix) with ESMTP id DADEAE80B90; Mon, 19 Jun 2023 17:48:06 +0200 (CEST) Received: by gardel-login.0pointer.net (Postfix, from userid 1000) id 976551601D3; Mon, 19 Jun 2023 17:48:06 +0200 (CEST) Date: Mon, 19 Jun 2023 17:48:06 +0200 From: Lennart Poettering To: Babis Chalios Cc: Theodore Ts'o , "Jason A. Donenfeld" , linux-kernel@vger.kernel.org, graf@amazon.de, xmarcalx@amazon.co.uk Subject: Re: [PATCH 1/1] vmgenid: emit uevent when VMGENID updates Message-ID: References: <20230531095119.11202-1-bchalios@amazon.es> <20230531095119.11202-2-bchalios@amazon.es> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230531095119.11202-2-bchalios@amazon.es> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, T_SCC_BODY_TEXT_LINE,T_SPF_TEMPERROR 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-kernel@vger.kernel.org On Mi, 31.05.23 11:51, Babis Chalios (bchalios@amazon.es) wrote: > We receive an ACPI notification every time the VM Generation ID changes > and use the new ID as fresh randomness added to the entropy pool. This > commits emits a uevent every time we receive the ACPI notification, as a > means to notify the user space that it now is in a new VM. > > Signed-off-by: Babis Chalios > --- > drivers/virt/vmgenid.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/virt/vmgenid.c b/drivers/virt/vmgenid.c > index a1c467a0e9f7..b67a28da4702 100644 > --- a/drivers/virt/vmgenid.c > +++ b/drivers/virt/vmgenid.c > @@ -68,6 +68,7 @@ static int vmgenid_add(struct acpi_device *device) > static void vmgenid_notify(struct acpi_device *device, u32 event) > { > struct vmgenid_state *state = acpi_driver_data(device); > + char *envp[] = { "NEW_VMGENID=1", NULL }; > u8 old_id[VMGENID_SIZE]; > > memcpy(old_id, state->this_id, sizeof(old_id)); > @@ -75,6 +76,7 @@ static void vmgenid_notify(struct acpi_device *device, u32 event) > if (!memcmp(old_id, state->this_id, sizeof(old_id))) > return; > add_vmfork_randomness(state->this_id, sizeof(state->this_id)); > + kobject_uevent_env(&device->dev.kobj, KOBJ_CHANGE, envp); > } > > static const struct acpi_device_id vmgenid_ids[] = { Beautifully simple. Looks good to me. Would love to make use of this from systemd. Reviewed-by: Lennart Poettering Lennart -- Lennart Poettering, Berlin