Date: Fri, 26 Dec 1997 19:12:13 +1100 From: Bruce Evans <bde@zeta.org.au> To: dg@root.com, julian@whistle.com Cc: current@FreeBSD.ORG, gjp@erols.com Subject: Re: crash (in networking code?) Message-ID: <199712260812.TAA11683@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
>I think this is a worry. I need to check a bunch of code against >this possibility. (MALLOC in splnet allowing un-expected re-enterence) I hope there are no reentrance bugs. Invalidation of objects that you think you own is bad enough. I use the following to find bogus M_WAITOK malloc()s. It complained about problems in all of the recently fixed areas (2 in netinet, one in accept1(). Bruce diff -c2 kern_malloc.c~ kern_malloc.c *** kern_malloc.c~ Fri Dec 5 23:25:33 1997 --- kern_malloc.c Fri Dec 26 14:02:11 1997 *************** *** 1,2 **** --- 1,6 ---- + static volatile int dbm_db = 0; + static volatile int dbm_ipl = 0; /* change to 0xc0020000 to hide splnet bugs */ + static volatile int dbm_sleep = 0; + /* * Copyright (c) 1987, 1991, 1993 *************** *** 127,130 **** --- 137,153 ---- kbp = &bucket[indx]; s = splhigh(); + #if 1 + if (!cold && !(flags & M_NOWAIT) && s != 0x80000000 && s != dbm_ipl) { + #elif 0 + if (!cold && !(flags & M_NOWAIT) && s & 0x0000ffff) { + #else + if (!cold && !(flags & M_NOWAIT) && s == 0xffffffff) { + #endif + printf("malloc(..., M_NOWAIT) called at high ipl %#x\n", s); + if (dbm_db) + Debugger(""); + if (dbm_sleep) + tsleep((caddr_t)ksp, PSWP+2, type->ks_shortdesc, 1); + } while (ksp->ks_memuse >= ksp->ks_limit) { if (flags & M_NOWAIT) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199712260812.TAA11683>