Re: lockdep null-ptr-deref

From: Peter Zijlstra
Date: Fri Oct 02 2020 - 09:09:40 EST


On Fri, Oct 02, 2020 at 08:36:02PM +0800, Boqun Feng wrote:

> But what if f2() is called with interrupt disabled? Or f2() disables
> interrupt inside the function, like:
>
> void f2(...)
> {
> local_irq_disable();
> spin_lock(&B);
> g(...);
> ...
> local_irq_enable();
> }
>
> In this case, there wouldn't be any LOCK_ENABLED_*_READ usage for
> rwlock_t A. As a result, we won't see it in the lockdep splat.

Hurm, fair enough. So just to make sure, you're arguing for:

-#define LOCK_TRACE_STATES (XXX_LOCK_USAGE_STATES*4 + 1)
+#define LOCK_TRACE_STATES (XXX_LOCK_USAGE_STATES*4 + 2)

On top of my earlier patch, right?