All of lore.kernel.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: Benjamin Herrenschmidt <benh@au1.ibm.com>
Cc: Gabriel Paubert <paubert@iram.es>,
	paulus@samba.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc: Avoid panic during boot due to divide by zero in init_cache_info()
Date: Sun, 5 Mar 2017 18:10:47 -0600	[thread overview]
Message-ID: <20170306001047.GO31469@gate.crashing.org> (raw)
In-Reply-To: <1488755341.2870.117.camel@au1.ibm.com>

On Mon, Mar 06, 2017 at 10:09:01AM +1100, Benjamin Herrenschmidt wrote:
> > The compiler can do whatever it likes with code that has undefined
> > behaviour.  With this optimisation it a) can compile the conforming
> > code to something better; and b) undefined behaviour will trap instead
> > of doing something random (which often is exploitable).
> 
> I actually like that feature,

Yeah, me too -- it also (currently) makes *smaller* code than it would
without it.  Win-win-win.

> except it did bite me once or twice in the past
> adding traps to intentional NULL dereferences ;-) Ah the joys of writing
> a firmware where you poke at stuff at fixed addresses in low memory :-)

You cannot really have something at address 0, the way NULL pointers
are represented in GCC.  0 in firmware, so *fun*, especially before the
CFAR was invented.  "Something jumped to 0, CTR is 0 so it's probably
a BCTR, but which one of the 6000?"

What do you have at 0?  Not anything you need often I hope?


Segher

  reply	other threads:[~2017-03-06  0:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-04 23:54 [PATCH] powerpc: Avoid panic during boot due to divide by zero in init_cache_info() Anton Blanchard
2017-03-05  0:25 ` Benjamin Herrenschmidt
2017-03-05  0:27   ` Benjamin Herrenschmidt
2017-03-05 10:26 ` Michael Ellerman
2017-03-05 12:37   ` Segher Boessenkool
2017-03-05 16:58     ` Gabriel Paubert
2017-03-05 17:24       ` Segher Boessenkool
2017-03-05 23:09         ` Benjamin Herrenschmidt
2017-03-06  0:10           ` Segher Boessenkool [this message]
2017-03-06  0:20             ` Benjamin Herrenschmidt
2017-03-06 12:03         ` Gabriel Paubert
2017-03-06 14:17           ` Segher Boessenkool
2017-03-06 15:18             ` David Laight
2017-03-05 10:36 ` Michael Ellerman
2017-03-08  7:25 ` Michael Ellerman

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=20170306001047.GO31469@gate.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=benh@au1.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paubert@iram.es \
    --cc=paulus@samba.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.