From: Lennart Poettering <mzxreary@0pointer.de>
To: Babis Chalios <bchalios@amazon.es>
Cc: Theodore Ts'o <tytso@mit.edu>,
"Jason A. Donenfeld" <Jason@zx2c4.com>,
linux-kernel@vger.kernel.org, graf@amazon.de,
xmarcalx@amazon.co.uk
Subject: Re: [PATCH 1/1] vmgenid: emit uevent when VMGENID updates
Date: Mon, 19 Jun 2023 17:48:06 +0200 [thread overview]
Message-ID: <ZJB4trdk42vghv/o@gardel-login> (raw)
In-Reply-To: <20230531095119.11202-2-bchalios@amazon.es>
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 <bchalios@amazon.es>
> ---
> 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 <mzxreary@0pointer.de>
Lennart
--
Lennart Poettering, Berlin
next prev parent reply other threads:[~2023-06-19 15:48 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-31 9:51 [PATCH 0/1] User space notifications about VM cloning Babis Chalios
2023-05-31 9:51 ` [PATCH 1/1] vmgenid: emit uevent when VMGENID updates Babis Chalios
2023-06-19 9:14 ` Alexander Graf
2023-06-19 15:48 ` Lennart Poettering [this message]
2023-06-19 20:30 ` Jason A. Donenfeld
2023-06-19 20:37 ` Alexander Graf
2023-06-20 10:27 ` Babis Chalios
2023-06-20 11:28 ` Lennart Poettering
2023-11-14 12:51 ` Alexander Graf
2023-06-16 15:07 ` [PATCH 0/1] User space notifications about VM cloning Babis Chalios
2023-06-28 11:13 ` Alexander Graf
2023-06-28 11:22 ` Greg KH
2023-06-28 11:36 ` Jason A. Donenfeld
2023-06-28 11:47 ` Greg KH
2023-06-28 16:08 ` Greg KH
2023-06-28 16:27 ` Jason A. Donenfeld
2023-06-28 16:53 ` Amit Shah
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZJB4trdk42vghv/o@gardel-login \
--to=mzxreary@0pointer.de \
--cc=Jason@zx2c4.com \
--cc=bchalios@amazon.es \
--cc=graf@amazon.de \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=xmarcalx@amazon.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox