Re: [PATCH v2 03/10] x86: assembly, use SYM_FUNC_END for functions

From: Ingo Molnar
Date: Wed Mar 22 2017 - 03:33:20 EST



* Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:

> On Mon, Mar 20, 2017 at 01:32:15PM +0100, Jiri Slaby wrote:
> > ENTRY(ftrace_caller)
> > /* save_mcount_regs fills in first two parameters */
> > @@ -184,11 +184,12 @@ GLOBAL(ftrace_epilogue)
> > GLOBAL(ftrace_graph_call)
> > jmp ftrace_stub
> > #endif
> > +SYM_FUNC_END(ftrace_caller)
> >
> > /* This is weak to keep gas from relaxing the jumps */
> > WEAK(ftrace_stub)
> > retq
> > -END(ftrace_caller)
> > +SYM_FUNC_END(ftrace_caller)
>
> This gives ftrace_caller() two ends.

Such errors too could be detected automatically via objtool or some other symbol
debug mechanism.

The reason it might be a good fit for objtool is to make the checking optional (no
need to burden a regular build with it), plus objtool already looks at the .o from
first principles - a symbol checking sub-functionality could analyze the symbol
names in the same pass.

If we want to complicate things with CFI then we absolutely should increase the
quality of our symbol names space.

Thanks,

Ingo