Re: [PATCH RFC 01/10] vmalloc: Add basic perm alloc implementation

2020-12-07 Thread Edgecombe, Rick P
On Fri, 2020-12-04 at 15:24 -0800, Sean Christopherson wrote: > On Fri, Nov 20, 2020, Rick Edgecombe wrote: > > +struct perm_allocation { > > + struct page **pages; > > + virtual_perm cur_perm; > > + virtual_perm orig_perm; > > + struct vm_struct *area; > > + unsigned long offset; > > +

Re: [PATCH RFC 01/10] vmalloc: Add basic perm alloc implementation

2020-12-04 Thread Sean Christopherson
On Fri, Nov 20, 2020, Rick Edgecombe wrote: > +struct perm_allocation { > + struct page **pages; > + virtual_perm cur_perm; > + virtual_perm orig_perm; > + struct vm_struct *area; > + unsigned long offset; > + unsigned long size; > + void *writable; > +}; > + > +/* > +

Re: [PATCH RFC 01/10] vmalloc: Add basic perm alloc implementation

2020-11-24 Thread Edgecombe, Rick P
On Tue, 2020-11-24 at 10:16 +, Christoph Hellwig wrote: > On Mon, Nov 23, 2020 at 12:01:35AM +, Edgecombe, Rick P wrote: > > Another option could be putting the new metadata in vm_struct and > > just > > return that, like get_vm_area(). Then we don't need to invent a new > > struct. But

Re: [PATCH RFC 01/10] vmalloc: Add basic perm alloc implementation

2020-11-24 Thread Edgecombe, Rick P
On Tue, 2020-11-24 at 10:19 +, h...@infradead.org wrote: > But I thought that using those pgprot flags was still sort > overloading > > the meaning of pgprot. My understanding was that it is supposed to > > hold > > the actual bits set in the PTE. For example large pages or TLB > > hints > >

Re: [PATCH RFC 01/10] vmalloc: Add basic perm alloc implementation

2020-11-24 Thread h...@infradead.org
On Mon, Nov 23, 2020 at 08:44:12PM +, Edgecombe, Rick P wrote: > Well, there were two reasons: > 1. Non-standard naming for the PAGE_FOO flags. For example, > PAGE_KERNEL_ROX vs PAGE_KERNEL_READ_EXEC. This could be unified. I > think it's just riscv that breaks the conventions. Others are just

Re: [PATCH RFC 01/10] vmalloc: Add basic perm alloc implementation

2020-11-24 Thread Christoph Hellwig
On Mon, Nov 23, 2020 at 12:01:35AM +, Edgecombe, Rick P wrote: > Another option could be putting the new metadata in vm_struct and just > return that, like get_vm_area(). Then we don't need to invent a new > struct. But then normal vmalloc()'s would have a bit of wasted memory > since they

Re: [PATCH RFC 01/10] vmalloc: Add basic perm alloc implementation

2020-11-23 Thread Edgecombe, Rick P
On Mon, 2020-11-23 at 09:00 +, Christoph Hellwig wrote: > First thanks for doing this, having a vmalloc variant that starts out > with proper permissions has been on my todo list for a while. > > > +#define PERM_R 1 > > +#define PERM_W 2 > > +#define PERM_X 4 > > +#define PERM_RWX

Re: [PATCH RFC 01/10] vmalloc: Add basic perm alloc implementation

2020-11-23 Thread Christoph Hellwig
First thanks for doing this, having a vmalloc variant that starts out with proper permissions has been on my todo list for a while. > +#define PERM_R 1 > +#define PERM_W 2 > +#define PERM_X 4 > +#define PERM_RWX (PERM_R | PERM_W | PERM_X) > +#define PERM_RW

Re: [PATCH RFC 01/10] vmalloc: Add basic perm alloc implementation

2020-11-22 Thread Edgecombe, Rick P
On Sat, 2020-11-21 at 20:10 -0800, Andy Lutomirski wrote: > On Fri, Nov 20, 2020 at 12:30 PM Rick Edgecombe > 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

Re: [PATCH RFC 01/10] vmalloc: Add basic perm alloc implementation

2020-11-21 Thread Andy Lutomirski
On Fri, Nov 20, 2020 at 12:30 PM Rick Edgecombe 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

[PATCH RFC 01/10] vmalloc: Add basic perm alloc implementation

2020-11-20 Thread Rick Edgecombe
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