Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1715066pxf; Fri, 19 Mar 2021 13:57:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNtv8fuB/3BKQeQ6zKeXzbClMRJEFBxso/m//5CpYgpKCg07iVUsC3J3gVjgEUvrOsONu9 X-Received: by 2002:a05:6402:35cd:: with SMTP id z13mr11967276edc.21.1616187457484; Fri, 19 Mar 2021 13:57:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616187457; cv=none; d=google.com; s=arc-20160816; b=MRwfsL6tfloqhtfKM55I75jh8Vk7uqeDnaH5WIoOZhTWfiLGUPUBPaL+vH2qNfZirG hF0MjZlbd5p3c/RWdnUh9Or/Q9r6OMtT9W9aVhXw9F41fvWl2ZzUe0Di7A2kvNTqBj52 KJlYnV+u+RNsnDcKv9chtm9vEZq/5itpNuU+meJDm4dX2lnmD70CV7GWhGcGq+PgVSLJ j6IbH0XVwfCek49r+hL4Oq64/BPEe6gQ84gFFaTw2Ds9/BAW+qPEoZTa4S51FYTssBWe GQU9f13KfLDHXlb5vqzmZoX45TwTqEFnkwzWORMBBi1Vd01DE6u+5UHUw6OVV4jtE3Gs RFTw== 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 :message-id:date:subject:to:from:dkim-signature; bh=kcM6ggTK+Er1AJgCwL8fduwHmBm20BhwDOZjTH0qDPQ=; b=UPlHJE7Z6IRDYMWVIWSNsP41tFC3wcTDVQ5KaFBkeuigYNDZXL/827ksaGBS2zl6x9 S0xQSZXpkHUS5aqPdBFNmcNVshhUzX+128NREmOYIHnlho4vpqhEeothuzrhSshkSxKF Pf9UywfXcQ+8QgINHnRzAHLuItEsdtjk62g9GKyIEi2PwAiQSufW1dEpphJgLiQdsjDn BMgKIYm7i2kTItnWzC1neVPI4QwAJu9EJF1A0LvtnqfE3ot/XTFB+uuwEtkzLCd1uhE9 AIqtTHda5G1rM1WdyH3RR5+5hgI7LTq4QGh9/W4d+wqzraqfNE1L7s6HltRIEwyTCqF5 MELg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=Avlz29gG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m24si4720581edp.422.2021.03.19.13.57.14; Fri, 19 Mar 2021 13:57:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@soleen.com header.s=google header.b=Avlz29gG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230523AbhCSUvW (ORCPT + 99 others); Fri, 19 Mar 2021 16:51:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230285AbhCSUu4 (ORCPT ); Fri, 19 Mar 2021 16:50:56 -0400 Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4766FC06175F for ; Fri, 19 Mar 2021 13:50:56 -0700 (PDT) Received: by mail-qk1-x72e.google.com with SMTP id g20so4360555qkk.1 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=YXBlrFepQz6aU+jx0TrrZO7iPs2XSbqcaNbRL16oSbmDAp4m60XdUO/2q7yZDFxaaQ vbtpnnYb3iFodB2PWoLlRQiDKH5M72UTEAowTgYddvHMM/iAw2JXCYT/NvENMBusk02a hEnoFK6xtmP/jCN1vY1s9dIa/HDm3BSxtsJdYM9ulekXhHGJNqCK5kWHJY+CrSJaoRuO 9AK8j7XFnFj0NbAJKwqEqEgkbK9In6TutSFAO8bJIVhl6W8oQLmf0aSDNqGZoW0ywPet 5hx4whjf0m7XIct0mH1B7qhoC3kHqFD0ujHQ2qwXuBaCHHuUL/tn1x3z5It5yWo/TvWY o1Ag== X-Gm-Message-State: AOAM531xHfQsOP+ClOS+wkzVI5dj+Jvgybke4N0imVQgL4p22EWh+re/ 4l8Mtj1s+7ThhGDS2lvcMpk1jQOxUwJLTA== 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 --- 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; } -- 2.25.1