Skip to contentSkip to conversation

highmem: round down the address passed to kunmap_flush_on_unmap()

PATCH Applied Gyokhan Kochmarla 2 participants 2 messages Oct 15

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 highmem: round down the address passed to kunmap_flush_on_unmap()

From: "Matthew Wilcox (Oracle)" <[email protected]>

commit 88d7b12068b95731c280af8ce88e8ee9561f96de upstream.

We already round down the address in kunmap_local_indexed() which is the other implementation of __kunmap_local(). The only implementation of kunmap_flush_on_unmap() is PA-RISC which is expecting a page-aligned address. This may be causing PA-RISC to be flushing the wrong addresses currently.

Fixes 298fa1ad5571 ("highmem: Provide generic variant of kmap_atomic*")
Cc "Fabio M. De Francesco" <[email protected]>
Cc Al Viro <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Helge Deller <[email protected]>
Cc Alexander Potapenko <[email protected]>
Cc Andrey Konovalov <[email protected]>
Cc Bagas Sanjaya <[email protected]>
Cc David Sterba <[email protected]>
Cc Kees Cook <[email protected]>
Cc Sebastian Andrzej Siewior <[email protected]>
Cc Tony Luck <[email protected]>

[ 5.10 has no include/linux/highmem-internal.h and no
kmap_local API, so __kunmap_local() does not exist. Therefore, I applied the __kunmap_atomic() hunk to include/linux/highmem.h ]

---

298fa1ad5571 ("highmem: Provide generic variant of kmap_atomic*") came into 5.10.y in 5.10.270 (c1824fac30fa) as a Stable-dep-of 68d4d3e78150 ("isofs: fix out-of-bounds page array access on empty zisofs block"), but its follow-up 88d7b12068b9 did not. 5.15.y and 6.1.y already have it (5.15.93 and 6.1.11).

 include/linux/highmem.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/highmem.h +1 -1
index 5f7cd58db478..a2a252a93d76 100644
@@ -218,7 +218,7 @@ static inline void __kunmap_atomic(void *addr)
 	 * handles re-enabling faults and preemption
 	 */
 #ifdef ARCH_HAS_FLUSH_ON_KUNMAP
-	kunmap_flush_on_unmap(addr);
+	kunmap_flush_on_unmap(PTR_ALIGN_DOWN(addr, PAGE_SIZE));
 #endif
 }
 
Signature · 1 line
2.50.1
maintainer Applied
#1 lore raw
Quoted 3 lines

We already round down the address in kunmap_local_indexed() which is the other implementation of __kunmap_local(). The only implementation of kunmap_flush_on_unmap() is PA-RISC which is expecting a page-aligned

Queued for 5.10, thanks.

Signature · 2 lines
Thanks,
Sasha