[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0465d13d-83b6-163d-438d-065d03e9ba76@intel.com>
Date: Mon, 11 Sep 2023 15:12:27 +0800
From: Yin Fengwei <fengwei.yin@...el.com>
To: syzbot <syzbot+55cc72f8cc3a549119df@...kaller.appspotmail.com>,
<akpm@...ux-foundation.org>, <linux-kernel@...r.kernel.org>,
<linux-mm@...ck.org>, <syzkaller-bugs@...glegroups.com>,
<willy@...radead.org>
Subject: Re: [syzbot] [mm?] BUG: Bad page map (7)
On 9/10/23 01:12, syzbot wrote:
> commit 617c28ecab22d98a3809370eb6cb50fa24b7bfe1
> Author: Yin Fengwei <fengwei.yin@...el.com>
> Date: Wed Aug 2 15:14:05 2023 +0000
>
> filemap: batch PTE mappings
#syz test
diff --git a/arch/x86/include/asm/pgtable_64.h b/arch/x86/include/asm/pgtable_64.h
index a629b1b9f65a6..2701b47efa8f7 100644
--- a/arch/x86/include/asm/pgtable_64.h
+++ b/arch/x86/include/asm/pgtable_64.h
@@ -168,6 +168,28 @@ static inline void native_pgd_clear(pgd_t *pgd)
native_set_pgd(pgd, native_make_pgd(0));
}
+static inline void set_ptes(struct mm_struct *mm, unsigned long addr,
+ pte_t *ptep, pte_t pte, unsigned int nr)
+{
+ bool protnone = (pte_flags(pte) & (_PAGE_PROTNONE | _PAGE_PRESENT))
+ == _PAGE_PROTNONE;
+
+ page_table_check_ptes_set(mm, ptep, pte, nr);
+
+ for(;;) {
+ native_set_pte(ptep, pte);
+ if (--nr == 0)
+ break;
+
+ ptep++;
+ if (protnone)
+ pte = __pte(pte_val(pte) - (1UL << PFN_PTE_SHIFT));
+ else
+ pte = __pte(pte_val(pte) + (1UL << PFN_PTE_SHIFT));
+ }
+}
+#define set_ptes set_ptes
+
/*
* Conversion functions: convert a page and protection to a page entry,
* and a page entry and page directory to the page they refer to.
Powered by blists - more mailing lists