On Thu, Oct 17, 2024 at 10:35:27AM -0700, Andrii Nakryiko wrote: > On Thu, Oct 17, 2024 at 9:35 AM Shakeel Butt <shakeel.butt@xxxxxxxxx> wrote: > > On Thu, Oct 17, 2024 at 11:18:34AM GMT, David Hildenbrand wrote: > > > As replied elsewhere, can't we take a look at the mapping? > > > > > > We do the same thing in gup_fast_folio_allowed() where we check > > > secretmem_mapping(). > > > > Responded on the v1 but I think we can go with v1 of this work as > > whoever will be working on unmapping folios from direct map will need to > > fix gup_fast_folio_allowed(), they can fix this code as well. Also it > > seems like some arch don't have kernel_page_present() and builds are > > failing. > > > > Yeah, we are lucky that BPF CI tested s390x and caught this issue. > > > Andrii, let's move forward with the v1 patch. > > Let me post v3 based on v1 (checking for secretmem_mapping()), but > I'll change return code to -EFAULT, so in the future this can be > rolled into generic error handling code path with no change in error > code. Ok, I've seen that you don't need kernel_page_present() anymore, just after I implemented it for s390. I guess I'll send the patch below (with a different commit message) upstream anyway, just in case somebody else comes up with a similar use case.