Re: [PATCH] restore protections after forced fault in get_user_pages

From: Roland McGrath
Date: Mon Feb 02 2004 - 19:56:42 EST


> The follow_page issue should be fixable by just marking the _page_ dirty
> inside the ptrace routines. I think we do that anyway (or we'd already be
> buggy wrt perfectly normal writes).

access_process_vm already calls set_page_dirty_locked, in fact.
So things are relatively simple.

I suggested using pte_modify(pte, vma->vm_page_prot). That is not the
right thing to do, in fact. For private mappings, the vm_page_prot value
is always unwritable (PAGE_COPY). So getting the right bits is tiny bit
hairier. Either it can do:

if (vma->vm_flags & VM_WRITE)
entry = pte_mkwrite(entry);

or it can do something branchless like:

entry = pte_modify(entry, protection_map[vma->vm_flags & 0x7]);

Or maybe there is a more optimal formulation I haven't thought of.


Thanks,
Roland
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/