objtool,x86: Fix uaccess PUSHF/POPF validation
[linux-2.6-microblaze.git] / tools / objtool / check.c
index 080a3d6..5e5388a 100644 (file)
@@ -666,7 +666,7 @@ static void add_ignores(struct objtool_file *file)
 static const char *uaccess_safe_builtin[] = {
        /* KASAN */
        "kasan_report",
-       "check_memory_region",
+       "kasan_check_range",
        /* KASAN out-of-line */
        "__asan_loadN_noabort",
        "__asan_load1_noabort",
@@ -2084,6 +2084,20 @@ static int update_cfi_state(struct instruction *insn, struct cfi_state *cfi,
                                }
                        }
 
+                       else if (op->dest.reg == CFI_SP &&
+                                cfi->vals[op->src.reg].base == CFI_SP_INDIRECT &&
+                                cfi->vals[op->src.reg].offset == cfa->offset) {
+
+                               /*
+                                * The same stack swizzle case 2) as above. But
+                                * because we can't change cfa->base, case 3)
+                                * will become a regular POP. Pretend we're a
+                                * PUSH so things don't go unbalanced.
+                                */
+                               cfi->stack_size += 8;
+                       }
+
+
                        break;
 
                case OP_SRC_ADD:
@@ -2428,6 +2442,9 @@ static int handle_insn_ops(struct instruction *insn, struct insn_state *state)
                if (update_cfi_state(insn, &state->cfi, op))
                        return 1;
 
+               if (!insn->alt_group)
+                       continue;
+
                if (op->dest.type == OP_DEST_PUSHF) {
                        if (!state->uaccess_stack) {
                                state->uaccess_stack = 1;