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: <5a1d28b7-1e6e-da39-9b34-f86470163bb1@huawei.com>
Date: Mon, 26 Feb 2024 15:03:05 +0800
From: Jinjiang Tu <tujinjiang@...wei.com>
To: <liuyongqiang13@...wei.com>
CC: <arnd@...db.de>, <keescook@...omium.org>,
	<linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
	<linux@...linux.org.uk>, <m.szyprowski@...sung.com>, <rppt@...ux.ibm.com>,
	<sunnanyong@...wei.com>, <wangkefeng.wang@...wei.com>, <willy@...radead.org>,
	<yanaijie@...wei.com>, <zhangxiaoxu5@...wei.com>
Subject: Re: [PATCH v2] arm: flush: check if the folio is reserved for
 no-mapping addresses

Since some abuses of pfn_valid() have been reported, I check all the use 
of pfn_valid(), and find some suspicious cases.

phys_mem_access_prot() defined in arch/arm/mm/mmu.c returns 
pgprot_noncached() when pfn_valid() returns false.
I think it’s purpose is to return pgprot_noncached() when the pfn is not 
in RAM, and the use of pfn_valid() is incorrect.
Notably, phys_mem_access_prot() defined in arm64 uses 
pfn_is_map_memory() instead of pfn_valid() since commit
873ba463914c (arm64: decouple check whether pfn is in linear map from 
pfn_valid()).

Similarly, virt_addr_valid() defined in arm64 uses pfn_is_map_memory() 
instead of pfn_valid() since commit
873ba463914c (arm64: decouple check whether pfn is in linear map from 
pfn_valid()), But virt_addr_valid() still
uses pfn_valid(). Besides, the implementation of x86 also uses pfn_valid().

update_mmu_cache_range() defined in arch/arm/mm/fault-armv.c checks 
pfn_valid() and then calls __flush_dcache_folio().
This case is similar to the case reported by Yongqiang Liu, the pfn may 
not be a RAM pfn, and the system will crash in
__flush_dcache_folio() due to the kernel linear mapping is not 
established. virt_addr_valid() is used to check whether a
vrtual address is valid linear mapping. Are these uses of pfn_valid() 
incorrect?

pfn_modify_allowed() defined in arch/x86/mm/mmap.c checks pfn_valid(), 
and the comment says it is intended to check
whether the pfn is in real memory. So the use of pfn_valid() should be 
incorrent. This case is only involved when the cpu
is affected by X86_BUG_L1TF.

try_ram_remap() defined in kernel/iomem.c returns the linear address 
when three checks are passed. One of the checks is
pfn_valid(). The only caller memremap() guarantees the pfn passed to 
try_ram_remap() is in RAM, but the pfn may be in
NOMAP memory regions and is not mapped in linear mapping. commit 
260364d112bc (arm[64]/memremap: don't abuse
pfn_valid() to ensure presence of linear map) solves it by checking in 
arch_memremap_can_ram_remap(), However, if other
architectures involve this issue?

Do these suspicious case abuse pfn_valid() really? Thanks


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ