On Wed, Jun 07, 2017 at 02:34:40PM +0200, Martin Schwidefsky wrote:
> +#define arch_elf_pt_proc(ehdr, phdr, elf, interp, state)     \
> +({                                                           \
> +     struct elf64_hdr *_ehdr = (void *) ehdr;                \
> +     struct elf64_phdr *_phdr = (void *) phdr;               \
> +     int _rc = 0;                                            \
> +     if (_ehdr->e_ident[EI_CLASS] == ELFCLASS64 &&           \
> +         _phdr->p_type == PT_S390_REQUEST_PGSTE &&           \
> +         !page_table_allocate_pgste &&                       \
> +         !test_thread_flag(TIF_REQUEST_PGSTE)) {             \
> +             set_thread_flag(TIF_REQUEST_PGSTE);             \
> +             set_pt_regs_flag(task_pt_regs(current),         \
> +                              PIF_SYSCALL_RESTART);          \
> +             _rc = -EAGAIN;                                  \
> +     }                                                       \
> +     _rc;                                                    \
> +})

I'm wondering if this should simply fail, if a PT_S390_REQUEST_PGSTE type
segment exists, but it is not ELFCLASS64?
It will fail later anyway on s390_enable_sie(), but...

> diff --git a/arch/s390/include/asm/mmu_context.h 
> b/arch/s390/include/asm/mmu_context.h
> index c119d564d8f2..1201b18e817d 100644
> --- a/arch/s390/include/asm/mmu_context.h
> +++ b/arch/s390/include/asm/mmu_context.h
> @@ -25,7 +25,8 @@ static inline int init_new_context(struct task_struct *tsk,
>       mm->context.gmap_asce = 0;
>       mm->context.flush_mm = 0;
>  #ifdef CONFIG_PGSTE
> -     mm->context.alloc_pgste = page_table_allocate_pgste;
> +     mm->context.alloc_pgste = page_table_allocate_pgste ||
> +             test_thread_flag(TIF_REQUEST_PGSTE);

I think the alloc_pgste flag should be inherited on fork, no?

Reply via email to