public inbox for [email protected]
 help / color / mirror / Atom feed
From: Linus Torvalds <[email protected]>
To: Nick Desaulniers <[email protected]>
Cc: Kees Cook <[email protected]>,
	Sudip Mukherjee <[email protected]>,
	Nathan Chancellor <[email protected]>, Tom Rix <[email protected]>,
	Marco Elver <[email protected]>,
	Andrew Morton <[email protected]>,
	Josh Poimboeuf <[email protected]>,
	"Peter Zijlstra (Intel)" <[email protected]>,
	Linux Kernel Mailing List <[email protected]>,
	clang-built-linux <[email protected]>,
	Alexander Potapenko <[email protected]>
Subject: Re: [PATCH] ubsan: disable UBSAN_DIV_ZERO for clang
Date: Thu, 14 Jul 2022 14:48:37 -0700	[thread overview]
Message-ID: <CAHk-=whs05rO37wjdTOgppP-N+mYy70Q2ctBrp6vMoUP=OtcVA@mail.gmail.com> (raw)
In-Reply-To: <CAKwvOd=PB9Kpbnf3y0e5u6LrZ=Lv2Ex8O7y=VY63D67Jf2eyHQ@mail.gmail.com>

On Thu, Jul 14, 2022 at 2:38 PM Nick Desaulniers
<[email protected]> wrote:
>
> int do_div (int dividend, int divisor) {
>   return dividend / divisor;
> }
>
> has UB should divisor ever be zero, not much different from:

So?

What about the million other '/' in the kernel?

Adding one check to 'do_div()' is just stupid. It's like using a
bottle-cap as an umbrella.

Nick, that's the whole _point_ of having compiler support for things
like this - automation. Because doing them manually one at a time is
just completely broken and stupid.

                Linus


  reply	other threads:[~2022-07-14 21:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14 20:56 [PATCH] ubsan: disable UBSAN_DIV_ZERO for clang Nick Desaulniers
2022-07-14 21:24 ` Linus Torvalds
2022-07-14 21:38   ` Nick Desaulniers
2022-07-14 21:48     ` Linus Torvalds [this message]
2022-07-14 21:24 ` Nathan Chancellor
2022-07-14 23:15 ` Linus Torvalds

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='CAHk-=whs05rO37wjdTOgppP-N+mYy70Q2ctBrp6vMoUP=OtcVA@mail.gmail.com' \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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