Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2921315rwb; Mon, 15 Aug 2022 14:05:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR5XpM43m4XGfTxp+yl7FEzix7dEZLx1bxNt2RdGdVpbgrpOs4d6dov6aPvs/XAZekUI+lWl X-Received: by 2002:a17:907:2704:b0:734:e5ae:e1f5 with SMTP id w4-20020a170907270400b00734e5aee1f5mr8808335ejk.761.1660597541791; Mon, 15 Aug 2022 14:05:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597541; cv=none; d=google.com; s=arc-20160816; b=U7eNO4A+tNbpkaQkjYrZBgNKT9V9Gesq+NQoJaNluUX9ywh1+3W0KxkW7JR9MJOhuh IDUW8P0u5MFxiAEtAS438yqltLG6F3k9g1p2Kzbi7Mynaat2Bej86B5JNJlJ8pIx+keI +YDBC/n8hKA6M/LQTa/DT54hIpSZLOHUAgFMABqbYJeqNpjJw3OZAEPx0FD7DUfHZaEq JqFrZ4HB3peHHucNzM7GtGohmRzGr+9P8P/rURzqdBXfoKzYS4VVangTJG2Tkm4j3N/8 K+SYVbRasQFD79EIp+3Hxd4UFiRxj9ObH8wGdVrNAZ4b9k2hEYfLuFbsooHwnwwpSH86 3wXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EjVVEepXQeZQB0GVSW+BFRxZwXmrcqM1fsWgJsHuEl8=; b=GMdk6Xlumo48mgvUjzYhVpR16mvzFwOc46J11MC1VsB8RhL+CkgCBKJ0VViAPzfNPq U+V3NZrZQ40ODIwUbDqOjX8AYzUXaRGUN+Ug/VdvfE6TF5Rq/JOi6u3kFQJ37Z0O3yCF WhaAdCbWlW+K1ck0tLrhuWZDuAIKh/VxewvP/25EeeFCQwuABRN0axSKBXeAWJYLSK66 xwvb+ioV66YoKDWNOEFtX+smuYgnQxypUg1VXiAQIMpkkc/gwIyLxfCb4jHgdM3wcz04 wQAK8joKOlZ1dVUOj9HKunYKswTm/MiR0WNYYLAparF3HlUoOadnukXvnwDVT9PviqlU vA8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=G3R4RAA7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j4-20020a508a84000000b0043ba4ea320esi7921001edj.171.2022.08.15.14.05.16; Mon, 15 Aug 2022 14:05:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=G3R4RAA7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244327AbiHOTih (ORCPT + 99 others); Mon, 15 Aug 2022 15:38:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244181AbiHOTef (ORCPT ); Mon, 15 Aug 2022 15:34:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 416CEE60; Mon, 15 Aug 2022 11:45:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C5C6C611C1; Mon, 15 Aug 2022 18:45:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD959C433D6; Mon, 15 Aug 2022 18:45:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589120; bh=66U9M5aFiEG9ZonRvU6aDKIvHi2Duefgh838xmhafKs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G3R4RAA72bzrXVIFsB6TJKrqlWBozTgTTS/sHyrk0NZAM7U+b0MW4vGVOWr5vrryx 3zsCaLFXrDvvBCzP8LjVqKG5cknq15qt0w2GV8w2syq+yrSh8FW3r2w4MbLF9RX3Xt wMT3aOCKTjIBSCbowok0O+Q7mr41E3f/qXdp9tWs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiko Carstens , Alexander Gordeev , Vasily Gorbik , Sasha Levin Subject: [PATCH 5.15 619/779] s390/dump: fix old lowcore virtual vs physical address confusion Date: Mon, 15 Aug 2022 20:04:23 +0200 Message-Id: <20220815180403.828592726@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Gordeev [ 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 Signed-off-by: Alexander Gordeev Signed-off-by: Vasily Gorbik Signed-off-by: Sasha Levin --- arch/s390/kernel/asm-offsets.c | 2 ++ arch/s390/kernel/crash_dump.c | 2 +- arch/s390/kernel/os_info.c | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c index b57da9338588..9242d7ad71e7 100644 --- a/arch/s390/kernel/asm-offsets.c +++ b/arch/s390/kernel/asm-offsets.c @@ -128,6 +128,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); diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c index 785d54c9350c..9c2597be28dc 100644 --- a/arch/s390/kernel/crash_dump.c +++ b/arch/s390/kernel/crash_dump.c @@ -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(¬e, addr, sizeof(note))) diff --git a/arch/s390/kernel/os_info.c b/arch/s390/kernel/os_info.c index 4bef35b79b93..198f9694e439 100644 --- a/arch/s390/kernel/os_info.c +++ b/arch/s390/kernel/os_info.c @@ -15,6 +15,7 @@ #include #include #include +#include /* * OS info structure has to be page aligned @@ -123,7 +124,7 @@ static void os_info_old_init(void) return; if (!oldmem_data.start) 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; -- 2.35.1