Re: [PATCH 6/7] i915: Convert to verify_page_range()

From: Peter Zijlstra
Date: Tue Apr 13 2021 - 02:54:59 EST


On Mon, Apr 12, 2021 at 01:08:38PM -0700, Kees Cook wrote:
> On Mon, Apr 12, 2021 at 10:00:18AM +0200, Peter Zijlstra wrote:
> > @@ -1249,14 +1249,14 @@ static int check_absent_pte(pte_t *pte,
> >
> > static int check_present(unsigned long addr, unsigned long len)
> > {
> > - return apply_to_page_range(current->mm, addr, len,
> > - check_present_pte, (void *)addr);
> > + return verify_page_range(current->mm, addr, len,
> > + check_present_pte, (void *)addr);
>
> For example, switch to returning bad addr through verify_page_range(),
> or have a by-reference value, etc:
>
> unsigned long failed;
>
> failed = verify_page_range(current->mm< addr, len, check_present_pte);
> if (failed) {
> pr_err("missing PTE:%lx\n",
> (addr - failed) >> PAGE_SHIFT);

OK, lemme try that.