Re: [PATCH v2 6/6] mm: Introduce ctor/dtor at PGD level

2025-01-21 Thread Heiko Carstens
On Tue, Jan 21, 2025 at 05:37:33PM +0100, Alexander Gordeev wrote: > On Fri, Jan 03, 2025 at 06:44:15PM +, Kevin Brodsky wrote: > > Hi Kevin, > ... > > diff --git a/arch/s390/include/asm/pgalloc.h > > b/arch/s390/include/asm/pgalloc.h > > index 5fced6d3c36b..b19b6ed2ab53 100644 > > --- a/arch

Re: [PATCH v2 6/6] mm: Introduce ctor/dtor at PGD level

2025-01-21 Thread Alexander Gordeev
On Fri, Jan 03, 2025 at 06:44:15PM +, Kevin Brodsky wrote: Hi Kevin, ... > diff --git a/arch/s390/include/asm/pgalloc.h b/arch/s390/include/asm/pgalloc.h > index 5fced6d3c36b..b19b6ed2ab53 100644 > --- a/arch/s390/include/asm/pgalloc.h > +++ b/arch/s390/include/asm/pgalloc.h > @@ -130,11 +130,

Re: [PATCH RFC v2 16/29] mm: asi: Map kernel text and static data as nonsensitive

2025-01-21 Thread Brendan Jackman
On Fri, 10 Jan 2025 at 19:41, Brendan Jackman wrote: > + asi_clone_pgd(asi_global_nonsensitive_pgd, init_mm.pgd, > VMEMMAP_START); > + asi_clone_pgd(asi_global_nonsensitive_pgd, init_mm.pgd, > + VMEMMAP_START + (1UL << PGDIR_SHIFT)); There's a bug here that Yosry

[REGRESSION] Re: [PATCH v7 8/8] x86/module: enable ROX caches for module text on 64 bit

2025-01-21 Thread Ville Syrjälä
On Wed, Oct 23, 2024 at 07:27:11PM +0300, Mike Rapoport wrote: > From: "Mike Rapoport (Microsoft)" > > Enable execmem's cache of PMD_SIZE'ed pages mapped as ROX for module > text allocations on 64 bit. Hi, This breaks resume from hibernation on my Alderlake laptop. Fortunately this still rever

Re: [PATCH RFC v2 01/29] mm: asi: Make some utility functions noinstr compatible

2025-01-21 Thread Borislav Petkov
On Fri, Jan 10, 2025 at 06:40:27PM +, Brendan Jackman wrote: > Subject: Re: [PATCH RFC v2 01/29] mm: asi: Make some utility functions > noinstr compatible The tip tree preferred format for patch subject prefixes is 'subsys/component:', e.g. 'x86/apic:', 'x86/mm/fault:', 'sched/fair:', 'genirq

Re: [PATCH RFC v2 01/29] mm: asi: Make some utility functions noinstr compatible

2025-01-21 Thread Borislav Petkov
On Thu, Jan 16, 2025 at 02:22:42PM +0100, Brendan Jackman wrote: > Sure. I'm actually not even sure that for a [PATCH]-quality thing this > cross-cutting commit even makes sense - once we've decided on the > general way to solve this problem, perhaps the changes should just be > part of the commit

Re: [PATCH RFC v2 02/29] x86: Create CONFIG_MITIGATION_ADDRESS_SPACE_ISOLATION

2025-01-21 Thread Borislav Petkov
On Fri, Jan 10, 2025 at 06:40:28PM +, Brendan Jackman wrote: > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > index > 7b9a7e8f39acc8e9aeb7d4213e87d71047865f5c..5a50582eb210e9d1309856a737d32b76fa1bfc85 > 100644 > --- a/arch/x86/Kconfig > +++ b/arch/x86/Kconfig > @@ -2519,6 +2519,20 @@ conf

Re: [PATCH RFC v2 01/29] mm: asi: Make some utility functions noinstr compatible

2025-01-21 Thread Brendan Jackman
On Thu, 16 Jan 2025 at 01:21, Borislav Petkov wrote: > > Unfortunately Thomas pointed out this will prevent the function from > > being inlined at call sites in .text. > > > > So far I haven't been able[1] to find a formulation that lets us : > > 1. avoid calls from .noinstr.text -> .text, > > 2.

Re: [PATCH RFC v2 01/29] mm: asi: Make some utility functions noinstr compatible

2025-01-21 Thread Borislav Petkov
On Thu, Jan 16, 2025 at 01:18:58AM +0100, Borislav Petkov wrote: > Long story short, lemme try to poke around tomorrow to try to figure out what > actually happens. It could be caused by the part of Rik's patches and this one > inlining things. We'll see... Looks transient... The very similar gues

Re: [PATCH v2 00/10] x86/module: rework ROX cache to avoid writable copy

2025-01-21 Thread Peter Zijlstra
On Tue, Jan 21, 2025 at 11:57:29AM +0200, Mike Rapoport wrote: > Kirill A. Shutemov (1): > x86/mm/pat: restore large ROX pages after fragmentation The duplication between pmd and pud collapse is a bit annoying, but so be it. > Mike Rapoport (Microsoft) (9): > x86/mm/pat: cpa-test: fix length

[PATCH v2 10/10] x86: re-enable EXECMEM_ROX support

2025-01-21 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" after rework of execmem ROX caches Signed-off-by: Mike Rapoport (Microsoft) --- arch/x86/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index ef6cfea9df73..9d7bd0ae48c4 100644 --- a/arch/x86/Kconfig +++ b/arch/x

[PATCH v2 09/10] module: drop unused module_writable_address()

2025-01-21 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" module_writable_address() is unused and can be removed. Signed-off-by: Mike Rapoport (Microsoft) --- include/linux/module.h | 10 -- 1 file changed, 10 deletions(-) diff --git a/include/linux/module.h b/include/linux/module.h index e9fc9d1fa476..22209

[PATCH v2 08/10] Revert "x86/module: prepare module loading for ROX allocations of text"

2025-01-21 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" The module code does not create a writable copy of the executable memory anymore so there is no need to handle it in module relocation and alternatives patching. This reverts commit 9bfc4824fd4836c16bb44f922bfaffba5da3e4f3. Signed-off-by: Mike Rapoport (Microso

[PATCH v2 07/10] module: switch to execmem API for remapping as RW and restoring ROX

2025-01-21 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" Instead of using writable copy for module text sections, temporarily remap the memory allocated from execmem's ROX cache as writable and restore its ROX permissions after the module is formed. This will allow removing nasty games with writable copy in alternativ

[PATCH v2 06/10] module: introduce MODULE_STATE_GONE

2025-01-21 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" In order to use execmem's API for temporal remapping of the memory allocated from ROX cache as writable, there is a need to distinguish between the state when the module is being formed and the state when it is deconstructed and freed so that when module_memory_f

[PATCH v2 00/10] x86/module: rework ROX cache to avoid writable copy

2025-01-21 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" Hi, Following Peter's comments [1] these patches rework handling of ROX caches for module text allocations. Instead of using a writable copy that really complicates alternatives patching, temporarily remap parts of a large ROX page as RW for the time of module

[PATCH v2 04/10] execmem: don't remove ROX cache from the direct map

2025-01-21 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" The memory allocated for the ROX cache was removed from the direct map to reduce amount of direct map updates, however this cannot be tolerated by /proc/kcore that accesses module memory using vread_iter() and the latter does vmalloc_to_page() and copy_page_to_it

[PATCH v2 02/10] x86/mm/pat: drop duplicate variable in cpa_flush()

2025-01-21 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" There is a 'struct cpa_data *data' parameter in cpa_flush() that is assigned to a local 'struct cpa_data *cpa' variable. Rename the parameter from 'data' to 'cpa' and drop declaration of the local 'cpa' variable. Signed-off-by: Mike Rapoport (Microsoft) --- a

[PATCH v2 05/10] execmem: add API for temporal remapping as RW and restoring ROX afterwards

2025-01-21 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" Using a writable copy for ROX memory is cumbersome and error prone. Add API that allow temporarily remapping of ranges in the ROX cache as writable and then restoring their read-only-execute permissions. This API will be later used in modules code and will all

[PATCH v2 01/10] x86/mm/pat: cpa-test: fix length for CPA_ARRAY test

2025-01-21 Thread Mike Rapoport
From: "Mike Rapoport (Microsoft)" The CPA_ARRAY test always uses len[1] as numpages argument to change_page_attr_set() although the addresses array is different each iteration of the test loop. Replace len[1] with len[i] to have numpages matching the addresses array. Fixes: ecc729f1f471 ("x86/m

[PATCH v2 03/10] x86/mm/pat: restore large ROX pages after fragmentation

2025-01-21 Thread Mike Rapoport
From: "Kirill A. Shutemov" Change of attributes of the pages may lead to fragmentation of direct mapping over time and performance degradation when these pages contain executable code. With current code it's one way road: kernel tries to avoid splitting large pages, but it doesn't restore them b