From: Babis Chalios <bchalios@amazon.es>
To: Theodore Ts'o <tytso@mit.edu>,
"Jason A. Donenfeld" <Jason@zx2c4.com>,
<linux-kernel@vger.kernel.org>
Cc: <bchalios@amazon.es>, <graf@amazon.de>, <mzxreary@0pointer.de>,
<xmarcalx@amazon.co.uk>
Subject: [PATCH 1/1] vmgenid: emit uevent when VMGENID updates
Date: Wed, 31 May 2023 11:51:19 +0200 [thread overview]
Message-ID: <20230531095119.11202-2-bchalios@amazon.es> (raw)
In-Reply-To: <20230531095119.11202-1-bchalios@amazon.es>
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[] = {
--
2.39.2
next prev parent reply other threads:[~2023-05-31 9:52 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 ` Babis Chalios [this message]
2023-06-19 9:14 ` [PATCH 1/1] vmgenid: emit uevent when VMGENID updates Alexander Graf
2023-06-19 15:48 ` Lennart Poettering
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=20230531095119.11202-2-bchalios@amazon.es \
--to=bchalios@amazon.es \
--cc=Jason@zx2c4.com \
--cc=graf@amazon.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mzxreary@0pointer.de \
--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