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: <ae80c1b9-bafb-401c-9789-37a774c702c0@t-8ch.de>
Date: Wed, 12 Feb 2025 13:29:00 +0100
From: Thomas Weißschuh <linux@...ssschuh.net>
To: Mike Rapoport <rppt@...nel.org>
Cc: linux-kernel@...r.kernel.org, Alexander Graf <graf@...zon.com>, 
	Andrew Morton <akpm@...ux-foundation.org>, Andy Lutomirski <luto@...nel.org>, 
	Anthony Yznaga <anthony.yznaga@...cle.com>, Arnd Bergmann <arnd@...db.de>, 
	Ashish Kalra <ashish.kalra@....com>, Benjamin Herrenschmidt <benh@...nel.crashing.org>, 
	Borislav Petkov <bp@...en8.de>, Catalin Marinas <catalin.marinas@....com>, 
	Dave Hansen <dave.hansen@...ux.intel.com>, David Woodhouse <dwmw2@...radead.org>, 
	Eric Biederman <ebiederm@...ssion.com>, Ingo Molnar <mingo@...hat.com>, 
	James Gowans <jgowans@...zon.com>, Jonathan Corbet <corbet@....net>, 
	Krzysztof Kozlowski <krzk@...nel.org>, Mark Rutland <mark.rutland@....com>, 
	Paolo Bonzini <pbonzini@...hat.com>, Pasha Tatashin <pasha.tatashin@...een.com>, 
	"H. Peter Anvin" <hpa@...or.com>, Peter Zijlstra <peterz@...radead.org>, 
	Pratyush Yadav <ptyadav@...zon.de>, Rob Herring <robh+dt@...nel.org>, Rob Herring <robh@...nel.org>, 
	Saravana Kannan <saravanak@...gle.com>, Stanislav Kinsburskii <skinsburskii@...ux.microsoft.com>, 
	Steven Rostedt <rostedt@...dmis.org>, Thomas Gleixner <tglx@...utronix.de>, 
	Tom Lendacky <thomas.lendacky@....com>, Usama Arif <usama.arif@...edance.com>, 
	Will Deacon <will@...nel.org>, devicetree@...r.kernel.org, kexec@...ts.infradead.org, 
	linux-arm-kernel@...ts.infradead.org, linux-doc@...r.kernel.org, linux-mm@...ck.org, x86@...nel.org
Subject: Re: [PATCH v4 05/14] kexec: Add Kexec HandOver (KHO) generation
 helpers

On 2025-02-06 15:27:45+0200, Mike Rapoport wrote:
> From: Alexander Graf <graf@...zon.com>
> 
> This patch adds the core infrastructure to generate Kexec HandOver
> metadata. Kexec HandOver is a mechanism that allows Linux to preserve
> state - arbitrary properties as well as memory locations - across kexec.
> 
> It does so using 2 concepts:
> 
>   1) Device Tree - Every KHO kexec carries a KHO specific flattened
>      device tree blob that describes the state of the system. Device
>      drivers can register to KHO to serialize their state before kexec.
> 
>   2) Scratch Regions - CMA regions that we allocate in the first kernel.
>      CMA gives us the guarantee that no handover pages land in those
>      regions, because handover pages must be at a static physical memory
>      location. We use these regions as the place to load future kexec
>      images so that they won't collide with any handover data.
> 
> Signed-off-by: Alexander Graf <graf@...zon.com>
> Co-developed-by: Mike Rapoport (Microsoft) <rppt@...nel.org>
> Signed-off-by: Mike Rapoport (Microsoft) <rppt@...nel.org>
> ---
>  Documentation/ABI/testing/sysfs-kernel-kho    |  53 +++
>  .../admin-guide/kernel-parameters.txt         |  24 +
>  MAINTAINERS                                   |   1 +
>  include/linux/cma.h                           |   2 +
>  include/linux/kexec.h                         |  18 +
>  include/linux/kexec_handover.h                |  10 +
>  kernel/Makefile                               |   1 +
>  kernel/kexec_handover.c                       | 450 ++++++++++++++++++
>  mm/internal.h                                 |   3 -
>  mm/mm_init.c                                  |   8 +
>  10 files changed, 567 insertions(+), 3 deletions(-)
>  create mode 100644 Documentation/ABI/testing/sysfs-kernel-kho
>  create mode 100644 include/linux/kexec_handover.h
>  create mode 100644 kernel/kexec_handover.c

<snip>

> --- /dev/null
> +++ b/include/linux/kexec_handover.h
> @@ -0,0 +1,10 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef LINUX_KEXEC_HANDOVER_H
> +#define LINUX_KEXEC_HANDOVER_H

#include <linux/types.h>

> +
> +struct kho_mem {
> +	phys_addr_t addr;
> +	phys_addr_t size;
> +};
> +
> +#endif /* LINUX_KEXEC_HANDOVER_H */

<snip>

> +static ssize_t dt_read(struct file *file, struct kobject *kobj,
> +		       struct bin_attribute *attr, char *buf,

Please make the bin_attribute argument const. Currently both work, but
the non-const variant will go away.
This way I can test my stuff on linux-next.

> +		       loff_t pos, size_t count)
> +{
> +	mutex_lock(&kho_out.lock);
> +	memcpy(buf, attr->private + pos, count);
> +	mutex_unlock(&kho_out.lock);
> +
> +	return count;
> +}
> +
> +struct bin_attribute bin_attr_dt_kern = __BIN_ATTR(dt, 0400, dt_read, NULL, 0);

The new __BIN_ATTR_ADMIN_RO() could make this slightly shorter.

<snip>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ