[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YHaS+4eV7ATwAAWz@hirez.programming.kicks-ass.net>
Date: Wed, 14 Apr 2021 09:00:11 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Kees Cook <keescook@...omium.org>
Cc: akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
boris.ostrovsky@...cle.com, jgross@...e.com,
sstabellini@...nel.org, x86@...nel.org,
jani.nikula@...ux.intel.com, joonas.lahtinen@...ux.intel.com,
rodrigo.vivi@...el.com, chris@...is-wilson.co.uk,
intel-gfx@...ts.freedesktop.org, linux-mm@...ck.org, hch@....de
Subject: Re: [PATCH 4/7] mm: Introduce verify_page_range()
On Tue, Apr 13, 2021 at 08:01:08PM -0700, Kees Cook wrote:
> So the addr can just be encoded in "int", and no structure is needed at:
>
> typedef bool (*vpr_fn_t)(pte_t pte);
>
> static int vpr_fn(pte_t *pte, unsigned long addr, void *data)
> {
> vpr_fn_t callback = data;
>
> if (!callback(*pte))
> return addr >> PAGE_SIZE;
> return 0;
> }
>
> unsigned long verify_page_range(struct mm_struct *mm,
> unsigned long addr, unsigned long size,
> vpr_fn_t callback)
> {
> return apply_to_page_range(mm, addr, size, vpr_fn, callback) << PAGE_SIZE;
> }
>
> But maybe I'm missing something?
That covers only (32+12) bits of address space and will mostly work, but
we definitely support architectures (very much including x86_64) with
larger address spaces than that.
Powered by blists - more mailing lists