lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180117141315.nk4cszdo4tw7zaxk@treble>
Date:   Wed, 17 Jan 2018 08:13:15 -0600
From:   Josh Poimboeuf <jpoimboe@...hat.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     David Woodhouse <dwmw2@...radead.org>,
        linux-kernel@...r.kernel.org, Dave Hansen <dave.hansen@...el.com>,
        Ashok Raj <ashok.raj@...el.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Tim Chen <tim.c.chen@...ux.intel.com>,
        Andy Lutomirski <luto@...nel.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Greg KH <gregkh@...uxfoundation.org>,
        Andrea Arcangeli <aarcange@...hat.com>,
        Andi Kleen <ak@...ux.intel.com>,
        Arjan Van De Ven <arjan.van.de.ven@...el.com>,
        Dan Williams <dan.j.williams@...el.com>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Jun Nakajima <jun.nakajima@...el.com>,
        Asit Mallick <asit.k.mallick@...el.com>
Subject: Re: [PATCH v2 11/10] objtool: Even more complex static block checks

On Wed, Jan 17, 2018 at 09:13:09AM +0100, Peter Zijlstra wrote:
> On Tue, Jan 16, 2018 at 09:12:32PM -0600, Josh Poimboeuf wrote:
> > On Tue, Jan 16, 2018 at 08:49:17PM +0100, Peter Zijlstra wrote:
> > > Subject: objtool: Even more complex static block checks
> > > From: Peter Zijlstra <peterz@...radead.org>
> > > Date: Tue Jan 16 20:17:01 CET 2018
> > > 
> > > I've observed GCC transform:
> > > 
> > >   f()
> > >   {
> > > 	  if (!static_branch_unlikely())
> > > 		  return;
> > > 
> > > 	  static_assert();
> > > 	  A;
> > >   }
> > > 
> > >   g()
> > >   {
> > > 	  f();
> > >   }
> > > 
> > > Into:
> > > 
> > >   f()
> > >   {
> > > 	  static_assert();
> > > 	  A;
> > >   }
> > > 
> > >   g()
> > >   {
> > > 	  if (static_branch_unlikely())
> > > 		  f();
> > >   }
> > > 
> > > Which results in the assertion landing at f+0. The transformation is
> > > valid and useful; it avoids a pointless CALL+RET sequence, so we'll
> > > have to teach objtool how to deal with this.
> > > 
> > > Do this by marking all CALL destinations with static_call when called
> > > from a static_block and non_static_call when called outside a
> > > static_block. This allows us to identify functions called exclusively
> > > from a static_block and start them with a static_block.
> > 
> > Ew... where'd you place the assertion to trigger this?
> 
> Its the patch I pastebin'ed you earlier, also see below.

Ah, I remembered you mentioning the problem, just forgot you showed me
the patch.

> > It's late and my brain has already clocked out, so I'll need to revisit
> > this tomorrow.  But now I'm wondering if my basic block idea would be a
> > better way to solve this.
> 
> I would think basic-blocks are inside functions, and this patch goes
> across functions, something you'd still need even if you had basic
> blocks.

Right, but I was thinking the patch would be a lot simpler with basic
blocks.

> Also, basic blocks are non-trivial because they can overlap.

Hm, I thought a basic block only has one entry point and one exit point.
How could they overlap?

-- 
Josh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ