lkml.org 
[lkml]   [2021]   [Apr]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.

\
 
 \ /
  Last update: 2021-04-14 09:03    [W:0.173 / U:0.724 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site