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] [day] [month] [year] [list]
Message-ID: <20260109201142.GFaWFg_kR8eW48CpUp@fat_crate.local>
Date: Fri, 9 Jan 2026 21:11:42 +0100
From: Borislav Petkov <bp@...en8.de>
To: Coiby Xu <coxu@...hat.com>
Cc: kexec@...ts.infradead.org, x86@...nel.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	"open list:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] x86/crash: Use set_memory_p instead of
 __set_memory_prot

On Tue, Jan 06, 2026 at 05:50:58PM +0800, Coiby Xu wrote:
> set_memory_p has been introduced since commit 030ad7af9437 ("x86/mm:
> Regularize set_memory_p() parameters and make non-static"). There is no
> need to use __set_memory_prot.
> 
> Signed-off-by: Coiby Xu <coxu@...hat.com>
> ---
>  arch/x86/kernel/machine_kexec_64.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)

Why aren't those a single patch?

---
From: Coiby Xu <coxu@...hat.com>
Date: Tue, 6 Jan 2026 17:50:58 +0800
Subject: [PATCH] x86/crash: Use set_memory_p() instead of __set_memory_prot()

set_memory_p() is available to use outside of its compilation unit since:

  030ad7af9437 ("x86/mm: Regularize set_memory_p() parameters and make non-static").

There is no use for __set_memory_prot() anymore so drop it too.

  [ bp: Massage commit message. ]

Signed-off-by: Coiby Xu <coxu@...hat.com>
Signed-off-by: Borislav Petkov (AMD) <bp@...en8.de>
Link: https://patch.msgid.link/20260106095100.656292-1-coxu@redhat.com
---
 arch/x86/include/asm/set_memory.h  |  1 -
 arch/x86/kernel/machine_kexec_64.c |  5 +----
 arch/x86/mm/pat/set_memory.c       | 13 -------------
 3 files changed, 1 insertion(+), 18 deletions(-)

diff --git a/arch/x86/include/asm/set_memory.h b/arch/x86/include/asm/set_memory.h
index 61f56cdaccb5..4362c26aa992 100644
--- a/arch/x86/include/asm/set_memory.h
+++ b/arch/x86/include/asm/set_memory.h
@@ -38,7 +38,6 @@ int set_memory_rox(unsigned long addr, int numpages);
  * The caller is required to take care of these.
  */
 
-int __set_memory_prot(unsigned long addr, int numpages, pgprot_t prot);
 int _set_memory_uc(unsigned long addr, int numpages);
 int _set_memory_wc(unsigned long addr, int numpages);
 int _set_memory_wt(unsigned long addr, int numpages);
diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
index 201137b98fb8..0590d399d4f1 100644
--- a/arch/x86/kernel/machine_kexec_64.c
+++ b/arch/x86/kernel/machine_kexec_64.c
@@ -673,10 +673,7 @@ static void kexec_mark_dm_crypt_keys(bool protect)
 		if (protect)
 			set_memory_np((unsigned long)phys_to_virt(start_paddr), nr_pages);
 		else
-			__set_memory_prot(
-				(unsigned long)phys_to_virt(start_paddr),
-				nr_pages,
-				__pgprot(_PAGE_PRESENT | _PAGE_NX | _PAGE_RW));
+			set_memory_p((unsigned long)phys_to_virt(start_paddr), nr_pages);
 	}
 }
 
diff --git a/arch/x86/mm/pat/set_memory.c b/arch/x86/mm/pat/set_memory.c
index 6c6eb486f7a6..40581a720fe8 100644
--- a/arch/x86/mm/pat/set_memory.c
+++ b/arch/x86/mm/pat/set_memory.c
@@ -2145,19 +2145,6 @@ static inline int cpa_clear_pages_array(struct page **pages, int numpages,
 		CPA_PAGES_ARRAY, pages);
 }
 
-/*
- * __set_memory_prot is an internal helper for callers that have been passed
- * a pgprot_t value from upper layers and a reservation has already been taken.
- * If you want to set the pgprot to a specific page protocol, use the
- * set_memory_xx() functions.
- */
-int __set_memory_prot(unsigned long addr, int numpages, pgprot_t prot)
-{
-	return change_page_attr_set_clr(&addr, numpages, prot,
-					__pgprot(~pgprot_val(prot)), 0, 0,
-					NULL);
-}
-
 int _set_memory_uc(unsigned long addr, int numpages)
 {
 	/*
-- 
2.51.0

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ