[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrUjpdSGg0T8vehkXszDJKx5AS0BHP9qFRsakPABzPM2GA@mail.gmail.com>
Date: Sat, 21 Nov 2020 20:10:16 -0800
From: Andy Lutomirski <luto@...nel.org>
To: Rick Edgecombe <rick.p.edgecombe@...el.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Jessica Yu <jeyu@...nel.org>, bpf <bpf@...r.kernel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrew Lutomirski <luto@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>, X86 ML <x86@...nel.org>,
Mike Rapoport <rppt@...nel.org>, Linux-MM <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>,
Dan Williams <dan.j.williams@...el.com>,
Elena Reshetova <elena.reshetova@...el.com>,
Weiny Ira <ira.weiny@...el.com>
Subject: Re: [PATCH RFC 01/10] vmalloc: Add basic perm alloc implementation
On Fri, Nov 20, 2020 at 12:30 PM Rick Edgecombe
<rick.p.edgecombe@...el.com> wrote:
>
> In order to allow for future arch specific optimizations for vmalloc
> permissions, first add an implementation of a new interface that will
> work cross arch by using the existing set_memory_() functions.
>
> When allocating some memory that will be RO, for example it should be used
> like:
>
> /* Reserve va */
> struct perm_allocation *alloc = perm_alloc(vstart, vend, page_cnt, PERM_R);
I'm sure I could reverse-engineer this from the code, but:
Where do vstart and vend come from? Does perm_alloc() allocate memory
or just virtual addresses? Is the caller expected to call vmalloc()?
How does one free this thing?
> unsigned long ro = (unsigned long)perm_alloc_address(alloc);
>
> /* Write to writable address */
> strcpy((char *)perm_writable_addr(alloc, ro), "Some data to be RO");
> /* Signal that writing is done and mapping should be live */
> perm_writable_finish(alloc);
> /* Print from RO address */
> printk("Read only data is: %s\n", (char *)ro);
>
Powered by blists - more mailing lists