linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marco Elver <elver@google.com>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>,
	Borislav Petkov <bp@alien8.de>, Rong Chen <rong.a.chen@intel.com>,
	kernel test robot <lkp@intel.com>,
	"Li, Philip" <philip.li@intel.com>, x86-ml <x86@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	clang-built-linux <clang-built-linux@googlegroups.com>,
	kasan-dev <kasan-dev@googlegroups.com>,
	Ilie Halip <ilie.halip@gmail.com>
Subject: Re: [tip:x86/seves] BUILD SUCCESS WITH WARNING e6eb15c9ba3165698488ae5c34920eea20eaa38e
Date: Wed, 16 Sep 2020 10:59:01 +0200	[thread overview]
Message-ID: <CANpmjNPa8FuTURfO0btWir4ax7jBy79P5x7Z5h08e-Ybea1Fnw@mail.gmail.com> (raw)
In-Reply-To: <CAKwvOdmptEpi8fiOyWUo=AiZJiX+Z+VHJOM2buLPrWsMTwLnyw@mail.gmail.com>

On Wed, 16 Sep 2020 at 00:34, Nick Desaulniers <ndesaulniers@google.com> wrote:
> On Tue, Sep 15, 2020 at 2:02 PM Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> >
> > panic() is noreturn, so the compiler is enforcing the fact that it
> > doesn't return, by trapping if it does return.
> >
> > I seem to remember that's caused by CONFIG_UBSAN_TRAP.
>
> Indeed, if I remove CONFIG_UBSAN_TRAP from the 0day report's
> randconfig, these unreachable instruction warnings all go away.
>
> So what's the right way to fix this?
>
> CONFIG_UBSAN_TRAP enables -fsanitize-undefined-trap-on-error  (not
> sure why that's wrapped in cc-option; it shouldn't be selectable via
> Kconfig if unsupported by the toolchain).
>
> Should clang not be emitting `ud2` trapping instructions for this flag
> for no-return functions?

I think this would defeat the purpose of this UBSAN feature. Certain
UBSAN checks are done fully statically, like is done by
fsanitize=unreachable, and could actually be enabled in production
kernels; trapping the kernel in these cases would be a reasonable way
to avoid further damage to the system.

(You could in theory force it to not emit a trap by using
fno-sanitize-trap=unreachable, but I think it's a bad idea.)

> or
>
> Should objtool be made aware of the config option and then not check
> traps after no-returns?

I'd vote for this. And it seems Ilie implemented this already.

> I suspect the latter, but I'm not sure how feasible it is to
> implement.  Josh, Marco, do you have thoughts on the above?

Thanks,
-- Marco

  parent reply	other threads:[~2020-09-16  8:59 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-15 13:42 [tip:x86/seves] BUILD SUCCESS WITH WARNING e6eb15c9ba3165698488ae5c34920eea20eaa38e kernel test robot
2020-09-15 13:55 ` Borislav Petkov
2020-09-15 14:18   ` Rong Chen
2020-09-15 14:41     ` Borislav Petkov
2020-09-15 16:05     ` Borislav Petkov
2020-09-15 17:02       ` Josh Poimboeuf
2020-09-15 17:21         ` Borislav Petkov
2020-09-15 17:34           ` Borislav Petkov
2020-09-15 17:41             ` Nick Desaulniers
2020-09-15 18:01               ` Borislav Petkov
2020-09-15 18:04                 ` Nick Desaulniers
2020-09-15 17:40           ` Nick Desaulniers
2020-09-15 18:09             ` Marco Elver
2020-09-16  8:30               ` peterz
2020-09-16  8:46                 ` Marco Elver
2020-09-16  9:06                   ` peterz
2020-09-16  9:33                     ` Marco Elver
2020-09-16 18:22                   ` Nick Desaulniers
2020-09-16 18:51                     ` Marco Elver
2020-09-17  4:11                       ` Fangrui Song
     [not found]                       ` <333D40A0-4550-4309-9693-1ABA4AC75399@arm.com>
2020-09-17 11:04                         ` Mark Rutland
2020-09-17 11:16                           ` Daniel Kiss
2020-09-17 18:39                     ` Josh Poimboeuf
2020-09-15 17:44         ` Nick Desaulniers
2020-09-15 20:12         ` Nick Desaulniers
2020-09-15 20:49           ` Borislav Petkov
2020-09-15 21:02             ` Josh Poimboeuf
2020-09-15 21:14               ` Borislav Petkov
2020-09-15 22:34               ` Nick Desaulniers
2020-09-16  7:03                 ` Ilie Halip
2020-09-16  8:59                 ` Marco Elver [this message]
2020-09-21 16:51                 ` [tip: objtool/core] objtool: Ignore unreachable trap after call to noreturn functions tip-bot2 for Ilie Halip
2020-09-15 21:50             ` [tip:x86/seves] BUILD SUCCESS WITH WARNING e6eb15c9ba3165698488ae5c34920eea20eaa38e Arvind Sankar
2020-09-15 21:59               ` Nick Desaulniers
2020-09-15 22:44                 ` Arvind Sankar
2020-09-16 11:34               ` Borislav Petkov
2020-09-16 18:28                 ` Nick Desaulniers
2020-09-16 18:48                   ` Borislav Petkov
2020-09-15 21:13           ` Nick Desaulniers
2020-09-15 21:28             ` Josh Poimboeuf
2020-09-15 23:35               ` Marco Elver

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=CANpmjNPa8FuTURfO0btWir4ax7jBy79P5x7Z5h08e-Ybea1Fnw@mail.gmail.com \
    --to=elver@google.com \
    --cc=bp@alien8.de \
    --cc=clang-built-linux@googlegroups.com \
    --cc=ilie.halip@gmail.com \
    --cc=jpoimboe@redhat.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=ndesaulniers@google.com \
    --cc=philip.li@intel.com \
    --cc=rong.a.chen@intel.com \
    --cc=x86@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).