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]
Date: Tue,  9 Jan 2024 22:45:59 +0800
From: Yangyu Chen <cyy@...self.name>
To: Arnd Bergmann <arnd@...db.de>
Cc: Christoph Hellwig <hch@....de>,
	Alexander Potapenko <glider@...gle.com>,
	Mike Frysinger <vapier@...too.org>,
	linux-arch@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Yangyu Chen <cyy@...self.name>
Subject: [PATCH] asm-generic: flush icache only when vma->vm_flags has VM_EXEC set

For some ISAs like RISC-V, which may not support bus broadcast-based
icache flushing instructions, it's necessary to send IPIs to all of the
CPUs in the system to flush the icache. This process can be expensive for
these ISAs and introduce disturbances during performance profiling.
Limiting the icache flush to occur only when the vma->vm_flags has VM_EXEC
can help minimize the frequency of these operations.

Signed-off-by: Yangyu Chen <cyy@...self.name>
---
 include/asm-generic/cacheflush.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/asm-generic/cacheflush.h b/include/asm-generic/cacheflush.h
index 84ec53ccc450..729d51536575 100644
--- a/include/asm-generic/cacheflush.h
+++ b/include/asm-generic/cacheflush.h
@@ -102,7 +102,8 @@ static inline void flush_cache_vunmap(unsigned long start, unsigned long end)
 	do { \
 		instrument_copy_to_user((void __user *)dst, src, len); \
 		memcpy(dst, src, len); \
-		flush_icache_user_page(vma, page, vaddr, len); \
+		if (vma->vm_flags & VM_EXEC) \
+			flush_icache_user_page(vma, page, vaddr, len); \
 	} while (0)
 #endif
 
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ