# git rev-parse -q --verify 19ab500edb5d6020010caba48ce3b4ce4182ab63^{commit} 19ab500edb5d6020010caba48ce3b4ce4182ab63 already have revision, skipping fetch # git checkout -q -f -B kisskb 19ab500edb5d6020010caba48ce3b4ce4182ab63 # git clean -qxdf # < git log -1 # commit 19ab500edb5d6020010caba48ce3b4ce4182ab63 # Author: Aneesh Kumar K.V # Date: Sat Jun 27 12:31:46 2020 +0530 # # powerpc/mm/pkeys: Make pkey access check work on execute_only_key # # Jan reported that LTP mmap03 was getting stuck in a page fault loop # after commit c46241a370a6 ("powerpc/pkeys: Check vma before returning # key fault error to the user"), as well as a minimised reproducer: # # #include # #include # #include # #include # #include # # 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; # } # # And noticed that access_pkey_error() in page fault handler now always # seem to return false: # # __do_page_fault # access_pkey_error(is_pkey: 1, is_exec: 0, is_write: 0) # arch_vma_access_permitted # pkey_access_permitted # if (!is_pkey_enabled(pkey)) # return true # return false # # pkey_access_permitted() should not check if the pkey is available in # UAMOR (using is_pkey_enabled()). The kernel needs to do that check # only when allocating keys. This also makes sure the execute_only_key # which is marked as non-manageable via UAMOR is handled correctly in # pkey_access_permitted(), and fixes the bug. # # Fixes: c46241a370a6 ("powerpc/pkeys: Check vma before returning key fault error to the user") # Reported-by: Jan Stancek # Signed-off-by: Aneesh Kumar K.V # [mpe: Include bug report details etc. in the change log] # Signed-off-by: Michael Ellerman # Link: https://lore.kernel.org/r/20200627070147.297535-1-aneesh.kumar@linux.ibm.com # < /opt/cross/kisskb/br-mipsel-o32-full-2016.08-613-ge98b4dd/bin/mipsel-linux-gcc --version # < /opt/cross/kisskb/br-mipsel-o32-full-2016.08-613-ge98b4dd/bin/mipsel-linux-ld --version # < git log --format=%s --max-count=1 19ab500edb5d6020010caba48ce3b4ce4182ab63 # < make -s -j 48 ARCH=mips O=/kisskb/build/powerpc-fixes_mips-defconfig_mipsel CROSS_COMPILE=/opt/cross/kisskb/br-mipsel-o32-full-2016.08-613-ge98b4dd/bin/mipsel-linux- defconfig # < make -s -j 48 ARCH=mips O=/kisskb/build/powerpc-fixes_mips-defconfig_mipsel CROSS_COMPILE=/opt/cross/kisskb/br-mipsel-o32-full-2016.08-613-ge98b4dd/bin/mipsel-linux- help # make -s -j 48 ARCH=mips O=/kisskb/build/powerpc-fixes_mips-defconfig_mipsel CROSS_COMPILE=/opt/cross/kisskb/br-mipsel-o32-full-2016.08-613-ge98b4dd/bin/mipsel-linux- olddefconfig # make -s -j 48 ARCH=mips O=/kisskb/build/powerpc-fixes_mips-defconfig_mipsel CROSS_COMPILE=/opt/cross/kisskb/br-mipsel-o32-full-2016.08-613-ge98b4dd/bin/mipsel-linux- FIT description: Linux 5.8.0-rc2-g19ab500edb5d Created: Tue Jun 30 00:43:38 2020 Image 0 (kernel@0) Description: Linux 5.8.0-rc2-g19ab500edb5d Created: Tue Jun 30 00:43:38 2020 Type: Kernel Image Compression: gzip compressed Data Size: 4993845 Bytes = 4876.80 KiB = 4.76 MiB Architecture: MIPS OS: Linux Load Address: 0x80100000 Entry Point: 0x809319e0 Hash algo: sha1 Hash value: aa18927205018c40594f7a5ac7c6c35674912b50 Image 1 (fdt@boston) Description: img,boston Device Tree Created: Tue Jun 30 00:43:38 2020 Type: Flat Device Tree Compression: uncompressed Data Size: 3793 Bytes = 3.70 KiB = 0.00 MiB Architecture: MIPS Hash algo: sha1 Hash value: 4799f50d688573234da6e9d7701234d394759ef4 Image 2 (fdt@ni169445) Description: NI 169445 device tree Created: Tue Jun 30 00:43:38 2020 Type: Flat Device Tree Compression: uncompressed Data Size: 1871 Bytes = 1.83 KiB = 0.00 MiB Architecture: MIPS Hash algo: sha1 Hash value: 51b89b31605ee62038c8468c429af091dfc75ec7 Image 3 (fdt@ocelot_pcb123) Description: MSCC Ocelot PCB123 Device Tree Created: Tue Jun 30 00:43:38 2020 Type: Flat Device Tree Compression: uncompressed Data Size: 4639 Bytes = 4.53 KiB = 0.00 MiB Architecture: MIPS Hash algo: sha1 Hash value: be2724f58b66c316a61da7c11ced633f4e7e86c7 Image 4 (fdt@ocelot_pcb120) Description: MSCC Ocelot PCB120 Device Tree Created: Tue Jun 30 00:43:38 2020 Type: Flat Device Tree Compression: uncompressed Data Size: 5198 Bytes = 5.08 KiB = 0.00 MiB Architecture: MIPS Hash algo: sha1 Hash value: 7556b1594bd7ab9e3b3fa939d8e3e03ae58fa180 Image 5 (fdt@xilfpga) Description: MIPSfpga (xilfpga) Device Tree Created: Tue Jun 30 00:43:38 2020 Type: Flat Device Tree Compression: uncompressed Data Size: 2708 Bytes = 2.64 KiB = 0.00 MiB Architecture: MIPS Hash algo: sha1 Hash value: 63d058b780f65e22da30f0a183433765f1807f1d Default Configuration: 'conf@default' Configuration 0 (conf@default) Description: Generic Linux kernel Kernel: kernel@0 Configuration 1 (conf@boston) Description: Boston Linux kernel Kernel: kernel@0 FDT: fdt@boston Configuration 2 (conf@ni169445) Description: NI 169445 Linux Kernel Kernel: kernel@0 FDT: fdt@ni169445 Configuration 3 (conf@ocelot_pcb123) Description: Ocelot Linux kernel Kernel: kernel@0 FDT: fdt@ocelot_pcb123 Configuration 4 (conf@ocelot_pcb120) Description: Ocelot Linux kernel Kernel: kernel@0 FDT: fdt@ocelot_pcb120 Configuration 5 (conf@xilfpga) Description: MIPSfpga Linux kernel Kernel: kernel@0 FDT: fdt@xilfpga Completed OK # rm -rf /kisskb/build/powerpc-fixes_mips-defconfig_mipsel # Build took: 0:02:01.137497