NetBSD Problem Report #55030

From christos@astron.com  Fri Feb 28 17:47:31 2020
Return-Path: <christos@astron.com>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 64A941A9213
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 28 Feb 2020 17:47:31 +0000 (UTC)
Message-Id: <20200228163145.9062C10756@quasar.astron.com>
Date: Fri, 28 Feb 2020 16:31:45 +0000 (UTC)
From: christos@netbsd.org
Reply-To: christos@astron.com
To: gnats-bugs@NetBSD.org
Subject: nd6_llinfo_timer causes locking against myself
X-Send-Pr-Version: 3.95

>Number:         55030
>Category:       kern
>Synopsis:       nd6_llinfo_timer causes locking against myself
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 28 17:50:00 +0000 2020
>Closed-Date:    Sun Jul 25 02:47:54 +0000 2021
>Last-Modified:  Sun Jul 25 02:47:54 +0000 2021
>Originator:     Christos Zoulas
>Release:        NetBSD 9.99.48
>Organization:
	Entropy Anonymous
>Environment:
System: NetBSD quasar.astron.com 9.99.48 NetBSD 9.99.48 (QUASAR) #76: Thu Feb 27 22:02:36 EST 2020 christos@quasar.astron.com:/usr/src/sys/arch/amd64/compile/QUASAR amd64
Architecture: x86_64
Machine: amd64
>Description:
path throu in6_lltable_lookup tries to lock lle entry locked by
nd6_llinfo_timer.
>How-To-Repeat:
Normal running of the network
>Fix:

Wait for timer processing to finish before taking the lock (blocking
on softint?) This seems to work so far...

Index: nd6.c
===================================================================
RCS file: /cvsroot/src/sys/netinet6/nd6.c,v
retrieving revision 1.267
diff -u -u -r1.267 nd6.c
--- nd6.c	9 Mar 2020 21:20:56 -0000	1.267
+++ nd6.c	22 Mar 2020 18:13:40 -0000
@@ -466,7 +466,11 @@

 	SOFTNET_KERNEL_LOCK_UNLESS_NET_MPSAFE();

-	LLE_WLOCK(ln);
+	LLE_RLOCK(ln);
+	if (!LLE_TRY_UPGRADE(ln)) {
+		LLE_RUNLOCK(ln);
+		goto out;
+	}
 	if ((ln->la_flags & LLE_LINKED) == 0)
 		goto out;
 	if (ln->ln_ntick > 0) {
Panic:
    https://www.zoulas.com/~christos/NetBSD/nd6.png

>Release-Note:

>Audit-Trail:

From: "Christos Zoulas" <christos@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/55030 CVS commit: src/sys/netinet6
Date: Fri, 3 Apr 2020 10:04:27 -0400

 Module Name:	src
 Committed By:	christos
 Date:		Fri Apr  3 14:04:27 UTC 2020

 Modified Files:
 	src/sys/netinet6: nd6.c

 Log Message:
 PR/55030: Avoid locking against myself panic by moving the icmp error outside
 the lock. Thanks ozaki-r!


 To generate a diff of this commit:
 cvs rdiff -u -r1.267 -r1.268 src/sys/netinet6/nd6.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->feedback
State-Changed-By: maya@NetBSD.org
State-Changed-When: Tue, 21 Apr 2020 16:32:52 +0000
State-Changed-Why:
Do you believe this fix is satisfactory? 


State-Changed-From-To: feedback->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 25 Jul 2021 02:47:54 +0000
State-Changed-Why:
feedback timeout, fixed a year ago


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.