# 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 120 ARCH=powerpc O=/kisskb/build/powerpc-next_ppc64e_defconfig+KEXEC_powerpc-gcc5 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux- ppc64e_defconfig # Added to kconfig CONFIG_KEXEC=y # yes \n | make -s -j 120 ARCH=powerpc O=/kisskb/build/powerpc-next_ppc64e_defconfig+KEXEC_powerpc-gcc5 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux- oldconfig yes: standard output: Broken pipe # make -s -j 120 ARCH=powerpc O=/kisskb/build/powerpc-next_ppc64e_defconfig+KEXEC_powerpc-gcc5 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux- /kisskb/src/arch/powerpc/kernel/entry_64.S: Assembler messages: /kisskb/src/arch/powerpc/kernel/entry_64.S:279: Error: unrecognized opcode: `kuap_check_amr' /kisskb/src/arch/powerpc/kernel/entry_64.S:317: Error: unrecognized opcode: `kuap_restore_amr' /kisskb/src/arch/powerpc/kernel/entry_64.S:606: Error: unrecognized opcode: `kuap_check_amr' make[3]: *** [/kisskb/src/scripts/Makefile.build:367: arch/powerpc/kernel/entry_64.o] Error 1 make[3]: *** Waiting for unfinished jobs.... make[2]: *** [/kisskb/src/scripts/Makefile.build:492: arch/powerpc/kernel] Error 2 make[1]: *** [/kisskb/src/Makefile:1042: arch/powerpc] Error 2 make[1]: *** Waiting for unfinished jobs.... make: *** [Makefile:152: sub-make] Error 2 Command 'make -s -j 120 ARCH=powerpc O=/kisskb/build/powerpc-next_ppc64e_defconfig+KEXEC_powerpc-gcc5 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-5.5.0-nolibc/powerpc64-linux/bin/powerpc64-linux- ' returned non-zero exit status 2 # rm -rf /kisskb/build/powerpc-next_ppc64e_defconfig+KEXEC_powerpc-gcc5 # Build took: 0:00:48.786223