Skip to contentSkip to conversation

tomoyo: Use local kmap in tomoyo_dump_page()

PATCH In review Davidlohr Bueso 2 participants 2 messages Nov 28, 2025 – Dec 1, 2025

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

PATCH 1/1 tomoyo: Use local kmap in tomoyo_dump_page()

Replace the now deprecated kmap_atomic() with kmap_local_page().

The memcpy does not need atomic semantics, and the removed comment is now stale - this patch now makes it in sync again. Last but not least, highmem is going to be removed[0].

[0] https://lore.kernel.org/all/[email protected]/

---
 security/tomoyo/domain.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
security/tomoyo/domain.c +2 -7
index 5f9ccab26e9a..90cf0e2969df 100644
@@ -934,17 +934,12 @@ bool tomoyo_dump_page(struct linux_binprm *bprm, unsigned long pos,
 #endif
 	if (page != dump->page) {
 		const unsigned int offset = pos % PAGE_SIZE;
-		/*
-		 * Maybe kmap()/kunmap() should be used here.
-		 * But remove_arg_zero() uses kmap_atomic()/kunmap_atomic().
-		 * So do I.
-		 */
-		char *kaddr = kmap_atomic(page);
+		char *kaddr = kmap_local_page(page);
 
 		dump->page = page;
 		memcpy(dump->data + offset, kaddr + offset,
 		       PAGE_SIZE - offset);
-		kunmap_atomic(kaddr);
+		kunmap_local(kaddr);
 	}
 	/* Same with put_arg_page(page) in fs/exec.c */
 #ifdef CONFIG_MMU
Signature · 1 line
2.39.5
maintainer
#1 lore raw
Quoted 9 lines · Davidlohr Bueso

Replace the now deprecated kmap_atomic() with kmap_local_page().

The memcpy does not need atomic semantics, and the removed comment is now stale - this patch now makes it in sync again. Last but not least, highmem is going to be removed[0].

[0] https://lore.kernel.org/all/[email protected]/

Thank you. Applied.

https://sourceforge.net/p/tomoyo/tomoyo.git/ci/a9ea3a2e081d29350b7a3c0731729efbc70458b8/