From owner-trustedbsd-cvs@FreeBSD.ORG Mon Jan 22 15:21:04 2007 Return-Path: X-Original-To: trustedbsd-cvs@freebsd.org Delivered-To: trustedbsd-cvs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D22EB16A406 for ; Mon, 22 Jan 2007 15:21:04 +0000 (UTC) (envelope-from owner-perforce@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [209.31.154.42]) by mx1.freebsd.org (Postfix) with ESMTP id 5329A13C47E for ; Mon, 22 Jan 2007 15:21:04 +0000 (UTC) (envelope-from owner-perforce@freebsd.org) Received: from mx2.freebsd.org (mx2.freebsd.org [69.147.83.53]) by cyrus.watson.org (Postfix) with ESMTP id 5FD1B47DFE for ; Mon, 22 Jan 2007 10:20:59 -0500 (EST) Received: from hub.freebsd.org (hub.freebsd.org [69.147.83.54]) by mx2.freebsd.org (Postfix) with ESMTP id 8C5255733A; Mon, 22 Jan 2007 15:20:39 +0000 (GMT) (envelope-from owner-perforce@freebsd.org) Received: by hub.freebsd.org (Postfix, from userid 32767) id 7090916A40D; Mon, 22 Jan 2007 15:20:39 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 339D216A408 for ; Mon, 22 Jan 2007 15:20:39 +0000 (UTC) (envelope-from millert@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id E74F013C469 for ; Mon, 22 Jan 2007 15:20:38 +0000 (UTC) (envelope-from millert@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id l0MFKcPb004415 for ; Mon, 22 Jan 2007 15:20:38 GMT (envelope-from millert@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id l0MFKcvo004412 for perforce@freebsd.org; Mon, 22 Jan 2007 15:20:38 GMT (envelope-from millert@freebsd.org) Date: Mon, 22 Jan 2007 15:20:38 GMT Message-Id: <200701221520.l0MFKcvo004412@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to millert@freebsd.org using -f From: Todd Miller To: Perforce Change Reviews Cc: Subject: PERFORCE change 113322 for review X-BeenThere: trustedbsd-cvs@FreeBSD.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: TrustedBSD CVS and Perforce commit message list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Jan 2007 15:21:04 -0000 http://perforce.freebsd.org/chv.cgi?CH=113322 Change 113322 by millert@millert_macbook on 2007/01/22 15:19:53 Use m_dup_pkthdr() instead of M_COPY_PKTHDR() in m_copym() and m_copym_with_hdrs() since with MAC, M_COPY_PKTHDR() moves the mbuf tags instead of copying them, which effectively leaves the source mbuf unlabeled. Also need to zero out m_pkthdr.aux in the source mbuf after m_dup_pkthdr(). m_copy_pkthdr() did this for us but m_dup_pkthdr() does not. Affected files ... .. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/bsd/kern/uipc_mbuf.c#6 edit Differences ... ==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/bsd/kern/uipc_mbuf.c#6 (text+ko) ==== @@ -1536,7 +1536,11 @@ if (n == 0) goto nospace; if (copyhdr) { - M_COPY_PKTHDR(n, m); + MBUF_UNLOCK(); + if (!m_dup_pkthdr(n, m, wait)) + goto nospace_unlock; + MBUF_LOCK(); + m->m_pkthdr.aux = (struct mbuf *)NULL; if (len == M_COPYALL) n->m_pkthdr.len -= off0; else @@ -1579,6 +1583,7 @@ nospace: MBUF_UNLOCK(); +nospace_unlock: m_freem(top); MCFail++; return (0); @@ -1677,7 +1682,11 @@ *np = n; if (copyhdr) { - M_COPY_PKTHDR(n, m); + MBUF_UNLOCK(); + if (!m_dup_pkthdr(n, m, wait)) + goto nospace_unlock; + MBUF_LOCK(); + m->m_pkthdr.aux = (struct mbuf *)NULL; n->m_pkthdr.len = len; copyhdr = 0; }