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: <dce30be7-90d3-4a6a-9b26-44d76c3190a0@intel.com>
Date: Thu, 11 Sep 2025 15:07:21 -0700
From: Reinette Chatre <reinette.chatre@...el.com>
To: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>, Andrew Morton
	<akpm@...ux-foundation.org>
CC: Jonathan Corbet <corbet@....net>, Matthew Wilcox <willy@...radead.org>,
	Guo Ren <guoren@...nel.org>, Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
	Heiko Carstens <hca@...ux.ibm.com>, Vasily Gorbik <gor@...ux.ibm.com>,
	Alexander Gordeev <agordeev@...ux.ibm.com>, Christian Borntraeger
	<borntraeger@...ux.ibm.com>, Sven Schnelle <svens@...ux.ibm.com>, "David S .
 Miller" <davem@...emloft.net>, Andreas Larsson <andreas@...sler.com>, "Arnd
 Bergmann" <arnd@...db.de>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Dan Williams <dan.j.williams@...el.com>, Vishal Verma
	<vishal.l.verma@...el.com>, Dave Jiang <dave.jiang@...el.com>, Nicolas Pitre
	<nico@...xnic.net>, Muchun Song <muchun.song@...ux.dev>, Oscar Salvador
	<osalvador@...e.de>, David Hildenbrand <david@...hat.com>, Konstantin Komarov
	<almaz.alexandrovich@...agon-software.com>, Baoquan He <bhe@...hat.com>,
	Vivek Goyal <vgoyal@...hat.com>, Dave Young <dyoung@...hat.com>, Tony Luck
	<tony.luck@...el.com>, Dave Martin <Dave.Martin@....com>, James Morse
	<james.morse@....com>, Alexander Viro <viro@...iv.linux.org.uk>, "Christian
 Brauner" <brauner@...nel.org>, Jan Kara <jack@...e.cz>, "Liam R . Howlett"
	<Liam.Howlett@...cle.com>, Vlastimil Babka <vbabka@...e.cz>, Mike Rapoport
	<rppt@...nel.org>, Suren Baghdasaryan <surenb@...gle.com>, Michal Hocko
	<mhocko@...e.com>, Hugh Dickins <hughd@...gle.com>, Baolin Wang
	<baolin.wang@...ux.alibaba.com>, Uladzislau Rezki <urezki@...il.com>, "Dmitry
 Vyukov" <dvyukov@...gle.com>, Andrey Konovalov <andreyknvl@...il.com>, "Jann
 Horn" <jannh@...gle.com>, Pedro Falcato <pfalcato@...e.de>,
	<linux-doc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<linux-fsdevel@...r.kernel.org>, <linux-csky@...r.kernel.org>,
	<linux-mips@...r.kernel.org>, <linux-s390@...r.kernel.org>,
	<sparclinux@...r.kernel.org>, <nvdimm@...ts.linux.dev>,
	<linux-cxl@...r.kernel.org>, <linux-mm@...ck.org>, <ntfs3@...ts.linux.dev>,
	<kexec@...ts.infradead.org>, <kasan-dev@...glegroups.com>, Jason Gunthorpe
	<jgg@...dia.com>
Subject: Re: [PATCH v2 08/16] mm: add ability to take further action in
 vm_area_desc

Hi Lorenzo,

On 9/10/25 1:22 PM, Lorenzo Stoakes wrote:

...

> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> index 4a441f78340d..ae6c7a0a18a7 100644
> --- a/include/linux/mm_types.h
> +++ b/include/linux/mm_types.h
> @@ -770,6 +770,64 @@ struct pfnmap_track_ctx {
>  };
>  #endif
>  
> +/* What action should be taken after an .mmap_prepare call is complete? */
> +enum mmap_action_type {
> +	MMAP_NOTHING,		 /* Mapping is complete, no further action. */
> +	MMAP_REMAP_PFN,		 /* Remap PFN range based on desc->remap. */
> +	MMAP_INSERT_MIXED,	 /* Mixed map based on desc->mixedmap. */
> +	MMAP_INSERT_MIXED_PAGES, /* Mixed map based on desc->mixedmap_pages. */
> +	MMAP_CUSTOM_ACTION,	 /* User-provided hook. */
> +};
> +
> +struct mmap_action {
> +	union {
> +		/* Remap range. */
> +		struct {
> +			unsigned long addr;
> +			unsigned long pfn;
> +			unsigned long size;
> +			pgprot_t pgprot;
> +		} remap;
> +		/* Insert mixed map. */
> +		struct {
> +			unsigned long addr;
> +			unsigned long pfn;
> +			unsigned long num_pages;
> +		} mixedmap;
> +		/* Insert specific mixed map pages. */
> +		struct {
> +			unsigned long addr;
> +			struct page **pages;
> +			unsigned long num_pages;
> +			/* kfree pages on completion? */
> +			bool kfree_pages :1;
> +		} mixedmap_pages;
> +		struct {
> +			int (*action_hook)(struct vm_area_struct *vma);
> +		} custom;
> +	};
> +	enum mmap_action_type type;
> +
> +	/*
> +	 * If specified, this hook is invoked after the selected action has been
> +	 * successfully completed. Not that the VMA write lock still held.

A typo that may trip tired eyes: Not -> Note ? (perhaps also "is still held"?)
(also in the duplicate changes to tools/testing/vma/vma_internal.h)

> +	 *
> +	 * The absolute minimum ought to be done here.
> +	 *
> +	 * Returns 0 on success, or an error code.
> +	 */
> +	int (*success_hook)(struct vm_area_struct *vma);
> +
> +	/*
> +	 * If specified, this hook is invoked when an error occurred when
> +	 * attempting the selection action.
> +	 *
> +	 * The hook can return an error code in order to filter the error, but
> +	 * it is not valid to clear the error here.
> +	 */
> +	int (*error_hook)(int err);
> +};

Reinette



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ