[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200312162337.GU12561@hirez.programming.kicks-ass.net>
Date: Thu, 12 Mar 2020 17:23:37 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: tglx@...utronix.de, jpoimboe@...hat.com
Cc: linux-kernel@...r.kernel.org, x86@...nel.org,
Dan Carpenter <dan.carpenter@...cle.com>
Subject: Re: [RFC][PATCH 00/16] objtool: vmlinux.o and noinstr validation
On Thu, Mar 12, 2020 at 02:41:07PM +0100, Peter Zijlstra wrote:
> Hi all,
>
> These patches extend objtool to be able to run on vmlinux.o and validate
> Thomas's proposed noinstr annotation:
>
> https://lkml.kernel.org/r/20200310170951.87c29e9c1cfbddd93ccd92b3@kernel.org
>
> "That's why we want the sections and the annotation. If something calls
> out of a noinstr section into a regular text section and the call is not
> annotated at the call site, then objtool can complain and tell you. What
> Peter and I came up with looks like this:
>
> noinstr foo()
> do_protected(); <- Safe because in the noinstr section
> instr_begin(); <- Marks the begin of a safe region, ignored
> by objtool
> do_stuff(); <- All good
> instr_end(); <- End of the safe region. objtool starts
> looking again
> do_other_stuff(); <- Unsafe because do_other_stuff() is
> not protected
>
> and:
>
> noinstr do_protected()
> bar(); <- objtool will complain here
> "
>
> It should be accompanied by something like the below; which you'll find in a
> series by Thomas.
>
So one of the problem i've ran into while playing with this and Thomas'
patches is that it is 'difficult' to deal with indirect function calls.
objtool basically gives up instantly.
I know smatch has passes were it looks for function pointer assignments
and carries that forward into it's callchain generation. Doing something
like that for objtool is going to be 'fun'...
For now I've got limited success dodging a few instances with
__always_inline (which then results in the compiler resolving the
indirection).
Powered by blists - more mailing lists