lkml.org 
[lkml]   [2023]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v3 11/15] objtool: Remove too strict constraint in jump table search
    Date
    In code there is often a pattern like:

    load jump table address
    do some test
    conditional jump to label1:
    do something
    unconditional jump to label2:
    label1:
    do something else
    read jump table
    dynamic jump
    label2:
    do other job here ....

    find_jump_table() contains a constraint that stops the backsearch
    of the table address loading when a jump is found in-between.

    Remove that constraint.

    Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
    ---
    tools/objtool/check.c | 7 -------
    1 file changed, 7 deletions(-)

    diff --git a/tools/objtool/check.c b/tools/objtool/check.c
    index 05d789e6d3b6..c9f0fd31d146 100644
    --- a/tools/objtool/check.c
    +++ b/tools/objtool/check.c
    @@ -2067,13 +2067,6 @@ static struct reloc *find_jump_table(struct objtool_file *file,
    if (insn != orig_insn && insn->type == INSN_JUMP_DYNAMIC)
    break;

    - /* allow small jumps within the range */
    - if (insn->type == INSN_JUMP_UNCONDITIONAL &&
    - insn->jump_dest &&
    - (insn->jump_dest->offset <= insn->offset ||
    - insn->jump_dest->offset > orig_insn->offset))
    - break;
    -
    table_reloc = arch_find_switch_table(file, insn);
    if (!table_reloc)
    continue;
    --
    2.40.1
    \
     
     \ /
      Last update: 2023-06-23 19:07    [W:3.305 / U:0.188 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site