linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Zi Yan <ziy@nvidia.com>
To: Pasha Tatashin <pasha.tatashin@soleen.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	akpm@linux-foundation.org, rientjes@google.com, pjt@google.com,
	weixugc@google.com, gthelen@google.com, mingo@redhat.com,
	will@kernel.org, rppt@kernel.org, dave.hansen@linux.intel.com,
	hpa@zytor.com, aneesh.kumar@linux.ibm.com, jirislaby@kernel.org,
	songmuchun@bytedance.com, qydwhotmail@gmail.com,
	hughd@google.com, anshuman.khandual@arm.com
Subject: Re: [PATCH 1/3] mm/debug_vm_pgtable: remove pte entry from the page table
Date: Thu, 20 Jan 2022 10:19:50 -0500	[thread overview]
Message-ID: <0839D3DA-61AF-46B2-94FA-748BED4C9E0E@nvidia.com> (raw)
In-Reply-To: <20220120042513.1648831-2-pasha.tatashin@soleen.com>

[-- Attachment #1: Type: text/plain, Size: 1962 bytes --]

On 19 Jan 2022, at 23:25, Pasha Tatashin wrote:

> The pte entry that is used in pte_advanced_tests() is never removed from
> the page table at the end of the test.
>
> The issue is detected by page_table_check, to repro compile kernel with
> the following configs:
>
> CONFIG_DEBUG_VM_PGTABLE=y
> CONFIG_PAGE_TABLE_CHECK=y
> CONFIG_PAGE_TABLE_CHECK_ENFORCED=y
>
> During the boot the following BUG is printed:
>
> [    7.483050][    T1] debug_vm_pgtable: [debug_vm_pgtable         ]:
> Validating architecture page tabs
> [    7.490930][    T1] ------------[ cut here ]------------
> [    7.494926][    T1] kernel BUG at mm/page_table_check.c:194!
> [    7.499172][    T1] invalid opcode: 0000 [#1] PREEMPT SMP KASAN
> [    7.503610][    T1] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.16.0+
> [    7.508600][    T1] Hardware name: QEMU Standard PC (i440FX + PIIX,
> ...
>
> The entry should be properly removed from the page table before the page
> is released to the free list.
>
> Fixes: a5c3b9ffb0f4 ("mm/debug_vm_pgtable: add tests validating advanced arch page table helpers")
>
> Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
> ---
>  mm/debug_vm_pgtable.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/mm/debug_vm_pgtable.c b/mm/debug_vm_pgtable.c
> index a7ac97c76762..f7c5970f1719 100644
> --- a/mm/debug_vm_pgtable.c
> +++ b/mm/debug_vm_pgtable.c
> @@ -171,6 +171,7 @@ static void __init pte_advanced_tests(struct pgtable_debug_args *args)
>  	ptep_test_and_clear_young(args->vma, args->vaddr, args->ptep);
>  	pte = ptep_get(args->ptep);
>  	WARN_ON(pte_young(pte));
> +	ptep_get_and_clear_full(args->mm, args->vaddr, args->ptep, 1);
>  }
>
>  static void __init pte_savedwrite_tests(struct pgtable_debug_args *args)
> -- 
> 2.34.1.703.g22d0c6ccf7-goog

LGTM. Thanks.

Reviewed-by: Zi Yan <ziy@nvidia.com> and Tested-by: Zi Yan <ziy@nvidia.com>

--
Best Regards,
Yan, Zi

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 854 bytes --]

  reply	other threads:[~2022-01-20 15:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-20  4:25 [PATCH 0/3] page table check fixes and cleanups Pasha Tatashin
2022-01-20  4:25 ` [PATCH 1/3] mm/debug_vm_pgtable: remove pte entry from the page table Pasha Tatashin
2022-01-20 15:19   ` Zi Yan [this message]
2022-01-20  4:25 ` [PATCH 2/3] mm/page_table_check: check entries at pud and pmd levels Pasha Tatashin
2022-01-20 17:59   ` Wei Xu
2022-01-20 18:25     ` Pasha Tatashin
2022-01-20  4:25 ` [PATCH 3/3] mm/page_table_check: use unsigned long for page counters Pasha Tatashin
2022-01-20 18:25   ` Wei Xu

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=0839D3DA-61AF-46B2-94FA-748BED4C9E0E@nvidia.com \
    --to=ziy@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=anshuman.khandual@arm.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=gthelen@google.com \
    --cc=hpa@zytor.com \
    --cc=hughd@google.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@redhat.com \
    --cc=pasha.tatashin@soleen.com \
    --cc=pjt@google.com \
    --cc=qydwhotmail@gmail.com \
    --cc=rientjes@google.com \
    --cc=rppt@kernel.org \
    --cc=songmuchun@bytedance.com \
    --cc=weixugc@google.com \
    --cc=will@kernel.org \
    /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