lkml.org 
[lkml]   [2020]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH v3.1 18a/26] objtool: Remove CFI save/restore special case
    Subject: objtool: Remove CFI save/restore special case
    From: Peter Zijlstra <peterz@infradead.org>
    Date: Wed Mar 25 12:58:16 CET 2020

    There is a special case in the UNWIND_HINT_RESTORE code. When, upon
    looking for the UNWIND_HINT_SAVE instruction to restore from, it finds
    the instruction hasn't been visited yet, it normally issues a WARN,
    except when this HINT_SAVE instruction is the first instruction of
    this branch.

    This special case is of dubious correctness and is certainly unused
    (verified with an allmodconfig build), the two sites that employ
    UNWIND_HINT_SAVE/RESTORE (sync_core() and ftrace_regs_caller()) have
    the SAVE on unconditional instructions at the start of the function.
    It is therefore impossible for the save_insn not to have been visited
    when we do hit the RESTORE.

    Remove this.

    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    ---
    tools/objtool/check.c | 15 ++-------------
    1 file changed, 2 insertions(+), 13 deletions(-)

    --- a/tools/objtool/check.c
    +++ b/tools/objtool/check.c
    @@ -2040,15 +2040,14 @@ static int validate_return(struct symbol
    * tools/objtool/Documentation/stack-validation.txt.
    */
    static int validate_branch(struct objtool_file *file, struct symbol *func,
    - struct instruction *first, struct insn_state state)
    + struct instruction *insn, struct insn_state state)
    {
    + struct instruction *next_insn;
    struct alternative *alt;
    - struct instruction *insn, *next_insn;
    struct section *sec;
    u8 visited;
    int ret;

    - insn = first;
    sec = insn->sec;

    if (insn->alt_group && list_empty(&insn->alts)) {
    @@ -2101,16 +2100,6 @@ static int validate_branch(struct objtoo
    }

    if (!save_insn->visited) {
    - /*
    - * Oops, no state to copy yet.
    - * Hopefully we can reach this
    - * instruction from another branch
    - * after the save insn has been
    - * visited.
    - */
    - if (insn == first)
    - return 0;
    -
    WARN_FUNC("objtool isn't smart enough to handle this CFI save/restore combo",
    sec, insn->offset);
    return 1;
    \
     
     \ /
      Last update: 2020-03-25 15:42    [W:4.280 / U:0.276 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site