On Thu, Mar 12, 2015 at 9:54 AM, Oleg Nesterov <o...@redhat.com> wrote: > On 03/12, Andy Lutomirski wrote: >> >> On Thu, Mar 12, 2015 at 7:34 AM, Oleg Nesterov <o...@redhat.com> wrote: >> > >> > What is not clear: do we really want gup() to fail? Or it is not trivial >> > to turn __vvar_page into the "normal" page? (to simplify the discussion, >> > lets ignore hpet mapping for now). >> >> We could presumably fiddle with the vma to allow get_user_pages to >> work on at least the first vvar page. There are some decently large >> caveats, though: >> >> - We don't want to COW it. If someone pokes at that page with >> ptrace, for example, and it gets COWed, everything will stop working >> because the offending process will no longer see updates. That way >> lies infinite loops. > > Of course, but this looks simple... is_cow_mapping() == F so FOLL_FORCE > won't work anyway? > >> - The implementation could be odd. The vma is either VM_MIXEDMAP or >> VM_PFNMAP, and I don't see any practical way to change that. >> >> - The HPET and perhaps pvclock stuff. The HPET probably doesn't have >> a struct page at all, so you can't possibly get_user_pages it. > > Yes, this is true. OK, lets not dump it. I'll probably send a patch which > changes vma_dump_size() to check VM_DONTDUMP first... > > But this leads to another question: why do we want to expose this > "vvar" vma at all? > > For the moment, forget about compat 32-bit applications running under > 64-bit kernel. > > Can't we simply add FIX_VVAR_PAGE into fixed_addresses{}, map it into > init_mm via set_fixmap(FIX_VVAR_PAGE, __PAGE_USER) and change __vdso.* > functions to use fix_to_virt() address? > > I don't really understand the low-level details, I'd like to understand > if this can work or not. And if it can work, why this is undesirable. > > As for 32-bit applications. Yes, this can't work because 32-bit simply > can't access this "high" memory. But you know, it would be very nice to > have the fixmap-like "global" area in init_mm which is also visible to > compat applications. If we had it, uprobes could work without xol vma's. >
It could work for 32-bit native, but not for 32-bit compat. Also, I have grand plans to add per-task vvar overrides for seccomp and such. And RIP-relative addressing is a bit nicer than absolute :) It used to work that way, but we changed it in 3.15 IIRC. On a related note, I'm hoping to rework the mm part pretty heavily: http://lkml.kernel.org/r/cover.1414629045.git.l...@amacapital.net --Andy > Oleg. > -- Andy Lutomirski AMA Capital Management, LLC -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/