Module Name: src
Committed By: ozaki-r
Date: Wed Sep 25 09:53:38 UTC 2019
Modified Files:
src/sys/net: if.c if_llatbl.c link_proto.c route.c
src/sys/netinet: in.c
src/sys/netinet6: in6.c mld6.c nd6.c nd6_rtr.c
src/sys/netipsec: key.c
Log Message:
Make panic messages more informative
To generate a diff of this commit:
cvs rdiff -u -r1.461 -r1.462 src/sys/net/if.c
cvs rdiff -u -r1.30 -r1.31 src/sys/net/if_llatbl.c
cvs rdiff -u -r1.38 -r1.39 src/sys/net/link_proto.c
cvs rdiff -u -r1.222 -r1.223 src/sys/net/route.c
cvs rdiff -u -r1.234 -r1.235 src/sys/netinet/in.c
cvs rdiff -u -r1.275 -r1.276 src/sys/netinet6/in6.c
cvs rdiff -u -r1.100 -r1.101 src/sys/netinet6/mld6.c
cvs rdiff -u -r1.264 -r1.265 src/sys/netinet6/nd6.c
cvs rdiff -u -r1.145 -r1.146 src/sys/netinet6/nd6_rtr.c
cvs rdiff -u -r1.266 -r1.267 src/sys/netipsec/key.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.461 src/sys/net/if.c:1.462
--- src/sys/net/if.c:1.461 Thu Sep 19 06:07:24 2019
+++ src/sys/net/if.c Wed Sep 25 09:53:37 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.461 2019/09/19 06:07:24 knakahara Exp $ */
+/* $NetBSD: if.c,v 1.462 2019/09/25 09:53:37 ozaki-r Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.461 2019/09/19 06:07:24 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.462 2019/09/25 09:53:37 ozaki-r Exp $");
#if defined(_KERNEL_OPT)
#include "opt_inet.h"
@@ -1807,7 +1807,7 @@ void
ifafree(struct ifaddr *ifa)
{
KASSERT(ifa != NULL);
- KASSERT(ifa->ifa_refcnt > 0);
+ KASSERTMSG(ifa->ifa_refcnt > 0, "ifa_refcnt=%d", ifa->ifa_refcnt);
if (atomic_dec_uint_nv(&ifa->ifa_refcnt) == 0) {
free(ifa, M_IFADDR);
Index: src/sys/net/if_llatbl.c
diff -u src/sys/net/if_llatbl.c:1.30 src/sys/net/if_llatbl.c:1.31
--- src/sys/net/if_llatbl.c:1.30 Tue Jul 10 19:30:37 2018
+++ src/sys/net/if_llatbl.c Wed Sep 25 09:53:37 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if_llatbl.c,v 1.30 2018/07/10 19:30:37 kre Exp $ */
+/* $NetBSD: if_llatbl.c,v 1.31 2019/09/25 09:53:37 ozaki-r Exp $ */
/*
* Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved.
* Copyright (c) 2004-2008 Qing Li. All rights reserved.
@@ -239,7 +239,8 @@ htable_unlink_entry(struct llentry *lle)
lle->lle_tbl = NULL;
lle->lle_head = NULL;
#endif
- KASSERT(lle->lle_tbl->llt_lle_count != 0);
+ KASSERTMSG(lle->lle_tbl->llt_lle_count != 0,
+ "llt_lle_count=%u", lle->lle_tbl->llt_lle_count);
lle->lle_tbl->llt_lle_count--;
}
}
Index: src/sys/net/link_proto.c
diff -u src/sys/net/link_proto.c:1.38 src/sys/net/link_proto.c:1.39
--- src/sys/net/link_proto.c:1.38 Mon Apr 29 11:57:22 2019
+++ src/sys/net/link_proto.c Wed Sep 25 09:53:37 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: link_proto.c,v 1.38 2019/04/29 11:57:22 roy Exp $ */
+/* $NetBSD: link_proto.c,v 1.39 2019/09/25 09:53:37 ozaki-r Exp $ */
/*-
* Copyright (c) 1982, 1986, 1993
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.38 2019/04/29 11:57:22 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.39 2019/09/25 09:53:37 ozaki-r Exp $");
#include <sys/param.h>
#include <sys/socket.h>
@@ -220,7 +220,8 @@ link_control(struct socket *so, unsigned
ifaref(ifa);
ifa_release(ifa, &psref);
ifa_remove(ifp, ifa);
- KASSERT(ifa->ifa_refcnt == 1);
+ KASSERTMSG(ifa->ifa_refcnt == 1, "ifa_refcnt=%d",
+ ifa->ifa_refcnt);
ifafree(ifa);
ifa = NULL;
}
Index: src/sys/net/route.c
diff -u src/sys/net/route.c:1.222 src/sys/net/route.c:1.223
--- src/sys/net/route.c:1.222 Mon Sep 23 05:00:20 2019
+++ src/sys/net/route.c Wed Sep 25 09:53:37 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: route.c,v 1.222 2019/09/23 05:00:20 rin Exp $ */
+/* $NetBSD: route.c,v 1.223 2019/09/25 09:53:37 ozaki-r Exp $ */
/*-
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
#endif
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.222 2019/09/23 05:00:20 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.223 2019/09/25 09:53:37 ozaki-r Exp $");
#include <sys/param.h>
#ifdef RTFLUSH_DEBUG
@@ -621,7 +621,7 @@ static void
rt_ref(struct rtentry *rt)
{
- KASSERT(rt->rt_refcnt >= 0);
+ KASSERTMSG(rt->rt_refcnt >= 0, "rt_refcnt=%d", rt->rt_refcnt);
atomic_inc_uint(&rt->rt_refcnt);
}
@@ -725,7 +725,7 @@ void
rt_free(struct rtentry *rt)
{
- KASSERT(rt->rt_refcnt > 0);
+ KASSERTMSG(rt->rt_refcnt > 0, "rt_refcnt=%d", rt->rt_refcnt);
if (rt_wait_ok()) {
atomic_dec_uint(&rt->rt_refcnt);
_rt_free(rt);
Index: src/sys/netinet/in.c
diff -u src/sys/netinet/in.c:1.234 src/sys/netinet/in.c:1.235
--- src/sys/netinet/in.c:1.234 Mon Apr 29 11:57:22 2019
+++ src/sys/netinet/in.c Wed Sep 25 09:53:38 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: in.c,v 1.234 2019/04/29 11:57:22 roy Exp $ */
+/* $NetBSD: in.c,v 1.235 2019/09/25 09:53:38 ozaki-r Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.234 2019/04/29 11:57:22 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in.c,v 1.235 2019/09/25 09:53:38 ozaki-r Exp $");
#include "arp.h"
@@ -1937,7 +1937,7 @@ static void
in_lltable_destroy_lle(struct llentry *lle)
{
- KASSERT(lle->la_numheld == 0);
+ KASSERTMSG(lle->la_numheld == 0, "la_numheld=%d", lle->la_numheld);
LLE_WUNLOCK(lle);
LLE_LOCK_DESTROY(lle);
Index: src/sys/netinet6/in6.c
diff -u src/sys/netinet6/in6.c:1.275 src/sys/netinet6/in6.c:1.276
--- src/sys/netinet6/in6.c:1.275 Mon Apr 29 11:57:22 2019
+++ src/sys/netinet6/in6.c Wed Sep 25 09:53:38 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: in6.c,v 1.275 2019/04/29 11:57:22 roy Exp $ */
+/* $NetBSD: in6.c,v 1.276 2019/09/25 09:53:38 ozaki-r Exp $ */
/* $KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.275 2019/04/29 11:57:22 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6.c,v 1.276 2019/09/25 09:53:38 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -1437,7 +1437,9 @@ in6_purgeaddr(struct ifaddr *ifa)
mutex_enter(&in6_ifaddr_lock);
while ((imm = LIST_FIRST(&ia->ia6_memberships)) != NULL) {
struct in6_multi *in6m __diagused = imm->i6mm_maddr;
- KASSERT(in6m == NULL || in6m->in6m_ifp == ifp);
+ KASSERTMSG(in6m == NULL || in6m->in6m_ifp == ifp,
+ "in6m_ifp=%s ifp=%s", in6m ? in6m->in6m_ifp->if_xname : NULL,
+ ifp->if_xname);
LIST_REMOVE(imm, i6mm_chain);
mutex_exit(&in6_ifaddr_lock);
@@ -2432,7 +2434,7 @@ static void
in6_lltable_destroy_lle(struct llentry *lle)
{
- KASSERT(lle->la_numheld == 0);
+ KASSERTMSG(lle->la_numheld == 0, "la_numheld=%d", lle->la_numheld);
LLE_WUNLOCK(lle);
LLE_LOCK_DESTROY(lle);
Index: src/sys/netinet6/mld6.c
diff -u src/sys/netinet6/mld6.c:1.100 src/sys/netinet6/mld6.c:1.101
--- src/sys/netinet6/mld6.c:1.100 Sat Dec 22 14:28:57 2018
+++ src/sys/netinet6/mld6.c Wed Sep 25 09:53:38 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: mld6.c,v 1.100 2018/12/22 14:28:57 maxv Exp $ */
+/* $NetBSD: mld6.c,v 1.101 2019/09/25 09:53:38 ozaki-r Exp $ */
/* $KAME: mld6.c,v 1.25 2001/01/16 14:14:18 itojun Exp $ */
/*
@@ -102,7 +102,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mld6.c,v 1.100 2018/12/22 14:28:57 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mld6.c,v 1.101 2019/09/25 09:53:38 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -191,7 +191,8 @@ mld_starttimer(struct in6_multi *in6m)
struct timeval now;
KASSERT(rw_write_held(&in6_multilock));
- KASSERT(in6m->in6m_timer != IN6M_TIMER_UNDEF);
+ KASSERTMSG(in6m->in6m_timer != IN6M_TIMER_UNDEF,
+ "in6m_timer=%d", in6m->in6m_timer);
microtime(&now);
in6m->in6m_timer_expire.tv_sec = now.tv_sec + in6m->in6m_timer / hz;
@@ -233,7 +234,8 @@ mld_timeo(void *arg)
{
struct in6_multi *in6m = arg;
- KASSERT(in6m->in6m_refcount > 0);
+ KASSERTMSG(in6m->in6m_refcount > 0, "in6m_refcount=%d",
+ in6m->in6m_refcount);
KERNEL_LOCK_UNLESS_NET_MPSAFE();
rw_enter(&in6_multilock, RW_WRITER);
@@ -774,7 +776,8 @@ in6m_destroy(struct in6_multi *in6m)
struct sockaddr_in6 sin6;
KASSERT(rw_write_held(&in6_multilock));
- KASSERT(in6m->in6m_refcount == 0);
+ KASSERTMSG(in6m->in6m_refcount == 0, "in6m_refcount=%d",
+ in6m->in6m_refcount);
/*
* Unlink from list if it's listed. This must be done before
@@ -823,7 +826,8 @@ in6_delmulti_locked(struct in6_multi *in
{
KASSERT(rw_write_held(&in6_multilock));
- KASSERT(in6m->in6m_refcount > 0);
+ KASSERTMSG(in6m->in6m_refcount > 0, "in6m_refcount=%d",
+ in6m->in6m_refcount);
/*
* The caller should have a reference to in6m. So we don't need to care
Index: src/sys/netinet6/nd6.c
diff -u src/sys/netinet6/nd6.c:1.264 src/sys/netinet6/nd6.c:1.265
--- src/sys/netinet6/nd6.c:1.264 Wed Sep 25 09:52:32 2019
+++ src/sys/netinet6/nd6.c Wed Sep 25 09:53:38 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6.c,v 1.264 2019/09/25 09:52:32 ozaki-r Exp $ */
+/* $NetBSD: nd6.c,v 1.265 2019/09/25 09:53:38 ozaki-r Exp $ */
/* $KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.264 2019/09/25 09:52:32 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.265 2019/09/25 09:53:38 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_net_mpsafe.h"
@@ -737,7 +737,8 @@ nd6_timer_work(struct work *wk, void *ar
* Just invalidate the prefix here. Removing it
* will be done when purging an associated address.
*/
- KASSERT(pr->ndpr_refcnt > 0);
+ KASSERTMSG(pr->ndpr_refcnt > 0, "ndpr_refcnt=%d",
+ pr->ndpr_refcnt);
nd6_invalidate_prefix(pr);
}
}
@@ -898,7 +899,8 @@ nd6_purge(struct ifnet *ifp, struct in6_
/*
* All addresses referencing pr should be already freed.
*/
- KASSERT(pr->ndpr_refcnt == 0);
+ KASSERTMSG(pr->ndpr_refcnt == 0, "ndpr_refcnt=%d",
+ pr->ndpr_refcnt);
nd6_prelist_remove(pr);
}
}
@@ -1966,7 +1968,8 @@ nd6_ioctl(u_long cmd, void *data, struct
}
pserialize_read_exit(_s);
- KASSERT(pfx->ndpr_refcnt == 0);
+ KASSERTMSG(pfx->ndpr_refcnt == 0, "ndpr_refcnt=%d",
+ pfx->ndpr_refcnt);
nd6_prelist_remove(pfx);
}
ND6_UNLOCK();
Index: src/sys/netinet6/nd6_rtr.c
diff -u src/sys/netinet6/nd6_rtr.c:1.145 src/sys/netinet6/nd6_rtr.c:1.146
--- src/sys/netinet6/nd6_rtr.c:1.145 Mon Apr 29 11:57:22 2019
+++ src/sys/netinet6/nd6_rtr.c Wed Sep 25 09:53:38 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: nd6_rtr.c,v 1.145 2019/04/29 11:57:22 roy Exp $ */
+/* $NetBSD: nd6_rtr.c,v 1.146 2019/09/25 09:53:38 ozaki-r Exp $ */
/* $KAME: nd6_rtr.c,v 1.95 2001/02/07 08:09:47 itojun Exp $ */
/*
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.145 2019/04/29 11:57:22 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_rtr.c,v 1.146 2019/09/25 09:53:38 ozaki-r Exp $");
#ifdef _KERNEL_OPT
#include "opt_net_mpsafe.h"
@@ -946,7 +946,8 @@ restart:
}
pserialize_read_exit(s);
- KASSERT(pr->ndpr_refcnt == 0);
+ KASSERTMSG(pr->ndpr_refcnt == 0, "ndpr_refcnt=%d",
+ pr->ndpr_refcnt);
nd6_prelist_remove(pr);
}
}
@@ -1068,7 +1069,7 @@ nd6_prelist_remove(struct nd_prefix *pr)
struct in6_ifextra *ext = pr->ndpr_ifp->if_afdata[AF_INET6];
ND6_ASSERT_WLOCK();
- KASSERT(pr->ndpr_refcnt == 0);
+ KASSERTMSG(pr->ndpr_refcnt == 0, "ndpr_refcnt=%d", pr->ndpr_refcnt);
nd6_invalidate_prefix(pr);
Index: src/sys/netipsec/key.c
diff -u src/sys/netipsec/key.c:1.266 src/sys/netipsec/key.c:1.267
--- src/sys/netipsec/key.c:1.266 Sun Aug 4 14:30:36 2019
+++ src/sys/netipsec/key.c Wed Sep 25 09:53:38 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: key.c,v 1.266 2019/08/04 14:30:36 maxv Exp $ */
+/* $NetBSD: key.c,v 1.267 2019/09/25 09:53:38 ozaki-r Exp $ */
/* $FreeBSD: key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $ */
/* $KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $ */
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.266 2019/08/04 14:30:36 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.267 2019/09/25 09:53:38 ozaki-r Exp $");
/*
* This code is referred to RFC 2367
@@ -1695,7 +1695,8 @@ key_lookup_and_remove_sp(const struct se
mutex_enter(&key_spd.lock);
SPLIST_WRITER_FOREACH(sp, spidx->dir) {
- KASSERT(sp->state != IPSEC_SPSTATE_DEAD);
+ KASSERTMSG(sp->state != IPSEC_SPSTATE_DEAD, "sp->state=%u",
+ sp->state);
/*
* SPs created in kernel(e.g. ipsec(4) I/F) must not be
* removed by userland programs.
@@ -1760,7 +1761,8 @@ key_lookupbyid_and_remove_sp(u_int32_t i
mutex_enter(&key_spd.lock);
SPLIST_READER_FOREACH(sp, IPSEC_DIR_INBOUND) {
- KASSERT(sp->state != IPSEC_SPSTATE_DEAD);
+ KASSERTMSG(sp->state != IPSEC_SPSTATE_DEAD, "sp->state=%u",
+ sp->state);
/*
* SPs created in kernel(e.g. ipsec(4) I/F) must not be
* removed by userland programs.
@@ -1772,7 +1774,8 @@ key_lookupbyid_and_remove_sp(u_int32_t i
}
SPLIST_READER_FOREACH(sp, IPSEC_DIR_OUTBOUND) {
- KASSERT(sp->state != IPSEC_SPSTATE_DEAD);
+ KASSERTMSG(sp->state != IPSEC_SPSTATE_DEAD, "sp->state=%u",
+ sp->state);
/*
* SPs created in kernel(e.g. ipsec(4) I/F) must not be
* removed by userland programs.
@@ -2812,7 +2815,8 @@ key_api_spdflush(struct socket *so, stru
retry:
mutex_enter(&key_spd.lock);
SPLIST_WRITER_FOREACH(sp, dir) {
- KASSERT(sp->state != IPSEC_SPSTATE_DEAD);
+ KASSERTMSG(sp->state != IPSEC_SPSTATE_DEAD,
+ "sp->state=%u", sp->state);
/*
* Userlang programs can remove SPs created by userland
* probrams only, that is, they cannot remove SPs
@@ -3231,7 +3235,7 @@ key_unlink_sah(struct secashead *sah)
KASSERT(!cpu_softintr_p());
KASSERT(mutex_owned(&key_sad.lock));
- KASSERT(sah->state == SADB_SASTATE_DEAD);
+ KASSERTMSG(sah->state == SADB_SASTATE_DEAD, "sah->state=%u", sah->state);
/* Remove from the sah list */
SAHLIST_WRITER_REMOVE(sah);
@@ -3566,7 +3570,8 @@ static void
key_freesaval(struct secasvar *sav)
{
- KASSERT(key_sa_refcnt(sav) == 0);
+ KASSERTMSG(key_sa_refcnt(sav) == 0, "key_sa_refcnt(sav)=%u",
+ key_sa_refcnt(sav));
if (sav->replay != NULL)
kmem_intr_free(sav->replay, sav->replay_len);
@@ -3606,7 +3611,8 @@ key_setsaval(struct secasvar *sav, struc
KASSERT(mhp->msg != NULL);
/* We shouldn't initialize sav variables while someone uses it. */
- KASSERT(key_sa_refcnt(sav) == 0);
+ KASSERTMSG(key_sa_refcnt(sav) == 0, "key_sa_refcnt(sav)=%u",
+ key_sa_refcnt(sav));
/* SA */
if (mhp->ext[SADB_EXT_SA] != NULL) {
@@ -3795,7 +3801,8 @@ key_init_xform(struct secasvar *sav)
int error;
/* We shouldn't initialize sav variables while someone uses it. */
- KASSERT(key_sa_refcnt(sav) == 0);
+ KASSERTMSG(key_sa_refcnt(sav) == 0, "key_sa_refcnt(sav)=%u",
+ key_sa_refcnt(sav));
/* check SPI value */
switch (sav->sah->saidx.proto) {
@@ -4885,7 +4892,8 @@ key_timehandler_spd(time_t now)
retry:
mutex_enter(&key_spd.lock);
SPLIST_WRITER_FOREACH(sp, dir) {
- KASSERT(sp->state != IPSEC_SPSTATE_DEAD);
+ KASSERTMSG(sp->state != IPSEC_SPSTATE_DEAD,
+ "sp->state=%u", sp->state);
if (sp->lifetime == 0 && sp->validtime == 0)
continue;