lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZJB4trdk42vghv/o@gardel-login>
Date:   Mon, 19 Jun 2023 17:48:06 +0200
From:   Lennart Poettering <mzxreary@...inter.de>
To:     Babis Chalios <bchalios@...zon.es>
Cc:     Theodore Ts'o <tytso@....edu>,
        "Jason A. Donenfeld" <Jason@...c4.com>,
        linux-kernel@...r.kernel.org, graf@...zon.de, xmarcalx@...zon.co.uk
Subject: Re: [PATCH 1/1] vmgenid: emit uevent when VMGENID updates

On Mi, 31.05.23 11:51, Babis Chalios (bchalios@...zon.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@...zon.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@...inter.de>

Lennart

--
Lennart Poettering, Berlin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ