# git rev-parse -q --verify a970174d7a1010cb29a5b0c9fa0626abdefcfcbe^{commit} a970174d7a1010cb29a5b0c9fa0626abdefcfcbe already have revision, skipping fetch # git checkout -q -f -B kisskb a970174d7a1010cb29a5b0c9fa0626abdefcfcbe # git clean -qxdf # < git log -1 # commit a970174d7a1010cb29a5b0c9fa0626abdefcfcbe # Author: Steven Rostedt (Google) # Date: Mon Oct 24 11:45:36 2022 -0400 # # x86/mm: Do not verify W^X at boot up # # Adding on the kernel command line "ftrace=function" triggered: # # CPA detected W^X violation: 8000000000000063 -> 0000000000000063 range: 0xffffffffc0013000 - 0xffffffffc0013fff PFN 10031b # WARNING: CPU: 0 PID: 0 at arch/x86/mm/pat/set_memory.c:609 # verify_rwx+0x61/0x6d # Call Trace: # __change_page_attr_set_clr+0x146/0x8a6 # change_page_attr_set_clr+0x135/0x268 # change_page_attr_clear.constprop.0+0x16/0x1c # set_memory_x+0x2c/0x32 # arch_ftrace_update_trampoline+0x218/0x2db # ftrace_update_trampoline+0x16/0xa1 # __register_ftrace_function+0x93/0xb2 # ftrace_startup+0x21/0xf0 # register_ftrace_function_nolock+0x26/0x40 # register_ftrace_function+0x4e/0x143 # function_trace_init+0x7d/0xc3 # tracer_init+0x23/0x2c # tracing_set_tracer+0x1d5/0x206 # register_tracer+0x1c0/0x1e4 # init_function_trace+0x90/0x96 # early_trace_init+0x25c/0x352 # start_kernel+0x424/0x6e4 # x86_64_start_reservations+0x24/0x2a # x86_64_start_kernel+0x8c/0x95 # secondary_startup_64_no_verify+0xe0/0xeb # # This is because at boot up, kernel text is writable, and there's no # reason to do tricks to updated it. But the verifier does not # distinguish updates at boot up and at run time, and causes a warning at # time of boot. # # Add a check for system_state == SYSTEM_BOOTING and allow it if that is # the case. # # [ These SYSTEM_BOOTING special cases are all pretty horrid, but the x86 # text_poke() code does some odd things at bootup, forcing this for now # - Linus ] # # Link: https://lore.kernel.org/r/20221024112730.180916b3@gandalf.local.home # Fixes: 652c5bf380ad0 ("x86/mm: Refuse W^X violations") # Signed-off-by: Steven Rostedt (Google) # Signed-off-by: Linus Torvalds # < /opt/cross/kisskb/korg/gcc-8.5.0-nolibc/x86_64-linux/bin/x86_64-linux-gcc --version # < /opt/cross/kisskb/korg/gcc-8.5.0-nolibc/x86_64-linux/bin/x86_64-linux-ld --version # < git log --format=%s --max-count=1 a970174d7a1010cb29a5b0c9fa0626abdefcfcbe # < make -s -j 160 ARCH=x86_64 O=/kisskb/build/linus_x86_64-allnoconfig_x86_64-gcc8 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-8.5.0-nolibc/x86_64-linux/bin/x86_64-linux- allnoconfig # < make -s -j 160 ARCH=x86_64 O=/kisskb/build/linus_x86_64-allnoconfig_x86_64-gcc8 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-8.5.0-nolibc/x86_64-linux/bin/x86_64-linux- help # make -s -j 160 ARCH=x86_64 O=/kisskb/build/linus_x86_64-allnoconfig_x86_64-gcc8 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-8.5.0-nolibc/x86_64-linux/bin/x86_64-linux- olddefconfig # make -s -j 160 ARCH=x86_64 O=/kisskb/build/linus_x86_64-allnoconfig_x86_64-gcc8 CROSS_COMPILE=/opt/cross/kisskb/korg/gcc-8.5.0-nolibc/x86_64-linux/bin/x86_64-linux- Completed OK # rm -rf /kisskb/build/linus_x86_64-allnoconfig_x86_64-gcc8 # Build took: 0:00:19.950073