[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200324222406.zg6hylzqux353jhq@treble>
Date: Tue, 24 Mar 2020 17:24:06 -0500
From: Josh Poimboeuf <jpoimboe@...hat.com>
To: Kees Cook <keescook@...omium.org>
Cc: Peter Zijlstra <peterz@...radead.org>,
Randy Dunlap <rdunlap@...radead.org>,
Stephen Rothwell <sfr@...b.auug.org.au>,
Linux Next Mailing List <linux-next@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: linux-next: Tree for Mar 18 (objtool)
On Tue, Mar 24, 2020 at 11:18:07AM -0700, Kees Cook wrote:
> 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
So it sounds like this would replace the second UD2 with a "call
some_ubsan_function()"?
That might be slightly better, though it would still need an objtool
change to ignore unreachable warnings for such calls.
In the meantime I can still change objtool to ignore unreachable UD2s if
there aren't any better ideas.
--
Josh
Powered by blists - more mailing lists