On Fri, 2 Jun 2017 12:28:48 +0200 Heiko Carstens <heiko.carstens@xxxxxxxxxx> wrote: > On Fri, Jun 02, 2017 at 11:46:47AM +0200, Martin Schwidefsky wrote: > > On Fri, 2 Jun 2017 09:02:10 +0200 > > Heiko Carstens <heiko.carstens@xxxxxxxxxx> wrote: > > > Maybe this is a bit over-simplified, but might work. > > This is not over-simplified at all, that does work: > > Good! > > > +struct arch_elf_state { > > +}; > > + > > +#define INIT_ARCH_ELF_STATE { } > > + > > +#define arch_elf_pt_proc(ehdr, phdr, elf, interp, state) (0) > > +#define arch_check_elf(ehdr, interp, interp_ehdr, state) \ > > +({ \ > > + struct elf64_hdr *hdr = (void*) ehdr; \ > > + int _rc = 0; \ > > + if (hdr->e_ident[EI_CLASS] == ELFCLASS64 && \ > > + (hdr->e_flags & 0x00000002) && \ > > + !page_table_allocate_pgste && \ > > + !current->mm->context.alloc_pgste) { \ > > + current->mm->context.alloc_pgste = 1; \ > > However, I think this is over-simplified, unless I'm mistaken. > > If you set current->mm->context.alloc_pgste here, then that means that 4k > page tables will be freed when the original mm will be released, instead of > the correct 2k ones. > > I think you need an additional intermediate context flag here. Something > like current->mm->context.request_pgste or whatever, no? Yes, the flags for the current mm and the next mm have to be different. request_pgste is a nice name for the new flag, I'll use it. -- blue skies, Martin. "Reality continues to ruin my life." - Calvin.