# git rev-parse -q --verify 51d92826594c3ac1f9b7179a3ab246394a11ecd8^{commit} 51d92826594c3ac1f9b7179a3ab246394a11ecd8 already have revision, skipping fetch # git checkout -q -f -B kisskb 51d92826594c3ac1f9b7179a3ab246394a11ecd8 # git clean -qxdf # < git log -1 # commit 51d92826594c3ac1f9b7179a3ab246394a11ecd8 # Author: Christophe Leroy # Date: Mon Feb 1 06:29:50 2021 +0000 # # powerpc/603: Fix protection of user pages mapped with PROT_NONE # # On book3s/32, page protection is defined by the PP bits in the PTE # which provide the following protection depending on the access # keys defined in the matching segment register: # - PP 00 means RW with key 0 and N/A with key 1. # - PP 01 means RW with key 0 and RO with key 1. # - PP 10 means RW with both key 0 and key 1. # - PP 11 means RO with both key 0 and key 1. # # Since the implementation of kernel userspace access protection, # PP bits have been set as follows: # - PP00 for pages without _PAGE_USER # - PP01 for pages with _PAGE_USER and _PAGE_RW # - PP11 for pages with _PAGE_USER and without _PAGE_RW # # For kernelspace segments, kernel accesses are performed with key 0 # and user accesses are performed with key 1. As PP00 is used for # non _PAGE_USER pages, user can't access kernel pages not flagged # _PAGE_USER while kernel can. # # For userspace segments, both kernel and user accesses are performed # with key 0, therefore pages not flagged _PAGE_USER are still # accessible to the user. # # This shouldn't be an issue, because userspace is expected to be # accessible to the user. But unlike most other architectures, powerpc # implements PROT_NONE protection by removing _PAGE_USER flag instead of # flagging the page as not valid. This means that pages in userspace # that are not flagged _PAGE_USER shall remain inaccessible. # # To get the expected behaviour, just mimic other architectures in the # TLB miss handler by checking _PAGE_USER permission on userspace # accesses as if it was the _PAGE_PRESENT bit. # # Note that this problem only is only for 603 cores. The 604+ have # an hash table, and hash_page() function already implement the # verification of _PAGE_USER permission on userspace pages. # # Fixes: f342adca3afc ("powerpc/32s: Prepare Kernel Userspace Access Protection") # Cc: stable@vger.kernel.org # v5.2+ # Reported-by: Christoph Plattner # Signed-off-by: Christophe Leroy # Signed-off-by: Michael Ellerman # Link: https://lore.kernel.org/r/4a0c6e3bb8f0c162457bf54d9bc6fd8d7b55129f.1612160907.git.christophe.leroy@csgroup.eu # < /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 51d92826594c3ac1f9b7179a3ab246394a11ecd8 # < make -s -j 120 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 120 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 120 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 120 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.11.0-g51d92826594c Created: Thu Feb 25 02:27:42 2021 Image 0 (kernel@0) Description: Linux 5.11.0-g51d92826594c Created: Thu Feb 25 02:27:42 2021 Type: Kernel Image Compression: gzip compressed Data Size: 5247094 Bytes = 5124.12 KiB = 5.00 MiB Architecture: MIPS OS: Linux Load Address: 0x80100000 Entry Point: 0x809a63a0 Hash algo: sha1 Hash value: c8888eb2eb980661c0ef3db2f6113544e4bea45a Image 1 (fdt@boston) Description: img,boston Device Tree Created: Thu Feb 25 02:27:42 2021 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: Thu Feb 25 02:27:42 2021 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: Thu Feb 25 02:27:42 2021 Type: Flat Device Tree Compression: uncompressed Data Size: 4659 Bytes = 4.55 KiB = 0.00 MiB Architecture: MIPS Hash algo: sha1 Hash value: 5bcb6e4f21e8e5372544aa130b3bd097355a9050 Image 4 (fdt@ocelot_pcb120) Description: MSCC Ocelot PCB120 Device Tree Created: Thu Feb 25 02:27:42 2021 Type: Flat Device Tree Compression: uncompressed Data Size: 5418 Bytes = 5.29 KiB = 0.01 MiB Architecture: MIPS Hash algo: sha1 Hash value: 93d882f2009a217e0fa9dab94788535ed2be8476 Image 5 (fdt@xilfpga) Description: MIPSfpga (xilfpga) Device Tree Created: Thu Feb 25 02:27:42 2021 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:01:14.544068