# git rev-parse -q --verify 8734b41b3efe0fc6082c1937b0e88556c396dc96^{commit} 8734b41b3efe0fc6082c1937b0e88556c396dc96 already have revision, skipping fetch # git checkout -q -f -B kisskb 8734b41b3efe0fc6082c1937b0e88556c396dc96 # git clean -qxdf # < git log -1 # commit 8734b41b3efe0fc6082c1937b0e88556c396dc96 # Author: Russell Currey # Date: Tue Nov 23 18:15:20 2021 +1000 # # powerpc/module_64: Fix livepatching for RO modules # # Livepatching a loaded module involves applying relocations through # apply_relocate_add(), which attempts to write to read-only memory when # CONFIG_STRICT_MODULE_RWX=y. Work around this by performing these # writes through the text poke area by using patch_instruction(). # # R_PPC_REL24 is the only relocation type generated by the kpatch-build # userspace tool or klp-convert kernel tree that I observed applying a # relocation to a post-init module. # # A more comprehensive solution is planned, but using patch_instruction() # for R_PPC_REL24 on should serve as a sufficient fix. # # This does have a performance impact, I observed ~15% overhead in # module_load() on POWER8 bare metal with checksum verification off. # # Fixes: c35717c71e98 ("powerpc: Set ARCH_HAS_STRICT_MODULE_RWX") # Cc: stable@vger.kernel.org # v5.14+ # Reported-by: Joe Lawrence # Signed-off-by: Russell Currey # Tested-by: Joe Lawrence # [mpe: Check return codes from patch_instruction()] # Signed-off-by: Michael Ellerman # Link: https://lore.kernel.org/r/20211214121248.777249-1-mpe@ellerman.id.au # < /opt/cross/kisskb/korg/gcc-11.1.0-nolibc/x86_64-linux/bin/x86_64-linux-gcc --version # < /opt/cross/kisskb/korg/gcc-11.1.0-nolibc/x86_64-linux/bin/x86_64-linux-ld --version # < git log --format=%s --max-count=1 8734b41b3efe0fc6082c1937b0e88556c396dc96 # < make -s -j 80 ARCH=x86 O=/kisskb/build/powerpc-fixes_x86-allmodconfig_x86_64-gcc11 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-11.1.0-nolibc/x86_64-linux/bin/x86_64-linux- allmodconfig # Added to kconfig CONFIG_BUILD_DOCSRC=n # Added to kconfig CONFIG_MODULE_SIG=n # Added to kconfig CONFIG_SAMPLES=n # < make -s -j 80 ARCH=x86 O=/kisskb/build/powerpc-fixes_x86-allmodconfig_x86_64-gcc11 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-11.1.0-nolibc/x86_64-linux/bin/x86_64-linux- help # make -s -j 80 ARCH=x86 O=/kisskb/build/powerpc-fixes_x86-allmodconfig_x86_64-gcc11 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-11.1.0-nolibc/x86_64-linux/bin/x86_64-linux- olddefconfig # make -s -j 80 ARCH=x86 O=/kisskb/build/powerpc-fixes_x86-allmodconfig_x86_64-gcc11 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-11.1.0-nolibc/x86_64-linux/bin/x86_64-linux- vmlinux.o: warning: objtool: __do_fast_syscall_32()+0xa: call to stackleak_track_stack() leaves .noinstr.text section vmlinux.o: warning: objtool: do_syscall_64()+0x9: call to stackleak_track_stack() leaves .noinstr.text section vmlinux.o: warning: objtool: do_int80_syscall_32()+0x9: call to stackleak_track_stack() leaves .noinstr.text section vmlinux.o: warning: objtool: xen_get_debugreg()+0xb: call to HYPERVISOR_get_debugreg() leaves .noinstr.text section vmlinux.o: warning: objtool: xen_set_debugreg()+0x15: call to HYPERVISOR_set_debugreg.isra.0() leaves .noinstr.text section vmlinux.o: warning: objtool: exc_general_protection()+0x22: call to stackleak_track_stack() leaves .noinstr.text section vmlinux.o: warning: objtool: fixup_bad_iret()+0x20: call to stackleak_track_stack() leaves .noinstr.text section vmlinux.o: warning: objtool: mce_setup()+0x18: call to memset() leaves .noinstr.text section vmlinux.o: warning: objtool: do_machine_check()+0x27: call to stackleak_track_stack() leaves .noinstr.text section vmlinux.o: warning: objtool: .entry.text+0x10e6: call to stackleak_erase() leaves .noinstr.text section vmlinux.o: warning: objtool: .entry.text+0x143: call to stackleak_erase() leaves .noinstr.text section vmlinux.o: warning: objtool: .entry.text+0x17d9: call to stackleak_erase() leaves .noinstr.text section Completed OK # rm -rf /kisskb/build/powerpc-fixes_x86-allmodconfig_x86_64-gcc11 # Build took: 0:36:02.833519