Re: [lock validator] inet6_destroy_sock(): soft-safe -> soft-unsafe lock dependency

From: Herbert Xu
Date: Tue Jan 31 2006 - 05:26:44 EST


On Sat, Jan 28, 2006 at 04:22:04PM +0100, Ingo Molnar wrote:
>
> ===========================================================
> [ BUG: soft-safe -> soft-unsafe lock dependency detected! ]
> -----------------------------------------------------------
> sshd/2853 [HC0[0]:SC0[1]:HE1:SE0] is trying to acquire:
> (&newsk->sk_dst_lock){+-}, at: [<c048f385>] inet6_destroy_sock+0x25/0x100
>
> and this task is already holding:
> (&((sk)->sk_lock.slock)){+-}, at: [<c0464832>] tcp_close+0x142/0x650
> which would create a new lock dependency:
> (&((sk)->sk_lock.slock)){+-} -> (&newsk->sk_dst_lock){+-}

OK, I believe this is a false positive. However, Dave should
double-check this.

tcp_close is only called from process context. The rule for sk_dst_lock
is that it must also only be obtained in process context. On the other
hand, it is true that sk_lock can be obtained in softirq context.

In this particular case, sk_dst_lock is obtained by tcp_close with
softirqs disabled. This is not a problem in itself since we're not
trying to get sk_dst_lock from a real softirq context (as opposed to
process context with softirq disabled).

I believe this warning comes about because the validator creates a
dependency between sk_lock and sk_dst_lock. It then infers from this
dependency that in softirq contexts where sk_lock is obtained the code
may also attempt to obtain sk_dst_lock.

This inference is where the validator errs. sk_dst_lock is never
(or should never be, and as far as I can see none of the traces show
it to do so) obtained in a real softirq context.

Cheers,
--
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/