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-next>] [day] [month] [year] [list]
Message-ID: <20230810100011.14552-1-max8rr8@gmail.com>
Date:   Thu, 10 Aug 2023 13:00:11 +0300
From:   Max Ramanouski <max8rr8@...il.com>
To:     dave.hansen@...ux.intel.com, luto@...nel.org, peterz@...radead.org
Cc:     max8rr8@...il.com, linux-kernel@...r.kernel.org
Subject: [PATCH 1/1] x86/ioremap: Use is_vmalloc_addr in iounmap

On systems that use HMM (most notably amdgpu driver)
high_memory can jump over VMALLOC_START. That causes
some iounmap to exit early. This in addition to leaking,
causes problems with rebinding devices to vfio_pci from
other drivers with error of conflicting memtypes,
as they aren't freed in iounmap.

Replace comparison against high_memory with is_vmalloc_addr to
fix the issue and make x86 iounmap implementation more similar
to generic one, it also uses is_vmalloc_addr to validate pointer.

Signed-off-by: Max Ramanouski <max8rr8@...il.com>
---
 arch/x86/mm/ioremap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index aa7d27932..0b596a1d2 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -457,7 +457,7 @@ void iounmap(volatile void __iomem *addr)
 {
 	struct vm_struct *p, *o;
 
-	if ((void __force *)addr <= high_memory)
+	if (!is_vmalloc_addr((void __force *)addr))
 		return;
 
 	/*
-- 
2.41.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ