[PATCH 2/7] genalloc: selftest

From
Matthew Wilcox <willy@infradead.org>
Date
2018-02-26 19:12:35
Also in
linux-mm, lkml
Reply to
Igor Stoppa, 2018-02-26
On Mon, Feb 26, 2018 at 08:00:26PM +0200, Igor Stoppa wrote:
On 26/02/18 19:46, J Freyensee wrote:
quoted
That's a good question.? Based upon those articles, 'yes'.? But it seems 
like a 'darned-if-you-do, darned-if-you-don't' question as couldn't you 
also corrupt a mounted filesystem by crashing the kernel, yes/no?
The idea is to do it very early in the boot phase, before early init,
when the kernel has not gotten even close to any storage device.
quoted
If you really want a system crash, maybe just do a panic() like 
filesystems also use?
ok, if that's a more acceptable way to halt the kernel, I do not mind.
panic() halts the kernel
BUG_ON() kills the thread
WARN_ON() just prints messages

Now, if we're at boot time and we're still executing code from the init
thread, killing init is equivalent to halting the kernel.

The question is, what is appropriate for test modules?  I would say
WARN_ON is not appropriate because people ignore warnings.  BUG_ON is
reasonable for development.  panic() is probably not.

Also, calling BUG_ON while holding a lock is not a good idea; if anything
needs to acquire that lock to shut down in a reasonable fashion, it's
going to hang.

And there's no need to do something like BUG_ON(!foo); foo->wibble = 1;
Dereferencing a NULL pointer already produces a nice informative splat.
In general, we assume other parts of the kernel are sane and if they pass
us a NULL pool, it's no good returning -EINVAL, we may as well just oops
and let somebody else debug it.
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Thread (32 messages) 32 messages, 4 authors, last reply 2018-03-06
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help