[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y3Fw0DcIr/rXLw3v@x1n>
Date: Sun, 13 Nov 2022 17:33:52 -0500
From: Peter Xu <peterx@...hat.com>
To: kernel test robot <lkp@...el.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
oe-kbuild-all@...ts.linux.dev,
Andrea Arcangeli <aarcange@...hat.com>,
Axel Rasmussen <axelrasmussen@...gle.com>,
Ives van Hoorne <ives@...esandbox.io>,
Nadav Amit <nadav.amit@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Mike Rapoport <rppt@...ux.vnet.ibm.com>
Subject: Re: [PATCH v2 2/2] mm/uffd: Sanity check write bit for uffd-wp
protected ptes
On Sat, Nov 12, 2022 at 06:06:22AM +0800, kernel test robot wrote:
> vim +306 arch/x86/include/asm/pgtable.h
>
> 290
> 291 #ifdef CONFIG_HAVE_ARCH_USERFAULTFD_WP
> 292 static inline int pte_uffd_wp(pte_t pte)
> 293 {
> 294 bool wp = pte_flags(pte) & _PAGE_UFFD_WP;
> 295
> 296 /*
> 297 * Having write bit for wr-protect-marked present ptes is fatal,
> 298 * because it means the uffd-wp bit will be ignored and write will
> 299 * just go through.
> 300 *
> 301 * Use any chance of pgtable walking to verify this (e.g., when
> 302 * page swapped out or being migrated for all purposes). It means
> 303 * something is already wrong. Tell the admin even before the
> 304 * process crashes. We also nail it with wrong pgtable setup.
> 305 */
> > 306 VM_WARN_ON_ONCE(wp && pte_write(pte));
I just saw the comment in check_pgprot() right below:
/* mmdebug.h can not be included here because of dependencies */
#ifdef CONFIG_DEBUG_VM
...
#endif
I'll repost, will be the same as v1 code-wise.
--
Peter Xu
Powered by blists - more mailing lists