Commit 13fbe991 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull objtool fix from Thomas Gleixner:
 "A single robustness fix for objtool to handle unbalanced CLAC
  invocations under all circumstances"

* 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  objtool: Improve UACCESS coverage
parents 88c50834 882a0db9
...@@ -1946,6 +1946,7 @@ static int validate_branch(struct objtool_file *file, struct symbol *func, ...@@ -1946,6 +1946,7 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
struct alternative *alt; struct alternative *alt;
struct instruction *insn, *next_insn; struct instruction *insn, *next_insn;
struct section *sec; struct section *sec;
u8 visited;
int ret; int ret;
insn = first; insn = first;
...@@ -1972,12 +1973,12 @@ static int validate_branch(struct objtool_file *file, struct symbol *func, ...@@ -1972,12 +1973,12 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
return 1; return 1;
} }
visited = 1 << state.uaccess;
if (insn->visited) { if (insn->visited) {
if (!insn->hint && !insn_state_match(insn, &state)) if (!insn->hint && !insn_state_match(insn, &state))
return 1; return 1;
/* If we were here with AC=0, but now have AC=1, go again */ if (insn->visited & visited)
if (insn->state.uaccess || !state.uaccess)
return 0; return 0;
} }
...@@ -2024,7 +2025,7 @@ static int validate_branch(struct objtool_file *file, struct symbol *func, ...@@ -2024,7 +2025,7 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
} else } else
insn->state = state; insn->state = state;
insn->visited = true; insn->visited |= visited;
if (!insn->ignore_alts) { if (!insn->ignore_alts) {
bool skip_orig = false; bool skip_orig = false;
......
...@@ -33,8 +33,9 @@ struct instruction { ...@@ -33,8 +33,9 @@ struct instruction {
unsigned int len; unsigned int len;
enum insn_type type; enum insn_type type;
unsigned long immediate; unsigned long immediate;
bool alt_group, visited, dead_end, ignore, hint, save, restore, ignore_alts; bool alt_group, dead_end, ignore, hint, save, restore, ignore_alts;
bool retpoline_safe; bool retpoline_safe;
u8 visited;
struct symbol *call_dest; struct symbol *call_dest;
struct instruction *jump_dest; struct instruction *jump_dest;
struct instruction *first_jump_src; struct instruction *first_jump_src;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment