From patchwork Fri Mar 19 20:50:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 12151893 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 781DEC433DB for ; Fri, 19 Mar 2021 20:52:40 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F110B6197B for ; Fri, 19 Mar 2021 20:52:39 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F110B6197B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=soleen.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=OJiqxmukYjGblq9xbPr1oFYy/NK0ATj7aiRkuzZE6SM=; b=qG7niG1YrOgKDW 26jgctcvWIlD5pz2VKFQQidNKhf2hJa7eDC3n2122ve9DUN0GPqBgpp7xflz+QR6rxf1lMhT4mX9a H/5zgwcoi7B1azGfi1sgnlYOkZkjV6W1klkPat5ckqHnh+rO20bkK3tq9dnjv2CQVpqTdVocfkCj9 JkhzETS1LHBNxGghEL5Gac36X9guhcU7LeBe4vnfV0IGIFkcR+CDYM9Y9/z5TofPRxgVNbvvQ10Dx M9cS6UrjooMnMnsvu0Kpy6ng2XphWvYtgaXI311jE7KI18ev3+Bf7D/rMQ4vh2ipNEdqfOafPp2J1 B/g4sk3SrwoRWOIKCrvg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lNM5E-0087vK-Qq; Fri, 19 Mar 2021 20:51:01 +0000 Received: from mail-qk1-x733.google.com ([2607:f8b0:4864:20::733]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lNM5A-0087ue-Hf for linux-arm-kernel@lists.infradead.org; Fri, 19 Mar 2021 20:50:58 +0000 Received: by mail-qk1-x733.google.com with SMTP id g15so4371726qkl.4 for ; Fri, 19 Mar 2021 13:50:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=kcM6ggTK+Er1AJgCwL8fduwHmBm20BhwDOZjTH0qDPQ=; b=Avlz29gGZchCPVMGYeTRS8La1qM8kJKDot41P2nQuOQ7gwAsvrrvhw5ukYkNYvBPHS 8V2Ec+Xnw3edxuve1Q9AekwGgG/niQ9eUAPsMt5cem5FgeJvh6uVjJXezGsK39nn7fym f5RI+S55Fpr4kzeVKkz39Jbt9WzfWoVHKU25eBquAS+uM5yGpGoRhTfoEPD8AQxVd2QV tAqSGyRJk2u2h8nVr8Ztrq1NbcY/UPOYdzt+fzvSZQbgwHQpeomf5YRf24DQzzHRJHBm RYNHdFyrKhTTFPdOhj1DMel5dIiSqDcfb6z6t8BSZgCeze+2J00z/4xnWMokj/By0lrL 9GSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=kcM6ggTK+Er1AJgCwL8fduwHmBm20BhwDOZjTH0qDPQ=; b=SXpqnyCgu0cqCGAZGIpYXAUQ0421rQsCEEMoo1G2Do+EQX7xOVO3CLGEJsUwxi1tum bs1d8aPS7/uyBb8IDcrB4Ql63YKXuGgfmiPy0cVYMbYICMDBmjaWpV/FQhlQSQHEr4UI WRwibha9kAQn3bKLnzF9WOp/RiZY6YzQgb7zVFx2gOm1Otw9h1A9DhLxnfuBuO+fiekz 1DIwzzN+jTlTZBpcnC6opMHx+RUD3twR30Mbqy/r3gs/AHH4nsS6MabWSvHe4epTo2qL k7bIPUuQhEQy6sc6vkvM7mUzgXYwMRIS/oxdNsxpJwaeFaMb84B2v29RnTTjedQbt5gm FS9Q== X-Gm-Message-State: AOAM530fqrR0Pcm+IuGsrjrg/reZxFuEDKx5OuByi+GgjeuX/mmTZTtC kOQk9Ytm1U3EJ5aBF4yhuCuBPw== X-Google-Smtp-Source: ABdhPJzToMfT1lGPZE9W2Mh+M0tteG83XeQfh8DT5oShrLFvKCsEoqg1xpw2pSn/pY3wqzQsPYAI+A== X-Received: by 2002:a37:41ca:: with SMTP id o193mr527919qka.56.1616187055404; Fri, 19 Mar 2021 13:50:55 -0700 (PDT) Received: from localhost.localdomain (c-73-69-118-222.hsd1.nh.comcast.net. [73.69.118.222]) by smtp.gmail.com with ESMTPSA id i25sm5299518qka.38.2021.03.19.13.50.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Mar 2021 13:50:55 -0700 (PDT) From: Pavel Tatashin To: pasha.tatashin@soleen.com, tyhicks@linux.microsoft.com, jmorris@namei.org, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] arm64: kdump: update ppos when reading elfcorehdr Date: Fri, 19 Mar 2021 16:50:54 -0400 Message-Id: <20210319205054.743368-1-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210319_205056_915806_96EC4454 X-CRM114-Status: GOOD ( 11.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The ppos points to a position in the old kernel memory (and in case of arm64 in the crash kernel since elfcorehdr is passed as a segment). The function should update the ppos by the amount that was read. This bug is not exposed by accident, but other platforms update this value properly. So, fix it in ARM64 version of elfcorehdr_read() as well. Signed-off-by: Pavel Tatashin Reviewed-by: Tyler Hicks --- arch/arm64/kernel/crash_dump.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/kernel/crash_dump.c b/arch/arm64/kernel/crash_dump.c index e6e284265f19..58303a9ec32c 100644 --- a/arch/arm64/kernel/crash_dump.c +++ b/arch/arm64/kernel/crash_dump.c @@ -64,5 +64,7 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf, ssize_t elfcorehdr_read(char *buf, size_t count, u64 *ppos) { memcpy(buf, phys_to_virt((phys_addr_t)*ppos), count); + *ppos += count; + return count; }