lkml.org 
[lkml]   [2020]   [Mar]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 26/26] objtool: Add STT_NOTYPE noinstr validation
On Tue, Mar 24, 2020 at 04:31:39PM +0100, Peter Zijlstra wrote:
> Make sure to also check STT_NOTYPE symbols for noinstr violations.
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
> tools/objtool/check.c | 19 ++++++++++++++++++-
> 1 file changed, 18 insertions(+), 1 deletion(-)
>
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -2563,7 +2563,7 @@ static int validate_symbol(struct objtoo
> return 1;
> }
>
> - if (sym->pfunc != sym || sym->alias != sym)
> + if ((sym->type == STT_FUNC && sym->pfunc != sym) || sym->alias != sym)
> return 0;
>
> insn = find_insn(file, sec, sym->offset);
> @@ -2610,6 +2610,23 @@ static int validate_section(struct objto
> warnings += validate_symbol(file, sec, func, &state);
> }
>
> + if (state.noinstr) {
> + /*
> + * In vmlinux mode we will not run validate_unwind_hints() by
> + * default which means we'll not otherwise visit STT_NOTYPE
> + * symbols.
> + *
> + * In case of --duplicate mode, insn->visited will avoid actual
> + * duplicate work being done.
> + */
> + list_for_each_entry(func, &sec->symbol_list, list) {
> + if (func->type != STT_NOTYPE)
> + continue;
> +
> + warnings += validate_symbol(file, sec, func, &state);
> + }
> + }
> +

I guess this is ok, but is there a valid reason why we don't just call
validate_unwind_hints()?

It's also slightly concerning that validate_reachable_instructions()
isn't called, I'm not 100% convinced all the code will get checked.

--
Josh

\
 
 \ /
  Last update: 2020-03-24 23:18    [W:0.415 / U:19.740 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site