On Fri, Nov 20, 2020 at 12:30 PM Rick Edgecombe <rick.p.edgecombe@xxxxxxxxx> 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); >