linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Linux Next Mailing List <linux-next@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: linux-next: Tree for Mar 18 (objtool)
Date: Tue, 24 Mar 2020 11:18:07 -0700	[thread overview]
Message-ID: <202003241105.4707F983@keescook> (raw)
In-Reply-To: <20200324164433.qusyu5h7ykx3f2bu@treble>

On Tue, Mar 24, 2020 at 11:44:33AM -0500, Josh Poimboeuf wrote:
> On Fri, Mar 20, 2020 at 11:35:37AM -0700, Kees Cook wrote:
> > On Fri, Mar 20, 2020 at 09:26:13AM +0100, Peter Zijlstra wrote:
> > > On Thu, Mar 19, 2020 at 12:45:50PM -0500, Josh Poimboeuf wrote:
> > > > > On Thu, Mar 19, 2020 at 12:33:31PM -0500, Josh Poimboeuf wrote:
> > > 
> > > > > > Actually I suspect it's the __builtin_unreachable() annotation which is
> > > > > > making UBSAN add the __builtin_trap()...  because I don't see any double
> > > > > > UD2s for WARNs.
> > > 
> > > > Actually, removing __builtin_unreachable() *does* make the extra UD2 go
> > > > away -- I forgot I had some silly debug code.
> > > 
> > > LOL, check this:
> > > 
> > > "Built-in Function: void __builtin_unreachable (void)
> > > 
> > >     If control flow reaches the point of the __builtin_unreachable, the
> > >     program is undefined. It is useful in situations where the compiler
> > >     cannot deduce the unreachability of the code. "
> > > 
> > > Which, I bet, is what makes UBSAN insert that __builtin_trap().
> > > 
> > > What a friggin mess :/
> > 
> > What I'd like is to be able to specify to UBSAN what function to call
> > for the trap. I'd prefer to specify a well-defined exception handler,
> > but at present, UBSAN just inserts __builtin_trap().
> > 
> > Can't objtool be told to ignore a ud2 that lacks an execution path to it?
> 
> It can ignore unreachable UD2s, if we think that's the right fix.
> 
> I was hoping we could find a way to get rid of the double UD2s, but I
> couldn't figure out a way to do that when I looked at it last week.

As far as I could tell, this needs patches to the UBSAN support in gcc
and clang. I have opened bugs for each:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94307
https://bugs.llvm.org/show_bug.cgi?id=45295

-- 
Kees Cook

  reply	other threads:[~2020-03-24 18:18 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-18 11:09 linux-next: Tree for Mar 18 Stephen Rothwell
2020-03-18 16:14 ` linux-next: Tree for Mar 18 (drivers/base/power/sysfs.c) Randy Dunlap
2020-03-19  3:20   ` Stephen Rothwell
2020-03-19 14:47     ` [PATCH net-next] sysfs: fix static inline declaration of sysfs_groups_change_owner() Christian Brauner
2020-03-19 16:19       ` Randy Dunlap
2020-03-20  4:17       ` David Miller
2020-03-18 16:48 ` linux-next: Tree for Mar 18 (objtool) Randy Dunlap
2020-03-18 16:55   ` Josh Poimboeuf
2020-03-18 18:23   ` Josh Poimboeuf
2020-03-18 20:05     ` Peter Zijlstra
2020-03-19 11:12       ` Peter Zijlstra
2020-03-19 17:31       ` Josh Poimboeuf
2020-03-19 17:33         ` Josh Poimboeuf
2020-03-19 17:40           ` Josh Poimboeuf
2020-03-19 17:45             ` Josh Poimboeuf
2020-03-20  8:26               ` Peter Zijlstra
2020-03-20 18:35                 ` Kees Cook
2020-03-24 16:44                   ` Josh Poimboeuf
2020-03-24 18:18                     ` Kees Cook [this message]
2020-03-24 22:24                       ` Josh Poimboeuf
2020-03-26  5:57                         ` Kees Cook
2020-03-26 16:31                           ` Josh Poimboeuf
2020-03-26 18:36                             ` Kees Cook
2020-03-27  3:55                               ` Josh Poimboeuf

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=202003241105.4707F983@keescook \
    --to=keescook@chromium.org \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rdunlap@infradead.org \
    --cc=sfr@canb.auug.org.au \
    /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).