[bug] LTP mmap03 stuck in page fault loop after c46241a370a6 ("powerpc/pkeys: Check vma before returning key fault error to the user")

Aneesh Kumar K.V aneesh.kumar at linux.ibm.com
Fri Jun 26 17:47:48 AEST 2020


Hi Jan,

On 6/26/20 12:29 PM, Jan Stancek wrote:
> Hi,
> 
> LTP mmap03 is getting stuck in page fault loop after commit
>    c46241a370a6 ("powerpc/pkeys: Check vma before returning key fault error to the user")
> 
> System is ppc64le P9 lpar [1] running v5.8-rc2-34-g3e08a95294a4.
> 
> Here's a minimized reproducer:
> ------------------------- 8< -----------------------------
> #include <fcntl.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <unistd.h>
> #include <sys/mman.h>
> 
> int main(int ac, char **av)
> {
>          int page_sz = getpagesize();
>          int fildes;
>          char *addr;
> 
>          fildes = open("tempfile", O_WRONLY | O_CREAT, 0666);
>          write(fildes, &fildes, sizeof(fildes));
>          close(fildes);
> 
>          fildes = open("tempfile", O_RDONLY);
>          unlink("tempfile");
> 
>          addr = mmap(0, page_sz, PROT_EXEC, MAP_FILE | MAP_PRIVATE, fildes, 0);
> 
>          printf("%d\n", *addr);
>          return 0;
> }
> ------------------------- >8 -----------------------------

Thanks for the report. This is execute only key where vma has the 
implied read permission. So The patch do break this case. I will see how 
best we can handle  PROT_EXEC and the multi threaded test that required 
the change in the patch.


-aneesh


More information about the Linuxppc-dev mailing list