From: David Hildenbrand <david@redhat.com>
To: kernel test robot <oliver.sang@intel.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
Alexander Gordeev <agordeev@linux.ibm.com>,
Andrea Arcangeli <aarcange@redhat.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Borislav Petkov <bp@alien8.de>,
Catalin Marinas <catalin.marinas@arm.com>,
Christoph Hellwig <hch@lst.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
Don Dutile <ddutile@redhat.com>,
Gerald Schaefer <gerald.schaefer@linux.ibm.com>,
Heiko Carstens <hca@linux.ibm.com>,
Hugh Dickins <hughd@google.com>, Ingo Molnar <mingo@redhat.com>,
Jan Kara <jack@suse.cz>, Jann Horn <jannh@google.com>,
Jason Gunthorpe <jgg@nvidia.com>,
John Hubbard <jhubbard@nvidia.com>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Liang Zhang <zhangliang5@huawei.com>,
Matthew Wilcox <willy@infradead.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Michal Hocko <mhocko@kernel.org>,
Mike Kravetz <mike.kravetz@oracle.com>,
Mike Rapoport <rppt@linux.ibm.com>, Nadav Amit <namit@vmware.com>,
Oded Gabbay <oded.gabbay@gmail.com>,
Oleg Nesterov <oleg@redhat.com>,
Paul Mackerras <paulus@samba.org>,
Pedro Demarchi Gomes <pedrodemargomes@gmail.com>,
Peter Xu <peterx@redhat.com>, Rik van Riel <riel@surriel.com>,
Roman Gushchin <guro@fb.com>, Shakeel Butt <shakeelb@google.com>,
Thomas Gleixner <tglx@linutronix.de>,
Vasily Gorbik <gor@linux.ibm.com>,
Vlastimil Babka <vbabka@suse.cz>, Will Deacon <will@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
lkp@lists.01.org, lkp@intel.com
Subject: Re: [x86/pgtable] d1ec551f87: BUG:Bad_page_map_in_process
Date: Tue, 19 Apr 2022 10:36:56 +0200 [thread overview]
Message-ID: <57e2e54e-ccdf-a2b8-25cd-72848359533c@redhat.com> (raw)
In-Reply-To: <3dfc5379-3ca8-243e-e11c-782599863fcc@redhat.com>
On 19.04.22 10:22, David Hildenbrand wrote:
> On 19.04.22 09:59, kernel test robot wrote:
>>
>>
>> Greeting,
>>
>> FYI, we noticed the following commit (built with clang-15):
>>
>> commit: d1ec551f874e1663bfe76b994c0010a4566cf936 ("x86/pgtable: support __HAVE_ARCH_PTE_SWP_EXCLUSIVE")
>> https://github.com/hnaz/linux-mm master
>>
>> in testcase: trinity
>> version: trinity-static-i386-x86_64-1c734c75-1_2020-01-06
>> with following parameters:
>>
>> runtime: 300s
>> group: group-01
>>
>> test-description: Trinity is a linux system call fuzz tester.
>> test-url: http://codemonkey.org.uk/projects/trinity/
>>
>>
>> on test machine: qemu-system-i386 -enable-kvm -cpu SandyBridge -smp 2 -m 4G
>>
>> caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace):
>>
>>
>>
>> If you fix the issue, kindly add following tag
>> Reported-by: kernel test robot <oliver.sang@intel.com>
>>
>>
>> [ 40.201103][ T5099] BUG: Bad page map in process trinity-c7 pte:1713003a pmd:7ff71067
>> [ 40.201999][ T5099] addr:096e7000 vm_flags:00100073 anon_vma:bff0aa00 mapping:00000000 index:96e7
>> [ 40.202718][ T5099] file:(null) fault:0x0 mmap:0x0 readpage:0x0
>> [ 40.203229][ T5099] CPU: 0 PID: 5099 Comm: trinity-c7 Not tainted 5.18.0-rc2-mm1-00053-gd1ec551f874e #1
>> [ 40.203952][ T5099] Call Trace:
>> [ 40.204195][ T5099] ? dump_stack_lvl (??:?)
>> [ 40.204581][ T5099] ? dump_stack (??:?)
>> [ 40.204970][ T5099] ? print_bad_pte (memory.c:?)
>> [ 40.205384][ T5099] ? unmap_page_range (??:?)
>> [ 40.205843][ T5099] ? unmap_single_vma (memory.c:?)
>> [ 40.206271][ T5099] ? unmap_vmas (??:?)
>> [ 40.206647][ T5099] ? exit_mmap (??:?)
>> [ 40.207032][ T5099] ? __mmput (fork.c:?)
>> [ 40.207405][ T5099] ? mmput (??:?)
>> [ 40.207751][ T5099] ? exit_mm (exit.c:?)
>> [ 40.208121][ T5099] ? do_exit (??:?)
>> [ 40.208497][ T5099] ? do_group_exit (??:?)
>> [ 40.208905][ T5099] ? trace_hardirqs_on (??:?)
>> [ 40.209345][ T5099] ? get_signal (??:?)
>> [ 40.209750][ T5099] ? arch_do_signal_or_restart (??:?)
>> [ 40.210287][ T5099] ? exit_to_user_mode_loop (common.c:?)
>> [ 40.210778][ T5099] ? exit_to_user_mode_prepare (common.c:?)
>> [ 40.211302][ T5099] ? syscall_exit_to_user_mode (??:?)
>> [ 40.211808][ T5099] ? ret_from_fork (??:?)
>> [ 40.212268][ T5099] Disabling lock debugging due to kernel taint
>> [ 40.231123][ T5097] BUG: Bad page map in process trinity-c5 pte:171e0a3e pmd:0a8d3067
>> [ 40.231770][ T5099] BUG: Bad page map in process trinity-c7 pte:1713023a pmd:7ff71067
>> [ 40.231883][ T5097] addr:36ed5000 vm_flags:000000fb anon_vma:00000000 mapping:485d0d80 index:1
>> [ 40.232611][ T5099] addr:096e8000 vm_flags:00100073 anon_vma:bff0ab18 mapping:00000000 index:96e8
>> [ 40.233429][ T5097] file:dev/zero fault:shmem_fault mmap:shmem_mmap readpage:0x0
>> [ 40.234271][ T5099] file:(null) fault:0x0 mmap:0x0 readpage:0x0
>> [ 40.234971][ T5097] CPU: 1 PID: 5097 Comm: trinity-c5 Tainted: G B 5.18.0-rc2-mm1-00053-gd1ec551f874e #1
>> [ 40.236510][ T5097] Call Trace:
>
> This is 32bit (i386) I assume. I wonder if something about the 32bit swp
> layout is special and we have to restrict it to 64bit here.
>
Staring at arch/x86/include/asm/pgtable-2level.h, I think that's the case:
The swp type effectively starts at "_PAGE_BIT_PRESENT + 1" which should be bit 1.
Let's restrict this to x86-64 for now.
I think this is similar to CONFIG_HAVE_ARCH_SOFT_DIRTY, which depends on 64 bit.
The following should do the trick:
diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index e42e668153e9..a1c555abed26 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -1291,7 +1291,7 @@ static inline void update_mmu_cache_pud(struct vm_area_struct *vma,
unsigned long addr, pud_t *pud)
{
}
-
+#ifdef _PAGE_SWP_EXCLUSIVE
#define __HAVE_ARCH_PTE_SWP_EXCLUSIVE
static inline pte_t pte_swp_mkexclusive(pte_t pte)
{
@@ -1307,6 +1307,7 @@ static inline pte_t pte_swp_clear_exclusive(pte_t pte)
{
return pte_clear_flags(pte, _PAGE_SWP_EXCLUSIVE);
}
+#endif /* _PAGE_SWP_EXCLUSIVE */
#ifdef CONFIG_HAVE_ARCH_SOFT_DIRTY
static inline pte_t pte_swp_mksoft_dirty(pte_t pte)
diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/include/asm/pgtable_types.h
index 54a8f370046d..95403ae1f2e5 100644
--- a/arch/x86/include/asm/pgtable_types.h
+++ b/arch/x86/include/asm/pgtable_types.h
@@ -83,10 +83,12 @@
#define _PAGE_SOFT_DIRTY (_AT(pteval_t, 0))
#endif
+#ifdef CONFIG_64BIT
/*
- * We borrow bit 3 to remember PG_anon_exclusive.
+ * We borrow bit 3 on x86-64 to remember PG_anon_exclusive.
*/
#define _PAGE_SWP_EXCLUSIVE _PAGE_PWT
+#endif /* CONFIG_64BIT */
/*
* Tracking soft dirty bit when a page goes to a swap is tricky.
Thoughts?
--
Thanks,
David / dhildenb
next prev parent reply other threads:[~2022-04-19 8:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-19 7:59 kernel test robot
2022-04-19 8:22 ` David Hildenbrand
2022-04-19 8:36 ` David Hildenbrand [this message]
2022-04-19 13:00 ` David Hildenbrand
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=57e2e54e-ccdf-a2b8-25cd-72848359533c@redhat.com \
--to=david@redhat.com \
--cc=aarcange@redhat.com \
--cc=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=benh@kernel.crashing.org \
--cc=bp@alien8.de \
--cc=catalin.marinas@arm.com \
--cc=dave.hansen@linux.intel.com \
--cc=ddutile@redhat.com \
--cc=gerald.schaefer@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=guro@fb.com \
--cc=hannes@cmpxchg.org \
--cc=hca@linux.ibm.com \
--cc=hch@lst.de \
--cc=hughd@google.com \
--cc=jack@suse.cz \
--cc=jannh@google.com \
--cc=jgg@nvidia.com \
--cc=jhubbard@nvidia.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=lkp@lists.01.org \
--cc=mhocko@kernel.org \
--cc=mike.kravetz@oracle.com \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=namit@vmware.com \
--cc=oded.gabbay@gmail.com \
--cc=oleg@redhat.com \
--cc=oliver.sang@intel.com \
--cc=paulus@samba.org \
--cc=pedrodemargomes@gmail.com \
--cc=peterx@redhat.com \
--cc=riel@surriel.com \
--cc=rppt@linux.ibm.com \
--cc=shakeelb@google.com \
--cc=tglx@linutronix.de \
--cc=vbabka@suse.cz \
--cc=will@kernel.org \
--cc=willy@infradead.org \
--cc=zhangliang5@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®