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 D4B67EB64D9 for ; Mon, 19 Jun 2023 15:48:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231605AbjFSPsS (ORCPT ); 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> 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