lkml.org 
[lkml]   [2020]   [Mar]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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).

\
 
 \ /
  Last update: 2020-03-12 17:25    [W:0.322 / U:5.456 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site