powerpc: Rate-limit users spamming kernel log buffer
authorMichael Neuling <mikey@neuling.org>
Fri, 14 Mar 2014 06:03:58 +0000 (17:03 +1100)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Sun, 23 Mar 2014 22:48:34 +0000 (09:48 +1100)
The facility unavailable exception can be triggered from userspace by
accessing PMU registers when EBB is not enabled.  This causes the
included pr_err() to run, hence spamming the kernel log buffer.

This avoids this by rate limiting these messages.

Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/kernel/traps.c

index 33cd7a0b8e730b1d22583ab304821a2d1d203cc2..df86f0ce2d360340593548c61e1394a652df3d90 100644 (file)
@@ -1379,8 +1379,9 @@ void facility_unavailable_exception(struct pt_regs *regs)
        if (!arch_irq_disabled_regs(regs))
                local_irq_enable();
 
-       pr_err("%sFacility '%s' unavailable, exception at 0x%lx, MSR=%lx\n",
-              hv ? "Hypervisor " : "", facility, regs->nip, regs->msr);
+       pr_err_ratelimited(
+               "%sFacility '%s' unavailable, exception at 0x%lx, MSR=%lx\n",
+               hv ? "Hypervisor " : "", facility, regs->nip, regs->msr);
 
        if (user_mode(regs)) {
                _exception(SIGILL, regs, ILL_ILLOPC, regs->nip);