Re: [PATCH] ARM: Convert BUG() to use unreachable()

Jamie Lokier
2009-12-17T19:38:42Z

Joe Buck wrote:
> On Thu, Dec 17, 2009 at 11:06:13AM -0800, Russell King - ARM Linux wrote:
> > On Thu, Dec 17, 2009 at 10:35:17AM -0800, Joe Buck wrote:
> > > Besides, didn't I see a whole bunch of kernel security patches related
> > > to null pointer dereferences lately? If page 0 can be mapped, you
> > > suddenly won't get your trap.
> >
> > Page 0 can not be mapped on ARM kernels since the late 1990s, and this
> > protection is independent of the generic kernel.
> >
> > Milage may vary on other architectures, but that's not a concern here.

It does not trap on at least one ARM-nommu kernel...

> I don't understand, though, why you would want to implement a generally
> useful facility (make the kernel trap so you can do a post-mortem
> analysis) in a way that's only safe for the ARM port.

The patch under discussion, which led to these questions and Cc
gcc@gcc.gnu.org, is specific to the ARM architecture and that is
Russell's focus, as ARM kernel maintainer.

But yes, the whole principle of how to trap and whether it's safe to
follow a null pointer dereference with __builtin_unreachable() applies
to all the other architectures too.

-- Jamie