linux-toolchains.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Will Deacon <will@kernel.org>,
	Nick Desaulniers <ndesaulniers@google.com>,
	"Jose E. Marchesi" <jemarch@gnu.org>,
	"Paul E. McKenney" <paulmck@kernel.org>,
	ardb@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com,
	linux-toolchains@vger.kernel.org
Subject: Re: Linux Plumbers Conf 2021
Date: Tue, 18 May 2021 15:21:58 +0200	[thread overview]
Message-ID: <YKO/di4h3XGjqu68@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20210518124819.lkzzgjcrh4cc5a6i@treble>

On Tue, May 18, 2021 at 07:48:19AM -0500, Josh Poimboeuf wrote:
> Fixing linux-toolchains list address.
> 
> On Tue, May 18, 2021 at 07:43:13AM -0500, Josh Poimboeuf wrote:
> > On Tue, May 18, 2021 at 01:14:48PM +0100, Will Deacon wrote:
> > > If it's not too late, I'd definitely be interested in a discussion around
> > > objtool support for arm64. Specifically, I would very much like us _not_
> > > to have a hard dependency on objtool and instead treat it as a binary
> > > linter of sorts. However, this likely requires help from the toolchain
> > > where some of the jobs which are performed by objtool on x86 today now
> > > need to be done by the compiler/linker for arm64.
> > > 
> > > I don't have a good handle on exactly what is needed and whether there's
> > > any appetite from the toolchain developers to implement this, so it would
> > > be very helpful to kick that discussion off.
> > 
> > Objtool stack validation already is pretty much a "binary linter".  If
> > all the warnings are fixed then we can trust the unwind metadata (e.g.
> > frame pointers) for reliable unwinding / live patching.
> > 
> > All warnings are expected to be fixed by humans, so objtool doesn't have
> > to edit the binary (assuming no ORC, which is optional).  Objtool is
> > only considered a hard dependency for live patching because unfixed
> > warnings could mean a livepatch fail.
> > 
> > So I wonder what specifically you have in mind?

Things objtool does (in no apparent order):

 - validate stack frames

 - generate ORC unwind data (optional)

 - validates unreachable instructions; specifically the lack thereof
   (optional)

 - validates retpoline; or specifically the lack of indirect jump/call
   sites (with annotations for those few that are okay). (optional)

 - validates uaccess rules; specifically no call/ret in between
   __user_access_begin() and __user_access_end(). (optional)

 - validates noinstr annotation; *HOWEVER* we rely on objtool to NOP
   all __sanitizer_cov_* calls in .noinstr/.entry text sections because
   __no_sanitize_cov is 'broken' in all known compilers.

 - generates __mcount_loc section and NOPs the __fentry call sites
   (optional)

 - generates .static_call_sites section for STATIC_CALL_INLINE support

 - rewrites compiler generates call/jump to the retpoline thunk to an
   alternative such that we can patch out the thunk with an indirect
   call/jmp when retpolines are disabled. (arch dependent)

 - rewrites specific jmp.d8 sites (as found through the __jump_table
   section) to nop2, because GAS is unable to determine if a jmp becomes
   a jmp.d8 or jmp.d32 and emit the right sized nop. (optional)


So all except the __sanitize_cov__ crud would be fine, but that thing in
specific really wants fixing in the toolchains. Aside of that, all the
things where objtool generates/modifies sections/code are optional and
or architecture dependent.

Aside of that, objtool depends on being able to reconstruct the code
flow as generated by the compiler and a few code-gen options are known
to generate things objtool simply cannot follow, arm64 in specific had
some trouble with jump-tables.



  reply	other threads:[~2021-05-18 13:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAKwvOdm-Vb2BGRCmtYCh5JcGkM+XedzSMdNr8kQLbY4y_85EvA@mail.gmail.com>
     [not found] ` <20210518121447.GB7914@willie-the-truck>
     [not found]   ` <20210518124311.r4fwv6lfz3erkqnb@treble>
2021-05-18 12:48     ` Linux Plumbers Conf 2021 Josh Poimboeuf
2021-05-18 13:21       ` Peter Zijlstra [this message]
2021-05-18 16:57         ` Nick Desaulniers
2021-05-18 20:03           ` Peter Zijlstra
2021-05-18 20:15             ` Nick Desaulniers
2021-05-19  9:32             ` Mark Rutland
2021-05-19 10:19               ` Marco Elver
2021-05-19 11:56                 ` Mark Rutland
2021-05-19 14:04                   ` Marco Elver
2021-05-19 15:02                     ` Martin Liška
2021-05-19 15:05                       ` Marco Elver
2021-05-20  8:34                         ` Martin Liška
2021-06-16 23:01   ` Nick Desaulniers
2021-06-24 20:35     ` Nick Desaulniers
2021-06-24 20:37       ` Nick Desaulniers
2021-06-28 17:59         ` Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YKO/di4h3XGjqu68@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=ardb@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=jemarch@gnu.org \
    --cc=jpoimboe@redhat.com \
    --cc=linux-toolchains@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=ndesaulniers@google.com \
    --cc=paulmck@kernel.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).