]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
s390/dump: fix old lowcore virtual vs physical address confusion
authorAlexander Gordeev <agordeev@linux.ibm.com>
Sat, 29 Jan 2022 07:38:56 +0000 (08:38 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Aug 2022 13:16:09 +0000 (15:16 +0200)
[ Upstream commit dc306186a130c6d9feb0aabc1c71b8ed1674a3bf ]

Virtual addresses of vmcore_info and os_info members are
wrongly passed to copy_oldmem_kernel(), while the function
expects physical address of the source. Instead, __pa()
macro should have been applied.

Yet, use of __pa() macro could be somehow confusing, since
copy_oldmem_kernel() may treat the source as an offset, not
as a direct physical address (that depens from the oldmem
availability and location).

Fix the virtual vs physical address confusion and make the
way the old lowcore is read consistent across all sources.

Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/s390/kernel/asm-offsets.c
arch/s390/kernel/crash_dump.c
arch/s390/kernel/os_info.c

index 483051e10db3890cb2ca58a9fe12ee5344438495..e070073930a9a3f7778dec88578c02f86ed05287 100644 (file)
@@ -150,6 +150,8 @@ int main(void)
        OFFSET(__LC_BR_R1, lowcore, br_r1_trampoline);
        /* software defined ABI-relevant lowcore locations 0xe00 - 0xe20 */
        OFFSET(__LC_DUMP_REIPL, lowcore, ipib);
+       OFFSET(__LC_VMCORE_INFO, lowcore, vmcore_info);
+       OFFSET(__LC_OS_INFO, lowcore, os_info);
        /* hardware defined lowcore locations 0x1000 - 0x18ff */
        OFFSET(__LC_MCESAD, lowcore, mcesad);
        OFFSET(__LC_EXT_PARAMS2, lowcore, ext_params2);
index 205b2e2648aae3dd502ea37a0418040e0b0dc8b9..76762dc67ca90134b67c244a212f9b25042188dc 100644 (file)
@@ -432,7 +432,7 @@ static void *get_vmcoreinfo_old(unsigned long *size)
        Elf64_Nhdr note;
        void *addr;
 
-       if (copy_oldmem_kernel(&addr, &S390_lowcore.vmcore_info, sizeof(addr)))
+       if (copy_oldmem_kernel(&addr, (void *)__LC_VMCORE_INFO, sizeof(addr)))
                return NULL;
        memset(nt_name, 0, sizeof(nt_name));
        if (copy_oldmem_kernel(&note, addr, sizeof(note)))
index 0a5e4bafb6ad1eca70409f285ba110270999be6a..1b8e2aff20e34c9765f5bbf340b90bb126773db3 100644 (file)
@@ -15,6 +15,7 @@
 #include <asm/checksum.h>
 #include <asm/lowcore.h>
 #include <asm/os_info.h>
+#include <asm/asm-offsets.h>
 
 /*
  * OS info structure has to be page aligned
@@ -123,7 +124,7 @@ static void os_info_old_init(void)
                return;
        if (!OLDMEM_BASE)
                goto fail;
-       if (copy_oldmem_kernel(&addr, &S390_lowcore.os_info, sizeof(addr)))
+       if (copy_oldmem_kernel(&addr, (void *)__LC_OS_INFO, sizeof(addr)))
                goto fail;
        if (addr == 0 || addr % PAGE_SIZE)
                goto fail;