* [kas:uffd/v2 9/14] fs/userfaultfd.c:268 userfaultfd_huge_must_wait() warn: bitwise AND condition is false here
@ 2026-05-13 6:58 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-05-13 6:58 UTC (permalink / raw)
To: oe-kbuild; +Cc: lkp, Dan Carpenter
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: "Kiryl Shutsemau (Meta)" <kas@kernel.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/kas/linux.git uffd/v2
head: 0b6f87fd4809245f9eebee73f34e2fb14230330c
commit: 454b3381cb7ead65291b2d7e24c0bff62e55c41b [9/14] mm/userfaultfd: add RWP fault delivery and expose UFFDIO_REGISTER_MODE_RWP
:::::: branch date: 5 days ago
:::::: commit date: 5 days ago
config: powerpc-randconfig-r071-20260512 (https://download.01.org/0day-ci/archive/20260513/202605131448.3M8vurVv-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 11.5.0
smatch: v0.5.0-9065-ge9cc34fd
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202605131448.3M8vurVv-lkp@intel.com/
New smatch warnings:
fs/userfaultfd.c:268 userfaultfd_huge_must_wait() warn: bitwise AND condition is false here
Old smatch warnings:
fs/userfaultfd.c:218 userfault_msg() warn: bitwise AND condition is false here
fs/userfaultfd.c:334 userfaultfd_must_wait() warn: bitwise AND condition is false here
fs/userfaultfd.c:368 userfaultfd_must_wait() warn: bitwise AND condition is false here
fs/userfaultfd.c:1330 userfaultfd_register() warn: bitwise AND condition is false here
vim +268 fs/userfaultfd.c
86039bd3b4e6a11 Andrea Arcangeli 2015-09-04 226
369cd2121be4405 Mike Kravetz 2017-02-22 227 #ifdef CONFIG_HUGETLB_PAGE
369cd2121be4405 Mike Kravetz 2017-02-22 228 /*
369cd2121be4405 Mike Kravetz 2017-02-22 229 * Same functionality as userfaultfd_must_wait below with modifications for
369cd2121be4405 Mike Kravetz 2017-02-22 230 * hugepmd ranges.
369cd2121be4405 Mike Kravetz 2017-02-22 231 */
369cd2121be4405 Mike Kravetz 2017-02-22 232 static inline bool userfaultfd_huge_must_wait(struct userfaultfd_ctx *ctx,
29a22b9e08d70d6 Suren Baghdasaryan 2023-06-30 233 struct vm_fault *vmf,
369cd2121be4405 Mike Kravetz 2017-02-22 234 unsigned long reason)
369cd2121be4405 Mike Kravetz 2017-02-22 235 {
29a22b9e08d70d6 Suren Baghdasaryan 2023-06-30 236 struct vm_area_struct *vma = vmf->vma;
1e2c043628c7736 Janosch Frank 2018-07-03 237 pte_t *ptep, pte;
369cd2121be4405 Mike Kravetz 2017-02-22 238
29a22b9e08d70d6 Suren Baghdasaryan 2023-06-30 239 assert_fault_locked(vmf);
1e2c043628c7736 Janosch Frank 2018-07-03 240
29a22b9e08d70d6 Suren Baghdasaryan 2023-06-30 241 ptep = hugetlb_walk(vma, vmf->address, vma_mmu_pagesize(vma));
1e2c043628c7736 Janosch Frank 2018-07-03 242 if (!ptep)
c093cf451094a9a Lorenzo Stoakes 2025-11-10 243 return true;
369cd2121be4405 Mike Kravetz 2017-02-22 244
e6c0c03245b14d6 Christophe Leroy 2024-07-02 245 pte = huge_ptep_get(vma->vm_mm, vmf->address, ptep);
369cd2121be4405 Mike Kravetz 2017-02-22 246
369cd2121be4405 Mike Kravetz 2017-02-22 247 /*
369cd2121be4405 Mike Kravetz 2017-02-22 248 * Lockless access: we're in a wait_event so it's ok if it
c093cf451094a9a Lorenzo Stoakes 2025-11-10 249 * changes under us.
c093cf451094a9a Lorenzo Stoakes 2025-11-10 250 */
c093cf451094a9a Lorenzo Stoakes 2025-11-10 251
c093cf451094a9a Lorenzo Stoakes 2025-11-10 252 /* Entry is still missing, wait for userspace to resolve the fault. */
c093cf451094a9a Lorenzo Stoakes 2025-11-10 253 if (huge_pte_none(pte))
c093cf451094a9a Lorenzo Stoakes 2025-11-10 254 return true;
c093cf451094a9a Lorenzo Stoakes 2025-11-10 255 /* UFFD PTE markers require userspace to resolve the fault. */
68aa2fdbf57f769 Lorenzo Stoakes 2025-11-10 256 if (pte_is_uffd_marker(pte))
c093cf451094a9a Lorenzo Stoakes 2025-11-10 257 return true;
c093cf451094a9a Lorenzo Stoakes 2025-11-10 258 /*
c093cf451094a9a Lorenzo Stoakes 2025-11-10 259 * If VMA has UFFD WP faults enabled and WP fault, wait for userspace to
c093cf451094a9a Lorenzo Stoakes 2025-11-10 260 * resolve the fault.
369cd2121be4405 Mike Kravetz 2017-02-22 261 */
1e2c043628c7736 Janosch Frank 2018-07-03 262 if (!huge_pte_write(pte) && (reason & VM_UFFD_WP))
c093cf451094a9a Lorenzo Stoakes 2025-11-10 263 return true;
454b3381cb7ead6 Kiryl Shutsemau (Meta 2026-04-18 264) /*
454b3381cb7ead6 Kiryl Shutsemau (Meta 2026-04-18 265) * PTE is still RW-protected (protnone with uffd bit), wait for
454b3381cb7ead6 Kiryl Shutsemau (Meta 2026-04-18 266) * resolution. Plain PROT_NONE without the marker is not an RWP fault.
454b3381cb7ead6 Kiryl Shutsemau (Meta 2026-04-18 267) */
454b3381cb7ead6 Kiryl Shutsemau (Meta 2026-04-18 @268) if (pte_protnone(pte) && huge_pte_uffd(pte) && (reason & VM_UFFD_RWP))
454b3381cb7ead6 Kiryl Shutsemau (Meta 2026-04-18 269) return true;
c093cf451094a9a Lorenzo Stoakes 2025-11-10 270
c093cf451094a9a Lorenzo Stoakes 2025-11-10 271 return false;
369cd2121be4405 Mike Kravetz 2017-02-22 272 }
369cd2121be4405 Mike Kravetz 2017-02-22 273 #else
369cd2121be4405 Mike Kravetz 2017-02-22 274 static inline bool userfaultfd_huge_must_wait(struct userfaultfd_ctx *ctx,
29a22b9e08d70d6 Suren Baghdasaryan 2023-06-30 275 struct vm_fault *vmf,
369cd2121be4405 Mike Kravetz 2017-02-22 276 unsigned long reason)
369cd2121be4405 Mike Kravetz 2017-02-22 277 {
c093cf451094a9a Lorenzo Stoakes 2025-11-10 278 /* Should never get here. */
c093cf451094a9a Lorenzo Stoakes 2025-11-10 279 VM_WARN_ON_ONCE(1);
c093cf451094a9a Lorenzo Stoakes 2025-11-10 280 return false;
369cd2121be4405 Mike Kravetz 2017-02-22 281 }
369cd2121be4405 Mike Kravetz 2017-02-22 282 #endif /* CONFIG_HUGETLB_PAGE */
369cd2121be4405 Mike Kravetz 2017-02-22 283
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-05-13 6:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-13 6:58 [kas:uffd/v2 9/14] fs/userfaultfd.c:268 userfaultfd_huge_must_wait() warn: bitwise AND condition is false here kernel test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.