lkml.org 
[lkml]   [2023]   [Sep]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[tip: x86/bugs] x86/alternatives: Remove faulty optimization
    The following commit has been merged into the x86/bugs branch of tip:

    Commit-ID: eae1a2bb7dd350195c18f1788f5d687684d8d92d
    Gitweb: https://git.kernel.org/tip/eae1a2bb7dd350195c18f1788f5d687684d8d92d
    Author: Josh Poimboeuf <jpoimboe@kernel.org>
    AuthorDate: Mon, 04 Sep 2023 22:04:54 -07:00
    Committer: Ingo Molnar <mingo@kernel.org>
    CommitterDate: Tue, 19 Sep 2023 11:42:47 +02:00

    x86/alternatives: Remove faulty optimization

    The following commit

    095b8303f383 ("x86/alternative: Make custom return thunk unconditional")

    made '__x86_return_thunk' a placeholder value. All code setting
    X86_FEATURE_RETHUNK also changes the value of 'x86_return_thunk'. So
    the optimization at the beginning of apply_returns() is dead code.

    Also, before the above-mentioned commit, the optimization actually had a
    bug It bypassed __static_call_fixup(), causing some raw returns to
    remain unpatched in static call trampolines. Thus the 'Fixes' tag.

    Fixes: d2408e043e72 ("x86/alternative: Optimize returns patching")
    Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Acked-by: Borislav Petkov (AMD) <bp@alien8.de>
    Link: https://lore.kernel.org/r/16d19d2249d4485d8380fb215ffaae81e6b8119e.1693889988.git.jpoimboe@kernel.org
    ---
    arch/x86/kernel/alternative.c | 8 --------
    1 file changed, 8 deletions(-)

    diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
    index a5ead6a..c850f5a 100644
    --- a/arch/x86/kernel/alternative.c
    +++ b/arch/x86/kernel/alternative.c
    @@ -720,14 +720,6 @@ void __init_or_module noinline apply_returns(s32 *start, s32 *end)
    {
    s32 *s;

    - /*
    - * Do not patch out the default return thunks if those needed are the
    - * ones generated by the compiler.
    - */
    - if (cpu_feature_enabled(X86_FEATURE_RETHUNK) &&
    - (x86_return_thunk == __x86_return_thunk))
    - return;
    -
    for (s = start; s < end; s++) {
    void *dest = NULL, *addr = (void *)s + *s;
    struct insn insn;
    \
     
     \ /
      Last update: 2023-09-19 13:23    [W:3.132 / U:0.384 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site