Re: [RFC] kernel/panic: place an upper limit on number of oopses
From: Jann Horn
Date: Tue Jan 12 2016 - 18:51:27 EST
On Wed, Jan 13, 2016 at 10:34:39AM +1100, Daniel Axtens wrote:
> Jann Horn <jann@xxxxxxxxx> writes:
> > + * limit is reached, just panic.
> > + * The constant used as limit should be low enough to
> > + * mitigate this kind of exploitation attempt, but high
> > + * enough to avoid unnecessary panics.
> > + */
> > + if (atomic_inc_return(&oops_counter) >= 0x100000 &&
> > + panic_on_oops == 0) {
> Do you need to check panic_on_oops? If it was 1 you'd already have
> paniced, right?
[...]
> > + pr_emerg("oopsed too often, setting panic_on_oops=1\n");
> > + panic_on_oops = 1;
> Would it be easier to just panic here, rather than wait for another oops?
Ah, yes. So the code would be just this, apart from the definition of
oops_counter:
if (atomic_inc_return(&oops_counter) >= 0x100000)
panic("oopsed too often\n");
Attachment:
signature.asc
Description: Digital signature