Date: Wed, 6 Oct 2004 15:19:48 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 62753 for review Message-ID: <200410061519.i96FJmIp042402@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=62753 Change 62753 by jhb@jhb_slimer on 2004/10/06 15:18:56 Add some KASSERT()'s to help catch the use after free bug in the file desc code that sparc64 machines keep tripping. Affected files ... .. //depot/projects/smpng/sys/kern/kern_descrip.c#67 edit Differences ... ==== //depot/projects/smpng/sys/kern/kern_descrip.c#67 (text+ko) ==== @@ -179,6 +179,7 @@ FILEDESC_LOCK_ASSERT(fdp, MA_OWNED); KASSERT(!fdisused(fdp, fd), ("fd already used")); + KASSERT(fdp->fd_map[NDSLOT(fd)] != 0xdeadc0de, ("writing to free'd map")); fdp->fd_map[NDSLOT(fd)] |= NDBIT(fd); if (fd > fdp->fd_lastfile) fdp->fd_lastfile = fd; @@ -197,6 +198,7 @@ ("fd is already unused")); KASSERT(fdp->fd_ofiles[fd] == NULL, ("fd is still in use")); + KASSERT(fdp->fd_map[NDSLOT(fd)] != 0xdeadc0de, ("writing to free'd map")); fdp->fd_map[NDSLOT(fd)] &= ~NDBIT(fd); if (fd < fdp->fd_freefile) fdp->fd_freefile = fd; @@ -389,6 +391,7 @@ case F_SETFD: /* mtx_assert(&Giant, MA_NOTOWNED); */ + KASSERT(*pop != 0xdeadc0de, ("writing to free'd flags")); *pop = (*pop &~ UF_EXCLOSE) | (arg & FD_CLOEXEC ? UF_EXCLOSE : 0); FILEDESC_UNLOCK(fdp); @@ -681,6 +684,7 @@ * Duplicate the source descriptor */ fdp->fd_ofiles[new] = fp; + KASSERT(fdp->fd_ofileflags[old] != 0xdeadc0de, ("reading/writing free'd file flags")); fdp->fd_ofileflags[new] = fdp->fd_ofileflags[old] &~ UF_EXCLOSE; if (new > fdp->fd_lastfile) fdp->fd_lastfile = new;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200410061519.i96FJmIp042402>