Merge branch 'linus' into objtool/core, to pick up Xen dependencies
[linux-block.git] / tools / objtool / check.c
index 7c40bd51c75a58c03bfd1141c213472a66ae1930..ba07a8ebaf7310c872c154594145e2205203e5f7 100644 (file)
@@ -186,6 +186,7 @@ static bool __dead_end_function(struct objtool_file *file, struct symbol *func,
                "snp_abort",
                "stop_this_cpu",
                "usercopy_abort",
+               "xen_cpu_bringup_again",
                "xen_start_kernel",
        };
 
@@ -376,6 +377,7 @@ static int decode_instructions(struct objtool_file *file)
 
                if (!strcmp(sec->name, ".noinstr.text") ||
                    !strcmp(sec->name, ".entry.text") ||
+                   !strcmp(sec->name, ".cpuidle.text") ||
                    !strncmp(sec->name, ".text.__x86.", 12))
                        sec->noinstr = true;
 
@@ -427,6 +429,15 @@ static int decode_instructions(struct objtool_file *file)
                        if (func->type != STT_NOTYPE && func->type != STT_FUNC)
                                continue;
 
+                       if (func->offset == sec->sh.sh_size) {
+                               /* Heuristic: likely an "end" symbol */
+                               if (func->type == STT_NOTYPE)
+                                       continue;
+                               WARN("%s(): STT_FUNC at end of section",
+                                    func->name);
+                               return -1;
+                       }
+
                        if (func->return_thunk || func->alias != func)
                                continue;
 
@@ -1224,6 +1235,7 @@ static const char *uaccess_safe_builtin[] = {
        "__ubsan_handle_type_mismatch",
        "__ubsan_handle_type_mismatch_v1",
        "__ubsan_handle_shift_out_of_bounds",
+       "__ubsan_handle_load_invalid_value",
        /* misc */
        "csum_partial_copy_generic",
        "copy_mc_fragile",
@@ -3374,6 +3386,12 @@ static inline bool noinstr_call_dest(struct objtool_file *file,
        if (func->sec->noinstr)
                return true;
 
+       /*
+        * If the symbol is a static_call trampoline, we can't tell.
+        */
+       if (func->static_call_tramp)
+               return true;
+
        /*
         * The __ubsan_handle_*() calls are like WARN(), they only happen when
         * something 'BAD' happened. At the risk of taking the machine down,
@@ -4171,6 +4189,12 @@ static int validate_noinstr_sections(struct objtool_file *file)
                warnings += validate_unwind_hints(file, sec);
        }
 
+       sec = find_section_by_name(file->elf, ".cpuidle.text");
+       if (sec) {
+               warnings += validate_section(file, sec);
+               warnings += validate_unwind_hints(file, sec);
+       }
+
        return warnings;
 }