# git rev-parse -q --verify d02d2129641d6cd22492ddc85e11d112eb0d5a6f^{commit} d02d2129641d6cd22492ddc85e11d112eb0d5a6f already have revision, skipping fetch # git checkout -q -f -B kisskb d02d2129641d6cd22492ddc85e11d112eb0d5a6f # git clean -qxdf # < git log -1 # commit d02d2129641d6cd22492ddc85e11d112eb0d5a6f # Author: Russell Currey # Date: Fri Mar 1 01:49:17 2019 +1100 # # powerpc/64s: Implement KUAP for Radix MMU # # Kernel Userspace Access Prevention utilises a feature of the Radix MMU # which disallows read and write access to userspace addresses. By # utilising this, the kernel is prevented from accessing user data from # outside of trusted paths that perform proper safety checks, such as # copy_{to/from}_user() and friends. # # Userspace access is disabled from early boot and is only enabled when # performing an operation like copy_{to/from}_user(). The register that # controls this (AMR) does not prevent userspace from accessing itself, # so there is no need to save and restore when entering and exiting # userspace. # # This feature has a slight performance impact which I roughly measured # to be 3% slower in the worst case (performing 1GB of 1 byte # read()/write() syscalls), and is gated behind the CONFIG_PPC_KUAP # option for performance-critical builds. # # This feature can be tested by using the lkdtm driver (CONFIG_LKDTM=y) # and performing the following: # # # (echo ACCESS_USERSPACE) > [debugfs]/provoke-crash/DIRECT # # If enabled, this should send SIGSEGV to the thread. # # mpe: Drop the unused paca flags. Zero the UAMOR to be safe. Save the # AMR when we enter the kernel from the kernel and then lock it again. # Restore on the way back to the kernel. This means we handle nesting of # interrupts properly, ie. we are protected inside the page fault # handler caused by a user access. Add paranoid checking of AMR in # switch and syscall return. Add an isync() to prevent_user_access() # # Signed-off-by: Russell Currey # Signed-off-by: Michael Ellerman # < /opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux-gcc --version # < /opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux-ld --version # < git log --format=%s --max-count=1 d02d2129641d6cd22492ddc85e11d112eb0d5a6f # < make -s -j 80 ARCH=powerpc O=/kisskb/build/powerpc-next_mpc85xx_smp_defconfig_powerpc-gcc5 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux- mpc85xx_smp_defconfig # make -s -j 80 ARCH=powerpc O=/kisskb/build/powerpc-next_mpc85xx_smp_defconfig_powerpc-gcc5 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux- In file included from /kisskb/src/include/linux/kernel.h:10:0, from /kisskb/src/include/linux/list.h:9, from /kisskb/src/include/linux/module.h:9, from /kisskb/src/drivers/net/ethernet/freescale/fs_enet/mac-scc.c:15: /kisskb/src/drivers/net/ethernet/freescale/fs_enet/mac-scc.c: In function 'allocate_bd': /kisskb/src/include/linux/err.h:22:49: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] #define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO) ^ /kisskb/src/include/linux/compiler.h:77:42: note: in definition of macro 'unlikely' # define unlikely(x) __builtin_expect(!!(x), 0) ^ /kisskb/src/drivers/net/ethernet/freescale/fs_enet/mac-scc.c:139:6: note: in expansion of macro 'IS_ERR_VALUE' if (IS_ERR_VALUE(fep->ring_mem_addr)) ^ /kisskb/src/arch/powerpc/boot/dts/fsl/mpc8541cds.dts:334.3-21: Warning (pci_device_bus_num): /pci@e0008000/i8259@19000:bus-range: PCI bus number 1 out of range, expected (0 - 0) /kisskb/src/arch/powerpc/boot/dts/fsl/mpc8555cds.dts:334.3-21: Warning (pci_device_bus_num): /pci@e0008000/i8259@19000:bus-range: PCI bus number 1 out of range, expected (0 - 0) INFO: Uncompressed kernel (size 0xc2770c) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc2770c) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc2770c) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc2770c) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc2770c) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc2770c) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc2770c) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc2770c) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc2770c) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc2770c) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc2770c) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc2770c) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc2770c) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc2770c) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc2770c) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) INFO: Uncompressed kernel (size 0xc16ed8) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xd00000) Image Name: Linux-5.0.0-rc2-gd02d2129641d Created: Fri Mar 1 03:01:02 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6009273 Bytes = 5868.43 KiB = 5.73 MiB Load Address: 00d00000 Entry Point: 00d002a4 Image Name: Linux-5.0.0-rc2-gd02d2129641d Created: Fri Mar 1 03:01:02 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5978960 Bytes = 5838.83 KiB = 5.70 MiB Load Address: 00000000 Entry Point: 00000000 Image Name: Linux-5.0.0-rc2-gd02d2129641d Created: Fri Mar 1 03:01:02 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6009065 Bytes = 5868.23 KiB = 5.73 MiB Load Address: 00d00000 Entry Point: 00d002a4 Image Name: Linux-5.0.0-rc2-gd02d2129641d Created: Fri Mar 1 03:01:03 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6009276 Bytes = 5868.43 KiB = 5.73 MiB Load Address: 00d00000 Entry Point: 00d002a4 Image Name: Linux-5.0.0-rc2-gd02d2129641d Created: Fri Mar 1 03:01:03 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6008305 Bytes = 5867.49 KiB = 5.73 MiB Load Address: 00d00000 Entry Point: 00d002a4 Image Name: Linux-5.0.0-rc2-gd02d2129641d Created: Fri Mar 1 03:01:03 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6009015 Bytes = 5868.18 KiB = 5.73 MiB Load Address: 00d00000 Entry Point: 00d002a4 Image Name: Linux-5.0.0-rc2-gd02d2129641d Created: Fri Mar 1 03:01:03 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6008352 Bytes = 5867.53 KiB = 5.73 MiB Load Address: 00d00000 Entry Point: 00d00314 Image Name: Linux-5.0.0-rc2-gd02d2129641d Created: Fri Mar 1 03:01:03 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6009462 Bytes = 5868.62 KiB = 5.73 MiB Load Address: 00d00000 Entry Point: 00d002a4 Image Name: Linux-5.0.0-rc2-gd02d2129641d Created: Fri Mar 1 03:01:03 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6009451 Bytes = 5868.60 KiB = 5.73 MiB Load Address: 00d00000 Entry Point: 00d00314 Image Name: Linux-5.0.0-rc2-gd02d2129641d Created: Fri Mar 1 03:01:03 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6009012 Bytes = 5868.18 KiB = 5.73 MiB Load Address: 00d00000 Entry Point: 00d002a4 Image Name: Linux-5.0.0-rc2-gd02d2129641d Created: Fri Mar 1 03:01:03 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6008320 Bytes = 5867.50 KiB = 5.73 MiB Load Address: 00d00000 Entry Point: 00d00314 Image Name: Linux-5.0.0-rc2-gd02d2129641d Created: Fri Mar 1 03:01:03 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6008322 Bytes = 5867.50 KiB = 5.73 MiB Load Address: 00d00000 Entry Point: 00d00314 Image Name: Linux-5.0.0-rc2-gd02d2129641d Created: Fri Mar 1 03:01:03 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6009554 Bytes = 5868.71 KiB = 5.73 MiB Load Address: 00d00000 Entry Point: 00d002a4 Image Name: Linux-5.0.0-rc2-gd02d2129641d Created: Fri Mar 1 03:01:03 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6008338 Bytes = 5867.52 KiB = 5.73 MiB Load Address: 00d00000 Entry Point: 00d002a4 Image Name: Linux-5.0.0-rc2-gd02d2129641d Created: Fri Mar 1 03:01:03 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6009472 Bytes = 5868.62 KiB = 5.73 MiB Load Address: 00d00000 Entry Point: 00d002a4 Image Name: Linux-5.0.0-rc2-gd02d2129641d Created: Fri Mar 1 03:01:03 2019 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 6009501 Bytes = 5868.65 KiB = 5.73 MiB Load Address: 00d00000 Entry Point: 00d00314 Completed OK # rm -rf /kisskb/build/powerpc-next_mpc85xx_smp_defconfig_powerpc-gcc5 # Build took: 0:02:09.013675