mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sebastian Ene <sebastianene@google.com>
To: akpm@linux-foundation.org, alexghiti@rivosinc.com,
	ankita@nvidia.com,  ardb@kernel.org, catalin.marinas@arm.com,
	christophe.leroy@csgroup.eu,  james.morse@arm.com,
	vdonnefort@google.com, mark.rutland@arm.com,  maz@kernel.org,
	oliver.upton@linux.dev, rananta@google.com,
	 ryan.roberts@arm.com, sebastianene@google.com,
	shahuang@redhat.com,  suzuki.poulose@arm.com, will@kernel.org,
	yuzenghui@huawei.com
Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
	 linux-kernel@vger.kernel.org, kernel-team@android.com
Subject: [PATCH v10 4/5] arm64: ptdump: Don't override the level when operating on the stage-2 tables
Date: Mon,  9 Sep 2024 12:47:20 +0000	[thread overview]
Message-ID: <20240909124721.1672199-5-sebastianene@google.com> (raw)
In-Reply-To: <20240909124721.1672199-1-sebastianene@google.com>

Ptdump uses the init_mm structure directly to dump the kernel
pagetables. When ptdump is called on the stage-2 pagetables, this mm
argument is not used. Prevent the level from being overwritten by
checking the argument against NULL.

Signed-off-by: Sebastian Ene <sebastianene@google.com>
---
 arch/arm64/mm/ptdump.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/mm/ptdump.c b/arch/arm64/mm/ptdump.c
index ca53ef274a8b..264c5f9b97d8 100644
--- a/arch/arm64/mm/ptdump.c
+++ b/arch/arm64/mm/ptdump.c
@@ -197,8 +197,8 @@ void note_page(struct ptdump_state *pt_st, unsigned long addr, int level,
 	u64 prot = 0;
 
 	/* check if the current level has been folded dynamically */
-	if ((level == 1 && mm_p4d_folded(st->mm)) ||
-	    (level == 2 && mm_pud_folded(st->mm)))
+	if (st->mm && ((level == 1 && mm_p4d_folded(st->mm)) ||
+	    (level == 2 && mm_pud_folded(st->mm))))
 		level = 0;
 
 	if (level >= 0)
-- 
2.46.0.469.g59c65b2a67-goog


  parent reply	other threads:[~2024-09-09 12:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-09 12:47 [PATCH v10 0/5] arm64: ptdump: View the second stage page-tables Sebastian Ene
2024-09-09 12:47 ` [PATCH v10 1/5] KVM: arm64: Move pagetable definitions to common header Sebastian Ene
2024-09-09 12:47 ` [PATCH v10 2/5] arm64: ptdump: Expose the attribute parsing functionality Sebastian Ene
2024-09-10  9:57   ` Will Deacon
2024-09-10 16:59     ` Marc Zyngier
2024-09-09 12:47 ` [PATCH v10 3/5] arm64: ptdump: Use the ptdump description from a local context Sebastian Ene
2024-09-10 10:03   ` Will Deacon
2024-09-09 12:47 ` Sebastian Ene [this message]
2024-09-10 10:05   ` [PATCH v10 4/5] arm64: ptdump: Don't override the level when operating on the stage-2 tables Will Deacon
2024-09-09 12:47 ` [PATCH v10 5/5] KVM: arm64: Register ptdump with debugfs on guest creation Sebastian Ene
2024-09-10 20:27   ` Marc Zyngier
2024-09-10 20:35 ` [PATCH v10 0/5] arm64: ptdump: View the second stage page-tables Marc Zyngier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240909124721.1672199-5-sebastianene@google.com \
    --to=sebastianene@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexghiti@rivosinc.com \
    --cc=ankita@nvidia.com \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=james.morse@arm.com \
    --cc=kernel-team@android.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=oliver.upton@linux.dev \
    --cc=rananta@google.com \
    --cc=ryan.roberts@arm.com \
    --cc=shahuang@redhat.com \
    --cc=suzuki.poulose@arm.com \
    --cc=vdonnefort@google.com \
    --cc=will@kernel.org \
    --cc=yuzenghui@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®