Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3491581pxf; Mon, 29 Mar 2021 03:53:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwen6JABBZy4twtV3xvtORrE2uVqtvFW4VdrNkbdkMnnzoizjEWuxCyAFj4ileFyY327pBO X-Received: by 2002:a05:6402:42c9:: with SMTP id i9mr28159123edc.35.1617015190483; Mon, 29 Mar 2021 03:53:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617015190; cv=none; d=google.com; s=arc-20160816; b=Gwcg6xxOTk7vcN7gH8TYC4TENoWhOV4hnNc3sVAqSoTU12Fao/NqlZ3upDVY1y9ZtI vWmlUIn3U7eilt/rS6Du619prEiohBMScs4UXW2JHMH9sR1hFjfLqw88hxhsoe3Q9kny tQ5oNgpzaPN6vLUBtOj3yWn69W2TkOCQ05V0r/1qlOOPe+vN1kEpUO2fJkM+uU2lpC+x D0MEnygZP2+tBaRQuB+4r0xgxrBcndlbWuEk4w+Bq+2ns1OIH84mCgbu4tDs+o7G3Cwm ron5CRpYi2In2QbPHgRV7JPlbgHfN063uwk+vdWHQOiyS67g1mcqvC9A0e1L/e4HnNlG 2mIw== 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=ethXS107T/0Ry25kCSu4ECMMGhf+v5g6kJBQbn/8O58=; b=WNIEnOF9D/DYjgcQjY2mQIqJJQxoq/6iV7jegGSa97YxnoXARCv2S/NPdYDlxOwXxy hfxdsumIIPzFSLwezxgB97lqvW/NG1eyP2PsB+e1YN96jlol7yqxgPDfCxx3WsWIuoQw XAG3NZnfBjmMe4Ooo/L9vYiqVdEzbvtb8C6WxKUvI0b0SDnRwZdJaYvZL8t01fY0Y5WV onuvbROqNPao/HpONvRVTxG1b5kMSM+PPpKdG7O8dQa2Gx4Vh3kmtit+cFGs12XqXt5B IkZSzP2Zzxsr2Tb7eGlJglV4AAYOO5ewXme1+SJzmf0mJzg96vLDVoR1WyHH/BgB2CQ9 3V9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UR3T29+g; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p16si12368477edu.606.2021.03.29.03.52.48; Mon, 29 Mar 2021 03:53:10 -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=@linuxfoundation.org header.s=korg header.b=UR3T29+g; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235134AbhC2ImS (ORCPT + 99 others); Mon, 29 Mar 2021 04:42:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:41812 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233044AbhC2IYB (ORCPT ); Mon, 29 Mar 2021 04:24:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CADB46044F; Mon, 29 Mar 2021 08:24:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1617006241; bh=X37DBp6Ormim7xfW0XxjlYmJjt/SCXjIhAHFNaJKq0A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UR3T29+gn+w3/cjONt9tRagGmzRcHX95Qu9WSEHkpMk9gPRmGFvM3lCE5TWvLQl5d zFWOxewzg6GGtr8PMgRWLhm+f/x3WgZtWT+tXEfLwyoIxeWp9tDMTUCI37Frdh3sxj Clxq+Djx2BKAFJWKev4DaMri60kDNagA3bqpQBKM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Tatashin , Tyler Hicks , Will Deacon , Sasha Levin Subject: [PATCH 5.10 168/221] arm64: kdump: update ppos when reading elfcorehdr Date: Mon, 29 Mar 2021 09:58:19 +0200 Message-Id: <20210329075634.752777974@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210329075629.172032742@linuxfoundation.org> References: <20210329075629.172032742@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pavel Tatashin [ Upstream commit 141f8202cfa4192c3af79b6cbd68e7760bb01b5a ] 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 Fixes: e62aaeac426a ("arm64: kdump: provide /proc/vmcore file") Reviewed-by: Tyler Hicks Link: https://lore.kernel.org/r/20210319205054.743368-1-pasha.tatashin@soleen.com Signed-off-by: Will Deacon Signed-off-by: Sasha Levin --- 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.30.1