On Jul 22, 2022, at 12:54 AM, David Hildenbrand <david@xxxxxxxxxx> wrote: > ⚠ External Email > > On 18.07.22 13:47, Nadav Amit wrote: >> From: Nadav Amit <namit@xxxxxxxxxx> >> >> As the next patches are going to introduce more information that needs >> to be propagated regarding handled user requests, introduce uffd_flags >> that would be used to propagate this information. >> >> Remove the unused UFFD_FLAGS_SET to avoid confusion in the constant >> names. >> >> Introducing uffd flags also allows to avoid mm/userfaultfd from being >> using uapi (e.g., UFFDIO_COPY_MODE_WP). >> >> Cc: Mike Kravetz <mike.kravetz@xxxxxxxxxx> >> Cc: Hugh Dickins <hughd@xxxxxxxxxx> >> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> >> Cc: Axel Rasmussen <axelrasmussen@xxxxxxxxxx> >> Cc: Peter Xu <peterx@xxxxxxxxxx> >> Cc: Mike Rapoport <rppt@xxxxxxxxxxxxx> >> Acked-by: David Hildenbrand <david@xxxxxxxxxx> >> Signed-off-by: Nadav Amit <namit@xxxxxxxxxx> > > [...] > >> int mwriteprotect_range(struct mm_struct *dst_mm, unsigned long start, >> - unsigned long len, bool enable_wp, >> - atomic_t *mmap_changing) >> + unsigned long len, >> + atomic_t *mmap_changing, uffd_flags_t uffd_flags) >> { >> + bool enable_wp = uffd_flags & UFFD_FLAGS_WP; > > Could be that this will trigger a sparse warnings, but I haven't fully > understood yet when/how sparse will start to complain. If so, this would > have to be > > bool enable_wp = !!(uffd_flags & UFFD_FLAGS_WP); > > I stumbled into something like that in > https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.kernel.org%2Flkml%2F202202252038.ij1YGn0d-lkp%40intel.com%2FT%2F&data=05%7C01%7Cnamit%40vmware.com%7Cc237032d11f04972fdb708da6bb77ada%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C637940733049609220%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=qW0xe6sS7PjP3papl890GoPTbZ97iE%2Ffztt1rA9t6%2F0%3D&reserved=0 Oh, damn. Thanks for pointing it out. Sparse gives me segmentation faults for some reason, but I guess it should be addressed - just in case.