]> www.infradead.org Git - users/dwmw2/linux.git/commit
fs/proc/kcore.c: allow translation of physical memory addresses
authorAlexander Gordeev <agordeev@linux.ibm.com>
Mon, 30 Sep 2024 12:21:19 +0000 (14:21 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 9 Oct 2024 19:47:19 +0000 (12:47 -0700)
commit3d5854d75e3187147613130561b58f0b06166172
treeacaf406a23a546d445a542e2573f6cefaf4154d8
parent76503e1fa1a53ef041a120825d5ce81c7fe7bdd7
fs/proc/kcore.c: allow translation of physical memory addresses

When /proc/kcore is read an attempt to read the first two pages results in
HW-specific page swap on s390 and another (so called prefix) pages are
accessed instead.  That leads to a wrong read.

Allow architecture-specific translation of memory addresses using
kc_xlate_dev_mem_ptr() and kc_unxlate_dev_mem_ptr() callbacks similarily
to /dev/mem xlate_dev_mem_ptr() and unxlate_dev_mem_ptr() callbacks.  That
way an architecture can deal with specific physical memory ranges.

Re-use the existing /dev/mem callback implementation on s390, which
handles the described prefix pages swapping correctly.

For other architectures the default callback is basically NOP.  It is
expected the condition (vaddr == __va(__pa(vaddr))) always holds true for
KCORE_RAM memory type.

Link: https://lkml.kernel.org/r/20240930122119.1651546-1-agordeev@linux.ibm.com
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Suggested-by: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/s390/include/asm/io.h
fs/proc/kcore.c