From owner-svn-src-all@freebsd.org Sun Jul 26 00:11:08 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 204119A53D6; Sun, 26 Jul 2015 00:11:08 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F30BE7B; Sun, 26 Jul 2015 00:11:08 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6Q0B7mX015643; Sun, 26 Jul 2015 00:11:07 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6Q0B5V8015636; Sun, 26 Jul 2015 00:11:05 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201507260011.t6Q0B5V8015636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sun, 26 Jul 2015 00:11:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285884 - in head: lib/libiconv_modules/BIG5 lib/libiconv_modules/EUC lib/libiconv_modules/EUCTW lib/libiconv_modules/UTF1632 lib/libiconv_modules/UTF7 lib/libiconv_modules/iconv_std us... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 00:11:08 -0000 Author: pfg Date: Sun Jul 26 00:11:04 2015 New Revision: 285884 URL: https://svnweb.freebsd.org/changeset/base/285884 Log: Bump GCC max-inline-insns-single in libiconv_modules and grep This is required by our FORTIFY_SOURCE implementation as it does more inlining. As a rule of thumb, FORTIFY_SOURCE doubles the number of inlines except that in grep inlining blows up for some reason. Modified: head/lib/libiconv_modules/BIG5/Makefile head/lib/libiconv_modules/EUC/Makefile head/lib/libiconv_modules/EUCTW/Makefile head/lib/libiconv_modules/UTF1632/Makefile head/lib/libiconv_modules/UTF7/Makefile head/lib/libiconv_modules/iconv_std/Makefile head/usr.bin/grep/Makefile Modified: head/lib/libiconv_modules/BIG5/Makefile ============================================================================== --- head/lib/libiconv_modules/BIG5/Makefile Sat Jul 25 20:17:19 2015 (r285883) +++ head/lib/libiconv_modules/BIG5/Makefile Sun Jul 26 00:11:04 2015 (r285884) @@ -2,6 +2,6 @@ SHLIB= BIG5 SRCS+= citrus_big5.c -CFLAGS.gcc+= --param max-inline-insns-single=32 +CFLAGS.gcc+= --param max-inline-insns-single=64 .include Modified: head/lib/libiconv_modules/EUC/Makefile ============================================================================== --- head/lib/libiconv_modules/EUC/Makefile Sat Jul 25 20:17:19 2015 (r285883) +++ head/lib/libiconv_modules/EUC/Makefile Sun Jul 26 00:11:04 2015 (r285884) @@ -2,6 +2,6 @@ SHLIB= EUC SRCS+= citrus_euc.c -CFLAGS.gcc+= --param max-inline-insns-single=32 +CFLAGS.gcc+= --param max-inline-insns-single=64 .include Modified: head/lib/libiconv_modules/EUCTW/Makefile ============================================================================== --- head/lib/libiconv_modules/EUCTW/Makefile Sat Jul 25 20:17:19 2015 (r285883) +++ head/lib/libiconv_modules/EUCTW/Makefile Sun Jul 26 00:11:04 2015 (r285884) @@ -2,6 +2,6 @@ SHLIB= EUCTW SRCS+= citrus_euctw.c -CFLAGS.gcc+= --param max-inline-insns-single=32 +CFLAGS.gcc+= --param max-inline-insns-single=64 .include Modified: head/lib/libiconv_modules/UTF1632/Makefile ============================================================================== --- head/lib/libiconv_modules/UTF1632/Makefile Sat Jul 25 20:17:19 2015 (r285883) +++ head/lib/libiconv_modules/UTF1632/Makefile Sun Jul 26 00:11:04 2015 (r285884) @@ -2,6 +2,6 @@ SHLIB= UTF1632 SRCS+= citrus_utf1632.c -CFLAGS.gcc+= --param max-inline-insns-single=32 +CFLAGS.gcc+= --param max-inline-insns-single=64 .include Modified: head/lib/libiconv_modules/UTF7/Makefile ============================================================================== --- head/lib/libiconv_modules/UTF7/Makefile Sat Jul 25 20:17:19 2015 (r285883) +++ head/lib/libiconv_modules/UTF7/Makefile Sun Jul 26 00:11:04 2015 (r285884) @@ -2,6 +2,6 @@ SHLIB= UTF7 SRCS+= citrus_utf7.c -CFLAGS.gcc+= --param max-inline-insns-single=32 +CFLAGS.gcc+= --param max-inline-insns-single=64 .include Modified: head/lib/libiconv_modules/iconv_std/Makefile ============================================================================== --- head/lib/libiconv_modules/iconv_std/Makefile Sat Jul 25 20:17:19 2015 (r285883) +++ head/lib/libiconv_modules/iconv_std/Makefile Sun Jul 26 00:11:04 2015 (r285884) @@ -2,6 +2,6 @@ SHLIB= iconv_std SRCS+= citrus_iconv_std.c -CFLAGS.gcc+= --param max-inline-insns-single=32 +CFLAGS.gcc+= --param max-inline-insns-single=64 .include Modified: head/usr.bin/grep/Makefile ============================================================================== --- head/usr.bin/grep/Makefile Sat Jul 25 20:17:19 2015 (r285883) +++ head/usr.bin/grep/Makefile Sun Jul 26 00:11:04 2015 (r285884) @@ -20,6 +20,8 @@ SRCS= file.c grep.c queue.c util.c SRCS+= fastmatch.c hashtable.c tre-compile.c tre-fastmatch.c xmalloc.c CFLAGS+=-I${.CURDIR}/regex +CFLAGS.gcc+= --param max-inline-insns-single=500 + .if ${MK_BSD_GREP} == "yes" LINKS= ${BINDIR}/grep ${BINDIR}/egrep \ ${BINDIR}/grep ${BINDIR}/fgrep \ From owner-svn-src-all@freebsd.org Sun Jul 26 08:33:47 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FE4E9A395D; Sun, 26 Jul 2015 08:33:47 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9031A1D4; Sun, 26 Jul 2015 08:33:47 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6Q8Xlpk023372; Sun, 26 Jul 2015 08:33:47 GMT (envelope-from brueffer@FreeBSD.org) Received: (from brueffer@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6Q8Xlb1023371; Sun, 26 Jul 2015 08:33:47 GMT (envelope-from brueffer@FreeBSD.org) Message-Id: <201507260833.t6Q8Xlb1023371@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brueffer set sender to brueffer@FreeBSD.org using -f From: Christian Brueffer Date: Sun, 26 Jul 2015 08:33:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285885 - head/sys/fs/tmpfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 08:33:47 -0000 Author: brueffer Date: Sun Jul 26 08:33:46 2015 New Revision: 285885 URL: https://svnweb.freebsd.org/changeset/base/285885 Log: In tmpfs_chtimes(), remove checks on the nanosecond level when determining whether a node changed. Other filesystems, e.g., UFS, only check on seconds, when determining whether something changed. This also corrects the birthtime case, where we checked tv_nsec twice, instead of tv_sec and tv_nsec (PR). PR: 201284 Submitted by: David Binderman Patch suggested by: kib Reviewed by: kib MFC after: 2 weeks Committed from: Essen FreeBSD Hackathon Modified: head/sys/fs/tmpfs/tmpfs_subr.c Modified: head/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_subr.c Sun Jul 26 00:11:04 2015 (r285884) +++ head/sys/fs/tmpfs/tmpfs_subr.c Sun Jul 26 08:33:46 2015 (r285885) @@ -1709,20 +1709,18 @@ tmpfs_chtimes(struct vnode *vp, struct v if (error != 0) return (error); - if (vap->va_atime.tv_sec != VNOVAL && vap->va_atime.tv_nsec != VNOVAL) + if (vap->va_atime.tv_sec != VNOVAL) node->tn_status |= TMPFS_NODE_ACCESSED; - if (vap->va_mtime.tv_sec != VNOVAL && vap->va_mtime.tv_nsec != VNOVAL) + if (vap->va_mtime.tv_sec != VNOVAL) node->tn_status |= TMPFS_NODE_MODIFIED; - if (vap->va_birthtime.tv_nsec != VNOVAL && - vap->va_birthtime.tv_nsec != VNOVAL) + if (vap->va_birthtime.tv_sec != VNOVAL) node->tn_status |= TMPFS_NODE_MODIFIED; tmpfs_itimes(vp, &vap->va_atime, &vap->va_mtime); - if (vap->va_birthtime.tv_nsec != VNOVAL && - vap->va_birthtime.tv_nsec != VNOVAL) + if (vap->va_birthtime.tv_sec != VNOVAL) node->tn_birthtime = vap->va_birthtime; MPASS(VOP_ISLOCKED(vp)); From owner-svn-src-all@freebsd.org Sun Jul 26 08:41:38 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A83C9A3C1A; Sun, 26 Jul 2015 08:41:38 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BC28493F; Sun, 26 Jul 2015 08:41:37 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id t6Q8fW6s081941 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sun, 26 Jul 2015 11:41:32 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.9.2 kib.kiev.ua t6Q8fW6s081941 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id t6Q8fWsQ081940; Sun, 26 Jul 2015 11:41:32 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 26 Jul 2015 11:41:32 +0300 From: Konstantin Belousov To: Christian Brueffer Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r285885 - head/sys/fs/tmpfs Message-ID: <20150726084132.GM2072@kib.kiev.ua> References: <201507260833.t6Q8Xlb1023371@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201507260833.t6Q8Xlb1023371@repo.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 08:41:38 -0000 On Sun, Jul 26, 2015 at 08:33:47AM +0000, Christian Brueffer wrote: > Author: brueffer > Date: Sun Jul 26 08:33:46 2015 > New Revision: 285885 > URL: https://svnweb.freebsd.org/changeset/base/285885 > > Log: > In tmpfs_chtimes(), remove checks on the nanosecond level when > determining whether a node changed. No, these are checks to see if the userspace requested an update to the corresponding inode time and supplied valid time. I.e. the code change is right, but the commit message is misleading. > > Other filesystems, e.g., UFS, only check on seconds, when determining > whether something changed. > > This also corrects the birthtime case, where we checked tv_nsec > twice, instead of tv_sec and tv_nsec (PR). > > PR: 201284 > Submitted by: David Binderman > Patch suggested by: kib > Reviewed by: kib > MFC after: 2 weeks > Committed from: Essen FreeBSD Hackathon > > Modified: > head/sys/fs/tmpfs/tmpfs_subr.c > > Modified: head/sys/fs/tmpfs/tmpfs_subr.c > ============================================================================== > --- head/sys/fs/tmpfs/tmpfs_subr.c Sun Jul 26 00:11:04 2015 (r285884) > +++ head/sys/fs/tmpfs/tmpfs_subr.c Sun Jul 26 08:33:46 2015 (r285885) > @@ -1709,20 +1709,18 @@ tmpfs_chtimes(struct vnode *vp, struct v > if (error != 0) > return (error); > > - if (vap->va_atime.tv_sec != VNOVAL && vap->va_atime.tv_nsec != VNOVAL) > + if (vap->va_atime.tv_sec != VNOVAL) > node->tn_status |= TMPFS_NODE_ACCESSED; > > - if (vap->va_mtime.tv_sec != VNOVAL && vap->va_mtime.tv_nsec != VNOVAL) > + if (vap->va_mtime.tv_sec != VNOVAL) > node->tn_status |= TMPFS_NODE_MODIFIED; > > - if (vap->va_birthtime.tv_nsec != VNOVAL && > - vap->va_birthtime.tv_nsec != VNOVAL) > + if (vap->va_birthtime.tv_sec != VNOVAL) > node->tn_status |= TMPFS_NODE_MODIFIED; > > tmpfs_itimes(vp, &vap->va_atime, &vap->va_mtime); > > - if (vap->va_birthtime.tv_nsec != VNOVAL && > - vap->va_birthtime.tv_nsec != VNOVAL) > + if (vap->va_birthtime.tv_sec != VNOVAL) > node->tn_birthtime = vap->va_birthtime; > MPASS(VOP_ISLOCKED(vp)); > From owner-svn-src-all@freebsd.org Sun Jul 26 10:17:18 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B63CB9A739D; Sun, 26 Jul 2015 10:17:18 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A67E0806; Sun, 26 Jul 2015 10:17:18 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6QAHIcm065120; Sun, 26 Jul 2015 10:17:18 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6QAHIYv065119; Sun, 26 Jul 2015 10:17:18 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201507261017.t6QAHIYv065119@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 26 Jul 2015 10:17:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285886 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 10:17:18 -0000 Author: tuexen Date: Sun Jul 26 10:17:17 2015 New Revision: 285886 URL: https://svnweb.freebsd.org/changeset/base/285886 Log: Fix and improve a debug message. The SID was reported as an SSN. MFC after: 1 week Modified: head/sys/netinet/sctp_indata.c Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Sun Jul 26 08:33:46 2015 (r285885) +++ head/sys/netinet/sctp_indata.c Sun Jul 26 10:17:17 2015 (r285886) @@ -578,10 +578,10 @@ sctp_queue_data_to_stream(struct sctp_tc sctp_log_strm_del(control, NULL, SCTP_STR_LOG_FROM_INTO_STRD); } SCTPDBG(SCTP_DEBUG_INDATA1, - "queue to stream called for ssn:%u lastdel:%u nxt:%u\n", - (uint32_t) control->sinfo_stream, - (uint32_t) strm->last_sequence_delivered, - (uint32_t) nxt_todel); + "queue to stream called for sid:%u ssn:%u tsn:%u lastdel:%u nxt:%u\n", + (uint32_t) control->sinfo_stream, (uint32_t) control->sinfo_ssn, + (uint32_t) control->sinfo_tsn, + (uint32_t) strm->last_sequence_delivered, (uint32_t) nxt_todel); if (SCTP_SSN_GE(strm->last_sequence_delivered, control->sinfo_ssn)) { /* The incoming sseq is behind where we last delivered? */ SCTPDBG(SCTP_DEBUG_INDATA1, "Duplicate S-SEQ:%d delivered:%d from peer, Abort association\n", From owner-svn-src-all@freebsd.org Sun Jul 26 10:37:41 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C5FC9A78AF; Sun, 26 Jul 2015 10:37:41 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7339BEF6; Sun, 26 Jul 2015 10:37:41 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6QAbfSb073335; Sun, 26 Jul 2015 10:37:41 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6QAbfE1073334; Sun, 26 Jul 2015 10:37:41 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201507261037.t6QAbfE1073334@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 26 Jul 2015 10:37:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285887 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 10:37:41 -0000 Author: tuexen Date: Sun Jul 26 10:37:40 2015 New Revision: 285887 URL: https://svnweb.freebsd.org/changeset/base/285887 Log: Improve locking on Mac OS X. This does not change the functionality on FreeBSD. Reviewed by: rrs MFC after: 1 week Modified: head/sys/netinet/sctp_indata.c Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Sun Jul 26 10:17:17 2015 (r285886) +++ head/sys/netinet/sctp_indata.c Sun Jul 26 10:37:40 2015 (r285887) @@ -602,6 +602,20 @@ protocol_error: return; } +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) + struct socket *so; + + so = SCTP_INP_SO(stcb->sctp_ep); + atomic_add_int(&stcb->asoc.refcnt, 1); + SCTP_TCB_UNLOCK(stcb); + SCTP_SOCKET_LOCK(so, 1); + SCTP_TCB_LOCK(stcb); + atomic_subtract_int(&stcb->asoc.refcnt, 1); + if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) { + SCTP_SOCKET_UNLOCK(so, 1); + return; + } +#endif if (nxt_todel == control->sinfo_ssn) { /* can be delivered right away? */ if (SCTP_BASE_SYSCTL(sctp_logging_level) & SCTP_STR_LOGGING_ENABLE) { @@ -617,7 +631,7 @@ protocol_error: sctp_add_to_readq(stcb->sctp_ep, stcb, control, &stcb->sctp_socket->so_rcv, 1, - SCTP_READ_LOCK_NOT_HELD, SCTP_SO_NOT_LOCKED); + SCTP_READ_LOCK_NOT_HELD, SCTP_SO_LOCKED); TAILQ_FOREACH_SAFE(control, &strm->inqueue, next, at) { /* all delivered */ nxt_todel = strm->last_sequence_delivered + 1; @@ -641,7 +655,7 @@ protocol_error: control, &stcb->sctp_socket->so_rcv, 1, SCTP_READ_LOCK_NOT_HELD, - SCTP_SO_NOT_LOCKED); + SCTP_SO_LOCKED); continue; } break; @@ -653,6 +667,9 @@ protocol_error: * to put it on the queue. */ if (SCTP_TSN_GE(asoc->cumulative_tsn, control->sinfo_tsn)) { +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) + SCTP_SOCKET_UNLOCK(so, 1); +#endif goto protocol_error; } if (TAILQ_EMPTY(&strm->inqueue)) { @@ -699,6 +716,9 @@ protocol_error: control->whoFrom = NULL; } sctp_free_a_readq(stcb, control); +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) + SCTP_SOCKET_UNLOCK(so, 1); +#endif return; } else { if (TAILQ_NEXT(at, next) == NULL) { @@ -718,6 +738,9 @@ protocol_error: } } } +#if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) + SCTP_SOCKET_UNLOCK(so, 1); +#endif } /* From owner-svn-src-all@freebsd.org Sun Jul 26 10:53:33 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 518689A7E42; Sun, 26 Jul 2015 10:53:33 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 42522BCC; Sun, 26 Jul 2015 10:53:33 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6QArXer081203; Sun, 26 Jul 2015 10:53:33 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6QArX3q081202; Sun, 26 Jul 2015 10:53:33 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201507261053.t6QArX3q081202@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sun, 26 Jul 2015 10:53:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285888 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 10:53:33 -0000 Author: ae Date: Sun Jul 26 10:53:32 2015 New Revision: 285888 URL: https://svnweb.freebsd.org/changeset/base/285888 Log: Build debug version of rmlock's methods only when LOCK_DEBUG > 0. Currently LOCK_DEBUG is always defined in sys/lock.h (0 or 1). This means that debugging code always built. In addition the kernel modules have always defined LOCK_DEBUG as 1. So, debugging rmlock code is always used by kernel modules. MFC after: 1 week Modified: head/sys/kern/kern_rmlock.c Modified: head/sys/kern/kern_rmlock.c ============================================================================== --- head/sys/kern/kern_rmlock.c Sun Jul 26 10:37:40 2015 (r285887) +++ head/sys/kern/kern_rmlock.c Sun Jul 26 10:53:32 2015 (r285888) @@ -586,7 +586,7 @@ _rm_wunlock(struct rmlock *rm) mtx_unlock(&rm->rm_lock_mtx); } -#ifdef LOCK_DEBUG +#if LOCK_DEBUG > 0 void _rm_wlock_debug(struct rmlock *rm, const char *file, int line) From owner-svn-src-all@freebsd.org Sun Jul 26 11:16:49 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 607549AB5A5; Sun, 26 Jul 2015 11:16:49 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 50E4695D; Sun, 26 Jul 2015 11:16:49 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6QBGnJU089614; Sun, 26 Jul 2015 11:16:49 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6QBGnBQ089613; Sun, 26 Jul 2015 11:16:49 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201507261116.t6QBGnBQ089613@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sun, 26 Jul 2015 11:16:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285889 - head/sys/geom/part X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 11:16:49 -0000 Author: ae Date: Sun Jul 26 11:16:48 2015 New Revision: 285889 URL: https://svnweb.freebsd.org/changeset/base/285889 Log: Report the scheme and provider names in warning message about unaligned partition. PR: 201873 MFC after: 1 week Modified: head/sys/geom/part/g_part.c Modified: head/sys/geom/part/g_part.c ============================================================================== --- head/sys/geom/part/g_part.c Sun Jul 26 10:53:32 2015 (r285888) +++ head/sys/geom/part/g_part.c Sun Jul 26 11:16:48 2015 (r285889) @@ -322,8 +322,10 @@ g_part_check_integrity(struct g_part_tab if (e1->gpe_offset > offset) offset = e1->gpe_offset; if ((offset + pp->stripeoffset) % pp->stripesize) { - DPRINTF("partition %d is not aligned on %u " - "bytes\n", e1->gpe_index, pp->stripesize); + DPRINTF("partition %d on (%s, %s) is not " + "aligned on %u bytes\n", e1->gpe_index, + pp->name, table->gpt_scheme->name, + pp->stripesize); /* Don't treat this as a critical failure */ } } From owner-svn-src-all@freebsd.org Sun Jul 26 11:21:41 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E41909AB7C2; Sun, 26 Jul 2015 11:21:41 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CDC22E28; Sun, 26 Jul 2015 11:21:41 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6QBLfqV093738; Sun, 26 Jul 2015 11:21:41 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6QBLb86093721; Sun, 26 Jul 2015 11:21:37 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201507261121.t6QBLb86093721@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 26 Jul 2015 11:21:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285890 - in head: etc/mtree gnu/usr.bin/rcs gnu/usr.bin/rcs/ident tools/build/mk usr.bin usr.bin/ident usr.bin/ident/tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 11:21:42 -0000 Author: bapt Date: Sun Jul 26 11:21:36 2015 New Revision: 285890 URL: https://svnweb.freebsd.org/changeset/base/285890 Log: Replace GNU RCS ident with a BSD license ident Rationale: ident(1) is useful out of RCS, lot of scripts are using ident(1) and failing when base is built WITHOUT_RCS. This version is: - fully compatible with RCS 5.7 ident. - fully compatible with RCS 5.9 ident. - passes all ident test from GNU RCS 5.9 test suite This version has support for: svn extension for the Keyword id (double colon and # before last $) DiffĂ©rences with GNU RCS ident: - no long options as found in GNU RCS 5.9 (but not commented there). - '-V' reports nothing but has been added for compatibility. Differential Revision: https://reviews.freebsd.org/D3200 Reviewed by: pfg Added: head/usr.bin/ident/ head/usr.bin/ident/Makefile (contents, props changed) head/usr.bin/ident/ident.1 (contents, props changed) head/usr.bin/ident/ident.c (contents, props changed) head/usr.bin/ident/tests/ head/usr.bin/ident/tests/Makefile (contents, props changed) head/usr.bin/ident/tests/ident.sh (contents, props changed) head/usr.bin/ident/tests/test.in (contents, props changed) head/usr.bin/ident/tests/test.out (contents, props changed) head/usr.bin/ident/tests/testnoid (contents, props changed) Deleted: head/gnu/usr.bin/rcs/ident/ Modified: head/etc/mtree/BSD.tests.dist head/gnu/usr.bin/rcs/Makefile head/tools/build/mk/OptionalObsoleteFiles.inc head/usr.bin/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Sun Jul 26 11:16:48 2015 (r285889) +++ head/etc/mtree/BSD.tests.dist Sun Jul 26 11:21:36 2015 (r285890) @@ -528,6 +528,8 @@ .. gzip .. + ident + .. join .. jot Modified: head/gnu/usr.bin/rcs/Makefile ============================================================================== --- head/gnu/usr.bin/rcs/Makefile Sun Jul 26 11:16:48 2015 (r285889) +++ head/gnu/usr.bin/rcs/Makefile Sun Jul 26 11:21:36 2015 (r285890) @@ -1,3 +1,5 @@ -SUBDIR= lib ci co ident merge rcs rcsclean rcsdiff rcsmerge rlog rcsfreeze +# $FreeBSD$ + +SUBDIR= lib ci co merge rcs rcsclean rcsdiff rcsmerge rlog rcsfreeze .include Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Sun Jul 26 11:16:48 2015 (r285889) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Sun Jul 26 11:21:36 2015 (r285890) @@ -6316,7 +6316,6 @@ OLD_FILES+=usr/share/man/man8/rwhod.8.gz .if ${MK_RCS} == no OLD_FILES+=usr/bin/ci OLD_FILES+=usr/bin/co -OLD_FILES+=usr/bin/ident OLD_FILES+=usr/bin/merge OLD_FILES+=usr/bin/rcs OLD_FILES+=usr/bin/rcsclean @@ -6327,7 +6326,6 @@ OLD_FILES+=usr/bin/rlog OLD_FILES+=usr/sbin/etcupdate OLD_FILES+=usr/share/man/man1/ci.1.gz OLD_FILES+=usr/share/man/man1/co.1.gz -OLD_FILES+=usr/share/man/man1/ident.1.gz OLD_FILES+=usr/share/man/man1/merge.1.gz OLD_FILES+=usr/share/man/man1/rcs.1.gz OLD_FILES+=usr/share/man/man1/rcsclean.1.gz Modified: head/usr.bin/Makefile ============================================================================== --- head/usr.bin/Makefile Sun Jul 26 11:16:48 2015 (r285889) +++ head/usr.bin/Makefile Sun Jul 26 11:21:36 2015 (r285890) @@ -64,6 +64,7 @@ SUBDIR= ${_addr2line} \ hexdump \ ${_iconv} \ id \ + ident \ ipcrm \ ipcs \ join \ Added: head/usr.bin/ident/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/ident/Makefile Sun Jul 26 11:21:36 2015 (r285890) @@ -0,0 +1,13 @@ +# $FreeBSD$ + +.include + +PROG= ident + +LIBADD= sbuf + +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + +.include Added: head/usr.bin/ident/ident.1 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/ident/ident.1 Sun Jul 26 11:21:36 2015 (r285890) @@ -0,0 +1,68 @@ +.\" Copyright (c) 2015 Baptiste Daroussin +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd Jul 25, 2015 +.Dt IDENT 1 +.Os +.Sh NAME +.Nm ident +.Nd identify RCS keyword string in files +.Sh SYNOPSIS +.Nm +.Op Fl q +.Op Fl V +.Op Ar File Ns s +.Sh DESCRIPTION +The +.Nm +utility searches for all instances of the pattern +.Sq $keyword: text$ +in +.Ar files . +.Pp +If no arguments are passed, then +.Nm +parses the standard input. +.Pp +.Em keyword +must only be composed of alphanumeric values in the C locale, followed by +.Sq \&: +and a space. +.Pp +These options are supported: +.Bl -tag -width "XXX" +.It Fl q +Quiet mode: suppress warnings if no pattern found. +.It Fl V +Do nothing, added for compatibility with GNU ident. +.El +.Sh EXIT STATUS +.Ex -std ident +.Sh AUTHORS +This version of the +.Nm +utility was written by +.An Baptiste Daroussin Aq Mt bapt@FreeBSD.org . Added: head/usr.bin/ident/ident.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/ident/ident.c Sun Jul 26 11:21:36 2015 (r285890) @@ -0,0 +1,173 @@ +/*- + * Copyright (c) 2015 Baptiste Daroussin + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer + * in this position and unchanged. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +static bool +parse_id(FILE *fp, struct sbuf *buf, locale_t l) +{ + int c; + bool isid = false; + bool subversion = false; + + sbuf_putc(buf, '$'); + while ((c = fgetc(fp)) != EOF) { + sbuf_putc(buf, c); + if (!isid) { + if (c == '$') { + sbuf_clear(buf); + sbuf_putc(buf, '$'); + continue; + } + if (c == ':') { + c = fgetc(fp); + /* accept :: for subversion compatibility */ + if (c == ':') { + subversion = true; + sbuf_putc(buf, c); + c = fgetc(fp); + } + if (c == ' ') { + sbuf_putc(buf, c); + isid = true; + continue; + } + return (false); + } + + if (!isalpha_l(c, l)) + return (false); + } else { + if (c == '\n') + return (false); + if (c == '$') { + sbuf_finish(buf); + /* should end with a space */ + c = sbuf_data(buf)[sbuf_len(buf) - 2]; + if (!subversion) { + if (c != ' ') + return (0); + } else if (subversion) { + if (c != ' ' && c != '#') + return (0); + } + printf(" %s\n", sbuf_data(buf)); + return (true); + } + } + } + + return (false); +} + +static int +scan(FILE *fp, const char *name, bool quiet) +{ + int c; + bool hasid = false; + struct sbuf *id = sbuf_new_auto(); + locale_t l; + + l = newlocale(LC_ALL_MASK, "C", NULL); + + if (name != NULL) + printf("%s:\n", name); + + while ((c = fgetc(fp)) != EOF) { + if (c == '$') { + sbuf_clear(id); + if (parse_id(fp, id, l)) + hasid = true; + } + } + sbuf_delete(id); + freelocale(l); + + if (!hasid) { + if (!quiet) + fprintf(stderr, "%s warning: no id keywords in %s\n", + getprogname(), name ? name : "standard input"); + + return (EXIT_FAILURE); + } + + return (EXIT_SUCCESS); +} + +int +main(int argc, char **argv) +{ + bool quiet = false; + int ch, i; + int ret = EXIT_SUCCESS; + FILE *fp; + + while ((ch = getopt(argc, argv, "qV")) != -1) { + switch (ch) { + case 'q': + quiet = true; + break; + case 'V': + /* Do nothing, compat with GNU rcs's ident */ + return (EXIT_SUCCESS); + default: + errx(EXIT_FAILURE, "usage: %s [-q] [-V] [file...]", + getprogname()); + } + } + + argc -= optind; + argv += optind; + + if (argc == 0) + return (scan(stdin, NULL, quiet)); + + for (i = 0; i < argc; i++) { + fp = fopen(argv[i], "r"); + if (fp == NULL) { + warn("%s", argv[i]); + ret = EXIT_FAILURE; + continue; + } + if (scan(fp, argv[i], quiet) != EXIT_SUCCESS) + ret = EXIT_FAILURE; + fclose(fp); + } + + return (ret); +} Added: head/usr.bin/ident/tests/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/ident/tests/Makefile Sun Jul 26 11:21:36 2015 (r285890) @@ -0,0 +1,11 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/usr.bin/ident + +ATF_TESTS_SH= ident +FILES= test.in \ + test.out \ + testnoid +FILESDIR= ${TESTSDIR} + +.include Added: head/usr.bin/ident/tests/ident.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/ident/tests/ident.sh Sun Jul 26 11:21:36 2015 (r285890) @@ -0,0 +1,16 @@ +# $FreeBSD$ + +atf_test_case ident +ident_body() { + atf_check -o file:$(atf_get_srcdir)/test.out \ + ident < $(atf_get_srcdir)/test.in + atf_check -o match:'Foo.*' -s exit:1 \ + -e inline:"ident warning: no id keywords in $(atf_get_srcdir)/testnoid\n" \ + ident $(atf_get_srcdir)/test.in $(atf_get_srcdir)/testnoid + atf_check -o match:'Foo.*' -s exit:1 \ + ident -q $(atf_get_srcdir)/test.in $(atf_get_srcdir)/testnoid +} +atf_init_test_cases() +{ + atf_add_test_case ident +} Added: head/usr.bin/ident/tests/test.in ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/ident/tests/test.in Sun Jul 26 11:21:36 2015 (r285890) @@ -0,0 +1,15 @@ +# tranditional + $Foo: bar $ (OK traditional) + $$Foo: bar $ + $$Fo$o: bar $ + $Fo$o: bar $ + $ Foo : bar $ (WRONG -- NON ALPHANUM BEFORE :) + $ Foo : bar $ (WRONG -- NON ALPHANUM BEFORE :) + $Foo: bar $ (WRONG -- NO SPACE AFTER :) + $Foo:bar $ (WRONG -- NO SPACE AFTER :) + $Foo: bar$ (WRONG -- NO SPACE BEFORE $)) +# Subversion like + $Bar:: baz$ (WRONG -- NO SPACE BEFORE $) + $Bar:: baz $ (OK -- SPACE BEFORE $) + $Qux:: frobby zow#$ (OK -- HASH BEFORE $)' ' + Added: head/usr.bin/ident/tests/test.out ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/ident/tests/test.out Sun Jul 26 11:21:36 2015 (r285890) @@ -0,0 +1,6 @@ + $Foo: bar $ + $Foo: bar $ + $o: bar $ + $o: bar $ + $Bar:: baz $ + $Qux:: frobby zow#$ Added: head/usr.bin/ident/tests/testnoid ============================================================================== From owner-svn-src-all@freebsd.org Sun Jul 26 12:26:00 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C0359A4884; Sun, 26 Jul 2015 12:26:00 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.130]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mout.kundenserver.de", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EDD0583C; Sun, 26 Jul 2015 12:25:59 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from dyn177.linuxhotel.de ([79.228.197.153]) by mrelayeu.kundenserver.de (mreue003) with ESMTPSA (Nemesis) id 0MYrLj-1ZOVnJ20lX-00ViJP; Sun, 26 Jul 2015 14:25:50 +0200 Message-ID: <55B4D1CA.80502@FreeBSD.org> Date: Sun, 26 Jul 2015 14:25:46 +0200 From: Christian Brueffer User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Konstantin Belousov CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r285885 - head/sys/fs/tmpfs References: <201507260833.t6Q8Xlb1023371@repo.freebsd.org> <20150726084132.GM2072@kib.kiev.ua> In-Reply-To: <20150726084132.GM2072@kib.kiev.ua> OpenPGP: id=04D74375648AB688F82157D2A2E0582D3A67DC36; url=http://people.freebsd.org/~brueffer/brueffer.key.asc Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="GFnsjQfM0sik3Jv2uiQ1Q1G5PAA4ccAER" X-Provags-ID: V03:K0:rSWzR3sqji4/1N2IFVxBBxuoW3lxUGPgg8i67WDcUycA09u313R WpJaXy7xrmojeODjswS/8bFLc/BrqpipUtTdqIQjZQWROI3aDqHX5Bi9iPAPuhQbdbVHV0b Yh4eyGbBm2mKGoQXEO6sVEHuHyXjVvNzzpPXvFjI6cbU2th6esoXO88LXMF75sxCwzX6iV3 w2KXZpEzBvTWP3/kj8eOw== X-UI-Out-Filterresults: notjunk:1;V01:K0:byDM+MIegOg=:ZuMhuZa3w8p05dSXKe7Gv/ 1J1ivh/Xo69xXAoyRocjDzWeBkmn/YiUBK8KCbF82X7uQPjKTCKwHuMCG5gJYoJfzrwJtu8lf VFlBn39wZMfvsX9VEZwmxTnhbArwtN1mQp5NmdHoz3Hw8AqCtVIkj1ynNaksum2Cnv/s+sSlh I4jVCNTGwD+qfwmmuBdS9nnXZQ8HcP6yesvphk30zdhz65D5M2628N+WCulUUWJb8P+5Y+rOk lUAtYKYQ6PvCWL+Ss+F173MIjw6jKGHDjvn69J3cxaYss0YUZDrWnxG6wQ7toDLGsF5Y2/GiF VpTtVzsBHcXqtPBeUDYyrD/R8AsQD3ouZU09Abfzbxzd/hr7FQWSXKTn3o2FppnUpjZottXjZ qbyV1Fj7WRHIfmbtm7aT9Wo3rgyi9N69hgtm3hKsbHcYDSIptRvDpuYodTOBS7jFrzeSTe1X/ jEODjEe8QT8DzGZOaHm8JBUCZ1k8bAAMdjm+MYMqi/m59nD0HI9EIW2pxNf1AozN18FMPZgn1 llz/uJvndYlcm5KMdDQ7dL8oiJiA2wrHtg7vlGeopIOjlcqxxy3XXVYP0Bkd/yoPqcM9Y9nj7 NyiTWfJ4k3HFkScMXYXnMJjoTw7XZrGpW+3NUGZtdkKJkCN3Z7ghRFMqki7cdn5+6WV0cjEn/ 0at5TX+b9h8Jpw0YmtJ/xJF4W X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 12:26:00 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --GFnsjQfM0sik3Jv2uiQ1Q1G5PAA4ccAER Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 7/26/15 10:41 AM, Konstantin Belousov wrote: > On Sun, Jul 26, 2015 at 08:33:47AM +0000, Christian Brueffer wrote: >> Author: brueffer >> Date: Sun Jul 26 08:33:46 2015 >> New Revision: 285885 >> URL: https://svnweb.freebsd.org/changeset/base/285885 >> >> Log: >> In tmpfs_chtimes(), remove checks on the nanosecond level when >> determining whether a node changed. > No, these are checks to see if the userspace requested an update to the= > corresponding inode time and supplied valid time. >=20 > I.e. the code change is right, but the commit message is misleading. Ah, sorry for the misunderstanding. I'll do a forced commit to clarify the message later today. Thanks for the help! Chris --GFnsjQfM0sik3Jv2uiQ1Q1G5PAA4ccAER Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQJ8BAEBCgBmBQJVtNHNXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ5QzhCQjQ5MDgzNDUwNjkyOUM5Mjg2NDE3 OEM4MzY5ODQ3RTE2NDg3AAoJEHjINphH4WSHRrkQAJaTSjpo3dV84llW17LCuKKr agK+qT8CZ7XbOlOfX4pJtqyiW7SGDlTdVtJH1BLULtu+OQ6AKCpwWHzNkCl+mBJT r5MbuCMn8Q0eUVCsh+AuVldScK28VDaHqYVy73HRIO5ukcAY2TyY1Y3tjhxRmHMo qStb+pCNZeps0M/T9lyyLlvauDnXJyIT722z7Hev7wrZLgejLWPXwPAPVXgeuWan ZWsZXcFZywaOD6pMpJB7mu9BGo65jrMOlQ+PWFcYsqp7U4CnBGEPOdRERuL7uISd 2pg/jl5udP3pJt/UhuJuXo78w7q0QIYP4UXp3lHPvTa4Tix5eF1Jq7qq/D/D5jzo pwyNKoCBCPsGZI8lw8+bf2VQyqLHT8i+euK+i5p738VCeq2QTwKymoPzOr3dgOKj GRiSBO1DFFGW7FDmi2+T2cFKC9NPqdqeiOD8Jez/ZSBAyFAIjNLsCfPhS0jMfjfV E20HiZkLNvM5b5cqx2WO0cu5SPcVYTd22CQyy3r9w9MwdmskSjSwX1htwkuCIX7/ t2s/TPA5WCE4csW+B9d9uHIKBca7j4B2HF6RWj7ftGsvp9q5a9cWWABAq9qp/afq PeQBHKohnVUay88Bo/m8ezK5mYb6EINkCkZ40chEZXH9+xel0JHdnuRUuHk/buL9 y8Rdv16L3t7GACwI5GAN =wOJe -----END PGP SIGNATURE----- --GFnsjQfM0sik3Jv2uiQ1Q1G5PAA4ccAER-- From owner-svn-src-all@freebsd.org Sun Jul 26 14:46:43 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C6AD9ABF15; Sun, 26 Jul 2015 14:46:43 +0000 (UTC) (envelope-from rodrigc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6CE541E3; Sun, 26 Jul 2015 14:46:43 +0000 (UTC) (envelope-from rodrigc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6QEkhPR083194; Sun, 26 Jul 2015 14:46:43 GMT (envelope-from rodrigc@FreeBSD.org) Received: (from rodrigc@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6QEkhTM083193; Sun, 26 Jul 2015 14:46:43 GMT (envelope-from rodrigc@FreeBSD.org) Message-Id: <201507261446.t6QEkhTM083193@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rodrigc set sender to rodrigc@FreeBSD.org using -f From: Craig Rodrigues Date: Sun, 26 Jul 2015 14:46:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285891 - head/tests/sys/fifo X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 14:46:43 -0000 Author: rodrigc Date: Sun Jul 26 14:46:42 2015 New Revision: 285891 URL: https://svnweb.freebsd.org/changeset/base/285891 Log: Pass unsigned long argument to ioctl(). Eliminates "ioctl sign-extension" warnings. PR: 200896 Modified: head/tests/sys/fifo/fifo_misc.c Modified: head/tests/sys/fifo/fifo_misc.c ============================================================================== --- head/tests/sys/fifo/fifo_misc.c Sun Jul 26 11:21:36 2015 (r285890) +++ head/tests/sys/fifo/fifo_misc.c Sun Jul 26 14:46:42 2015 (r285891) @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -149,7 +150,7 @@ test_truncate(void) } static int -test_ioctl_setclearflag(int fd, int flag, const char *testname, +test_ioctl_setclearflag(int fd, unsigned long flag, const char *testname, const char *fdname, const char *flagname) { int i; From owner-svn-src-all@freebsd.org Sun Jul 26 14:59:07 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D9999AA3A4; Sun, 26 Jul 2015 14:59:07 +0000 (UTC) (envelope-from crodr001@gmail.com) Received: from mail-yk0-x22d.google.com (mail-yk0-x22d.google.com [IPv6:2607:f8b0:4002:c07::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3E44EA40; Sun, 26 Jul 2015 14:59:07 +0000 (UTC) (envelope-from crodr001@gmail.com) Received: by ykay190 with SMTP id y190so51926220yka.3; Sun, 26 Jul 2015 07:59:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:content-type; bh=k5/rCd7vkm9zL6zZs0gSWWnW/gd4gpjYilbx5FBIVGY=; b=nHnz0H/TVm827RFD3lhBqfzXbh6/kILdVEonLUvaDM47Mh9E5XvYhBYP/et+NPNBd7 /1YePhGbNBpI5wRuYikV6MsOpK/Kgr5wNRohaphhK2cpM+SXyeM99elWVkvO4qE1gngL PuRmGSd6lSKGc5pLBRn+0uCoNwiHGgDDjZIf1HXhJXmyw1SdIbWhp7E12T/zSs960N6n OGuoMyFVhZE6twjb6PtKxTVN+R6+bWLnAqoZfIgBmcbIgd2rreSrxJjC/r/if6Z6tYEz VrhzyV2EGKOtMJ/k2Ga8YdrswmaH6tYXhEA4673cm5ulCtdG9ZReuJpzhpQkLGbvbJ40 +uHA== MIME-Version: 1.0 X-Received: by 10.170.36.197 with SMTP id 188mr24270419yke.10.1437922746070; Sun, 26 Jul 2015 07:59:06 -0700 (PDT) Sender: crodr001@gmail.com Received: by 10.37.65.193 with HTTP; Sun, 26 Jul 2015 07:59:06 -0700 (PDT) In-Reply-To: <201507261446.t6QEkhTM083193@repo.freebsd.org> References: <201507261446.t6QEkhTM083193@repo.freebsd.org> Date: Sun, 26 Jul 2015 10:59:06 -0400 X-Google-Sender-Auth: Xsqavd66pcDt-WGUkjtqEP2jjcY Message-ID: Subject: Re: svn commit: r285891 - head/tests/sys/fifo From: Craig Rodrigues To: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 14:59:07 -0000 On Sun, Jul 26, 2015 at 10:46 AM, Craig Rodrigues wrote: > Author: rodrigc > Date: Sun Jul 26 14:46:42 2015 > New Revision: 285891 > URL: https://svnweb.freebsd.org/changeset/base/285891 > > Log: > Pass unsigned long argument to ioctl(). > > Eliminates "ioctl sign-extension" warnings. > > PR: 200896 > > Sponsored by: Essen FreeBSD Hackathon From owner-svn-src-all@freebsd.org Sun Jul 26 16:39:39 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 014C99AB38A; Sun, 26 Jul 2015 16:39:39 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CB202B89; Sun, 26 Jul 2015 16:39:38 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6QGdcZv028992; Sun, 26 Jul 2015 16:39:38 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6QGdcvW028991; Sun, 26 Jul 2015 16:39:38 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201507261639.t6QGdcvW028991@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Sun, 26 Jul 2015 16:39:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285892 - head/sys/dev/proto X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 16:39:39 -0000 Author: marcel Date: Sun Jul 26 16:39:37 2015 New Revision: 285892 URL: https://svnweb.freebsd.org/changeset/base/285892 Log: o make sure the boundary is a power of 2, when not zero. o don't convert 0 to ~0 just so that we can use MIN. ~0 is not a valid boundary. Introduce BNDRY_MIN that deals with 0 values that mean no boundary. Modified: head/sys/dev/proto/proto_busdma.c Modified: head/sys/dev/proto/proto_busdma.c ============================================================================== --- head/sys/dev/proto/proto_busdma.c Sun Jul 26 14:46:42 2015 (r285891) +++ head/sys/dev/proto/proto_busdma.c Sun Jul 26 16:39:37 2015 (r285892) @@ -51,6 +51,9 @@ __FBSDID("$FreeBSD$"); MALLOC_DEFINE(M_PROTO_BUSDMA, "proto_busdma", "DMA management data"); +#define BNDRY_MIN(a, b) \ + (((a) == 0) ? (b) : (((b) == 0) ? (a) : MIN((a), (b)))) + struct proto_callback_bundle { struct proto_busdma *busdma; struct proto_md *md; @@ -63,6 +66,11 @@ proto_busdma_tag_create(struct proto_bus { struct proto_tag *tag; + /* Make sure that when a boundary is specified, it's a power of 2 */ + if (ioc->u.tag.bndry != 0 && + (ioc->u.tag.bndry & (ioc->u.tag.bndry - 1)) != 0) + return (EINVAL); + /* * If nsegs is 1, ignore maxsegsz. What this means is that if we have * just 1 segment, then maxsz should be equal to maxsegsz. To keep it @@ -71,16 +79,12 @@ proto_busdma_tag_create(struct proto_bus if (ioc->u.tag.maxsegsz > ioc->u.tag.maxsz || ioc->u.tag.nsegs == 1) ioc->u.tag.maxsegsz = ioc->u.tag.maxsz; - /* A bndry of 0 really means ~0, or no boundary. */ - if (ioc->u.tag.bndry == 0) - ioc->u.tag.bndry = ~0U; - tag = malloc(sizeof(*tag), M_PROTO_BUSDMA, M_WAITOK | M_ZERO); if (parent != NULL) { tag->parent = parent; LIST_INSERT_HEAD(&parent->children, tag, peers); tag->align = MAX(ioc->u.tag.align, parent->align); - tag->bndry = MIN(ioc->u.tag.bndry, parent->bndry); + tag->bndry = BNDRY_MIN(ioc->u.tag.bndry, parent->bndry); tag->maxaddr = MIN(ioc->u.tag.maxaddr, parent->maxaddr); tag->maxsz = MIN(ioc->u.tag.maxsz, parent->maxsz); tag->maxsegsz = MIN(ioc->u.tag.maxsegsz, parent->maxsegsz); From owner-svn-src-all@freebsd.org Sun Jul 26 16:40:52 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 508E69AB49B; Sun, 26 Jul 2015 16:40:52 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3DA88D8D; Sun, 26 Jul 2015 16:40:52 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6QGeq4f032137; Sun, 26 Jul 2015 16:40:52 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6QGeqcA032136; Sun, 26 Jul 2015 16:40:52 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201507261640.t6QGeqcA032136@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Sun, 26 Jul 2015 16:40:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285893 - head/tools/bus_space X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 16:40:52 -0000 Author: marcel Date: Sun Jul 26 16:40:51 2015 New Revision: 285893 URL: https://svnweb.freebsd.org/changeset/base/285893 Log: Remove debugging output. We should have tracing instead. Modified: head/tools/bus_space/busdma.c Modified: head/tools/bus_space/busdma.c ============================================================================== --- head/tools/bus_space/busdma.c Sun Jul 26 16:39:37 2015 (r285892) +++ head/tools/bus_space/busdma.c Sun Jul 26 16:40:51 2015 (r285893) @@ -33,7 +33,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -348,10 +347,6 @@ bd_md_load(int mdid, void *buf, u_long l if (ioctl(md->fd, PROTO_IOC_BUSDMA, &ioc) == -1) return (errno); - printf("XXX: %s: phys(%d, %#lx), bus(%d, %#lx)\n", __func__, - ioc.u.md.phys_nsegs, ioc.u.md.phys_addr, - ioc.u.md.bus_nsegs, ioc.u.md.bus_addr); - error = bd_md_add_seg(md, BUSDMA_MD_VIRT, ioc.u.md.virt_addr, len); error = bd_md_add_seg(md, BUSDMA_MD_PHYS, ioc.u.md.phys_addr, len); error = bd_md_add_seg(md, BUSDMA_MD_BUS, ioc.u.md.bus_addr, len); @@ -412,10 +407,6 @@ bd_mem_alloc(int tid, u_int flags) tag->refcnt++; md->key = ioc.result; - printf("XXX: %s: phys(%d, %#lx), bus(%d, %#lx)\n", __func__, - ioc.u.md.phys_nsegs, ioc.u.md.phys_addr, - ioc.u.md.bus_nsegs, ioc.u.md.bus_addr); - /* XXX we need to support multiple segments */ assert(ioc.u.md.phys_nsegs == 1); assert(ioc.u.md.bus_nsegs == 1); From owner-svn-src-all@freebsd.org Sun Jul 26 17:57:37 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C6569AB256; Sun, 26 Jul 2015 17:57:37 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E3F20E23; Sun, 26 Jul 2015 17:57:36 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6QHva3H070179; Sun, 26 Jul 2015 17:57:36 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6QHvaJG070178; Sun, 26 Jul 2015 17:57:36 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507261757.t6QHvaJG070178@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Sun, 26 Jul 2015 17:57:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285894 - head/release/doc/en_US.ISO8859-1/relnotes stable/10/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 17:57:37 -0000 Author: gjb Date: Sun Jul 26 17:57:35 2015 New Revision: 285894 URL: https://svnweb.freebsd.org/changeset/base/285894 Log: Further refine the PAE_TABLES entry, based on feedback from alc. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Changes in other areas also in this revision: Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jul 26 16:40:51 2015 (r285893) +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jul 26 17:57:35 2015 (r285894) @@ -353,13 +353,16 @@ The PAE_TABLES kernel configuration option has been added for &os;/&arch.i386;, which instructs &man.pmap.9; - to use PAE format for page tables with - 32-bit physical addresses. Unlike the PAE - option, PAE_TABLES preserves kernel binary - interface (KBI) compatibility with - non-PAE kernels, allowing - non-PAE kernel modules and drivers to work - with a PAE_TABLES-enabled kernel. + to use PAE format for page tables while + maintaining a 32-bit physical address size elsewhere in the + kernel. The use of this option can enhance application-level + security by enabling the creation of no execute + mappings on modern &arch.i386; processors. Unlike the + PAE option, PAE_TABLES + preserves kernel binary interface (KBI) + compatibility with non-PAE kernels, + allowing non-PAE kernel modules and drivers + to work with a PAE_TABLES-enabled kernel. Additionally, system limits are tuned for 4GB maximum RAM, avoiding kernel virtual address space (KVA) exhaustion. From owner-svn-src-all@freebsd.org Sun Jul 26 17:57:37 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6F859AB25D; Sun, 26 Jul 2015 17:57:37 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7CB08E24; Sun, 26 Jul 2015 17:57:37 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6QHvb8l070189; Sun, 26 Jul 2015 17:57:37 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6QHvbt2070188; Sun, 26 Jul 2015 17:57:37 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507261757.t6QHvbt2070188@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Sun, 26 Jul 2015 17:57:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285894 - head/release/doc/en_US.ISO8859-1/relnotes stable/10/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 17:57:37 -0000 Author: gjb Date: Sun Jul 26 17:57:35 2015 New Revision: 285894 URL: https://svnweb.freebsd.org/changeset/base/285894 Log: Further refine the PAE_TABLES entry, based on feedback from alc. Sponsored by: The FreeBSD Foundation Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml Changes in other areas also in this revision: Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- head/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jul 26 16:40:51 2015 (r285893) +++ head/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jul 26 17:57:35 2015 (r285894) @@ -803,13 +803,16 @@ The PAE_TABLES kernel configuration option has been added for &os;/&arch.i386;, which instructs &man.pmap.9; - to use PAE format for page tables with - 32-bit physical addresses. Unlike the PAE - option, PAE_TABLES preserves kernel binary - interface (KBI) compatibility with - non-PAE kernels, allowing - non-PAE kernel modules and drivers to work - with a PAE_TABLES-enabled kernel. + to use PAE format for page tables while + maintaining a 32-bit physical address size elsewhere in the + kernel. The use of this option can enhance application-level + security by enabling the creation of no execute + mappings on modern &arch.i386; processors. Unlike the + PAE option, PAE_TABLES + preserves kernel binary interface (KBI) + compatibility with non-PAE kernels, + allowing non-PAE kernel modules and drivers + to work with a PAE_TABLES-enabled kernel. Additionally, system limits are tuned for 4GB maximum RAM, avoiding kernel virtual address space (KVA) exhaustion. From owner-svn-src-all@freebsd.org Sun Jul 26 17:57:54 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3002B9AB2CA; Sun, 26 Jul 2015 17:57:54 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0737210A4; Sun, 26 Jul 2015 17:57:54 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6QHvrYi070303; Sun, 26 Jul 2015 17:57:53 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6QHvrBW070302; Sun, 26 Jul 2015 17:57:53 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507261757.t6QHvrBW070302@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Sun, 26 Jul 2015 17:57:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r285895 - releng/10.2/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 17:57:54 -0000 Author: gjb Date: Sun Jul 26 17:57:53 2015 New Revision: 285895 URL: https://svnweb.freebsd.org/changeset/base/285895 Log: Further refine the PAE_TABLES entry, based on feedback from alc. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jul 26 17:57:35 2015 (r285894) +++ releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jul 26 17:57:53 2015 (r285895) @@ -353,13 +353,16 @@ The PAE_TABLES kernel configuration option has been added for &os;/&arch.i386;, which instructs &man.pmap.9; - to use PAE format for page tables with - 32-bit physical addresses. Unlike the PAE - option, PAE_TABLES preserves kernel binary - interface (KBI) compatibility with - non-PAE kernels, allowing - non-PAE kernel modules and drivers to work - with a PAE_TABLES-enabled kernel. + to use PAE format for page tables while + maintaining a 32-bit physical address size elsewhere in the + kernel. The use of this option can enhance application-level + security by enabling the creation of no execute + mappings on modern &arch.i386; processors. Unlike the + PAE option, PAE_TABLES + preserves kernel binary interface (KBI) + compatibility with non-PAE kernels, + allowing non-PAE kernel modules and drivers + to work with a PAE_TABLES-enabled kernel. Additionally, system limits are tuned for 4GB maximum RAM, avoiding kernel virtual address space (KVA) exhaustion. From owner-svn-src-all@freebsd.org Sun Jul 26 19:47:03 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7F659ABF22; Sun, 26 Jul 2015 19:47:03 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B8BE91B1F; Sun, 26 Jul 2015 19:47:03 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6QJl3XF032354; Sun, 26 Jul 2015 19:47:03 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6QJl3ei032353; Sun, 26 Jul 2015 19:47:03 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507261947.t6QJl3ei032353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Sun, 26 Jul 2015 19:47:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285896 - head/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 19:47:03 -0000 Author: gjb Date: Sun Jul 26 19:47:02 2015 New Revision: 285896 URL: https://svnweb.freebsd.org/changeset/base/285896 Log: Document r285679, bsdinstall(8) updates to workaround various problematic BIOSes when booting from GPT, and partition scheme selection in the UFS partition menu. Sponsored by: The FreeBSD Foundation Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- head/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jul 26 17:57:53 2015 (r285895) +++ head/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jul 26 19:47:02 2015 (r285896) @@ -540,6 +540,19 @@ The &man.bsdinstall.8; utility has been updated to use the new &man.dpv.3; library to display progress when extracting the &os; distributions. + + Support for detecting and implementing + a workaround for various laptops and motherboards that do not + boot properly from GPT-partitioned disks + has been added to &man.bsdinstall.8;. Additionally, the + active flag will be set on the partition + when needed. + + Support for selecting the partitioning + scheme when installing on the UFS + filesystem has been added to &man.bsdinstall.8;. From owner-svn-src-all@freebsd.org Sun Jul 26 19:47:06 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB7F79ABF4E; Sun, 26 Jul 2015 19:47:06 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB7341B22; Sun, 26 Jul 2015 19:47:06 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6QJl628032400; Sun, 26 Jul 2015 19:47:06 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6QJl6Ji032398; Sun, 26 Jul 2015 19:47:06 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507261947.t6QJl6Ji032398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Sun, 26 Jul 2015 19:47:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285897 - in head/release/doc: en_US.ISO8859-1/relnotes share/xml X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 19:47:07 -0000 Author: gjb Date: Sun Jul 26 19:47:05 2015 New Revision: 285897 URL: https://svnweb.freebsd.org/changeset/base/285897 Log: Document r285642, ssh(1) hostname canonicalization before looking for the host in known_hosts. Add Dell, Inc. to sponsors.ent. Sponsored by: The FreeBSD Foundation Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml head/release/doc/share/xml/sponsor.ent Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- head/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jul 26 19:47:02 2015 (r285896) +++ head/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jul 26 19:47:05 2015 (r285897) @@ -511,6 +511,11 @@ OpenSSL has been updated to version 1.0.1p. + + The + &man.ssh.1; utility has been updated to re-implement hostname + canonicalization before locating the host in + known_hosts. Modified: head/release/doc/share/xml/sponsor.ent ============================================================================== --- head/release/doc/share/xml/sponsor.ent Sun Jul 26 19:47:02 2015 (r285896) +++ head/release/doc/share/xml/sponsor.ent Sun Jul 26 19:47:05 2015 (r285897) @@ -19,6 +19,7 @@ + From owner-svn-src-all@freebsd.org Sun Jul 26 19:47:10 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2028A9ABF5E; Sun, 26 Jul 2015 19:47:10 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 860C51BCA; Sun, 26 Jul 2015 19:47:09 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6QJl91o032448; Sun, 26 Jul 2015 19:47:09 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6QJl941032447; Sun, 26 Jul 2015 19:47:09 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507261947.t6QJl941032447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Sun, 26 Jul 2015 19:47:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285898 - head/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 19:47:10 -0000 Author: gjb Date: Sun Jul 26 19:47:08 2015 New Revision: 285898 URL: https://svnweb.freebsd.org/changeset/base/285898 Log: Document r285557, bsdinstall aligns zfs partitions on 1Mb boundaries. Sponsored by: The FreeBSD Foundation Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- head/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jul 26 19:47:05 2015 (r285897) +++ head/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jul 26 19:47:08 2015 (r285898) @@ -546,6 +546,11 @@ updated to use the new &man.dpv.3; library to display progress when extracting the &os; distributions. + Support for detecting and implementing + aligning partitions on 1Mb boundaries has been added to + &man.bsdinstall.8;. + Support for detecting and implementing a workaround for various laptops and motherboards that do not From owner-svn-src-all@freebsd.org Sun Jul 26 19:47:40 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 006CA9ABFCB; Sun, 26 Jul 2015 19:47:40 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D87D31F0C; Sun, 26 Jul 2015 19:47:39 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6QJld4w032552; Sun, 26 Jul 2015 19:47:39 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6QJldJU032551; Sun, 26 Jul 2015 19:47:39 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507261947.t6QJldJU032551@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Sun, 26 Jul 2015 19:47:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r285899 - releng/10.2/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 19:47:40 -0000 Author: gjb Date: Sun Jul 26 19:47:38 2015 New Revision: 285899 URL: https://svnweb.freebsd.org/changeset/base/285899 Log: Document r273838, PLPMTUD blackhole detection (RFC 4821). Submitted by: sbruno Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jul 26 19:47:08 2015 (r285898) +++ releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jul 26 19:47:38 2015 (r285899) @@ -730,7 +730,80 @@ Network Procols -   + Support for PLPMTUD + blackhole detection (RFC 4821) has been + added to the &man.tcp.4; stack, disabled by default. New + control tunables have been added: + + + + + + + + Tunable + Description + + + + + + net.inet.tcp.pmtud_blackhole_detection + Enables or disables PLPMTUD + blackhole detection + + + + net.inet.tcp.pmtud_blackhole_mss + MSS to try for IPv4 + + + + net.inet.tcp.v6pmtud_blackhole_mss + MSS to try for IPv6 + + + + + + New monitoring &man.sysctl.8;s haven been added: + + + + + + + + Tunable + Description + + + + + + net.inet.tcp.pmtud_blackhole_activated + Number of times the code was activated to attempt + downshifting the MSS + + + + net.inet.tcp.pmtud_blackhole_min_activated + Number of times the blackhole + MSS was used in an attempt to + downshift + + + + net.inet.tcp.pmtud_blackhole_failed + Number of times that the blackhole failed to + connect after downshifting the + MSS + + + + + From owner-svn-src-all@freebsd.org Sun Jul 26 19:47:45 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A38499AB01D; Sun, 26 Jul 2015 19:47:45 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4D4E91FB1; Sun, 26 Jul 2015 19:47:45 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6QJljAb032646; Sun, 26 Jul 2015 19:47:45 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6QJli2J032644; Sun, 26 Jul 2015 19:47:44 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507261947.t6QJli2J032644@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Sun, 26 Jul 2015 19:47:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r285901 - in releng/10.2/release/doc: en_US.ISO8859-1/relnotes share/xml X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 19:47:45 -0000 Author: gjb Date: Sun Jul 26 19:47:43 2015 New Revision: 285901 URL: https://svnweb.freebsd.org/changeset/base/285901 Log: Document r285750, ssh(1) hostname canonicalization before looking for the host in known_hosts. Add Dell, Inc. to sponsors.ent. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml releng/10.2/release/doc/share/xml/sponsor.ent Modified: releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jul 26 19:47:41 2015 (r285900) +++ releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jul 26 19:47:43 2015 (r285901) @@ -269,6 +269,11 @@ The ntp suite has been updated to version 4.2.8p3. + + The + &man.ssh.1; utility has been updated to re-implement hostname + canonicalization before locating the host in + known_hosts. Modified: releng/10.2/release/doc/share/xml/sponsor.ent ============================================================================== --- releng/10.2/release/doc/share/xml/sponsor.ent Sun Jul 26 19:47:41 2015 (r285900) +++ releng/10.2/release/doc/share/xml/sponsor.ent Sun Jul 26 19:47:43 2015 (r285901) @@ -15,6 +15,7 @@ + From owner-svn-src-all@freebsd.org Sun Jul 26 19:47:42 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 45A109ABFE9; Sun, 26 Jul 2015 19:47:42 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 33E511F0D; Sun, 26 Jul 2015 19:47:42 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6QJlgpH032597; Sun, 26 Jul 2015 19:47:42 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6QJlgU2032596; Sun, 26 Jul 2015 19:47:42 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507261947.t6QJlgU2032596@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Sun, 26 Jul 2015 19:47:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r285900 - releng/10.2/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 19:47:42 -0000 Author: gjb Date: Sun Jul 26 19:47:41 2015 New Revision: 285900 URL: https://svnweb.freebsd.org/changeset/base/285900 Log: Document r285769, bsdinstall(8) updates to workaround various problematic BIOSes when booting from GPT, and partition scheme selection in the UFS partition menu. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jul 26 19:47:38 2015 (r285899) +++ releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jul 26 19:47:41 2015 (r285900) @@ -274,7 +274,18 @@ Installation and Configuration Tools -   + Support for detecting and implementing + a workaround for various laptops and motherboards that do not + boot properly from GPT-partitioned disks + has been added to &man.bsdinstall.8;. Additionally, the + active flag will be set on the partition + when needed. + + Support for selecting the partitioning + scheme when installing on the UFS + filesystem has been added to &man.bsdinstall.8;. From owner-svn-src-all@freebsd.org Sun Jul 26 19:47:48 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E964F9AB03D; Sun, 26 Jul 2015 19:47:47 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C649BE4; Sun, 26 Jul 2015 19:47:47 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6QJllPY032691; Sun, 26 Jul 2015 19:47:47 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6QJllZJ032690; Sun, 26 Jul 2015 19:47:47 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507261947.t6QJllZJ032690@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Sun, 26 Jul 2015 19:47:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r285902 - releng/10.2/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 19:47:48 -0000 Author: gjb Date: Sun Jul 26 19:47:46 2015 New Revision: 285902 URL: https://svnweb.freebsd.org/changeset/base/285902 Log: Document r285721, bsdinstall aligns zfs partitions on 1Mb boundaries. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jul 26 19:47:43 2015 (r285901) +++ releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml Sun Jul 26 19:47:46 2015 (r285902) @@ -287,6 +287,11 @@ active flag will be set on the partition when needed. + Support for detecting and implementing + aligning partitions on 1Mb boundaries has been added to + &man.bsdinstall.8;. + Support for selecting the partitioning scheme when installing on the UFS From owner-svn-src-all@freebsd.org Sun Jul 26 20:32:53 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D34879ABB30 for ; Sun, 26 Jul 2015 20:32:53 +0000 (UTC) (envelope-from scott4long@yahoo.com) Received: from nm8-vm8.bullet.mail.gq1.yahoo.com (nm8-vm8.bullet.mail.gq1.yahoo.com [98.136.218.231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A3604EC4 for ; Sun, 26 Jul 2015 20:32:53 +0000 (UTC) (envelope-from scott4long@yahoo.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1437942448; bh=o0NaeW+7oMfRCSx+/IjLDi4J6CD3H2J1ULOyIr4pc7k=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From:Subject; b=uXwLnH7YkrhceELrM7U1WDjMy972kR66pas/7A8O+4zYxHljGGcaVM7uhnsnxfySqsECT3qA3aKeQIEGLrHtNCf6dcsgnTYUbsPC3lF5an/oKrXAtEp/sFLE7+sPbHuryKPkRQTRSxHu7aG/pzmRUfRMrGpMGhXN/pN0IGzUMxLkf8Le9CrPu9r1sQfiIYJ/U1aP+KRoon67YkYcgdeRxVD595HxDgk+tySLN7irkroqbeXlTePHW4IHDvtTZrb9/QXD0NQV6dOp9xg44CwIHoQLFExHHObJu5NbWO4HqmEfwC2Z30xMMtUSo9HuV7UMy5PQiRMjmW5tS0qfiHKEkQ== Received: from [98.137.12.56] by nm8.bullet.mail.gq1.yahoo.com with NNFMP; 26 Jul 2015 20:27:28 -0000 Received: from [98.136.164.70] by tm1.bullet.mail.gq1.yahoo.com with NNFMP; 26 Jul 2015 20:27:28 -0000 Received: from [127.0.0.1] by smtp232.mail.gq1.yahoo.com with NNFMP; 26 Jul 2015 20:27:28 -0000 X-Yahoo-Newman-Id: 199026.83405.bm@smtp232.mail.gq1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: hns4q8UVM1myh0oaaA3p.GrECySS5IGGa51tlA8F.BNYNW. 5cQqYX4TwqgbXyWaR4.doKDESKMODGn.SPx5V7tQuweIyHeFWNOpCu1XB4RI 5hVt2m0rNgj3gy8QbKz9UZibfSPW.bRfqeleFkZe8RAPpdhGvGDd02IE92qO mBVJsyg1hFARRkR6AxQxGf4SzdUChbR9hotfMjIErbCrj9sMS40bj8ljMAvu YX5cY0TJuno3uHvHVVCl3jjajVjR7AzOsa7mDWJVruuvHAdTHSU_DuDrB2vc bUPE0veh6lJroCPDFJJjI41CC6R0F6hiNya10T1bJGr4fmukS2Yu7iEfFCEX L.OV6lNg6roA3.BLMGU9dHp1BRWD7wJLmebFnFSUA_wA315WZM9Entcd17yz sGvXF00bI7Pr_ZDR4qk3lwwRy8AW43xHRuugP4vXnf7awhLEPiM0WO0Fjitz nXMsiSfpwu_ky2c7x.Bi0iADD0tOQ9RwhzJcDfa12Bigfr7bcjiVmq7oc2Zg 1T2vAL3EJnhXqkHIDOXX34a_40aJOt.LtlDQ0YsfT X-Yahoo-SMTP: clhABp.swBB7fs.LwIJpv3jkWgo2NU8- Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) Subject: Re: svn commit: r284297 - in head: cddl/contrib/opensolaris/cmd/lockstat sys/kern sys/sys From: Scott Long In-Reply-To: <201506121001.t5CA1PTm089721@svn.freebsd.org> Date: Sun, 26 Jul 2015 14:27:25 -0600 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: References: <201506121001.t5CA1PTm089721@svn.freebsd.org> To: Andriy Gapon X-Mailer: Apple Mail (2.2098) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 20:32:53 -0000 > On Jun 12, 2015, at 4:01 AM, Andriy Gapon wrote: > > Author: avg > Date: Fri Jun 12 10:01:24 2015 > New Revision: 284297 > URL: https://svnweb.freebsd.org/changeset/base/284297 > > Log: > several lockstat improvements > > 0. For spin events report time spent spinning, not a loop count. > While loop count is much easier and cheaper to obtain it is hard > to reason about the reported numbers, espcially for adaptive locks > where both spinning and sleeping can happen. > So, it's better to compare apples and apples. > This causes spinning to be exceptionally more expensive just by having KDTRACE_HOOKS enabled, whether or not Dtrace is actually in use. It makes it undesirable to deploy with Dtrace by default since it impacts performance. Is there a way to make the expensive collection optional, or only enable when dtrace is using the lockstat module? Also have you seen the other recent performance complaint related to this commit? Thanks, Scott From owner-svn-src-all@freebsd.org Sun Jul 26 20:49:53 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C94C39ABE40; Sun, 26 Jul 2015 20:49:53 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wi0-x232.google.com (mail-wi0-x232.google.com [IPv6:2a00:1450:400c:c05::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5EB3D1546; Sun, 26 Jul 2015 20:49:53 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by wicgb10 with SMTP id gb10so87040252wic.1; Sun, 26 Jul 2015 13:49:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=k9ZxcsQhPZO7L1pxyBO38jq4rf9M88he0wH8gGs2wG4=; b=067bOE3DmhqwIwgqV3YLSVT6Mn5clT1kTmfwZSV5COpw9rHbm4ZImolIHbNcTZ/pQ9 HJzgN30VwFfVdnQO8aBK6JAIo4KO5IXmqj1Nbct+bz+fhex41D0LaqsHMFPmpNB/l1fZ mOqTMf4xOasKBADly5yGct8YMQ5P075kBcTKWcAlaUBPBgwja85pQkBM6WTtwTKuv2hO PVSJ75cK+r7K6Tytlje/0fWUg4C1/pJafuy/uA/tw17mwKsCTLVbn6aPIP0nS39J2adp akpvlvyHkkpJ2jgOtsra9lzjTE0WDU/W3hXexFUao8FXJCOi9dwzZ+EWDDJSXZhZc+iJ /RBg== X-Received: by 10.180.81.103 with SMTP id z7mr16548078wix.21.1437943791515; Sun, 26 Jul 2015 13:49:51 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id s1sm9962484wix.13.2015.07.26.13.49.50 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Jul 2015 13:49:50 -0700 (PDT) Sender: Baptiste Daroussin Date: Sun, 26 Jul 2015 22:49:48 +0200 From: Baptiste Daroussin To: "Simon J. Gerraty" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r284345 - in head: . bin/cat bin/chflags bin/chio bin/chmod bin/cp bin/csh bin/date bin/dd bin/df bin/domainname bin/echo bin/ed bin/expr bin/freebsd-version bin/getfacl bin/hostname bi... Message-ID: <20150726204948.GD1522@ivaldir.etoilebsd.net> References: <201506131920.t5DJKwMH033508@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="eqp4TxRxnD4KrmFZ" Content-Disposition: inline In-Reply-To: <201506131920.t5DJKwMH033508@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 20:49:53 -0000 --eqp4TxRxnD4KrmFZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jun 13, 2015 at 07:20:58PM +0000, Simon J. Gerraty wrote: > Author: sjg > Date: Sat Jun 13 19:20:56 2015 > New Revision: 284345 > URL: https://svnweb.freebsd.org/changeset/base/284345 >=20 > Log: > Add META_MODE support. > =20 > Off by default, build behaves normally. > WITH_META_MODE we get auto objdir creation, the ability to > start build from anywhere in the tree. > =20 > Still need to add real targets under targets/ to build packages. > =20 > Differential Revision: D2796 > Reviewed by: brooks imp This breaks using fmake from ports because of usage of :U in sys.mk fmake has to be supported until 9 is EOLed otherwise this is a major pain f= or all developers, having the ability to use fmake allows people to ensure syn= tax is compatible with FreeBSD 9 (not that I'm just speaking about sys.mk not o= ther parts) Best regards, Bapt --eqp4TxRxnD4KrmFZ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlW1R+wACgkQ8kTtMUmk6ExLuQCfYEiXcY+rHbeds3jOCpSo1wGU WCAAoLiqvANj4Y6yx9hzjwYOqu3UnaSi =8xLh -----END PGP SIGNATURE----- --eqp4TxRxnD4KrmFZ-- From owner-svn-src-all@freebsd.org Sun Jul 26 21:37:34 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F84B99C0B3; Sun, 26 Jul 2015 21:37:34 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7AC4CED; Sun, 26 Jul 2015 21:37:34 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6QLbYCC084095; Sun, 26 Jul 2015 21:37:34 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6QLbWrw084088; Sun, 26 Jul 2015 21:37:32 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201507262137.t6QLbWrw084088@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Sun, 26 Jul 2015 21:37:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285903 - in head/tools/bus_space: . C Python X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 21:37:34 -0000 Author: marcel Date: Sun Jul 26 21:37:31 2015 New Revision: 285903 URL: https://svnweb.freebsd.org/changeset/base/285903 Log: Change the dev argument from a full path to just the device identification (e.g. isa:0x3f0 or pci0:2:1:0). In libbus, the device is turned into a path name. For bus_space_map(), the resource is now specified in a second argument. Before: bus.map('/dev/proto/pci0:2:1:0/pcicfg') busdma.tag_create('/dev/proto/pci0:2:1:0/busdma', ...) Now: bus.map('pci0:2:1:0', 'pcicfg') busdma.tag_create('pci0:2:1:0', ...) Modified: head/tools/bus_space/C/lang.c head/tools/bus_space/C/libbus.h head/tools/bus_space/Python/lang.c head/tools/bus_space/bus.c head/tools/bus_space/bus.h head/tools/bus_space/busdma.c Modified: head/tools/bus_space/C/lang.c ============================================================================== --- head/tools/bus_space/C/lang.c Sun Jul 26 19:47:46 2015 (r285902) +++ head/tools/bus_space/C/lang.c Sun Jul 26 21:37:31 2015 (r285903) @@ -80,10 +80,10 @@ bus_write_4(int rid, long ofs, uint32_t } int -bus_map(const char *dev) +bus_map(const char *dev, const char *resource) { - return (bs_map(dev)); + return (bs_map(dev, resource)); } int Modified: head/tools/bus_space/C/libbus.h ============================================================================== --- head/tools/bus_space/C/libbus.h Sun Jul 26 19:47:46 2015 (r285902) +++ head/tools/bus_space/C/libbus.h Sun Jul 26 21:37:31 2015 (r285903) @@ -29,7 +29,7 @@ #ifndef _LIBBUS_SPACE_H_ #define _LIBBUS_SPACE_H_ -int bus_map(const char *dev); +int bus_map(const char *dev, const char *resource); int16_t bus_read_1(int rid, long ofs); int32_t bus_read_2(int rid, long ofs); int64_t bus_read_4(int rid, long ofs); Modified: head/tools/bus_space/Python/lang.c ============================================================================== --- head/tools/bus_space/Python/lang.c Sun Jul 26 19:47:46 2015 (r285902) +++ head/tools/bus_space/Python/lang.c Sun Jul 26 21:37:31 2015 (r285903) @@ -131,12 +131,12 @@ bus_write_4(PyObject *self, PyObject *ar static PyObject * bus_map(PyObject *self, PyObject *args) { - char *dev; + char *dev, *resource; int rid; - if (!PyArg_ParseTuple(args, "s", &dev)) + if (!PyArg_ParseTuple(args, "ss", &dev, &resource)) return (NULL); - rid = bs_map(dev); + rid = bs_map(dev, resource); if (rid == -1) { PyErr_SetString(PyExc_IOError, strerror(errno)); return (NULL); Modified: head/tools/bus_space/bus.c ============================================================================== --- head/tools/bus_space/bus.c Sun Jul 26 19:47:46 2015 (r285902) +++ head/tools/bus_space/bus.c Sun Jul 26 21:37:31 2015 (r285903) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -92,19 +93,25 @@ rid_lookup(int rid) } int -bs_map(const char *dev) +bs_map(const char *dev, const char *res) { + char path[PATH_MAX]; struct proto_ioc_region region; struct resource *r; - int rid; + int len, rid; + len = snprintf(path, PATH_MAX, "/dev/proto/%s/%s", dev, res); + if (len >= PATH_MAX) { + errno = EINVAL; + return (-1); + } rid = rid_alloc(); if (rid == -1) return (-1); r = rid_lookup(rid); if (r == NULL) return (-1); - r->fd = open(dev, O_RDWR); + r->fd = open(path, O_RDWR); if (r->fd == -1) return (-1); r->rid = -1; Modified: head/tools/bus_space/bus.h ============================================================================== --- head/tools/bus_space/bus.h Sun Jul 26 19:47:46 2015 (r285902) +++ head/tools/bus_space/bus.h Sun Jul 26 21:37:31 2015 (r285903) @@ -29,7 +29,7 @@ #ifndef _TOOLS_BUS_SPACE_H_ #define _TOOLS_BUS_SPACE_H_ -int bs_map(const char *dev); +int bs_map(const char *dev, const char *res); int bs_read(int rid, off_t ofs, void *buf, ssize_t bufsz); int bs_subregion(int rid0, long ofs, long sz); int bs_unmap(int rid); Modified: head/tools/bus_space/busdma.c ============================================================================== --- head/tools/bus_space/busdma.c Sun Jul 26 19:47:46 2015 (r285902) +++ head/tools/bus_space/busdma.c Sun Jul 26 21:37:31 2015 (r285903) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -183,10 +184,16 @@ int bd_tag_create(const char *dev, u_long align, u_long bndry, u_long maxaddr, u_long maxsz, u_int nsegs, u_long maxsegsz, u_int datarate, u_int flags) { + char path[PATH_MAX]; struct obj *tag; - int fd; + int fd, len; - fd = open(dev, O_RDWR); + len = snprintf(path, PATH_MAX, "/dev/proto/%s/busdma", dev); + if (len >= PATH_MAX) { + errno = EINVAL; + return (-1); + } + fd = open(path, O_RDWR); if (fd == -1) return (-1); From owner-svn-src-all@freebsd.org Sun Jul 26 23:17:55 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F2E89AB58D for ; Sun, 26 Jul 2015 23:17:55 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 31168EC4 for ; Sun, 26 Jul 2015 23:17:55 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.84 (FreeBSD)) (envelope-from ) id 1ZJVAv-000OvN-GG; Mon, 27 Jul 2015 02:17:45 +0300 Date: Mon, 27 Jul 2015 02:17:45 +0300 From: Slawa Olhovchenkov To: kpneal@pobox.com Cc: svn-src-all@freebsd.org Subject: Re: svn commit: r284959 - in head: . share/man/man4 share/man/man9 sys/conf sys/dev/glxsb sys/dev/hifn sys/dev/random sys/dev/rndtest sys/dev/safe sys/dev/syscons sys/dev/ubsec sys/dev/virtio/random sy... Message-ID: <20150726231745.GV44094@zxy.spb.ru> References: <20150724012519.GE78154@funkthat.com> <96EA33AB-7325-4DD2-83F4-B4FAF6F47CB5@yahoo.com> <20150725085209.GI43740@zxy.spb.ru> <20150726230137.GB66594@neutralgood.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150726230137.GB66594@neutralgood.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2015 23:17:55 -0000 On Sun, Jul 26, 2015 at 07:01:37PM -0400, kpneal@pobox.com wrote: > On Sat, Jul 25, 2015 at 11:52:09AM +0300, Slawa Olhovchenkov wrote: > > On Fri, Jul 24, 2015 at 11:06:59PM -0600, Scott Long via svn-src-all wrote: > > > > > > I'm working on a premise of "tools, not policy". I'd like there to be > > > > enough harvesting points for the box owner to get the warm fuzzies. > > > > If they choose to use less, fine by me. > > > > > > > > > > Sure, and that's not an unreasonable goal, but the devil is in the details. > > > It's an unfortunate fact of modern CPU architecture that even something > > > as simple and innocent as a run-time control that checks a variable can > > > cause significant performance problems, thanks to the penalty of cache > > > misses and bus contention between lots of CPU cores. Maybe these > > > "extended" collection points should be controlled with a compile-time > > > option? > > > > I am hate compile-time option, may be time to introduction some JIT in > > project? As global feature. > > I agree with your dislike of compile-time options, and this is especially > true in the OS itself. > > However, a JIT is rather large, and is a rather large effort as well. A > JIT in the kernel would scare the heck out of me because ensuring it didn't > have exploitable security issues would be a lost cause. You could have the > kernel call out to a userland JIT that created (re)loadable modules, but > you'd need to have the source either in kernel, or you'd need to be certain > that all the relevant source was installed. > > Simpler JITs could be written, but that is a large amount of effort for > generated code that wouldn't be as good as the system compiler's code. > > Heck, I ported a 31-bit (yes, thirty-one) JIT for MVS to 64-bit z/OS (modern > MVS), working full time, and it still took me two and a half years to > finish it. For some purpose may be enough some limited, very specific JIT. For example, BPF have JIT as option. 'JIT for options' may be working just as in-place patching (replace call by nops), as example. From owner-svn-src-all@freebsd.org Mon Jul 27 00:28:52 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2EA59AA4E2; Mon, 27 Jul 2015 00:28:52 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 886C4C24; Mon, 27 Jul 2015 00:28:52 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6R0Sqqu052540; Mon, 27 Jul 2015 00:28:52 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6R0Sq6D052539; Mon, 27 Jul 2015 00:28:52 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201507270028.t6R0Sq6D052539@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Mon, 27 Jul 2015 00:28:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285904 - stable/10/sys/fs/nfsclient X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jul 2015 00:28:52 -0000 Author: rmacklem Date: Mon Jul 27 00:28:51 2015 New Revision: 285904 URL: https://svnweb.freebsd.org/changeset/base/285904 Log: MFC: r285066 Alex Burlyga reported a POLA violation for the new NFS client as compared to the old NFS client via email to the freebsd-fs@ mailing list. For the new client, when multiple clients attempted to create a symbolic link concurrently, more that one client would report success instead of EEXIST. This was caused by code in the new client that mapped EEXIST to OK assuming it was caused by a retried RPC request. Since the old client did not do this, the patch defaults to the old behaviour and permits the new behaviour to be enabled via a sysctl. Modified: stable/10/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clrpcops.c Sun Jul 26 21:37:31 2015 (r285903) +++ stable/10/sys/fs/nfsclient/nfs_clrpcops.c Mon Jul 27 00:28:51 2015 (r285904) @@ -46,6 +46,13 @@ __FBSDID("$FreeBSD$"); #include "opt_inet6.h" #include +#include + +SYSCTL_DECL(_vfs_nfs); + +static int nfsignore_eexist = 0; +SYSCTL_INT(_vfs_nfs, OID_AUTO, ignore_eexist, CTLFLAG_RW, + &nfsignore_eexist, 0, "NFS ignore EEXIST replies for mkdir/symlink"); /* * Global variables @@ -2528,8 +2535,12 @@ nfsrpc_symlink(vnode_t dvp, char *name, mbuf_freem(nd->nd_mrep); /* * Kludge: Map EEXIST => 0 assuming that it is a reply to a retry. + * Only do this if vfs.nfs.ignore_eexist is set. + * Never do this for NFSv4.1 or later minor versions, since sessions + * should guarantee "exactly once" RPC semantics. */ - if (error == EEXIST) + if (error == EEXIST && nfsignore_eexist != 0 && (!NFSHASNFSV4(nmp) || + nmp->nm_minorvers == 0)) error = 0; return (error); } @@ -2548,10 +2559,12 @@ nfsrpc_mkdir(vnode_t dvp, char *name, in nfsattrbit_t attrbits; int error = 0; struct nfsfh *fhp; + struct nfsmount *nmp; *nfhpp = NULL; *attrflagp = 0; *dattrflagp = 0; + nmp = VFSTONFS(vnode_mount(dvp)); fhp = VTONFS(dvp)->n_fhp; if (namelen > NFS_MAXNAMLEN) return (ENAMETOOLONG); @@ -2603,9 +2616,13 @@ nfsrpc_mkdir(vnode_t dvp, char *name, in nfsmout: mbuf_freem(nd->nd_mrep); /* - * Kludge: Map EEXIST => 0 assuming that you have a reply to a retry. + * Kludge: Map EEXIST => 0 assuming that it is a reply to a retry. + * Only do this if vfs.nfs.ignore_eexist is set. + * Never do this for NFSv4.1 or later minor versions, since sessions + * should guarantee "exactly once" RPC semantics. */ - if (error == EEXIST) + if (error == EEXIST && nfsignore_eexist != 0 && (!NFSHASNFSV4(nmp) || + nmp->nm_minorvers == 0)) error = 0; return (error); } From owner-svn-src-all@freebsd.org Mon Jul 27 04:07:40 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E2F99AC08D; Mon, 27 Jul 2015 04:07:40 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 3045D1E7; Mon, 27 Jul 2015 04:07:39 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from Julian-MBP3.local (ppp121-45-248-13.lns20.per4.internode.on.net [121.45.248.13]) (authenticated bits=0) by vps1.elischer.org (8.14.9/8.14.9) with ESMTP id t6R47RBe049244 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Sun, 26 Jul 2015 21:07:30 -0700 (PDT) (envelope-from julian@freebsd.org) Subject: Re: svn commit: r285854 - head/sys/amd64/include To: Alan Cox , John-Mark Gurney , Alan Cox References: <201507241943.t6OJhJaq090500@repo.freebsd.org> <20150724211532.GO78154@funkthat.com> <55B3CF86.200@rice.edu> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Julian Elischer Message-ID: <55B5AE79.3060505@freebsd.org> Date: Mon, 27 Jul 2015 12:07:21 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <55B3CF86.200@rice.edu> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jul 2015 04:07:40 -0000 On 7/26/15 2:03 AM, Alan Cox wrote: > On 07/24/2015 16:15, John-Mark Gurney wrote: >> Alan Cox wrote this message on Fri, Jul 24, 2015 at 19:43 +0000: >>> Author: alc >>> Date: Fri Jul 24 19:43:18 2015 >>> New Revision: 285854 >>> URL: https://svnweb.freebsd.org/changeset/base/285854 >>> >>> Log: >>> Add a comment discussing the appropriate use of the atomic_*() functions >>> with acquire and release semantics versus the *mb() functions on amd64 >>> processors. >> Please put this documentation in the atomic(9) man page where it is >> easier to read and access... it's probably best to just move it >> there and reference atomic(9) here... >> >> Also, this advice isn't amd64 specific is it? If it isn't, why is it >> in an amd64 include file? > > While the first sentence is not amd64 specific, the core of this > paragraph, the third, four, and fifth sentences, is very amd64 specific. > In particular, the redundancy of the rmb() and wmb() functions for > ordinary cases of interprocessor memory ordering is not generally true > across architectures that we support. For example, on arm64 or powerpc, > these functions do provide non-redundant ordering. > > But, I do agree that the first sentence also belongs in a man page, like > atomic(9). Today, however, we have no man page documenting the *mb() > functions. > > >>> Modified: >>> head/sys/amd64/include/atomic.h >>> >>> Modified: head/sys/amd64/include/atomic.h >>> ============================================================================== >>> --- head/sys/amd64/include/atomic.h Fri Jul 24 19:37:30 2015 (r285853) >>> +++ head/sys/amd64/include/atomic.h Fri Jul 24 19:43:18 2015 (r285854) >>> @@ -32,6 +32,25 @@ >>> #error this file needs sys/cdefs.h as a prerequisite >>> #endif >>> >>> +/* >>> + * To express interprocessor (as opposed to processor and device) memory >>> + * ordering constraints, use the atomic_*() functions with acquire and release >>> + * semantics rather than the *mb() functions. An architecture's memory >>> + * ordering (or memory consistency) model governs the order in which a >>> + * program's accesses to different locations may be performed by an >>> + * implementation of that architecture. In general, for memory regions >>> + * defined as writeback cacheable, the memory ordering implemented by amd64 >>> + * processors preserves the program ordering of a load followed by a load, a >>> + * load followed by a store, and a store followed by a store. Only a store >>> + * followed by a load to a different memory location may be reordered. >>> + * Therefore, except for special cases, like non-temporal memory accesses or >>> + * memory regions defined as write combining, the memory ordering effects >>> + * provided by the sfence instruction in the wmb() function and the lfence >>> + * instruction in the rmb() function are redundant. In contrast, the >>> + * atomic_*() functions with acquire and release semantics do not perform >>> + * redundant instructions for ordinary cases of interprocessor memory >>> + * ordering on any architecture. >>> + */ >>> #define mb() __asm __volatile("mfence;" : : : "memory") >>> #define wmb() __asm __volatile("sfence;" : : : "memory") >>> #define rmb() __asm __volatile("lfence;" : : : "memory") It's getting long past the time when someone who understands the VM system writes a document about it. I think we have maybe 6 people who 'get it', and that pool needs to be expanded.. Maybe someone who has students can set an assignment for extra credit for someone to write a start and we cna keep fleshing it out :-) What there is, is now getting rather out of date, and much of the MACH documentation no longer applies. I'm willing to proof read and help but I don't know enough to actually write it. > > > > From owner-svn-src-all@freebsd.org Mon Jul 27 05:31:43 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6AF979ACC6A; Mon, 27 Jul 2015 05:31:43 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "gold.funkthat.com", Issuer "gold.funkthat.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id E9AF8820; Mon, 27 Jul 2015 05:31:42 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (localhost [127.0.0.1]) by gold.funkthat.com (8.14.5/8.14.5) with ESMTP id t6R5FvD5060511 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 26 Jul 2015 22:15:57 -0700 (PDT) (envelope-from jmg@gold.funkthat.com) Received: (from jmg@localhost) by gold.funkthat.com (8.14.5/8.14.5/Submit) id t6R5FvCM060510; Sun, 26 Jul 2015 22:15:57 -0700 (PDT) (envelope-from jmg) Date: Sun, 26 Jul 2015 22:15:57 -0700 From: John-Mark Gurney To: kpneal@pobox.com Cc: Scott Long , Alexey Dokuchaev , svn-src-head@FreeBSD.org, src-committers , Mark R V Murray , svn-src-all@FreeBSD.org Subject: Re: svn commit: r284959 - in head: . share/man/man4 share/man/man9 sys/conf sys/dev/glxsb sys/dev/hifn sys/dev/random sys/dev/rndtest sys/dev/safe sys/dev/syscons sys/dev/ubsec sys/dev/virtio/random sy... Message-ID: <20150727051557.GC78154@funkthat.com> References: <20150724012519.GE78154@funkthat.com> <20150725143629.GA49086@FreeBSD.org> <20150726225158.GA66594@neutralgood.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150726225158.GA66594@neutralgood.org> X-Operating-System: FreeBSD 9.1-PRERELEASE amd64 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? User-Agent: Mutt/1.5.21 (2010-09-15) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (gold.funkthat.com [127.0.0.1]); Sun, 26 Jul 2015 22:15:57 -0700 (PDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jul 2015 05:31:43 -0000 kpneal@pobox.com wrote this message on Sun, Jul 26, 2015 at 18:51 -0400: > > Microphones don???t typically exist on virtual machines, servers, appliances/embedded gadgets, and trusted computers. Nice idea for the desktop, but far from universal. > > Personally, I _hate_ the idea of having a mic on my desktop. If the machine > is hacked the mic can be turned against me. Same with cameras. If there > is no mic (and no camera) then I can't be harmed in this way. I should have been more clear on my use of the "mic"... I'm only talking about using the mic input w/o a mic attached... Even w/o the mic attached, there are slight variations in the input due to the ADC and pre-amp... > There have been women who were blackmailed because they took their laptop > with them when they were bathing. Obviously I'm not going to be blackmailed > in this way (I'm a guy, for starters), but the principle holds. I want to > be able to hold a private conversation in the same room as my computer and > not have to worry about anyone listening in. It's impossible for FreeBSD to attach a mic if there isn't one already attached, nor will it ever be required to attach one to run FreeBSD. Also, if one is hardwired, like in many laptops, using it for randomness won't increase or decrease the likelyhood of the above happening... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-all@freebsd.org Mon Jul 27 10:04:08 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 233249AC4EC; Mon, 27 Jul 2015 10:04:08 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1377DA13; Mon, 27 Jul 2015 10:04:08 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6RA47Ec090329; Mon, 27 Jul 2015 10:04:07 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6RA47C8090326; Mon, 27 Jul 2015 10:04:07 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201507271004.t6RA47C8090326@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Mon, 27 Jul 2015 10:04:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285906 - in head/sys: compat/cloudabi64 contrib/cloudabi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jul 2015 10:04:08 -0000 Author: ed Date: Mon Jul 27 10:04:06 2015 New Revision: 285906 URL: https://svnweb.freebsd.org/changeset/base/285906 Log: Sync in latest upstream system call definitions. Futex object scopes have been renamed from using their own constants to simply reusing the existing CLOUDABI_MAP_{PRIVATE,SHARED} flags, as they are more accurate in this context. Modified: head/sys/compat/cloudabi64/syscalls.master head/sys/contrib/cloudabi/syscalldefs_md.h head/sys/contrib/cloudabi/syscalldefs_mi.h Modified: head/sys/compat/cloudabi64/syscalls.master ============================================================================== --- head/sys/compat/cloudabi64/syscalls.master Mon Jul 27 04:11:41 2015 (r285905) +++ head/sys/compat/cloudabi64/syscalls.master Mon Jul 27 10:04:06 2015 (r285906) @@ -21,7 +21,7 @@ 2 AUE_NULL STD { void cloudabi_sys_condvar_signal( \ cloudabi_condvar_t *condvar, \ - cloudabi_futexscope_t scope, \ + cloudabi_mflags_t scope, \ cloudabi_nthreads_t nwaiters); } 3 AUE_NULL STD { void cloudabi_sys_fd_close( \ @@ -132,7 +132,7 @@ 31 AUE_NULL STD { void cloudabi_sys_lock_unlock( \ cloudabi_lock_t *lock, \ - cloudabi_futexscope_t scope); } + cloudabi_mflags_t scope); } 32 AUE_NULL STD { void cloudabi_sys_mem_advise( \ void *addr, size_t len, \ @@ -209,6 +209,6 @@ cloudabi64_threadattr_t *attr); } 54 AUE_NULL STD { void cloudabi_sys_thread_exit( \ cloudabi_lock_t *lock, \ - cloudabi_futexscope_t scope); } + cloudabi_mflags_t scope); } 55 AUE_NULL STD { void cloudabi_sys_thread_tcb_set(void *tcb); } 56 AUE_NULL STD { void cloudabi_sys_thread_yield(); } Modified: head/sys/contrib/cloudabi/syscalldefs_md.h ============================================================================== --- head/sys/contrib/cloudabi/syscalldefs_md.h Mon Jul 27 04:11:41 2015 (r285905) +++ head/sys/contrib/cloudabi/syscalldefs_md.h Mon Jul 27 10:04:06 2015 (r285906) @@ -193,8 +193,8 @@ typedef struct { struct { MEMBER(PTR(_Atomic(cloudabi_condvar_t))) condvar; MEMBER(PTR(_Atomic(cloudabi_lock_t))) lock; - MEMBER(cloudabi_futexscope_t) condvar_scope; - MEMBER(cloudabi_futexscope_t) lock_scope; + MEMBER(cloudabi_mflags_t) condvar_scope; + MEMBER(cloudabi_mflags_t) lock_scope; } condvar; // CLOUDABI_EVENTTYPE_FD_READ and CLOUDABI_EVENTTYPE_FD_WRITE: @@ -208,7 +208,7 @@ typedef struct { // and acquire a read or write lock. struct { MEMBER(PTR(_Atomic(cloudabi_lock_t))) lock; - MEMBER(cloudabi_futexscope_t) lock_scope; + MEMBER(cloudabi_mflags_t) lock_scope; } lock; // CLOUDABI_EVENTTYPE_PROC_TERMINATE: Wait for a process to terminate. Modified: head/sys/contrib/cloudabi/syscalldefs_mi.h ============================================================================== --- head/sys/contrib/cloudabi/syscalldefs_mi.h Mon Jul 27 04:11:41 2015 (r285905) +++ head/sys/contrib/cloudabi/syscalldefs_mi.h Mon Jul 27 10:04:06 2015 (r285906) @@ -189,10 +189,6 @@ #define CLOUDABI_FILETYPE_SOCKET_STREAM 0x82 #define CLOUDABI_FILETYPE_SYMBOLIC_LINK 0x90 -// Futex object scopes. -#define CLOUDABI_FUTEXSCOPE_GLOBAL 1 -#define CLOUDABI_FUTEXSCOPE_PROCESS_LOCAL 2 - // Read-write lock related constants. #define CLOUDABI_LOCK_UNLOCKED 0 // Lock is unlocked. #define CLOUDABI_LOCK_WRLOCKED 0x40000000 // Lock is write locked. @@ -354,7 +350,6 @@ typedef int64_t cloudabi_filedelta_t; typedef uint64_t cloudabi_filesize_t; // ftruncate(), struct stat::st_size. typedef uint8_t cloudabi_filetype_t; // struct stat::st_mode. typedef uint16_t cloudabi_fsflags_t; // file_stat_put(). -typedef uint8_t cloudabi_futexscope_t; // Scope of lock or condition variable. typedef uint64_t cloudabi_inode_t; // struct stat::st_ino. typedef uint32_t cloudabi_linkcount_t; // struct stat::st_nlink. typedef uint32_t cloudabi_lock_t; // pthread_{mutex,rwlock}_*(). From owner-svn-src-all@freebsd.org Mon Jul 27 10:04:30 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D31B89AC519; Mon, 27 Jul 2015 10:04:30 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C3647B83; Mon, 27 Jul 2015 10:04:30 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6RA4UOs090396; Mon, 27 Jul 2015 10:04:30 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6RA4Tqh090390; Mon, 27 Jul 2015 10:04:29 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201507271004.t6RA4Tqh090390@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Mon, 27 Jul 2015 10:04:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285907 - head/sys/compat/cloudabi64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jul 2015 10:04:31 -0000 Author: ed Date: Mon Jul 27 10:04:28 2015 New Revision: 285907 URL: https://svnweb.freebsd.org/changeset/base/285907 Log: Regenerate system call table. Modified: head/sys/compat/cloudabi64/cloudabi64_proto.h head/sys/compat/cloudabi64/cloudabi64_syscall.h head/sys/compat/cloudabi64/cloudabi64_syscalls.c head/sys/compat/cloudabi64/cloudabi64_sysent.c head/sys/compat/cloudabi64/cloudabi64_systrace_args.c Modified: head/sys/compat/cloudabi64/cloudabi64_proto.h ============================================================================== --- head/sys/compat/cloudabi64/cloudabi64_proto.h Mon Jul 27 10:04:06 2015 (r285906) +++ head/sys/compat/cloudabi64/cloudabi64_proto.h Mon Jul 27 10:04:28 2015 (r285907) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/cloudabi64/syscalls.master 285790 2015-07-22 10:04:53Z ed + * created from FreeBSD: head/sys/compat/cloudabi64/syscalls.master 285906 2015-07-27 10:04:06Z ed */ #ifndef _CLOUDABI64_SYSPROTO_H_ @@ -43,7 +43,7 @@ struct cloudabi_sys_clock_time_get_args }; struct cloudabi_sys_condvar_signal_args { char condvar_l_[PADL_(cloudabi_condvar_t *)]; cloudabi_condvar_t * condvar; char condvar_r_[PADR_(cloudabi_condvar_t *)]; - char scope_l_[PADL_(cloudabi_futexscope_t)]; cloudabi_futexscope_t scope; char scope_r_[PADR_(cloudabi_futexscope_t)]; + char scope_l_[PADL_(cloudabi_mflags_t)]; cloudabi_mflags_t scope; char scope_r_[PADR_(cloudabi_mflags_t)]; char nwaiters_l_[PADL_(cloudabi_nthreads_t)]; cloudabi_nthreads_t nwaiters; char nwaiters_r_[PADR_(cloudabi_nthreads_t)]; }; struct cloudabi_sys_fd_close_args { @@ -194,7 +194,7 @@ struct cloudabi_sys_file_unlink_args { }; struct cloudabi_sys_lock_unlock_args { char lock_l_[PADL_(cloudabi_lock_t *)]; cloudabi_lock_t * lock; char lock_r_[PADR_(cloudabi_lock_t *)]; - char scope_l_[PADL_(cloudabi_futexscope_t)]; cloudabi_futexscope_t scope; char scope_r_[PADR_(cloudabi_futexscope_t)]; + char scope_l_[PADL_(cloudabi_mflags_t)]; cloudabi_mflags_t scope; char scope_r_[PADR_(cloudabi_mflags_t)]; }; struct cloudabi_sys_mem_advise_args { char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)]; @@ -302,7 +302,7 @@ struct cloudabi64_sys_thread_create_args }; struct cloudabi_sys_thread_exit_args { char lock_l_[PADL_(cloudabi_lock_t *)]; cloudabi_lock_t * lock; char lock_r_[PADR_(cloudabi_lock_t *)]; - char scope_l_[PADL_(cloudabi_futexscope_t)]; cloudabi_futexscope_t scope; char scope_r_[PADR_(cloudabi_futexscope_t)]; + char scope_l_[PADL_(cloudabi_mflags_t)]; cloudabi_mflags_t scope; char scope_r_[PADR_(cloudabi_mflags_t)]; }; struct cloudabi_sys_thread_tcb_set_args { char tcb_l_[PADL_(void *)]; void * tcb; char tcb_r_[PADR_(void *)]; Modified: head/sys/compat/cloudabi64/cloudabi64_syscall.h ============================================================================== --- head/sys/compat/cloudabi64/cloudabi64_syscall.h Mon Jul 27 10:04:06 2015 (r285906) +++ head/sys/compat/cloudabi64/cloudabi64_syscall.h Mon Jul 27 10:04:28 2015 (r285907) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/cloudabi64/syscalls.master 285790 2015-07-22 10:04:53Z ed + * created from FreeBSD: head/sys/compat/cloudabi64/syscalls.master 285906 2015-07-27 10:04:06Z ed */ #define CLOUDABI64_SYS_cloudabi_sys_clock_res_get 0 Modified: head/sys/compat/cloudabi64/cloudabi64_syscalls.c ============================================================================== --- head/sys/compat/cloudabi64/cloudabi64_syscalls.c Mon Jul 27 10:04:06 2015 (r285906) +++ head/sys/compat/cloudabi64/cloudabi64_syscalls.c Mon Jul 27 10:04:28 2015 (r285907) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/cloudabi64/syscalls.master 285790 2015-07-22 10:04:53Z ed + * created from FreeBSD: head/sys/compat/cloudabi64/syscalls.master 285906 2015-07-27 10:04:06Z ed */ const char *cloudabi64_syscallnames[] = { Modified: head/sys/compat/cloudabi64/cloudabi64_sysent.c ============================================================================== --- head/sys/compat/cloudabi64/cloudabi64_sysent.c Mon Jul 27 10:04:06 2015 (r285906) +++ head/sys/compat/cloudabi64/cloudabi64_sysent.c Mon Jul 27 10:04:28 2015 (r285907) @@ -3,7 +3,7 @@ * * DO NOT EDIT-- this file is automatically generated. * $FreeBSD$ - * created from FreeBSD: head/sys/compat/cloudabi64/syscalls.master 285790 2015-07-22 10:04:53Z ed + * created from FreeBSD: head/sys/compat/cloudabi64/syscalls.master 285906 2015-07-27 10:04:06Z ed */ #include Modified: head/sys/compat/cloudabi64/cloudabi64_systrace_args.c ============================================================================== --- head/sys/compat/cloudabi64/cloudabi64_systrace_args.c Mon Jul 27 10:04:06 2015 (r285906) +++ head/sys/compat/cloudabi64/cloudabi64_systrace_args.c Mon Jul 27 10:04:28 2015 (r285907) @@ -30,7 +30,7 @@ systrace_args(int sysnum, void *params, case 2: { struct cloudabi_sys_condvar_signal_args *p = params; uarg[0] = (intptr_t) p->condvar; /* cloudabi_condvar_t * */ - iarg[1] = p->scope; /* cloudabi_futexscope_t */ + iarg[1] = p->scope; /* cloudabi_mflags_t */ iarg[2] = p->nwaiters; /* cloudabi_nthreads_t */ *n_args = 3; break; @@ -297,7 +297,7 @@ systrace_args(int sysnum, void *params, case 31: { struct cloudabi_sys_lock_unlock_args *p = params; uarg[0] = (intptr_t) p->lock; /* cloudabi_lock_t * */ - iarg[1] = p->scope; /* cloudabi_futexscope_t */ + iarg[1] = p->scope; /* cloudabi_mflags_t */ *n_args = 2; break; } @@ -495,7 +495,7 @@ systrace_args(int sysnum, void *params, case 54: { struct cloudabi_sys_thread_exit_args *p = params; uarg[0] = (intptr_t) p->lock; /* cloudabi_lock_t * */ - iarg[1] = p->scope; /* cloudabi_futexscope_t */ + iarg[1] = p->scope; /* cloudabi_mflags_t */ *n_args = 2; break; } @@ -551,7 +551,7 @@ systrace_entry_setargdesc(int sysnum, in p = "cloudabi_condvar_t *"; break; case 1: - p = "cloudabi_futexscope_t"; + p = "cloudabi_mflags_t"; break; case 2: p = "cloudabi_nthreads_t"; @@ -1033,7 +1033,7 @@ systrace_entry_setargdesc(int sysnum, in p = "cloudabi_lock_t *"; break; case 1: - p = "cloudabi_futexscope_t"; + p = "cloudabi_mflags_t"; break; default: break; @@ -1373,7 +1373,7 @@ systrace_entry_setargdesc(int sysnum, in p = "cloudabi_lock_t *"; break; case 1: - p = "cloudabi_futexscope_t"; + p = "cloudabi_mflags_t"; break; default: break; From owner-svn-src-all@freebsd.org Mon Jul 27 10:07:30 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA2989AC5E1; Mon, 27 Jul 2015 10:07:30 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 98F79D39; Mon, 27 Jul 2015 10:07:30 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6RA7UtF090563; Mon, 27 Jul 2015 10:07:30 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6RA7Uew090560; Mon, 27 Jul 2015 10:07:30 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201507271007.t6RA7Uew090560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Mon, 27 Jul 2015 10:07:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285908 - head/sys/compat/cloudabi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jul 2015 10:07:30 -0000 Author: ed Date: Mon Jul 27 10:07:29 2015 New Revision: 285908 URL: https://svnweb.freebsd.org/changeset/base/285908 Log: Add a futex implementation for CloudABI. Summary: CloudABI provides two different types of futex objects: read-write locks and condition variables. There is no need to provide separate support for once objects and thread joining, as these are efficiently simulated by blocking on a read-write lock. Mutexes simply use read-write locks. Condition variables always have a lock object associated to them. They always know to which lock a thread needs to be migrated if woken up. This allows us to implement requeueing. A broadcast on a condition variable will never cause multiple threads to be woken up at once. They will be woken up iteratively. This implementation still has lots of room for improvement. Locking is coarse and right now we use linked lists to store all of the locks and condition variables, instead of using a hash table. The primary goal of this implementation was to behave correctly. Performance will be improved as we go. Test Plan: This futex implementation has been in use for the last couple of months and seems to work pretty well. All of the cloudlibc and libc++ unit tests seem to pass. Reviewers: dchagin, kib, vangyzen Subscribers: imp Differential Revision: https://reviews.freebsd.org/D3148 Modified: head/sys/compat/cloudabi/cloudabi_clock.c head/sys/compat/cloudabi/cloudabi_futex.c head/sys/compat/cloudabi/cloudabi_thread.c head/sys/compat/cloudabi/cloudabi_util.h Modified: head/sys/compat/cloudabi/cloudabi_clock.c ============================================================================== --- head/sys/compat/cloudabi/cloudabi_clock.c Mon Jul 27 10:04:28 2015 (r285907) +++ head/sys/compat/cloudabi/cloudabi_clock.c Mon Jul 27 10:07:29 2015 (r285908) @@ -80,31 +80,27 @@ cloudabi_convert_timespec(const struct t return (0); } +/* Fetches the time value of a clock. */ int -cloudabi_sys_clock_res_get(struct thread *td, - struct cloudabi_sys_clock_res_get_args *uap) +cloudabi_clock_time_get(struct thread *td, cloudabi_clockid_t clock_id, + cloudabi_timestamp_t *ret) { struct timespec ts; - cloudabi_timestamp_t cts; int error; clockid_t clockid; - error = cloudabi_convert_clockid(uap->clock_id, &clockid); - if (error != 0) - return (error); - error = kern_clock_getres(td, clockid, &ts); + error = cloudabi_convert_clockid(clock_id, &clockid); if (error != 0) return (error); - error = cloudabi_convert_timespec(&ts, &cts); + error = kern_clock_gettime(td, clockid, &ts); if (error != 0) return (error); - td->td_retval[0] = cts; - return (0); + return (cloudabi_convert_timespec(&ts, ret)); } int -cloudabi_sys_clock_time_get(struct thread *td, - struct cloudabi_sys_clock_time_get_args *uap) +cloudabi_sys_clock_res_get(struct thread *td, + struct cloudabi_sys_clock_res_get_args *uap) { struct timespec ts; cloudabi_timestamp_t cts; @@ -114,7 +110,7 @@ cloudabi_sys_clock_time_get(struct threa error = cloudabi_convert_clockid(uap->clock_id, &clockid); if (error != 0) return (error); - error = kern_clock_gettime(td, clockid, &ts); + error = kern_clock_getres(td, clockid, &ts); if (error != 0) return (error); error = cloudabi_convert_timespec(&ts, &cts); @@ -123,3 +119,15 @@ cloudabi_sys_clock_time_get(struct threa td->td_retval[0] = cts; return (0); } + +int +cloudabi_sys_clock_time_get(struct thread *td, + struct cloudabi_sys_clock_time_get_args *uap) +{ + cloudabi_timestamp_t ts; + int error; + + error = cloudabi_clock_time_get(td, uap->clock_id, &ts); + td->td_retval[0] = ts; + return (error); +} Modified: head/sys/compat/cloudabi/cloudabi_futex.c ============================================================================== --- head/sys/compat/cloudabi/cloudabi_futex.c Mon Jul 27 10:04:28 2015 (r285907) +++ head/sys/compat/cloudabi/cloudabi_futex.c Mon Jul 27 10:07:29 2015 (r285908) @@ -26,22 +26,1197 @@ #include __FBSDID("$FreeBSD$"); +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + #include +#include +#include + +/* + * Futexes for CloudABI. + * + * On most systems, futexes are implemented as objects of a single type + * on which a set of operations can be performed. CloudABI makes a clear + * distinction between locks and condition variables. A lock may have + * zero or more associated condition variables. A condition variable is + * always associated with exactly one lock. There is a strict topology. + * This approach has two advantages: + * + * - This topology is guaranteed to be acyclic. Requeueing of threads + * only happens in one direction (from condition variables to locks). + * This eases locking. + * - It means that a futex object for a lock exists when it is unlocked, + * but has threads waiting on associated condition variables. Threads + * can be requeued to a lock even if the thread performing the wakeup + * does not have the lock mapped in its address space. + * + * This futex implementation only implements a single lock type, namely + * a read-write lock. A regular mutex type would not be necessary, as + * the read-write lock is as efficient as a mutex if used as such. + * Userspace futex locks are 32 bits in size: + * + * - 1 bit: has threads waiting in kernel-space. + * - 1 bit: is write-locked. + * - 30 bits: + * - if write-locked: thread ID of owner. + * - if not write-locked: number of read locks held. + * + * Condition variables are also 32 bits in size. Its value is modified + * by kernel-space exclusively. Zero indicates that it has no waiting + * threads. Non-zero indicates the opposite. + * + * This implementation is optimal, in the sense that it only wakes up + * threads if they can actually continue execution. It does not suffer + * from the thundering herd problem. If multiple threads waiting on a + * condition variable need to be woken up, only a single thread is + * scheduled. All other threads are 'donated' to this thread. After the + * thread manages to reacquire the lock, it requeues its donated threads + * to the lock. + * + * TODO(ed): Integrate this functionality into kern_umtx.c instead. + * TODO(ed): Store futex objects in a hash table. + * TODO(ed): Add actual priority inheritance. + * TODO(ed): Let futex_queue also take priorities into account. + * TODO(ed): Make locking fine-grained. + * TODO(ed): Perform sleeps until an actual absolute point in time, + * instead of converting the timestamp to a relative value. + */ + +struct futex_address; +struct futex_condvar; +struct futex_lock; +struct futex_queue; +struct futex_waiter; + +/* Identifier of a location in memory. */ +struct futex_address { + /* For process-private objects: address space of the process. */ + struct vmspace * fa_vmspace; + /* For process-shared objects: VM object containing the object. */ + struct vm_object * fa_vmobject; + + /* Memory address within address space or offset within VM object. */ + uintptr_t fa_offset; +}; + +/* A set of waiting threads. */ +struct futex_queue { + STAILQ_HEAD(, futex_waiter) fq_list; + unsigned int fq_count; +}; + +/* Condition variables. */ +struct futex_condvar { + /* Address of the condition variable. */ + struct futex_address fc_address; + + /* The lock the waiters should be moved to when signalled. */ + struct futex_lock * fc_lock; + + /* Threads waiting on the condition variable. */ + struct futex_queue fc_waiters; + /* + * Number of threads blocked on this condition variable, or + * being blocked on the lock after being requeued. + */ + unsigned int fc_waitcount; + + /* Global list pointers. */ + LIST_ENTRY(futex_condvar) fc_next; +}; + +/* Read-write locks. */ +struct futex_lock { + /* Address of the lock. */ + struct futex_address fl_address; + + /* + * Current owner of the lock. LOCK_UNMANAGED if the lock is + * currently not owned by the kernel. LOCK_OWNER_UNKNOWN in case + * the owner is not known (e.g., when the lock is read-locked). + */ + cloudabi_tid_t fl_owner; +#define LOCK_UNMANAGED 0x0 +#define LOCK_OWNER_UNKNOWN 0x1 + + /* Writers blocked on the lock. */ + struct futex_queue fl_writers; + /* Readers blocked on the lock. */ + struct futex_queue fl_readers; + /* Number of threads blocked on this lock + condition variables. */ + unsigned int fl_waitcount; + + /* Global list pointers. */ + LIST_ENTRY(futex_lock) fl_next; +}; + +/* Information associated with a thread blocked on an object. */ +struct futex_waiter { + /* Thread ID. */ + cloudabi_tid_t fw_tid; + /* Condition variable used for waiting. */ + struct cv fw_wait; + + /* Queue this waiter is currently placed in. */ + struct futex_queue * fw_queue; + /* List pointers of fw_queue. */ + STAILQ_ENTRY(futex_waiter) fw_next; + + /* Lock has been acquired. */ + bool fw_locked; + /* If not locked, threads that should block after acquiring. */ + struct futex_queue fw_donated; +}; + +/* Global data structures. */ +static MALLOC_DEFINE(M_FUTEX, "futex", "CloudABI futex"); + +static struct sx futex_global_lock; +SX_SYSINIT(futex_global_lock, &futex_global_lock, "CloudABI futex global lock"); + +static LIST_HEAD(, futex_lock) futex_lock_list = + LIST_HEAD_INITIALIZER(&futex_lock_list); +static LIST_HEAD(, futex_condvar) futex_condvar_list = + LIST_HEAD_INITIALIZER(&futex_condvar_list); + +/* Utility functions. */ +static void futex_lock_assert(const struct futex_lock *); +static struct futex_lock *futex_lock_lookup_locked(struct futex_address *); +static void futex_lock_release(struct futex_lock *); +static int futex_lock_tryrdlock(struct futex_lock *, cloudabi_lock_t *); +static int futex_lock_unmanage(struct futex_lock *, cloudabi_lock_t *); +static int futex_lock_update_owner(struct futex_lock *, cloudabi_lock_t *); +static int futex_lock_wake_up_next(struct futex_lock *, cloudabi_lock_t *); +static unsigned int futex_queue_count(const struct futex_queue *); +static void futex_queue_init(struct futex_queue *); +static void futex_queue_requeue(struct futex_queue *, struct futex_queue *, + unsigned int); +static int futex_queue_sleep(struct futex_queue *, struct futex_lock *, + struct futex_waiter *, struct thread *, cloudabi_clockid_t, + cloudabi_timestamp_t, cloudabi_timestamp_t); +static cloudabi_tid_t futex_queue_tid_best(const struct futex_queue *); +static void futex_queue_wake_up_all(struct futex_queue *); +static void futex_queue_wake_up_best(struct futex_queue *); +static void futex_queue_wake_up_donate(struct futex_queue *, unsigned int); +static int futex_user_load(uint32_t *, uint32_t *); +static int futex_user_store(uint32_t *, uint32_t); +static int futex_user_cmpxchg(uint32_t *, uint32_t, uint32_t *, uint32_t); + +/* + * futex_address operations. + */ + +static int +futex_address_create(struct futex_address *fa, struct thread *td, + const void *object, cloudabi_mflags_t scope) +{ + struct vmspace *vs; + struct vm_object *vo; + vm_map_t map; + vm_map_entry_t entry; + vm_pindex_t pindex; + vm_prot_t prot; + boolean_t wired; + + /* + * Most of the time objects are stored in privately mapped + * anonymous memory. For these objects we wouldn't need to look + * up the corresponding VM object. The scope hint provided by + * userspace allows us to skip the VM map lookup for the common + * case. + * + * POSIX does permit enabling PTHREAD_PROCESS_SHARED on a lock + * stored in a private mapping, at the cost of additional + * performance overhead. Fall back to identifying the object by + * virtual memory address if the mapping isn't shared. + */ + vs = td->td_proc->p_vmspace; + switch (scope) { + case CLOUDABI_MAP_SHARED: + map = &vs->vm_map; + if (vm_map_lookup(&map, (vm_offset_t)object, + VM_PROT_COPY | VM_PROT_WRITE, &entry, &vo, &pindex, &prot, + &wired) != KERN_SUCCESS) + return (EFAULT); + + if (entry->inheritance == VM_INHERIT_SHARE) { + /* + * Address corresponds to a shared mapping. + * Identify the address by its VM object. + */ + fa->fa_vmspace = NULL; + fa->fa_vmobject = vo; + vm_object_reference(vo); + fa->fa_offset = entry->offset - entry->start + + (vm_offset_t)object; + vm_map_lookup_done(map, entry); + return (0); + } + vm_map_lookup_done(map, entry); + /* FALLTHROUGH */ + case CLOUDABI_MAP_PRIVATE: + /* + * Address corresponds to a private mapping. Never + * identify the address by its VM object, as shadow + * objects may get inserted if another thread forks. + * Simply use the VM space instead. + */ + fa->fa_vmspace = vs; + fa->fa_vmobject = NULL; + fa->fa_offset = (uintptr_t)object; + return (0); + default: + return (EINVAL); + } +} + +static void +futex_address_free(struct futex_address *fa) +{ + + if (fa->fa_vmobject != NULL) + vm_object_deallocate(fa->fa_vmobject); +} + +static bool +futex_address_match(const struct futex_address *fa1, + const struct futex_address *fa2) +{ + + /* Either fa_vmspace or fa_vmobject is NULL. */ + return (fa1->fa_vmspace == fa2->fa_vmspace && + fa1->fa_vmobject == fa2->fa_vmobject && + fa1->fa_offset == fa2->fa_offset); +} + +/* + * futex_condvar operations. + */ + +static void +futex_condvar_assert(const struct futex_condvar *fc) +{ + + KASSERT(fc->fc_waitcount >= futex_queue_count(&fc->fc_waiters), + ("Total number of waiters cannot be smaller than the wait queue")); + futex_lock_assert(fc->fc_lock); +} + +static int +futex_condvar_lookup(struct thread *td, const cloudabi_condvar_t *address, + cloudabi_mflags_t scope, struct futex_condvar **fcret) +{ + struct futex_address fa_condvar; + struct futex_condvar *fc; + int error; + + error = futex_address_create(&fa_condvar, td, address, scope); + if (error != 0) + return (error); + + sx_xlock(&futex_global_lock); + LIST_FOREACH(fc, &futex_condvar_list, fc_next) { + if (futex_address_match(&fc->fc_address, &fa_condvar)) { + /* Found matching lock object. */ + futex_address_free(&fa_condvar); + futex_condvar_assert(fc); + *fcret = fc; + return (0); + } + } + sx_xunlock(&futex_global_lock); + futex_address_free(&fa_condvar); + return (ENOENT); +} + +static int +futex_condvar_lookup_or_create(struct thread *td, + const cloudabi_condvar_t *condvar, cloudabi_mflags_t condvar_scope, + const cloudabi_lock_t *lock, cloudabi_mflags_t lock_scope, + struct futex_condvar **fcret) +{ + struct futex_address fa_condvar, fa_lock; + struct futex_condvar *fc; + struct futex_lock *fl; + int error; + + error = futex_address_create(&fa_condvar, td, condvar, condvar_scope); + if (error != 0) + return (error); + error = futex_address_create(&fa_lock, td, lock, lock_scope); + if (error != 0) { + futex_address_free(&fa_condvar); + return (error); + } + + sx_xlock(&futex_global_lock); + LIST_FOREACH(fc, &futex_condvar_list, fc_next) { + if (!futex_address_match(&fc->fc_address, &fa_condvar)) + continue; + fl = fc->fc_lock; + if (!futex_address_match(&fl->fl_address, &fa_lock)) { + /* Condition variable is owned by a different lock. */ + futex_address_free(&fa_condvar); + futex_address_free(&fa_lock); + sx_xunlock(&futex_global_lock); + return (EINVAL); + } + + /* Found fully matching condition variable. */ + futex_address_free(&fa_condvar); + futex_address_free(&fa_lock); + futex_condvar_assert(fc); + *fcret = fc; + return (0); + } + + /* None found. Create new condition variable object. */ + fc = malloc(sizeof(*fc), M_FUTEX, M_WAITOK); + fc->fc_address = fa_condvar; + fc->fc_lock = futex_lock_lookup_locked(&fa_lock); + futex_queue_init(&fc->fc_waiters); + fc->fc_waitcount = 0; + LIST_INSERT_HEAD(&futex_condvar_list, fc, fc_next); + *fcret = fc; + return (0); +} + +static void +futex_condvar_release(struct futex_condvar *fc) +{ + struct futex_lock *fl; + + futex_condvar_assert(fc); + fl = fc->fc_lock; + if (fc->fc_waitcount == 0) { + /* Condition variable has no waiters. Deallocate it. */ + futex_address_free(&fc->fc_address); + LIST_REMOVE(fc, fc_next); + free(fc, M_FUTEX); + } + futex_lock_release(fl); +} + +static int +futex_condvar_unmanage(struct futex_condvar *fc, + cloudabi_condvar_t *condvar) +{ + + if (futex_queue_count(&fc->fc_waiters) != 0) + return (0); + return (futex_user_store(condvar, CLOUDABI_CONDVAR_HAS_NO_WAITERS)); +} + +/* + * futex_lock operations. + */ + +static void +futex_lock_assert(const struct futex_lock *fl) +{ + + /* + * A futex lock can only be kernel-managed if it has waiters. + * Vice versa: if a futex lock has waiters, it must be + * kernel-managed. + */ + KASSERT((fl->fl_owner == LOCK_UNMANAGED) == + (futex_queue_count(&fl->fl_readers) == 0 && + futex_queue_count(&fl->fl_writers) == 0), + ("Managed locks must have waiting threads")); + KASSERT(fl->fl_waitcount != 0 || fl->fl_owner == LOCK_UNMANAGED, + ("Lock with no waiters must be unmanaged")); +} + +static int +futex_lock_lookup(struct thread *td, const cloudabi_lock_t *address, + cloudabi_mflags_t scope, struct futex_lock **flret) +{ + struct futex_address fa; + int error; + + error = futex_address_create(&fa, td, address, scope); + if (error != 0) + return (error); + + sx_xlock(&futex_global_lock); + *flret = futex_lock_lookup_locked(&fa); + return (0); +} + +static struct futex_lock * +futex_lock_lookup_locked(struct futex_address *fa) +{ + struct futex_lock *fl; + + LIST_FOREACH(fl, &futex_lock_list, fl_next) { + if (futex_address_match(&fl->fl_address, fa)) { + /* Found matching lock object. */ + futex_address_free(fa); + futex_lock_assert(fl); + return (fl); + } + } + + /* None found. Create new lock object. */ + fl = malloc(sizeof(*fl), M_FUTEX, M_WAITOK); + fl->fl_address = *fa; + fl->fl_owner = LOCK_UNMANAGED; + futex_queue_init(&fl->fl_readers); + futex_queue_init(&fl->fl_writers); + fl->fl_waitcount = 0; + LIST_INSERT_HEAD(&futex_lock_list, fl, fl_next); + return (fl); +} + +static int +futex_lock_rdlock(struct futex_lock *fl, struct thread *td, + cloudabi_lock_t *lock, cloudabi_clockid_t clock_id, + cloudabi_timestamp_t timeout, cloudabi_timestamp_t precision) +{ + struct futex_waiter fw; + int error; + + error = futex_lock_tryrdlock(fl, lock); + if (error == EBUSY) { + /* Suspend execution. */ + KASSERT(fl->fl_owner != LOCK_UNMANAGED, + ("Attempted to sleep on an unmanaged lock")); + error = futex_queue_sleep(&fl->fl_readers, fl, &fw, td, + clock_id, timeout, precision); + KASSERT((error == 0) == fw.fw_locked, + ("Should have locked write lock on success")); + KASSERT(futex_queue_count(&fw.fw_donated) == 0, + ("Lock functions cannot receive threads")); + } + if (error != 0) + futex_lock_unmanage(fl, lock); + return (error); +} + +static void +futex_lock_release(struct futex_lock *fl) +{ + + futex_lock_assert(fl); + if (fl->fl_waitcount == 0) { + /* Lock object is unreferenced. Deallocate it. */ + KASSERT(fl->fl_owner == LOCK_UNMANAGED, + ("Attempted to free a managed lock")); + futex_address_free(&fl->fl_address); + LIST_REMOVE(fl, fl_next); + free(fl, M_FUTEX); + } + sx_xunlock(&futex_global_lock); +} + +static int +futex_lock_unmanage(struct futex_lock *fl, cloudabi_lock_t *lock) +{ + cloudabi_lock_t cmp, old; + int error; + + if (futex_queue_count(&fl->fl_readers) == 0 && + futex_queue_count(&fl->fl_writers) == 0) { + /* Lock should be unmanaged. */ + fl->fl_owner = LOCK_UNMANAGED; + + /* Clear kernel-managed bit. */ + error = futex_user_load(lock, &old); + if (error != 0) + return (error); + for (;;) { + cmp = old; + error = futex_user_cmpxchg(lock, cmp, &old, + cmp & ~CLOUDABI_LOCK_KERNEL_MANAGED); + if (error != 0) + return (error); + if (old == cmp) + break; + } + } + return (0); +} + +/* Sets an owner of a lock, based on a userspace lock value. */ +static void +futex_lock_set_owner(struct futex_lock *fl, cloudabi_lock_t lock) +{ + + /* Lock has no explicit owner. */ + if ((lock & ~CLOUDABI_LOCK_WRLOCKED) == 0) { + fl->fl_owner = LOCK_OWNER_UNKNOWN; + return; + } + lock &= ~(CLOUDABI_LOCK_WRLOCKED | CLOUDABI_LOCK_KERNEL_MANAGED); + + /* Don't allow userspace to silently unlock. */ + if (lock == LOCK_UNMANAGED) { + fl->fl_owner = LOCK_OWNER_UNKNOWN; + return; + } + fl->fl_owner = lock; +} + +static int +futex_lock_unlock(struct futex_lock *fl, struct thread *td, + cloudabi_lock_t *lock) +{ + int error; + + /* Validate that this thread is allowed to unlock. */ + error = futex_lock_update_owner(fl, lock); + if (error != 0) + return (error); + if (fl->fl_owner != LOCK_UNMANAGED && fl->fl_owner != td->td_tid) + return (EPERM); + return (futex_lock_wake_up_next(fl, lock)); +} + +/* Syncs in the owner of the lock from userspace if needed. */ +static int +futex_lock_update_owner(struct futex_lock *fl, cloudabi_lock_t *address) +{ + cloudabi_lock_t lock; + int error; + + if (fl->fl_owner == LOCK_OWNER_UNKNOWN) { + error = futex_user_load(address, &lock); + if (error != 0) + return (error); + futex_lock_set_owner(fl, lock); + } + return (0); +} + +static int +futex_lock_tryrdlock(struct futex_lock *fl, cloudabi_lock_t *address) +{ + cloudabi_lock_t old, cmp; + int error; + + if (fl->fl_owner != LOCK_UNMANAGED) { + /* Lock is already acquired. */ + return (EBUSY); + } + + old = CLOUDABI_LOCK_UNLOCKED; + for (;;) { + if ((old & CLOUDABI_LOCK_KERNEL_MANAGED) != 0) { + /* + * Userspace lock is kernel-managed, even though + * the kernel disagrees. + */ + return (EINVAL); + } + + if ((old & CLOUDABI_LOCK_WRLOCKED) == 0) { + /* + * Lock is not write-locked. Attempt to acquire + * it by increasing the read count. + */ + cmp = old; + error = futex_user_cmpxchg(address, cmp, &old, cmp + 1); + if (error != 0) + return (error); + if (old == cmp) { + /* Success. */ + return (0); + } + } else { + /* Lock is write-locked. Make it kernel-managed. */ + cmp = old; + error = futex_user_cmpxchg(address, cmp, &old, + cmp | CLOUDABI_LOCK_KERNEL_MANAGED); + if (error != 0) + return (error); + if (old == cmp) { + /* Success. */ + futex_lock_set_owner(fl, cmp); + return (EBUSY); + } + } + } +} + +static int +futex_lock_trywrlock(struct futex_lock *fl, cloudabi_lock_t *address, + cloudabi_tid_t tid, bool force_kernel_managed) +{ + cloudabi_lock_t old, new, cmp; + int error; + + if (fl->fl_owner == tid) { + /* Attempted to acquire lock recursively. */ + return (EDEADLK); + } + if (fl->fl_owner != LOCK_UNMANAGED) { + /* Lock is already acquired. */ + return (EBUSY); + } + + old = CLOUDABI_LOCK_UNLOCKED; + for (;;) { + if ((old & CLOUDABI_LOCK_KERNEL_MANAGED) != 0) { + /* + * Userspace lock is kernel-managed, even though + * the kernel disagrees. + */ + return (EINVAL); + } + if (old == (tid | CLOUDABI_LOCK_WRLOCKED)) { + /* Attempted to acquire lock recursively. */ + return (EDEADLK); + } + + if (old == CLOUDABI_LOCK_UNLOCKED) { + /* Lock is unlocked. Attempt to acquire it. */ + new = tid | CLOUDABI_LOCK_WRLOCKED; + if (force_kernel_managed) + new |= CLOUDABI_LOCK_KERNEL_MANAGED; + error = futex_user_cmpxchg(address, + CLOUDABI_LOCK_UNLOCKED, &old, new); + if (error != 0) + return (error); + if (old == CLOUDABI_LOCK_UNLOCKED) { + /* Success. */ + if (force_kernel_managed) + fl->fl_owner = tid; + return (0); + } + } else { + /* Lock is still locked. Make it kernel-managed. */ + cmp = old; + error = futex_user_cmpxchg(address, cmp, &old, + cmp | CLOUDABI_LOCK_KERNEL_MANAGED); + if (error != 0) + return (error); + if (old == cmp) { + /* Success. */ + futex_lock_set_owner(fl, cmp); + return (EBUSY); + } + } + } +} + +static int +futex_lock_wake_up_next(struct futex_lock *fl, cloudabi_lock_t *lock) +{ + cloudabi_tid_t tid; + int error; + + /* + * Determine which thread(s) to wake up. Prefer waking up + * writers over readers to prevent write starvation. + */ + if (futex_queue_count(&fl->fl_writers) > 0) { + /* Transfer ownership to a single write-locker. */ + if (futex_queue_count(&fl->fl_writers) > 1 || + futex_queue_count(&fl->fl_readers) > 0) { + /* Lock should remain managed afterwards. */ + tid = futex_queue_tid_best(&fl->fl_writers); + error = futex_user_store(lock, + tid | CLOUDABI_LOCK_WRLOCKED | + CLOUDABI_LOCK_KERNEL_MANAGED); + if (error != 0) + return (error); + + futex_queue_wake_up_best(&fl->fl_writers); + fl->fl_owner = tid; + } else { + /* Lock can become unmanaged afterwards. */ + error = futex_user_store(lock, + futex_queue_tid_best(&fl->fl_writers) | + CLOUDABI_LOCK_WRLOCKED); + if (error != 0) + return (error); + + futex_queue_wake_up_best(&fl->fl_writers); + fl->fl_owner = LOCK_UNMANAGED; + } + } else { + /* Transfer ownership to all read-lockers (if any). */ + error = futex_user_store(lock, + futex_queue_count(&fl->fl_readers)); + if (error != 0) + return (error); + + /* Wake up all threads. */ + futex_queue_wake_up_all(&fl->fl_readers); + fl->fl_owner = LOCK_UNMANAGED; + } + return (0); +} + +static int +futex_lock_wrlock(struct futex_lock *fl, struct thread *td, + cloudabi_lock_t *lock, cloudabi_clockid_t clock_id, + cloudabi_timestamp_t timeout, cloudabi_timestamp_t precision, + struct futex_queue *donated) +{ + struct futex_waiter fw; + int error; + + error = futex_lock_trywrlock(fl, lock, td->td_tid, + futex_queue_count(donated) > 0); + + if (error == 0 || error == EBUSY) { + /* Put donated threads in queue before suspending. */ + KASSERT(futex_queue_count(donated) == 0 || + fl->fl_owner != LOCK_UNMANAGED, + ("Lock should be managed if we are going to donate")); + futex_queue_requeue(donated, &fl->fl_writers, UINT_MAX); + } else { + /* + * This thread cannot deal with the donated threads. + * Wake up the next thread and let it try it by itself. + */ + futex_queue_wake_up_donate(donated, UINT_MAX); + } + + if (error == EBUSY) { + /* Suspend execution if the lock was busy. */ + KASSERT(fl->fl_owner != LOCK_UNMANAGED, + ("Attempted to sleep on an unmanaged lock")); + error = futex_queue_sleep(&fl->fl_writers, fl, &fw, td, + clock_id, timeout, precision); + KASSERT((error == 0) == fw.fw_locked, + ("Should have locked write lock on success")); + KASSERT(futex_queue_count(&fw.fw_donated) == 0, + ("Lock functions cannot receive threads")); + } + if (error != 0) + futex_lock_unmanage(fl, lock); + return (error); +} + +/* + * futex_queue operations. + */ + +static cloudabi_tid_t +futex_queue_tid_best(const struct futex_queue *fq) +{ + + return (STAILQ_FIRST(&fq->fq_list)->fw_tid); +} + +static unsigned int +futex_queue_count(const struct futex_queue *fq) +{ + + return (fq->fq_count); +} + +static void +futex_queue_init(struct futex_queue *fq) +{ + + STAILQ_INIT(&fq->fq_list); + fq->fq_count = 0; +} + +/* Converts a relative timestamp to an sbintime. */ +static sbintime_t +futex_queue_convert_timestamp_relative(cloudabi_timestamp_t ts) +{ + cloudabi_timestamp_t s, ns; + + s = ts / 1000000000; + ns = ts % 1000000000; + if (s > INT32_MAX) + return (INT64_MAX); + return ((s << 32) + (ns << 32) / 1000000000); +} + +/* Converts an absolute timestamp and precision to a pair of sbintime values. */ +static int +futex_queue_convert_timestamp(struct thread *td, cloudabi_clockid_t clock_id, + cloudabi_timestamp_t timeout, cloudabi_timestamp_t precision, + sbintime_t *sbttimeout, sbintime_t *sbtprecision) +{ + cloudabi_timestamp_t now; + int error; + + /* Make the time relative. */ + error = cloudabi_clock_time_get(td, clock_id, &now); + if (error != 0) + return (error); + timeout = timeout < now ? 0 : timeout - now; + + *sbttimeout = futex_queue_convert_timestamp_relative(timeout); + *sbtprecision = futex_queue_convert_timestamp_relative(precision); + return (0); +} + +static int +futex_queue_sleep(struct futex_queue *fq, struct futex_lock *fl, + struct futex_waiter *fw, struct thread *td, cloudabi_clockid_t clock_id, + cloudabi_timestamp_t timeout, cloudabi_timestamp_t precision) +{ + sbintime_t sbttimeout, sbtprecision; + int error; + + /* Initialize futex_waiter object. */ + fw->fw_tid = td->td_tid; + fw->fw_locked = false; + futex_queue_init(&fw->fw_donated); + + if (timeout != UINT64_MAX) { + /* Convert timeout duration. */ + error = futex_queue_convert_timestamp(td, clock_id, timeout, + precision, &sbttimeout, &sbtprecision); + if (error != 0) + return (error); + } + + /* Place object in the queue. */ + fw->fw_queue = fq; + STAILQ_INSERT_TAIL(&fq->fq_list, fw, fw_next); + ++fq->fq_count; + + cv_init(&fw->fw_wait, "futex"); + ++fl->fl_waitcount; + + futex_lock_assert(fl); + if (timeout == UINT64_MAX) { + /* Wait without a timeout. */ + error = cv_wait_sig(&fw->fw_wait, &futex_global_lock); + } else { + /* Wait respecting the timeout. */ + error = cv_timedwait_sig_sbt(&fw->fw_wait, &futex_global_lock, + sbttimeout, sbtprecision, 0); + futex_lock_assert(fl); + if (error == EWOULDBLOCK && + fw->fw_queue != NULL && fw->fw_queue != fq) { + /* + * We got signalled on a condition variable, but + * observed a timeout while waiting to reacquire + * the lock. In other words, we didn't actually + * time out. Go back to sleep and wait for the + * lock to be reacquired. + */ + error = cv_wait_sig(&fw->fw_wait, &futex_global_lock); + } + } + futex_lock_assert(fl); + + --fl->fl_waitcount; + cv_destroy(&fw->fw_wait); + + fq = fw->fw_queue; + if (fq == NULL) { + /* Thread got dequeued, so we've slept successfully. */ + return (0); + } + + /* Thread is still enqueued. Remove it. */ + KASSERT(error != 0, ("Woken up thread is still enqueued")); + STAILQ_REMOVE(&fq->fq_list, fw, futex_waiter, fw_next); + --fq->fq_count; + return (error == EWOULDBLOCK ? ETIMEDOUT : error); +} + +/* Moves up to nwaiters waiters from one queue to another. */ +static void +futex_queue_requeue(struct futex_queue *fqfrom, struct futex_queue *fqto, + unsigned int nwaiters) +{ + struct futex_waiter *fw; + + /* Move waiters to the target queue. */ + while (nwaiters-- > 0 && !STAILQ_EMPTY(&fqfrom->fq_list)) { + fw = STAILQ_FIRST(&fqfrom->fq_list); + STAILQ_REMOVE_HEAD(&fqfrom->fq_list, fw_next); + --fqfrom->fq_count; + + fw->fw_queue = fqto; + STAILQ_INSERT_TAIL(&fqto->fq_list, fw, fw_next); + ++fqto->fq_count; + } +} + +/* Wakes up all waiters in a queue. */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Jul 27 12:14:15 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A3779ABA78; Mon, 27 Jul 2015 12:14:15 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A1E2D0; Mon, 27 Jul 2015 12:14:15 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6RCEFK3042401; Mon, 27 Jul 2015 12:14:15 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6RCEFSh042400; Mon, 27 Jul 2015 12:14:15 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201507271214.t6RCEFSh042400@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Mon, 27 Jul 2015 12:14:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285909 - head/sys/dev/usb/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jul 2015 12:14:15 -0000 Author: marius Date: Mon Jul 27 12:14:14 2015 New Revision: 285909 URL: https://svnweb.freebsd.org/changeset/base/285909 Log: - Probe UICLASS_CDC/UISUBCLASS_ABSTRACT_CONTROL_MODEL/0xff again. This variant of Microsoft RNDIS, i. e. their unofficial version of CDC ACM, has been disabled in r261544 for resolving a conflict with umodem(4). Eventually, in r275790 that problem was dealt with in the right way. However, r275790 failed to put probing of RNDIS devices in question back. - Initialize the device prior to querying it, as required by the RNDIS specification. Otherwise already determining the MAC address may fail rightfully. - On detach, halt the device again. - Use UCDC_SEND_ENCAPSULATED_{COMMAND,RESPONSE}. While these macros are resolving to the same values as UR_{CLEAR_FEATURE,GET_STATUS}, the former set is way more appropriate in this context. - Report unknown - rather: unimplemented - events unconditionally and not just in debug mode. This ensures that we'll get some hint of what is going wrong instead of the driver silently failing. - Deal with the Microsoft ActiveSync requirement of using an input buffer the size of the expected reply or larger - except for variably sized replies - when querying a device. - Fix some pointless NULL checks, style bugs etc. This changes allow urndis(4) to communicate with a Microsoft-certified USB RNDIS test token. MFC after: 3 days Sponsored by: genua mbh Modified: head/sys/dev/usb/net/if_urndis.c Modified: head/sys/dev/usb/net/if_urndis.c ============================================================================== --- head/sys/dev/usb/net/if_urndis.c Mon Jul 27 10:07:29 2015 (r285908) +++ head/sys/dev/usb/net/if_urndis.c Mon Jul 27 12:14:14 2015 (r285909) @@ -78,12 +78,20 @@ static uether_fn_t urndis_start; static uether_fn_t urndis_setmulti; static uether_fn_t urndis_setpromisc; -static uint32_t urndis_ctrl_query(struct urndis_softc *, uint32_t, const void **, uint16_t *); -static uint32_t urndis_ctrl_set(struct urndis_softc *, uint32_t, struct urndis_set_req *, uint16_t); -static uint32_t urndis_ctrl_handle_init(struct urndis_softc *, const struct urndis_comp_hdr *); -static uint32_t urndis_ctrl_handle_query(struct urndis_softc *, const struct urndis_comp_hdr *, const void **, uint16_t *); -static uint32_t urndis_ctrl_handle_reset(struct urndis_softc *, const struct urndis_comp_hdr *); -static uint32_t urndis_ctrl_init(struct urndis_softc *); +static uint32_t urndis_ctrl_query(struct urndis_softc *sc, uint32_t oid, + struct urndis_query_req *msg, uint16_t len, + const void **rbuf, uint16_t *rbufsz); +static uint32_t urndis_ctrl_set(struct urndis_softc *sc, uint32_t oid, + struct urndis_set_req *msg, uint16_t len); +static uint32_t urndis_ctrl_handle_init(struct urndis_softc *sc, + const struct urndis_comp_hdr *hdr); +static uint32_t urndis_ctrl_handle_query(struct urndis_softc *sc, + const struct urndis_comp_hdr *hdr, const void **buf, + uint16_t *bufsz); +static uint32_t urndis_ctrl_handle_reset(struct urndis_softc *sc, + const struct urndis_comp_hdr *hdr); +static uint32_t urndis_ctrl_init(struct urndis_softc *sc); +static uint32_t urndis_ctrl_halt(struct urndis_softc *sc); #ifdef USB_DEBUG static int urndis_debug = 0; @@ -93,7 +101,6 @@ SYSCTL_INT(_hw_usb_urndis, OID_AUTO, deb #endif static const struct usb_config urndis_config[URNDIS_N_TRANSFER] = { - [URNDIS_BULK_RX] = { .type = UE_BULK, .endpoint = UE_ADDR_ANY, @@ -154,7 +161,7 @@ static driver_t urndis_driver = { static devclass_t urndis_devclass; -DRIVER_MODULE(urndis, uhub, urndis_driver, urndis_devclass, NULL, 0); +DRIVER_MODULE(urndis, uhub, urndis_driver, urndis_devclass, NULL, NULL); MODULE_VERSION(urndis, 1); MODULE_DEPEND(urndis, uether, 1, 1, 1); MODULE_DEPEND(urndis, usb, 1, 1, 1); @@ -171,6 +178,9 @@ static const struct usb_ether_methods ur static const STRUCT_USB_HOST_ID urndis_host_devs[] = { /* Generic RNDIS class match */ + {USB_IFACE_CLASS(UICLASS_CDC), + USB_IFACE_SUBCLASS(UISUBCLASS_ABSTRACT_CONTROL_MODEL), + USB_IFACE_PROTOCOL(0xff)}, {USB_IFACE_CLASS(UICLASS_WIRELESS), USB_IFACE_SUBCLASS(UISUBCLASS_RF), USB_IFACE_PROTOCOL(UIPROTO_RNDIS)}, {USB_IFACE_CLASS(UICLASS_IAD), USB_IFACE_SUBCLASS(UISUBCLASS_SYNC), @@ -192,21 +202,27 @@ urndis_probe(device_t dev) static void urndis_attach_post(struct usb_ether *ue) { + /* no-op */ - return; } static int urndis_attach(device_t dev) { + static struct { + union { + struct urndis_query_req query; + struct urndis_set_req set; + } hdr; + union { + uint8_t eaddr[ETHER_ADDR_LEN]; + uint32_t filter; + } ibuf; + } msg; struct urndis_softc *sc = device_get_softc(dev); struct usb_ether *ue = &sc->sc_ue; struct usb_attach_arg *uaa = device_get_ivars(dev); struct usb_cdc_cm_descriptor *cmd; - struct { - struct urndis_set_req hdr; - uint32_t filter; - } msg_filter; const void *buf; uint16_t bufsz; uint8_t iface_index[2] = { uaa->info.bIfaceIndex + 1, uaa->info.bIfaceIndex }; @@ -228,9 +244,7 @@ urndis_attach(device_t dev) mtx_init(&sc->sc_mtx, device_get_nameunit(dev), NULL, MTX_DEF); /* scan the alternate settings looking for a valid one */ - for (i = 0; i != 32; i++) { - error = usbd_set_alt_interface_index(uaa->device, iface_index[0], i); @@ -244,16 +258,27 @@ urndis_attach(device_t dev) if (error == 0) break; } - if ((error != 0) || (i == 32)) { - device_printf(dev, "No valid alternate " - "setting found\n"); + device_printf(dev, "No valid alternate setting found\n"); goto detach; } + + /* Initialize device - must be done before even querying it */ URNDIS_LOCK(sc); - error = urndis_ctrl_query(sc, OID_802_3_PERMANENT_ADDRESS, &buf, &bufsz); + error = urndis_ctrl_init(sc); URNDIS_UNLOCK(sc); + if (error != (int)RNDIS_STATUS_SUCCESS) { + device_printf(dev, "Unable to initialize hardware\n"); + goto detach; + } + /* Determine MAC address */ + memset(msg.ibuf.eaddr, 0, sizeof(msg.ibuf.eaddr)); + URNDIS_LOCK(sc); + error = urndis_ctrl_query(sc, OID_802_3_PERMANENT_ADDRESS, + &msg.hdr.query, sizeof(msg.hdr.query) + sizeof(msg.ibuf.eaddr), + &buf, &bufsz); + URNDIS_UNLOCK(sc); if (error != (int)RNDIS_STATUS_SUCCESS) { device_printf(dev, "Unable to get hardware address\n"); goto detach; @@ -267,17 +292,16 @@ urndis_attach(device_t dev) /* Initialize packet filter */ sc->sc_filter = RNDIS_PACKET_TYPE_BROADCAST | RNDIS_PACKET_TYPE_ALL_MULTICAST; - msg_filter.filter = htole32(sc->sc_filter); - + msg.ibuf.filter = htole32(sc->sc_filter); URNDIS_LOCK(sc); error = urndis_ctrl_set(sc, OID_GEN_CURRENT_PACKET_FILTER, - &msg_filter.hdr, sizeof(msg_filter)); + &msg.hdr.set, sizeof(msg.hdr.set) + sizeof(msg.ibuf.filter)); URNDIS_UNLOCK(sc); - if (error != (int)RNDIS_STATUS_SUCCESS) { device_printf(dev, "Unable to set data filters\n"); goto detach; } + ue->ue_sc = sc; ue->ue_dev = dev; ue->ue_udev = uaa->device; @@ -298,7 +322,7 @@ urndis_attach(device_t dev) return (0); /* success */ detach: - urndis_detach(dev); + (void)urndis_detach(dev); return (ENXIO); /* failure */ } @@ -313,6 +337,10 @@ urndis_detach(device_t dev) uether_ifdetach(ue); + URNDIS_LOCK(sc); + (void)urndis_ctrl_halt(sc); + URNDIS_UNLOCK(sc); + mtx_destroy(&sc->sc_mtx); return (0); @@ -340,8 +368,6 @@ urndis_init(struct usb_ether *ue) ifp->if_drv_flags |= IFF_DRV_RUNNING; - urndis_ctrl_init(sc); - /* stall data write direction, which depends on USB mode */ usbd_xfer_set_stall(sc->sc_xfer[URNDIS_BULK_TX]); @@ -369,20 +395,21 @@ urndis_stop(struct usb_ether *ue) static void urndis_setmulti(struct usb_ether *ue) { + /* no-op */ - return; } static void urndis_setpromisc(struct usb_ether *ue) { + /* no-op */ - return; } static int urndis_suspend(device_t dev) { + device_printf(dev, "Suspending\n"); return (0); } @@ -390,6 +417,7 @@ urndis_suspend(device_t dev) static int urndis_resume(device_t dev) { + device_printf(dev, "Resuming\n"); return (0); } @@ -416,8 +444,8 @@ urndis_ctrl_send(struct urndis_softc *sc { usb_error_t err; - err = urndis_ctrl_msg(sc, UT_WRITE_CLASS_INTERFACE, UR_GET_STATUS, - sc->sc_ifaceno_ctl, 0, buf, len); + err = urndis_ctrl_msg(sc, UT_WRITE_CLASS_INTERFACE, + UCDC_SEND_ENCAPSULATED_COMMAND, sc->sc_ifaceno_ctl, 0, buf, len); DPRINTF("%s\n", usbd_errstr(err)); @@ -430,8 +458,9 @@ urndis_ctrl_recv(struct urndis_softc *sc struct urndis_comp_hdr *hdr; usb_error_t err; - err = urndis_ctrl_msg(sc, UT_READ_CLASS_INTERFACE, UR_CLEAR_FEATURE, - sc->sc_ifaceno_ctl, 0, sc->sc_response_buf, RNDIS_RESPONSE_LEN); + err = urndis_ctrl_msg(sc, UT_READ_CLASS_INTERFACE, + UCDC_GET_ENCAPSULATED_RESPONSE, sc->sc_ifaceno_ctl, 0, + sc->sc_response_buf, RNDIS_RESPONSE_LEN); if (err != USB_ERR_NORMAL_COMPLETION) return (NULL); @@ -480,7 +509,8 @@ urndis_ctrl_handle(struct urndis_softc * break; default: - DPRINTF("ctrl message error: unknown event 0x%x\n", + device_printf(sc->sc_ue.ue_dev, + "ctrl message error: unknown event 0x%x\n", le32toh(hdr->rm_type)); rval = RNDIS_STATUS_FAILURE; break; @@ -548,10 +578,8 @@ urndis_ctrl_handle_query(struct urndis_s le32toh(msg->rm_infobuflen), le32toh(msg->rm_infobufoffset)); - if (buf != NULL && bufsz != NULL) { - *buf = NULL; - *bufsz = 0; - } + *buf = NULL; + *bufsz = 0; if (le32toh(msg->rm_status) != RNDIS_STATUS_SUCCESS) { DPRINTF("query failed 0x%x\n", le32toh(msg->rm_status)); return (le32toh(msg->rm_status)); @@ -571,10 +599,10 @@ urndis_ctrl_handle_query(struct urndis_s le32toh(msg->rm_len)); return (RNDIS_STATUS_FAILURE); } - if (buf != NULL && bufsz != NULL) { - *buf = ((const uint8_t *)msg) + RNDIS_HEADER_OFFSET + le32toh(msg->rm_infobufoffset); - *bufsz = le32toh(msg->rm_infobuflen); - } + *buf = ((const uint8_t *)msg) + RNDIS_HEADER_OFFSET + + le32toh(msg->rm_infobufoffset); + *bufsz = le32toh(msg->rm_infobuflen); + return (le32toh(msg->rm_status)); } @@ -627,7 +655,7 @@ urndis_ctrl_init(struct urndis_softc *sc msg.rm_type = htole32(REMOTE_NDIS_INITIALIZE_MSG); msg.rm_len = htole32(sizeof(msg)); - msg.rm_rid = htole32(0); + msg.rm_rid = 0; msg.rm_ver_major = htole32(1); msg.rm_ver_minor = htole32(1); msg.rm_max_xfersz = htole32(RNDIS_RX_MAXLEN); @@ -656,7 +684,6 @@ urndis_ctrl_init(struct urndis_softc *sc return (rval); } -#if 0 static uint32_t urndis_ctrl_halt(struct urndis_softc *sc) { @@ -675,27 +702,36 @@ urndis_ctrl_halt(struct urndis_softc *sc rval = urndis_ctrl_send(sc, &msg, sizeof(msg)); if (rval != RNDIS_STATUS_SUCCESS) - printf("halt failed\n"); + DPRINTF("halt failed\n"); return (rval); } -#endif - +/* + * NB: Querying a device has the requirment of using an input buffer the size + * of the expected reply or larger, except for variably sized replies. + */ static uint32_t -urndis_ctrl_query(struct urndis_softc *sc, uint32_t oid, const void **rbuf, uint16_t *rbufsz) +urndis_ctrl_query(struct urndis_softc *sc, uint32_t oid, + struct urndis_query_req *msg, uint16_t len, const void **rbuf, + uint16_t *rbufsz) { - struct urndis_query_req msg; - uint32_t rval; struct urndis_comp_hdr *hdr; + uint32_t datalen, rval; - msg.rm_type = htole32(REMOTE_NDIS_QUERY_MSG); - msg.rm_len = htole32(sizeof(msg)); - msg.rm_rid = 0; /* XXX */ - msg.rm_oid = htole32(oid); - msg.rm_infobuflen = htole32(0); - msg.rm_infobufoffset = 0; - msg.rm_devicevchdl = 0; + msg->rm_type = htole32(REMOTE_NDIS_QUERY_MSG); + msg->rm_len = htole32(len); + msg->rm_rid = 0; /* XXX */ + msg->rm_oid = htole32(oid); + datalen = len - sizeof(*msg); + msg->rm_infobuflen = htole32(datalen); + if (datalen != 0) { + msg->rm_infobufoffset = htole32(sizeof(*msg) - + RNDIS_HEADER_OFFSET); + } else { + msg->rm_infobufoffset = 0; + } + msg->rm_devicevchdl = 0; DPRINTF("type %u len %u rid %u oid 0x%x " "infobuflen %u infobufoffset %u devicevchdl %u\n", @@ -707,7 +743,7 @@ urndis_ctrl_query(struct urndis_softc *s le32toh(msg.rm_infobufoffset), le32toh(msg.rm_devicevchdl)); - rval = urndis_ctrl_send(sc, &msg, sizeof(msg)); + rval = urndis_ctrl_send(sc, msg, len); if (rval != RNDIS_STATUS_SUCCESS) { DPRINTF("query failed\n"); @@ -723,19 +759,21 @@ urndis_ctrl_query(struct urndis_softc *s } static uint32_t -urndis_ctrl_set(struct urndis_softc *sc, uint32_t oid, struct urndis_set_req *msg, uint16_t len) +urndis_ctrl_set(struct urndis_softc *sc, uint32_t oid, + struct urndis_set_req *msg, uint16_t len) { struct urndis_comp_hdr *hdr; - uint32_t rval; - uint32_t datalen = len - sizeof(*msg); + uint32_t datalen, rval; msg->rm_type = htole32(REMOTE_NDIS_SET_MSG); msg->rm_len = htole32(len); msg->rm_rid = 0; /* XXX */ msg->rm_oid = htole32(oid); + datalen = len - sizeof(*msg); msg->rm_infobuflen = htole32(datalen); if (datalen != 0) { - msg->rm_infobufoffset = htole32(sizeof(*msg) - RNDIS_HEADER_OFFSET); + msg->rm_infobufoffset = htole32(sizeof(*msg) - + RNDIS_HEADER_OFFSET); } else { msg->rm_infobufoffset = 0; } @@ -782,13 +820,11 @@ urndis_bulk_read_callback(struct usb_xfe switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: - usbd_xfer_status(xfer, &actlen, NULL, &aframes, NULL); DPRINTFN(1, "received %u bytes in %u frames\n", actlen, aframes); for (offset = 0; actlen >= (uint32_t)sizeof(msg);) { - /* copy out header */ usbd_copy_out(pc, offset, &msg, sizeof(msg)); @@ -929,7 +965,7 @@ tr_setup: usbd_xfer_set_frame_offset(xfer, x * RNDIS_TX_MAXLEN, x); - next_pkt: +next_pkt: IFQ_DRV_DEQUEUE(&ifp->if_snd, m); if (m == NULL) From owner-svn-src-all@freebsd.org Mon Jul 27 13:17:59 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A273B9AAA7D; Mon, 27 Jul 2015 13:17:59 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8671A2BA; Mon, 27 Jul 2015 13:17:59 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6RDHxxT067200; Mon, 27 Jul 2015 13:17:59 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6RDHwpj067194; Mon, 27 Jul 2015 13:17:58 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201507271317.t6RDHwpj067194@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Mon, 27 Jul 2015 13:17:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285910 - in head: lib/libc/sys sys/kern sys/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jul 2015 13:17:59 -0000 Author: ed Date: Mon Jul 27 13:17:57 2015 New Revision: 285910 URL: https://svnweb.freebsd.org/changeset/base/285910 Log: Make shutdown() return ENOTCONN as required by POSIX, part deux. Summary: Back in 2005, maxim@ attempted to fix shutdown() to return ENOTCONN in case the socket was not connected (r150152). This had to be rolled back (r150155), as it broke some of the existing programs that depend on this behavior. I reapplied this change on my system and indeed, syslogd failed to start up. I fixed this back in February (279016) and MFC'ed it to the supported stable branches. Apart from that, things seem to work out all right. Since at least Linux and Mac OS X do the right thing, I'd like to go ahead and give this another try. To keep old copies of syslogd working, only start returning ENOTCONN for recent binaries. I took a look at the XNU sources and they seem to test against both SS_ISCONNECTED, SS_ISCONNECTING and SS_ISDISCONNECTING, instead of just SS_ISCONNECTED. That seams reasonable, so let's do the same. Test Plan: This issue was uncovered while writing tests for shutdown() in CloudABI: https://github.com/NuxiNL/cloudlibc/blob/master/src/libc/sys/socket/shutdown_test.c#L26 Reviewers: glebius, rwatson, #manpages, gnn, #network Reviewed By: gnn, #network Subscribers: bms, mjg, imp Differential Revision: https://reviews.freebsd.org/D3039 Modified: head/lib/libc/sys/shutdown.2 head/sys/kern/uipc_socket.c head/sys/kern/uipc_syscalls.c head/sys/sys/param.h Modified: head/lib/libc/sys/shutdown.2 ============================================================================== --- head/lib/libc/sys/shutdown.2 Mon Jul 27 12:14:14 2015 (r285909) +++ head/lib/libc/sys/shutdown.2 Mon Jul 27 13:17:57 2015 (r285910) @@ -29,7 +29,7 @@ .\" @(#)shutdown.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd March 5, 2007 +.Dd July 27, 2015 .Dt SHUTDOWN 2 .Os .Sh NAME @@ -79,40 +79,26 @@ The following protocol specific actions based on the properties of the socket associated with the file descriptor .Fa s . .Bl -column ".Dv PF_INET6" ".Dv SOCK_STREAM" ".Dv IPPROTO_SCTP" -.It Sy Domain Ta Sy Type Ta Sy Protocol Ta Sy Return value and action +.It Sy Domain Ta Sy Type Ta Sy Protocol Ta Sy Action .It Dv PF_INET Ta Dv SOCK_DGRAM Ta Dv IPPROTO_SCTP Ta -Return \-1. -The global variable -.Va errno -will be set to -.Er EOPNOTSUPP . +Failure, +as socket is not connected. .It Dv PF_INET Ta Dv SOCK_DGRAM Ta Dv IPPROTO_UDP Ta -Return 0. -ICMP messages will -.Em not -be generated. +Failure, +as socket is not connected. .It Dv PF_INET Ta Dv SOCK_STREAM Ta Dv IPPROTO_SCTP Ta -Return 0. Send queued data and tear down association. .It Dv PF_INET Ta Dv SOCK_STREAM Ta Dv IPPROTO_TCP Ta -Return 0. Send queued data, wait for ACK, then send FIN. .It Dv PF_INET6 Ta Dv SOCK_DGRAM Ta Dv IPPROTO_SCTP Ta -Return \-1. -The global variable -.Va errno -will be set to -.Er EOPNOTSUPP . +Failure, +as socket is not connected. .It Dv PF_INET6 Ta Dv SOCK_DGRAM Ta Dv IPPROTO_UDP Ta -Return 0. -ICMP messages will -.Em not -be generated. +Failure, +as socket is not connected. .It Dv PF_INET6 Ta Dv SOCK_STREAM Ta Dv IPPROTO_SCTP Ta -Return 0. Send queued data and tear down association. .It Dv PF_INET6 Ta Dv SOCK_STREAM Ta Dv IPPROTO_TCP Ta -Return 0. Send queued data, wait for ACK, then send FIN. .El .\" @@ -131,16 +117,10 @@ argument is not a valid file descriptor. The .Fa how argument is invalid. -.It Bq Er EOPNOTSUPP -The socket associated with the file descriptor -.Fa s -does not support this operation. .It Bq Er ENOTCONN The .Fa s -argument specifies a -.Dv SOCK_STREAM -socket which is not connected. +argument specifies a socket which is not connected. .It Bq Er ENOTSOCK The .Fa s Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Mon Jul 27 12:14:14 2015 (r285909) +++ head/sys/kern/uipc_socket.c Mon Jul 27 13:17:57 2015 (r285910) @@ -2334,6 +2334,9 @@ soshutdown(struct socket *so, int how) if (!(how == SHUT_RD || how == SHUT_WR || how == SHUT_RDWR)) return (EINVAL); + if ((so->so_state & + (SS_ISCONNECTED | SS_ISCONNECTING | SS_ISDISCONNECTING)) == 0) + return (ENOTCONN); CURVNET_SET(so->so_vnet); if (pr->pr_usrreqs->pru_flush != NULL) Modified: head/sys/kern/uipc_syscalls.c ============================================================================== --- head/sys/kern/uipc_syscalls.c Mon Jul 27 12:14:14 2015 (r285909) +++ head/sys/kern/uipc_syscalls.c Mon Jul 27 13:17:57 2015 (r285910) @@ -1383,6 +1383,15 @@ sys_shutdown(td, uap) if (error == 0) { so = fp->f_data; error = soshutdown(so, uap->how); + /* + * Previous versions did not return ENOTCONN, but 0 in + * case the socket was not connected. Some important + * programs like syslogd up to r279016, 2015-02-19, + * still depend on this behavior. + */ + if (error == ENOTCONN && + td->td_proc->p_osrel < P_OSREL_SHUTDOWN_ENOTCONN) + error = 0; fdrop(fp, td); } return (error); Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Jul 27 12:14:14 2015 (r285909) +++ head/sys/sys/param.h Mon Jul 27 13:17:57 2015 (r285910) @@ -77,12 +77,13 @@ #define __FreeBSD_kernel__ #ifdef _KERNEL -#define P_OSREL_SIGWAIT 700000 -#define P_OSREL_SIGSEGV 700004 -#define P_OSREL_MAP_ANON 800104 -#define P_OSREL_MAP_FSTRICT 1100036 +#define P_OSREL_SIGWAIT 700000 +#define P_OSREL_SIGSEGV 700004 +#define P_OSREL_MAP_ANON 800104 +#define P_OSREL_MAP_FSTRICT 1100036 +#define P_OSREL_SHUTDOWN_ENOTCONN 1100077 -#define P_OSREL_MAJOR(x) ((x) / 100000) +#define P_OSREL_MAJOR(x) ((x) / 100000) #endif #ifndef LOCORE From owner-svn-src-all@freebsd.org Mon Jul 27 14:03:36 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B163E9AC402; Mon, 27 Jul 2015 14:03:36 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F338C0B; Mon, 27 Jul 2015 14:03:36 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6RE3aTU086959; Mon, 27 Jul 2015 14:03:36 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6RE3ZO5086956; Mon, 27 Jul 2015 14:03:35 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201507271403.t6RE3ZO5086956@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Mon, 27 Jul 2015 14:03:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285911 - in head/sys/dev/vt/hw: efifb fb X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jul 2015 14:03:36 -0000 Author: marius Date: Mon Jul 27 14:03:34 2015 New Revision: 285911 URL: https://svnweb.freebsd.org/changeset/base/285911 Log: - Nuke dupe $FreeBSD$. - Fix whitespace. MFC after: 3 days Modified: head/sys/dev/vt/hw/efifb/efifb.c head/sys/dev/vt/hw/fb/vt_early_fb.c head/sys/dev/vt/hw/fb/vt_fb.c Modified: head/sys/dev/vt/hw/efifb/efifb.c ============================================================================== --- head/sys/dev/vt/hw/efifb/efifb.c Mon Jul 27 13:17:57 2015 (r285910) +++ head/sys/dev/vt/hw/efifb/efifb.c Mon Jul 27 14:03:34 2015 (r285911) @@ -25,8 +25,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #include @@ -178,4 +176,3 @@ vt_efifb_remap(void *xinfo) info->fb_vbase = (intptr_t)pmap_mapdev_attr(info->fb_pbase, info->fb_size, VM_MEMATTR_WRITE_COMBINING); } - Modified: head/sys/dev/vt/hw/fb/vt_early_fb.c ============================================================================== --- head/sys/dev/vt/hw/fb/vt_early_fb.c Mon Jul 27 13:17:57 2015 (r285910) +++ head/sys/dev/vt/hw/fb/vt_early_fb.c Mon Jul 27 14:03:34 2015 (r285911) @@ -25,8 +25,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #include @@ -127,7 +125,7 @@ vt_efb_initialize(struct fb_info *info) default: panic("Unknown color space fb_depth %d", info->fb_depth); break; - } + } } static phandle_t @@ -213,9 +211,9 @@ vt_efb_init(struct vt_device *vd) if (len == -1) { len = OF_getprop(OF_parent(node), "assigned-addresses", pciaddrs, sizeof(pciaddrs)); - } - if (len == -1) - len = 0; + } + if (len == -1) + len = 0; n_pciaddrs = len / sizeof(struct ofw_pci_register); /* @@ -283,7 +281,7 @@ vt_efb_init(struct vt_device *vd) BUS_SPACE_MAP_PREFETCHABLE, (bus_space_handle_t *)&info->fb_vbase); #endif - } + } /* blank full size */ len = info->fb_size / 4; Modified: head/sys/dev/vt/hw/fb/vt_fb.c ============================================================================== --- head/sys/dev/vt/hw/fb/vt_fb.c Mon Jul 27 13:17:57 2015 (r285910) +++ head/sys/dev/vt/hw/fb/vt_fb.c Mon Jul 27 14:03:34 2015 (r285911) @@ -25,8 +25,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #include @@ -188,7 +186,6 @@ vt_fb_setpixel(struct vt_device *vd, int /* panic? */ return; } - } void From owner-svn-src-all@freebsd.org Mon Jul 27 14:34:33 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51CB19ACB91; Mon, 27 Jul 2015 14:34:33 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 42252A02; Mon, 27 Jul 2015 14:34:33 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6REYXc0099145; Mon, 27 Jul 2015 14:34:33 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6REYXGF099144; Mon, 27 Jul 2015 14:34:33 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201507271434.t6REYXGF099144@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Mon, 27 Jul 2015 14:34:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285912 - head/sys/dev/vt/colors X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jul 2015 14:34:33 -0000 Author: marius Date: Mon Jul 27 14:34:32 2015 New Revision: 285912 URL: https://svnweb.freebsd.org/changeset/base/285912 Log: - Use __FBSDID(). - Const'ify cons_to_vga_colors. - Fix line wrapping. MFC after: 3 days Modified: head/sys/dev/vt/colors/vt_termcolors.c Modified: head/sys/dev/vt/colors/vt_termcolors.c ============================================================================== --- head/sys/dev/vt/colors/vt_termcolors.c Mon Jul 27 14:03:34 2015 (r285911) +++ head/sys/dev/vt/colors/vt_termcolors.c Mon Jul 27 14:34:32 2015 (r285912) @@ -25,15 +25,16 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ +#include +__FBSDID("$FreeBSD$"); + #include #include -static struct { +static const struct { unsigned char r; /* Red percentage value. */ unsigned char g; /* Green percentage value. */ unsigned char b; /* Blue percentage value. */ @@ -68,8 +69,8 @@ static const int cons_to_vga_colors[16] }; int -vt_generate_cons_palette(uint32_t *palette, int format, uint32_t rmax, int roffset, - uint32_t gmax, int goffset, uint32_t bmax, int boffset) +vt_generate_cons_palette(uint32_t *palette, int format, uint32_t rmax, + int roffset, uint32_t gmax, int goffset, uint32_t bmax, int boffset) { int i; From owner-svn-src-all@freebsd.org Mon Jul 27 14:43:15 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1EFF9AC104; Mon, 27 Jul 2015 14:43:15 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 985E1326; Mon, 27 Jul 2015 14:43:15 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6REhFJ3003421; Mon, 27 Jul 2015 14:43:15 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6REhFwg003419; Mon, 27 Jul 2015 14:43:15 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201507271443.t6REhFwg003419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Mon, 27 Jul 2015 14:43:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285913 - in head: etc/devd sys/dev/usb/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jul 2015 14:43:15 -0000 Author: marius Date: Mon Jul 27 14:43:14 2015 New Revision: 285913 URL: https://svnweb.freebsd.org/changeset/base/285913 Log: - Fix compilation after r285909 with USB_DEBUG defined. - Regenerate usb.conf. Modified: head/etc/devd/usb.conf head/sys/dev/usb/net/if_urndis.c Modified: head/etc/devd/usb.conf ============================================================================== --- head/etc/devd/usb.conf Mon Jul 27 14:34:32 2015 (r285912) +++ head/etc/devd/usb.conf Mon Jul 27 14:43:14 2015 (r285913) @@ -5436,6 +5436,15 @@ nomatch 32 { nomatch 32 { match "bus" "uhub[0-9]+"; match "mode" "host"; + match "intclass" "0x02"; + match "intsubclass" "0x02"; + match "intprotocol" "0xff"; + action "kldload -n if_urndis"; +}; + +nomatch 32 { + match "bus" "uhub[0-9]+"; + match "mode" "host"; match "intclass" "0x03"; match "intsubclass" "0x01"; match "intprotocol" "0x01"; @@ -5576,5 +5585,5 @@ nomatch 32 { action "kldload -n umass"; }; -# 2687 USB entries processed +# 2688 USB entries processed Modified: head/sys/dev/usb/net/if_urndis.c ============================================================================== --- head/sys/dev/usb/net/if_urndis.c Mon Jul 27 14:34:32 2015 (r285912) +++ head/sys/dev/usb/net/if_urndis.c Mon Jul 27 14:43:14 2015 (r285913) @@ -735,13 +735,13 @@ urndis_ctrl_query(struct urndis_softc *s DPRINTF("type %u len %u rid %u oid 0x%x " "infobuflen %u infobufoffset %u devicevchdl %u\n", - le32toh(msg.rm_type), - le32toh(msg.rm_len), - le32toh(msg.rm_rid), - le32toh(msg.rm_oid), - le32toh(msg.rm_infobuflen), - le32toh(msg.rm_infobufoffset), - le32toh(msg.rm_devicevchdl)); + le32toh(msg->rm_type), + le32toh(msg->rm_len), + le32toh(msg->rm_rid), + le32toh(msg->rm_oid), + le32toh(msg->rm_infobuflen), + le32toh(msg->rm_infobufoffset), + le32toh(msg->rm_devicevchdl)); rval = urndis_ctrl_send(sc, msg, len); From owner-svn-src-all@freebsd.org Mon Jul 27 15:26:52 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 439DE9AC9EE; Mon, 27 Jul 2015 15:26:52 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 272D5EE; Mon, 27 Jul 2015 15:26:52 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6RFQqf5020506; Mon, 27 Jul 2015 15:26:52 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6RFQpuf020504; Mon, 27 Jul 2015 15:26:51 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201507271526.t6RFQpuf020504@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Mon, 27 Jul 2015 15:26:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285914 - head/sys/dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jul 2015 15:26:52 -0000 Author: marius Date: Mon Jul 27 15:26:50 2015 New Revision: 285914 URL: https://svnweb.freebsd.org/changeset/base/285914 Log: - Move the remainder of host controller capability registers reading from xhci_start_controller() to xhci_init(). These values don't change at run- time so there's no point of acquiring them on every USB_HW_POWER_RESUME instead of only once during initialization. In r276717, reading the first couple of registers in question already had been moved as a prerequisite for the changes in that revision. - Identify ASMedia ASM1042A controllers. - Use NULL instead of 0 for pointers. MFC after: 3 days Modified: head/sys/dev/usb/controller/xhci.c head/sys/dev/usb/controller/xhci_pci.c Modified: head/sys/dev/usb/controller/xhci.c ============================================================================== --- head/sys/dev/usb/controller/xhci.c Mon Jul 27 14:43:14 2015 (r285913) +++ head/sys/dev/usb/controller/xhci.c Mon Jul 27 15:26:50 2015 (r285914) @@ -375,54 +375,12 @@ xhci_start_controller(struct xhci_softc return (USB_ERR_IOERROR); } - if (!(XREAD4(sc, oper, XHCI_PAGESIZE) & XHCI_PAGESIZE_4K)) { - device_printf(sc->sc_bus.parent, "Controller does " - "not support 4K page size.\n"); - return (USB_ERR_IOERROR); - } - - temp = XREAD4(sc, capa, XHCI_HCSPARAMS1); - - i = XHCI_HCS1_N_PORTS(temp); - - if (i == 0) { - device_printf(sc->sc_bus.parent, "Invalid number " - "of ports: %u\n", i); - return (USB_ERR_IOERROR); - } - - sc->sc_noport = i; - sc->sc_noslot = XHCI_HCS1_DEVSLOT_MAX(temp); - - if (sc->sc_noslot > XHCI_MAX_DEVICES) - sc->sc_noslot = XHCI_MAX_DEVICES; - /* set up number of device slots */ - DPRINTF("CONFIG=0x%08x -> 0x%08x\n", XREAD4(sc, oper, XHCI_CONFIG), sc->sc_noslot); XWRITE4(sc, oper, XHCI_CONFIG, sc->sc_noslot); - DPRINTF("Max slots: %u\n", sc->sc_noslot); - - temp = XREAD4(sc, capa, XHCI_HCSPARAMS2); - - sc->sc_noscratch = XHCI_HCS2_SPB_MAX(temp); - - if (sc->sc_noscratch > XHCI_MAX_SCRATCHPADS) { - device_printf(sc->sc_bus.parent, "XHCI request " - "too many scratchpads\n"); - return (USB_ERR_NOMEM); - } - - DPRINTF("Max scratch: %u\n", sc->sc_noscratch); - - temp = XREAD4(sc, capa, XHCI_HCSPARAMS3); - - sc->sc_exit_lat_max = XHCI_HCS3_U1_DEL(temp) + - XHCI_HCS3_U2_DEL(temp) + 250 /* us */; - temp = XREAD4(sc, oper, XHCI_USBSTS); /* clear interrupts */ @@ -454,29 +412,13 @@ xhci_start_controller(struct xhci_softc XWRITE4(sc, oper, XHCI_DCBAAP_LO, (uint32_t)addr); XWRITE4(sc, oper, XHCI_DCBAAP_HI, (uint32_t)(addr >> 32)); - /* Setup event table size */ - - temp = XREAD4(sc, capa, XHCI_HCSPARAMS2); - - DPRINTF("HCS2=0x%08x\n", temp); - - temp = XHCI_HCS2_ERST_MAX(temp); - temp = 1U << temp; - if (temp > XHCI_MAX_RSEG) - temp = XHCI_MAX_RSEG; - - sc->sc_erst_max = temp; - + /* set up event table size */ DPRINTF("ERSTSZ=0x%08x -> 0x%08x\n", - XREAD4(sc, runt, XHCI_ERSTSZ(0)), temp); + XREAD4(sc, runt, XHCI_ERSTSZ(0)), sc->sc_erst_max); - XWRITE4(sc, runt, XHCI_ERSTSZ(0), XHCI_ERSTS_SET(temp)); + XWRITE4(sc, runt, XHCI_ERSTSZ(0), XHCI_ERSTS_SET(sc->sc_erst_max)); - /* Check if we should use the default IMOD value */ - if (sc->sc_imod_default == 0) - sc->sc_imod_default = XHCI_IMOD_DEFAULT; - - /* Setup interrupt rate */ + /* set up interrupt rate */ XWRITE4(sc, runt, XHCI_IMOD(0), sc->sc_imod_default); usbd_get_page(&sc->sc_hw.root_pc, 0, &buf_res); @@ -503,8 +445,7 @@ xhci_start_controller(struct xhci_softc XWRITE4(sc, runt, XHCI_ERSTBA_LO(0), (uint32_t)addr); XWRITE4(sc, runt, XHCI_ERSTBA_HI(0), (uint32_t)(addr >> 32)); - /* Setup interrupter registers */ - + /* set up interrupter registers */ temp = XREAD4(sc, runt, XHCI_IMAN(0)); temp |= XHCI_IMAN_INTR_ENA; XWRITE4(sc, runt, XHCI_IMAN(0), temp); @@ -615,6 +556,12 @@ xhci_init(struct xhci_softc *sc, device_ DPRINTF("xHCI version = 0x%04x\n", XREAD2(sc, capa, XHCI_HCIVERSION)); + if (!(XREAD4(sc, oper, XHCI_PAGESIZE) & XHCI_PAGESIZE_4K)) { + device_printf(sc->sc_bus.parent, "Controller does " + "not support 4K page size.\n"); + return (ENXIO); + } + temp = XREAD4(sc, capa, XHCI_HCSPARAMS0); DPRINTF("HCS0 = 0x%08x\n", temp); @@ -633,6 +580,55 @@ xhci_init(struct xhci_softc *sc, device_ device_printf(self, "%d bytes context size, %d-bit DMA\n", sc->sc_ctx_is_64_byte ? 64 : 32, (int)sc->sc_bus.dma_bits); + temp = XREAD4(sc, capa, XHCI_HCSPARAMS1); + + /* get number of device slots */ + sc->sc_noport = XHCI_HCS1_N_PORTS(temp); + + if (sc->sc_noport == 0) { + device_printf(sc->sc_bus.parent, "Invalid number " + "of ports: %u\n", sc->sc_noport); + return (ENXIO); + } + + sc->sc_noport = sc->sc_noport; + sc->sc_noslot = XHCI_HCS1_DEVSLOT_MAX(temp); + + DPRINTF("Max slots: %u\n", sc->sc_noslot); + + if (sc->sc_noslot > XHCI_MAX_DEVICES) + sc->sc_noslot = XHCI_MAX_DEVICES; + + temp = XREAD4(sc, capa, XHCI_HCSPARAMS2); + + DPRINTF("HCS2=0x%08x\n", temp); + + /* get number of scratchpads */ + sc->sc_noscratch = XHCI_HCS2_SPB_MAX(temp); + + if (sc->sc_noscratch > XHCI_MAX_SCRATCHPADS) { + device_printf(sc->sc_bus.parent, "XHCI request " + "too many scratchpads\n"); + return (ENOMEM); + } + + DPRINTF("Max scratch: %u\n", sc->sc_noscratch); + + /* get event table size */ + sc->sc_erst_max = 1U << XHCI_HCS2_ERST_MAX(temp); + if (sc->sc_erst_max > XHCI_MAX_RSEG) + sc->sc_erst_max = XHCI_MAX_RSEG; + + temp = XREAD4(sc, capa, XHCI_HCSPARAMS3); + + /* get maximum exit latency */ + sc->sc_exit_lat_max = XHCI_HCS3_U1_DEL(temp) + + XHCI_HCS3_U2_DEL(temp) + 250 /* us */; + + /* Check if we should use the default IMOD value. */ + if (sc->sc_imod_default == 0) + sc->sc_imod_default = XHCI_IMOD_DEFAULT; + /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(self), &xhci_iterate_hw_softc)) { Modified: head/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- head/sys/dev/usb/controller/xhci_pci.c Mon Jul 27 14:43:14 2015 (r285913) +++ head/sys/dev/usb/controller/xhci_pci.c Mon Jul 27 15:26:50 2015 (r285914) @@ -86,10 +86,9 @@ static driver_t xhci_driver = { static devclass_t xhci_devclass; -DRIVER_MODULE(xhci, pci, xhci_driver, xhci_devclass, 0, 0); +DRIVER_MODULE(xhci, pci, xhci_driver, xhci_devclass, NULL, NULL); MODULE_DEPEND(xhci, usb, 1, 1, 1); - static const char * xhci_pci_match(device_t self) { @@ -101,6 +100,8 @@ xhci_pci_match(device_t self) case 0x10421b21: return ("ASMedia ASM1042 USB 3.0 controller"); + case 0x11421b21: + return ("ASMedia ASM1042A USB 3.0 controller"); case 0x0f358086: return ("Intel Intel BayTrail USB 3.0 controller"); @@ -193,16 +194,28 @@ xhci_pci_attach(device_t self) sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res); sc->sc_io_size = rman_get_size(sc->sc_io_res); - /* check for USB 3.0 controllers which don't support 64-bit DMA */ switch (pci_get_devid(self)) { case 0x01941033: /* NEC uPD720200 USB 3.0 controller */ + /* Don't use 64-bit DMA on these controllers. */ usedma32 = 1; break; + case 0x0f358086: /* BayTrail */ + case 0x9c318086: /* Panther Point */ + case 0x1e318086: /* Panther Point */ + case 0x8c318086: /* Lynx Point */ + case 0x8cb18086: /* Wildcat Point */ + /* + * On Intel chipsets, reroute ports from EHCI to XHCI + * controller and use a different IMOD value. + */ + sc->sc_port_route = &xhci_pci_port_route; + sc->sc_imod_default = XHCI_IMOD_DEFAULT_LP; + /* FALLTHROUGH */ default: usedma32 = 0; break; } - + if (xhci_init(sc, self, usedma32)) { device_printf(self, "Could not initialize softc\n"); bus_release_resource(self, SYS_RES_MEMORY, PCI_XHCI_CBMEM, @@ -261,20 +274,6 @@ xhci_pci_attach(device_t self) goto error; } - /* On Intel chipsets reroute ports from EHCI to XHCI controller. */ - switch (pci_get_devid(self)) { - case 0x0f358086: /* BayTrail */ - case 0x9c318086: /* Panther Point */ - case 0x1e318086: /* Panther Point */ - case 0x8c318086: /* Lynx Point */ - case 0x8cb18086: /* Wildcat Point */ - sc->sc_port_route = &xhci_pci_port_route; - sc->sc_imod_default = XHCI_IMOD_DEFAULT_LP; - break; - default: - break; - } - xhci_pci_take_controller(self); err = xhci_halt_controller(sc); From owner-svn-src-all@freebsd.org Mon Jul 27 15:32:38 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 967FE9ACC09; Mon, 27 Jul 2015 15:32:38 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 865378FD; Mon, 27 Jul 2015 15:32:38 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6RFWcwT024346; Mon, 27 Jul 2015 15:32:38 GMT (envelope-from jimharris@FreeBSD.org) Received: (from jimharris@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6RFWc5C024345; Mon, 27 Jul 2015 15:32:38 GMT (envelope-from jimharris@FreeBSD.org) Message-Id: <201507271532.t6RFWc5C024345@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jimharris set sender to jimharris@FreeBSD.org using -f From: Jim Harris Date: Mon, 27 Jul 2015 15:32:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285915 - stable/10/sys/dev/nvd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jul 2015 15:32:38 -0000 Author: jimharris Date: Mon Jul 27 15:32:37 2015 New Revision: 285915 URL: https://svnweb.freebsd.org/changeset/base/285915 Log: MFC r285767: nvd: set d_delmaxsize to full capacity of NVMe namespace The NVMe specification has no ability to specify a maximum delete size that is less than the full capacity of the namespace - so just using the namespace size is the correct value here. This fixes reported issues where ZFS trim on init looked like it was hanging the system - previously the default I/O max size (128KB on Intel NVMe controllers) was used for delete operations which worked out to only about 8MB/s. With this patch I can add an 800GB DC P3700 drive to a ZFS pool in about 15-20 seconds. Sponsored by: Intel Modified: stable/10/sys/dev/nvd/nvd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/nvd/nvd.c ============================================================================== --- stable/10/sys/dev/nvd/nvd.c Mon Jul 27 15:26:50 2015 (r285914) +++ stable/10/sys/dev/nvd/nvd.c Mon Jul 27 15:32:37 2015 (r285915) @@ -278,6 +278,7 @@ nvd_new_disk(struct nvme_namespace *ns, disk->d_maxsize = nvme_ns_get_max_io_xfer_size(ns); disk->d_sectorsize = nvme_ns_get_sector_size(ns); disk->d_mediasize = (off_t)nvme_ns_get_size(ns); + disk->d_delmaxsize = (off_t)nvme_ns_get_size(ns); if (TAILQ_EMPTY(&disk_head)) disk->d_unit = 0; From owner-svn-src-all@freebsd.org Mon Jul 27 15:34:03 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84DB69ACCA9; Mon, 27 Jul 2015 15:34:03 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 743CCADA; Mon, 27 Jul 2015 15:34:03 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6RFY3vM024489; Mon, 27 Jul 2015 15:34:03 GMT (envelope-from jimharris@FreeBSD.org) Received: (from jimharris@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6RFY3Z9024488; Mon, 27 Jul 2015 15:34:03 GMT (envelope-from jimharris@FreeBSD.org) Message-Id: <201507271534.t6RFY3Z9024488@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jimharris set sender to jimharris@FreeBSD.org using -f From: Jim Harris Date: Mon, 27 Jul 2015 15:34:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285916 - stable/10/sbin/nvmecontrol X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jul 2015 15:34:03 -0000 Author: jimharris Date: Mon Jul 27 15:34:02 2015 New Revision: 285916 URL: https://svnweb.freebsd.org/changeset/base/285916 Log: MFC r285796: nvmecontrol: read controller identify data before any log page operations Sponsored by: Intel Modified: stable/10/sbin/nvmecontrol/logpage.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/nvmecontrol/logpage.c ============================================================================== --- stable/10/sbin/nvmecontrol/logpage.c Mon Jul 27 15:32:37 2015 (r285915) +++ stable/10/sbin/nvmecontrol/logpage.c Mon Jul 27 15:34:02 2015 (r285916) @@ -298,6 +298,8 @@ logpage(int argc, char *argv[]) open_dev(argv[optind], &fd, 1, 1); } + read_controller_data(fd, &cdata); + /* * The log page attribtues indicate whether or not the controller * supports the SMART/Health information log page on a per @@ -307,7 +309,6 @@ logpage(int argc, char *argv[]) if (log_page != NVME_LOG_HEALTH_INFORMATION) errx(1, "log page %d valid only at controller level", log_page); - read_controller_data(fd, &cdata); if (cdata.lpa.ns_smart == 0) errx(1, "controller does not support per namespace " From owner-svn-src-all@freebsd.org Mon Jul 27 15:35:37 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62FC49ACD6F; Mon, 27 Jul 2015 15:35:37 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46AB3E40; Mon, 27 Jul 2015 15:35:37 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6RFZbuX024842; Mon, 27 Jul 2015 15:35:37 GMT (envelope-from jimharris@FreeBSD.org) Received: (from jimharris@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6RFZboO024841; Mon, 27 Jul 2015 15:35:37 GMT (envelope-from jimharris@FreeBSD.org) Message-Id: <201507271535.t6RFZboO024841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jimharris set sender to jimharris@FreeBSD.org using -f From: Jim Harris Date: Mon, 27 Jul 2015 15:35:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285917 - stable/10/sys/dev/nvme X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jul 2015 15:35:37 -0000 Author: jimharris Date: Mon Jul 27 15:35:36 2015 New Revision: 285917 URL: https://svnweb.freebsd.org/changeset/base/285917 Log: MFC r285815: nvme: properly handle case where pci_alloc_msix does not alloc all vectors Sponsored by: Intel Modified: stable/10/sys/dev/nvme/nvme_ctrlr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- stable/10/sys/dev/nvme/nvme_ctrlr.c Mon Jul 27 15:34:02 2015 (r285916) +++ stable/10/sys/dev/nvme/nvme_ctrlr.c Mon Jul 27 15:35:36 2015 (r285917) @@ -930,7 +930,8 @@ nvme_ctrlr_construct(struct nvme_control { union cap_lo_register cap_lo; union cap_hi_register cap_hi; - int i, num_vectors, per_cpu_io_queues, rid; + int i, per_cpu_io_queues, rid; + int num_vectors_requested, num_vectors_allocated; int status, timeout_period; ctrlr->dev = dev; @@ -988,7 +989,7 @@ nvme_ctrlr_construct(struct nvme_control } /* One vector per IO queue, plus one vector for admin queue. */ - num_vectors = ctrlr->num_io_queues + 1; + num_vectors_requested = ctrlr->num_io_queues + 1; /* * If we cannot even allocate 2 vectors (one for admin, one for @@ -997,15 +998,36 @@ nvme_ctrlr_construct(struct nvme_control if (pci_msix_count(dev) < 2) { ctrlr->msix_enabled = 0; goto intx; - } else if (pci_msix_count(dev) < num_vectors) { + } else if (pci_msix_count(dev) < num_vectors_requested) { ctrlr->per_cpu_io_queues = FALSE; ctrlr->num_io_queues = 1; - num_vectors = 2; /* one for admin, one for I/O */ + num_vectors_requested = 2; /* one for admin, one for I/O */ } - if (pci_alloc_msix(dev, &num_vectors) != 0) { + num_vectors_allocated = num_vectors_requested; + if (pci_alloc_msix(dev, &num_vectors_allocated) != 0) { ctrlr->msix_enabled = 0; goto intx; + } else if (num_vectors_allocated < num_vectors_requested) { + if (num_vectors_allocated < 2) { + pci_release_msi(dev); + ctrlr->msix_enabled = 0; + goto intx; + } else { + ctrlr->per_cpu_io_queues = FALSE; + ctrlr->num_io_queues = 1; + /* + * Release whatever vectors were allocated, and just + * reallocate the two needed for the admin and single + * I/O qpair. + */ + num_vectors_allocated = 2; + pci_release_msi(dev); + if (pci_alloc_msix(dev, &num_vectors_allocated) != 0) + panic("could not reallocate any vectors\n"); + if (num_vectors_allocated != 2) + panic("could not reallocate 2 vectors\n"); + } } /* @@ -1022,7 +1044,7 @@ nvme_ctrlr_construct(struct nvme_control * vendors wishing to import this driver into kernels based on * older versions of FreeBSD. */ - for (i = 0; i < num_vectors; i++) { + for (i = 0; i < num_vectors_allocated; i++) { rid = i + 1; ctrlr->msi_res[i] = bus_alloc_resource_any(ctrlr->dev, SYS_RES_IRQ, &rid, RF_ACTIVE); From owner-svn-src-all@freebsd.org Mon Jul 27 15:37:03 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9763D9ACDD9; Mon, 27 Jul 2015 15:37:03 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7CAD2FC5; Mon, 27 Jul 2015 15:37:03 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6RFb3Dg024955; Mon, 27 Jul 2015 15:37:03 GMT (envelope-from jimharris@FreeBSD.org) Received: (from jimharris@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6RFb3Tg024954; Mon, 27 Jul 2015 15:37:03 GMT (envelope-from jimharris@FreeBSD.org) Message-Id: <201507271537.t6RFb3Tg024954@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jimharris set sender to jimharris@FreeBSD.org using -f From: Jim Harris Date: Mon, 27 Jul 2015 15:37:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285918 - stable/10/sys/dev/nvme X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jul 2015 15:37:03 -0000 Author: jimharris Date: Mon Jul 27 15:37:02 2015 New Revision: 285918 URL: https://svnweb.freebsd.org/changeset/base/285918 Log: MFC r285816: nvme: ensure csts.rdy bit is cleared before returning from nvme_ctrlr_disable Sponsored by: Intel Modified: stable/10/sys/dev/nvme/nvme_ctrlr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- stable/10/sys/dev/nvme/nvme_ctrlr.c Mon Jul 27 15:35:36 2015 (r285917) +++ stable/10/sys/dev/nvme/nvme_ctrlr.c Mon Jul 27 15:37:02 2015 (r285918) @@ -1,5 +1,5 @@ /*- - * Copyright (C) 2012-2014 Intel Corporation + * Copyright (C) 2012-2015 Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -207,7 +207,7 @@ nvme_ctrlr_fail_req_task(void *arg, int } static int -nvme_ctrlr_wait_for_ready(struct nvme_controller *ctrlr) +nvme_ctrlr_wait_for_ready(struct nvme_controller *ctrlr, int desired_val) { int ms_waited; union cc_register cc; @@ -216,18 +216,19 @@ nvme_ctrlr_wait_for_ready(struct nvme_co cc.raw = nvme_mmio_read_4(ctrlr, cc); csts.raw = nvme_mmio_read_4(ctrlr, csts); - if (!cc.bits.en) { - nvme_printf(ctrlr, "%s called with cc.en = 0\n", __func__); + if (cc.bits.en != desired_val) { + nvme_printf(ctrlr, "%s called with desired_val = %d " + "but cc.en = %d\n", __func__, desired_val, cc.bits.en); return (ENXIO); } ms_waited = 0; - while (!csts.bits.rdy) { + while (csts.bits.rdy != desired_val) { DELAY(1000); if (ms_waited++ > ctrlr->ready_timeout_in_ms) { - nvme_printf(ctrlr, "controller did not become ready " - "within %d ms\n", ctrlr->ready_timeout_in_ms); + nvme_printf(ctrlr, "controller ready did not become %d " + "within %d ms\n", desired_val, ctrlr->ready_timeout_in_ms); return (ENXIO); } csts.raw = nvme_mmio_read_4(ctrlr, csts); @@ -246,11 +247,12 @@ nvme_ctrlr_disable(struct nvme_controlle csts.raw = nvme_mmio_read_4(ctrlr, csts); if (cc.bits.en == 1 && csts.bits.rdy == 0) - nvme_ctrlr_wait_for_ready(ctrlr); + nvme_ctrlr_wait_for_ready(ctrlr, 1); cc.bits.en = 0; nvme_mmio_write_4(ctrlr, cc, cc.raw); DELAY(5000); + nvme_ctrlr_wait_for_ready(ctrlr, 0); } static int @@ -267,7 +269,7 @@ nvme_ctrlr_enable(struct nvme_controller if (csts.bits.rdy == 1) return (0); else - return (nvme_ctrlr_wait_for_ready(ctrlr)); + return (nvme_ctrlr_wait_for_ready(ctrlr, 1)); } nvme_mmio_write_8(ctrlr, asq, ctrlr->adminq.cmd_bus_addr); @@ -295,7 +297,7 @@ nvme_ctrlr_enable(struct nvme_controller nvme_mmio_write_4(ctrlr, cc, cc.raw); DELAY(5000); - return (nvme_ctrlr_wait_for_ready(ctrlr)); + return (nvme_ctrlr_wait_for_ready(ctrlr, 1)); } int From owner-svn-src-all@freebsd.org Mon Jul 27 17:50:06 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5110C9ACF11; Mon, 27 Jul 2015 17:50:06 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 419273A4; Mon, 27 Jul 2015 17:50:06 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6RHo6GR079311; Mon, 27 Jul 2015 17:50:06 GMT (envelope-from jimharris@FreeBSD.org) Received: (from jimharris@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6RHo6NC079310; Mon, 27 Jul 2015 17:50:06 GMT (envelope-from jimharris@FreeBSD.org) Message-Id: <201507271750.t6RHo6NC079310@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jimharris set sender to jimharris@FreeBSD.org using -f From: Jim Harris Date: Mon, 27 Jul 2015 17:50:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r285919 - releng/10.2/sys/dev/nvd X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jul 2015 17:50:06 -0000 Author: jimharris Date: Mon Jul 27 17:50:05 2015 New Revision: 285919 URL: https://svnweb.freebsd.org/changeset/base/285919 Log: MFS r285915: MFC r285767: nvd: set d_delmaxsize to full capacity of NVMe namespace The NVMe specification has no ability to specify a maximum delete size that is less than the full capacity of the namespace - so just using the namespace size is the correct value here. This fixes reported issues where ZFS trim on init looked like it was hanging the system - previously the default I/O max size (128KB on Intel NVMe controllers) was used for delete operations which worked out to only about 8MB/s. With this patch I can add an 800GB DC P3700 drive to a ZFS pool in about 15-20 seconds. Approved by: re (gjb) Sponsored by: Intel Modified: releng/10.2/sys/dev/nvd/nvd.c Directory Properties: releng/10.2/ (props changed) Modified: releng/10.2/sys/dev/nvd/nvd.c ============================================================================== --- releng/10.2/sys/dev/nvd/nvd.c Mon Jul 27 15:37:02 2015 (r285918) +++ releng/10.2/sys/dev/nvd/nvd.c Mon Jul 27 17:50:05 2015 (r285919) @@ -278,6 +278,7 @@ nvd_new_disk(struct nvme_namespace *ns, disk->d_maxsize = nvme_ns_get_max_io_xfer_size(ns); disk->d_sectorsize = nvme_ns_get_sector_size(ns); disk->d_mediasize = (off_t)nvme_ns_get_size(ns); + disk->d_delmaxsize = (off_t)nvme_ns_get_size(ns); if (TAILQ_EMPTY(&disk_head)) disk->d_unit = 0; From owner-svn-src-all@freebsd.org Mon Jul 27 17:51:13 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2ADE89ACF5D; Mon, 27 Jul 2015 17:51:13 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B55D902; Mon, 27 Jul 2015 17:51:13 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6RHpCap083022; Mon, 27 Jul 2015 17:51:12 GMT (envelope-from jimharris@FreeBSD.org) Received: (from jimharris@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6RHpCXu083021; Mon, 27 Jul 2015 17:51:12 GMT (envelope-from jimharris@FreeBSD.org) Message-Id: <201507271751.t6RHpCXu083021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jimharris set sender to jimharris@FreeBSD.org using -f From: Jim Harris Date: Mon, 27 Jul 2015 17:51:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r285920 - releng/10.2/sbin/nvmecontrol X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jul 2015 17:51:13 -0000 Author: jimharris Date: Mon Jul 27 17:51:12 2015 New Revision: 285920 URL: https://svnweb.freebsd.org/changeset/base/285920 Log: MFS r285916: MFC r285796: nvmecontrol: read controller identify data before any log page operations Approved by: re (gjb) Sponsored by: Intel Modified: releng/10.2/sbin/nvmecontrol/logpage.c Directory Properties: releng/10.2/ (props changed) Modified: releng/10.2/sbin/nvmecontrol/logpage.c ============================================================================== --- releng/10.2/sbin/nvmecontrol/logpage.c Mon Jul 27 17:50:05 2015 (r285919) +++ releng/10.2/sbin/nvmecontrol/logpage.c Mon Jul 27 17:51:12 2015 (r285920) @@ -298,6 +298,8 @@ logpage(int argc, char *argv[]) open_dev(argv[optind], &fd, 1, 1); } + read_controller_data(fd, &cdata); + /* * The log page attribtues indicate whether or not the controller * supports the SMART/Health information log page on a per @@ -307,7 +309,6 @@ logpage(int argc, char *argv[]) if (log_page != NVME_LOG_HEALTH_INFORMATION) errx(1, "log page %d valid only at controller level", log_page); - read_controller_data(fd, &cdata); if (cdata.lpa.ns_smart == 0) errx(1, "controller does not support per namespace " From owner-svn-src-all@freebsd.org Mon Jul 27 17:52:18 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88DD39AC055; Mon, 27 Jul 2015 17:52:18 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6C74FADF; Mon, 27 Jul 2015 17:52:18 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6RHqI3p083214; Mon, 27 Jul 2015 17:52:18 GMT (envelope-from jimharris@FreeBSD.org) Received: (from jimharris@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6RHqIXM083213; Mon, 27 Jul 2015 17:52:18 GMT (envelope-from jimharris@FreeBSD.org) Message-Id: <201507271752.t6RHqIXM083213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jimharris set sender to jimharris@FreeBSD.org using -f From: Jim Harris Date: Mon, 27 Jul 2015 17:52:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r285921 - releng/10.2/sys/dev/nvme X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jul 2015 17:52:18 -0000 Author: jimharris Date: Mon Jul 27 17:52:17 2015 New Revision: 285921 URL: https://svnweb.freebsd.org/changeset/base/285921 Log: MFS r285917: MFC r285815: nvme: properly handle case where pci_alloc_msix does not alloc all vectors Approved by: re (gjb) Sponsored by: Intel Modified: releng/10.2/sys/dev/nvme/nvme_ctrlr.c Directory Properties: releng/10.2/ (props changed) Modified: releng/10.2/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- releng/10.2/sys/dev/nvme/nvme_ctrlr.c Mon Jul 27 17:51:12 2015 (r285920) +++ releng/10.2/sys/dev/nvme/nvme_ctrlr.c Mon Jul 27 17:52:17 2015 (r285921) @@ -930,7 +930,8 @@ nvme_ctrlr_construct(struct nvme_control { union cap_lo_register cap_lo; union cap_hi_register cap_hi; - int i, num_vectors, per_cpu_io_queues, rid; + int i, per_cpu_io_queues, rid; + int num_vectors_requested, num_vectors_allocated; int status, timeout_period; ctrlr->dev = dev; @@ -988,7 +989,7 @@ nvme_ctrlr_construct(struct nvme_control } /* One vector per IO queue, plus one vector for admin queue. */ - num_vectors = ctrlr->num_io_queues + 1; + num_vectors_requested = ctrlr->num_io_queues + 1; /* * If we cannot even allocate 2 vectors (one for admin, one for @@ -997,15 +998,36 @@ nvme_ctrlr_construct(struct nvme_control if (pci_msix_count(dev) < 2) { ctrlr->msix_enabled = 0; goto intx; - } else if (pci_msix_count(dev) < num_vectors) { + } else if (pci_msix_count(dev) < num_vectors_requested) { ctrlr->per_cpu_io_queues = FALSE; ctrlr->num_io_queues = 1; - num_vectors = 2; /* one for admin, one for I/O */ + num_vectors_requested = 2; /* one for admin, one for I/O */ } - if (pci_alloc_msix(dev, &num_vectors) != 0) { + num_vectors_allocated = num_vectors_requested; + if (pci_alloc_msix(dev, &num_vectors_allocated) != 0) { ctrlr->msix_enabled = 0; goto intx; + } else if (num_vectors_allocated < num_vectors_requested) { + if (num_vectors_allocated < 2) { + pci_release_msi(dev); + ctrlr->msix_enabled = 0; + goto intx; + } else { + ctrlr->per_cpu_io_queues = FALSE; + ctrlr->num_io_queues = 1; + /* + * Release whatever vectors were allocated, and just + * reallocate the two needed for the admin and single + * I/O qpair. + */ + num_vectors_allocated = 2; + pci_release_msi(dev); + if (pci_alloc_msix(dev, &num_vectors_allocated) != 0) + panic("could not reallocate any vectors\n"); + if (num_vectors_allocated != 2) + panic("could not reallocate 2 vectors\n"); + } } /* @@ -1022,7 +1044,7 @@ nvme_ctrlr_construct(struct nvme_control * vendors wishing to import this driver into kernels based on * older versions of FreeBSD. */ - for (i = 0; i < num_vectors; i++) { + for (i = 0; i < num_vectors_allocated; i++) { rid = i + 1; ctrlr->msi_res[i] = bus_alloc_resource_any(ctrlr->dev, SYS_RES_IRQ, &rid, RF_ACTIVE); From owner-svn-src-all@freebsd.org Mon Jul 27 17:53:12 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D17999AC0D1; Mon, 27 Jul 2015 17:53:12 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B5D1AD0E; Mon, 27 Jul 2015 17:53:12 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6RHrCXO083506; Mon, 27 Jul 2015 17:53:12 GMT (envelope-from jimharris@FreeBSD.org) Received: (from jimharris@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6RHrChN083505; Mon, 27 Jul 2015 17:53:12 GMT (envelope-from jimharris@FreeBSD.org) Message-Id: <201507271753.t6RHrChN083505@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jimharris set sender to jimharris@FreeBSD.org using -f From: Jim Harris Date: Mon, 27 Jul 2015 17:53:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r285922 - releng/10.2/sys/dev/nvme X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jul 2015 17:53:13 -0000 Author: jimharris Date: Mon Jul 27 17:53:11 2015 New Revision: 285922 URL: https://svnweb.freebsd.org/changeset/base/285922 Log: MFS r285918: MFC r285816: nvme: ensure csts.rdy bit is cleared before returning from nvme_ctrlr_disable Approved by: re (gjb) Sponsored by: Intel Modified: releng/10.2/sys/dev/nvme/nvme_ctrlr.c Directory Properties: releng/10.2/ (props changed) Modified: releng/10.2/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- releng/10.2/sys/dev/nvme/nvme_ctrlr.c Mon Jul 27 17:52:17 2015 (r285921) +++ releng/10.2/sys/dev/nvme/nvme_ctrlr.c Mon Jul 27 17:53:11 2015 (r285922) @@ -1,5 +1,5 @@ /*- - * Copyright (C) 2012-2014 Intel Corporation + * Copyright (C) 2012-2015 Intel Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -207,7 +207,7 @@ nvme_ctrlr_fail_req_task(void *arg, int } static int -nvme_ctrlr_wait_for_ready(struct nvme_controller *ctrlr) +nvme_ctrlr_wait_for_ready(struct nvme_controller *ctrlr, int desired_val) { int ms_waited; union cc_register cc; @@ -216,18 +216,19 @@ nvme_ctrlr_wait_for_ready(struct nvme_co cc.raw = nvme_mmio_read_4(ctrlr, cc); csts.raw = nvme_mmio_read_4(ctrlr, csts); - if (!cc.bits.en) { - nvme_printf(ctrlr, "%s called with cc.en = 0\n", __func__); + if (cc.bits.en != desired_val) { + nvme_printf(ctrlr, "%s called with desired_val = %d " + "but cc.en = %d\n", __func__, desired_val, cc.bits.en); return (ENXIO); } ms_waited = 0; - while (!csts.bits.rdy) { + while (csts.bits.rdy != desired_val) { DELAY(1000); if (ms_waited++ > ctrlr->ready_timeout_in_ms) { - nvme_printf(ctrlr, "controller did not become ready " - "within %d ms\n", ctrlr->ready_timeout_in_ms); + nvme_printf(ctrlr, "controller ready did not become %d " + "within %d ms\n", desired_val, ctrlr->ready_timeout_in_ms); return (ENXIO); } csts.raw = nvme_mmio_read_4(ctrlr, csts); @@ -246,11 +247,12 @@ nvme_ctrlr_disable(struct nvme_controlle csts.raw = nvme_mmio_read_4(ctrlr, csts); if (cc.bits.en == 1 && csts.bits.rdy == 0) - nvme_ctrlr_wait_for_ready(ctrlr); + nvme_ctrlr_wait_for_ready(ctrlr, 1); cc.bits.en = 0; nvme_mmio_write_4(ctrlr, cc, cc.raw); DELAY(5000); + nvme_ctrlr_wait_for_ready(ctrlr, 0); } static int @@ -267,7 +269,7 @@ nvme_ctrlr_enable(struct nvme_controller if (csts.bits.rdy == 1) return (0); else - return (nvme_ctrlr_wait_for_ready(ctrlr)); + return (nvme_ctrlr_wait_for_ready(ctrlr, 1)); } nvme_mmio_write_8(ctrlr, asq, ctrlr->adminq.cmd_bus_addr); @@ -295,7 +297,7 @@ nvme_ctrlr_enable(struct nvme_controller nvme_mmio_write_4(ctrlr, cc, cc.raw); DELAY(5000); - return (nvme_ctrlr_wait_for_ready(ctrlr)); + return (nvme_ctrlr_wait_for_ready(ctrlr, 1)); } int From owner-svn-src-all@freebsd.org Mon Jul 27 19:21:24 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86D069AC5C6; Mon, 27 Jul 2015 19:21:24 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 65FF4146; Mon, 27 Jul 2015 19:21:24 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6RJLOb8025765; Mon, 27 Jul 2015 19:21:24 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6RJLOnt025764; Mon, 27 Jul 2015 19:21:24 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201507271921.t6RJLOnt025764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 27 Jul 2015 19:21:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285923 - head/usr.bin/ident X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jul 2015 19:21:24 -0000 Author: delphij Date: Mon Jul 27 19:21:23 2015 New Revision: 285923 URL: https://svnweb.freebsd.org/changeset/base/285923 Log: Rewrite scan procedure with a FSM. This improves code readability by making clear transits between different states, and avoids bug with handling repeated $'s. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D3221 Modified: head/usr.bin/ident/ident.c Modified: head/usr.bin/ident/ident.c ============================================================================== --- head/usr.bin/ident/ident.c Mon Jul 27 17:53:11 2015 (r285922) +++ head/usr.bin/ident/ident.c Mon Jul 27 19:21:23 2015 (r285923) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2015 Baptiste Daroussin + * Copyright (c) 2015 Xin LI * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,68 +39,23 @@ __FBSDID("$FreeBSD$"); #include #include -static bool -parse_id(FILE *fp, struct sbuf *buf, locale_t l) -{ - int c; - bool isid = false; - bool subversion = false; - - sbuf_putc(buf, '$'); - while ((c = fgetc(fp)) != EOF) { - sbuf_putc(buf, c); - if (!isid) { - if (c == '$') { - sbuf_clear(buf); - sbuf_putc(buf, '$'); - continue; - } - if (c == ':') { - c = fgetc(fp); - /* accept :: for subversion compatibility */ - if (c == ':') { - subversion = true; - sbuf_putc(buf, c); - c = fgetc(fp); - } - if (c == ' ') { - sbuf_putc(buf, c); - isid = true; - continue; - } - return (false); - } - - if (!isalpha_l(c, l)) - return (false); - } else { - if (c == '\n') - return (false); - if (c == '$') { - sbuf_finish(buf); - /* should end with a space */ - c = sbuf_data(buf)[sbuf_len(buf) - 2]; - if (!subversion) { - if (c != ' ') - return (0); - } else if (subversion) { - if (c != ' ' && c != '#') - return (0); - } - printf(" %s\n", sbuf_data(buf)); - return (true); - } - } - } - - return (false); -} +typedef enum { + /* state condition to transit to next state */ + INIT, /* '$' */ + DELIM_SEEN, /* letter */ + KEYWORD, /* punctuation mark */ + PUNC_SEEN, /* ':' -> _SVN; space -> TEXT */ + PUNC_SEEN_SVN, /* space */ + TEXT +} analyzer_states; static int scan(FILE *fp, const char *name, bool quiet) { int c; bool hasid = false; + bool subversion = false; + analyzer_states state = INIT; struct sbuf *id = sbuf_new_auto(); locale_t l; @@ -109,10 +65,123 @@ scan(FILE *fp, const char *name, bool qu printf("%s:\n", name); while ((c = fgetc(fp)) != EOF) { - if (c == '$') { - sbuf_clear(id); - if (parse_id(fp, id, l)) - hasid = true; + switch (state) { + case INIT: + if (c == '$') { + /* Transit to DELIM_SEEN if we see $ */ + state = DELIM_SEEN; + } else { + /* Otherwise, stay in INIT state */ + continue; + } + break; + case DELIM_SEEN: + if (isalpha_l(c, l)) { + /* Transit to KEYWORD if we see letter */ + sbuf_clear(id); + sbuf_putc(id, '$'); + sbuf_putc(id, c); + state = KEYWORD; + + continue; + } else if (c == '$') { + /* Or, stay in DELIM_SEEN if more $ */ + continue; + } else { + /* Otherwise, transit back to INIT */ + state = INIT; + } + break; + case KEYWORD: + sbuf_putc(id, c); + + if (isalpha_l(c, l)) { + /* + * Stay in KEYWORD if additional letter is seen + */ + continue; + } else if (c == ':') { + /* + * See ':' for the first time, transit to + * PUNC_SEEN. + */ + state = PUNC_SEEN; + subversion = false; + } else if (c == '$') { + /* + * Incomplete ident. Go back to DELIM_SEEN + * state because we see a '$' which could be + * the beginning of a keyword. + */ + state = DELIM_SEEN; + } else { + /* + * Go back to INIT state otherwise. + */ + state = INIT; + } + break; + case PUNC_SEEN: + case PUNC_SEEN_SVN: + sbuf_putc(id, c); + + switch (c) { + case ':': + /* + * If we see '::' (seen : in PUNC_SEEN), + * activate subversion treatment and transit + * to PUNC_SEEN_SVN state. + * + * If more than two :'s were seen, the ident + * is invalid and we would therefore go back + * to INIT state. + */ + if (state == PUNC_SEEN) { + state = PUNC_SEEN_SVN; + subversion = true; + } else { + state = INIT; + } + break; + case ' ': + /* + * A space after ':' or '::' indicates we are at the + * last component of potential ident. + */ + state = TEXT; + break; + default: + /* All other characters are invalid */ + state = INIT; + break; + } + break; + case TEXT: + sbuf_putc(id, c); + + if (iscntrl_l(c, l)) { + /* Control characters are not allowed in this state */ + state = INIT; + } else if (c == '$') { + sbuf_finish(id); + /* + * valid ident should end with a space. + * + * subversion extension uses '#' to indicate that + * the keyword expansion have exceeded the fixed + * width, so it is also permitted if we are in + * subversion mode. No length check is enforced + * because GNU RCS ident(1) does not do it either. + */ + c = sbuf_data(id)[sbuf_len(id) - 2]; + if (c == ' ' || (subversion && c == '#')) { + printf(" %s\n", sbuf_data(id)); + hasid = true; + } + state = INIT; + } + /* Other characters: stay in the state */ + break; } } sbuf_delete(id); From owner-svn-src-all@freebsd.org Mon Jul 27 22:35:57 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7A789ACF9B; Mon, 27 Jul 2015 22:35:57 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B773A1FD; Mon, 27 Jul 2015 22:35:57 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6RMZvvl036958; Mon, 27 Jul 2015 22:35:57 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6RMZtgx036945; Mon, 27 Jul 2015 22:35:55 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201507272235.t6RMZtgx036945@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Mon, 27 Jul 2015 22:35:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285925 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Jul 2015 22:35:58 -0000 Author: tuexen Date: Mon Jul 27 22:35:54 2015 New Revision: 285925 URL: https://svnweb.freebsd.org/changeset/base/285925 Log: Provide consistent error causes whenever an ABORT chunk is sent. MFC after: 1 week Modified: head/sys/netinet/sctp_asconf.c head/sys/netinet/sctp_indata.c head/sys/netinet/sctp_input.c head/sys/netinet/sctp_output.c head/sys/netinet/sctp_pcb.c head/sys/netinet/sctp_timer.c head/sys/netinet/sctputil.c Modified: head/sys/netinet/sctp_asconf.c ============================================================================== --- head/sys/netinet/sctp_asconf.c Mon Jul 27 22:20:28 2015 (r285924) +++ head/sys/netinet/sctp_asconf.c Mon Jul 27 22:35:54 2015 (r285925) @@ -1680,8 +1680,14 @@ sctp_handle_asconf_ack(struct mbuf *m, i * abort the asoc, since someone probably just hijacked us... */ if (serial_num == (asoc->asconf_seq_out + 1)) { + struct mbuf *op_err; + char msg[SCTP_DIAG_INFO_LEN]; + SCTPDBG(SCTP_DEBUG_ASCONF1, "handle_asconf_ack: got unexpected next serial number! Aborting asoc!\n"); - sctp_abort_an_association(stcb->sctp_ep, stcb, NULL, SCTP_SO_NOT_LOCKED); + snprintf(msg, sizeof(msg), "Never sent serial number %8.8x", + serial_num); + op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, SCTP_SO_NOT_LOCKED); *abort_no_unlock = 1; return; } Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Mon Jul 27 22:20:28 2015 (r285924) +++ head/sys/netinet/sctp_indata.c Mon Jul 27 22:35:54 2015 (r285925) @@ -2488,8 +2488,11 @@ sctp_process_data(struct mbuf **mm, int */ if (SCTP_BASE_SYSCTL(sctp_strict_data_order)) { struct mbuf *op_err; + char msg[SCTP_DIAG_INFO_LEN]; - op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, ""); + snprintf(msg, sizeof(msg), "DATA chunk followwd by chunk of type %2.2x", + ch->ch.chunk_type); + op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); sctp_abort_association(inp, stcb, m, iphlen, src, dst, Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Mon Jul 27 22:20:28 2015 (r285924) +++ head/sys/netinet/sctp_input.c Mon Jul 27 22:35:54 2015 (r285925) @@ -4624,7 +4624,7 @@ __attribute__((noinline)) } } if (stcb == NULL) { - snprintf(msg, sizeof(msg), "OOTB, %s:%d at %s\n", __FILE__, __LINE__, __FUNCTION__); + snprintf(msg, sizeof(msg), "OOTB, %s:%d at %s", __FILE__, __LINE__, __FUNCTION__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); /* no association, so it's out of the blue... */ @@ -4668,7 +4668,7 @@ __attribute__((noinline)) if (locked_tcb) { SCTP_TCB_UNLOCK(locked_tcb); } - snprintf(msg, sizeof(msg), "OOTB, %s:%d at %s\n", __FILE__, __LINE__, __FUNCTION__); + snprintf(msg, sizeof(msg), "OOTB, %s:%d at %s", __FILE__, __LINE__, __FUNCTION__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); sctp_handle_ootb(m, iphlen, *offset, src, dst, @@ -5834,7 +5834,7 @@ sctp_common_input_processing(struct mbuf */ SCTP_TCB_UNLOCK(stcb); stcb = NULL; - snprintf(msg, sizeof(msg), "OOTB, %s:%d at %s\n", __FILE__, __LINE__, __FUNCTION__); + snprintf(msg, sizeof(msg), "OOTB, %s:%d at %s", __FILE__, __LINE__, __FUNCTION__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); sctp_handle_ootb(m, iphlen, offset, src, dst, sh, inp, op_err, @@ -5886,7 +5886,7 @@ sctp_common_input_processing(struct mbuf } if (stcb == NULL) { /* out of the blue DATA chunk */ - snprintf(msg, sizeof(msg), "OOTB, %s:%d at %s\n", __FILE__, __LINE__, __FUNCTION__); + snprintf(msg, sizeof(msg), "OOTB, %s:%d at %s", __FILE__, __LINE__, __FUNCTION__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); sctp_handle_ootb(m, iphlen, offset, src, dst, sh, inp, op_err, @@ -5958,7 +5958,7 @@ sctp_common_input_processing(struct mbuf /* * We consider OOTB any data sent during asoc setup. */ - snprintf(msg, sizeof(msg), "OOTB, %s:%d at %s\n", __FILE__, __LINE__, __FUNCTION__); + snprintf(msg, sizeof(msg), "OOTB, %s:%d at %s", __FILE__, __LINE__, __FUNCTION__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); sctp_handle_ootb(m, iphlen, offset, src, dst, sh, inp, op_err, Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Mon Jul 27 22:20:28 2015 (r285924) +++ head/sys/netinet/sctp_output.c Mon Jul 27 22:35:54 2015 (r285925) @@ -5524,7 +5524,7 @@ do_a_abort: if (op_err == NULL) { char msg[SCTP_DIAG_INFO_LEN]; - snprintf(msg, sizeof(msg), "%s:%d at %s\n", __FILE__, __LINE__, __FUNCTION__); + snprintf(msg, sizeof(msg), "%s:%d at %s", __FILE__, __LINE__, __FUNCTION__); op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), msg); } @@ -6682,10 +6682,17 @@ sctp_sendall_iterator(struct sctp_inpcb if (TAILQ_EMPTY(&asoc->send_queue) && TAILQ_EMPTY(&asoc->sent_queue) && (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT)) { + struct mbuf *op_err; + char msg[SCTP_DIAG_INFO_LEN]; + abort_anyway: + snprintf(msg, sizeof(msg), + "%s:%d at %s", __FILE__, __LINE__, __FUNCTION__); + op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), + msg); atomic_add_int(&stcb->asoc.refcnt, 1); sctp_abort_an_association(stcb->sctp_ep, stcb, - NULL, SCTP_SO_NOT_LOCKED); + op_err, SCTP_SO_NOT_LOCKED); atomic_add_int(&stcb->asoc.refcnt, -1); goto no_chunk_output; } @@ -9454,12 +9461,16 @@ sctp_chunk_retransmission(struct sctp_in } if ((SCTP_BASE_SYSCTL(sctp_max_retran_chunk)) && (chk->snd_count >= SCTP_BASE_SYSCTL(sctp_max_retran_chunk))) { - /* Gak, we have exceeded max unlucky retran, abort! */ - SCTP_PRINTF("Gak, chk->snd_count:%d >= max:%d - send abort\n", - chk->snd_count, - SCTP_BASE_SYSCTL(sctp_max_retran_chunk)); + struct mbuf *op_err; + char msg[SCTP_DIAG_INFO_LEN]; + + snprintf(msg, sizeof(msg), "TSN %8.8x retransmitted %d times, giving up", + chk->rec.data.TSN_seq, chk->snd_count); + op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), + msg); atomic_add_int(&stcb->asoc.refcnt, 1); - sctp_abort_an_association(stcb->sctp_ep, stcb, NULL, so_locked); + sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, + so_locked); SCTP_TCB_LOCK(stcb); atomic_subtract_int(&stcb->asoc.refcnt, 1); return (SCTP_RETRAN_EXIT); @@ -13344,13 +13355,20 @@ dataless_eof: if (TAILQ_EMPTY(&asoc->send_queue) && TAILQ_EMPTY(&asoc->sent_queue) && (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT)) { + struct mbuf *op_err; + char msg[SCTP_DIAG_INFO_LEN]; + abort_anyway: if (free_cnt_applied) { atomic_add_int(&stcb->asoc.refcnt, -1); free_cnt_applied = 0; } + snprintf(msg, sizeof(msg), + "%s:%d at %s", __FILE__, __LINE__, __FUNCTION__); + op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), + msg); sctp_abort_an_association(stcb->sctp_ep, stcb, - NULL, SCTP_SO_LOCKED); + op_err, SCTP_SO_LOCKED); /* * now relock the stcb so everything * is sane Modified: head/sys/netinet/sctp_pcb.c ============================================================================== --- head/sys/netinet/sctp_pcb.c Mon Jul 27 22:20:28 2015 (r285924) +++ head/sys/netinet/sctp_pcb.c Mon Jul 27 22:35:54 2015 (r285925) @@ -6250,12 +6250,20 @@ sctp_load_addresses_from_init(struct sct */ if (stcb_tmp) { if (SCTP_GET_STATE(&stcb_tmp->asoc) & SCTP_STATE_COOKIE_WAIT) { + struct mbuf *op_err; + char msg[SCTP_DIAG_INFO_LEN]; + /* * in setup state we * abort this guy */ + snprintf(msg, sizeof(msg), + "%s:%d at %s", __FILE__, __LINE__, __FUNCTION__); + op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), + msg); sctp_abort_an_association(stcb_tmp->sctp_ep, - stcb_tmp, NULL, SCTP_SO_NOT_LOCKED); + stcb_tmp, op_err, + SCTP_SO_NOT_LOCKED); goto add_it_now; } SCTP_TCB_UNLOCK(stcb_tmp); @@ -6339,18 +6347,26 @@ sctp_load_addresses_from_init(struct sct * strange, address is in another * assoc? straighten out locks. */ - if (stcb_tmp) + if (stcb_tmp) { if (SCTP_GET_STATE(&stcb_tmp->asoc) & SCTP_STATE_COOKIE_WAIT) { + struct mbuf *op_err; + char msg[SCTP_DIAG_INFO_LEN]; + /* * in setup state we * abort this guy */ + snprintf(msg, sizeof(msg), + "%s:%d at %s", __FILE__, __LINE__, __FUNCTION__); + op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), + msg); sctp_abort_an_association(stcb_tmp->sctp_ep, - stcb_tmp, NULL, SCTP_SO_NOT_LOCKED); + stcb_tmp, op_err, + SCTP_SO_NOT_LOCKED); goto add_it_now6; } - SCTP_TCB_UNLOCK(stcb_tmp); - + SCTP_TCB_UNLOCK(stcb_tmp); + } if (stcb->asoc.state == 0) { /* the assoc was freed? */ return (-21); Modified: head/sys/netinet/sctp_timer.c ============================================================================== --- head/sys/netinet/sctp_timer.c Mon Jul 27 22:20:28 2015 (r285924) +++ head/sys/netinet/sctp_timer.c Mon Jul 27 22:35:54 2015 (r285925) @@ -153,7 +153,7 @@ sctp_threshold_management(struct sctp_in /* Abort notification sends a ULP notify */ struct mbuf *op_err; - op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, + op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Association error counter exceeded"); inp->last_abort_code = SCTP_FROM_SCTP_TIMER + SCTP_LOC_2; sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); @@ -1046,7 +1046,7 @@ sctp_cookie_timer(struct sctp_inpcb *inp /* FOOBAR! */ struct mbuf *op_err; - op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, + op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), "Cookie timer expired, but no cookie"); inp->last_abort_code = SCTP_FROM_SCTP_TIMER + SCTP_LOC_3; sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); Modified: head/sys/netinet/sctputil.c ============================================================================== --- head/sys/netinet/sctputil.c Mon Jul 27 22:20:28 2015 (r285924) +++ head/sys/netinet/sctputil.c Mon Jul 27 22:35:54 2015 (r285925) @@ -1445,6 +1445,7 @@ sctp_timeout_handler(void *t) struct sctp_tcb *stcb; struct sctp_nets *net; struct sctp_timer *tmr; + struct mbuf *op_err; #if defined(__APPLE__) || defined(SCTP_SO_LOCK_TESTING) struct socket *so; @@ -1756,7 +1757,9 @@ sctp_timeout_handler(void *t) break; } SCTP_STAT_INCR(sctps_timoshutdownguard); - sctp_abort_an_association(inp, stcb, NULL, SCTP_SO_NOT_LOCKED); + op_err = sctp_generate_cause(SCTP_BASE_SYSCTL(sctp_diag_info_code), + "Shutdown guard timer expired"); + sctp_abort_an_association(inp, stcb, op_err, SCTP_SO_NOT_LOCKED); /* no need to unlock on tcb its gone */ goto out_decr; From owner-svn-src-all@freebsd.org Tue Jul 28 02:32:46 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5CE0398D151; Tue, 28 Jul 2015 02:32:46 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 45D1D14ED; Tue, 28 Jul 2015 02:32:46 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S2Wka4043395; Tue, 28 Jul 2015 02:32:46 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S2WfSq043383; Tue, 28 Jul 2015 02:32:41 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201507280232.t6S2WfSq043383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Tue, 28 Jul 2015 02:32:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285926 - in head: libexec/ypxfr usr.bin/ypcat usr.bin/ypmatch usr.bin/ypwhich usr.sbin/yp_mkdb usr.sbin/yppush usr.sbin/ypserv X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 02:32:46 -0000 Author: araujo (ports committer) Date: Tue Jul 28 02:32:40 2015 New Revision: 285926 URL: https://svnweb.freebsd.org/changeset/base/285926 Log: Staticfy and constify some variables and clean up the code a bit to make it more readable. No functional change. Differential Revision: D3166 Reviewed by: kib Sponsored by: gandi.net Modified: head/libexec/ypxfr/ypxfr_getmap.c head/libexec/ypxfr/ypxfr_main.c head/libexec/ypxfr/ypxfrd_getmap.c head/usr.bin/ypcat/ypcat.c head/usr.bin/ypmatch/ypmatch.c head/usr.bin/ypwhich/ypwhich.c head/usr.sbin/yp_mkdb/yp_mkdb.c head/usr.sbin/yppush/yppush_main.c head/usr.sbin/ypserv/yp_access.c head/usr.sbin/ypserv/yp_dblookup.c head/usr.sbin/ypserv/yp_error.c head/usr.sbin/ypserv/yp_main.c Modified: head/libexec/ypxfr/ypxfr_getmap.c ============================================================================== --- head/libexec/ypxfr/ypxfr_getmap.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/libexec/ypxfr/ypxfr_getmap.c Tue Jul 28 02:32:40 2015 (r285926) @@ -43,8 +43,8 @@ __FBSDID("$FreeBSD$"); extern bool_t xdr_ypresp_all_seq(XDR *, unsigned long *); -int (*ypresp_allfn)(); -void *ypresp_data; +static int (*ypresp_allfn)(); +static void *ypresp_data; extern DB *specdbp; extern enum ypstat yp_errno; Modified: head/libexec/ypxfr/ypxfr_main.c ============================================================================== --- head/libexec/ypxfr/ypxfr_main.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/libexec/ypxfr/ypxfr_main.c Tue Jul 28 02:32:40 2015 (r285926) @@ -54,12 +54,12 @@ __FBSDID("$FreeBSD$"); char *progname = "ypxfr"; char *yp_dir = _PATH_YP; int _rpcpmstart = 0; -int ypxfr_use_yplib = 0; /* Assume the worst. */ -int ypxfr_clear = 1; -int ypxfr_prognum = 0; -struct sockaddr_in ypxfr_callback_addr; -struct yppushresp_xfr ypxfr_resp; -DB *dbp; +static int ypxfr_use_yplib = 0; /* Assume the worst. */ +static int ypxfr_clear = 1; +static int ypxfr_prognum = 0; +static struct sockaddr_in ypxfr_callback_addr; +static struct yppushresp_xfr ypxfr_resp; +static DB *dbp; static void ypxfr_exit(ypxfrstat retval, char *temp) Modified: head/libexec/ypxfr/ypxfrd_getmap.c ============================================================================== --- head/libexec/ypxfr/ypxfrd_getmap.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/libexec/ypxfr/ypxfrd_getmap.c Tue Jul 28 02:32:40 2015 (r285926) @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include "ypxfr_extern.h" -int fp = 0; +static int fp = 0; static bool_t xdr_my_xfr(register XDR *xdrs, xfr *objp) Modified: head/usr.bin/ypcat/ypcat.c ============================================================================== --- head/usr.bin/ypcat/ypcat.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/usr.bin/ypcat/ypcat.c Tue Jul 28 02:32:40 2015 (r285926) @@ -47,9 +47,9 @@ __FBSDID("$FreeBSD$"); #include #include -struct ypalias { +const struct ypalias { char *alias, *name; -} ypaliases[] = { +} static ypaliases[] = { { "passwd", "passwd.byname" }, { "master.passwd", "master.passwd.byname" }, { "shadow", "shadow.byname" }, @@ -62,7 +62,7 @@ struct ypalias { { "ethers", "ethers.byname" }, }; -int key; +static int key; static void usage(void) Modified: head/usr.bin/ypmatch/ypmatch.c ============================================================================== --- head/usr.bin/ypmatch/ypmatch.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/usr.bin/ypmatch/ypmatch.c Tue Jul 28 02:32:40 2015 (r285926) @@ -47,9 +47,9 @@ __FBSDID("$FreeBSD$"); #include #include -struct ypalias { +const struct ypalias { char *alias, *name; -} ypaliases[] = { +} static ypaliases[] = { { "passwd", "passwd.byname" }, { "master.passwd", "master.passwd.byname" }, { "shadow", "shadow.byname" }, Modified: head/usr.bin/ypwhich/ypwhich.c ============================================================================== --- head/usr.bin/ypwhich/ypwhich.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/usr.bin/ypwhich/ypwhich.c Tue Jul 28 02:32:40 2015 (r285926) @@ -59,9 +59,9 @@ __FBSDID("$FreeBSD$"); extern bool_t xdr_domainname(); -struct ypalias { +const struct ypalias { char *alias, *name; -} ypaliases[] = { +} static ypaliases[] = { { "passwd", "passwd.byname" }, { "master.passwd", "master.passwd.byname" }, { "shadow", "shadow.byname" }, Modified: head/usr.sbin/yp_mkdb/yp_mkdb.c ============================================================================== --- head/usr.sbin/yp_mkdb/yp_mkdb.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/usr.sbin/yp_mkdb/yp_mkdb.c Tue Jul 28 02:32:40 2015 (r285926) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include "ypxfr_extern.h" char *yp_dir = ""; /* No particular default needed. */ -int _rpcpmstart = 0; int debug = 1; static void @@ -66,7 +65,6 @@ usage(void) } #define PERM_SECURE (S_IRUSR|S_IWUSR) - static DB * open_db(char *path, int flags) { @@ -185,7 +183,6 @@ main(int argc, char *argv[]) * write to stdout; the db library doesn't let you * write to a file stream like that. */ - if (!strcmp(infile, "-")) { ifp = stdin; } else { @@ -327,7 +324,6 @@ main(int argc, char *argv[]) (void)(dbp->close)(dbp); doclear: - if (clear) { char in = 0; char *out = NULL; Modified: head/usr.sbin/yppush/yppush_main.c ============================================================================== --- head/usr.sbin/yppush/yppush_main.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/usr.sbin/yppush/yppush_main.c Tue Jul 28 02:32:40 2015 (r285926) @@ -58,15 +58,15 @@ int debug = 1; int _rpcpmstart = 0; char *yp_dir = _PATH_YP; -char *yppush_mapname = NULL; /* Map to transfer. */ -char *yppush_domain = NULL; /* Domain in which map resides. */ -char *yppush_master = NULL; /* Master NIS server for said domain. */ -int skip_master = 0; /* Do not attempt to push map to master. */ -int verbose = 0; /* Toggle verbose mode. */ -unsigned long yppush_transid = 0; -int yppush_timeout = 80; /* Default timeout. */ -int yppush_jobs = 1; /* Number of allowed concurrent jobs. */ -int yppush_running_jobs = 0; /* Number of currently running jobs. */ +static char *yppush_mapname = NULL; /* Map to transfer. */ +static char *yppush_domain = NULL; /* Domain in which map resides. */ +static char *yppush_master = NULL; /* Master NIS server for said domain. */ +static int skip_master = 0; /* Do not attempt to push map to master. */ +static int verbose = 0; /* Toggle verbose mode. */ +static unsigned long yppush_transid = 0; +static int yppush_timeout = 80; /* Default timeout. */ +static int yppush_jobs = 1; /* Number of allowed concurrent jobs. */ +static int yppush_running_jobs = 0; /* Number of currently running jobs. */ /* Structure for holding information about a running job. */ struct jobs { @@ -80,8 +80,7 @@ struct jobs { struct jobs *next; }; -struct jobs *yppush_joblist; /* Linked list of running jobs. */ - +static struct jobs *yppush_joblist; /* Linked list of running jobs. */ static int yppush_svc_run(int); /* @@ -464,7 +463,8 @@ yppush_foreach(int status, char *key, in return (0); } -static void usage() +static void +usage() { fprintf (stderr, "%s\n%s\n", "usage: yppush [-d domain] [-t timeout] [-j #parallel jobs] [-h host]", Modified: head/usr.sbin/ypserv/yp_access.c ============================================================================== --- head/usr.sbin/ypserv/yp_access.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/usr.sbin/ypserv/yp_access.c Tue Jul 28 02:32:40 2015 (r285926) @@ -57,8 +57,8 @@ __FBSDID("$FreeBSD$"); extern int debug; - /* NIS v1 */ -const char *yp_procs[] = { +static const char *yp_procs[] = { + /* NIS v1 */ "ypoldproc_null", "ypoldproc_domain", "ypoldproc_domain_nonack", @@ -71,7 +71,7 @@ const char *yp_procs[] = { "badproc1", /* placeholder */ "badproc2", /* placeholder */ "badproc3", /* placeholder */ - + /* NIS v2 */ "ypproc_null", "ypproc_domain", @@ -93,7 +93,7 @@ struct securenet { struct securenet *next; }; -struct securenet *securenets; +static struct securenet *securenets; #define LINEBUFSZ 1024 Modified: head/usr.sbin/ypserv/yp_dblookup.c ============================================================================== --- head/usr.sbin/ypserv/yp_dblookup.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/usr.sbin/ypserv/yp_dblookup.c Tue Jul 28 02:32:40 2015 (r285926) @@ -405,7 +405,7 @@ yp_open_db(const char *domain, const cha #ifdef DB_CACHE again: #endif - dbp = dbopen(buf,O_RDONLY, PERM_SECURE, DB_HASH, NULL); + dbp = dbopen(buf, O_RDONLY, PERM_SECURE, DB_HASH, NULL); if (dbp == NULL) { switch (errno) { Modified: head/usr.sbin/ypserv/yp_error.c ============================================================================== --- head/usr.sbin/ypserv/yp_error.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/usr.sbin/ypserv/yp_error.c Tue Jul 28 02:32:40 2015 (r285926) @@ -46,13 +46,13 @@ __FBSDID("$FreeBSD$"); #include "yp_extern.h" int debug; -extern int _rpcpmstart; +extern int _rpcpmstart; extern char *progname; - static void __verr(const char *fmt, va_list ap) __printflike(1, 0); -static void __verr(const char *fmt, va_list ap) +static void +__verr(const char *fmt, va_list ap) { if (debug && !_rpcpmstart) { fprintf(stderr,"%s: ",progname); Modified: head/usr.sbin/ypserv/yp_main.c ============================================================================== --- head/usr.sbin/ypserv/yp_main.c Mon Jul 27 22:35:54 2015 (r285925) +++ head/usr.sbin/ypserv/yp_main.c Tue Jul 28 02:32:40 2015 (r285926) @@ -72,13 +72,11 @@ __FBSDID("$FreeBSD$"); #define _RPCSVC_CLOSEDOWN 120 int _rpcpmstart; /* Started by a port monitor ? */ -static int _rpcfdtype; - /* Whether Stream or Datagram ? */ +static int _rpcfdtype; /* Whether Stream or Datagram? */ static int _rpcaf; static int _rpcfd; - /* States a server can be in wrt request */ - +/* States a server can be in wrt request */ #define _IDLE 0 #define _SERVED 1 #define _SERVING 2 From owner-svn-src-all@freebsd.org Tue Jul 28 04:54:06 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E315F9AC3E5; Tue, 28 Jul 2015 04:54:06 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D386D1DCA; Tue, 28 Jul 2015 04:54:06 +0000 (UTC) (envelope-from marcel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S4s6DV005112; Tue, 28 Jul 2015 04:54:06 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S4s6tj005111; Tue, 28 Jul 2015 04:54:06 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201507280454.t6S4s6tj005111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Tue, 28 Jul 2015 04:54:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285927 - head/sys/dev/proto X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 04:54:07 -0000 Author: marcel Date: Tue Jul 28 04:54:05 2015 New Revision: 285927 URL: https://svnweb.freebsd.org/changeset/base/285927 Log: Check the sync operation. Modified: head/sys/dev/proto/proto_busdma.c Modified: head/sys/dev/proto/proto_busdma.c ============================================================================== --- head/sys/dev/proto/proto_busdma.c Tue Jul 28 02:32:40 2015 (r285926) +++ head/sys/dev/proto/proto_busdma.c Tue Jul 28 04:54:05 2015 (r285927) @@ -325,7 +325,12 @@ static int proto_busdma_sync(struct proto_busdma *busdma, struct proto_md *md, struct proto_ioc_busdma *ioc) { - + u_int ops; + + ops = BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE | + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE; + if (ioc->u.sync.op & ~ops) + return (EINVAL); if (!md->physaddr) return (ENXIO); bus_dmamap_sync(md->bd_tag, md->bd_map, ioc->u.sync.op); From owner-svn-src-all@freebsd.org Tue Jul 28 05:46:39 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23ABC9ACE93; Tue, 28 Jul 2015 05:46:39 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E78F910DD; Tue, 28 Jul 2015 05:46:38 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S5kcRq027641; Tue, 28 Jul 2015 05:46:38 GMT (envelope-from whu@FreeBSD.org) Received: (from whu@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S5kciI027640; Tue, 28 Jul 2015 05:46:38 GMT (envelope-from whu@FreeBSD.org) Message-Id: <201507280546.t6S5kciI027640@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: whu set sender to whu@FreeBSD.org using -f From: Wei Hu Date: Tue, 28 Jul 2015 05:46:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285928 - stable/10/sys/dev/hyperv/netvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 05:46:39 -0000 Author: whu Date: Tue Jul 28 05:46:37 2015 New Revision: 285928 URL: https://svnweb.freebsd.org/changeset/base/285928 Log: MFC r285785 Do not enable UDP checksum offloading when running on the Hyper-V on Windows Server 2012 and earlier hosts. Submitted by: whu Reviewed by: royger Approved by: royger Relnotes: No Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D3217 Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Jul 28 04:54:05 2015 (r285927) +++ stable/10/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Tue Jul 28 05:46:37 2015 (r285928) @@ -343,7 +343,15 @@ netvsc_attach(device_t dev) IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_TSO; ifp->if_capenable |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_TSO; - ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_TSO; + /* + * Only enable UDP checksum offloading when it is on 2012R2 or + * later. UDP checksum offloading doesn't work on earlier + * Windows releases. + */ + if (hv_vmbus_protocal_version >= HV_VMBUS_VERSION_WIN8_1) + ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_TSO; + else + ifp->if_hwassist = CSUM_TCP | CSUM_TSO; ret = hv_rf_on_device_add(device_ctx, &device_info); if (ret != 0) { @@ -1110,7 +1118,17 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, ifp->if_hwassist &= ~(CSUM_TCP | CSUM_UDP); } else { ifp->if_capenable |= IFCAP_TXCSUM; - ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP); + /* + * Only enable UDP checksum offloading on + * Windows Server 2012R2 or later releases. + */ + if (hv_vmbus_protocal_version >= + HV_VMBUS_VERSION_WIN8_1) { + ifp->if_hwassist |= + (CSUM_TCP | CSUM_UDP); + } else { + ifp->if_hwassist |= CSUM_TCP; + } } } From owner-svn-src-all@freebsd.org Tue Jul 28 05:48:59 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D779D9ACF1E; Tue, 28 Jul 2015 05:48:59 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C78B31373; Tue, 28 Jul 2015 05:48:59 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S5mxPR027877; Tue, 28 Jul 2015 05:48:59 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S5mxvc027876; Tue, 28 Jul 2015 05:48:59 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201507280548.t6S5mxvc027876@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 28 Jul 2015 05:48:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285929 - stable/10/usr.sbin/ctladm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 05:48:59 -0000 Author: bapt Date: Tue Jul 28 05:48:58 2015 New Revision: 285929 URL: https://svnweb.freebsd.org/changeset/base/285929 Log: make ctdladm(8) return 0 is everything was ok. retval is used to test the return of XML_Parse function which is ok if 1 is returned and retval it directly returned to the main function and used as an exit value. if all the parsing part is done reset retval to 0 so that the command return 0 if everything ok Differential Revision: https://reviews.freebsd.org/D3102 Reviewed by: trasz Sponsored by: gandi.net Modified: stable/10/usr.sbin/ctladm/ctladm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctladm/ctladm.c ============================================================================== --- stable/10/usr.sbin/ctladm/ctladm.c Tue Jul 28 05:46:37 2015 (r285928) +++ stable/10/usr.sbin/ctladm/ctladm.c Tue Jul 28 05:48:58 2015 (r285929) @@ -3657,6 +3657,7 @@ retry: retval = 1; goto bailout; } + retval = 0; XML_ParserFree(parser); if (verbose != 0) { @@ -4075,6 +4076,7 @@ retry: retval = 1; goto bailout; } + retval = 0; XML_ParserFree(parser); printf("LUN Backend %18s %4s %-16s %-16s\n", "Size (Blocks)", "BS", @@ -4371,6 +4373,7 @@ retry: retval = 1; goto bailout; } + retval = 0; XML_ParserFree(parser); if (quiet == 0) From owner-svn-src-all@freebsd.org Tue Jul 28 06:36:51 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 798899ACA45; Tue, 28 Jul 2015 06:36:51 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 62676949; Tue, 28 Jul 2015 06:36:51 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S6apJ8049315; Tue, 28 Jul 2015 06:36:51 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S6aoib049312; Tue, 28 Jul 2015 06:36:50 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201507280636.t6S6aoib049312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Tue, 28 Jul 2015 06:36:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285930 - head/sys/compat/cloudabi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 06:36:51 -0000 Author: ed Date: Tue Jul 28 06:36:49 2015 New Revision: 285930 URL: https://svnweb.freebsd.org/changeset/base/285930 Log: Make fstat() and friends work. Summary: CloudABI provides access to two different stat structures: - fdstat, containing file descriptor level status: oflags, file descriptor type and Capsicum rights, used by cap_rights_get(), fcntl(F_GETFL), getsockopt(SO_TYPE). - filestat, containing your regular file status: timestamps, inode number, used by fstat(). Unlike FreeBSD's stat::st_mode, CloudABI file descriptor types don't have overloaded meanings (e.g., returning S_ISCHR() for kqueues). Add a utility function to extract the type of a file descriptor accurately. CloudABI does not work with O_ACCMODEs. File descriptors have two sets of Capsicum-style rights: rights that apply to the file descriptor itself ('base') and rights that apply to any new file descriptors yielded through openat() ('inheriting'). Though not perfect, we can pretty safely decompose Capsicum rights to such a pair. This is done in convert_capabilities(). Test Plan: Tests for these system calls are fairly extensive in cloudlibc. Reviewers: jonathan, mjg, #manpages Reviewed By: mjg Subscribers: imp Differential Revision: https://reviews.freebsd.org/D3171 Modified: head/sys/compat/cloudabi/cloudabi_fd.c head/sys/compat/cloudabi/cloudabi_file.c head/sys/compat/cloudabi/cloudabi_util.h Modified: head/sys/compat/cloudabi/cloudabi_fd.c ============================================================================== --- head/sys/compat/cloudabi/cloudabi_fd.c Tue Jul 28 05:48:58 2015 (r285929) +++ head/sys/compat/cloudabi/cloudabi_fd.c Tue Jul 28 06:36:49 2015 (r285930) @@ -27,13 +27,64 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include +#include #include #include +#include #include +#include #include +#include +#include + +/* Translation between CloudABI and Capsicum rights. */ +#define RIGHTS_MAPPINGS \ + MAPPING(CLOUDABI_RIGHT_FD_DATASYNC, CAP_FSYNC) \ + MAPPING(CLOUDABI_RIGHT_FD_READ, CAP_READ) \ + MAPPING(CLOUDABI_RIGHT_FD_SEEK, CAP_SEEK) \ + MAPPING(CLOUDABI_RIGHT_FD_STAT_PUT_FLAGS, CAP_FCNTL) \ + MAPPING(CLOUDABI_RIGHT_FD_SYNC, CAP_FSYNC) \ + MAPPING(CLOUDABI_RIGHT_FD_TELL, CAP_SEEK_TELL) \ + MAPPING(CLOUDABI_RIGHT_FD_WRITE, CAP_WRITE) \ + MAPPING(CLOUDABI_RIGHT_FILE_ADVISE) \ + MAPPING(CLOUDABI_RIGHT_FILE_ALLOCATE, CAP_WRITE) \ + MAPPING(CLOUDABI_RIGHT_FILE_CREATE_DIRECTORY, CAP_MKDIRAT) \ + MAPPING(CLOUDABI_RIGHT_FILE_CREATE_FILE, CAP_CREATE) \ + MAPPING(CLOUDABI_RIGHT_FILE_CREATE_FIFO, CAP_MKFIFOAT) \ + MAPPING(CLOUDABI_RIGHT_FILE_LINK_SOURCE, CAP_LOOKUP) \ + MAPPING(CLOUDABI_RIGHT_FILE_LINK_TARGET, CAP_LINKAT) \ + MAPPING(CLOUDABI_RIGHT_FILE_OPEN, CAP_LOOKUP) \ + MAPPING(CLOUDABI_RIGHT_FILE_READDIR, CAP_READ) \ + MAPPING(CLOUDABI_RIGHT_FILE_READLINK, CAP_LOOKUP) \ + MAPPING(CLOUDABI_RIGHT_FILE_RENAME_SOURCE, CAP_RENAMEAT) \ + MAPPING(CLOUDABI_RIGHT_FILE_RENAME_TARGET, CAP_LINKAT) \ + MAPPING(CLOUDABI_RIGHT_FILE_STAT_FGET, CAP_FSTAT) \ + MAPPING(CLOUDABI_RIGHT_FILE_STAT_FPUT_SIZE, CAP_FTRUNCATE) \ + MAPPING(CLOUDABI_RIGHT_FILE_STAT_FPUT_TIMES, CAP_FUTIMES) \ + MAPPING(CLOUDABI_RIGHT_FILE_STAT_GET, CAP_FSTATAT) \ + MAPPING(CLOUDABI_RIGHT_FILE_STAT_PUT_TIMES, CAP_FUTIMESAT) \ + MAPPING(CLOUDABI_RIGHT_FILE_SYMLINK, CAP_SYMLINKAT) \ + MAPPING(CLOUDABI_RIGHT_FILE_UNLINK, CAP_UNLINKAT) \ + MAPPING(CLOUDABI_RIGHT_MEM_MAP, CAP_MMAP) \ + MAPPING(CLOUDABI_RIGHT_MEM_MAP_EXEC, CAP_MMAP_X) \ + MAPPING(CLOUDABI_RIGHT_POLL_FD_READWRITE, CAP_EVENT) \ + MAPPING(CLOUDABI_RIGHT_POLL_MODIFY, CAP_KQUEUE_CHANGE) \ + MAPPING(CLOUDABI_RIGHT_POLL_PROC_TERMINATE, CAP_PDWAIT) \ + MAPPING(CLOUDABI_RIGHT_POLL_WAIT, CAP_KQUEUE_EVENT) \ + MAPPING(CLOUDABI_RIGHT_PROC_EXEC, CAP_FEXECVE) \ + MAPPING(CLOUDABI_RIGHT_SOCK_ACCEPT, CAP_ACCEPT) \ + MAPPING(CLOUDABI_RIGHT_SOCK_BIND_DIRECTORY, CAP_BINDAT) \ + MAPPING(CLOUDABI_RIGHT_SOCK_BIND_SOCKET, CAP_BIND) \ + MAPPING(CLOUDABI_RIGHT_SOCK_CONNECT_DIRECTORY, CAP_CONNECTAT) \ + MAPPING(CLOUDABI_RIGHT_SOCK_CONNECT_SOCKET, CAP_CONNECT) \ + MAPPING(CLOUDABI_RIGHT_SOCK_LISTEN, CAP_LISTEN) \ + MAPPING(CLOUDABI_RIGHT_SOCK_SHUTDOWN, CAP_SHUTDOWN) \ + MAPPING(CLOUDABI_RIGHT_SOCK_STAT_GET, CAP_GETPEERNAME, \ + CAP_GETSOCKNAME, CAP_GETSOCKOPT) int cloudabi_sys_fd_close(struct thread *td, struct cloudabi_sys_fd_close_args *uap) @@ -160,13 +211,214 @@ cloudabi_sys_fd_seek(struct thread *td, return (sys_lseek(td, &lseek_args)); } +/* Converts a file descriptor to a CloudABI file descriptor type. */ +cloudabi_filetype_t +cloudabi_convert_filetype(const struct file *fp) +{ + struct socket *so; + struct vnode *vp; + + switch (fp->f_type) { + case DTYPE_FIFO: + return (CLOUDABI_FILETYPE_FIFO); + case DTYPE_KQUEUE: + return (CLOUDABI_FILETYPE_POLL); + case DTYPE_PIPE: + return (CLOUDABI_FILETYPE_FIFO); + case DTYPE_PROCDESC: + return (CLOUDABI_FILETYPE_PROCESS); + case DTYPE_SHM: + return (CLOUDABI_FILETYPE_SHARED_MEMORY); + case DTYPE_SOCKET: + so = fp->f_data; + switch (so->so_type) { + case SOCK_DGRAM: + return (CLOUDABI_FILETYPE_SOCKET_DGRAM); + case SOCK_SEQPACKET: + return (CLOUDABI_FILETYPE_SOCKET_SEQPACKET); + case SOCK_STREAM: + return (CLOUDABI_FILETYPE_SOCKET_STREAM); + default: + return (CLOUDABI_FILETYPE_UNKNOWN); + } + case DTYPE_VNODE: + vp = fp->f_vnode; + switch (vp->v_type) { + case VBLK: + return (CLOUDABI_FILETYPE_BLOCK_DEVICE); + case VCHR: + return (CLOUDABI_FILETYPE_CHARACTER_DEVICE); + case VDIR: + return (CLOUDABI_FILETYPE_DIRECTORY); + case VFIFO: + return (CLOUDABI_FILETYPE_FIFO); + case VLNK: + return (CLOUDABI_FILETYPE_SYMBOLIC_LINK); + case VREG: + return (CLOUDABI_FILETYPE_REGULAR_FILE); + case VSOCK: + return (CLOUDABI_FILETYPE_SOCKET_STREAM); + default: + return (CLOUDABI_FILETYPE_UNKNOWN); + } + default: + return (CLOUDABI_FILETYPE_UNKNOWN); + } +} + +/* + * Converts FreeBSD's Capsicum rights to CloudABI's set of rights. + */ +static void +convert_capabilities(const cap_rights_t *capabilities, + cloudabi_filetype_t filetype, cloudabi_rights_t *base, + cloudabi_rights_t *inheriting) +{ + cloudabi_rights_t rights; + + /* Convert FreeBSD bits to CloudABI bits. */ + rights = 0; +#define MAPPING(cloudabi, ...) do { \ + if (cap_rights_is_set(capabilities, ##__VA_ARGS__)) \ + rights |= (cloudabi); \ +} while (0); + RIGHTS_MAPPINGS +#undef MAPPING + + /* + * CloudABI has a small number of additional rights bits to + * disambiguate between multiple purposes. Remove the bits that + * don't apply to the type of the file descriptor. + * + * As file descriptor access modes (O_ACCMODE) has been fully + * replaced by rights bits, CloudABI distinguishes between + * rights that apply to the file descriptor itself (base) versus + * rights of new file descriptors derived from them + * (inheriting). The code below approximates the pair by + * decomposing depending on the file descriptor type. + * + * We need to be somewhat accurate about which actions can + * actually be performed on the file descriptor, as functions + * like fcntl(fd, F_GETFL) are emulated on top of this. + */ + switch (filetype) { + case CLOUDABI_FILETYPE_DIRECTORY: + *base = rights & (CLOUDABI_RIGHT_FD_STAT_PUT_FLAGS | + CLOUDABI_RIGHT_FD_SYNC | CLOUDABI_RIGHT_FILE_ADVISE | + CLOUDABI_RIGHT_FILE_CREATE_DIRECTORY | + CLOUDABI_RIGHT_FILE_CREATE_FILE | + CLOUDABI_RIGHT_FILE_CREATE_FIFO | + CLOUDABI_RIGHT_FILE_LINK_SOURCE | + CLOUDABI_RIGHT_FILE_LINK_TARGET | + CLOUDABI_RIGHT_FILE_OPEN | + CLOUDABI_RIGHT_FILE_READDIR | + CLOUDABI_RIGHT_FILE_READLINK | + CLOUDABI_RIGHT_FILE_RENAME_SOURCE | + CLOUDABI_RIGHT_FILE_RENAME_TARGET | + CLOUDABI_RIGHT_FILE_STAT_FGET | + CLOUDABI_RIGHT_FILE_STAT_FPUT_TIMES | + CLOUDABI_RIGHT_FILE_STAT_GET | + CLOUDABI_RIGHT_FILE_STAT_PUT_TIMES | + CLOUDABI_RIGHT_FILE_SYMLINK | + CLOUDABI_RIGHT_FILE_UNLINK | + CLOUDABI_RIGHT_POLL_FD_READWRITE | + CLOUDABI_RIGHT_SOCK_BIND_DIRECTORY | + CLOUDABI_RIGHT_SOCK_CONNECT_DIRECTORY); + *inheriting = rights; + break; + case CLOUDABI_FILETYPE_FIFO: + *base = rights & ~(CLOUDABI_RIGHT_FILE_ADVISE | + CLOUDABI_RIGHT_FILE_ALLOCATE | + CLOUDABI_RIGHT_FILE_READDIR); + *inheriting = 0; + break; + case CLOUDABI_FILETYPE_POLL: + *base = rights & ~CLOUDABI_RIGHT_FILE_ADVISE; + *inheriting = 0; + break; + case CLOUDABI_FILETYPE_PROCESS: + *base = rights & ~CLOUDABI_RIGHT_FILE_ADVISE; + *inheriting = 0; + break; + case CLOUDABI_FILETYPE_REGULAR_FILE: + *base = rights & ~CLOUDABI_RIGHT_FILE_READDIR; + *inheriting = 0; + break; + case CLOUDABI_FILETYPE_SHARED_MEMORY: + *base = rights & ~(CLOUDABI_RIGHT_FD_SEEK | + CLOUDABI_RIGHT_FD_TELL | + CLOUDABI_RIGHT_FILE_ADVISE | + CLOUDABI_RIGHT_FILE_ALLOCATE | + CLOUDABI_RIGHT_FILE_READDIR); + *inheriting = 0; + break; + case CLOUDABI_FILETYPE_SOCKET_DGRAM: + case CLOUDABI_FILETYPE_SOCKET_SEQPACKET: + case CLOUDABI_FILETYPE_SOCKET_STREAM: + *base = rights & (CLOUDABI_RIGHT_FD_READ | + CLOUDABI_RIGHT_FD_STAT_PUT_FLAGS | + CLOUDABI_RIGHT_FD_WRITE | + CLOUDABI_RIGHT_FILE_STAT_FGET | + CLOUDABI_RIGHT_POLL_FD_READWRITE | + CLOUDABI_RIGHT_SOCK_ACCEPT | + CLOUDABI_RIGHT_SOCK_BIND_SOCKET | + CLOUDABI_RIGHT_SOCK_CONNECT_SOCKET | + CLOUDABI_RIGHT_SOCK_LISTEN | + CLOUDABI_RIGHT_SOCK_SHUTDOWN | + CLOUDABI_RIGHT_SOCK_STAT_GET); + *inheriting = rights; + break; + default: + *base = rights; + *inheriting = 0; + break; + } +} + int cloudabi_sys_fd_stat_get(struct thread *td, struct cloudabi_sys_fd_stat_get_args *uap) { - - /* Not implemented. */ - return (ENOSYS); + cloudabi_fdstat_t fsb = {}; + struct filedesc *fdp; + struct file *fp; + seq_t seq; + cap_rights_t rights; + int error, oflags; + bool modified; + + /* Obtain file descriptor properties. */ + fdp = td->td_proc->p_fd; + do { + error = fget_unlocked(fdp, uap->fd, cap_rights_init(&rights), + &fp, &seq); + if (error != 0) + return (error); + if (fp->f_ops == &badfileops) { + fdrop(fp, td); + return (EBADF); + } + + rights = *cap_rights(fdp, uap->fd); + oflags = OFLAGS(fp->f_flag); + fsb.fs_filetype = cloudabi_convert_filetype(fp); + + modified = fd_modified(fdp, uap->fd, seq); + fdrop(fp, td); + } while (modified); + + /* Convert file descriptor flags. */ + if (oflags & O_APPEND) + fsb.fs_flags |= CLOUDABI_FDFLAG_APPEND; + if (oflags & O_NONBLOCK) + fsb.fs_flags |= CLOUDABI_FDFLAG_NONBLOCK; + if (oflags & O_SYNC) + fsb.fs_flags |= CLOUDABI_FDFLAG_SYNC; + + /* Convert capabilities to CloudABI rights. */ + convert_capabilities(&rights, fsb.fs_filetype, + &fsb.fs_rights_base, &fsb.fs_rights_inheriting); + return (copyout(&fsb, (void *)uap->buf, sizeof(fsb))); } int Modified: head/sys/compat/cloudabi/cloudabi_file.c ============================================================================== --- head/sys/compat/cloudabi/cloudabi_file.c Tue Jul 28 05:48:58 2015 (r285929) +++ head/sys/compat/cloudabi/cloudabi_file.c Tue Jul 28 06:36:49 2015 (r285930) @@ -27,14 +27,18 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include #include +#include +#include #include #include #include +#include static MALLOC_DEFINE(M_CLOUDABI_PATH, "cloudabipath", "CloudABI pathnames"); @@ -220,13 +224,50 @@ cloudabi_sys_file_rename(struct thread * return (error); } +/* Converts a FreeBSD stat structure to a CloudABI stat structure. */ +static void +convert_stat(const struct stat *sb, cloudabi_filestat_t *csb) +{ + cloudabi_filestat_t res = { + .st_dev = sb->st_dev, + .st_ino = sb->st_ino, + .st_nlink = sb->st_nlink, + .st_size = sb->st_size, + }; + + cloudabi_convert_timespec(&sb->st_atim, &res.st_atim); + cloudabi_convert_timespec(&sb->st_mtim, &res.st_mtim); + cloudabi_convert_timespec(&sb->st_ctim, &res.st_ctim); + *csb = res; +} + int cloudabi_sys_file_stat_fget(struct thread *td, struct cloudabi_sys_file_stat_fget_args *uap) { + struct stat sb; + cloudabi_filestat_t csb; + struct file *fp; + cap_rights_t rights; + cloudabi_filetype_t filetype; + int error; - /* Not implemented. */ - return (ENOSYS); + /* Fetch file descriptor attributes. */ + error = fget(td, uap->fd, cap_rights_init(&rights, CAP_FSTAT), &fp); + if (error != 0) + return (error); + error = fo_stat(fp, &sb, td->td_ucred, td); + if (error != 0) { + fdrop(fp, td); + return (error); + } + filetype = cloudabi_convert_filetype(fp); + fdrop(fp, td); + + /* Convert attributes to CloudABI's format. */ + convert_stat(&sb, &csb); + csb.st_filetype = filetype; + return (copyout(&csb, uap->buf, sizeof(csb))); } int @@ -242,9 +283,42 @@ int cloudabi_sys_file_stat_get(struct thread *td, struct cloudabi_sys_file_stat_get_args *uap) { + struct stat sb; + cloudabi_filestat_t csb; + char *path; + int error; - /* Not implemented. */ - return (ENOSYS); + error = copyin_path(uap->path, uap->pathlen, &path); + if (error != 0) + return (error); + + error = kern_statat(td, + (uap->fd & CLOUDABI_LOOKUP_SYMLINK_FOLLOW) != 0 ? 0 : + AT_SYMLINK_NOFOLLOW, uap->fd, path, UIO_SYSSPACE, &sb, NULL); + cloudabi_freestr(path); + if (error != 0) + return (error); + + /* Convert results and return them. */ + convert_stat(&sb, &csb); + if (S_ISBLK(sb.st_mode)) + csb.st_filetype = CLOUDABI_FILETYPE_BLOCK_DEVICE; + else if (S_ISCHR(sb.st_mode)) + csb.st_filetype = CLOUDABI_FILETYPE_CHARACTER_DEVICE; + else if (S_ISDIR(sb.st_mode)) + csb.st_filetype = CLOUDABI_FILETYPE_DIRECTORY; + else if (S_ISFIFO(sb.st_mode)) + csb.st_filetype = CLOUDABI_FILETYPE_FIFO; + else if (S_ISREG(sb.st_mode)) + csb.st_filetype = CLOUDABI_FILETYPE_REGULAR_FILE; + else if (S_ISSOCK(sb.st_mode)) { + /* Inaccurate, but the best that we can do. */ + csb.st_filetype = CLOUDABI_FILETYPE_SOCKET_STREAM; + } else if (S_ISLNK(sb.st_mode)) + csb.st_filetype = CLOUDABI_FILETYPE_SYMBOLIC_LINK; + else + csb.st_filetype = CLOUDABI_FILETYPE_UNKNOWN; + return (copyout(&csb, uap->buf, sizeof(csb))); } int Modified: head/sys/compat/cloudabi/cloudabi_util.h ============================================================================== --- head/sys/compat/cloudabi/cloudabi_util.h Tue Jul 28 05:48:58 2015 (r285929) +++ head/sys/compat/cloudabi/cloudabi_util.h Tue Jul 28 06:36:49 2015 (r285930) @@ -30,6 +30,7 @@ #include +struct file; struct thread; struct timespec; @@ -40,6 +41,9 @@ int cloudabi_clock_time_get(struct threa /* Converts a FreeBSD errno to a CloudABI errno. */ cloudabi_errno_t cloudabi_convert_errno(int); +/* Converts a file descriptor to a CloudABI file descriptor type. */ +cloudabi_filetype_t cloudabi_convert_filetype(const struct file *); + /* Converts a struct timespec to a CloudABI timestamp. */ int cloudabi_convert_timespec(const struct timespec *, cloudabi_timestamp_t *); From owner-svn-src-all@freebsd.org Tue Jul 28 06:50:48 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C8479ACC9B; Tue, 28 Jul 2015 06:50:48 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D69FDDC; Tue, 28 Jul 2015 06:50:48 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S6olAn053997; Tue, 28 Jul 2015 06:50:47 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S6olKq053995; Tue, 28 Jul 2015 06:50:47 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201507280650.t6S6olKq053995@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Tue, 28 Jul 2015 06:50:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285931 - head/sys/compat/cloudabi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 06:50:48 -0000 Author: ed Date: Tue Jul 28 06:50:47 2015 New Revision: 285931 URL: https://svnweb.freebsd.org/changeset/base/285931 Log: Implement directory and FIFO creation. The file_create() system call can be used to create files of a given type. Right now it can only be used to create directories and FIFOs. As CloudABI does not expose filesystem permissions, this system call lacks a mode argument. Simply use 0777 or 0666 depending on the file type. Modified: head/sys/compat/cloudabi/cloudabi_file.c Modified: head/sys/compat/cloudabi/cloudabi_file.c ============================================================================== --- head/sys/compat/cloudabi/cloudabi_file.c Tue Jul 28 06:36:49 2015 (r285930) +++ head/sys/compat/cloudabi/cloudabi_file.c Tue Jul 28 06:50:47 2015 (r285931) @@ -137,9 +137,31 @@ int cloudabi_sys_file_create(struct thread *td, struct cloudabi_sys_file_create_args *uap) { + char *path; + int error; - /* Not implemented. */ - return (ENOSYS); + error = copyin_path(uap->path, uap->pathlen, &path); + if (error != 0) + return (error); + + /* + * CloudABI processes cannot interact with UNIX credentials and + * permissions. Depend on the umask that is set prior to + * execution to restrict the file permissions. + */ + switch (uap->type) { + case CLOUDABI_FILETYPE_DIRECTORY: + error = kern_mkdirat(td, uap->fd, path, UIO_SYSSPACE, 0777); + break; + case CLOUDABI_FILETYPE_FIFO: + error = kern_mkfifoat(td, uap->fd, path, UIO_SYSSPACE, 0666); + break; + default: + error = EINVAL; + break; + } + cloudabi_freestr(path); + return (error); } int From owner-svn-src-all@freebsd.org Tue Jul 28 06:55:09 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 60E2F9ACE57; Tue, 28 Jul 2015 06:55:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 51D0D13BD; Tue, 28 Jul 2015 06:55:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S6t9Pw057285; Tue, 28 Jul 2015 06:55:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S6t9YR057284; Tue, 28 Jul 2015 06:55:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201507280655.t6S6t9YR057284@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 28 Jul 2015 06:55:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285932 - head/sys/x86/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 06:55:09 -0000 Author: kib Date: Tue Jul 28 06:55:08 2015 New Revision: 285932 URL: https://svnweb.freebsd.org/changeset/base/285932 Log: Add bit names for the IA32_MISC_ENABLE msr. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/x86/include/specialreg.h Modified: head/sys/x86/include/specialreg.h ============================================================================== --- head/sys/x86/include/specialreg.h Tue Jul 28 06:50:47 2015 (r285931) +++ head/sys/x86/include/specialreg.h Tue Jul 28 06:55:08 2015 (r285932) @@ -521,6 +521,17 @@ #define IA32_FEATURE_CONTROL_SMX_EN 0x02 /* enable VMX inside SMX */ #define IA32_FEATURE_CONTROL_VMX_EN 0x04 /* enable VMX outside SMX */ +/* MSR IA32_MISC_ENABLE */ +#define IA32_MISC_EN_FASTSTR 0x0000000000000001ULL +#define IA32_MISC_EN_ATCCE 0x0000000000000008ULL +#define IA32_MISC_EN_PERFMON 0x0000000000000080ULL +#define IA32_MISC_EN_PEBSU 0x0000000000001000ULL +#define IA32_MISC_EN_ESSTE 0x0000000000010000ULL +#define IA32_MISC_EN_MONE 0x0000000000040000ULL +#define IA32_MISC_EN_LIMCPUID 0x0000000000400000ULL +#define IA32_MISC_EN_xTPRD 0x0000000000800000ULL +#define IA32_MISC_EN_XDD 0x0000000400000000ULL + /* * PAT modes. */ From owner-svn-src-all@freebsd.org Tue Jul 28 06:58:11 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8EEFF9ACEBA; Tue, 28 Jul 2015 06:58:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 77FA015DB; Tue, 28 Jul 2015 06:58:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S6wBg4057490; Tue, 28 Jul 2015 06:58:11 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S6wBNT057489; Tue, 28 Jul 2015 06:58:11 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201507280658.t6S6wBNT057489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 28 Jul 2015 06:58:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285933 - head/sys/rpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 06:58:11 -0000 Author: kib Date: Tue Jul 28 06:58:10 2015 New Revision: 285933 URL: https://svnweb.freebsd.org/changeset/base/285933 Log: Remove useless acquire semantic from the atomic_add operation before sosend(). The only release on the xp_snt_cnt is done after sosend(), with an intent to synchronize with load_acq in svc_vc_ack(). Reviewed by: alc Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/rpc/svc_vc.c Modified: head/sys/rpc/svc_vc.c ============================================================================== --- head/sys/rpc/svc_vc.c Tue Jul 28 06:55:08 2015 (r285932) +++ head/sys/rpc/svc_vc.c Tue Jul 28 06:58:10 2015 (r285933) @@ -860,7 +860,7 @@ svc_vc_reply(SVCXPRT *xprt, struct rpc_m len = mrep->m_pkthdr.len; *mtod(mrep, uint32_t *) = htonl(0x80000000 | (len - sizeof(uint32_t))); - atomic_add_acq_32(&xprt->xp_snd_cnt, len); + atomic_add_32(&xprt->xp_snd_cnt, len); error = sosend(xprt->xp_socket, NULL, NULL, mrep, NULL, 0, curthread); if (!error) { From owner-svn-src-all@freebsd.org Tue Jul 28 07:04:52 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D01479AB04B; Tue, 28 Jul 2015 07:04:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B5A591AD0; Tue, 28 Jul 2015 07:04:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S74qPG061386; Tue, 28 Jul 2015 07:04:52 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S74qO1061385; Tue, 28 Jul 2015 07:04:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201507280704.t6S74qO1061385@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 28 Jul 2015 07:04:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285934 - head/sys/amd64/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 07:04:53 -0000 Author: kib Date: Tue Jul 28 07:04:51 2015 New Revision: 285934 URL: https://svnweb.freebsd.org/changeset/base/285934 Log: Remove full barrier from the amd64 atomic_load_acq_*(). Strong ordering semantic of x86 CPUs makes only the compiler barrier neccessary to give the acquire behaviour. Existing implementation ensured sequentially consistent semantic for load_acq, making much stronger guarantee than required by standard's definition of the load acquire. Consumers which depend on the barrier are believed to be identified and already fixed to use proper operations. Noted by: alc (long time ago) Reviewed by: alc, bde Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/amd64/include/atomic.h Modified: head/sys/amd64/include/atomic.h ============================================================================== --- head/sys/amd64/include/atomic.h Tue Jul 28 06:58:10 2015 (r285933) +++ head/sys/amd64/include/atomic.h Tue Jul 28 07:04:51 2015 (r285934) @@ -269,13 +269,13 @@ atomic_testandset_long(volatile u_long * * IA32 memory model, a simple store guarantees release semantics. * * However, a load may pass a store if they are performed on distinct - * addresses, so for atomic_load_acq we introduce a Store/Load barrier - * before the load in SMP kernels. We use "lock addl $0,mem", as - * recommended by the AMD Software Optimization Guide, and not mfence. - * In the kernel, we use a private per-cpu cache line as the target - * for the locked addition, to avoid introducing false data - * dependencies. In userspace, a word in the red zone on the stack - * (-8(%rsp)) is utilized. + * addresses, so we need a Store/Load barrier for sequentially + * consistent fences in SMP kernels. We use "lock addl $0,mem" for a + * Store/Load barrier, as recommended by the AMD Software Optimization + * Guide, and not mfence. In the kernel, we use a private per-cpu + * cache line as the target for the locked addition, to avoid + * introducing false data dependencies. In user space, we use a word + * in the stack's red zone (-8(%rsp)). * * For UP kernels, however, the memory of the single processor is * always consistent, so we only need to stop the compiler from @@ -319,22 +319,12 @@ __storeload_barrier(void) } #endif /* _KERNEL*/ -/* - * C11-standard acq/rel semantics only apply when the variable in the - * call is the same for acq as it is for rel. However, our previous - * (x86) implementations provided much stronger ordering than required - * (essentially what is called seq_cst order in C11). This - * implementation provides the historical strong ordering since some - * callers depend on it. - */ - #define ATOMIC_LOAD(TYPE) \ static __inline u_##TYPE \ atomic_load_acq_##TYPE(volatile u_##TYPE *p) \ { \ u_##TYPE res; \ \ - __storeload_barrier(); \ res = *p; \ __compiler_membar(); \ return (res); \ From owner-svn-src-all@freebsd.org Tue Jul 28 07:06:04 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C09F9AB091 for ; Tue, 28 Jul 2015 07:06:04 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-oi0-f45.google.com (mail-oi0-f45.google.com [209.85.218.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C25AA1C63 for ; Tue, 28 Jul 2015 07:06:03 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by oige126 with SMTP id e126so64535213oig.0 for ; Tue, 28 Jul 2015 00:05:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=+ofwWkWUZr4n561/0OwI5brLcnIiLD2WnpNVaKKxyw0=; b=TMSM7t2KwYmYa7EYo8VfyV4qNDcLHMX7XvmT4TXSBVNZAGSLD9Wtm4sZ/mCrbVs9Cv 5kGy6McKchhFOvu2A4YCvpnWJH6tCBNFSAp7IQ83nxD+58J3xBt4/1B8fRobXEFgP6+e BXxghSAPWvn8fgm0OX/Xdme/p8xVMkTQtNZOAGsORsdW36KHinPRrSHENKT/KG53+MF7 kiBw3q2pk13Y6O9B5SkNqMCgLQ3IY6Fbdhudnoy0LvXZulrvPDQ4kEVLkf882L/lfdIo xoTD1uznYQbP243LJbIOMY7UyidoUYc4SVmV8lTZ6E4TMAMaNVo+5M19G3NYiVwO+mbA bhEA== X-Gm-Message-State: ALoCoQnqfgIQSN1quXjNTIXJY646KSm60oSbMcjEAdCCX7ijQ8exJHszdlBAcj9BHXU+GaE01jrj MIME-Version: 1.0 X-Received: by 10.202.67.67 with SMTP id q64mr30972771oia.124.1438067157389; Tue, 28 Jul 2015 00:05:57 -0700 (PDT) Received: by 10.76.0.46 with HTTP; Tue, 28 Jul 2015 00:05:57 -0700 (PDT) X-Originating-IP: [84.27.222.46] In-Reply-To: <201507280232.t6S2WfSq043383@repo.freebsd.org> References: <201507280232.t6S2WfSq043383@repo.freebsd.org> Date: Tue, 28 Jul 2015 09:05:57 +0200 Message-ID: Subject: Re: svn commit: r285926 - in head: libexec/ypxfr usr.bin/ypcat usr.bin/ypmatch usr.bin/ypwhich usr.sbin/yp_mkdb usr.sbin/yppush usr.sbin/ypserv From: Ed Schouten To: Marcelo Araujo Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 07:06:04 -0000 Hi Marcelo, Thanks for working on this! 2015-07-28 4:32 GMT+02:00 Marcelo Araujo : > -struct ypalias { > +const struct ypalias { > char *alias, *name; > -} ypaliases[] = { > +} static ypaliases[] = { > { "passwd", "passwd.byname" }, > { "master.passwd", "master.passwd.byname" }, > { "shadow", "shadow.byname" }, I seem to remember that certain compilers (Intel?) are pretty picky about the ordering of 'static' and 'const'. const static int i; // Compiler error. It's also inconsistent with the rest of our codebase, where we typically put 'static' in front of the type. Could you please change this to the following? static const struct ypalias { ... } ypaliases[] = { ... }; Thanks! -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK/VAT number: 62051717 From owner-svn-src-all@freebsd.org Tue Jul 28 07:23:17 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3D319AB57F; Tue, 28 Jul 2015 07:23:17 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: from mail-oi0-x234.google.com (mail-oi0-x234.google.com [IPv6:2607:f8b0:4003:c06::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A21487C7; Tue, 28 Jul 2015 07:23:17 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: by oige126 with SMTP id e126so64715890oig.0; Tue, 28 Jul 2015 00:23:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=gBAaqRMGH9jPkj1qaMNJZvjMAVkzPJpPy1jBRBEOBc4=; b=zTdUXgYYvBdyx4utIn2eweSgCULKFp8R6ZObHy+LLyFMDkc4LX+Lxetk1MP+iZR+LS iRSTRssgOCzTkj+ZhrDSPtDiarducLBNkWOivgMjcZU7rjMR1JNsfKHENYx4/zhqR/Z2 I/Vj+vnKhamutWPFC0HE0xBrIVjKCpbZGpJblQPvxQI3QKbPrNaIfq0Y9IsTTLU+ASmh NNO8MSiaq/5SPiIz4N/KrLr4RXQIJrG2mV3s7szI3KKEua3u3x5gF4soCgj0tBpQeY8B aLzHmJI7T1iTqJuw5Z2pEVuLcCBtIJH2vDkypXZVil15QPF47lDk4Htd9qndNSj1/ci+ W7zQ== MIME-Version: 1.0 X-Received: by 10.202.200.151 with SMTP id y145mr30768414oif.111.1438068196916; Tue, 28 Jul 2015 00:23:16 -0700 (PDT) Received: by 10.202.11.193 with HTTP; Tue, 28 Jul 2015 00:23:16 -0700 (PDT) Reply-To: araujo@FreeBSD.org In-Reply-To: References: <201507280232.t6S2WfSq043383@repo.freebsd.org> Date: Tue, 28 Jul 2015 15:23:16 +0800 Message-ID: Subject: Re: svn commit: r285926 - in head: libexec/ypxfr usr.bin/ypcat usr.bin/ypmatch usr.bin/ypwhich usr.sbin/yp_mkdb usr.sbin/yppush usr.sbin/ypserv From: Marcelo Araujo To: Ed Schouten Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 07:23:18 -0000 2015-07-28 15:05 GMT+08:00 Ed Schouten : > Hi Marcelo, > > Thanks for working on this! > > 2015-07-28 4:32 GMT+02:00 Marcelo Araujo : > > -struct ypalias { > > +const struct ypalias { > > char *alias, *name; > > -} ypaliases[] = { > > +} static ypaliases[] = { > > { "passwd", "passwd.byname" }, > > { "master.passwd", "master.passwd.byname" }, > > { "shadow", "shadow.byname" }, > > I seem to remember that certain compilers (Intel?) are pretty picky > about the ordering of 'static' and 'const'. > > const static int i; // Compiler error. > > It's also inconsistent with the rest of our codebase, where we > typically put 'static' in front of the type. Could you please change > this to the following? > > static const struct ypalias { > ... > } ypaliases[] = { > ... > }; > > Thanks! > Hello Ed, Thanks to point it out. I got a problem with sparc64, exactly because of that. I will fix it later. All the best. -- Marcelo Araujo (__)araujo@FreeBSD.org \\\'',)http://www.FreeBSD.org \/ \ ^ Power To Server. .\. /_) From owner-svn-src-all@freebsd.org Tue Jul 28 07:30:08 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2EF99AB6C2; Tue, 28 Jul 2015 07:30:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C724F9B2; Tue, 28 Jul 2015 07:30:08 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S7U8eL069700; Tue, 28 Jul 2015 07:30:08 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S7U8eS069698; Tue, 28 Jul 2015 07:30:08 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201507280730.t6S7U8eS069698@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 28 Jul 2015 07:30:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285935 - head/sys/dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 07:30:09 -0000 Author: hselasky Date: Tue Jul 28 07:30:07 2015 New Revision: 285935 URL: https://svnweb.freebsd.org/changeset/base/285935 Log: Optimise the DWC OTG host mode driver's receive path: Remove NAKing limit and pause IN and OUT transactions for 125us in case of NAK response for BULK and CONTROL endpoints. This gets the receive latency down and improves USB network throughput at the cost of some CPU usage. MFC after: 1 month Modified: head/sys/dev/usb/controller/dwc_otg.c head/sys/dev/usb/controller/dwc_otg.h Modified: head/sys/dev/usb/controller/dwc_otg.c ============================================================================== --- head/sys/dev/usb/controller/dwc_otg.c Tue Jul 28 07:04:51 2015 (r285934) +++ head/sys/dev/usb/controller/dwc_otg.c Tue Jul 28 07:30:07 2015 (r285935) @@ -453,8 +453,12 @@ static void dwc_otg_enable_sof_irq(struct dwc_otg_softc *sc) { /* In device mode we don't use the SOF interrupt */ - if (sc->sc_flags.status_device_mode != 0 || - (sc->sc_irq_mask & GINTMSK_SOFMSK) != 0) + if (sc->sc_flags.status_device_mode != 0) + return; + /* Ensure the SOF interrupt is not disabled */ + sc->sc_needsof = 1; + /* Check if the SOF interrupt is already enabled */ + if ((sc->sc_irq_mask & GINTMSK_SOFMSK) != 0) return; sc->sc_irq_mask |= GINTMSK_SOFMSK; DWC_OTG_WRITE_4(sc, DOTG_GINTMSK, sc->sc_irq_mask); @@ -775,7 +779,7 @@ check_state: case DWC_CHAN_ST_WAIT_ANE: if (hcint & (HCINT_RETRY | HCINT_ERRORS)) { - td->did_nak++; + td->did_nak = 1; td->tt_scheduled = 0; goto send_pkt; } else if (hcint & (HCINT_ACK | HCINT_NYET)) { @@ -789,7 +793,7 @@ check_state: case DWC_CHAN_ST_WAIT_S_ANE: if (hcint & (HCINT_RETRY | HCINT_ERRORS)) { - td->did_nak++; + td->did_nak = 1; td->tt_scheduled = 0; goto send_pkt; } else if (hcint & (HCINT_ACK | HCINT_NYET)) { @@ -801,7 +805,7 @@ check_state: if (hcint & HCINT_NYET) { goto send_cpkt; } else if (hcint & (HCINT_RETRY | HCINT_ERRORS)) { - td->did_nak++; + td->did_nak = 1; td->tt_scheduled = 0; goto send_pkt; } else if (hcint & HCINT_ACK) { @@ -1069,8 +1073,17 @@ dwc_otg_host_rate_check(struct dwc_otg_s if (!td->tt_scheduled) goto busy; td->tt_scheduled = 0; - } else if (td->did_nak >= DWC_OTG_NAK_MAX) { - goto busy; + } else if (td->did_nak != 0) { + uint8_t frame_num = (uint8_t)sc->sc_last_frame_num; + /* check if we should pause sending queries for 125us */ + if (td->tmr_res == frame_num) { + /* wait a bit */ + dwc_otg_enable_sof_irq(sc); + goto busy; + } + /* query for data one more time */ + td->tmr_res = frame_num; + td->did_nak = 0; } else if (td->set_toggle) { td->set_toggle = 0; td->toggle = 1; @@ -1257,7 +1270,7 @@ dwc_otg_host_data_rx(struct dwc_otg_soft goto receive_pkt; } } - td->did_nak++; + td->did_nak = 1; td->tt_scheduled = 0; if (td->hcsplt != 0) goto receive_spkt; @@ -1312,7 +1325,7 @@ dwc_otg_host_data_rx(struct dwc_otg_soft * case of interrupt and isochronous transfers: */ if (hcint & (HCINT_RETRY | HCINT_ERRORS)) { - td->did_nak++; + td->did_nak = 1; td->tt_scheduled = 0; goto receive_spkt; } else if (hcint & HCINT_NYET) { @@ -1638,7 +1651,7 @@ dwc_otg_host_data_tx(struct dwc_otg_soft case DWC_CHAN_ST_WAIT_ANE: if (hcint & (HCINT_RETRY | HCINT_ERRORS)) { - td->did_nak++; + td->did_nak = 1; td->tt_scheduled = 0; goto send_pkt; } else if (hcint & (HCINT_ACK | HCINT_NYET)) { @@ -1664,7 +1677,7 @@ dwc_otg_host_data_tx(struct dwc_otg_soft case DWC_CHAN_ST_WAIT_S_ANE: if (hcint & (HCINT_RETRY | HCINT_ERRORS)) { - td->did_nak++; + td->did_nak = 1; td->tt_scheduled = 0; goto send_pkt; } else if (hcint & (HCINT_ACK | HCINT_NYET)) { @@ -1677,7 +1690,7 @@ dwc_otg_host_data_tx(struct dwc_otg_soft if (hcint & HCINT_NYET) { goto send_cpkt; } else if (hcint & (HCINT_RETRY | HCINT_ERRORS)) { - td->did_nak++; + td->did_nak = 1; td->tt_scheduled = 0; goto send_pkt; } else if (hcint & HCINT_ACK) { @@ -2280,8 +2293,6 @@ static void dwc_otg_timer(void *_sc) { struct dwc_otg_softc *sc = _sc; - struct usb_xfer *xfer; - struct dwc_otg_td *td; USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); @@ -2292,14 +2303,6 @@ dwc_otg_timer(void *_sc) /* increment timer value */ sc->sc_tmr_val++; - TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { - td = xfer->td_transfer_cache; - if (td != NULL) { - /* reset NAK counter */ - td->did_nak = 0; - } - } - /* enable SOF interrupt, which will poll jobs */ dwc_otg_enable_sof_irq(sc); @@ -2459,8 +2462,7 @@ dwc_otg_update_host_transfer_schedule_lo TAILQ_FOREACH_SAFE(xfer, &sc->sc_bus.intr_q.head, wait_entry, xfer_next) { td = xfer->td_transfer_cache; if (td == NULL || - td->ep_type != UE_CONTROL || - td->did_nak >= DWC_OTG_NAK_MAX) { + td->ep_type != UE_CONTROL) { continue; } @@ -2480,8 +2482,7 @@ dwc_otg_update_host_transfer_schedule_lo TAILQ_FOREACH_SAFE(xfer, &sc->sc_bus.intr_q.head, wait_entry, xfer_next) { td = xfer->td_transfer_cache; if (td == NULL || - td->ep_type != UE_BULK || - td->did_nak >= DWC_OTG_NAK_MAX) { + td->ep_type != UE_BULK) { continue; } @@ -3244,7 +3245,7 @@ dwc_otg_setup_standard_chain(struct usb_ td->tmr_res = 1; } else { td->tmr_val = 0; - td->tmr_res = 0; + td->tmr_res = (uint8_t)sc->sc_last_frame_num; } break; case USB_SPEED_HIGH: @@ -3269,7 +3270,7 @@ dwc_otg_setup_standard_chain(struct usb_ td->tmr_res = 1 << usbd_xfer_get_fps_shift(xfer); } else { td->tmr_val = 0; - td->tmr_res = 0; + td->tmr_res = (uint8_t)sc->sc_last_frame_num; } break; default: @@ -3309,8 +3310,6 @@ static void dwc_otg_start_standard_chain(struct usb_xfer *xfer) { struct dwc_otg_softc *sc = DWC_OTG_BUS2SC(xfer->xroot->bus); - struct usb_xfer_root *xroot; - struct dwc_otg_td *td; DPRINTFN(9, "\n"); @@ -3341,24 +3340,6 @@ dwc_otg_start_standard_chain(struct usb_ /* enable SOF interrupt, if any */ dwc_otg_enable_sof_irq(sc); - - td = xfer->td_transfer_cache; - if (td->ep_type != UE_BULK) - goto done; - - xroot = xfer->xroot; - - /* - * Optimise the ping-pong effect by waking up other BULK - * transfers belonging to the same device group: - */ - TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { - td = xfer->td_transfer_cache; - if (td == NULL || td->ep_type != UE_BULK || xfer->xroot != xroot) - continue; - /* reset NAK counter */ - td->did_nak = 0; - } done: USB_BUS_SPIN_UNLOCK(&sc->sc_bus); } Modified: head/sys/dev/usb/controller/dwc_otg.h ============================================================================== --- head/sys/dev/usb/controller/dwc_otg.h Tue Jul 28 07:04:51 2015 (r285934) +++ head/sys/dev/usb/controller/dwc_otg.h Tue Jul 28 07:30:07 2015 (r285935) @@ -37,7 +37,6 @@ #define DWC_OTG_TT_SLOT_MAX 8 #define DWC_OTG_SLOT_IDLE_MAX 3 #define DWC_OTG_SLOT_IDLE_MIN 2 -#define DWC_OTG_NAK_MAX 16 /* 16 NAKs = 2 ms */ #ifndef DWC_OTG_TX_MAX_FIFO_SIZE #define DWC_OTG_TX_MAX_FIFO_SIZE DWC_OTG_MAX_TXN #endif @@ -68,7 +67,6 @@ struct dwc_otg_td { uint8_t errcnt; uint8_t tmr_res; uint8_t tmr_val; - uint8_t did_nak; /* NAK counter */ uint8_t ep_no; uint8_t ep_type; uint8_t channel; @@ -93,6 +91,7 @@ struct dwc_otg_td { uint8_t set_toggle:1; uint8_t got_short:1; uint8_t tt_scheduled:1; + uint8_t did_nak:1; }; struct dwc_otg_tt_info { From owner-svn-src-all@freebsd.org Tue Jul 28 08:22:51 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A1D89AA630; Tue, 28 Jul 2015 08:22:51 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A4DFA13; Tue, 28 Jul 2015 08:22:51 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S8Mp4v094287; Tue, 28 Jul 2015 08:22:51 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S8MpVB094286; Tue, 28 Jul 2015 08:22:51 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201507280822.t6S8MpVB094286@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 28 Jul 2015 08:22:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285936 - stable/10/sbin/geom/class/part X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 08:22:51 -0000 Author: ae Date: Tue Jul 28 08:22:50 2015 New Revision: 285936 URL: https://svnweb.freebsd.org/changeset/base/285936 Log: MFC r285735: lseek() allows an offset to be set beyond the end of file. Using it to check that partition has enough space to write bootcode doesn't work. Use the known size of provider instead. PR: 201504 Modified: stable/10/sbin/geom/class/part/geom_part.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/geom/class/part/geom_part.c ============================================================================== --- stable/10/sbin/geom/class/part/geom_part.c Tue Jul 28 07:30:07 2015 (r285935) +++ stable/10/sbin/geom/class/part/geom_part.c Tue Jul 28 08:22:50 2015 (r285936) @@ -1095,14 +1095,11 @@ gpart_write_partcode(struct ggeom *gp, i if (pp != NULL) { snprintf(dsf, sizeof(dsf), "/dev/%s", pp->lg_name); + if (pp->lg_mediasize < size) + errx(EXIT_FAILURE, "%s: not enough space", dsf); fd = open(dsf, O_WRONLY); if (fd == -1) err(EXIT_FAILURE, "%s", dsf); - if (lseek(fd, size, SEEK_SET) != size) - errx(EXIT_FAILURE, "%s: not enough space", dsf); - if (lseek(fd, 0, SEEK_SET) != 0) - err(EXIT_FAILURE, "%s", dsf); - /* * When writing to a disk device, the write must be * sector aligned and not write to any partial sectors, @@ -1141,11 +1138,11 @@ gpart_write_partcode_vtoc8(struct ggeom if (pp->lg_sectorsize != sizeof(struct vtoc8)) errx(EXIT_FAILURE, "%s: unexpected sector " "size (%d)\n", dsf, pp->lg_sectorsize); + if (pp->lg_mediasize < VTOC_BOOTSIZE) + continue; fd = open(dsf, O_WRONLY); if (fd == -1) err(EXIT_FAILURE, "%s", dsf); - if (lseek(fd, VTOC_BOOTSIZE, SEEK_SET) != VTOC_BOOTSIZE) - continue; /* * We ignore the first VTOC_BOOTSIZE bytes of boot code in * order to avoid overwriting the label. From owner-svn-src-all@freebsd.org Tue Jul 28 08:25:50 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A22609AA71C; Tue, 28 Jul 2015 08:25:50 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 78880C8C; Tue, 28 Jul 2015 08:25:50 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S8PoVP094588; Tue, 28 Jul 2015 08:25:50 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S8PoXj094587; Tue, 28 Jul 2015 08:25:50 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201507280825.t6S8PoXj094587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 28 Jul 2015 08:25:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r285937 - stable/9/sbin/geom/class/part X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 08:25:50 -0000 Author: ae Date: Tue Jul 28 08:25:49 2015 New Revision: 285937 URL: https://svnweb.freebsd.org/changeset/base/285937 Log: MFC r285735: lseek() allows an offset to be set beyond the end of file. Using it to check that partition has enough space to write bootcode doesn't work. Use the known size of provider instead. PR: 201504 Modified: stable/9/sbin/geom/class/part/geom_part.c Directory Properties: stable/9/sbin/geom/class/part/ (props changed) Modified: stable/9/sbin/geom/class/part/geom_part.c ============================================================================== --- stable/9/sbin/geom/class/part/geom_part.c Tue Jul 28 08:22:50 2015 (r285936) +++ stable/9/sbin/geom/class/part/geom_part.c Tue Jul 28 08:25:49 2015 (r285937) @@ -1095,14 +1095,11 @@ gpart_write_partcode(struct ggeom *gp, i if (pp != NULL) { snprintf(dsf, sizeof(dsf), "/dev/%s", pp->lg_name); + if (pp->lg_mediasize < size) + errx(EXIT_FAILURE, "%s: not enough space", dsf); fd = open(dsf, O_WRONLY); if (fd == -1) err(EXIT_FAILURE, "%s", dsf); - if (lseek(fd, size, SEEK_SET) != size) - errx(EXIT_FAILURE, "%s: not enough space", dsf); - if (lseek(fd, 0, SEEK_SET) != 0) - err(EXIT_FAILURE, "%s", dsf); - /* * When writing to a disk device, the write must be * sector aligned and not write to any partial sectors, @@ -1141,11 +1138,11 @@ gpart_write_partcode_vtoc8(struct ggeom if (pp->lg_sectorsize != sizeof(struct vtoc8)) errx(EXIT_FAILURE, "%s: unexpected sector " "size (%d)\n", dsf, pp->lg_sectorsize); + if (pp->lg_mediasize < VTOC_BOOTSIZE) + continue; fd = open(dsf, O_WRONLY); if (fd == -1) err(EXIT_FAILURE, "%s", dsf); - if (lseek(fd, VTOC_BOOTSIZE, SEEK_SET) != VTOC_BOOTSIZE) - continue; /* * We ignore the first VTOC_BOOTSIZE bytes of boot code in * order to avoid overwriting the label. From owner-svn-src-all@freebsd.org Tue Jul 28 08:50:15 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 026209AAD67; Tue, 28 Jul 2015 08:50:15 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E72A61A9F; Tue, 28 Jul 2015 08:50:14 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S8oESj003185; Tue, 28 Jul 2015 08:50:14 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S8oEfA003184; Tue, 28 Jul 2015 08:50:14 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201507280850.t6S8oEfA003184@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 28 Jul 2015 08:50:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285938 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 08:50:15 -0000 Author: tuexen Date: Tue Jul 28 08:50:13 2015 New Revision: 285938 URL: https://svnweb.freebsd.org/changeset/base/285938 Log: Fix a typo reported by Erik Cederstrand. MFC after: 1 week Modified: head/sys/netinet/sctp_indata.c Modified: head/sys/netinet/sctp_indata.c ============================================================================== --- head/sys/netinet/sctp_indata.c Tue Jul 28 08:25:49 2015 (r285937) +++ head/sys/netinet/sctp_indata.c Tue Jul 28 08:50:13 2015 (r285938) @@ -2490,7 +2490,7 @@ sctp_process_data(struct mbuf **mm, int struct mbuf *op_err; char msg[SCTP_DIAG_INFO_LEN]; - snprintf(msg, sizeof(msg), "DATA chunk followwd by chunk of type %2.2x", + snprintf(msg, sizeof(msg), "DATA chunk followed by chunk of type %2.2x", ch->ch.chunk_type); op_err = sctp_generate_cause(SCTP_CAUSE_PROTOCOL_VIOLATION, msg); sctp_abort_association(inp, stcb, From owner-svn-src-all@freebsd.org Tue Jul 28 09:09:02 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D41879AC425; Tue, 28 Jul 2015 09:09:02 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B9A568C1; Tue, 28 Jul 2015 09:09:02 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S992An011553; Tue, 28 Jul 2015 09:09:02 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S992WW011552; Tue, 28 Jul 2015 09:09:02 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201507280909.t6S992WW011552@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 28 Jul 2015 09:09:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285939 - stable/10/sys/netpfil/pf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 09:09:03 -0000 Author: glebius Date: Tue Jul 28 09:09:01 2015 New Revision: 285939 URL: https://svnweb.freebsd.org/changeset/base/285939 Log: Merge r271458: - Provide a sleepable lock to protect against ioctl() vs ioctl() races. - Use the new lock to protect against simultaneous DIOCSTART and/or DIOCSTOP ioctls. Modified: stable/10/sys/netpfil/pf/pf_ioctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- stable/10/sys/netpfil/pf/pf_ioctl.c Tue Jul 28 08:50:13 2015 (r285938) +++ stable/10/sys/netpfil/pf/pf_ioctl.c Tue Jul 28 09:09:01 2015 (r285939) @@ -188,6 +188,7 @@ static volatile VNET_DEFINE(int, pf_pfil VNET_DEFINE(int, pf_end_threads); struct rwlock pf_rules_lock; +struct sx pf_ioctl_lock; /* pfsync */ pfsync_state_import_t *pfsync_state_import_ptr = NULL; @@ -1090,20 +1091,18 @@ pfioctl(struct cdev *dev, u_long cmd, ca switch (cmd) { case DIOCSTART: - PF_RULES_WLOCK(); + sx_xlock(&pf_ioctl_lock); if (V_pf_status.running) error = EEXIST; else { int cpu; - PF_RULES_WUNLOCK(); error = hook_pf(); if (error) { DPFPRINTF(PF_DEBUG_MISC, ("pf: pfil registration failed\n")); break; } - PF_RULES_WLOCK(); V_pf_status.running = 1; V_pf_status.since = time_second; @@ -1112,27 +1111,23 @@ pfioctl(struct cdev *dev, u_long cmd, ca DPFPRINTF(PF_DEBUG_MISC, ("pf: started\n")); } - PF_RULES_WUNLOCK(); break; case DIOCSTOP: - PF_RULES_WLOCK(); + sx_xlock(&pf_ioctl_lock); if (!V_pf_status.running) error = ENOENT; else { V_pf_status.running = 0; - PF_RULES_WUNLOCK(); error = dehook_pf(); if (error) { V_pf_status.running = 1; DPFPRINTF(PF_DEBUG_MISC, ("pf: pfil unregistration failed\n")); } - PF_RULES_WLOCK(); V_pf_status.since = time_second; DPFPRINTF(PF_DEBUG_MISC, ("pf: stopped\n")); } - PF_RULES_WUNLOCK(); break; case DIOCADDRULE: { @@ -3256,6 +3251,8 @@ DIOCCHANGEADDR_error: break; } fail: + if (sx_xlocked(&pf_ioctl_lock)) + sx_xunlock(&pf_ioctl_lock); CURVNET_RESTORE(); return (error); @@ -3728,6 +3725,7 @@ pf_load(void) VNET_LIST_RUNLOCK(); rw_init(&pf_rules_lock, "pf rulesets"); + sx_init(&pf_ioctl_lock, "pf ioctl"); pf_dev = make_dev(&pf_cdevsw, 0, 0, 0, 0600, PF_NAME); if ((error = pfattach()) != 0) @@ -3741,9 +3739,7 @@ pf_unload(void) { int error = 0; - PF_RULES_WLOCK(); V_pf_status.running = 0; - PF_RULES_WUNLOCK(); swi_remove(V_pf_swi_cookie); error = dehook_pf(); if (error) { @@ -3772,6 +3768,7 @@ pf_unload(void) PF_RULES_WUNLOCK(); destroy_dev(pf_dev); rw_destroy(&pf_rules_lock); + sx_destroy(&pf_ioctl_lock); return (error); } From owner-svn-src-all@freebsd.org Tue Jul 28 09:13:57 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E688D9AC5FF; Tue, 28 Jul 2015 09:13:57 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA77AE36; Tue, 28 Jul 2015 09:13:57 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S9Dvo9015416; Tue, 28 Jul 2015 09:13:57 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S9Duae015413; Tue, 28 Jul 2015 09:13:56 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201507280913.t6S9Duae015413@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 28 Jul 2015 09:13:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285940 - in stable/10/sys: net netpfil/pf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 09:13:58 -0000 Author: glebius Date: Tue Jul 28 09:13:55 2015 New Revision: 285940 URL: https://svnweb.freebsd.org/changeset/base/285940 Log: Merge 280169: always lock the hash row of a source node when updating its 'states' counter. PR: 182401 Modified: stable/10/sys/net/pfvar.h stable/10/sys/netpfil/pf/pf.c stable/10/sys/netpfil/pf/pf_ioctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/net/pfvar.h ============================================================================== --- stable/10/sys/net/pfvar.h Tue Jul 28 09:09:01 2015 (r285939) +++ stable/10/sys/net/pfvar.h Tue Jul 28 09:13:55 2015 (r285940) @@ -1549,7 +1549,6 @@ extern struct pf_state *pf_find_state_a extern struct pf_src_node *pf_find_src_node(struct pf_addr *, struct pf_rule *, sa_family_t, int); extern void pf_unlink_src_node(struct pf_src_node *); -extern void pf_unlink_src_node_locked(struct pf_src_node *); extern u_int pf_free_src_nodes(struct pf_src_node_list *); extern void pf_print_state(struct pf_state *); extern void pf_print_flags(u_int8_t); Modified: stable/10/sys/netpfil/pf/pf.c ============================================================================== --- stable/10/sys/netpfil/pf/pf.c Tue Jul 28 09:09:01 2015 (r285939) +++ stable/10/sys/netpfil/pf/pf.c Tue Jul 28 09:13:55 2015 (r285940) @@ -655,7 +655,10 @@ pf_find_src_node(struct pf_addr *src, st ((af == AF_INET && n->addr.v4.s_addr == src->v4.s_addr) || (af == AF_INET6 && bcmp(&n->addr, src, sizeof(*src)) == 0))) break; - if (n != NULL || returnlocked == 0) + if (n != NULL) { + n->states++; + PF_HASHROW_UNLOCK(sh); + } else if (returnlocked == 0) PF_HASHROW_UNLOCK(sh); return (n); @@ -699,6 +702,7 @@ pf_insert_src_node(struct pf_src_node ** LIST_INSERT_HEAD(&sh->nodes, *sn, entry); (*sn)->creation = time_uptime; (*sn)->ruletype = rule->action; + (*sn)->states = 1; if ((*sn)->rule.ptr != NULL) counter_u64_add((*sn)->rule.ptr->src_nodes, 1); PF_HASHROW_UNLOCK(sh); @@ -715,37 +719,13 @@ pf_insert_src_node(struct pf_src_node ** } void -pf_unlink_src_node_locked(struct pf_src_node *src) +pf_unlink_src_node(struct pf_src_node *src) { -#ifdef INVARIANTS - struct pf_srchash *sh; - sh = &V_pf_srchash[pf_hashsrc(&src->addr, src->af)]; - PF_HASHROW_ASSERT(sh); -#endif + PF_HASHROW_ASSERT(&V_pf_srchash[pf_hashsrc(&src->addr, src->af)]); LIST_REMOVE(src, entry); if (src->rule.ptr) counter_u64_add(src->rule.ptr->src_nodes, -1); - counter_u64_add(V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS], 1); -} - -void -pf_unlink_src_node(struct pf_src_node *src) -{ - struct pf_srchash *sh; - - sh = &V_pf_srchash[pf_hashsrc(&src->addr, src->af)]; - PF_HASHROW_LOCK(sh); - pf_unlink_src_node_locked(src); - PF_HASHROW_UNLOCK(sh); -} - -static void -pf_free_src_node(struct pf_src_node *sn) -{ - - KASSERT(sn->states == 0, ("%s: %p has refs", __func__, sn)); - uma_zfree(V_pf_sources_z, sn); } u_int @@ -755,10 +735,12 @@ pf_free_src_nodes(struct pf_src_node_lis u_int count = 0; LIST_FOREACH_SAFE(sn, head, entry, tmp) { - pf_free_src_node(sn); + uma_zfree(V_pf_sources_z, sn); count++; } + counter_u64_add(V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS], count); + return (count); } @@ -1550,7 +1532,7 @@ pf_purge_expired_src_nodes() PF_HASHROW_LOCK(sh); LIST_FOREACH_SAFE(cur, &sh->nodes, entry, next) if (cur->states == 0 && cur->expire <= time_uptime) { - pf_unlink_src_node_locked(cur); + pf_unlink_src_node(cur); LIST_INSERT_HEAD(&freelist, cur, entry); } else if (cur->rule.ptr != NULL) cur->rule.ptr->rule_flag |= PFRULE_REFS; @@ -1565,27 +1547,31 @@ pf_purge_expired_src_nodes() static void pf_src_tree_remove_state(struct pf_state *s) { - u_int32_t timeout; + struct pf_src_node *sn; + struct pf_srchash *sh; + uint32_t timeout; + + timeout = s->rule.ptr->timeout[PFTM_SRC_NODE] ? + s->rule.ptr->timeout[PFTM_SRC_NODE] : + V_pf_default_rule.timeout[PFTM_SRC_NODE]; if (s->src_node != NULL) { + sn = s->src_node; + sh = &V_pf_srchash[pf_hashsrc(&sn->addr, sn->af)]; + PF_HASHROW_LOCK(sh); if (s->src.tcp_est) - --s->src_node->conn; - if (--s->src_node->states == 0) { - timeout = s->rule.ptr->timeout[PFTM_SRC_NODE]; - if (!timeout) - timeout = - V_pf_default_rule.timeout[PFTM_SRC_NODE]; - s->src_node->expire = time_uptime + timeout; - } + --sn->conn; + if (--sn->states == 0) + sn->expire = time_uptime + timeout; + PF_HASHROW_UNLOCK(sh); } if (s->nat_src_node != s->src_node && s->nat_src_node != NULL) { - if (--s->nat_src_node->states == 0) { - timeout = s->rule.ptr->timeout[PFTM_SRC_NODE]; - if (!timeout) - timeout = - V_pf_default_rule.timeout[PFTM_SRC_NODE]; - s->nat_src_node->expire = time_uptime + timeout; - } + sn = s->nat_src_node; + sh = &V_pf_srchash[pf_hashsrc(&sn->addr, sn->af)]; + PF_HASHROW_LOCK(sh); + if (--sn->states == 0) + sn->expire = time_uptime + timeout; + PF_HASHROW_UNLOCK(sh); } s->src_node = s->nat_src_node = NULL; } @@ -3571,15 +3557,12 @@ pf_create_state(struct pf_rule *r, struc s->creation = time_uptime; s->expire = time_uptime; - if (sn != NULL) { + if (sn != NULL) s->src_node = sn; - s->src_node->states++; - } if (nsn != NULL) { /* XXX We only modify one side for now. */ PF_ACPY(&nsn->raddr, &nk->addr[1], pd->af); s->nat_src_node = nsn; - s->nat_src_node->states++; } if (pd->proto == IPPROTO_TCP) { if ((pd->flags & PFDESC_TCP_NORM) && pf_normalize_tcp_init(m, @@ -3677,14 +3660,32 @@ csfailed: if (nk != NULL) uma_zfree(V_pf_state_key_z, nk); - if (sn != NULL && sn->states == 0 && sn->expire == 0) { - pf_unlink_src_node(sn); - pf_free_src_node(sn); + if (sn != NULL) { + struct pf_srchash *sh; + + sh = &V_pf_srchash[pf_hashsrc(&sn->addr, sn->af)]; + PF_HASHROW_LOCK(sh); + if (--sn->states == 0 && sn->expire == 0) { + pf_unlink_src_node(sn); + uma_zfree(V_pf_sources_z, sn); + counter_u64_add( + V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS], 1); + } + PF_HASHROW_UNLOCK(sh); } - if (nsn != sn && nsn != NULL && nsn->states == 0 && nsn->expire == 0) { - pf_unlink_src_node(nsn); - pf_free_src_node(nsn); + if (nsn != sn && nsn != NULL) { + struct pf_srchash *sh; + + sh = &V_pf_srchash[pf_hashsrc(&nsn->addr, nsn->af)]; + PF_HASHROW_LOCK(sh); + if (--nsn->states == 1 && nsn->expire == 0) { + pf_unlink_src_node(nsn); + uma_zfree(V_pf_sources_z, nsn); + counter_u64_add( + V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS], 1); + } + PF_HASHROW_UNLOCK(sh); } return (PF_DROP); Modified: stable/10/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- stable/10/sys/netpfil/pf/pf_ioctl.c Tue Jul 28 09:09:01 2015 (r285939) +++ stable/10/sys/netpfil/pf/pf_ioctl.c Tue Jul 28 09:13:55 2015 (r285940) @@ -3430,7 +3430,7 @@ pf_kill_srcnodes(struct pfioc_src_node_k &psnk->psnk_dst.addr.v.a.addr, &psnk->psnk_dst.addr.v.a.mask, &sn->raddr, sn->af)) { - pf_unlink_src_node_locked(sn); + pf_unlink_src_node(sn); LIST_INSERT_HEAD(&kill, sn, entry); sn->expire = 1; } @@ -3443,18 +3443,10 @@ pf_kill_srcnodes(struct pfioc_src_node_k PF_HASHROW_LOCK(ih); LIST_FOREACH(s, &ih->states, entry) { - if (s->src_node && s->src_node->expire == 1) { -#ifdef INVARIANTS - s->src_node->states--; -#endif + if (s->src_node && s->src_node->expire == 1) s->src_node = NULL; - } - if (s->nat_src_node && s->nat_src_node->expire == 1) { -#ifdef INVARIANTS - s->nat_src_node->states--; -#endif + if (s->nat_src_node && s->nat_src_node->expire == 1) s->nat_src_node = NULL; - } } PF_HASHROW_UNLOCK(ih); } From owner-svn-src-all@freebsd.org Tue Jul 28 09:16:55 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5DB8C9AC683; Tue, 28 Jul 2015 09:16:55 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2F645FF5; Tue, 28 Jul 2015 09:16:55 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S9GtIT015675; Tue, 28 Jul 2015 09:16:55 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S9GtEZ015674; Tue, 28 Jul 2015 09:16:55 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201507280916.t6S9GtEZ015674@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 28 Jul 2015 09:16:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285941 - stable/10/sys/netpfil/pf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 09:16:55 -0000 Author: glebius Date: Tue Jul 28 09:16:54 2015 New Revision: 285941 URL: https://svnweb.freebsd.org/changeset/base/285941 Log: Merge r283061, r283063: don't dereference NULL is pf_get_mtag() fails. PR: 200222 Modified: stable/10/sys/netpfil/pf/pf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netpfil/pf/pf.c ============================================================================== --- stable/10/sys/netpfil/pf/pf.c Tue Jul 28 09:13:55 2015 (r285940) +++ stable/10/sys/netpfil/pf/pf.c Tue Jul 28 09:16:54 2015 (r285941) @@ -5912,13 +5912,14 @@ done: ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) { action = PF_DROP; REASON_SET(&reason, PFRES_MEMORY); + } else { + if (pqid || (pd.tos & IPTOS_LOWDELAY)) + pd.pf_mtag->qid = r->pqid; + else + pd.pf_mtag->qid = r->qid; + /* Add hints for ecn. */ + pd.pf_mtag->hdr = h; } - if (pqid || (pd.tos & IPTOS_LOWDELAY)) - pd.pf_mtag->qid = r->pqid; - else - pd.pf_mtag->qid = r->qid; - /* add hints for ecn */ - pd.pf_mtag->hdr = h; } #endif /* ALTQ */ @@ -5957,9 +5958,11 @@ done: log = 1; DPFPRINTF(PF_DEBUG_MISC, ("pf: failed to allocate tag\n")); + } else { + pd.pf_mtag->flags |= + PF_FASTFWD_OURS_PRESENT; + m->m_flags &= ~M_FASTFWD_OURS; } - pd.pf_mtag->flags |= PF_FASTFWD_OURS_PRESENT; - m->m_flags &= ~M_FASTFWD_OURS; } ip_divert_ptr(*m0, dir == PF_IN ? DIR_IN : DIR_OUT); *m0 = NULL; @@ -6341,13 +6344,14 @@ done: ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) { action = PF_DROP; REASON_SET(&reason, PFRES_MEMORY); + } else { + if (pd.tos & IPTOS_LOWDELAY) + pd.pf_mtag->qid = r->pqid; + else + pd.pf_mtag->qid = r->qid; + /* Add hints for ecn. */ + pd.pf_mtag->hdr = h; } - if (pd.tos & IPTOS_LOWDELAY) - pd.pf_mtag->qid = r->pqid; - else - pd.pf_mtag->qid = r->qid; - /* add hints for ecn */ - pd.pf_mtag->hdr = h; } #endif /* ALTQ */ From owner-svn-src-all@freebsd.org Tue Jul 28 09:19:05 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C74979AC6E6; Tue, 28 Jul 2015 09:19:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B68901192; Tue, 28 Jul 2015 09:19:05 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S9J5HG015855; Tue, 28 Jul 2015 09:19:05 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S9J5tL015854; Tue, 28 Jul 2015 09:19:05 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507280919.t6S9J5tL015854@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 28 Jul 2015 09:19:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r285942 - in stable: 10/sys/dev/cxgb/ulp/iw_cxgb 7/sys/dev/cxgb/ulp/iw_cxgb 8/sys/dev/cxgb/ulp/iw_cxgb 9/sys/dev/cxgb/ulp/iw_cxgb X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 09:19:05 -0000 Author: dim Date: Tue Jul 28 09:19:04 2015 New Revision: 285942 URL: https://svnweb.freebsd.org/changeset/base/285942 Log: MFC r285340: Fix swapped copyin(9) arguments in cxgb's iwch_arm_cq() function. Detected by clang 3.7.0 with the warning: sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c:309:18: error: variable 'rptr' is uninitialized when used here [-Werror,-Wuninitialized] chp->cq.rptr = rptr; ^~~~ Modified: stable/9/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c stable/7/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c stable/8/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Directory Properties: stable/10/ (props changed) stable/7/ (props changed) stable/7/sys/ (props changed) stable/8/ (props changed) stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/cxgb/ (props changed) Modified: stable/9/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c ============================================================================== --- stable/9/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Tue Jul 28 09:16:54 2015 (r285941) +++ stable/9/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Tue Jul 28 09:19:04 2015 (r285942) @@ -302,7 +302,7 @@ iwch_arm_cq(struct ib_cq *ibcq, enum ib_ else cq_op = CQ_ARM_AN; if (chp->user_rptr_addr) { - if (copyin(&rptr, chp->user_rptr_addr, 4)) + if (copyin(chp->user_rptr_addr, &rptr, sizeof(rptr))) return (-EFAULT); mtx_lock(&chp->lock); chp->cq.rptr = rptr; From owner-svn-src-all@freebsd.org Tue Jul 28 09:19:06 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93E719AC6EC; Tue, 28 Jul 2015 09:19:06 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8307F1193; Tue, 28 Jul 2015 09:19:06 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S9J6Ls015861; Tue, 28 Jul 2015 09:19:06 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S9J6II015860; Tue, 28 Jul 2015 09:19:06 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507280919.t6S9J6II015860@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 28 Jul 2015 09:19:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r285942 - in stable: 10/sys/dev/cxgb/ulp/iw_cxgb 7/sys/dev/cxgb/ulp/iw_cxgb 8/sys/dev/cxgb/ulp/iw_cxgb 9/sys/dev/cxgb/ulp/iw_cxgb X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 09:19:06 -0000 Author: dim Date: Tue Jul 28 09:19:04 2015 New Revision: 285942 URL: https://svnweb.freebsd.org/changeset/base/285942 Log: MFC r285340: Fix swapped copyin(9) arguments in cxgb's iwch_arm_cq() function. Detected by clang 3.7.0 with the warning: sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c:309:18: error: variable 'rptr' is uninitialized when used here [-Werror,-Wuninitialized] chp->cq.rptr = rptr; ^~~~ Modified: stable/8/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Directory Properties: stable/8/ (props changed) stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/cxgb/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c stable/7/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c stable/9/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Directory Properties: stable/10/ (props changed) stable/7/ (props changed) stable/7/sys/ (props changed) stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/8/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c ============================================================================== --- stable/8/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Tue Jul 28 09:16:54 2015 (r285941) +++ stable/8/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Tue Jul 28 09:19:04 2015 (r285942) @@ -340,7 +340,7 @@ iwch_arm_cq(struct ib_cq *ibcq, enum ib_ else cq_op = CQ_ARM_AN; if (chp->user_rptr_addr) { - if (copyin(&rptr, chp->user_rptr_addr, 4)) + if (copyin(chp->user_rptr_addr, &rptr, sizeof(rptr))) return (-EFAULT); mtx_lock(&chp->lock); chp->cq.rptr = rptr; From owner-svn-src-all@freebsd.org Tue Jul 28 09:19:07 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6BF2C9AC6F5; Tue, 28 Jul 2015 09:19:07 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5B3911195; Tue, 28 Jul 2015 09:19:07 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S9J7xE015870; Tue, 28 Jul 2015 09:19:07 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S9J79W015869; Tue, 28 Jul 2015 09:19:07 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507280919.t6S9J79W015869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 28 Jul 2015 09:19:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285942 - in stable: 10/sys/dev/cxgb/ulp/iw_cxgb 7/sys/dev/cxgb/ulp/iw_cxgb 8/sys/dev/cxgb/ulp/iw_cxgb 9/sys/dev/cxgb/ulp/iw_cxgb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 09:19:07 -0000 Author: dim Date: Tue Jul 28 09:19:04 2015 New Revision: 285942 URL: https://svnweb.freebsd.org/changeset/base/285942 Log: MFC r285340: Fix swapped copyin(9) arguments in cxgb's iwch_arm_cq() function. Detected by clang 3.7.0 with the warning: sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c:309:18: error: variable 'rptr' is uninitialized when used here [-Werror,-Wuninitialized] chp->cq.rptr = rptr; ^~~~ Modified: stable/10/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/7/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c stable/8/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c stable/9/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Directory Properties: stable/7/ (props changed) stable/7/sys/ (props changed) stable/8/ (props changed) stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/cxgb/ (props changed) stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/10/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c ============================================================================== --- stable/10/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Tue Jul 28 09:16:54 2015 (r285941) +++ stable/10/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Tue Jul 28 09:19:04 2015 (r285942) @@ -302,7 +302,7 @@ iwch_arm_cq(struct ib_cq *ibcq, enum ib_ else cq_op = CQ_ARM_AN; if (chp->user_rptr_addr) { - if (copyin(&rptr, chp->user_rptr_addr, 4)) + if (copyin(chp->user_rptr_addr, &rptr, sizeof(rptr))) return (-EFAULT); mtx_lock(&chp->lock); chp->cq.rptr = rptr; From owner-svn-src-all@freebsd.org Tue Jul 28 09:19:08 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DF509AC714; Tue, 28 Jul 2015 09:19:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2CAC911A1; Tue, 28 Jul 2015 09:19:08 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S9J8eH015876; Tue, 28 Jul 2015 09:19:08 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S9J8Wf015875; Tue, 28 Jul 2015 09:19:08 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507280919.t6S9J8Wf015875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 28 Jul 2015 09:19:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org Subject: svn commit: r285942 - in stable: 10/sys/dev/cxgb/ulp/iw_cxgb 7/sys/dev/cxgb/ulp/iw_cxgb 8/sys/dev/cxgb/ulp/iw_cxgb 9/sys/dev/cxgb/ulp/iw_cxgb X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 09:19:08 -0000 Author: dim Date: Tue Jul 28 09:19:04 2015 New Revision: 285942 URL: https://svnweb.freebsd.org/changeset/base/285942 Log: MFC r285340: Fix swapped copyin(9) arguments in cxgb's iwch_arm_cq() function. Detected by clang 3.7.0 with the warning: sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c:309:18: error: variable 'rptr' is uninitialized when used here [-Werror,-Wuninitialized] chp->cq.rptr = rptr; ^~~~ Modified: stable/7/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Directory Properties: stable/7/ (props changed) stable/7/sys/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c stable/8/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c stable/9/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Directory Properties: stable/10/ (props changed) stable/8/ (props changed) stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/cxgb/ (props changed) stable/9/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/7/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c ============================================================================== --- stable/7/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Tue Jul 28 09:16:54 2015 (r285941) +++ stable/7/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Tue Jul 28 09:19:04 2015 (r285942) @@ -355,7 +355,7 @@ iwch_arm_cq(struct ib_cq *ibcq, enum ib_ else cq_op = CQ_ARM_AN; if (chp->user_rptr_addr) { - if (copyin(&rptr, chp->user_rptr_addr, 4)) + if (copyin(chp->user_rptr_addr, &rptr, sizeof(rptr))) return (-EFAULT); mtx_lock(&chp->lock); chp->cq.rptr = rptr; From owner-svn-src-all@freebsd.org Tue Jul 28 09:21:20 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C3E4C9AC870; Tue, 28 Jul 2015 09:21:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B37981A9E; Tue, 28 Jul 2015 09:21:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S9LKqT017015; Tue, 28 Jul 2015 09:21:20 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S9LKSI017014; Tue, 28 Jul 2015 09:21:20 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201507280921.t6S9LKSI017014@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 28 Jul 2015 09:21:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285943 - stable/10/sys/netpfil/pf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 09:21:20 -0000 Author: glebius Date: Tue Jul 28 09:21:19 2015 New Revision: 285943 URL: https://svnweb.freebsd.org/changeset/base/285943 Log: Merge r283106: During module unload unlock rules before destroying UMA zones, which may sleep in uma_drain(). It is safe to unlock here, since we are already dehooked from pfil(9) and all pf threads had quit. Modified: stable/10/sys/netpfil/pf/pf_ioctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- stable/10/sys/netpfil/pf/pf_ioctl.c Tue Jul 28 09:19:04 2015 (r285942) +++ stable/10/sys/netpfil/pf/pf_ioctl.c Tue Jul 28 09:21:19 2015 (r285943) @@ -3750,6 +3750,7 @@ pf_unload(void) wakeup_one(pf_purge_thread); rw_sleep(pf_purge_thread, &pf_rules_lock, 0, "pftmo", 0); } + PF_RULES_WUNLOCK(); pf_normalize_cleanup(); pfi_cleanup(); pfr_cleanup(); @@ -3757,7 +3758,6 @@ pf_unload(void) pf_cleanup(); if (IS_DEFAULT_VNET(curvnet)) pf_mtag_cleanup(); - PF_RULES_WUNLOCK(); destroy_dev(pf_dev); rw_destroy(&pf_rules_lock); sx_destroy(&pf_ioctl_lock); From owner-svn-src-all@freebsd.org Tue Jul 28 09:36:27 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C6B09ACCD9; Tue, 28 Jul 2015 09:36:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 24ACD144; Tue, 28 Jul 2015 09:36:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6S9aR43024066; Tue, 28 Jul 2015 09:36:27 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6S9aQEV024065; Tue, 28 Jul 2015 09:36:27 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201507280936.t6S9aQEV024065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 28 Jul 2015 09:36:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285944 - head/sys/netpfil/pf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 09:36:27 -0000 Author: glebius Date: Tue Jul 28 09:36:26 2015 New Revision: 285944 URL: https://svnweb.freebsd.org/changeset/base/285944 Log: Fix a typo in r280169. Of course we are interested in deleting nsn only if we have just created it and we were the last reference. Submitted by: dhartmei Modified: head/sys/netpfil/pf/pf.c Modified: head/sys/netpfil/pf/pf.c ============================================================================== --- head/sys/netpfil/pf/pf.c Tue Jul 28 09:21:19 2015 (r285943) +++ head/sys/netpfil/pf/pf.c Tue Jul 28 09:36:26 2015 (r285944) @@ -3681,7 +3681,7 @@ csfailed: sh = &V_pf_srchash[pf_hashsrc(&nsn->addr, nsn->af)]; PF_HASHROW_LOCK(sh); - if (--nsn->states == 1 && nsn->expire == 0) { + if (--nsn->states == 0 && nsn->expire == 0) { pf_unlink_src_node(nsn); uma_zfree(V_pf_sources_z, nsn); counter_u64_add( From owner-svn-src-all@freebsd.org Tue Jul 28 10:31:35 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5504C9AD7BB; Tue, 28 Jul 2015 10:31:35 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 45E5F1E30; Tue, 28 Jul 2015 10:31:35 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SAVZsr046388; Tue, 28 Jul 2015 10:31:35 GMT (envelope-from garga@FreeBSD.org) Received: (from garga@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SAVZnu046387; Tue, 28 Jul 2015 10:31:35 GMT (envelope-from garga@FreeBSD.org) Message-Id: <201507281031.t6SAVZnu046387@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: garga set sender to garga@FreeBSD.org using -f From: Renato Botelho Date: Tue, 28 Jul 2015 10:31:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285945 - head/sys/netpfil/pf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 10:31:35 -0000 Author: garga (ports committer) Date: Tue Jul 28 10:31:34 2015 New Revision: 285945 URL: https://svnweb.freebsd.org/changeset/base/285945 Log: Respect pf rule log option before log dropped packets with IP options or dangerous v6 headers Reviewed by: gnn, eri Approved by: gnn Obtained from: pfSense MFC after: 3 days Sponsored by: Netgate Differential Revision: https://reviews.freebsd.org/D3222 Modified: head/sys/netpfil/pf/pf.c Modified: head/sys/netpfil/pf/pf.c ============================================================================== --- head/sys/netpfil/pf/pf.c Tue Jul 28 09:36:26 2015 (r285944) +++ head/sys/netpfil/pf/pf.c Tue Jul 28 10:31:34 2015 (r285945) @@ -5895,7 +5895,8 @@ done: !((s && s->state_flags & PFSTATE_ALLOWOPTS) || r->allow_opts)) { action = PF_DROP; REASON_SET(&reason, PFRES_IPOPTIONS); - log = 1; + if (r->log) + log = 1; DPFPRINTF(PF_DEBUG_MISC, ("pf: dropping packet with ip options\n")); } @@ -6329,7 +6330,8 @@ done: !((s && s->state_flags & PFSTATE_ALLOWOPTS) || r->allow_opts)) { action = PF_DROP; REASON_SET(&reason, PFRES_IPOPTIONS); - log = 1; + if (r->log) + log = 1; DPFPRINTF(PF_DEBUG_MISC, ("pf: dropping packet with dangerous v6 headers\n")); } From owner-svn-src-all@freebsd.org Tue Jul 28 11:19:40 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C1F29AD496; Tue, 28 Jul 2015 11:19:40 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 32BBF1A49; Tue, 28 Jul 2015 11:19:40 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SBJegg065098; Tue, 28 Jul 2015 11:19:40 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SBJdKn065095; Tue, 28 Jul 2015 11:19:39 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201507281119.t6SBJdKn065095@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Tue, 28 Jul 2015 11:19:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285946 - in head: . sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 11:19:40 -0000 Author: smh Date: Tue Jul 28 11:19:38 2015 New Revision: 285946 URL: https://svnweb.freebsd.org/changeset/base/285946 Log: Add warning about low KSTACK_PAGES for ZFS use As ZFS requires a more kernel stack pages than is the default on some architectures e.g. i386, warn if KSTACK_PAGES is less than ZFS_MIN_KSTACK_PAGES (which is 4 at the time of writing). MFC after: 3 days Sponsored by: Multiplay Modified: head/UPDATING head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Modified: head/UPDATING ============================================================================== --- head/UPDATING Tue Jul 28 10:31:34 2015 (r285945) +++ head/UPDATING Tue Jul 28 11:19:38 2015 (r285946) @@ -31,6 +31,14 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20150728: + As ZFS requires a more kernel stack pages than is the default on some + architectures e.g. i386, it now warns if KSTACK_PAGES is less than + ZFS_MIN_KSTACK_PAGES (which is 4 at the time of writing). + + Please consider using 'options KSTACK_PAGES=X' where X is greater + than or equal to ZFS_MIN_KSTACK_PAGES i.e. 4 in such configurations. + 20150706: sendmail has been updated to 8.15.2. Starting with FreeBSD 11.0 and sendmail 8.15, sendmail uses uncompressed IPv6 addresses by Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Jul 28 10:31:34 2015 (r285945) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Jul 28 11:19:38 2015 (r285946) @@ -6491,10 +6491,18 @@ static void zfs_shutdown(void *, int); static eventhandler_tag zfs_shutdown_event_tag; +#define ZFS_MIN_KSTACK_PAGES 4 + int zfs__init(void) { +#if KSTACK_PAGES < ZFS_MIN_KSTACK_PAGES + printf("ZFS NOTICE: KSTACK_PAGES is %d which could result in stack " + "overflow panic!\nPlease consider adding " + "'options KSTACK_PAGES=%d' to your kernel config\n", KSTACK_PAGES, + ZFS_MIN_KSTACK_PAGES); +#endif zfs_root_token = root_mount_hold("ZFS"); mutex_init(&zfs_share_lock, NULL, MUTEX_DEFAULT, NULL); From owner-svn-src-all@freebsd.org Tue Jul 28 11:20:54 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 243949AD4EC; Tue, 28 Jul 2015 11:20:54 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebius.int.ru", Issuer "cell.glebius.int.ru" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id A0A3A1CF8; Tue, 28 Jul 2015 11:20:53 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.9/8.14.9) with ESMTP id t6SBKpQo084837 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 28 Jul 2015 14:20:51 +0300 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.9/8.14.9/Submit) id t6SBKpnf084836; Tue, 28 Jul 2015 14:20:51 +0300 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 28 Jul 2015 14:20:51 +0300 From: Gleb Smirnoff To: Renato Botelho Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r285945 - head/sys/netpfil/pf Message-ID: <20150728112051.GT72729@FreeBSD.org> References: <201507281031.t6SAVZnu046387@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201507281031.t6SAVZnu046387@repo.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 11:20:54 -0000 Renato, On Tue, Jul 28, 2015 at 10:31:35AM +0000, Renato Botelho wrote: R> Author: garga (ports committer) R> Date: Tue Jul 28 10:31:34 2015 R> New Revision: 285945 R> URL: https://svnweb.freebsd.org/changeset/base/285945 R> R> Log: R> Respect pf rule log option before log dropped packets with IP options or R> dangerous v6 headers R> R> Reviewed by: gnn, eri R> Approved by: gnn R> Obtained from: pfSense R> MFC after: 3 days R> Sponsored by: Netgate R> Differential Revision: https://reviews.freebsd.org/D3222 R> R> Modified: R> head/sys/netpfil/pf/pf.c R> R> Modified: head/sys/netpfil/pf/pf.c R> ============================================================================== R> --- head/sys/netpfil/pf/pf.c Tue Jul 28 09:36:26 2015 (r285944) R> +++ head/sys/netpfil/pf/pf.c Tue Jul 28 10:31:34 2015 (r285945) R> @@ -5895,7 +5895,8 @@ done: R> !((s && s->state_flags & PFSTATE_ALLOWOPTS) || r->allow_opts)) { R> action = PF_DROP; R> REASON_SET(&reason, PFRES_IPOPTIONS); R> - log = 1; R> + if (r->log) R> + log = 1; R> DPFPRINTF(PF_DEBUG_MISC, R> ("pf: dropping packet with ip options\n")); R> } R> @@ -6329,7 +6330,8 @@ done: R> !((s && s->state_flags & PFSTATE_ALLOWOPTS) || r->allow_opts)) { R> action = PF_DROP; R> REASON_SET(&reason, PFRES_IPOPTIONS); R> - log = 1; R> + if (r->log) R> + log = 1; R> DPFPRINTF(PF_DEBUG_MISC, R> ("pf: dropping packet with dangerous v6 headers\n")); R> } Why not simply: log = r->log; ? That would also match the style of the function, since it already has: log = s->log; -- Totus tuus, Glebius. From owner-svn-src-all@freebsd.org Tue Jul 28 11:21:34 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8CD699AD5F9; Tue, 28 Jul 2015 11:21:34 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 79A021F85; Tue, 28 Jul 2015 11:21:34 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SBLY7H068282; Tue, 28 Jul 2015 11:21:34 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SBLYvg068281; Tue, 28 Jul 2015 11:21:34 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201507281121.t6SBLYvg068281@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Tue, 28 Jul 2015 11:21:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285947 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 11:21:34 -0000 Author: smh Date: Tue Jul 28 11:21:33 2015 New Revision: 285947 URL: https://svnweb.freebsd.org/changeset/base/285947 Log: Correct typo in UPDATING message MFC after: 3 days Sponsored by: Multiplay Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Tue Jul 28 11:19:38 2015 (r285946) +++ head/UPDATING Tue Jul 28 11:21:33 2015 (r285947) @@ -32,7 +32,7 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11 "ln -s 'abort:false,junk:false' /etc/malloc.conf".) 20150728: - As ZFS requires a more kernel stack pages than is the default on some + As ZFS requires more kernel stack pages than is the default on some architectures e.g. i386, it now warns if KSTACK_PAGES is less than ZFS_MIN_KSTACK_PAGES (which is 4 at the time of writing). From owner-svn-src-all@freebsd.org Tue Jul 28 12:20:58 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E94829AB9A6; Tue, 28 Jul 2015 12:20:58 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D954D7EC; Tue, 28 Jul 2015 12:20:58 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SCKwFK090327; Tue, 28 Jul 2015 12:20:58 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SCKwwv090325; Tue, 28 Jul 2015 12:20:58 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201507281220.t6SCKwwv090325@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 28 Jul 2015 12:20:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285948 - in head/usr.sbin/pw: . tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 12:20:59 -0000 Author: bapt Date: Tue Jul 28 12:20:57 2015 New Revision: 285948 URL: https://svnweb.freebsd.org/changeset/base/285948 Log: when -n is passed to any pw subcommand it is always expected to be considered as a name so do not try to convert it to an id if it is a numeric value PR: 31933 Reported by: ted@impulse.net Sponsored by: gandi.net Modified: head/usr.sbin/pw/pw.c head/usr.sbin/pw/tests/pw_userdel.sh Modified: head/usr.sbin/pw/pw.c ============================================================================== --- head/usr.sbin/pw/pw.c Tue Jul 28 11:21:33 2015 (r285947) +++ head/usr.sbin/pw/pw.c Tue Jul 28 12:20:57 2015 (r285948) @@ -287,14 +287,7 @@ main(int argc, char *argv[]) errstr); break; case 'n': - if (strspn(optarg, "0123456789") != strlen(optarg)) { - name = optarg; - break; - } - id = strtonum(optarg, 0, LONG_MAX, &errstr); - if (errstr != NULL) - errx(EX_USAGE, "Bad id '%s': %s", optarg, - errstr); + name = optarg; break; case 'H': if (conf.fd != -1) Modified: head/usr.sbin/pw/tests/pw_userdel.sh ============================================================================== --- head/usr.sbin/pw/tests/pw_userdel.sh Tue Jul 28 11:21:33 2015 (r285947) +++ head/usr.sbin/pw/tests/pw_userdel.sh Tue Jul 28 12:20:57 2015 (r285948) @@ -50,8 +50,18 @@ delete_files_body() { fi } +atf_test_case delete_numeric_name +delete_numeric_name_body() { + populate_etc_skel + + atf_check ${PW} useradd -n foo -u 4001 + atf_check -e inline:"pw: no such user \`4001'\n" -s exit:67 \ + ${PW} userdel -n 4001 +} + atf_init_test_cases() { atf_add_test_case rmuser_seperate_group atf_add_test_case user_do_not_try_to_delete_root_if_user_unknown atf_add_test_case delete_files + atf_add_test_case delete_numeric_name } From owner-svn-src-all@freebsd.org Tue Jul 28 12:40:10 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5027F9ABEDF; Tue, 28 Jul 2015 12:40:10 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 406C6EE8; Tue, 28 Jul 2015 12:40:10 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SCeAhp097786; Tue, 28 Jul 2015 12:40:10 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SCeAHQ097785; Tue, 28 Jul 2015 12:40:10 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201507281240.t6SCeAHQ097785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 28 Jul 2015 12:40:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r285949 - stable/9/usr.sbin/mfiutil X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 12:40:10 -0000 Author: emaste Date: Tue Jul 28 12:40:09 2015 New Revision: 285949 URL: https://svnweb.freebsd.org/changeset/base/285949 Log: MFC r285067: mfiutil: increase buffer size to accommodate sprintf string PR: 201289 Modified: stable/9/usr.sbin/mfiutil/mfi_foreign.c Directory Properties: stable/9/usr.sbin/mfiutil/ (props changed) Modified: stable/9/usr.sbin/mfiutil/mfi_foreign.c ============================================================================== --- stable/9/usr.sbin/mfiutil/mfi_foreign.c Tue Jul 28 12:20:57 2015 (r285948) +++ stable/9/usr.sbin/mfiutil/mfi_foreign.c Tue Jul 28 12:40:09 2015 (r285949) @@ -110,7 +110,7 @@ static int foreign_show_cfg(int fd, uint32_t opcode, uint8_t cfgidx, int diagnostic) { struct mfi_config_data *config; - char prefix[26]; + char prefix[64]; int error; uint8_t mbox[4]; From owner-svn-src-all@freebsd.org Tue Jul 28 12:40:42 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 992E29ABF71; Tue, 28 Jul 2015 12:40:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 86761111C; Tue, 28 Jul 2015 12:40:42 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SCegmm098521; Tue, 28 Jul 2015 12:40:42 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SCegFp098520; Tue, 28 Jul 2015 12:40:42 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201507281240.t6SCegFp098520@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 28 Jul 2015 12:40:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285950 - stable/10/usr.sbin/mfiutil X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 12:40:42 -0000 Author: emaste Date: Tue Jul 28 12:40:41 2015 New Revision: 285950 URL: https://svnweb.freebsd.org/changeset/base/285950 Log: MFC r201289: mfiutil: increase buffer size to accommodate sprintf string PR: 201289 Modified: stable/10/usr.sbin/mfiutil/mfi_foreign.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/mfiutil/mfi_foreign.c ============================================================================== --- stable/10/usr.sbin/mfiutil/mfi_foreign.c Tue Jul 28 12:40:09 2015 (r285949) +++ stable/10/usr.sbin/mfiutil/mfi_foreign.c Tue Jul 28 12:40:41 2015 (r285950) @@ -110,7 +110,7 @@ static int foreign_show_cfg(int fd, uint32_t opcode, uint8_t cfgidx, int diagnostic) { struct mfi_config_data *config; - char prefix[26]; + char prefix[64]; int error; uint8_t mbox[4]; From owner-svn-src-all@freebsd.org Tue Jul 28 12:42:29 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F16F9AC13C; Tue, 28 Jul 2015 12:42:29 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebius.int.ru", Issuer "cell.glebius.int.ru" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 2CF2D1625; Tue, 28 Jul 2015 12:42:28 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.9/8.14.9) with ESMTP id t6SCgK9k085318 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 28 Jul 2015 15:42:20 +0300 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.9/8.14.9/Submit) id t6SCgKE3085317; Tue, 28 Jul 2015 15:42:20 +0300 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 28 Jul 2015 15:42:20 +0300 From: Gleb Smirnoff To: Ermal =?iso-8859-1?Q?Lu=E7i?= Cc: Olivier =?iso-8859-1?Q?Cochard-Labb=E9?= , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r285051 - head/sys/netinet Message-ID: <20150728124220.GW72729@FreeBSD.org> References: <201507021810.t62IAgCc003272@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="apg+fY3UKMMABzWO" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <201507021810.t62IAgCc003272@repo.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 12:42:29 -0000 --apg+fY3UKMMABzWO Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit Ermal, see comments inlined, On Thu, Jul 02, 2015 at 06:10:42PM +0000, Ermal Luçi wrote: E> Author: eri E> Date: Thu Jul 2 18:10:41 2015 E> New Revision: 285051 E> URL: https://svnweb.freebsd.org/changeset/base/285051 E> E> Log: E> Avoid doing multiple route lookups for the same destination IP during forwarding E> E> ip_forward() does a route lookup for testing this packet can be sent to a known destination, E> it also can do another route lookup if it detects that an ICMP redirect is needed, E> it forgets all of this and handovers to ip_output() to do the same lookup yet again. E> E> This optimisation just does one route lookup during the forwarding path and handovers that to be considered by ip_output(). E> E> Differential Revision: https://reviews.freebsd.org/D2964 E> Approved by: ae, gnn(mentor) E> MFC after: 1 week E> E> Modified: E> head/sys/netinet/ip_input.c E> E> Modified: head/sys/netinet/ip_input.c E> ============================================================================== E> --- head/sys/netinet/ip_input.c Thu Jul 2 17:30:59 2015 (r285050) E> +++ head/sys/netinet/ip_input.c Thu Jul 2 18:10:41 2015 (r285051) E> @@ -897,6 +897,7 @@ ip_forward(struct mbuf *m, int srcrt) E> struct ip *ip = mtod(m, struct ip *); E> struct in_ifaddr *ia; E> struct mbuf *mcopy; E> + struct sockaddr_in *sin; E> struct in_addr dest; E> struct route ro; E> int error, type = 0, code = 0, mtu = 0; E> @@ -925,7 +926,22 @@ ip_forward(struct mbuf *m, int srcrt) E> } E> #endif E> E> - ia = ip_rtaddr(ip->ip_dst, M_GETFIB(m)); E> + bzero(&ro, sizeof(ro)); E> + sin = (struct sockaddr_in *)&ro.ro_dst; E> + sin->sin_family = AF_INET; E> + sin->sin_len = sizeof(*sin); E> + sin->sin_addr = ip->ip_dst; E> +#ifdef RADIX_MPATH E> + rtalloc_mpath_fib(&ro, E> + ntohl(ip->ip_src.s_addr ^ ip->ip_dst.s_addr), E> + M_GETFIB(m)); E> +#else E> + in_rtalloc_ign(&ro, 0, M_GETFIB(m)); E> +#endif E> + if (ro.ro_rt != NULL) { E> + ia = ifatoia(ro.ro_rt->rt_ifa); E> + ifa_ref(&ia->ia_ifa); E> + } E> #ifndef IPSEC E> /* E> * 'ia' may be NULL if there is no route for this destination. E> @@ -934,6 +950,7 @@ ip_forward(struct mbuf *m, int srcrt) E> */ E> if (!srcrt && ia == NULL) { E> icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, 0, 0); E> + RO_RTFREE(&ro); E> return; E> } Here the ifa reference is leaked upon return. But don't hurry with fixing that :) Actually you don't need to ifa_ref() in this function. You acquired a reference on rtentry in in_rtalloc_ign() and hold it until RO_RTFREE(). And the rtentry itself always holds a reference on the ifa. So, there is no reason to put extra reference on the ifa. The ip_output() was already improved in r262747. And ip_forward() can also be. The only place that touches ia after RO_RTFREE() is EMSGSIZE handling, this can be moved up before RO_RTFREE(). Here is suggested patch. Ermal and Oliver, can you please test/benchmark it? -- Totus tuus, Glebius. --apg+fY3UKMMABzWO Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="ip_forward.diff" Index: ip_input.c =================================================================== --- ip_input.c (revision 285945) +++ ip_input.c (working copy) @@ -938,10 +938,9 @@ ip_forward(struct mbuf *m, int srcrt) #else in_rtalloc_ign(&ro, 0, M_GETFIB(m)); #endif - if (ro.ro_rt != NULL) { + if (ro.ro_rt != NULL) ia = ifatoia(ro.ro_rt->rt_ifa); - ifa_ref(&ia->ia_ifa); - } else + else ia = NULL; #ifndef IPSEC /* @@ -1031,9 +1030,33 @@ ip_forward(struct mbuf *m, int srcrt) } error = ip_output(m, NULL, &ro, IP_FORWARDING, NULL, NULL); - - if (error == EMSGSIZE && ro.ro_rt) - mtu = ro.ro_rt->rt_mtu; + if (error == EMSGSIZE) { + if (ro.ro_rt != NULL) + mtu = ro.ro_rt->rt_mtu; +#ifdef IPSEC + /* + * If IPsec is configured for this path, + * override any possibly mtu value set by ip_output. + */ + mtu = ip_ipsec_mtu(mcopy, mtu); +#endif /* IPSEC */ + /* + * If the MTU was set before make sure we are below the + * interface MTU. + * If the MTU wasn't set before use the interface mtu or + * fall back to the next smaller mtu step compared to the + * current packet size. + */ + if (mtu != 0) { + if (ia != NULL) + mtu = min(mtu, ia->ia_ifp->if_mtu); + } else { + if (ia != NULL) + mtu = ia->ia_ifp->if_mtu; + else + mtu = ip_next_mtu(ntohs(ip->ip_len), 0); + } + } RO_RTFREE(&ro); if (error) @@ -1045,16 +1068,11 @@ ip_forward(struct mbuf *m, int srcrt) else { if (mcopy) m_freem(mcopy); - if (ia != NULL) - ifa_free(&ia->ia_ifa); return; } } - if (mcopy == NULL) { - if (ia != NULL) - ifa_free(&ia->ia_ifa); + if (mcopy == NULL) return; - } switch (error) { @@ -1074,30 +1092,6 @@ ip_forward(struct mbuf *m, int srcrt) case EMSGSIZE: type = ICMP_UNREACH; code = ICMP_UNREACH_NEEDFRAG; - -#ifdef IPSEC - /* - * If IPsec is configured for this path, - * override any possibly mtu value set by ip_output. - */ - mtu = ip_ipsec_mtu(mcopy, mtu); -#endif /* IPSEC */ - /* - * If the MTU was set before make sure we are below the - * interface MTU. - * If the MTU wasn't set before use the interface mtu or - * fall back to the next smaller mtu step compared to the - * current packet size. - */ - if (mtu != 0) { - if (ia != NULL) - mtu = min(mtu, ia->ia_ifp->if_mtu); - } else { - if (ia != NULL) - mtu = ia->ia_ifp->if_mtu; - else - mtu = ip_next_mtu(ntohs(ip->ip_len), 0); - } IPSTAT_INC(ips_cantfrag); break; @@ -1104,12 +1098,8 @@ ip_forward(struct mbuf *m, int srcrt) case ENOBUFS: case EACCES: /* ipfw denied packet */ m_freem(mcopy); - if (ia != NULL) - ifa_free(&ia->ia_ifa); return; } - if (ia != NULL) - ifa_free(&ia->ia_ifa); icmp_error(mcopy, type, code, dest.s_addr, mtu); } --apg+fY3UKMMABzWO-- From owner-svn-src-all@freebsd.org Tue Jul 28 12:45:09 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 453839AC1D4; Tue, 28 Jul 2015 12:45:09 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B9F318F9; Tue, 28 Jul 2015 12:45:09 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SCj8bJ001804; Tue, 28 Jul 2015 12:45:08 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SCj8Vt001803; Tue, 28 Jul 2015 12:45:08 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201507281245.t6SCj8Vt001803@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 28 Jul 2015 12:45:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285951 - stable/10/sys/boot/efi/libefi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 12:45:09 -0000 Author: emaste Date: Tue Jul 28 12:45:08 2015 New Revision: 285951 URL: https://svnweb.freebsd.org/changeset/base/285951 Log: MFC r285246: Avoid creating invalid UEFI device path The UEFI loader on the 10.1 release install disk (disc1) modifies an existing EFI_DEVICE_PATH_PROTOCOL instance in an apparent attempt to truncate the device path. In doing so it creates an invalid device path. Perform the equivalent action without modification of structures allocated by firmware. PR: 197641 Submitted by: Chris Ruffin Modified: stable/10/sys/boot/efi/libefi/efipart.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/efi/libefi/efipart.c ============================================================================== --- stable/10/sys/boot/efi/libefi/efipart.c Tue Jul 28 12:40:41 2015 (r285950) +++ stable/10/sys/boot/efi/libefi/efipart.c Tue Jul 28 12:45:08 2015 (r285951) @@ -63,13 +63,14 @@ static int efipart_init(void) { EFI_BLOCK_IO *blkio; - EFI_DEVICE_PATH *devpath, *node; + EFI_DEVICE_PATH *devpath, *devpathcpy, *tmpdevpath, *node; EFI_HANDLE *hin, *hout, *aliases, handle; EFI_STATUS status; UINTN sz; CHAR16 *path; u_int n, nin, nout; int err; + size_t devpathlen; sz = 0; hin = NULL; @@ -98,9 +99,15 @@ efipart_init(void) if (EFI_ERROR(status)) { continue; } + node = devpath; - while (!IsDevicePathEnd(NextDevicePathNode(node))) + devpathlen = DevicePathNodeLength(node); + while (!IsDevicePathEnd(NextDevicePathNode(node))) { node = NextDevicePathNode(node); + devpathlen += DevicePathNodeLength(node); + } + devpathlen += DevicePathNodeLength(NextDevicePathNode(node)); + status = BS->HandleProtocol(hin[n], &blkio_guid, (void**)&blkio); if (EFI_ERROR(status)) @@ -117,10 +124,16 @@ efipart_init(void) */ if (DevicePathType(node) == MEDIA_DEVICE_PATH && DevicePathSubType(node) == MEDIA_CDROM_DP) { - node->Type = END_DEVICE_PATH_TYPE; - node->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; - status = BS->LocateDevicePath(&blkio_guid, &devpath, + devpathcpy = malloc(devpathlen); + memcpy(devpathcpy, devpath, devpathlen); + node = devpathcpy; + while (!IsDevicePathEnd(NextDevicePathNode(node))) + node = NextDevicePathNode(node); + SetDevicePathEndNode(node); + tmpdevpath = devpathcpy; + status = BS->LocateDevicePath(&blkio_guid, &tmpdevpath, &handle); + free(devpathcpy); if (EFI_ERROR(status)) continue; hout[nout] = handle; From owner-svn-src-all@freebsd.org Tue Jul 28 12:46:38 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 490499AC284; Tue, 28 Jul 2015 12:46:38 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3933B1AD3; Tue, 28 Jul 2015 12:46:38 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SCkcpv001927; Tue, 28 Jul 2015 12:46:38 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SCkcZF001926; Tue, 28 Jul 2015 12:46:38 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201507281246.t6SCkcZF001926@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 28 Jul 2015 12:46:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285952 - stable/10/usr.bin/clang/lldb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 12:46:38 -0000 Author: emaste Date: Tue Jul 28 12:46:37 2015 New Revision: 285952 URL: https://svnweb.freebsd.org/changeset/base/285952 Log: MFC r285248: lldb: use .PATH to find man page instead of symlinking it Modified: stable/10/usr.bin/clang/lldb/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/clang/lldb/Makefile ============================================================================== --- stable/10/usr.bin/clang/lldb/Makefile Tue Jul 28 12:45:08 2015 (r285951) +++ stable/10/usr.bin/clang/lldb/Makefile Tue Jul 28 12:46:37 2015 (r285952) @@ -13,8 +13,8 @@ SRCDIR= tools/lldb/tools/driver SRCS= Driver.cpp \ Platform.cpp -lldb.1: - ln -fs ${LLDB_SRCS}/docs/lldb.1 ${.TARGET} +# Man page directory +.PATH: ${LLDB_SRCS}/docs DPADD= ${LIBEDIT} ${LIBNCURSESW} ${LIBEXECINFO} ${LIBPANEL} LDADD= -ledit -lncursesw -lexecinfo -lpanel From owner-svn-src-all@freebsd.org Tue Jul 28 12:52:23 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B29649AC4E3; Tue, 28 Jul 2015 12:52:23 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A0E991F0; Tue, 28 Jul 2015 12:52:23 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SCqNod005940; Tue, 28 Jul 2015 12:52:23 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SCqNLZ005939; Tue, 28 Jul 2015 12:52:23 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201507281252.t6SCqNLZ005939@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 28 Jul 2015 12:52:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r285953 - releng/10.2/usr.sbin/mfiutil X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 12:52:23 -0000 Author: emaste Date: Tue Jul 28 12:52:22 2015 New Revision: 285953 URL: https://svnweb.freebsd.org/changeset/base/285953 Log: MFS r285950: mfiutil: increase buffer size to accommodate sprintf string PR: 201289 Approved by: re (gjb) Modified: releng/10.2/usr.sbin/mfiutil/mfi_foreign.c Directory Properties: releng/10.2/ (props changed) Modified: releng/10.2/usr.sbin/mfiutil/mfi_foreign.c ============================================================================== --- releng/10.2/usr.sbin/mfiutil/mfi_foreign.c Tue Jul 28 12:46:37 2015 (r285952) +++ releng/10.2/usr.sbin/mfiutil/mfi_foreign.c Tue Jul 28 12:52:22 2015 (r285953) @@ -110,7 +110,7 @@ static int foreign_show_cfg(int fd, uint32_t opcode, uint8_t cfgidx, int diagnostic) { struct mfi_config_data *config; - char prefix[26]; + char prefix[64]; int error; uint8_t mbox[4]; From owner-svn-src-all@freebsd.org Tue Jul 28 12:57:20 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5AC359AC64D; Tue, 28 Jul 2015 12:57:20 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4ACC57CA; Tue, 28 Jul 2015 12:57:20 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SCvKI6006458; Tue, 28 Jul 2015 12:57:20 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SCvKRS006457; Tue, 28 Jul 2015 12:57:20 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201507281257.t6SCvKRS006457@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Tue, 28 Jul 2015 12:57:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285954 - head/sys/compat/cloudabi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 12:57:20 -0000 Author: ed Date: Tue Jul 28 12:57:19 2015 New Revision: 285954 URL: https://svnweb.freebsd.org/changeset/base/285954 Log: Implement file attribute modification system calls for CloudABI. CloudABI uses a system call interface to modify file attributes that is more similar to KPI's/FUSE, namely where a stat structure is passed back to the kernel, together with a bitmask of attributes that should be changed. This would allow us to update any set of attributes atomically. That said, I'd rather not go as far as to actually implement it that way, as it would require us to duplicate more code than strictly needed. Let's just stick to the combinations that are actually used by cloudlibc. Obtained from: https://github.com/NuxiNL/freebsd Modified: head/sys/compat/cloudabi/cloudabi_file.c Modified: head/sys/compat/cloudabi/cloudabi_file.c ============================================================================== --- head/sys/compat/cloudabi/cloudabi_file.c Tue Jul 28 12:52:22 2015 (r285953) +++ head/sys/compat/cloudabi/cloudabi_file.c Tue Jul 28 12:57:19 2015 (r285954) @@ -292,13 +292,64 @@ cloudabi_sys_file_stat_fget(struct threa return (copyout(&csb, uap->buf, sizeof(csb))); } +/* Converts timestamps to arguments to futimens() and utimensat(). */ +static void +convert_utimens_arguments(const cloudabi_filestat_t *fs, + cloudabi_fsflags_t flags, struct timespec *ts) +{ + + if ((flags & CLOUDABI_FILESTAT_ATIM_NOW) != 0) { + ts[0].tv_nsec = UTIME_NOW; + } else if ((flags & CLOUDABI_FILESTAT_ATIM) != 0) { + ts[0].tv_sec = fs->st_atim / 1000000000; + ts[0].tv_nsec = fs->st_atim % 1000000000; + } else { + ts[0].tv_nsec = UTIME_OMIT; + } + + if ((flags & CLOUDABI_FILESTAT_MTIM_NOW) != 0) { + ts[1].tv_nsec = UTIME_NOW; + } else if ((flags & CLOUDABI_FILESTAT_MTIM) != 0) { + ts[1].tv_sec = fs->st_mtim / 1000000000; + ts[1].tv_nsec = fs->st_mtim % 1000000000; + } else { + ts[1].tv_nsec = UTIME_OMIT; + } +} + int cloudabi_sys_file_stat_fput(struct thread *td, struct cloudabi_sys_file_stat_fput_args *uap) { + cloudabi_filestat_t fs; + struct timespec ts[2]; + int error; + + error = copyin(uap->buf, &fs, sizeof(fs)); + if (error != 0) + return (error); - /* Not implemented. */ - return (ENOSYS); + /* + * Only support truncation and timestamp modification separately + * for now, to prevent unnecessary code duplication. + */ + if ((uap->flags & CLOUDABI_FILESTAT_SIZE) != 0) { + /* Call into kern_ftruncate() for file truncation. */ + if ((uap->flags & ~CLOUDABI_FILESTAT_SIZE) != 0) + return (EINVAL); + return (kern_ftruncate(td, uap->fd, fs.st_size)); + } else if ((uap->flags & (CLOUDABI_FILESTAT_ATIM | + CLOUDABI_FILESTAT_ATIM_NOW | CLOUDABI_FILESTAT_MTIM | + CLOUDABI_FILESTAT_MTIM_NOW)) != 0) { + /* Call into kern_futimens() for timestamp modification. */ + if ((uap->flags & ~(CLOUDABI_FILESTAT_ATIM | + CLOUDABI_FILESTAT_ATIM_NOW | CLOUDABI_FILESTAT_MTIM | + CLOUDABI_FILESTAT_MTIM_NOW)) != 0) + return (EINVAL); + convert_utimens_arguments(&fs, uap->flags, ts); + return (kern_futimens(td, uap->fd, ts, UIO_SYSSPACE)); + } + return (EINVAL); } int @@ -347,9 +398,33 @@ int cloudabi_sys_file_stat_put(struct thread *td, struct cloudabi_sys_file_stat_put_args *uap) { + cloudabi_filestat_t fs; + struct timespec ts[2]; + char *path; + int error; + + /* + * Only support timestamp modification for now, as there is no + * truncateat(). + */ + if ((uap->flags & ~(CLOUDABI_FILESTAT_ATIM | + CLOUDABI_FILESTAT_ATIM_NOW | CLOUDABI_FILESTAT_MTIM | + CLOUDABI_FILESTAT_MTIM_NOW)) != 0) + return (EINVAL); - /* Not implemented. */ - return (ENOSYS); + error = copyin(uap->buf, &fs, sizeof(fs)); + if (error != 0) + return (error); + error = copyin_path(uap->path, uap->pathlen, &path); + if (error != 0) + return (error); + + convert_utimens_arguments(&fs, uap->flags, ts); + error = kern_utimensat(td, uap->fd, path, UIO_SYSSPACE, ts, + UIO_SYSSPACE, (uap->fd & CLOUDABI_LOOKUP_SYMLINK_FOLLOW) != 0 ? + 0 : AT_SYMLINK_NOFOLLOW); + cloudabi_freestr(path); + return (error); } int From owner-svn-src-all@freebsd.org Tue Jul 28 13:09:17 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2CEB39AC9FA; Tue, 28 Jul 2015 13:09:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D97B7E; Tue, 28 Jul 2015 13:09:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SD9Gwu010988; Tue, 28 Jul 2015 13:09:16 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SD9GEi010987; Tue, 28 Jul 2015 13:09:16 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201507281309.t6SD9GEi010987@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 28 Jul 2015 13:09:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285955 - head/contrib/llvm/tools/lldb/docs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 13:09:17 -0000 Author: emaste Date: Tue Jul 28 13:09:16 2015 New Revision: 285955 URL: https://svnweb.freebsd.org/changeset/base/285955 Log: Remove claim that the OS is Darwin from lldb(1) Reported by: bapt Modified: head/contrib/llvm/tools/lldb/docs/lldb.1 Modified: head/contrib/llvm/tools/lldb/docs/lldb.1 ============================================================================== --- head/contrib/llvm/tools/lldb/docs/lldb.1 Tue Jul 28 12:57:19 2015 (r285954) +++ head/contrib/llvm/tools/lldb/docs/lldb.1 Tue Jul 28 13:09:16 2015 (r285955) @@ -1,6 +1,6 @@ .Dd June 7, 2012 \" DATE .Dt LLDB 1 \" Program name and manual section number -.Os Darwin \" Operating System +.Os .Sh NAME \" Section Header - required - don't modify .Nm lldb .Nd The debugger From owner-svn-src-all@freebsd.org Tue Jul 28 13:11:32 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 638939ACB52; Tue, 28 Jul 2015 13:11:32 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3B8B23BF; Tue, 28 Jul 2015 13:11:32 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SDBWZO014702; Tue, 28 Jul 2015 13:11:32 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SDBWZC014701; Tue, 28 Jul 2015 13:11:32 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201507281311.t6SDBWZC014701@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 28 Jul 2015 13:11:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r285956 - releng/10.2/sys/boot/efi/libefi X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 13:11:32 -0000 Author: emaste Date: Tue Jul 28 13:11:31 2015 New Revision: 285956 URL: https://svnweb.freebsd.org/changeset/base/285956 Log: MFS r285951: Avoid creating invalid UEFI device path The UEFI loader on the 10.1 release install disk (disc1) modifies an existing EFI_DEVICE_PATH_PROTOCOL instance in an apparent attempt to truncate the device path. In doing so it creates an invalid device path. Perform the equivalent action without modification of structures allocated by firmware. PR: 197641 Submitted by: Chris Ruffin Approved by: re (gjb) Modified: releng/10.2/sys/boot/efi/libefi/efipart.c Directory Properties: releng/10.2/ (props changed) Modified: releng/10.2/sys/boot/efi/libefi/efipart.c ============================================================================== --- releng/10.2/sys/boot/efi/libefi/efipart.c Tue Jul 28 13:09:16 2015 (r285955) +++ releng/10.2/sys/boot/efi/libefi/efipart.c Tue Jul 28 13:11:31 2015 (r285956) @@ -63,13 +63,14 @@ static int efipart_init(void) { EFI_BLOCK_IO *blkio; - EFI_DEVICE_PATH *devpath, *node; + EFI_DEVICE_PATH *devpath, *devpathcpy, *tmpdevpath, *node; EFI_HANDLE *hin, *hout, *aliases, handle; EFI_STATUS status; UINTN sz; CHAR16 *path; u_int n, nin, nout; int err; + size_t devpathlen; sz = 0; hin = NULL; @@ -98,9 +99,15 @@ efipart_init(void) if (EFI_ERROR(status)) { continue; } + node = devpath; - while (!IsDevicePathEnd(NextDevicePathNode(node))) + devpathlen = DevicePathNodeLength(node); + while (!IsDevicePathEnd(NextDevicePathNode(node))) { node = NextDevicePathNode(node); + devpathlen += DevicePathNodeLength(node); + } + devpathlen += DevicePathNodeLength(NextDevicePathNode(node)); + status = BS->HandleProtocol(hin[n], &blkio_guid, (void**)&blkio); if (EFI_ERROR(status)) @@ -117,10 +124,16 @@ efipart_init(void) */ if (DevicePathType(node) == MEDIA_DEVICE_PATH && DevicePathSubType(node) == MEDIA_CDROM_DP) { - node->Type = END_DEVICE_PATH_TYPE; - node->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE; - status = BS->LocateDevicePath(&blkio_guid, &devpath, + devpathcpy = malloc(devpathlen); + memcpy(devpathcpy, devpath, devpathlen); + node = devpathcpy; + while (!IsDevicePathEnd(NextDevicePathNode(node))) + node = NextDevicePathNode(node); + SetDevicePathEndNode(node); + tmpdevpath = devpathcpy; + status = BS->LocateDevicePath(&blkio_guid, &tmpdevpath, &handle); + free(devpathcpy); if (EFI_ERROR(status)) continue; hout[nout] = handle; From owner-svn-src-all@freebsd.org Tue Jul 28 13:16:09 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85D369ACC27; Tue, 28 Jul 2015 13:16:09 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 75A82A3F; Tue, 28 Jul 2015 13:16:09 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SDG9ne014966; Tue, 28 Jul 2015 13:16:09 GMT (envelope-from zbb@FreeBSD.org) Received: (from zbb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SDG9If014965; Tue, 28 Jul 2015 13:16:09 GMT (envelope-from zbb@FreeBSD.org) Message-Id: <201507281316.t6SDG9If014965@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zbb set sender to zbb@FreeBSD.org using -f From: Zbigniew Bodek Date: Tue, 28 Jul 2015 13:16:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285957 - head/sys/dev/ofw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 13:16:09 -0000 Author: zbb Date: Tue Jul 28 13:16:08 2015 New Revision: 285957 URL: https://svnweb.freebsd.org/changeset/base/285957 Log: Limit ofw_cpu_early_foreach() to CPUs only On some platforms, the /cpus node contains cpu-to-cluster map which deffinitely is not a CPU node. Its presence was causing incrementing of "id" variable and reporting more CPUs available than it should. To make "id" valid, increment it only when an entry really is a CPU device. Reviewed by: andrew Obtained from: Semihalf Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3216 Modified: head/sys/dev/ofw/ofw_cpu.c Modified: head/sys/dev/ofw/ofw_cpu.c ============================================================================== --- head/sys/dev/ofw/ofw_cpu.c Tue Jul 28 13:11:31 2015 (r285956) +++ head/sys/dev/ofw/ofw_cpu.c Tue Jul 28 13:16:08 2015 (r285957) @@ -281,11 +281,13 @@ ofw_cpu_early_foreach(ofw_cpu_foreach_cb phandle_t node, child; pcell_t addr_cells, reg[2]; char status[16]; - u_int id; + char device_type[16]; + u_int id, next_id; int count, rv; count = 0; id = 0; + next_id = 0; node = OF_finddevice("/cpus"); if (node == -1) @@ -296,7 +298,21 @@ ofw_cpu_early_foreach(ofw_cpu_foreach_cb sizeof(addr_cells)) < 0) return (-1); - for (child = OF_child(node); child != 0; child = OF_peer(child), id++) { + for (child = OF_child(node); child != 0; child = OF_peer(child), + id = next_id) { + + /* Check if child is a CPU */ + memset(device_type, 0, sizeof(device_type)); + rv = OF_getprop(child, "device_type", device_type, + sizeof(device_type) - 1); + if (rv < 0) + continue; + if (strcmp(device_type, "cpu") != 0) + continue; + + /* We're processing CPU, update next_id used in the next iteration */ + next_id++; + /* * If we are filtering by runnable then limit to only * those that have been enabled. From owner-svn-src-all@freebsd.org Tue Jul 28 13:19:03 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B02AE9ACCB0; Tue, 28 Jul 2015 13:19:03 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: from mail-qg0-x234.google.com (mail-qg0-x234.google.com [IPv6:2607:f8b0:400d:c04::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6B757C70; Tue, 28 Jul 2015 13:19:03 +0000 (UTC) (envelope-from garga.bsd@gmail.com) Received: by qgeu79 with SMTP id u79so74416812qge.1; Tue, 28 Jul 2015 06:19:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=qbyrXuh8/y4CXoeIh3W1XEKQVMZMUvJBNc6jhWY+CtI=; b=YQyvoN9HYrvAu3Jc8kavsHkPfZCCVGeYgKXnVSwVMhc68TDVjz3Dha/SApgev/lA9H iXSNXWhtM4cur+WKtGSSjfshF6+CBp0B3Pmd6C5kU1vO9WiEEBnaoBnGYMa4Baxu1kn1 gXPUITyebRvOMDnhCjVeWKFVSyV5AP79et3FiayKE2IkR6iMftnKP/viu5K8vRgT2PCA /QyGQVmMWajEEzycB2B2RjyHc3kdGB+epfzGX9Rtx4WRRDf5V5xtgHReASWhgU9g3rL9 MBLp/3SBYR0GULKrtllbGSJPpUCDSHYe4pXogBBaWB24KUjbdUF1MgfseHix27ZdzX+l /glA== X-Received: by 10.140.104.110 with SMTP id z101mr47657285qge.76.1438089542566; Tue, 28 Jul 2015 06:19:02 -0700 (PDT) Received: from mbp.home (179-125-138-94.desktop.com.br. [179.125.138.94]) by smtp.gmail.com with ESMTPSA id i36sm11117923qkh.36.2015.07.28.06.19.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 28 Jul 2015 06:19:01 -0700 (PDT) Sender: Renato Botelho Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2102\)) Subject: Re: svn commit: r285945 - head/sys/netpfil/pf From: Renato Botelho In-Reply-To: <20150728112051.GT72729@FreeBSD.org> Date: Tue, 28 Jul 2015 10:18:57 -0300 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <201507281031.t6SAVZnu046387@repo.freebsd.org> <20150728112051.GT72729@FreeBSD.org> To: Gleb Smirnoff X-Mailer: Apple Mail (2.2102) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 13:19:03 -0000 > On Jul 28, 2015, at 08:20, Gleb Smirnoff wrote: >=20 > Renato, >=20 > On Tue, Jul 28, 2015 at 10:31:35AM +0000, Renato Botelho wrote: > R> Author: garga (ports committer) > R> Date: Tue Jul 28 10:31:34 2015 > R> New Revision: 285945 > R> URL: https://svnweb.freebsd.org/changeset/base/285945 > R>=20 > R> Log: > R> Respect pf rule log option before log dropped packets with IP = options or > R> dangerous v6 headers > R> =20 > R> Reviewed by: gnn, eri > R> Approved by: gnn > R> Obtained from: pfSense > R> MFC after: 3 days > R> Sponsored by: Netgate > R> Differential Revision: https://reviews.freebsd.org/D3222 > R>=20 > R> Modified: > R> head/sys/netpfil/pf/pf.c > R>=20 > R> Modified: head/sys/netpfil/pf/pf.c > R> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > R> --- head/sys/netpfil/pf/pf.c Tue Jul 28 09:36:26 2015 = (r285944) > R> +++ head/sys/netpfil/pf/pf.c Tue Jul 28 10:31:34 2015 = (r285945) > R> @@ -5895,7 +5895,8 @@ done: > R> !((s && s->state_flags & PFSTATE_ALLOWOPTS) || = r->allow_opts)) { > R> action =3D PF_DROP; > R> REASON_SET(&reason, PFRES_IPOPTIONS); > R> - log =3D 1; > R> + if (r->log) > R> + log =3D 1; > R> DPFPRINTF(PF_DEBUG_MISC, > R> ("pf: dropping packet with ip options\n")); > R> } > R> @@ -6329,7 +6330,8 @@ done: > R> !((s && s->state_flags & PFSTATE_ALLOWOPTS) || = r->allow_opts)) { > R> action =3D PF_DROP; > R> REASON_SET(&reason, PFRES_IPOPTIONS); > R> - log =3D 1; > R> + if (r->log) > R> + log =3D 1; > R> DPFPRINTF(PF_DEBUG_MISC, > R> ("pf: dropping packet with dangerous v6 = headers\n")); > R> } >=20 > Why not simply: >=20 > log =3D r->log; >=20 > ? >=20 > That would also match the style of the function, since it already has: >=20 > log =3D s->log; Thanks for pointing this out. Do you approve the following patch? Index: sys/netpfil/pf/pf.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- sys/netpfil/pf/pf.c (revision 285945) +++ sys/netpfil/pf/pf.c (working copy) @@ -5895,8 +5895,7 @@ !((s && s->state_flags & PFSTATE_ALLOWOPTS) || = r->allow_opts)) { action =3D PF_DROP; REASON_SET(&reason, PFRES_IPOPTIONS); - if (r->log) - log =3D 1; + log =3D r->log; DPFPRINTF(PF_DEBUG_MISC, ("pf: dropping packet with ip options\n")); } @@ -6330,8 +6329,7 @@ !((s && s->state_flags & PFSTATE_ALLOWOPTS) || = r->allow_opts)) { action =3D PF_DROP; REASON_SET(&reason, PFRES_IPOPTIONS); - if (r->log) - log =3D 1; + log =3D r->log; DPFPRINTF(PF_DEBUG_MISC, ("pf: dropping packet with dangerous v6 = headers\n")); } -- Renato Botelho From owner-svn-src-all@freebsd.org Tue Jul 28 13:48:20 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DFBB69AD37F; Tue, 28 Jul 2015 13:48:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D035C321; Tue, 28 Jul 2015 13:48:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SDmKXP029639; Tue, 28 Jul 2015 13:48:20 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SDmK3v029638; Tue, 28 Jul 2015 13:48:20 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201507281348.t6SDmK3v029638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 28 Jul 2015 13:48:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285958 - head/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 13:48:21 -0000 Author: glebius Date: Tue Jul 28 13:48:19 2015 New Revision: 285958 URL: https://svnweb.freebsd.org/changeset/base/285958 Log: Fix the r272906 description. Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: head/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- head/release/doc/en_US.ISO8859-1/relnotes/article.xml Tue Jul 28 13:16:08 2015 (r285957) +++ head/release/doc/en_US.ISO8859-1/relnotes/article.xml Tue Jul 28 13:48:19 2015 (r285958) @@ -1049,7 +1049,7 @@ The &man.alc.4; driver has been updated to support AR816x and AR817x ethernet controllers. - The &man.pfil.9; interface default hash + The &man.pf.4; packet filter default hash has been changed from Jenkins to Murmur3, providing a 3-percent performance increase in packets-per-second. From owner-svn-src-all@freebsd.org Tue Jul 28 14:20:34 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4BB39AD962; Tue, 28 Jul 2015 14:20:34 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 95B74222; Tue, 28 Jul 2015 14:20:34 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SEKYp0044546; Tue, 28 Jul 2015 14:20:34 GMT (envelope-from zbb@FreeBSD.org) Received: (from zbb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SEKY5g044545; Tue, 28 Jul 2015 14:20:34 GMT (envelope-from zbb@FreeBSD.org) Message-Id: <201507281420.t6SEKY5g044545@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zbb set sender to zbb@FreeBSD.org using -f From: Zbigniew Bodek Date: Tue, 28 Jul 2015 14:20:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285959 - head/sys/contrib/alpine-hal X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 14:20:34 -0000 Author: zbb Date: Tue Jul 28 14:20:33 2015 New Revision: 285959 URL: https://svnweb.freebsd.org/changeset/base/285959 Log: Import Annapurna Labs Alpine HAL to sys/contrib/ Import from vendor-sys/alpine-hal/2.7 SVN rev.: 285432 HAL version: 2.7 Obtained from: Semihalf Sponsored by: Annapurna Labs Added: head/sys/contrib/alpine-hal/ - copied from r285958, vendor-sys/alpine-hal/2.7/ From owner-svn-src-all@freebsd.org Tue Jul 28 14:31:10 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4911F9ADBA1; Tue, 28 Jul 2015 14:31:10 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebius.int.ru", Issuer "cell.glebius.int.ru" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id B13AA9AA; Tue, 28 Jul 2015 14:31:08 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.9/8.14.9) with ESMTP id t6SEV6oX085981 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 28 Jul 2015 17:31:06 +0300 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.9/8.14.9/Submit) id t6SEV69l085980; Tue, 28 Jul 2015 17:31:06 +0300 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 28 Jul 2015 17:31:06 +0300 From: Gleb Smirnoff To: Mark Johnston , Jason Unovitch Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r285782 - head/usr.bin/netstat Message-ID: <20150728143106.GY72729@FreeBSD.org> References: <201507212357.t6LNvd7K023794@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201507212357.t6LNvd7K023794@repo.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 14:31:10 -0000 Mark, Jason, On Tue, Jul 21, 2015 at 11:57:39PM +0000, Mark Johnston wrote: M> Fix counter reads on platforms where sizeof(uint64_t) != sizeof(uint64_t *). M> M> In the kernel, structs such as tcpstat are manipulated as an array of M> counter_u64_t (uint64_t *), but made visible to userland as an array of M> uint64_t. kread_counters() was previously copying the counter array into M> user space and sequentially overwriting each counter with its value. This M> mostly affects IPsec counters, as other counters are exported via sysctl. M> M> PR: 201700 M> Tested by: Jason Unovitch Thanks for fixing the bug after me. One question, though: why do you use sizeof(u_long) instead of size of a pointer? M> ============================================================================== M> --- head/usr.bin/netstat/main.c Tue Jul 21 23:44:36 2015 (r285781) M> +++ head/usr.bin/netstat/main.c Tue Jul 21 23:57:38 2015 (r285782) M> @@ -776,19 +776,31 @@ kread_counter(u_long addr) M> int M> kread_counters(u_long addr, void *buf, size_t size) M> { M> - uint64_t *c = buf; M> + uint64_t *c; M> + u_long *counters; M> + size_t i, n; M> M> if (kvmd_init() < 0) M> return (-1); M> M> - if (kread(addr, buf, size) < 0) M> + if (size % sizeof(uint64_t) != 0) { M> + xo_warnx("kread_counters: invalid counter set size"); M> return (-1); M> + } M> M> - while (size != 0) { M> - *c = kvm_counter_u64_fetch(kvmd, *c); M> - size -= sizeof(*c); M> - c++; M> + n = size / sizeof(uint64_t); M> + if ((counters = malloc(n * sizeof(u_long))) == NULL) M> + xo_err(-1, "malloc"); M> + if (kread(addr, counters, n * sizeof(u_long)) < 0) { M> + free(counters); M> + return (-1); M> } M> + M> + c = buf; M> + for (i = 0; i < n; i++) M> + c[i] = kvm_counter_u64_fetch(kvmd, counters[i]); M> + M> + free(counters); M> return (0); M> } -- Totus tuus, Glebius. From owner-svn-src-all@freebsd.org Tue Jul 28 14:43:28 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B9C679ADD51; Tue, 28 Jul 2015 14:43:28 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebius.int.ru", Issuer "cell.glebius.int.ru" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4674FFB9; Tue, 28 Jul 2015 14:43:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.9/8.14.9) with ESMTP id t6SEhPbX086033 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 28 Jul 2015 17:43:25 +0300 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.9/8.14.9/Submit) id t6SEhPBp086032; Tue, 28 Jul 2015 17:43:25 +0300 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Tue, 28 Jul 2015 17:43:25 +0300 From: Gleb Smirnoff To: Renato Botelho Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r285945 - head/sys/netpfil/pf Message-ID: <20150728144325.GZ72729@FreeBSD.org> References: <201507281031.t6SAVZnu046387@repo.freebsd.org> <20150728112051.GT72729@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 14:43:28 -0000 Renato, On Tue, Jul 28, 2015 at 10:18:57AM -0300, Renato Botelho wrote: R> Thanks for pointing this out. Do you approve the following patch? R> R> Index: sys/netpfil/pf/pf.c R> =================================================================== R> --- sys/netpfil/pf/pf.c (revision 285945) R> +++ sys/netpfil/pf/pf.c (working copy) R> @@ -5895,8 +5895,7 @@ R> !((s && s->state_flags & PFSTATE_ALLOWOPTS) || r->allow_opts)) { R> action = PF_DROP; R> REASON_SET(&reason, PFRES_IPOPTIONS); R> - if (r->log) R> - log = 1; R> + log = r->log; R> DPFPRINTF(PF_DEBUG_MISC, R> ("pf: dropping packet with ip options\n")); R> } R> @@ -6330,8 +6329,7 @@ R> !((s && s->state_flags & PFSTATE_ALLOWOPTS) || r->allow_opts)) { R> action = PF_DROP; R> REASON_SET(&reason, PFRES_IPOPTIONS); R> - if (r->log) R> - log = 1; R> + log = r->log; R> DPFPRINTF(PF_DEBUG_MISC, R> ("pf: dropping packet with dangerous v6 headers\n")); R> } Yes, this looks better. Thanks. -- Totus tuus, Glebius. From owner-svn-src-all@freebsd.org Tue Jul 28 14:59:30 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 254A69ADFFC; Tue, 28 Jul 2015 14:59:30 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 10E0DA0B; Tue, 28 Jul 2015 14:59:30 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SExTCv062492; Tue, 28 Jul 2015 14:59:29 GMT (envelope-from garga@FreeBSD.org) Received: (from garga@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SExTDW062491; Tue, 28 Jul 2015 14:59:29 GMT (envelope-from garga@FreeBSD.org) Message-Id: <201507281459.t6SExTDW062491@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: garga set sender to garga@FreeBSD.org using -f From: Renato Botelho Date: Tue, 28 Jul 2015 14:59:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285960 - head/sys/netpfil/pf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 14:59:30 -0000 Author: garga (ports committer) Date: Tue Jul 28 14:59:29 2015 New Revision: 285960 URL: https://svnweb.freebsd.org/changeset/base/285960 Log: Simplify logic added in r285945 as suggested by glebius Approved by: glebius MFC after: 3 days Sponsored by: Netgate Modified: head/sys/netpfil/pf/pf.c Modified: head/sys/netpfil/pf/pf.c ============================================================================== --- head/sys/netpfil/pf/pf.c Tue Jul 28 14:20:33 2015 (r285959) +++ head/sys/netpfil/pf/pf.c Tue Jul 28 14:59:29 2015 (r285960) @@ -5895,8 +5895,7 @@ done: !((s && s->state_flags & PFSTATE_ALLOWOPTS) || r->allow_opts)) { action = PF_DROP; REASON_SET(&reason, PFRES_IPOPTIONS); - if (r->log) - log = 1; + log = r->log; DPFPRINTF(PF_DEBUG_MISC, ("pf: dropping packet with ip options\n")); } @@ -6330,8 +6329,7 @@ done: !((s && s->state_flags & PFSTATE_ALLOWOPTS) || r->allow_opts)) { action = PF_DROP; REASON_SET(&reason, PFRES_IPOPTIONS); - if (r->log) - log = 1; + log = r->log; DPFPRINTF(PF_DEBUG_MISC, ("pf: dropping packet with dangerous v6 headers\n")); } From owner-svn-src-all@freebsd.org Tue Jul 28 15:03:57 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C6E9E9AC204; Tue, 28 Jul 2015 15:03:57 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B6883E09; Tue, 28 Jul 2015 15:03:57 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SF3vMg066572; Tue, 28 Jul 2015 15:03:57 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SF3v2D066571; Tue, 28 Jul 2015 15:03:57 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507281503.t6SF3v2D066571@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 28 Jul 2015 15:03:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285961 - stable/10/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 15:03:57 -0000 Author: gjb Date: Tue Jul 28 15:03:56 2015 New Revision: 285961 URL: https://svnweb.freebsd.org/changeset/base/285961 Log: Fix the description for r274486. Submitted by: glebius Sponsored by: The FreeBSD Foundation Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Tue Jul 28 14:59:29 2015 (r285960) +++ stable/10/release/doc/en_US.ISO8859-1/relnotes/article.xml Tue Jul 28 15:03:56 2015 (r285961) @@ -483,7 +483,7 @@ Network Drivers - The &man.pfil.9; interface default hash + The &man.pf.4; interface default hash has been changed from Jenkins to Murmur3, providing a 3-percent performance increase in packets-per-second. From owner-svn-src-all@freebsd.org Tue Jul 28 15:05:20 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FAD79AC278; Tue, 28 Jul 2015 15:05:20 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 206B8F4E; Tue, 28 Jul 2015 15:05:20 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SF5JRV066768; Tue, 28 Jul 2015 15:05:19 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SF5JiS066767; Tue, 28 Jul 2015 15:05:19 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507281505.t6SF5JiS066767@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 28 Jul 2015 15:05:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r285962 - releng/10.2/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 15:05:20 -0000 Author: gjb Date: Tue Jul 28 15:05:19 2015 New Revision: 285962 URL: https://svnweb.freebsd.org/changeset/base/285962 Log: Fix the description for r274486. Submitted by: glebius Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml Tue Jul 28 15:03:56 2015 (r285961) +++ releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml Tue Jul 28 15:05:19 2015 (r285962) @@ -504,7 +504,7 @@ Network Drivers - The &man.pfil.9; interface default hash + The &man.pf.4; interface default hash has been changed from Jenkins to Murmur3, providing a 3-percent performance increase in packets-per-second. From owner-svn-src-all@freebsd.org Tue Jul 28 15:26:49 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0A679AC751; Tue, 28 Jul 2015 15:26:49 +0000 (UTC) (envelope-from jason.unovitch@gmail.com) Received: from mail-ig0-x22d.google.com (mail-ig0-x22d.google.com [IPv6:2607:f8b0:4001:c05::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8C00CAED; Tue, 28 Jul 2015 15:26:49 +0000 (UTC) (envelope-from jason.unovitch@gmail.com) Received: by igbpg9 with SMTP id pg9so141651640igb.0; Tue, 28 Jul 2015 08:26:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=NEuVooqYBKb+76StWalkbIKfRtah5Kakb/twmoEPsNk=; b=mK3OmdDSoeZ0umkNiGuyeJ8zOqJyrP4Of8SvmMEW/EYe2dAczX2fQOhIYbD/h6rhea OoBRxwDnQlD7oDAukveWK4avwazVMnf7ceewBihwjbPJvBs37744PRXRjGl/B50fPLvu 6Vha0WXidUxkCt7DtBoyEuD+SrhpPvEWb2bSOXV7SDJP1NiDR6gxWd1ABLT6b7O53PJ0 2duDY5f/+SAoauprEd6al7YITy1hW/GS0uaQTWkd0cbgOV+TFrmzI0ob9qBiJ6nHheMV R/30lfEDIqUd/Fb/zvCniS2p4yNx+U1vSRDgWskjh7GosLUs/AnXPvC4/06IUrH2IUTh +aNA== MIME-Version: 1.0 X-Received: by 10.50.128.169 with SMTP id np9mr7979252igb.37.1438097208547; Tue, 28 Jul 2015 08:26:48 -0700 (PDT) Received: by 10.36.27.13 with HTTP; Tue, 28 Jul 2015 08:26:48 -0700 (PDT) Received: by 10.36.27.13 with HTTP; Tue, 28 Jul 2015 08:26:48 -0700 (PDT) In-Reply-To: <20150728143106.GY72729@FreeBSD.org> References: <201507212357.t6LNvd7K023794@repo.freebsd.org> <20150728143106.GY72729@FreeBSD.org> Date: Tue, 28 Jul 2015 11:26:48 -0400 Message-ID: Subject: Re: svn commit: r285782 - head/usr.bin/netstat From: Jason Unovitch To: Gleb Smirnoff Cc: src-committers@freebsd.org, svn-src-head@freebsd.org, Mark Johnston , svn-src-all@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 15:26:50 -0000 On Jul 28, 2015 10:31 AM, "Gleb Smirnoff" wrote: > > Mark, Jason, > > On Tue, Jul 21, 2015 at 11:57:39PM +0000, Mark Johnston wrote: > M> Fix counter reads on platforms where sizeof(uint64_t) != sizeof(uint64_t *). > M> > M> In the kernel, structs such as tcpstat are manipulated as an array of > M> counter_u64_t (uint64_t *), but made visible to userland as an array of > M> uint64_t. kread_counters() was previously copying the counter array into > M> user space and sequentially overwriting each counter with its value. This > M> mostly affects IPsec counters, as other counters are exported via sysctl. > M> > M> PR: 201700 > M> Tested by: Jason Unovitch > > Thanks for fixing the bug after me. > > One question, though: why do you use sizeof(u_long) instead of size of a > pointer? > Gleb, Mark will have to provide more details on the choice of using sizeof(u_long). I had tested the end result of the fix. All of our discussion on the matter was in the PR. https://bugs.freebsd.org/201700 It hasn't been MFC'd so I'd be more than happy to test the revision so we can MFC both commits for the fix. > M>@ ============================================================================== > M> --- head/usr.bin/netstat/main.c Tue Jul 21 23:44:36 2015 (r285781) > M> +++ head/usr.bin/netstat/main.c Tue Jul 21 23:57:38 2015 (r285782) > M> @@ -776,19 +776,31 @@ kread_counter(u_long addr) > M> int > M> kread_counters(u_long addr, void *buf, size_t size) > M> { > M> - uint64_t *c = buf; > M> + uint64_t *c; > M> + u_long *counters; > M> + size_t i, n; > M> > M> if (kvmd_init() < 0) > M> return (-1); > M> > M> - if (kread(addr, buf, size) < 0) > M> + if (size % sizeof(uint64_t) != 0) { > M> + xo_warnx("kread_counters: invalid counter set size"); > M> return (-1); > M> + } > M> > M> - while (size != 0) { > M> - *c = kvm_counter_u64_fetch(kvmd, *c); > M> - size -= sizeof(*c); > M> - c++; > M> + n = size / sizeof(uint64_t); > M> + if ((counters = malloc(n * sizeof(u_long))) == NULL) > M> + xo_err(-1, "malloc"); > M> + if (kread(addr, counters, n * sizeof(u_long)) < 0) { > M> + free(counters); > M> + return (-1); > M> } > M> + > M> + c = buf; > M> + for (i = 0; i < n; i++) > M> + c[i] = kvm_counter_u64_fetch(kvmd, counters[i]); > M> + > M> + free(counters); > M> return (0); > M> } > > -- > Totus tuus, Glebius. -Jason From owner-svn-src-all@freebsd.org Tue Jul 28 16:04:42 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E37C9ACEEC; Tue, 28 Jul 2015 16:04:42 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 3A44C1D0B; Tue, 28 Jul 2015 16:04:42 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 37F2E1D38; Tue, 28 Jul 2015 16:04:42 +0000 (UTC) Date: Tue, 28 Jul 2015 16:04:42 +0000 From: Alexey Dokuchaev To: John-Mark Gurney Cc: Mark R V Murray , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers Subject: Re: svn commit: r284959 - in head: . share/man/man4 share/man/man9 sys/conf sys/dev/glxsb sys/dev/hifn sys/dev/random sys/dev/rndtest sys/dev/safe sys/dev/syscons sys/dev/ubsec sys/dev/virtio/random sy... Message-ID: <20150728160442.GA16709@FreeBSD.org> References: <20150724012519.GE78154@funkthat.com> <20150725143629.GA49086@FreeBSD.org> <20150725173054.GV78154@funkthat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150725173054.GV78154@funkthat.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 16:04:42 -0000 On Sat, Jul 25, 2015 at 10:30:55AM -0700, John-Mark Gurney wrote: > Alexey Dokuchaev wrote this message on Sat, Jul 25, 2015 at 14:36 +0000: > > On Fri, Jul 24, 2015 at 07:59:35AM +0100, Mark R V Murray wrote: > > > [...] > > > > Heck, piping in mic data to /dev/random is a good way to seed the > > > > rng on many machines. > > > > > > Well, sure, but what if you don't have microphone? I want lots > > > of choices, in anticipation of only a subset being usable. > > > > I like the microphone idea. Not just it adds another hard-to-mess-with > > (?) entropy source, it can also be a nice "reference" example for people > > wanting to write their own sources and plug them into the RNG framework. > > Shouldn't be done in kernel, just do it from userland, by adding the > following to cron: > 3 * * * * root sleep $(jot -r 1 120 1); dd if=/dev/dsp bs=512 count=5 2>/dev/null | sha512 > /dev/random Hey, that's nice, thanks! I didn't realize from reading random(4) that it can be fed like this. Perhaps manpage should be updated (the cron trick could be a nice candidate for EXAMPLES section or something)... ./danfe From owner-svn-src-all@freebsd.org Tue Jul 28 16:39:37 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59A919AD4B8; Tue, 28 Jul 2015 16:39:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49E3FF40; Tue, 28 Jul 2015 16:39:37 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SGdbas008745; Tue, 28 Jul 2015 16:39:37 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SGdbgl008743; Tue, 28 Jul 2015 16:39:37 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201507281639.t6SGdbgl008743@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 28 Jul 2015 16:39:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285963 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 16:39:37 -0000 Author: kib Date: Tue Jul 28 16:39:36 2015 New Revision: 285963 URL: https://svnweb.freebsd.org/changeset/base/285963 Log: MFC r285134 (by mjg): fd: de-k&r-ify functions + some whitespace fixes MFC r285269: Handle copyout for the fcntl(F_OGETLK) using oflock structure. Modified: stable/10/sys/kern/kern_descrip.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_descrip.c ============================================================================== --- stable/10/sys/kern/kern_descrip.c Tue Jul 28 15:05:19 2015 (r285962) +++ stable/10/sys/kern/kern_descrip.c Tue Jul 28 16:39:36 2015 (r285963) @@ -418,9 +418,10 @@ kern_fcntl_freebsd(struct thread *td, in struct flock fl; struct __oflock ofl; intptr_t arg1; - int error; + int error, newcmd; error = 0; + newcmd = cmd; switch (cmd) { case F_OGETLK: case F_OSETLK: @@ -438,31 +439,31 @@ kern_fcntl_freebsd(struct thread *td, in switch (cmd) { case F_OGETLK: - cmd = F_GETLK; - break; + newcmd = F_GETLK; + break; case F_OSETLK: - cmd = F_SETLK; - break; + newcmd = F_SETLK; + break; case F_OSETLKW: - cmd = F_SETLKW; - break; + newcmd = F_SETLKW; + break; } arg1 = (intptr_t)&fl; break; - case F_GETLK: - case F_SETLK: - case F_SETLKW: + case F_GETLK: + case F_SETLK: + case F_SETLKW: case F_SETLK_REMOTE: - error = copyin((void *)(intptr_t)arg, &fl, sizeof(fl)); - arg1 = (intptr_t)&fl; - break; + error = copyin((void *)(intptr_t)arg, &fl, sizeof(fl)); + arg1 = (intptr_t)&fl; + break; default: arg1 = arg; break; } if (error) return (error); - error = kern_fcntl(td, fd, cmd, arg1); + error = kern_fcntl(td, fd, newcmd, arg1); if (error) return (error); if (cmd == F_OGETLK) { @@ -746,7 +747,7 @@ kern_fcntl(struct thread *td, int fd, in if ((flp->l_start > 0 && foffset > OFF_MAX - flp->l_start) || (flp->l_start < 0 && - foffset < OFF_MIN - flp->l_start)) { + foffset < OFF_MIN - flp->l_start)) { FILEDESC_SUNLOCK(fdp); error = EOVERFLOW; fdrop(fp, td); @@ -954,13 +955,13 @@ funsetown(struct sigio **sigiop) struct pgrp *pg = (sigio)->sio_pgrp; PGRP_LOCK(pg); SLIST_REMOVE(&sigio->sio_pgrp->pg_sigiolst, sigio, - sigio, sio_pgsigio); + sigio, sio_pgsigio); PGRP_UNLOCK(pg); } else { struct proc *p = (sigio)->sio_proc; PROC_LOCK(p); SLIST_REMOVE(&sigio->sio_proc->p_sigiolst, sigio, - sigio, sio_pgsigio); + sigio, sio_pgsigio); PROC_UNLOCK(p); } SIGIO_UNLOCK(); @@ -1214,18 +1215,14 @@ struct close_args { #endif /* ARGSUSED */ int -sys_close(td, uap) - struct thread *td; - struct close_args *uap; +sys_close(struct thread *td, struct close_args *uap) { return (kern_close(td, uap->fd)); } int -kern_close(td, fd) - struct thread *td; - int fd; +kern_close(struct thread *td, int fd) { struct filedesc *fdp; struct file *fp; @@ -2312,10 +2309,10 @@ closef(struct file *fp, struct thread *t fdp = td->td_proc->p_fd; FILEDESC_XLOCK(fdp); for (fdtol = fdtol->fdl_next; - fdtol != td->td_proc->p_fdtol; - fdtol = fdtol->fdl_next) { + fdtol != td->td_proc->p_fdtol; + fdtol = fdtol->fdl_next) { if ((fdtol->fdl_leader->p_flag & - P_ADVLOCK) == 0) + P_ADVLOCK) == 0) continue; fdtol->fdl_holdcount++; FILEDESC_XUNLOCK(fdp); @@ -2933,8 +2930,7 @@ filedesc_to_leader_alloc(struct filedesc struct filedesc_to_leader *fdtol; fdtol = malloc(sizeof(struct filedesc_to_leader), - M_FILEDESC_TO_LEADER, - M_WAITOK); + M_FILEDESC_TO_LEADER, M_WAITOK); fdtol->fdl_refcount = 1; fdtol->fdl_holdcount = 0; fdtol->fdl_wakeup = 0; From owner-svn-src-all@freebsd.org Tue Jul 28 17:00:04 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1AB409AD86E; Tue, 28 Jul 2015 17:00:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0B5E4C63; Tue, 28 Jul 2015 17:00:04 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SH03sS018106; Tue, 28 Jul 2015 17:00:03 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SH03RZ018105; Tue, 28 Jul 2015 17:00:03 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201507281700.t6SH03RZ018105@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 28 Jul 2015 17:00:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r285964 - releng/10.2/sys/kern X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 17:00:04 -0000 Author: kib Date: Tue Jul 28 17:00:03 2015 New Revision: 285964 URL: https://svnweb.freebsd.org/changeset/base/285964 Log: MFC r285134 (by mjg): fd: de-k&r-ify functions + some whitespace fixes MFC r285269: Handle copyout for the fcntl(F_OGETLK) using oflock structure. Approved by: re (gjb) Modified: releng/10.2/sys/kern/kern_descrip.c Directory Properties: releng/10.2/ (props changed) Modified: releng/10.2/sys/kern/kern_descrip.c ============================================================================== --- releng/10.2/sys/kern/kern_descrip.c Tue Jul 28 16:39:36 2015 (r285963) +++ releng/10.2/sys/kern/kern_descrip.c Tue Jul 28 17:00:03 2015 (r285964) @@ -418,9 +418,10 @@ kern_fcntl_freebsd(struct thread *td, in struct flock fl; struct __oflock ofl; intptr_t arg1; - int error; + int error, newcmd; error = 0; + newcmd = cmd; switch (cmd) { case F_OGETLK: case F_OSETLK: @@ -438,31 +439,31 @@ kern_fcntl_freebsd(struct thread *td, in switch (cmd) { case F_OGETLK: - cmd = F_GETLK; - break; + newcmd = F_GETLK; + break; case F_OSETLK: - cmd = F_SETLK; - break; + newcmd = F_SETLK; + break; case F_OSETLKW: - cmd = F_SETLKW; - break; + newcmd = F_SETLKW; + break; } arg1 = (intptr_t)&fl; break; - case F_GETLK: - case F_SETLK: - case F_SETLKW: + case F_GETLK: + case F_SETLK: + case F_SETLKW: case F_SETLK_REMOTE: - error = copyin((void *)(intptr_t)arg, &fl, sizeof(fl)); - arg1 = (intptr_t)&fl; - break; + error = copyin((void *)(intptr_t)arg, &fl, sizeof(fl)); + arg1 = (intptr_t)&fl; + break; default: arg1 = arg; break; } if (error) return (error); - error = kern_fcntl(td, fd, cmd, arg1); + error = kern_fcntl(td, fd, newcmd, arg1); if (error) return (error); if (cmd == F_OGETLK) { @@ -746,7 +747,7 @@ kern_fcntl(struct thread *td, int fd, in if ((flp->l_start > 0 && foffset > OFF_MAX - flp->l_start) || (flp->l_start < 0 && - foffset < OFF_MIN - flp->l_start)) { + foffset < OFF_MIN - flp->l_start)) { FILEDESC_SUNLOCK(fdp); error = EOVERFLOW; fdrop(fp, td); @@ -954,13 +955,13 @@ funsetown(struct sigio **sigiop) struct pgrp *pg = (sigio)->sio_pgrp; PGRP_LOCK(pg); SLIST_REMOVE(&sigio->sio_pgrp->pg_sigiolst, sigio, - sigio, sio_pgsigio); + sigio, sio_pgsigio); PGRP_UNLOCK(pg); } else { struct proc *p = (sigio)->sio_proc; PROC_LOCK(p); SLIST_REMOVE(&sigio->sio_proc->p_sigiolst, sigio, - sigio, sio_pgsigio); + sigio, sio_pgsigio); PROC_UNLOCK(p); } SIGIO_UNLOCK(); @@ -1214,18 +1215,14 @@ struct close_args { #endif /* ARGSUSED */ int -sys_close(td, uap) - struct thread *td; - struct close_args *uap; +sys_close(struct thread *td, struct close_args *uap) { return (kern_close(td, uap->fd)); } int -kern_close(td, fd) - struct thread *td; - int fd; +kern_close(struct thread *td, int fd) { struct filedesc *fdp; struct file *fp; @@ -2312,10 +2309,10 @@ closef(struct file *fp, struct thread *t fdp = td->td_proc->p_fd; FILEDESC_XLOCK(fdp); for (fdtol = fdtol->fdl_next; - fdtol != td->td_proc->p_fdtol; - fdtol = fdtol->fdl_next) { + fdtol != td->td_proc->p_fdtol; + fdtol = fdtol->fdl_next) { if ((fdtol->fdl_leader->p_flag & - P_ADVLOCK) == 0) + P_ADVLOCK) == 0) continue; fdtol->fdl_holdcount++; FILEDESC_XUNLOCK(fdp); @@ -2933,8 +2930,7 @@ filedesc_to_leader_alloc(struct filedesc struct filedesc_to_leader *fdtol; fdtol = malloc(sizeof(struct filedesc_to_leader), - M_FILEDESC_TO_LEADER, - M_WAITOK); + M_FILEDESC_TO_LEADER, M_WAITOK); fdtol->fdl_refcount = 1; fdtol->fdl_holdcount = 0; fdtol->fdl_wakeup = 0; From owner-svn-src-all@freebsd.org Tue Jul 28 17:06:14 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A876A9ADA5C; Tue, 28 Jul 2015 17:06:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 941711AF; Tue, 28 Jul 2015 17:06:14 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SH6Ecd022314; Tue, 28 Jul 2015 17:06:14 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SH6EmI022313; Tue, 28 Jul 2015 17:06:14 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201507281706.t6SH6EmI022313@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 28 Jul 2015 17:06:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285965 - stable/10/share/man/man9 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 17:06:14 -0000 Author: kib Date: Tue Jul 28 17:06:13 2015 New Revision: 285965 URL: https://svnweb.freebsd.org/changeset/base/285965 Log: MFC r285173: Document the locking context for the directly dispatched callouts. Cross-reference timeout(9). Modified: stable/10/share/man/man9/locking.9 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man9/locking.9 ============================================================================== --- stable/10/share/man/man9/locking.9 Tue Jul 28 17:00:03 2015 (r285964) +++ stable/10/share/man/man9/locking.9 Tue Jul 28 17:06:13 2015 (r285965) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 30, 2013 +.Dd July 5, 2015 .Dt LOCKING 9 .Os .Sh NAME @@ -387,6 +387,7 @@ At this time this is a rather easy to re .It interrupt filter: Ta \&ok Ta \&no Ta \&no Ta \&no Ta \&no Ta \&no .It interrupt thread: Ta \&ok Ta \&ok Ta \&ok Ta \&no Ta \&no Ta \&no .It callout: Ta \&ok Ta \&ok Ta \&ok Ta \&no Ta \&no Ta \&no +.It direct callout: Ta \&ok Ta \&no Ta \&no Ta \&no Ta \&no Ta \&no .It system call: Ta \&ok Ta \&ok Ta \&ok Ta \&ok Ta \&ok Ta \&ok .El .Sh SEE ALSO @@ -400,6 +401,7 @@ At this time this is a rather easy to re .Xr sema 9 , .Xr sleep 9 , .Xr sx 9 , +.Xr timeout 9 , .Xr BUS_SETUP_INTR 9 , .Xr LOCK_PROFILING 9 .Sh HISTORY From owner-svn-src-all@freebsd.org Tue Jul 28 17:08:33 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 503D99ADB0D; Tue, 28 Jul 2015 17:08:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 40AA73D4; Tue, 28 Jul 2015 17:08:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SH8XYg022635; Tue, 28 Jul 2015 17:08:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SH8XT9022634; Tue, 28 Jul 2015 17:08:33 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201507281708.t6SH8XT9022634@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 28 Jul 2015 17:08:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285966 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 17:08:33 -0000 Author: kib Date: Tue Jul 28 17:08:32 2015 New Revision: 285966 URL: https://svnweb.freebsd.org/changeset/base/285966 Log: MFC r285039: Remove asserts which might reference freed memory. Modified: stable/10/sys/kern/vfs_mount.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/vfs_mount.c ============================================================================== --- stable/10/sys/kern/vfs_mount.c Tue Jul 28 17:06:13 2015 (r285965) +++ stable/10/sys/kern/vfs_mount.c Tue Jul 28 17:08:32 2015 (r285966) @@ -1108,9 +1108,6 @@ vfs_domount( } else error = vfs_domount_update(td, vp, fsflags, optlist); - ASSERT_VI_UNLOCKED(vp, __func__); - ASSERT_VOP_UNLOCKED(vp, __func__); - return (error); } From owner-svn-src-all@freebsd.org Tue Jul 28 17:12:42 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FB8D9ADCA9; Tue, 28 Jul 2015 17:12:42 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F3E12A4C; Tue, 28 Jul 2015 17:12:41 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SHCfHg026690; Tue, 28 Jul 2015 17:12:41 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SHCfQE026689; Tue, 28 Jul 2015 17:12:41 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201507281712.t6SHCfQE026689@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 28 Jul 2015 17:12:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285967 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 17:12:42 -0000 Author: kib Date: Tue Jul 28 17:12:41 2015 New Revision: 285967 URL: https://svnweb.freebsd.org/changeset/base/285967 Log: MFC r284956: Do not calculate the stack's bottom address twice. Modified: stable/10/sys/kern/kern_exec.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_exec.c ============================================================================== --- stable/10/sys/kern/kern_exec.c Tue Jul 28 17:08:32 2015 (r285966) +++ stable/10/sys/kern/kern_exec.c Tue Jul 28 17:12:41 2015 (r285967) @@ -1116,7 +1116,7 @@ exec_new_vmspace(imgp, sv) * process stack so we can check the stack rlimit. */ vmspace->vm_ssize = sgrowsiz >> PAGE_SHIFT; - vmspace->vm_maxsaddr = (char *)sv->sv_usrstack - ssiz; + vmspace->vm_maxsaddr = (char *)stack_addr; return (0); } From owner-svn-src-all@freebsd.org Tue Jul 28 17:20:36 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E38B9ADE12; Tue, 28 Jul 2015 17:20:36 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 29C14E07; Tue, 28 Jul 2015 17:20:36 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SHKaJN028228; Tue, 28 Jul 2015 17:20:36 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SHKaDb028227; Tue, 28 Jul 2015 17:20:36 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201507281720.t6SHKaDb028227@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 28 Jul 2015 17:20:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r285968 - vendor/libarchive/dist/libarchive X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 17:20:36 -0000 Author: bdrewery Date: Tue Jul 28 17:20:35 2015 New Revision: 285968 URL: https://svnweb.freebsd.org/changeset/base/285968 Log: Apply upstream changeset fa9e61: Fix --one-file-system to include the directory encountered rather than excluding it. Modified: vendor/libarchive/dist/libarchive/archive_read_disk_posix.c Modified: vendor/libarchive/dist/libarchive/archive_read_disk_posix.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_disk_posix.c Tue Jul 28 17:12:41 2015 (r285967) +++ vendor/libarchive/dist/libarchive/archive_read_disk_posix.c Tue Jul 28 17:20:35 2015 (r285968) @@ -974,7 +974,7 @@ next_entry(struct archive_read_disk *a, t->initial_filesystem_id = t->current_filesystem_id; if (!a->traverse_mount_points) { if (t->initial_filesystem_id != t->current_filesystem_id) - return (ARCHIVE_RETRY); + descend = 0; } t->descend = descend; From owner-svn-src-all@freebsd.org Tue Jul 28 17:32:15 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 94AD89AC441; Tue, 28 Jul 2015 17:32:15 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B22FC07; Tue, 28 Jul 2015 17:32:15 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SHWFMK035951; Tue, 28 Jul 2015 17:32:15 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SHWF4M035950; Tue, 28 Jul 2015 17:32:15 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201507281732.t6SHWF4M035950@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 28 Jul 2015 17:32:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285969 - in head/contrib/libarchive: . libarchive X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 17:32:15 -0000 Author: bdrewery Date: Tue Jul 28 17:32:14 2015 New Revision: 285969 URL: https://svnweb.freebsd.org/changeset/base/285969 Log: Mark vendor r285968 merged for r280870. Modified: Directory Properties: head/contrib/libarchive/ (props changed) head/contrib/libarchive/libarchive/ (props changed) From owner-svn-src-all@freebsd.org Tue Jul 28 17:48:37 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59AE19AC9CF; Tue, 28 Jul 2015 17:48:37 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 488BD1958; Tue, 28 Jul 2015 17:48:37 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SHmbcv041238; Tue, 28 Jul 2015 17:48:37 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SHmZOO041232; Tue, 28 Jul 2015 17:48:35 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201507281748.t6SHmZOO041232@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 28 Jul 2015 17:48:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r285970 - in vendor/libarchive/dist: . libarchive libarchive/test X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 17:48:37 -0000 Author: bdrewery Date: Tue Jul 28 17:48:34 2015 New Revision: 285970 URL: https://svnweb.freebsd.org/changeset/base/285970 Log: Apply upstream changeset bf4f6ec64e: Fix issue 356: properly skip a sparse file entry in a tar file. Added: vendor/libarchive/dist/libarchive/test/test_read_format_gtar_sparse_skip_entry.c (contents, props changed) vendor/libarchive/dist/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu Modified: vendor/libarchive/dist/Makefile.am vendor/libarchive/dist/libarchive/archive_read_support_format_tar.c vendor/libarchive/dist/libarchive/test/CMakeLists.txt Modified: vendor/libarchive/dist/Makefile.am ============================================================================== --- vendor/libarchive/dist/Makefile.am Tue Jul 28 17:32:14 2015 (r285969) +++ vendor/libarchive/dist/Makefile.am Tue Jul 28 17:48:34 2015 (r285970) @@ -395,6 +395,7 @@ libarchive_test_SOURCES= \ libarchive/test/test_read_format_gtar_gz.c \ libarchive/test/test_read_format_gtar_lzma.c \ libarchive/test/test_read_format_gtar_sparse.c \ + libarchive/test/test_read_format_gtar_sparse_skip_entry.c \ libarchive/test/test_read_format_iso_Z.c \ libarchive/test/test_read_format_iso_multi_extent.c \ libarchive/test/test_read_format_iso_xorriso.c \ @@ -622,6 +623,7 @@ libarchive_test_EXTRA_DIST=\ libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tar.uu \ libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tar.uu \ libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu \ + libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu \ libarchive/test/test_read_format_iso.iso.Z.uu \ libarchive/test/test_read_format_iso_2.iso.Z.uu \ libarchive/test/test_read_format_iso_joliet.iso.Z.uu \ Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_tar.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_support_format_tar.c Tue Jul 28 17:32:14 2015 (r285969) +++ vendor/libarchive/dist/libarchive/archive_read_support_format_tar.c Tue Jul 28 17:48:34 2015 (r285970) @@ -585,13 +585,23 @@ static int archive_read_format_tar_skip(struct archive_read *a) { int64_t bytes_skipped; + int64_t request; + struct sparse_block *p; struct tar* tar; tar = (struct tar *)(a->format->data); - bytes_skipped = __archive_read_consume(a, - tar->entry_bytes_remaining + tar->entry_padding + - tar->entry_bytes_unconsumed); + /* Do not consume the hole of a sparse file. */ + request = 0; + for (p = tar->sparse_list; p != NULL; p = p->next) { + if (!p->hole) + request += p->remaining; + } + if (request > tar->entry_bytes_remaining) + request = tar->entry_bytes_remaining; + request += tar->entry_padding + tar->entry_bytes_unconsumed; + + bytes_skipped = __archive_read_consume(a, request); if (bytes_skipped < 0) return (ARCHIVE_FATAL); Modified: vendor/libarchive/dist/libarchive/test/CMakeLists.txt ============================================================================== --- vendor/libarchive/dist/libarchive/test/CMakeLists.txt Tue Jul 28 17:32:14 2015 (r285969) +++ vendor/libarchive/dist/libarchive/test/CMakeLists.txt Tue Jul 28 17:48:34 2015 (r285970) @@ -110,6 +110,7 @@ IF(ENABLE_TEST) test_read_format_gtar_gz.c test_read_format_gtar_lzma.c test_read_format_gtar_sparse.c + test_read_format_gtar_sparse_skip_entry.c test_read_format_iso_Z.c test_read_format_iso_multi_extent.c test_read_format_iso_xorriso.c Added: vendor/libarchive/dist/libarchive/test/test_read_format_gtar_sparse_skip_entry.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libarchive/dist/libarchive/test/test_read_format_gtar_sparse_skip_entry.c Tue Jul 28 17:48:34 2015 (r285970) @@ -0,0 +1,119 @@ +/*- + * Copyright (c) 2014 Michihiro NAKAJIMA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD"); + +/* + * To test skip a sparse file entry, this test does not read file data. + */ +DEFINE_TEST(test_read_format_gtar_sparse_skip_entry) +{ + const char *refname = "test_read_format_gtar_sparse_skip_entry.tar.Z.uu"; + struct archive *a; + struct archive_entry *ae; + const void *p; + size_t s; + int64_t o; + + copy_reference_file(refname); + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_filename(a, refname, 10240)); + + /* Verify regular first file. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("a", archive_entry_pathname(ae)); + assertEqualInt(10737418244, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), + ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); + + /* Verify regular second file. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("b", archive_entry_pathname(ae)); + assertEqualInt(4, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), + ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); + + + /* End of archive. */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + /* Verify archive format. */ + assertEqualIntA(a, ARCHIVE_FILTER_COMPRESS, archive_filter_code(a, 0)); + assertEqualIntA(a, ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE, + archive_format(a)); + + /* Close the archive. */ + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + + + /* + * Read just one block of a sparse file and skip it. + */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_filename(a, refname, 10240)); + + /* Verify regular first file. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("a", archive_entry_pathname(ae)); + assertEqualInt(10737418244, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), + ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); + assertEqualInt(0, archive_read_data_block(a, &p, &s, &o)); + assertEqualInt(4096, s); + assertEqualInt(0, o); + + + /* Verify regular second file. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("b", archive_entry_pathname(ae)); + assertEqualInt(4, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), + ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); + + + /* End of archive. */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + /* Verify archive format. */ + assertEqualIntA(a, ARCHIVE_FILTER_COMPRESS, archive_filter_code(a, 0)); + assertEqualIntA(a, ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE, + archive_format(a)); + + /* Close the archive. */ + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} + Added: vendor/libarchive/dist/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/libarchive/dist/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu Tue Jul 28 17:48:34 2015 (r285970) @@ -0,0 +1,15 @@ +begin 644 - +M'YV04,+@05(F#)DRBD:;,V!@T8-6)NE&'#10T<-#;>R(%CAEV28_3R9?LW\(P8-F[`<#%C +M)@T<->#6>`PBC.2^E07;J#'#Q>J-F5DJ<`GBB),J+N;`<3JGC(LV8=2\D<-V +M]DO;N'7S]MTFC9OA/6#,CE'[=N[=$V +M9]RY=212"9YD1EOO*&`DE!&*>645%9IY9589JGE +MEEQVZ>678(8IYIADEFGFF6BFJ>::;+;IYIMPQBGGG'36:>>=>.:IYYY\]NGG +MGX`&*NB@A!9JJ)YB](D@1PZ>U&B#*468484RT11###7<8!8(&-)4PX=^DN@4 +B5%*E6.J*746JTHN'2LFDDZW&*NNLM-9JZZVXYJKKKKR&!0`` +` +end From owner-svn-src-all@freebsd.org Tue Jul 28 18:37:24 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 727279AD801; Tue, 28 Jul 2015 18:37:24 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 62BC4DDA; Tue, 28 Jul 2015 18:37:24 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SIbOC9065585; Tue, 28 Jul 2015 18:37:24 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SIbOtQ065584; Tue, 28 Jul 2015 18:37:24 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201507281837.t6SIbOtQ065584@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: "Conrad E. Meyer" Date: Tue, 28 Jul 2015 18:37:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285971 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 18:37:24 -0000 Author: cem Date: Tue Jul 28 18:37:23 2015 New Revision: 285971 URL: https://svnweb.freebsd.org/changeset/base/285971 Log: MFC r285483: pipe_direct_write: Fix mismatched pipelock/unlock If a signal is caught in pipelock, causing it to fail, pipe_direct_write should not try to pipeunlock. Approved by: markj (mentor) Sponsored by: EMC / Isilon Storage Division Modified: stable/10/sys/kern/sys_pipe.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/sys_pipe.c ============================================================================== --- stable/10/sys/kern/sys_pipe.c Tue Jul 28 17:48:34 2015 (r285970) +++ stable/10/sys/kern/sys_pipe.c Tue Jul 28 18:37:23 2015 (r285971) @@ -945,9 +945,10 @@ pipe_direct_write(wpipe, uio) retry: PIPE_LOCK_ASSERT(wpipe, MA_OWNED); error = pipelock(wpipe, 1); - if (wpipe->pipe_state & PIPE_EOF) + if (error != 0) + goto error1; + if ((wpipe->pipe_state & PIPE_EOF) != 0) { error = EPIPE; - if (error) { pipeunlock(wpipe); goto error1; } From owner-svn-src-all@freebsd.org Tue Jul 28 18:41:30 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DCB2A9AD8F3; Tue, 28 Jul 2015 18:41:30 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CBC911164; Tue, 28 Jul 2015 18:41:30 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SIfUuJ068941; Tue, 28 Jul 2015 18:41:30 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SIfTMb068730; Tue, 28 Jul 2015 18:41:29 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201507281841.t6SIfTMb068730@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 28 Jul 2015 18:41:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285972 - in head: contrib/libarchive/libarchive contrib/libarchive/libarchive/test lib/libarchive/test X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 18:41:31 -0000 Author: bdrewery Date: Tue Jul 28 18:41:28 2015 New Revision: 285972 URL: https://svnweb.freebsd.org/changeset/base/285972 Log: MFV r285970: Apply upstream changeset bf4f6ec64e: Fix issue 356: properly skip a sparse file entry in a tar file. PR: 201506 MFC after: 3 days Relnotes: yes Added: head/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.c - copied, changed from r285970, vendor/libarchive/dist/libarchive/test/test_read_format_gtar_sparse_skip_entry.c head/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu - copied unchanged from r285970, vendor/libarchive/dist/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu Modified: head/contrib/libarchive/libarchive/archive_read_support_format_tar.c head/lib/libarchive/test/Makefile Directory Properties: head/contrib/libarchive/ (props changed) head/contrib/libarchive/libarchive/ (props changed) Modified: head/contrib/libarchive/libarchive/archive_read_support_format_tar.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_tar.c Tue Jul 28 18:37:23 2015 (r285971) +++ head/contrib/libarchive/libarchive/archive_read_support_format_tar.c Tue Jul 28 18:41:28 2015 (r285972) @@ -585,13 +585,23 @@ static int archive_read_format_tar_skip(struct archive_read *a) { int64_t bytes_skipped; + int64_t request; + struct sparse_block *p; struct tar* tar; tar = (struct tar *)(a->format->data); - bytes_skipped = __archive_read_consume(a, - tar->entry_bytes_remaining + tar->entry_padding + - tar->entry_bytes_unconsumed); + /* Do not consume the hole of a sparse file. */ + request = 0; + for (p = tar->sparse_list; p != NULL; p = p->next) { + if (!p->hole) + request += p->remaining; + } + if (request > tar->entry_bytes_remaining) + request = tar->entry_bytes_remaining; + request += tar->entry_padding + tar->entry_bytes_unconsumed; + + bytes_skipped = __archive_read_consume(a, request); if (bytes_skipped < 0) return (ARCHIVE_FATAL); Copied and modified: head/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.c (from r285970, vendor/libarchive/dist/libarchive/test/test_read_format_gtar_sparse_skip_entry.c) ============================================================================== --- vendor/libarchive/dist/libarchive/test/test_read_format_gtar_sparse_skip_entry.c Tue Jul 28 17:48:34 2015 (r285970, copy source) +++ head/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.c Tue Jul 28 18:41:28 2015 (r285972) @@ -30,14 +30,22 @@ __FBSDID("$FreeBSD"); */ DEFINE_TEST(test_read_format_gtar_sparse_skip_entry) { +#ifndef __FreeBSD__ /* Backport test. */ const char *refname = "test_read_format_gtar_sparse_skip_entry.tar.Z.uu"; +#else + const char *refname = "test_read_format_gtar_sparse_skip_entry.tar.Z"; +#endif struct archive *a; struct archive_entry *ae; const void *p; size_t s; int64_t o; +#ifndef __FreeBSD__ /* Backport test. */ copy_reference_file(refname); +#else + extract_reference_file(refname); +#endif assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); @@ -48,17 +56,21 @@ DEFINE_TEST(test_read_format_gtar_sparse assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("a", archive_entry_pathname(ae)); assertEqualInt(10737418244, archive_entry_size(ae)); +#ifndef __FreeBSD__ /* Backport test. */ assertEqualInt(archive_entry_is_encrypted(ae), 0); assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); +#endif /* Verify regular second file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("b", archive_entry_pathname(ae)); assertEqualInt(4, archive_entry_size(ae)); +#ifndef __FreeBSD__ /* Backport test. */ assertEqualInt(archive_entry_is_encrypted(ae), 0); assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); +#endif /* End of archive. */ @@ -87,9 +99,11 @@ DEFINE_TEST(test_read_format_gtar_sparse assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("a", archive_entry_pathname(ae)); assertEqualInt(10737418244, archive_entry_size(ae)); +#ifndef __FreeBSD__ /* Backport test. */ assertEqualInt(archive_entry_is_encrypted(ae), 0); assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); +#endif assertEqualInt(0, archive_read_data_block(a, &p, &s, &o)); assertEqualInt(4096, s); assertEqualInt(0, o); @@ -99,9 +113,11 @@ DEFINE_TEST(test_read_format_gtar_sparse assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("b", archive_entry_pathname(ae)); assertEqualInt(4, archive_entry_size(ae)); +#ifndef __FreeBSD__ /* Backport test. */ assertEqualInt(archive_entry_is_encrypted(ae), 0); assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); +#endif /* End of archive. */ Copied: head/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu (from r285970, vendor/libarchive/dist/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu Tue Jul 28 18:41:28 2015 (r285972, copy of r285970, vendor/libarchive/dist/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu) @@ -0,0 +1,15 @@ +begin 644 - +M'YV04,+@05(F#)DRBD:;,V!@T8-6)NE&'#10T<-#;>R(%CAEV28_3R9?LW\(P8-F[`<#%C +M)@T<->#6>`PBC.2^E07;J#'#Q>J-F5DJ<`GBB),J+N;`<3JGC(LV8=2\D<-V +M]DO;N'7S]MTFC9OA/6#,CE'[=N[=$V +M9]RY=212"9YD1EOO*&`DE!&*>645%9IY9589JGE +MEEQVZ>678(8IYIADEFGFF6BFJ>::;+;IYIMPQBGGG'36:>>=>.:IYYY\]NGG +MGX`&*NB@A!9JJ)YB](D@1PZ>U&B#*468484RT11###7<8!8(&-)4PX=^DN@4 +B5%*E6.J*746JTHN'2LFDDZW&*NNLM-9JZZVXYJKKKKR&!0`` +` +end Modified: head/lib/libarchive/test/Makefile ============================================================================== --- head/lib/libarchive/test/Makefile Tue Jul 28 18:37:23 2015 (r285971) +++ head/lib/libarchive/test/Makefile Tue Jul 28 18:41:28 2015 (r285972) @@ -120,6 +120,7 @@ TESTS= \ test_read_format_gtar_gz.c \ test_read_format_gtar_lzma.c \ test_read_format_gtar_sparse.c \ + test_read_format_gtar_sparse_skip_entry.c \ test_read_format_iso_Z.c \ test_read_format_iso_multi_extent.c \ test_read_format_iso_xorriso.c \ From owner-svn-src-all@freebsd.org Tue Jul 28 19:15:46 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 400839AD398; Tue, 28 Jul 2015 19:15:46 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2FCE19E2; Tue, 28 Jul 2015 19:15:46 +0000 (UTC) (envelope-from davidcs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SJFkth084770; Tue, 28 Jul 2015 19:15:46 GMT (envelope-from davidcs@FreeBSD.org) Received: (from davidcs@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SJFjSj084767; Tue, 28 Jul 2015 19:15:45 GMT (envelope-from davidcs@FreeBSD.org) Message-Id: <201507281915.t6SJFjSj084767@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: davidcs set sender to davidcs@FreeBSD.org using -f From: David C Somayajulu Date: Tue, 28 Jul 2015 19:15:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285973 - head/sys/dev/bxe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 19:15:46 -0000 Author: davidcs Date: Tue Jul 28 19:15:44 2015 New Revision: 285973 URL: https://svnweb.freebsd.org/changeset/base/285973 Log: - Avoid lock contention in the if_transmit callback by using trylock and enqueueing the frames when it fails. This way there is some latency removed from the transmitting path. - If IFF_DRV_OACTIVE is set (and also if IFF_DRV_RUNNING is not) just enqueue the desired frames and return successful transmit. This way we avoid to return errors on transmit side and resulting in possible out-of-order frames. Please note that IFF_DRV_OACTIVE is set everytime we get the threshold ring hit, so this can be happening quite often. Submitted by: Attilio.Rao@isilon.com MFC after:5 days Modified: head/sys/dev/bxe/bxe.c head/sys/dev/bxe/bxe.h Modified: head/sys/dev/bxe/bxe.c ============================================================================== --- head/sys/dev/bxe/bxe.c Tue Jul 28 18:41:28 2015 (r285972) +++ head/sys/dev/bxe/bxe.c Tue Jul 28 19:15:44 2015 (r285973) @@ -5999,19 +5999,26 @@ bxe_tx_mq_start_locked(struct bxe_softc rc = tx_count = 0; + BXE_FP_TX_LOCK_ASSERT(fp); + if (!tx_br) { BLOGE(sc, "Multiqueue TX and no buf_ring!\n"); return (EINVAL); } + if (!sc->link_vars.link_up || + (ifp->if_drv_flags & + (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) { + rc = drbr_enqueue_drv(ifp, tx_br, m); + goto bxe_tx_mq_start_locked_exit; + } + /* fetch the depth of the driver queue */ depth = drbr_inuse_drv(ifp, tx_br); if (depth > fp->eth_q_stats.tx_max_drbr_queue_depth) { fp->eth_q_stats.tx_max_drbr_queue_depth = depth; } - BXE_FP_TX_LOCK_ASSERT(fp); - if (m == NULL) { /* no new work, check for pending frames */ next = drbr_dequeue_drv(ifp, tx_br); @@ -6103,26 +6110,11 @@ bxe_tx_mq_start(struct ifnet *ifp, fp = &sc->fp[fp_index]; - if (!(if_getdrvflags(ifp) & IFF_DRV_RUNNING)) { - BLOGW(sc, "Interface not running, ignoring transmit request\n"); - return (ENETDOWN); - } - - if (if_getdrvflags(ifp) & IFF_DRV_OACTIVE) { - BLOGW(sc, "Interface TX queue is full, ignoring transmit request\n"); - return (EBUSY); - } - - if (!sc->link_vars.link_up) { - BLOGW(sc, "Interface link is down, ignoring transmit request\n"); - return (ENETDOWN); - } - - /* XXX change to TRYLOCK here and if failed then schedule taskqueue */ - - BXE_FP_TX_LOCK(fp); - rc = bxe_tx_mq_start_locked(sc, ifp, fp, m); - BXE_FP_TX_UNLOCK(fp); + if (BXE_FP_TX_TRYLOCK(fp)) { + rc = bxe_tx_mq_start_locked(sc, ifp, fp, m); + BXE_FP_TX_UNLOCK(fp); + } else + rc = drbr_enqueue_drv(ifp, fp->tx_br, m); return (rc); } Modified: head/sys/dev/bxe/bxe.h ============================================================================== --- head/sys/dev/bxe/bxe.h Tue Jul 28 18:41:28 2015 (r285972) +++ head/sys/dev/bxe/bxe.h Tue Jul 28 19:15:44 2015 (r285973) @@ -582,6 +582,7 @@ struct bxe_fastpath { #define BXE_FP_TX_LOCK(fp) mtx_lock(&fp->tx_mtx) #define BXE_FP_TX_UNLOCK(fp) mtx_unlock(&fp->tx_mtx) #define BXE_FP_TX_LOCK_ASSERT(fp) mtx_assert(&fp->tx_mtx, MA_OWNED) +#define BXE_FP_TX_TRYLOCK(fp) mtx_trylock(&fp->tx_mtx) #define BXE_FP_RX_LOCK(fp) mtx_lock(&fp->rx_mtx) #define BXE_FP_RX_UNLOCK(fp) mtx_unlock(&fp->rx_mtx) From owner-svn-src-all@freebsd.org Tue Jul 28 19:58:37 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9CD0E9AD1E8; Tue, 28 Jul 2015 19:58:37 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8D10791D; Tue, 28 Jul 2015 19:58:37 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SJwbTX002399; Tue, 28 Jul 2015 19:58:37 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SJwbT0002397; Tue, 28 Jul 2015 19:58:37 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201507281958.t6SJwbT0002397@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 28 Jul 2015 19:58:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285974 - head/usr.bin/patch X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 19:58:37 -0000 Author: delphij Date: Tue Jul 28 19:58:36 2015 New Revision: 285974 URL: https://svnweb.freebsd.org/changeset/base/285974 Log: Fix shell injection vulnerability in patch(1) and drop SCCS support by replacing system() with execve(). Future revisions may remove the functionality completely. Obtained from: Bitrig Security: CVE-2015-1416 Modified: head/usr.bin/patch/common.h head/usr.bin/patch/inp.c Modified: head/usr.bin/patch/common.h ============================================================================== --- head/usr.bin/patch/common.h Tue Jul 28 19:15:44 2015 (r285973) +++ head/usr.bin/patch/common.h Tue Jul 28 19:58:36 2015 (r285974) @@ -43,12 +43,10 @@ #define LINENUM_MAX LONG_MAX #define SCCSPREFIX "s." -#define GET "get -e %s" -#define SCCSDIFF "get -p %s | diff - %s >/dev/null" #define RCSSUFFIX ",v" -#define CHECKOUT "co -l %s" -#define RCSDIFF "rcsdiff %s > /dev/null" +#define CHECKOUT "/usr/bin/co" +#define RCSDIFF "/usr/bin/rcsdiff" #define ORIGEXT ".orig" #define REJEXT ".rej" Modified: head/usr.bin/patch/inp.c ============================================================================== --- head/usr.bin/patch/inp.c Tue Jul 28 19:15:44 2015 (r285973) +++ head/usr.bin/patch/inp.c Tue Jul 28 19:58:36 2015 (r285974) @@ -31,8 +31,10 @@ #include #include #include +#include #include +#include #include #include #include @@ -133,12 +135,14 @@ reallocate_lines(size_t *lines_allocated static bool plan_a(const char *filename) { - int ifd, statfailed; + int ifd, statfailed, devnull, pstat; char *p, *s, lbuf[INITLINELEN]; struct stat filestat; ptrdiff_t sz; size_t i; size_t iline, lines_allocated; + pid_t pid; + char *argp[4] = {NULL}; #ifdef DEBUGGING if (debug & 8) @@ -166,13 +170,14 @@ plan_a(const char *filename) } if (statfailed && check_only) fatal("%s not found, -C mode, can't probe further\n", filename); - /* For nonexistent or read-only files, look for RCS or SCCS versions. */ + /* For nonexistent or read-only files, look for RCS versions. */ + if (statfailed || /* No one can write to it. */ (filestat.st_mode & 0222) == 0 || /* I can't write to it. */ ((filestat.st_mode & 0022) == 0 && filestat.st_uid != getuid())) { - const char *cs = NULL, *filebase, *filedir; + char *filebase, *filedir; struct stat cstat; char *tmp_filename1, *tmp_filename2; @@ -180,43 +185,26 @@ plan_a(const char *filename) tmp_filename2 = strdup(filename); if (tmp_filename1 == NULL || tmp_filename2 == NULL) fatal("strdupping filename"); + filebase = basename(tmp_filename1); filedir = dirname(tmp_filename2); - /* Leave room in lbuf for the diff command. */ - s = lbuf + 20; - #define try(f, a1, a2, a3) \ - (snprintf(s, buf_size - 20, f, a1, a2, a3), stat(s, &cstat) == 0) - - if (try("%s/RCS/%s%s", filedir, filebase, RCSSUFFIX) || - try("%s/RCS/%s%s", filedir, filebase, "") || - try("%s/%s%s", filedir, filebase, RCSSUFFIX)) { - snprintf(buf, buf_size, CHECKOUT, filename); - snprintf(lbuf, sizeof lbuf, RCSDIFF, filename); - cs = "RCS"; - } else if (try("%s/SCCS/%s%s", filedir, SCCSPREFIX, filebase) || - try("%s/%s%s", filedir, SCCSPREFIX, filebase)) { - snprintf(buf, buf_size, GET, s); - snprintf(lbuf, sizeof lbuf, SCCSDIFF, s, filename); - cs = "SCCS"; - } else if (statfailed) - fatal("can't find %s\n", filename); - - free(tmp_filename1); - free(tmp_filename2); + (snprintf(lbuf, sizeof(lbuf), f, a1, a2, a3), stat(lbuf, &cstat) == 0) /* * else we can't write to it but it's not under a version * control system, so just proceed. */ - if (cs) { + if (try("%s/RCS/%s%s", filedir, filebase, RCSSUFFIX) || + try("%s/RCS/%s%s", filedir, filebase, "") || + try("%s/%s%s", filedir, filebase, RCSSUFFIX)) { if (!statfailed) { if ((filestat.st_mode & 0222) != 0) /* The owner can write to it. */ fatal("file %s seems to be locked " - "by somebody else under %s\n", - filename, cs); + "by somebody else under RCS\n", + filename); /* * It might be checked out unlocked. See if * it's safe to check out the default version @@ -224,21 +212,59 @@ plan_a(const char *filename) */ if (verbose) say("Comparing file %s to default " - "%s version...\n", - filename, cs); - if (system(lbuf)) + "RCS version...\n", filename); + + switch (pid = fork()) { + case -1: + fatal("can't fork: %s\n", + strerror(errno)); + case 0: + devnull = open("/dev/null", O_RDONLY); + if (devnull == -1) { + fatal("can't open /dev/null: %s", + strerror(errno)); + } + (void)dup2(devnull, STDOUT_FILENO); + argp[0] = strdup(RCSDIFF); + argp[1] = strdup(filename); + execv(RCSDIFF, argp); + exit(127); + } + pid = waitpid(pid, &pstat, 0); + if (pid == -1 || WEXITSTATUS(pstat) != 0) { fatal("can't check out file %s: " - "differs from default %s version\n", - filename, cs); + "differs from default RCS version\n", + filename); + } } + if (verbose) - say("Checking out file %s from %s...\n", - filename, cs); - if (system(buf) || stat(filename, &filestat)) - fatal("can't check out file %s from %s\n", - filename, cs); + say("Checking out file %s from RCS...\n", + filename); + + switch (pid = fork()) { + case -1: + fatal("can't fork: %s\n", strerror(errno)); + case 0: + argp[0] = strdup(CHECKOUT); + argp[1] = strdup("-l"); + argp[2] = strdup(filename); + execv(CHECKOUT, argp); + exit(127); + } + pid = waitpid(pid, &pstat, 0); + if (pid == -1 || WEXITSTATUS(pstat) != 0 || + stat(filename, &filestat)) { + fatal("can't check out file %s from RCS\n", + filename); + } + } else if (statfailed) { + fatal("can't find %s\n", filename); } + free(tmp_filename1); + free(tmp_filename2); } + filemode = filestat.st_mode; if (!S_ISREG(filemode)) fatal("%s is not a normal file--can't patch\n", filename); From owner-svn-src-all@freebsd.org Tue Jul 28 19:58:40 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 979D99AD209; Tue, 28 Jul 2015 19:58:40 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8737693B; Tue, 28 Jul 2015 19:58:40 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SJwex8002448; Tue, 28 Jul 2015 19:58:40 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SJwdLp002446; Tue, 28 Jul 2015 19:58:39 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201507281958.t6SJwdLp002446@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 28 Jul 2015 19:58:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285975 - head/crypto/openssh X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 19:58:40 -0000 Author: delphij Date: Tue Jul 28 19:58:38 2015 New Revision: 285975 URL: https://svnweb.freebsd.org/changeset/base/285975 Log: Fix multiple OpenSSH vulnerabilities. Security: CVE-2014-2653 Security: CVE-2015-5600 Security: FreeBSD-SA-15:16.openssh Modified: head/crypto/openssh/auth2-chall.c head/crypto/openssh/sshconnect.c Modified: head/crypto/openssh/auth2-chall.c ============================================================================== --- head/crypto/openssh/auth2-chall.c Tue Jul 28 19:58:36 2015 (r285974) +++ head/crypto/openssh/auth2-chall.c Tue Jul 28 19:58:38 2015 (r285975) @@ -82,6 +82,7 @@ struct KbdintAuthctxt void *ctxt; KbdintDevice *device; u_int nreq; + u_int devices_done; }; #ifdef USE_PAM @@ -168,11 +169,15 @@ kbdint_next_device(Authctxt *authctxt, K if (len == 0) break; for (i = 0; devices[i]; i++) { - if (!auth2_method_allowed(authctxt, + if ((kbdintctxt->devices_done & (1 << i)) != 0 || + !auth2_method_allowed(authctxt, "keyboard-interactive", devices[i]->name)) continue; - if (strncmp(kbdintctxt->devices, devices[i]->name, len) == 0) + if (strncmp(kbdintctxt->devices, devices[i]->name, + len) == 0) { kbdintctxt->device = devices[i]; + kbdintctxt->devices_done |= 1 << i; + } } t = kbdintctxt->devices; kbdintctxt->devices = t[len] ? xstrdup(t+len+1) : NULL; Modified: head/crypto/openssh/sshconnect.c ============================================================================== --- head/crypto/openssh/sshconnect.c Tue Jul 28 19:58:36 2015 (r285974) +++ head/crypto/openssh/sshconnect.c Tue Jul 28 19:58:38 2015 (r285975) @@ -1247,29 +1247,39 @@ verify_host_key(char *host, struct socka { int flags = 0; char *fp; + Key *plain = NULL; fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); debug("Server host key: %s %s", key_type(host_key), fp); free(fp); - /* XXX certs are not yet supported for DNS */ - if (!key_is_cert(host_key) && options.verify_host_key_dns && - verify_host_key_dns(host, hostaddr, host_key, &flags) == 0) { - if (flags & DNS_VERIFY_FOUND) { - - if (options.verify_host_key_dns == 1 && - flags & DNS_VERIFY_MATCH && - flags & DNS_VERIFY_SECURE) - return 0; - - if (flags & DNS_VERIFY_MATCH) { - matching_host_key_dns = 1; - } else { - warn_changed_key(host_key); - error("Update the SSHFP RR in DNS with the new " - "host key to get rid of this message."); + if (options.verify_host_key_dns) { + /* + * XXX certs are not yet supported for DNS, so downgrade + * them and try the plain key. + */ + plain = key_from_private(host_key); + if (key_is_cert(plain)) + key_drop_cert(plain); + if (verify_host_key_dns(host, hostaddr, plain, &flags) == 0) { + if (flags & DNS_VERIFY_FOUND) { + if (options.verify_host_key_dns == 1 && + flags & DNS_VERIFY_MATCH && + flags & DNS_VERIFY_SECURE) { + key_free(plain); + return 0; + } + if (flags & DNS_VERIFY_MATCH) { + matching_host_key_dns = 1; + } else { + warn_changed_key(plain); + error("Update the SSHFP RR in DNS " + "with the new host key to get rid " + "of this message."); + } } } + key_free(plain); } return check_host_key(host, hostaddr, options.port, host_key, RDRW, From owner-svn-src-all@freebsd.org Tue Jul 28 19:58:48 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55FB79AD22E; Tue, 28 Jul 2015 19:58:48 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 299DFB0A; Tue, 28 Jul 2015 19:58:48 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SJwmHa002502; Tue, 28 Jul 2015 19:58:48 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SJwj2m002495; Tue, 28 Jul 2015 19:58:45 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201507281958.t6SJwj2m002495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 28 Jul 2015 19:58:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285976 - in stable/10: crypto/openssh sys/netinet usr.bin/patch X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 19:58:48 -0000 Author: delphij Date: Tue Jul 28 19:58:44 2015 New Revision: 285976 URL: https://svnweb.freebsd.org/changeset/base/285976 Log: Fix patch(1) shell injection vulnerability. [SA-15:14] Fix resource exhaustion in TCP reassembly. [SA-15:15] Fix OpenSSH multiple vulnerabilities. [SA-15:16] Modified: stable/10/crypto/openssh/auth2-chall.c stable/10/crypto/openssh/sshconnect.c stable/10/sys/netinet/tcp_reass.c stable/10/sys/netinet/tcp_subr.c stable/10/sys/netinet/tcp_var.h stable/10/usr.bin/patch/common.h stable/10/usr.bin/patch/inp.c Modified: stable/10/crypto/openssh/auth2-chall.c ============================================================================== --- stable/10/crypto/openssh/auth2-chall.c Tue Jul 28 19:58:38 2015 (r285975) +++ stable/10/crypto/openssh/auth2-chall.c Tue Jul 28 19:58:44 2015 (r285976) @@ -82,6 +82,7 @@ struct KbdintAuthctxt void *ctxt; KbdintDevice *device; u_int nreq; + u_int devices_done; }; #ifdef USE_PAM @@ -168,11 +169,15 @@ kbdint_next_device(Authctxt *authctxt, K if (len == 0) break; for (i = 0; devices[i]; i++) { - if (!auth2_method_allowed(authctxt, + if ((kbdintctxt->devices_done & (1 << i)) != 0 || + !auth2_method_allowed(authctxt, "keyboard-interactive", devices[i]->name)) continue; - if (strncmp(kbdintctxt->devices, devices[i]->name, len) == 0) + if (strncmp(kbdintctxt->devices, devices[i]->name, + len) == 0) { kbdintctxt->device = devices[i]; + kbdintctxt->devices_done |= 1 << i; + } } t = kbdintctxt->devices; kbdintctxt->devices = t[len] ? xstrdup(t+len+1) : NULL; Modified: stable/10/crypto/openssh/sshconnect.c ============================================================================== --- stable/10/crypto/openssh/sshconnect.c Tue Jul 28 19:58:38 2015 (r285975) +++ stable/10/crypto/openssh/sshconnect.c Tue Jul 28 19:58:44 2015 (r285976) @@ -1246,29 +1246,39 @@ verify_host_key(char *host, struct socka { int flags = 0; char *fp; + Key *plain = NULL; fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); debug("Server host key: %s %s", key_type(host_key), fp); free(fp); - /* XXX certs are not yet supported for DNS */ - if (!key_is_cert(host_key) && options.verify_host_key_dns && - verify_host_key_dns(host, hostaddr, host_key, &flags) == 0) { - if (flags & DNS_VERIFY_FOUND) { - - if (options.verify_host_key_dns == 1 && - flags & DNS_VERIFY_MATCH && - flags & DNS_VERIFY_SECURE) - return 0; - - if (flags & DNS_VERIFY_MATCH) { - matching_host_key_dns = 1; - } else { - warn_changed_key(host_key); - error("Update the SSHFP RR in DNS with the new " - "host key to get rid of this message."); + if (options.verify_host_key_dns) { + /* + * XXX certs are not yet supported for DNS, so downgrade + * them and try the plain key. + */ + plain = key_from_private(host_key); + if (key_is_cert(plain)) + key_drop_cert(plain); + if (verify_host_key_dns(host, hostaddr, plain, &flags) == 0) { + if (flags & DNS_VERIFY_FOUND) { + if (options.verify_host_key_dns == 1 && + flags & DNS_VERIFY_MATCH && + flags & DNS_VERIFY_SECURE) { + key_free(plain); + return 0; + } + if (flags & DNS_VERIFY_MATCH) { + matching_host_key_dns = 1; + } else { + warn_changed_key(plain); + error("Update the SSHFP RR in DNS " + "with the new host key to get rid " + "of this message."); + } } } + key_free(plain); } return check_host_key(host, hostaddr, options.port, host_key, RDRW, Modified: stable/10/sys/netinet/tcp_reass.c ============================================================================== --- stable/10/sys/netinet/tcp_reass.c Tue Jul 28 19:58:38 2015 (r285975) +++ stable/10/sys/netinet/tcp_reass.c Tue Jul 28 19:58:44 2015 (r285976) @@ -79,25 +79,22 @@ static int tcp_reass_sysctl_qsize(SYSCTL static SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0, "TCP Segment Reassembly Queue"); -static VNET_DEFINE(int, tcp_reass_maxseg) = 0; -#define V_tcp_reass_maxseg VNET(tcp_reass_maxseg) -SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN, - &VNET_NAME(tcp_reass_maxseg), 0, +static int tcp_reass_maxseg = 0; +SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN, + &tcp_reass_maxseg, 0, "Global maximum number of TCP Segments in Reassembly Queue"); -SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments, +SYSCTL_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments, (CTLTYPE_INT | CTLFLAG_RD), NULL, 0, &tcp_reass_sysctl_qsize, "I", "Global number of TCP Segments currently in Reassembly Queue"); -static VNET_DEFINE(int, tcp_reass_overflows) = 0; -#define V_tcp_reass_overflows VNET(tcp_reass_overflows) -SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, overflows, +static int tcp_reass_overflows = 0; +SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, overflows, CTLFLAG_RD, - &VNET_NAME(tcp_reass_overflows), 0, + &tcp_reass_overflows, 0, "Global number of TCP Segment Reassembly Queue Overflows"); -static VNET_DEFINE(uma_zone_t, tcp_reass_zone); -#define V_tcp_reass_zone VNET(tcp_reass_zone) +static uma_zone_t tcp_reass_zone; /* Initialize TCP reassembly queue */ static void @@ -105,36 +102,27 @@ tcp_reass_zone_change(void *tag) { /* Set the zone limit and read back the effective value. */ - V_tcp_reass_maxseg = nmbclusters / 16; - V_tcp_reass_maxseg = uma_zone_set_max(V_tcp_reass_zone, - V_tcp_reass_maxseg); + tcp_reass_maxseg = nmbclusters / 16; + tcp_reass_maxseg = uma_zone_set_max(tcp_reass_zone, + tcp_reass_maxseg); } void -tcp_reass_init(void) +tcp_reass_global_init(void) { - V_tcp_reass_maxseg = nmbclusters / 16; + tcp_reass_maxseg = nmbclusters / 16; TUNABLE_INT_FETCH("net.inet.tcp.reass.maxsegments", - &V_tcp_reass_maxseg); - V_tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), + &tcp_reass_maxseg); + tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); /* Set the zone limit and read back the effective value. */ - V_tcp_reass_maxseg = uma_zone_set_max(V_tcp_reass_zone, - V_tcp_reass_maxseg); + tcp_reass_maxseg = uma_zone_set_max(tcp_reass_zone, + tcp_reass_maxseg); EVENTHANDLER_REGISTER(nmbclusters_change, tcp_reass_zone_change, NULL, EVENTHANDLER_PRI_ANY); } -#ifdef VIMAGE -void -tcp_reass_destroy(void) -{ - - uma_zdestroy(V_tcp_reass_zone); -} -#endif - void tcp_reass_flush(struct tcpcb *tp) { @@ -145,7 +133,7 @@ tcp_reass_flush(struct tcpcb *tp) while ((qe = LIST_FIRST(&tp->t_segq)) != NULL) { LIST_REMOVE(qe, tqe_q); m_freem(qe->tqe_m); - uma_zfree(V_tcp_reass_zone, qe); + uma_zfree(tcp_reass_zone, qe); tp->t_segqlen--; } @@ -159,7 +147,7 @@ tcp_reass_sysctl_qsize(SYSCTL_HANDLER_AR { int qsize; - qsize = uma_zone_get_cur(V_tcp_reass_zone); + qsize = uma_zone_get_cur(tcp_reass_zone); return (sysctl_handle_int(oidp, &qsize, 0, req)); } @@ -207,7 +195,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd */ if ((th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) && tp->t_segqlen >= (so->so_rcv.sb_hiwat / tp->t_maxseg) + 1) { - V_tcp_reass_overflows++; + tcp_reass_overflows++; TCPSTAT_INC(tcps_rcvmemdrop); m_freem(m); *tlenp = 0; @@ -226,7 +214,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd * Use a temporary structure on the stack for the missing segment * when the zone is exhausted. Otherwise we may get stuck. */ - te = uma_zalloc(V_tcp_reass_zone, M_NOWAIT); + te = uma_zalloc(tcp_reass_zone, M_NOWAIT); if (te == NULL) { if (th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) { TCPSTAT_INC(tcps_rcvmemdrop); @@ -277,7 +265,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd TCPSTAT_ADD(tcps_rcvdupbyte, *tlenp); m_freem(m); if (te != &tqs) - uma_zfree(V_tcp_reass_zone, te); + uma_zfree(tcp_reass_zone, te); tp->t_segqlen--; /* * Try to present any queued data @@ -314,7 +302,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd nq = LIST_NEXT(q, tqe_q); LIST_REMOVE(q, tqe_q); m_freem(q->tqe_m); - uma_zfree(V_tcp_reass_zone, q); + uma_zfree(tcp_reass_zone, q); tp->t_segqlen--; q = nq; } @@ -353,7 +341,7 @@ present: else sbappendstream_locked(&so->so_rcv, q->tqe_m); if (q != &tqs) - uma_zfree(V_tcp_reass_zone, q); + uma_zfree(tcp_reass_zone, q); tp->t_segqlen--; q = nq; } while (q && q->tqe_th->th_seq == tp->rcv_nxt); Modified: stable/10/sys/netinet/tcp_subr.c ============================================================================== --- stable/10/sys/netinet/tcp_subr.c Tue Jul 28 19:58:38 2015 (r285975) +++ stable/10/sys/netinet/tcp_subr.c Tue Jul 28 19:58:44 2015 (r285976) @@ -376,7 +376,6 @@ tcp_init(void) tcp_tw_init(); syncache_init(); tcp_hc_init(); - tcp_reass_init(); TUNABLE_INT_FETCH("net.inet.tcp.sack.enable", &V_tcp_do_sack); V_sack_hole_zone = uma_zcreate("sackhole", sizeof(struct sackhole), @@ -386,6 +385,8 @@ tcp_init(void) if (!IS_DEFAULT_VNET(curvnet)) return; + tcp_reass_global_init(); + /* XXX virtualize those bellow? */ tcp_delacktime = TCPTV_DELACK; tcp_keepinit = TCPTV_KEEP_INIT; @@ -433,7 +434,6 @@ void tcp_destroy(void) { - tcp_reass_destroy(); tcp_hc_destroy(); syncache_destroy(); tcp_tw_destroy(); Modified: stable/10/sys/netinet/tcp_var.h ============================================================================== --- stable/10/sys/netinet/tcp_var.h Tue Jul 28 19:58:38 2015 (r285975) +++ stable/10/sys/netinet/tcp_var.h Tue Jul 28 19:58:44 2015 (r285976) @@ -679,11 +679,8 @@ char *tcp_log_addrs(struct in_conninfo * char *tcp_log_vain(struct in_conninfo *, struct tcphdr *, void *, const void *); int tcp_reass(struct tcpcb *, struct tcphdr *, int *, struct mbuf *); -void tcp_reass_init(void); +void tcp_reass_global_init(void); void tcp_reass_flush(struct tcpcb *); -#ifdef VIMAGE -void tcp_reass_destroy(void); -#endif void tcp_input(struct mbuf *, int); u_long tcp_maxmtu(struct in_conninfo *, struct tcp_ifcap *); u_long tcp_maxmtu6(struct in_conninfo *, struct tcp_ifcap *); Modified: stable/10/usr.bin/patch/common.h ============================================================================== --- stable/10/usr.bin/patch/common.h Tue Jul 28 19:58:38 2015 (r285975) +++ stable/10/usr.bin/patch/common.h Tue Jul 28 19:58:44 2015 (r285976) @@ -43,12 +43,10 @@ #define LINENUM_MAX LONG_MAX #define SCCSPREFIX "s." -#define GET "get -e %s" -#define SCCSDIFF "get -p %s | diff - %s >/dev/null" #define RCSSUFFIX ",v" -#define CHECKOUT "co -l %s" -#define RCSDIFF "rcsdiff %s > /dev/null" +#define CHECKOUT "/usr/bin/co" +#define RCSDIFF "/usr/bin/rcsdiff" #define ORIGEXT ".orig" #define REJEXT ".rej" Modified: stable/10/usr.bin/patch/inp.c ============================================================================== --- stable/10/usr.bin/patch/inp.c Tue Jul 28 19:58:38 2015 (r285975) +++ stable/10/usr.bin/patch/inp.c Tue Jul 28 19:58:44 2015 (r285976) @@ -31,8 +31,10 @@ #include #include #include +#include #include +#include #include #include #include @@ -132,12 +134,14 @@ reallocate_lines(size_t *lines_allocated static bool plan_a(const char *filename) { - int ifd, statfailed; + int ifd, statfailed, devnull, pstat; char *p, *s, lbuf[INITLINELEN]; struct stat filestat; ptrdiff_t sz; size_t i; size_t iline, lines_allocated; + pid_t pid; + char *argp[4] = {NULL}; #ifdef DEBUGGING if (debug & 8) @@ -165,13 +169,14 @@ plan_a(const char *filename) } if (statfailed && check_only) fatal("%s not found, -C mode, can't probe further\n", filename); - /* For nonexistent or read-only files, look for RCS or SCCS versions. */ + /* For nonexistent or read-only files, look for RCS versions. */ + if (statfailed || /* No one can write to it. */ (filestat.st_mode & 0222) == 0 || /* I can't write to it. */ ((filestat.st_mode & 0022) == 0 && filestat.st_uid != getuid())) { - const char *cs = NULL, *filebase, *filedir; + char *filebase, *filedir; struct stat cstat; char *tmp_filename1, *tmp_filename2; @@ -179,43 +184,26 @@ plan_a(const char *filename) tmp_filename2 = strdup(filename); if (tmp_filename1 == NULL || tmp_filename2 == NULL) fatal("strdupping filename"); + filebase = basename(tmp_filename1); filedir = dirname(tmp_filename2); - /* Leave room in lbuf for the diff command. */ - s = lbuf + 20; - #define try(f, a1, a2, a3) \ - (snprintf(s, buf_size - 20, f, a1, a2, a3), stat(s, &cstat) == 0) - - if (try("%s/RCS/%s%s", filedir, filebase, RCSSUFFIX) || - try("%s/RCS/%s%s", filedir, filebase, "") || - try("%s/%s%s", filedir, filebase, RCSSUFFIX)) { - snprintf(buf, buf_size, CHECKOUT, filename); - snprintf(lbuf, sizeof lbuf, RCSDIFF, filename); - cs = "RCS"; - } else if (try("%s/SCCS/%s%s", filedir, SCCSPREFIX, filebase) || - try("%s/%s%s", filedir, SCCSPREFIX, filebase)) { - snprintf(buf, buf_size, GET, s); - snprintf(lbuf, sizeof lbuf, SCCSDIFF, s, filename); - cs = "SCCS"; - } else if (statfailed) - fatal("can't find %s\n", filename); - - free(tmp_filename1); - free(tmp_filename2); + (snprintf(lbuf, sizeof(lbuf), f, a1, a2, a3), stat(lbuf, &cstat) == 0) /* * else we can't write to it but it's not under a version * control system, so just proceed. */ - if (cs) { + if (try("%s/RCS/%s%s", filedir, filebase, RCSSUFFIX) || + try("%s/RCS/%s%s", filedir, filebase, "") || + try("%s/%s%s", filedir, filebase, RCSSUFFIX)) { if (!statfailed) { if ((filestat.st_mode & 0222) != 0) /* The owner can write to it. */ fatal("file %s seems to be locked " - "by somebody else under %s\n", - filename, cs); + "by somebody else under RCS\n", + filename); /* * It might be checked out unlocked. See if * it's safe to check out the default version @@ -223,21 +211,59 @@ plan_a(const char *filename) */ if (verbose) say("Comparing file %s to default " - "%s version...\n", - filename, cs); - if (system(lbuf)) + "RCS version...\n", filename); + + switch (pid = fork()) { + case -1: + fatal("can't fork: %s\n", + strerror(errno)); + case 0: + devnull = open("/dev/null", O_RDONLY); + if (devnull == -1) { + fatal("can't open /dev/null: %s", + strerror(errno)); + } + (void)dup2(devnull, STDOUT_FILENO); + argp[0] = strdup(RCSDIFF); + argp[1] = strdup(filename); + execv(RCSDIFF, argp); + exit(127); + } + pid = waitpid(pid, &pstat, 0); + if (pid == -1 || WEXITSTATUS(pstat) != 0) { fatal("can't check out file %s: " - "differs from default %s version\n", - filename, cs); + "differs from default RCS version\n", + filename); + } } + if (verbose) - say("Checking out file %s from %s...\n", - filename, cs); - if (system(buf) || stat(filename, &filestat)) - fatal("can't check out file %s from %s\n", - filename, cs); + say("Checking out file %s from RCS...\n", + filename); + + switch (pid = fork()) { + case -1: + fatal("can't fork: %s\n", strerror(errno)); + case 0: + argp[0] = strdup(CHECKOUT); + argp[1] = strdup("-l"); + argp[2] = strdup(filename); + execv(CHECKOUT, argp); + exit(127); + } + pid = waitpid(pid, &pstat, 0); + if (pid == -1 || WEXITSTATUS(pstat) != 0 || + stat(filename, &filestat)) { + fatal("can't check out file %s from RCS\n", + filename); + } + } else if (statfailed) { + fatal("can't find %s\n", filename); } + free(tmp_filename1); + free(tmp_filename2); } + filemode = filestat.st_mode; if (!S_ISREG(filemode)) fatal("%s is not a normal file--can't patch\n", filename); From owner-svn-src-all@freebsd.org Tue Jul 28 19:59:00 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DBB09AD299; Tue, 28 Jul 2015 19:59:00 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 23416CDC; Tue, 28 Jul 2015 19:59:00 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SJx0GH002572; Tue, 28 Jul 2015 19:59:00 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SJwwI7002565; Tue, 28 Jul 2015 19:58:58 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201507281958.t6SJwwI7002565@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 28 Jul 2015 19:58:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r285977 - in stable: 8/contrib/bind9/lib/dns 8/crypto/openssh 8/sys/netinet 9/contrib/bind9/lib/dns 9/crypto/openssh 9/sys/netinet X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 19:59:00 -0000 Author: delphij Date: Tue Jul 28 19:58:54 2015 New Revision: 285977 URL: https://svnweb.freebsd.org/changeset/base/285977 Log: Fix resource exhaustion in TCP reassembly. [SA-15:15] Fix OpenSSH multiple vulnerabilities. [SA-15:16] Fix BIND remote denial of service vulnerability. [SA-15:17] Modified: stable/8/contrib/bind9/lib/dns/tkey.c stable/8/crypto/openssh/auth2-chall.c stable/8/crypto/openssh/sshconnect.c stable/8/sys/netinet/tcp_reass.c stable/8/sys/netinet/tcp_subr.c stable/8/sys/netinet/tcp_var.h Changes in other areas also in this revision: Modified: stable/9/contrib/bind9/lib/dns/tkey.c stable/9/crypto/openssh/auth2-chall.c stable/9/crypto/openssh/sshconnect.c stable/9/sys/netinet/tcp_reass.c stable/9/sys/netinet/tcp_subr.c stable/9/sys/netinet/tcp_var.h Modified: stable/8/contrib/bind9/lib/dns/tkey.c ============================================================================== --- stable/8/contrib/bind9/lib/dns/tkey.c Tue Jul 28 19:58:44 2015 (r285976) +++ stable/8/contrib/bind9/lib/dns/tkey.c Tue Jul 28 19:58:54 2015 (r285977) @@ -650,6 +650,7 @@ dns_tkey_processquery(dns_message_t *msg * Try the answer section, since that's where Win2000 * puts it. */ + name = NULL; if (dns_message_findname(msg, DNS_SECTION_ANSWER, qname, dns_rdatatype_tkey, 0, &name, &tkeyset) != ISC_R_SUCCESS) { Modified: stable/8/crypto/openssh/auth2-chall.c ============================================================================== --- stable/8/crypto/openssh/auth2-chall.c Tue Jul 28 19:58:44 2015 (r285976) +++ stable/8/crypto/openssh/auth2-chall.c Tue Jul 28 19:58:54 2015 (r285977) @@ -82,6 +82,7 @@ struct KbdintAuthctxt void *ctxt; KbdintDevice *device; u_int nreq; + u_int devices_done; }; #ifdef USE_PAM @@ -169,9 +170,14 @@ kbdint_next_device(KbdintAuthctxt *kbdin if (len == 0) break; - for (i = 0; devices[i]; i++) - if (strncmp(kbdintctxt->devices, devices[i]->name, len) == 0) + for (i = 0; devices[i]; i++) { + if ((kbdintctxt->devices_done & (1 << i)) != 0) + continue; + if (strncmp(kbdintctxt->devices, devices[i]->name, len) == 0) { kbdintctxt->device = devices[i]; + kbdintctxt->devices_done |= 1 << i; + } + } t = kbdintctxt->devices; kbdintctxt->devices = t[len] ? xstrdup(t+len+1) : NULL; xfree(t); Modified: stable/8/crypto/openssh/sshconnect.c ============================================================================== --- stable/8/crypto/openssh/sshconnect.c Tue Jul 28 19:58:44 2015 (r285976) +++ stable/8/crypto/openssh/sshconnect.c Tue Jul 28 19:58:54 2015 (r285977) @@ -1141,29 +1141,39 @@ verify_host_key(char *host, struct socka { int flags = 0; char *fp; + Key *plain = NULL; fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); debug("Server host key: %s %s", key_type(host_key), fp); xfree(fp); - /* XXX certs are not yet supported for DNS */ - if (!key_is_cert(host_key) && options.verify_host_key_dns && - verify_host_key_dns(host, hostaddr, host_key, &flags) == 0) { - if (flags & DNS_VERIFY_FOUND) { - - if (options.verify_host_key_dns == 1 && - flags & DNS_VERIFY_MATCH && - flags & DNS_VERIFY_SECURE) - return 0; - - if (flags & DNS_VERIFY_MATCH) { - matching_host_key_dns = 1; - } else { - warn_changed_key(host_key); - error("Update the SSHFP RR in DNS with the new " - "host key to get rid of this message."); + if (options.verify_host_key_dns) { + /* + * XXX certs are not yet supported for DNS, so downgrade + * them and try the plain key. + */ + plain = key_from_private(host_key); + if (key_is_cert(plain)) + key_drop_cert(plain); + if (verify_host_key_dns(host, hostaddr, plain, &flags) == 0) { + if (flags & DNS_VERIFY_FOUND) { + if (options.verify_host_key_dns == 1 && + flags & DNS_VERIFY_MATCH && + flags & DNS_VERIFY_SECURE) { + key_free(plain); + return 0; + } + if (flags & DNS_VERIFY_MATCH) { + matching_host_key_dns = 1; + } else { + warn_changed_key(plain); + error("Update the SSHFP RR in DNS " + "with the new host key to get rid " + "of this message."); + } } } + key_free(plain); } return check_host_key(host, hostaddr, options.port, host_key, RDRW, Modified: stable/8/sys/netinet/tcp_reass.c ============================================================================== --- stable/8/sys/netinet/tcp_reass.c Tue Jul 28 19:58:44 2015 (r285976) +++ stable/8/sys/netinet/tcp_reass.c Tue Jul 28 19:58:54 2015 (r285977) @@ -80,62 +80,49 @@ static int tcp_reass_sysctl_qsize(SYSCTL SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0, "TCP Segment Reassembly Queue"); -static VNET_DEFINE(int, tcp_reass_maxseg) = 0; -#define V_tcp_reass_maxseg VNET(tcp_reass_maxseg) +static int tcp_reass_maxseg = 0; SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLTYPE_INT | CTLFLAG_RDTUN, - &VNET_NAME(tcp_reass_maxseg), 0, &tcp_reass_sysctl_maxseg, "I", + &tcp_reass_maxseg, 0, &tcp_reass_sysctl_maxseg, "I", "Global maximum number of TCP Segments in Reassembly Queue"); -static VNET_DEFINE(int, tcp_reass_qsize) = 0; -#define V_tcp_reass_qsize VNET(tcp_reass_qsize) -SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments, +static int tcp_reass_qsize = 0; +SYSCTL_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments, CTLTYPE_INT | CTLFLAG_RD, - &VNET_NAME(tcp_reass_qsize), 0, &tcp_reass_sysctl_qsize, "I", + &tcp_reass_qsize, 0, &tcp_reass_sysctl_qsize, "I", "Global number of TCP Segments currently in Reassembly Queue"); -static VNET_DEFINE(int, tcp_reass_overflows) = 0; -#define V_tcp_reass_overflows VNET(tcp_reass_overflows) -SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, overflows, +static int tcp_reass_overflows = 0; +SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, overflows, CTLTYPE_INT | CTLFLAG_RD, - &VNET_NAME(tcp_reass_overflows), 0, + &tcp_reass_overflows, 0, "Global number of TCP Segment Reassembly Queue Overflows"); -static VNET_DEFINE(uma_zone_t, tcp_reass_zone); -#define V_tcp_reass_zone VNET(tcp_reass_zone) +static uma_zone_t tcp_reass_zone; /* Initialize TCP reassembly queue */ static void tcp_reass_zone_change(void *tag) { - V_tcp_reass_maxseg = nmbclusters / 16; - uma_zone_set_max(V_tcp_reass_zone, V_tcp_reass_maxseg); + tcp_reass_maxseg = nmbclusters / 16; + uma_zone_set_max(tcp_reass_zone, tcp_reass_maxseg); } void -tcp_reass_init(void) +tcp_reass_global_init(void) { - V_tcp_reass_maxseg = nmbclusters / 16; + tcp_reass_maxseg = nmbclusters / 16; TUNABLE_INT_FETCH("net.inet.tcp.reass.maxsegments", - &V_tcp_reass_maxseg); - V_tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), + &tcp_reass_maxseg); + tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); - uma_zone_set_max(V_tcp_reass_zone, V_tcp_reass_maxseg); + uma_zone_set_max(tcp_reass_zone, tcp_reass_maxseg); EVENTHANDLER_REGISTER(nmbclusters_change, tcp_reass_zone_change, NULL, EVENTHANDLER_PRI_ANY); } -#ifdef VIMAGE -void -tcp_reass_destroy(void) -{ - - uma_zdestroy(V_tcp_reass_zone); -} -#endif - void tcp_reass_flush(struct tcpcb *tp) { @@ -146,7 +133,7 @@ tcp_reass_flush(struct tcpcb *tp) while ((qe = LIST_FIRST(&tp->t_segq)) != NULL) { LIST_REMOVE(qe, tqe_q); m_freem(qe->tqe_m); - uma_zfree(V_tcp_reass_zone, qe); + uma_zfree(tcp_reass_zone, qe); tp->t_segqlen--; } @@ -158,14 +145,14 @@ tcp_reass_flush(struct tcpcb *tp) static int tcp_reass_sysctl_maxseg(SYSCTL_HANDLER_ARGS) { - V_tcp_reass_maxseg = uma_zone_get_max(V_tcp_reass_zone); + tcp_reass_maxseg = uma_zone_get_max(tcp_reass_zone); return (sysctl_handle_int(oidp, arg1, arg2, req)); } static int tcp_reass_sysctl_qsize(SYSCTL_HANDLER_ARGS) { - V_tcp_reass_qsize = uma_zone_get_cur(V_tcp_reass_zone); + tcp_reass_qsize = uma_zone_get_cur(tcp_reass_zone); return (sysctl_handle_int(oidp, arg1, arg2, req)); } @@ -213,7 +200,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd */ if ((th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) && tp->t_segqlen >= (so->so_rcv.sb_hiwat / tp->t_maxseg) + 1) { - V_tcp_reass_overflows++; + tcp_reass_overflows++; TCPSTAT_INC(tcps_rcvmemdrop); m_freem(m); *tlenp = 0; @@ -232,7 +219,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd * Use a temporary structure on the stack for the missing segment * when the zone is exhausted. Otherwise we may get stuck. */ - te = uma_zalloc(V_tcp_reass_zone, M_NOWAIT); + te = uma_zalloc(tcp_reass_zone, M_NOWAIT); if (te == NULL) { if (th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) { TCPSTAT_INC(tcps_rcvmemdrop); @@ -283,7 +270,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd TCPSTAT_ADD(tcps_rcvdupbyte, *tlenp); m_freem(m); if (te != &tqs) - uma_zfree(V_tcp_reass_zone, te); + uma_zfree(tcp_reass_zone, te); tp->t_segqlen--; /* * Try to present any queued data @@ -320,7 +307,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd nq = LIST_NEXT(q, tqe_q); LIST_REMOVE(q, tqe_q); m_freem(q->tqe_m); - uma_zfree(V_tcp_reass_zone, q); + uma_zfree(tcp_reass_zone, q); tp->t_segqlen--; q = nq; } @@ -359,7 +346,7 @@ present: else sbappendstream_locked(&so->so_rcv, q->tqe_m); if (q != &tqs) - uma_zfree(V_tcp_reass_zone, q); + uma_zfree(tcp_reass_zone, q); tp->t_segqlen--; q = nq; } while (q && q->tqe_th->th_seq == tp->rcv_nxt); Modified: stable/8/sys/netinet/tcp_subr.c ============================================================================== --- stable/8/sys/netinet/tcp_subr.c Tue Jul 28 19:58:44 2015 (r285976) +++ stable/8/sys/netinet/tcp_subr.c Tue Jul 28 19:58:54 2015 (r285977) @@ -375,7 +375,6 @@ tcp_init(void) tcp_tw_init(); syncache_init(); tcp_hc_init(); - tcp_reass_init(); TUNABLE_INT_FETCH("net.inet.tcp.sack.enable", &V_tcp_do_sack); V_sack_hole_zone = uma_zcreate("sackhole", sizeof(struct sackhole), @@ -385,6 +384,8 @@ tcp_init(void) if (!IS_DEFAULT_VNET(curvnet)) return; + tcp_reass_global_init(); + /* XXX virtualize those bellow? */ tcp_delacktime = TCPTV_DELACK; tcp_keepinit = TCPTV_KEEP_INIT; @@ -424,7 +425,6 @@ void tcp_destroy(void) { - tcp_reass_destroy(); tcp_hc_destroy(); syncache_destroy(); tcp_tw_destroy(); Modified: stable/8/sys/netinet/tcp_var.h ============================================================================== --- stable/8/sys/netinet/tcp_var.h Tue Jul 28 19:58:44 2015 (r285976) +++ stable/8/sys/netinet/tcp_var.h Tue Jul 28 19:58:54 2015 (r285977) @@ -653,11 +653,8 @@ char *tcp_log_addrs(struct in_conninfo char *tcp_log_vain(struct in_conninfo *, struct tcphdr *, void *, const void *); int tcp_reass(struct tcpcb *, struct tcphdr *, int *, struct mbuf *); -void tcp_reass_init(void); +void tcp_reass_global_init(void); void tcp_reass_flush(struct tcpcb *); -#ifdef VIMAGE -void tcp_reass_destroy(void); -#endif void tcp_input(struct mbuf *, int); u_long tcp_maxmtu(struct in_conninfo *, int *); u_long tcp_maxmtu6(struct in_conninfo *, int *); From owner-svn-src-all@freebsd.org Tue Jul 28 19:58:57 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 736229AD286; Tue, 28 Jul 2015 19:58:57 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 59067CCD; Tue, 28 Jul 2015 19:58:57 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SJwvmR002558; Tue, 28 Jul 2015 19:58:57 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SJwtiu002551; Tue, 28 Jul 2015 19:58:55 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201507281958.t6SJwtiu002551@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 28 Jul 2015 19:58:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r285977 - in stable: 8/contrib/bind9/lib/dns 8/crypto/openssh 8/sys/netinet 9/contrib/bind9/lib/dns 9/crypto/openssh 9/sys/netinet X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 19:58:57 -0000 Author: delphij Date: Tue Jul 28 19:58:54 2015 New Revision: 285977 URL: https://svnweb.freebsd.org/changeset/base/285977 Log: Fix resource exhaustion in TCP reassembly. [SA-15:15] Fix OpenSSH multiple vulnerabilities. [SA-15:16] Fix BIND remote denial of service vulnerability. [SA-15:17] Modified: stable/9/contrib/bind9/lib/dns/tkey.c stable/9/crypto/openssh/auth2-chall.c stable/9/crypto/openssh/sshconnect.c stable/9/sys/netinet/tcp_reass.c stable/9/sys/netinet/tcp_subr.c stable/9/sys/netinet/tcp_var.h Changes in other areas also in this revision: Modified: stable/8/contrib/bind9/lib/dns/tkey.c stable/8/crypto/openssh/auth2-chall.c stable/8/crypto/openssh/sshconnect.c stable/8/sys/netinet/tcp_reass.c stable/8/sys/netinet/tcp_subr.c stable/8/sys/netinet/tcp_var.h Modified: stable/9/contrib/bind9/lib/dns/tkey.c ============================================================================== --- stable/9/contrib/bind9/lib/dns/tkey.c Tue Jul 28 19:58:44 2015 (r285976) +++ stable/9/contrib/bind9/lib/dns/tkey.c Tue Jul 28 19:58:54 2015 (r285977) @@ -650,6 +650,7 @@ dns_tkey_processquery(dns_message_t *msg * Try the answer section, since that's where Win2000 * puts it. */ + name = NULL; if (dns_message_findname(msg, DNS_SECTION_ANSWER, qname, dns_rdatatype_tkey, 0, &name, &tkeyset) != ISC_R_SUCCESS) { Modified: stable/9/crypto/openssh/auth2-chall.c ============================================================================== --- stable/9/crypto/openssh/auth2-chall.c Tue Jul 28 19:58:44 2015 (r285976) +++ stable/9/crypto/openssh/auth2-chall.c Tue Jul 28 19:58:54 2015 (r285977) @@ -82,6 +82,7 @@ struct KbdintAuthctxt void *ctxt; KbdintDevice *device; u_int nreq; + u_int devices_done; }; #ifdef USE_PAM @@ -168,11 +169,15 @@ kbdint_next_device(Authctxt *authctxt, K if (len == 0) break; for (i = 0; devices[i]; i++) { - if (!auth2_method_allowed(authctxt, + if ((kbdintctxt->devices_done & (1 << i)) != 0 || + !auth2_method_allowed(authctxt, "keyboard-interactive", devices[i]->name)) continue; - if (strncmp(kbdintctxt->devices, devices[i]->name, len) == 0) + if (strncmp(kbdintctxt->devices, devices[i]->name, + len) == 0) { kbdintctxt->device = devices[i]; + kbdintctxt->devices_done |= 1 << i; + } } t = kbdintctxt->devices; kbdintctxt->devices = t[len] ? xstrdup(t+len+1) : NULL; Modified: stable/9/crypto/openssh/sshconnect.c ============================================================================== --- stable/9/crypto/openssh/sshconnect.c Tue Jul 28 19:58:44 2015 (r285976) +++ stable/9/crypto/openssh/sshconnect.c Tue Jul 28 19:58:54 2015 (r285977) @@ -1247,29 +1247,39 @@ verify_host_key(char *host, struct socka { int flags = 0; char *fp; + Key *plain = NULL; fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); debug("Server host key: %s %s", key_type(host_key), fp); free(fp); - /* XXX certs are not yet supported for DNS */ - if (!key_is_cert(host_key) && options.verify_host_key_dns && - verify_host_key_dns(host, hostaddr, host_key, &flags) == 0) { - if (flags & DNS_VERIFY_FOUND) { - - if (options.verify_host_key_dns == 1 && - flags & DNS_VERIFY_MATCH && - flags & DNS_VERIFY_SECURE) - return 0; - - if (flags & DNS_VERIFY_MATCH) { - matching_host_key_dns = 1; - } else { - warn_changed_key(host_key); - error("Update the SSHFP RR in DNS with the new " - "host key to get rid of this message."); + if (options.verify_host_key_dns) { + /* + * XXX certs are not yet supported for DNS, so downgrade + * them and try the plain key. + */ + plain = key_from_private(host_key); + if (key_is_cert(plain)) + key_drop_cert(plain); + if (verify_host_key_dns(host, hostaddr, plain, &flags) == 0) { + if (flags & DNS_VERIFY_FOUND) { + if (options.verify_host_key_dns == 1 && + flags & DNS_VERIFY_MATCH && + flags & DNS_VERIFY_SECURE) { + key_free(plain); + return 0; + } + if (flags & DNS_VERIFY_MATCH) { + matching_host_key_dns = 1; + } else { + warn_changed_key(plain); + error("Update the SSHFP RR in DNS " + "with the new host key to get rid " + "of this message."); + } } } + key_free(plain); } return check_host_key(host, hostaddr, options.port, host_key, RDRW, Modified: stable/9/sys/netinet/tcp_reass.c ============================================================================== --- stable/9/sys/netinet/tcp_reass.c Tue Jul 28 19:58:44 2015 (r285976) +++ stable/9/sys/netinet/tcp_reass.c Tue Jul 28 19:58:54 2015 (r285977) @@ -79,25 +79,22 @@ static int tcp_reass_sysctl_qsize(SYSCTL static SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0, "TCP Segment Reassembly Queue"); -static VNET_DEFINE(int, tcp_reass_maxseg) = 0; -#define V_tcp_reass_maxseg VNET(tcp_reass_maxseg) -SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN, - &VNET_NAME(tcp_reass_maxseg), 0, +static int tcp_reass_maxseg = 0; +SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN, + &tcp_reass_maxseg, 0, "Global maximum number of TCP Segments in Reassembly Queue"); -SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments, +SYSCTL_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments, (CTLTYPE_INT | CTLFLAG_RD), NULL, 0, &tcp_reass_sysctl_qsize, "I", "Global number of TCP Segments currently in Reassembly Queue"); -static VNET_DEFINE(int, tcp_reass_overflows) = 0; -#define V_tcp_reass_overflows VNET(tcp_reass_overflows) -SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, overflows, +static int tcp_reass_overflows = 0; +SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, overflows, CTLFLAG_RD, - &VNET_NAME(tcp_reass_overflows), 0, + &tcp_reass_overflows, 0, "Global number of TCP Segment Reassembly Queue Overflows"); -static VNET_DEFINE(uma_zone_t, tcp_reass_zone); -#define V_tcp_reass_zone VNET(tcp_reass_zone) +static uma_zone_t tcp_reass_zone; /* Initialize TCP reassembly queue */ static void @@ -105,36 +102,27 @@ tcp_reass_zone_change(void *tag) { /* Set the zone limit and read back the effective value. */ - V_tcp_reass_maxseg = nmbclusters / 16; - V_tcp_reass_maxseg = uma_zone_set_max(V_tcp_reass_zone, - V_tcp_reass_maxseg); + tcp_reass_maxseg = nmbclusters / 16; + tcp_reass_maxseg = uma_zone_set_max(tcp_reass_zone, + tcp_reass_maxseg); } void -tcp_reass_init(void) +tcp_reass_global_init(void) { - V_tcp_reass_maxseg = nmbclusters / 16; + tcp_reass_maxseg = nmbclusters / 16; TUNABLE_INT_FETCH("net.inet.tcp.reass.maxsegments", - &V_tcp_reass_maxseg); - V_tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), + &tcp_reass_maxseg); + tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); /* Set the zone limit and read back the effective value. */ - V_tcp_reass_maxseg = uma_zone_set_max(V_tcp_reass_zone, - V_tcp_reass_maxseg); + tcp_reass_maxseg = uma_zone_set_max(tcp_reass_zone, + tcp_reass_maxseg); EVENTHANDLER_REGISTER(nmbclusters_change, tcp_reass_zone_change, NULL, EVENTHANDLER_PRI_ANY); } -#ifdef VIMAGE -void -tcp_reass_destroy(void) -{ - - uma_zdestroy(V_tcp_reass_zone); -} -#endif - void tcp_reass_flush(struct tcpcb *tp) { @@ -145,7 +133,7 @@ tcp_reass_flush(struct tcpcb *tp) while ((qe = LIST_FIRST(&tp->t_segq)) != NULL) { LIST_REMOVE(qe, tqe_q); m_freem(qe->tqe_m); - uma_zfree(V_tcp_reass_zone, qe); + uma_zfree(tcp_reass_zone, qe); tp->t_segqlen--; } @@ -159,7 +147,7 @@ tcp_reass_sysctl_qsize(SYSCTL_HANDLER_AR { int qsize; - qsize = uma_zone_get_cur(V_tcp_reass_zone); + qsize = uma_zone_get_cur(tcp_reass_zone); return (sysctl_handle_int(oidp, &qsize, 0, req)); } @@ -207,7 +195,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd */ if ((th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) && tp->t_segqlen >= (so->so_rcv.sb_hiwat / tp->t_maxseg) + 1) { - V_tcp_reass_overflows++; + tcp_reass_overflows++; TCPSTAT_INC(tcps_rcvmemdrop); m_freem(m); *tlenp = 0; @@ -226,7 +214,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd * Use a temporary structure on the stack for the missing segment * when the zone is exhausted. Otherwise we may get stuck. */ - te = uma_zalloc(V_tcp_reass_zone, M_NOWAIT); + te = uma_zalloc(tcp_reass_zone, M_NOWAIT); if (te == NULL) { if (th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) { TCPSTAT_INC(tcps_rcvmemdrop); @@ -277,7 +265,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd TCPSTAT_ADD(tcps_rcvdupbyte, *tlenp); m_freem(m); if (te != &tqs) - uma_zfree(V_tcp_reass_zone, te); + uma_zfree(tcp_reass_zone, te); tp->t_segqlen--; /* * Try to present any queued data @@ -314,7 +302,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd nq = LIST_NEXT(q, tqe_q); LIST_REMOVE(q, tqe_q); m_freem(q->tqe_m); - uma_zfree(V_tcp_reass_zone, q); + uma_zfree(tcp_reass_zone, q); tp->t_segqlen--; q = nq; } @@ -353,7 +341,7 @@ present: else sbappendstream_locked(&so->so_rcv, q->tqe_m); if (q != &tqs) - uma_zfree(V_tcp_reass_zone, q); + uma_zfree(tcp_reass_zone, q); tp->t_segqlen--; q = nq; } while (q && q->tqe_th->th_seq == tp->rcv_nxt); Modified: stable/9/sys/netinet/tcp_subr.c ============================================================================== --- stable/9/sys/netinet/tcp_subr.c Tue Jul 28 19:58:44 2015 (r285976) +++ stable/9/sys/netinet/tcp_subr.c Tue Jul 28 19:58:54 2015 (r285977) @@ -314,7 +314,6 @@ tcp_init(void) tcp_tw_init(); syncache_init(); tcp_hc_init(); - tcp_reass_init(); TUNABLE_INT_FETCH("net.inet.tcp.sack.enable", &V_tcp_do_sack); V_sack_hole_zone = uma_zcreate("sackhole", sizeof(struct sackhole), @@ -324,6 +323,8 @@ tcp_init(void) if (!IS_DEFAULT_VNET(curvnet)) return; + tcp_reass_global_init(); + /* XXX virtualize those bellow? */ tcp_delacktime = TCPTV_DELACK; tcp_keepinit = TCPTV_KEEP_INIT; @@ -371,7 +372,6 @@ void tcp_destroy(void) { - tcp_reass_destroy(); tcp_hc_destroy(); syncache_destroy(); tcp_tw_destroy(); Modified: stable/9/sys/netinet/tcp_var.h ============================================================================== --- stable/9/sys/netinet/tcp_var.h Tue Jul 28 19:58:44 2015 (r285976) +++ stable/9/sys/netinet/tcp_var.h Tue Jul 28 19:58:54 2015 (r285977) @@ -684,11 +684,8 @@ char *tcp_log_addrs(struct in_conninfo * char *tcp_log_vain(struct in_conninfo *, struct tcphdr *, void *, const void *); int tcp_reass(struct tcpcb *, struct tcphdr *, int *, struct mbuf *); -void tcp_reass_init(void); +void tcp_reass_global_init(void); void tcp_reass_flush(struct tcpcb *); -#ifdef VIMAGE -void tcp_reass_destroy(void); -#endif void tcp_input(struct mbuf *, int); u_long tcp_maxmtu(struct in_conninfo *, struct tcp_ifcap *); u_long tcp_maxmtu6(struct in_conninfo *, struct tcp_ifcap *); From owner-svn-src-all@freebsd.org Tue Jul 28 19:59:08 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 32FC39AD2F1; Tue, 28 Jul 2015 19:59:08 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 00808EB9; Tue, 28 Jul 2015 19:59:07 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SJx7D0002632; Tue, 28 Jul 2015 19:59:07 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SJx5Pr002625; Tue, 28 Jul 2015 19:59:05 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201507281959.t6SJx5Pr002625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 28 Jul 2015 19:59:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r285978 - in releng/10.2: crypto/openssh sys/netinet usr.bin/patch X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 19:59:08 -0000 Author: delphij Date: Tue Jul 28 19:59:04 2015 New Revision: 285978 URL: https://svnweb.freebsd.org/changeset/base/285978 Log: Fix patch(1) shell injection vulnerability. [SA-15:14] Fix resource exhaustion in TCP reassembly. [SA-15:15] Fix OpenSSH multiple vulnerabilities. [SA-15:16] Approved by: re (so blanket) Modified: releng/10.2/crypto/openssh/auth2-chall.c releng/10.2/crypto/openssh/sshconnect.c releng/10.2/sys/netinet/tcp_reass.c releng/10.2/sys/netinet/tcp_subr.c releng/10.2/sys/netinet/tcp_var.h releng/10.2/usr.bin/patch/common.h releng/10.2/usr.bin/patch/inp.c Modified: releng/10.2/crypto/openssh/auth2-chall.c ============================================================================== --- releng/10.2/crypto/openssh/auth2-chall.c Tue Jul 28 19:58:54 2015 (r285977) +++ releng/10.2/crypto/openssh/auth2-chall.c Tue Jul 28 19:59:04 2015 (r285978) @@ -82,6 +82,7 @@ struct KbdintAuthctxt void *ctxt; KbdintDevice *device; u_int nreq; + u_int devices_done; }; #ifdef USE_PAM @@ -168,11 +169,15 @@ kbdint_next_device(Authctxt *authctxt, K if (len == 0) break; for (i = 0; devices[i]; i++) { - if (!auth2_method_allowed(authctxt, + if ((kbdintctxt->devices_done & (1 << i)) != 0 || + !auth2_method_allowed(authctxt, "keyboard-interactive", devices[i]->name)) continue; - if (strncmp(kbdintctxt->devices, devices[i]->name, len) == 0) + if (strncmp(kbdintctxt->devices, devices[i]->name, + len) == 0) { kbdintctxt->device = devices[i]; + kbdintctxt->devices_done |= 1 << i; + } } t = kbdintctxt->devices; kbdintctxt->devices = t[len] ? xstrdup(t+len+1) : NULL; Modified: releng/10.2/crypto/openssh/sshconnect.c ============================================================================== --- releng/10.2/crypto/openssh/sshconnect.c Tue Jul 28 19:58:54 2015 (r285977) +++ releng/10.2/crypto/openssh/sshconnect.c Tue Jul 28 19:59:04 2015 (r285978) @@ -1246,29 +1246,39 @@ verify_host_key(char *host, struct socka { int flags = 0; char *fp; + Key *plain = NULL; fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); debug("Server host key: %s %s", key_type(host_key), fp); free(fp); - /* XXX certs are not yet supported for DNS */ - if (!key_is_cert(host_key) && options.verify_host_key_dns && - verify_host_key_dns(host, hostaddr, host_key, &flags) == 0) { - if (flags & DNS_VERIFY_FOUND) { - - if (options.verify_host_key_dns == 1 && - flags & DNS_VERIFY_MATCH && - flags & DNS_VERIFY_SECURE) - return 0; - - if (flags & DNS_VERIFY_MATCH) { - matching_host_key_dns = 1; - } else { - warn_changed_key(host_key); - error("Update the SSHFP RR in DNS with the new " - "host key to get rid of this message."); + if (options.verify_host_key_dns) { + /* + * XXX certs are not yet supported for DNS, so downgrade + * them and try the plain key. + */ + plain = key_from_private(host_key); + if (key_is_cert(plain)) + key_drop_cert(plain); + if (verify_host_key_dns(host, hostaddr, plain, &flags) == 0) { + if (flags & DNS_VERIFY_FOUND) { + if (options.verify_host_key_dns == 1 && + flags & DNS_VERIFY_MATCH && + flags & DNS_VERIFY_SECURE) { + key_free(plain); + return 0; + } + if (flags & DNS_VERIFY_MATCH) { + matching_host_key_dns = 1; + } else { + warn_changed_key(plain); + error("Update the SSHFP RR in DNS " + "with the new host key to get rid " + "of this message."); + } } } + key_free(plain); } return check_host_key(host, hostaddr, options.port, host_key, RDRW, Modified: releng/10.2/sys/netinet/tcp_reass.c ============================================================================== --- releng/10.2/sys/netinet/tcp_reass.c Tue Jul 28 19:58:54 2015 (r285977) +++ releng/10.2/sys/netinet/tcp_reass.c Tue Jul 28 19:59:04 2015 (r285978) @@ -79,25 +79,22 @@ static int tcp_reass_sysctl_qsize(SYSCTL static SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0, "TCP Segment Reassembly Queue"); -static VNET_DEFINE(int, tcp_reass_maxseg) = 0; -#define V_tcp_reass_maxseg VNET(tcp_reass_maxseg) -SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN, - &VNET_NAME(tcp_reass_maxseg), 0, +static int tcp_reass_maxseg = 0; +SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN, + &tcp_reass_maxseg, 0, "Global maximum number of TCP Segments in Reassembly Queue"); -SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments, +SYSCTL_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments, (CTLTYPE_INT | CTLFLAG_RD), NULL, 0, &tcp_reass_sysctl_qsize, "I", "Global number of TCP Segments currently in Reassembly Queue"); -static VNET_DEFINE(int, tcp_reass_overflows) = 0; -#define V_tcp_reass_overflows VNET(tcp_reass_overflows) -SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, overflows, +static int tcp_reass_overflows = 0; +SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, overflows, CTLFLAG_RD, - &VNET_NAME(tcp_reass_overflows), 0, + &tcp_reass_overflows, 0, "Global number of TCP Segment Reassembly Queue Overflows"); -static VNET_DEFINE(uma_zone_t, tcp_reass_zone); -#define V_tcp_reass_zone VNET(tcp_reass_zone) +static uma_zone_t tcp_reass_zone; /* Initialize TCP reassembly queue */ static void @@ -105,36 +102,27 @@ tcp_reass_zone_change(void *tag) { /* Set the zone limit and read back the effective value. */ - V_tcp_reass_maxseg = nmbclusters / 16; - V_tcp_reass_maxseg = uma_zone_set_max(V_tcp_reass_zone, - V_tcp_reass_maxseg); + tcp_reass_maxseg = nmbclusters / 16; + tcp_reass_maxseg = uma_zone_set_max(tcp_reass_zone, + tcp_reass_maxseg); } void -tcp_reass_init(void) +tcp_reass_global_init(void) { - V_tcp_reass_maxseg = nmbclusters / 16; + tcp_reass_maxseg = nmbclusters / 16; TUNABLE_INT_FETCH("net.inet.tcp.reass.maxsegments", - &V_tcp_reass_maxseg); - V_tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), + &tcp_reass_maxseg); + tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); /* Set the zone limit and read back the effective value. */ - V_tcp_reass_maxseg = uma_zone_set_max(V_tcp_reass_zone, - V_tcp_reass_maxseg); + tcp_reass_maxseg = uma_zone_set_max(tcp_reass_zone, + tcp_reass_maxseg); EVENTHANDLER_REGISTER(nmbclusters_change, tcp_reass_zone_change, NULL, EVENTHANDLER_PRI_ANY); } -#ifdef VIMAGE -void -tcp_reass_destroy(void) -{ - - uma_zdestroy(V_tcp_reass_zone); -} -#endif - void tcp_reass_flush(struct tcpcb *tp) { @@ -145,7 +133,7 @@ tcp_reass_flush(struct tcpcb *tp) while ((qe = LIST_FIRST(&tp->t_segq)) != NULL) { LIST_REMOVE(qe, tqe_q); m_freem(qe->tqe_m); - uma_zfree(V_tcp_reass_zone, qe); + uma_zfree(tcp_reass_zone, qe); tp->t_segqlen--; } @@ -159,7 +147,7 @@ tcp_reass_sysctl_qsize(SYSCTL_HANDLER_AR { int qsize; - qsize = uma_zone_get_cur(V_tcp_reass_zone); + qsize = uma_zone_get_cur(tcp_reass_zone); return (sysctl_handle_int(oidp, &qsize, 0, req)); } @@ -207,7 +195,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd */ if ((th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) && tp->t_segqlen >= (so->so_rcv.sb_hiwat / tp->t_maxseg) + 1) { - V_tcp_reass_overflows++; + tcp_reass_overflows++; TCPSTAT_INC(tcps_rcvmemdrop); m_freem(m); *tlenp = 0; @@ -226,7 +214,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd * Use a temporary structure on the stack for the missing segment * when the zone is exhausted. Otherwise we may get stuck. */ - te = uma_zalloc(V_tcp_reass_zone, M_NOWAIT); + te = uma_zalloc(tcp_reass_zone, M_NOWAIT); if (te == NULL) { if (th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) { TCPSTAT_INC(tcps_rcvmemdrop); @@ -277,7 +265,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd TCPSTAT_ADD(tcps_rcvdupbyte, *tlenp); m_freem(m); if (te != &tqs) - uma_zfree(V_tcp_reass_zone, te); + uma_zfree(tcp_reass_zone, te); tp->t_segqlen--; /* * Try to present any queued data @@ -314,7 +302,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd nq = LIST_NEXT(q, tqe_q); LIST_REMOVE(q, tqe_q); m_freem(q->tqe_m); - uma_zfree(V_tcp_reass_zone, q); + uma_zfree(tcp_reass_zone, q); tp->t_segqlen--; q = nq; } @@ -353,7 +341,7 @@ present: else sbappendstream_locked(&so->so_rcv, q->tqe_m); if (q != &tqs) - uma_zfree(V_tcp_reass_zone, q); + uma_zfree(tcp_reass_zone, q); tp->t_segqlen--; q = nq; } while (q && q->tqe_th->th_seq == tp->rcv_nxt); Modified: releng/10.2/sys/netinet/tcp_subr.c ============================================================================== --- releng/10.2/sys/netinet/tcp_subr.c Tue Jul 28 19:58:54 2015 (r285977) +++ releng/10.2/sys/netinet/tcp_subr.c Tue Jul 28 19:59:04 2015 (r285978) @@ -376,7 +376,6 @@ tcp_init(void) tcp_tw_init(); syncache_init(); tcp_hc_init(); - tcp_reass_init(); TUNABLE_INT_FETCH("net.inet.tcp.sack.enable", &V_tcp_do_sack); V_sack_hole_zone = uma_zcreate("sackhole", sizeof(struct sackhole), @@ -386,6 +385,8 @@ tcp_init(void) if (!IS_DEFAULT_VNET(curvnet)) return; + tcp_reass_global_init(); + /* XXX virtualize those bellow? */ tcp_delacktime = TCPTV_DELACK; tcp_keepinit = TCPTV_KEEP_INIT; @@ -433,7 +434,6 @@ void tcp_destroy(void) { - tcp_reass_destroy(); tcp_hc_destroy(); syncache_destroy(); tcp_tw_destroy(); Modified: releng/10.2/sys/netinet/tcp_var.h ============================================================================== --- releng/10.2/sys/netinet/tcp_var.h Tue Jul 28 19:58:54 2015 (r285977) +++ releng/10.2/sys/netinet/tcp_var.h Tue Jul 28 19:59:04 2015 (r285978) @@ -679,11 +679,8 @@ char *tcp_log_addrs(struct in_conninfo * char *tcp_log_vain(struct in_conninfo *, struct tcphdr *, void *, const void *); int tcp_reass(struct tcpcb *, struct tcphdr *, int *, struct mbuf *); -void tcp_reass_init(void); +void tcp_reass_global_init(void); void tcp_reass_flush(struct tcpcb *); -#ifdef VIMAGE -void tcp_reass_destroy(void); -#endif void tcp_input(struct mbuf *, int); u_long tcp_maxmtu(struct in_conninfo *, struct tcp_ifcap *); u_long tcp_maxmtu6(struct in_conninfo *, struct tcp_ifcap *); Modified: releng/10.2/usr.bin/patch/common.h ============================================================================== --- releng/10.2/usr.bin/patch/common.h Tue Jul 28 19:58:54 2015 (r285977) +++ releng/10.2/usr.bin/patch/common.h Tue Jul 28 19:59:04 2015 (r285978) @@ -43,12 +43,10 @@ #define LINENUM_MAX LONG_MAX #define SCCSPREFIX "s." -#define GET "get -e %s" -#define SCCSDIFF "get -p %s | diff - %s >/dev/null" #define RCSSUFFIX ",v" -#define CHECKOUT "co -l %s" -#define RCSDIFF "rcsdiff %s > /dev/null" +#define CHECKOUT "/usr/bin/co" +#define RCSDIFF "/usr/bin/rcsdiff" #define ORIGEXT ".orig" #define REJEXT ".rej" Modified: releng/10.2/usr.bin/patch/inp.c ============================================================================== --- releng/10.2/usr.bin/patch/inp.c Tue Jul 28 19:58:54 2015 (r285977) +++ releng/10.2/usr.bin/patch/inp.c Tue Jul 28 19:59:04 2015 (r285978) @@ -31,8 +31,10 @@ #include #include #include +#include #include +#include #include #include #include @@ -132,12 +134,14 @@ reallocate_lines(size_t *lines_allocated static bool plan_a(const char *filename) { - int ifd, statfailed; + int ifd, statfailed, devnull, pstat; char *p, *s, lbuf[INITLINELEN]; struct stat filestat; ptrdiff_t sz; size_t i; size_t iline, lines_allocated; + pid_t pid; + char *argp[4] = {NULL}; #ifdef DEBUGGING if (debug & 8) @@ -165,13 +169,14 @@ plan_a(const char *filename) } if (statfailed && check_only) fatal("%s not found, -C mode, can't probe further\n", filename); - /* For nonexistent or read-only files, look for RCS or SCCS versions. */ + /* For nonexistent or read-only files, look for RCS versions. */ + if (statfailed || /* No one can write to it. */ (filestat.st_mode & 0222) == 0 || /* I can't write to it. */ ((filestat.st_mode & 0022) == 0 && filestat.st_uid != getuid())) { - const char *cs = NULL, *filebase, *filedir; + char *filebase, *filedir; struct stat cstat; char *tmp_filename1, *tmp_filename2; @@ -179,43 +184,26 @@ plan_a(const char *filename) tmp_filename2 = strdup(filename); if (tmp_filename1 == NULL || tmp_filename2 == NULL) fatal("strdupping filename"); + filebase = basename(tmp_filename1); filedir = dirname(tmp_filename2); - /* Leave room in lbuf for the diff command. */ - s = lbuf + 20; - #define try(f, a1, a2, a3) \ - (snprintf(s, buf_size - 20, f, a1, a2, a3), stat(s, &cstat) == 0) - - if (try("%s/RCS/%s%s", filedir, filebase, RCSSUFFIX) || - try("%s/RCS/%s%s", filedir, filebase, "") || - try("%s/%s%s", filedir, filebase, RCSSUFFIX)) { - snprintf(buf, buf_size, CHECKOUT, filename); - snprintf(lbuf, sizeof lbuf, RCSDIFF, filename); - cs = "RCS"; - } else if (try("%s/SCCS/%s%s", filedir, SCCSPREFIX, filebase) || - try("%s/%s%s", filedir, SCCSPREFIX, filebase)) { - snprintf(buf, buf_size, GET, s); - snprintf(lbuf, sizeof lbuf, SCCSDIFF, s, filename); - cs = "SCCS"; - } else if (statfailed) - fatal("can't find %s\n", filename); - - free(tmp_filename1); - free(tmp_filename2); + (snprintf(lbuf, sizeof(lbuf), f, a1, a2, a3), stat(lbuf, &cstat) == 0) /* * else we can't write to it but it's not under a version * control system, so just proceed. */ - if (cs) { + if (try("%s/RCS/%s%s", filedir, filebase, RCSSUFFIX) || + try("%s/RCS/%s%s", filedir, filebase, "") || + try("%s/%s%s", filedir, filebase, RCSSUFFIX)) { if (!statfailed) { if ((filestat.st_mode & 0222) != 0) /* The owner can write to it. */ fatal("file %s seems to be locked " - "by somebody else under %s\n", - filename, cs); + "by somebody else under RCS\n", + filename); /* * It might be checked out unlocked. See if * it's safe to check out the default version @@ -223,21 +211,59 @@ plan_a(const char *filename) */ if (verbose) say("Comparing file %s to default " - "%s version...\n", - filename, cs); - if (system(lbuf)) + "RCS version...\n", filename); + + switch (pid = fork()) { + case -1: + fatal("can't fork: %s\n", + strerror(errno)); + case 0: + devnull = open("/dev/null", O_RDONLY); + if (devnull == -1) { + fatal("can't open /dev/null: %s", + strerror(errno)); + } + (void)dup2(devnull, STDOUT_FILENO); + argp[0] = strdup(RCSDIFF); + argp[1] = strdup(filename); + execv(RCSDIFF, argp); + exit(127); + } + pid = waitpid(pid, &pstat, 0); + if (pid == -1 || WEXITSTATUS(pstat) != 0) { fatal("can't check out file %s: " - "differs from default %s version\n", - filename, cs); + "differs from default RCS version\n", + filename); + } } + if (verbose) - say("Checking out file %s from %s...\n", - filename, cs); - if (system(buf) || stat(filename, &filestat)) - fatal("can't check out file %s from %s\n", - filename, cs); + say("Checking out file %s from RCS...\n", + filename); + + switch (pid = fork()) { + case -1: + fatal("can't fork: %s\n", strerror(errno)); + case 0: + argp[0] = strdup(CHECKOUT); + argp[1] = strdup("-l"); + argp[2] = strdup(filename); + execv(CHECKOUT, argp); + exit(127); + } + pid = waitpid(pid, &pstat, 0); + if (pid == -1 || WEXITSTATUS(pstat) != 0 || + stat(filename, &filestat)) { + fatal("can't check out file %s from RCS\n", + filename); + } + } else if (statfailed) { + fatal("can't find %s\n", filename); } + free(tmp_filename1); + free(tmp_filename2); } + filemode = filestat.st_mode; if (!S_ISREG(filemode)) fatal("%s is not a normal file--can't patch\n", filename); From owner-svn-src-all@freebsd.org Tue Jul 28 19:59:16 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3AEB49AD32B; Tue, 28 Jul 2015 19:59:16 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA6A51049; Tue, 28 Jul 2015 19:59:15 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SJxFUp002689; Tue, 28 Jul 2015 19:59:15 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SJxCLx002679; Tue, 28 Jul 2015 19:59:12 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201507281959.t6SJxCLx002679@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 28 Jul 2015 19:59:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r285979 - in releng/10.1: . crypto/openssh sys/netinet usr.bin/patch X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 19:59:16 -0000 Author: delphij Date: Tue Jul 28 19:59:11 2015 New Revision: 285979 URL: https://svnweb.freebsd.org/changeset/base/285979 Log: Fix patch(1) shell injection vulnerability. [SA-15:14] Fix resource exhaustion in TCP reassembly. [SA-15:15] Fix OpenSSH multiple vulnerabilities. [SA-15:16] Approved by: so Modified: releng/10.1/UPDATING releng/10.1/crypto/openssh/auth2-chall.c releng/10.1/crypto/openssh/sshconnect.c releng/10.1/sys/netinet/tcp_reass.c releng/10.1/sys/netinet/tcp_subr.c releng/10.1/sys/netinet/tcp_var.h releng/10.1/usr.bin/patch/common.h releng/10.1/usr.bin/patch/inp.c Modified: releng/10.1/UPDATING ============================================================================== --- releng/10.1/UPDATING Tue Jul 28 19:59:04 2015 (r285978) +++ releng/10.1/UPDATING Tue Jul 28 19:59:11 2015 (r285979) @@ -16,6 +16,16 @@ from older versions of FreeBSD, try WITH stable/10, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. +20150728: p16 FreeBSD-SA-15:14.bsdpatch + FreeBSD-SA-15:15.tcp + FreeBSD-SA-15:16.openssh + + Fix patch(1) shell injection vulnerability. [SA-15:14] + + Fix resource exhaustion in TCP reassembly. [SA-15:15] + + Fix OpenSSH multiple vulnerabilities. [SA-15:16] + 20150721: p15 FreeBSD-SA-15:13.tcp Fix resource exhaustion due to sessions stuck in LAST_ACK state. Modified: releng/10.1/crypto/openssh/auth2-chall.c ============================================================================== --- releng/10.1/crypto/openssh/auth2-chall.c Tue Jul 28 19:59:04 2015 (r285978) +++ releng/10.1/crypto/openssh/auth2-chall.c Tue Jul 28 19:59:11 2015 (r285979) @@ -82,6 +82,7 @@ struct KbdintAuthctxt void *ctxt; KbdintDevice *device; u_int nreq; + u_int devices_done; }; #ifdef USE_PAM @@ -168,11 +169,15 @@ kbdint_next_device(Authctxt *authctxt, K if (len == 0) break; for (i = 0; devices[i]; i++) { - if (!auth2_method_allowed(authctxt, + if ((kbdintctxt->devices_done & (1 << i)) != 0 || + !auth2_method_allowed(authctxt, "keyboard-interactive", devices[i]->name)) continue; - if (strncmp(kbdintctxt->devices, devices[i]->name, len) == 0) + if (strncmp(kbdintctxt->devices, devices[i]->name, + len) == 0) { kbdintctxt->device = devices[i]; + kbdintctxt->devices_done |= 1 << i; + } } t = kbdintctxt->devices; kbdintctxt->devices = t[len] ? xstrdup(t+len+1) : NULL; Modified: releng/10.1/crypto/openssh/sshconnect.c ============================================================================== --- releng/10.1/crypto/openssh/sshconnect.c Tue Jul 28 19:59:04 2015 (r285978) +++ releng/10.1/crypto/openssh/sshconnect.c Tue Jul 28 19:59:11 2015 (r285979) @@ -1246,29 +1246,39 @@ verify_host_key(char *host, struct socka { int flags = 0; char *fp; + Key *plain = NULL; fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); debug("Server host key: %s %s", key_type(host_key), fp); free(fp); - /* XXX certs are not yet supported for DNS */ - if (!key_is_cert(host_key) && options.verify_host_key_dns && - verify_host_key_dns(host, hostaddr, host_key, &flags) == 0) { - if (flags & DNS_VERIFY_FOUND) { - - if (options.verify_host_key_dns == 1 && - flags & DNS_VERIFY_MATCH && - flags & DNS_VERIFY_SECURE) - return 0; - - if (flags & DNS_VERIFY_MATCH) { - matching_host_key_dns = 1; - } else { - warn_changed_key(host_key); - error("Update the SSHFP RR in DNS with the new " - "host key to get rid of this message."); + if (options.verify_host_key_dns) { + /* + * XXX certs are not yet supported for DNS, so downgrade + * them and try the plain key. + */ + plain = key_from_private(host_key); + if (key_is_cert(plain)) + key_drop_cert(plain); + if (verify_host_key_dns(host, hostaddr, plain, &flags) == 0) { + if (flags & DNS_VERIFY_FOUND) { + if (options.verify_host_key_dns == 1 && + flags & DNS_VERIFY_MATCH && + flags & DNS_VERIFY_SECURE) { + key_free(plain); + return 0; + } + if (flags & DNS_VERIFY_MATCH) { + matching_host_key_dns = 1; + } else { + warn_changed_key(plain); + error("Update the SSHFP RR in DNS " + "with the new host key to get rid " + "of this message."); + } } } + key_free(plain); } return check_host_key(host, hostaddr, options.port, host_key, RDRW, Modified: releng/10.1/sys/netinet/tcp_reass.c ============================================================================== --- releng/10.1/sys/netinet/tcp_reass.c Tue Jul 28 19:59:04 2015 (r285978) +++ releng/10.1/sys/netinet/tcp_reass.c Tue Jul 28 19:59:11 2015 (r285979) @@ -79,25 +79,22 @@ static int tcp_reass_sysctl_qsize(SYSCTL static SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0, "TCP Segment Reassembly Queue"); -static VNET_DEFINE(int, tcp_reass_maxseg) = 0; -#define V_tcp_reass_maxseg VNET(tcp_reass_maxseg) -SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN, - &VNET_NAME(tcp_reass_maxseg), 0, +static int tcp_reass_maxseg = 0; +SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN, + &tcp_reass_maxseg, 0, "Global maximum number of TCP Segments in Reassembly Queue"); -SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments, +SYSCTL_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments, (CTLTYPE_INT | CTLFLAG_RD), NULL, 0, &tcp_reass_sysctl_qsize, "I", "Global number of TCP Segments currently in Reassembly Queue"); -static VNET_DEFINE(int, tcp_reass_overflows) = 0; -#define V_tcp_reass_overflows VNET(tcp_reass_overflows) -SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, overflows, +static int tcp_reass_overflows = 0; +SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, overflows, CTLTYPE_INT | CTLFLAG_RD, - &VNET_NAME(tcp_reass_overflows), 0, + &tcp_reass_overflows, 0, "Global number of TCP Segment Reassembly Queue Overflows"); -static VNET_DEFINE(uma_zone_t, tcp_reass_zone); -#define V_tcp_reass_zone VNET(tcp_reass_zone) +static uma_zone_t tcp_reass_zone; /* Initialize TCP reassembly queue */ static void @@ -105,36 +102,27 @@ tcp_reass_zone_change(void *tag) { /* Set the zone limit and read back the effective value. */ - V_tcp_reass_maxseg = nmbclusters / 16; - V_tcp_reass_maxseg = uma_zone_set_max(V_tcp_reass_zone, - V_tcp_reass_maxseg); + tcp_reass_maxseg = nmbclusters / 16; + tcp_reass_maxseg = uma_zone_set_max(tcp_reass_zone, + tcp_reass_maxseg); } void -tcp_reass_init(void) +tcp_reass_global_init(void) { - V_tcp_reass_maxseg = nmbclusters / 16; + tcp_reass_maxseg = nmbclusters / 16; TUNABLE_INT_FETCH("net.inet.tcp.reass.maxsegments", - &V_tcp_reass_maxseg); - V_tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), + &tcp_reass_maxseg); + tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); /* Set the zone limit and read back the effective value. */ - V_tcp_reass_maxseg = uma_zone_set_max(V_tcp_reass_zone, - V_tcp_reass_maxseg); + tcp_reass_maxseg = uma_zone_set_max(tcp_reass_zone, + tcp_reass_maxseg); EVENTHANDLER_REGISTER(nmbclusters_change, tcp_reass_zone_change, NULL, EVENTHANDLER_PRI_ANY); } -#ifdef VIMAGE -void -tcp_reass_destroy(void) -{ - - uma_zdestroy(V_tcp_reass_zone); -} -#endif - void tcp_reass_flush(struct tcpcb *tp) { @@ -145,7 +133,7 @@ tcp_reass_flush(struct tcpcb *tp) while ((qe = LIST_FIRST(&tp->t_segq)) != NULL) { LIST_REMOVE(qe, tqe_q); m_freem(qe->tqe_m); - uma_zfree(V_tcp_reass_zone, qe); + uma_zfree(tcp_reass_zone, qe); tp->t_segqlen--; } @@ -159,7 +147,7 @@ tcp_reass_sysctl_qsize(SYSCTL_HANDLER_AR { int qsize; - qsize = uma_zone_get_cur(V_tcp_reass_zone); + qsize = uma_zone_get_cur(tcp_reass_zone); return (sysctl_handle_int(oidp, &qsize, 0, req)); } @@ -207,7 +195,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd */ if ((th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) && tp->t_segqlen >= (so->so_rcv.sb_hiwat / tp->t_maxseg) + 1) { - V_tcp_reass_overflows++; + tcp_reass_overflows++; TCPSTAT_INC(tcps_rcvmemdrop); m_freem(m); *tlenp = 0; @@ -226,7 +214,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd * Use a temporary structure on the stack for the missing segment * when the zone is exhausted. Otherwise we may get stuck. */ - te = uma_zalloc(V_tcp_reass_zone, M_NOWAIT); + te = uma_zalloc(tcp_reass_zone, M_NOWAIT); if (te == NULL) { if (th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) { TCPSTAT_INC(tcps_rcvmemdrop); @@ -277,7 +265,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd TCPSTAT_ADD(tcps_rcvdupbyte, *tlenp); m_freem(m); if (te != &tqs) - uma_zfree(V_tcp_reass_zone, te); + uma_zfree(tcp_reass_zone, te); tp->t_segqlen--; /* * Try to present any queued data @@ -314,7 +302,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd nq = LIST_NEXT(q, tqe_q); LIST_REMOVE(q, tqe_q); m_freem(q->tqe_m); - uma_zfree(V_tcp_reass_zone, q); + uma_zfree(tcp_reass_zone, q); tp->t_segqlen--; q = nq; } @@ -353,7 +341,7 @@ present: else sbappendstream_locked(&so->so_rcv, q->tqe_m); if (q != &tqs) - uma_zfree(V_tcp_reass_zone, q); + uma_zfree(tcp_reass_zone, q); tp->t_segqlen--; q = nq; } while (q && q->tqe_th->th_seq == tp->rcv_nxt); Modified: releng/10.1/sys/netinet/tcp_subr.c ============================================================================== --- releng/10.1/sys/netinet/tcp_subr.c Tue Jul 28 19:59:04 2015 (r285978) +++ releng/10.1/sys/netinet/tcp_subr.c Tue Jul 28 19:59:11 2015 (r285979) @@ -375,7 +375,6 @@ tcp_init(void) tcp_tw_init(); syncache_init(); tcp_hc_init(); - tcp_reass_init(); TUNABLE_INT_FETCH("net.inet.tcp.sack.enable", &V_tcp_do_sack); V_sack_hole_zone = uma_zcreate("sackhole", sizeof(struct sackhole), @@ -385,6 +384,8 @@ tcp_init(void) if (!IS_DEFAULT_VNET(curvnet)) return; + tcp_reass_global_init(); + /* XXX virtualize those bellow? */ tcp_delacktime = TCPTV_DELACK; tcp_keepinit = TCPTV_KEEP_INIT; @@ -432,7 +433,6 @@ void tcp_destroy(void) { - tcp_reass_destroy(); tcp_hc_destroy(); syncache_destroy(); tcp_tw_destroy(); Modified: releng/10.1/sys/netinet/tcp_var.h ============================================================================== --- releng/10.1/sys/netinet/tcp_var.h Tue Jul 28 19:59:04 2015 (r285978) +++ releng/10.1/sys/netinet/tcp_var.h Tue Jul 28 19:59:11 2015 (r285979) @@ -666,11 +666,8 @@ char *tcp_log_addrs(struct in_conninfo * char *tcp_log_vain(struct in_conninfo *, struct tcphdr *, void *, const void *); int tcp_reass(struct tcpcb *, struct tcphdr *, int *, struct mbuf *); -void tcp_reass_init(void); +void tcp_reass_global_init(void); void tcp_reass_flush(struct tcpcb *); -#ifdef VIMAGE -void tcp_reass_destroy(void); -#endif void tcp_input(struct mbuf *, int); u_long tcp_maxmtu(struct in_conninfo *, struct tcp_ifcap *); u_long tcp_maxmtu6(struct in_conninfo *, struct tcp_ifcap *); Modified: releng/10.1/usr.bin/patch/common.h ============================================================================== --- releng/10.1/usr.bin/patch/common.h Tue Jul 28 19:59:04 2015 (r285978) +++ releng/10.1/usr.bin/patch/common.h Tue Jul 28 19:59:11 2015 (r285979) @@ -42,12 +42,10 @@ #define BUFFERSIZE 4096 #define SCCSPREFIX "s." -#define GET "get -e %s" -#define SCCSDIFF "get -p %s | diff - %s >/dev/null" #define RCSSUFFIX ",v" -#define CHECKOUT "co -l %s" -#define RCSDIFF "rcsdiff %s > /dev/null" +#define CHECKOUT "/usr/bin/co" +#define RCSDIFF "/usr/bin/rcsdiff" #define ORIGEXT ".orig" #define REJEXT ".rej" Modified: releng/10.1/usr.bin/patch/inp.c ============================================================================== --- releng/10.1/usr.bin/patch/inp.c Tue Jul 28 19:59:04 2015 (r285978) +++ releng/10.1/usr.bin/patch/inp.c Tue Jul 28 19:59:11 2015 (r285979) @@ -31,8 +31,10 @@ #include #include #include +#include #include +#include #include #include #include @@ -132,12 +134,14 @@ reallocate_lines(size_t *lines_allocated static bool plan_a(const char *filename) { - int ifd, statfailed; + int ifd, statfailed, devnull, pstat; char *p, *s, lbuf[INITLINELEN]; struct stat filestat; ptrdiff_t sz; size_t i; size_t iline, lines_allocated; + pid_t pid; + char *argp[4] = {NULL}; #ifdef DEBUGGING if (debug & 8) @@ -165,13 +169,14 @@ plan_a(const char *filename) } if (statfailed && check_only) fatal("%s not found, -C mode, can't probe further\n", filename); - /* For nonexistent or read-only files, look for RCS or SCCS versions. */ + /* For nonexistent or read-only files, look for RCS versions. */ + if (statfailed || /* No one can write to it. */ (filestat.st_mode & 0222) == 0 || /* I can't write to it. */ ((filestat.st_mode & 0022) == 0 && filestat.st_uid != getuid())) { - const char *cs = NULL, *filebase, *filedir; + char *filebase, *filedir; struct stat cstat; char *tmp_filename1, *tmp_filename2; @@ -179,43 +184,26 @@ plan_a(const char *filename) tmp_filename2 = strdup(filename); if (tmp_filename1 == NULL || tmp_filename2 == NULL) fatal("strdupping filename"); + filebase = basename(tmp_filename1); filedir = dirname(tmp_filename2); - /* Leave room in lbuf for the diff command. */ - s = lbuf + 20; - #define try(f, a1, a2, a3) \ - (snprintf(s, buf_size - 20, f, a1, a2, a3), stat(s, &cstat) == 0) - - if (try("%s/RCS/%s%s", filedir, filebase, RCSSUFFIX) || - try("%s/RCS/%s%s", filedir, filebase, "") || - try("%s/%s%s", filedir, filebase, RCSSUFFIX)) { - snprintf(buf, buf_size, CHECKOUT, filename); - snprintf(lbuf, sizeof lbuf, RCSDIFF, filename); - cs = "RCS"; - } else if (try("%s/SCCS/%s%s", filedir, SCCSPREFIX, filebase) || - try("%s/%s%s", filedir, SCCSPREFIX, filebase)) { - snprintf(buf, buf_size, GET, s); - snprintf(lbuf, sizeof lbuf, SCCSDIFF, s, filename); - cs = "SCCS"; - } else if (statfailed) - fatal("can't find %s\n", filename); - - free(tmp_filename1); - free(tmp_filename2); + (snprintf(lbuf, sizeof(lbuf), f, a1, a2, a3), stat(lbuf, &cstat) == 0) /* * else we can't write to it but it's not under a version * control system, so just proceed. */ - if (cs) { + if (try("%s/RCS/%s%s", filedir, filebase, RCSSUFFIX) || + try("%s/RCS/%s%s", filedir, filebase, "") || + try("%s/%s%s", filedir, filebase, RCSSUFFIX)) { if (!statfailed) { if ((filestat.st_mode & 0222) != 0) /* The owner can write to it. */ fatal("file %s seems to be locked " - "by somebody else under %s\n", - filename, cs); + "by somebody else under RCS\n", + filename); /* * It might be checked out unlocked. See if * it's safe to check out the default version @@ -223,21 +211,59 @@ plan_a(const char *filename) */ if (verbose) say("Comparing file %s to default " - "%s version...\n", - filename, cs); - if (system(lbuf)) + "RCS version...\n", filename); + + switch (pid = fork()) { + case -1: + fatal("can't fork: %s\n", + strerror(errno)); + case 0: + devnull = open("/dev/null", O_RDONLY); + if (devnull == -1) { + fatal("can't open /dev/null: %s", + strerror(errno)); + } + (void)dup2(devnull, STDOUT_FILENO); + argp[0] = strdup(RCSDIFF); + argp[1] = strdup(filename); + execv(RCSDIFF, argp); + exit(127); + } + pid = waitpid(pid, &pstat, 0); + if (pid == -1 || WEXITSTATUS(pstat) != 0) { fatal("can't check out file %s: " - "differs from default %s version\n", - filename, cs); + "differs from default RCS version\n", + filename); + } } + if (verbose) - say("Checking out file %s from %s...\n", - filename, cs); - if (system(buf) || stat(filename, &filestat)) - fatal("can't check out file %s from %s\n", - filename, cs); + say("Checking out file %s from RCS...\n", + filename); + + switch (pid = fork()) { + case -1: + fatal("can't fork: %s\n", strerror(errno)); + case 0: + argp[0] = strdup(CHECKOUT); + argp[1] = strdup("-l"); + argp[2] = strdup(filename); + execv(CHECKOUT, argp); + exit(127); + } + pid = waitpid(pid, &pstat, 0); + if (pid == -1 || WEXITSTATUS(pstat) != 0 || + stat(filename, &filestat)) { + fatal("can't check out file %s from RCS\n", + filename); + } + } else if (statfailed) { + fatal("can't find %s\n", filename); } + free(tmp_filename1); + free(tmp_filename2); } + filemode = filestat.st_mode; if (!S_ISREG(filemode)) fatal("%s is not a normal file--can't patch\n", filename); From owner-svn-src-all@freebsd.org Tue Jul 28 19:59:29 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42EEF9AD364; Tue, 28 Jul 2015 19:59:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2538811BB; Tue, 28 Jul 2015 19:59:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SJxTPi002756; Tue, 28 Jul 2015 19:59:29 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SJxNAJ002737; Tue, 28 Jul 2015 19:59:23 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201507281959.t6SJxNAJ002737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 28 Jul 2015 19:59:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r285980 - in releng: 8.4 8.4/contrib/bind9/lib/dns 8.4/crypto/openssh 8.4/sys/conf 8.4/sys/netinet 9.3 9.3/contrib/bind9/lib/dns 9.3/crypto/openssh 9.3/sys/conf 9.3/sys/netinet X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 19:59:29 -0000 Author: delphij Date: Tue Jul 28 19:59:22 2015 New Revision: 285980 URL: https://svnweb.freebsd.org/changeset/base/285980 Log: Fix resource exhaustion in TCP reassembly. [SA-15:15] Fix OpenSSH multiple vulnerabilities. [SA-15:16] Fix BIND remote denial of service vulnerability. [SA-15:17] Approved by: so Modified: releng/8.4/UPDATING releng/8.4/contrib/bind9/lib/dns/tkey.c releng/8.4/crypto/openssh/auth2-chall.c releng/8.4/crypto/openssh/sshconnect.c releng/8.4/sys/conf/newvers.sh releng/8.4/sys/netinet/tcp_reass.c releng/8.4/sys/netinet/tcp_subr.c releng/8.4/sys/netinet/tcp_var.h releng/9.3/UPDATING releng/9.3/contrib/bind9/lib/dns/tkey.c releng/9.3/crypto/openssh/auth2-chall.c releng/9.3/crypto/openssh/sshconnect.c releng/9.3/sys/conf/newvers.sh releng/9.3/sys/netinet/tcp_reass.c releng/9.3/sys/netinet/tcp_subr.c releng/9.3/sys/netinet/tcp_var.h Modified: releng/8.4/UPDATING ============================================================================== --- releng/8.4/UPDATING Tue Jul 28 19:59:11 2015 (r285979) +++ releng/8.4/UPDATING Tue Jul 28 19:59:22 2015 (r285980) @@ -15,6 +15,16 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. debugging tools present in HEAD were left in place because sun4v support still needs work to become production ready. +20150728: p35 FreeBSD-SA-15:15.tcp + FreeBSD-SA-15:16.openssh + FreeBSD-SA-15:17.bind + + Fix resource exhaustion in TCP reassembly. [SA-15:15] + + Fix OpenSSH multiple vulnerabilities. [SA-15:16] + + Fix BIND remote denial of service vulnerability. [SA-15:17] + 20150721: p34 FreeBSD-SA-15:13.tcp Fix resource exhaustion due to sessions stuck in LAST_ACK state. Modified: releng/8.4/contrib/bind9/lib/dns/tkey.c ============================================================================== --- releng/8.4/contrib/bind9/lib/dns/tkey.c Tue Jul 28 19:59:11 2015 (r285979) +++ releng/8.4/contrib/bind9/lib/dns/tkey.c Tue Jul 28 19:59:22 2015 (r285980) @@ -650,6 +650,7 @@ dns_tkey_processquery(dns_message_t *msg * Try the answer section, since that's where Win2000 * puts it. */ + name = NULL; if (dns_message_findname(msg, DNS_SECTION_ANSWER, qname, dns_rdatatype_tkey, 0, &name, &tkeyset) != ISC_R_SUCCESS) { Modified: releng/8.4/crypto/openssh/auth2-chall.c ============================================================================== --- releng/8.4/crypto/openssh/auth2-chall.c Tue Jul 28 19:59:11 2015 (r285979) +++ releng/8.4/crypto/openssh/auth2-chall.c Tue Jul 28 19:59:22 2015 (r285980) @@ -82,6 +82,7 @@ struct KbdintAuthctxt void *ctxt; KbdintDevice *device; u_int nreq; + u_int devices_done; }; #ifdef USE_PAM @@ -169,9 +170,14 @@ kbdint_next_device(KbdintAuthctxt *kbdin if (len == 0) break; - for (i = 0; devices[i]; i++) - if (strncmp(kbdintctxt->devices, devices[i]->name, len) == 0) + for (i = 0; devices[i]; i++) { + if ((kbdintctxt->devices_done & (1 << i)) != 0) + continue; + if (strncmp(kbdintctxt->devices, devices[i]->name, len) == 0) { kbdintctxt->device = devices[i]; + kbdintctxt->devices_done |= 1 << i; + } + } t = kbdintctxt->devices; kbdintctxt->devices = t[len] ? xstrdup(t+len+1) : NULL; xfree(t); Modified: releng/8.4/crypto/openssh/sshconnect.c ============================================================================== --- releng/8.4/crypto/openssh/sshconnect.c Tue Jul 28 19:59:11 2015 (r285979) +++ releng/8.4/crypto/openssh/sshconnect.c Tue Jul 28 19:59:22 2015 (r285980) @@ -1141,29 +1141,39 @@ verify_host_key(char *host, struct socka { int flags = 0; char *fp; + Key *plain = NULL; fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); debug("Server host key: %s %s", key_type(host_key), fp); xfree(fp); - /* XXX certs are not yet supported for DNS */ - if (!key_is_cert(host_key) && options.verify_host_key_dns && - verify_host_key_dns(host, hostaddr, host_key, &flags) == 0) { - if (flags & DNS_VERIFY_FOUND) { - - if (options.verify_host_key_dns == 1 && - flags & DNS_VERIFY_MATCH && - flags & DNS_VERIFY_SECURE) - return 0; - - if (flags & DNS_VERIFY_MATCH) { - matching_host_key_dns = 1; - } else { - warn_changed_key(host_key); - error("Update the SSHFP RR in DNS with the new " - "host key to get rid of this message."); + if (options.verify_host_key_dns) { + /* + * XXX certs are not yet supported for DNS, so downgrade + * them and try the plain key. + */ + plain = key_from_private(host_key); + if (key_is_cert(plain)) + key_drop_cert(plain); + if (verify_host_key_dns(host, hostaddr, plain, &flags) == 0) { + if (flags & DNS_VERIFY_FOUND) { + if (options.verify_host_key_dns == 1 && + flags & DNS_VERIFY_MATCH && + flags & DNS_VERIFY_SECURE) { + key_free(plain); + return 0; + } + if (flags & DNS_VERIFY_MATCH) { + matching_host_key_dns = 1; + } else { + warn_changed_key(plain); + error("Update the SSHFP RR in DNS " + "with the new host key to get rid " + "of this message."); + } } } + key_free(plain); } return check_host_key(host, hostaddr, options.port, host_key, RDRW, Modified: releng/8.4/sys/conf/newvers.sh ============================================================================== --- releng/8.4/sys/conf/newvers.sh Tue Jul 28 19:59:11 2015 (r285979) +++ releng/8.4/sys/conf/newvers.sh Tue Jul 28 19:59:22 2015 (r285980) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="8.4" -BRANCH="RELEASE-p34" +BRANCH="RELEASE-p35" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/8.4/sys/netinet/tcp_reass.c ============================================================================== --- releng/8.4/sys/netinet/tcp_reass.c Tue Jul 28 19:59:11 2015 (r285979) +++ releng/8.4/sys/netinet/tcp_reass.c Tue Jul 28 19:59:22 2015 (r285980) @@ -80,62 +80,49 @@ static int tcp_reass_sysctl_qsize(SYSCTL SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0, "TCP Segment Reassembly Queue"); -static VNET_DEFINE(int, tcp_reass_maxseg) = 0; -#define V_tcp_reass_maxseg VNET(tcp_reass_maxseg) +static int tcp_reass_maxseg = 0; SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLTYPE_INT | CTLFLAG_RDTUN, - &VNET_NAME(tcp_reass_maxseg), 0, &tcp_reass_sysctl_maxseg, "I", + &tcp_reass_maxseg, 0, &tcp_reass_sysctl_maxseg, "I", "Global maximum number of TCP Segments in Reassembly Queue"); -static VNET_DEFINE(int, tcp_reass_qsize) = 0; -#define V_tcp_reass_qsize VNET(tcp_reass_qsize) -SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments, +static int tcp_reass_qsize = 0; +SYSCTL_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments, CTLTYPE_INT | CTLFLAG_RD, - &VNET_NAME(tcp_reass_qsize), 0, &tcp_reass_sysctl_qsize, "I", + &tcp_reass_qsize, 0, &tcp_reass_sysctl_qsize, "I", "Global number of TCP Segments currently in Reassembly Queue"); -static VNET_DEFINE(int, tcp_reass_overflows) = 0; -#define V_tcp_reass_overflows VNET(tcp_reass_overflows) -SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, overflows, +static int tcp_reass_overflows = 0; +SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, overflows, CTLTYPE_INT | CTLFLAG_RD, - &VNET_NAME(tcp_reass_overflows), 0, + &tcp_reass_overflows, 0, "Global number of TCP Segment Reassembly Queue Overflows"); -static VNET_DEFINE(uma_zone_t, tcp_reass_zone); -#define V_tcp_reass_zone VNET(tcp_reass_zone) +static uma_zone_t tcp_reass_zone; /* Initialize TCP reassembly queue */ static void tcp_reass_zone_change(void *tag) { - V_tcp_reass_maxseg = nmbclusters / 16; - uma_zone_set_max(V_tcp_reass_zone, V_tcp_reass_maxseg); + tcp_reass_maxseg = nmbclusters / 16; + uma_zone_set_max(tcp_reass_zone, tcp_reass_maxseg); } void -tcp_reass_init(void) +tcp_reass_global_init(void) { - V_tcp_reass_maxseg = nmbclusters / 16; + tcp_reass_maxseg = nmbclusters / 16; TUNABLE_INT_FETCH("net.inet.tcp.reass.maxsegments", - &V_tcp_reass_maxseg); - V_tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), + &tcp_reass_maxseg); + tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); - uma_zone_set_max(V_tcp_reass_zone, V_tcp_reass_maxseg); + uma_zone_set_max(tcp_reass_zone, tcp_reass_maxseg); EVENTHANDLER_REGISTER(nmbclusters_change, tcp_reass_zone_change, NULL, EVENTHANDLER_PRI_ANY); } -#ifdef VIMAGE -void -tcp_reass_destroy(void) -{ - - uma_zdestroy(V_tcp_reass_zone); -} -#endif - void tcp_reass_flush(struct tcpcb *tp) { @@ -146,7 +133,7 @@ tcp_reass_flush(struct tcpcb *tp) while ((qe = LIST_FIRST(&tp->t_segq)) != NULL) { LIST_REMOVE(qe, tqe_q); m_freem(qe->tqe_m); - uma_zfree(V_tcp_reass_zone, qe); + uma_zfree(tcp_reass_zone, qe); tp->t_segqlen--; } @@ -158,14 +145,14 @@ tcp_reass_flush(struct tcpcb *tp) static int tcp_reass_sysctl_maxseg(SYSCTL_HANDLER_ARGS) { - V_tcp_reass_maxseg = uma_zone_get_max(V_tcp_reass_zone); + tcp_reass_maxseg = uma_zone_get_max(tcp_reass_zone); return (sysctl_handle_int(oidp, arg1, arg2, req)); } static int tcp_reass_sysctl_qsize(SYSCTL_HANDLER_ARGS) { - V_tcp_reass_qsize = uma_zone_get_cur(V_tcp_reass_zone); + tcp_reass_qsize = uma_zone_get_cur(tcp_reass_zone); return (sysctl_handle_int(oidp, arg1, arg2, req)); } @@ -213,7 +200,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd */ if ((th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) && tp->t_segqlen >= (so->so_rcv.sb_hiwat / tp->t_maxseg) + 1) { - V_tcp_reass_overflows++; + tcp_reass_overflows++; TCPSTAT_INC(tcps_rcvmemdrop); m_freem(m); *tlenp = 0; @@ -232,7 +219,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd * Use a temporary structure on the stack for the missing segment * when the zone is exhausted. Otherwise we may get stuck. */ - te = uma_zalloc(V_tcp_reass_zone, M_NOWAIT); + te = uma_zalloc(tcp_reass_zone, M_NOWAIT); if (te == NULL) { if (th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) { TCPSTAT_INC(tcps_rcvmemdrop); @@ -283,7 +270,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd TCPSTAT_ADD(tcps_rcvdupbyte, *tlenp); m_freem(m); if (te != &tqs) - uma_zfree(V_tcp_reass_zone, te); + uma_zfree(tcp_reass_zone, te); tp->t_segqlen--; /* * Try to present any queued data @@ -320,7 +307,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd nq = LIST_NEXT(q, tqe_q); LIST_REMOVE(q, tqe_q); m_freem(q->tqe_m); - uma_zfree(V_tcp_reass_zone, q); + uma_zfree(tcp_reass_zone, q); tp->t_segqlen--; q = nq; } @@ -359,7 +346,7 @@ present: else sbappendstream_locked(&so->so_rcv, q->tqe_m); if (q != &tqs) - uma_zfree(V_tcp_reass_zone, q); + uma_zfree(tcp_reass_zone, q); tp->t_segqlen--; q = nq; } while (q && q->tqe_th->th_seq == tp->rcv_nxt); Modified: releng/8.4/sys/netinet/tcp_subr.c ============================================================================== --- releng/8.4/sys/netinet/tcp_subr.c Tue Jul 28 19:59:11 2015 (r285979) +++ releng/8.4/sys/netinet/tcp_subr.c Tue Jul 28 19:59:22 2015 (r285980) @@ -375,7 +375,6 @@ tcp_init(void) tcp_tw_init(); syncache_init(); tcp_hc_init(); - tcp_reass_init(); TUNABLE_INT_FETCH("net.inet.tcp.sack.enable", &V_tcp_do_sack); V_sack_hole_zone = uma_zcreate("sackhole", sizeof(struct sackhole), @@ -385,6 +384,8 @@ tcp_init(void) if (!IS_DEFAULT_VNET(curvnet)) return; + tcp_reass_global_init(); + /* XXX virtualize those bellow? */ tcp_delacktime = TCPTV_DELACK; tcp_keepinit = TCPTV_KEEP_INIT; @@ -424,7 +425,6 @@ void tcp_destroy(void) { - tcp_reass_destroy(); tcp_hc_destroy(); syncache_destroy(); tcp_tw_destroy(); Modified: releng/8.4/sys/netinet/tcp_var.h ============================================================================== --- releng/8.4/sys/netinet/tcp_var.h Tue Jul 28 19:59:11 2015 (r285979) +++ releng/8.4/sys/netinet/tcp_var.h Tue Jul 28 19:59:22 2015 (r285980) @@ -653,11 +653,8 @@ char *tcp_log_addrs(struct in_conninfo char *tcp_log_vain(struct in_conninfo *, struct tcphdr *, void *, const void *); int tcp_reass(struct tcpcb *, struct tcphdr *, int *, struct mbuf *); -void tcp_reass_init(void); +void tcp_reass_global_init(void); void tcp_reass_flush(struct tcpcb *); -#ifdef VIMAGE -void tcp_reass_destroy(void); -#endif void tcp_input(struct mbuf *, int); u_long tcp_maxmtu(struct in_conninfo *, int *); u_long tcp_maxmtu6(struct in_conninfo *, int *); Modified: releng/9.3/UPDATING ============================================================================== --- releng/9.3/UPDATING Tue Jul 28 19:59:11 2015 (r285979) +++ releng/9.3/UPDATING Tue Jul 28 19:59:22 2015 (r285980) @@ -11,6 +11,16 @@ handbook: Items affecting the ports and packages system can be found in /usr/ports/UPDATING. Please read that file before running portupgrade. +20150728: p21 FreeBSD-SA-15:15.tcp + FreeBSD-SA-15:16.openssh + FreeBSD-SA-15:17.bind + + Fix resource exhaustion in TCP reassembly. [SA-15:15] + + Fix OpenSSH multiple vulnerabilities. [SA-15:16] + + Fix BIND remote denial of service vulnerability. [SA-15:17] + 20150721: p20 FreeBSD-SA-15:13.tcp Fix resource exhaustion due to sessions stuck in LAST_ACK state. Modified: releng/9.3/contrib/bind9/lib/dns/tkey.c ============================================================================== --- releng/9.3/contrib/bind9/lib/dns/tkey.c Tue Jul 28 19:59:11 2015 (r285979) +++ releng/9.3/contrib/bind9/lib/dns/tkey.c Tue Jul 28 19:59:22 2015 (r285980) @@ -650,6 +650,7 @@ dns_tkey_processquery(dns_message_t *msg * Try the answer section, since that's where Win2000 * puts it. */ + name = NULL; if (dns_message_findname(msg, DNS_SECTION_ANSWER, qname, dns_rdatatype_tkey, 0, &name, &tkeyset) != ISC_R_SUCCESS) { Modified: releng/9.3/crypto/openssh/auth2-chall.c ============================================================================== --- releng/9.3/crypto/openssh/auth2-chall.c Tue Jul 28 19:59:11 2015 (r285979) +++ releng/9.3/crypto/openssh/auth2-chall.c Tue Jul 28 19:59:22 2015 (r285980) @@ -82,6 +82,7 @@ struct KbdintAuthctxt void *ctxt; KbdintDevice *device; u_int nreq; + u_int devices_done; }; #ifdef USE_PAM @@ -168,11 +169,15 @@ kbdint_next_device(Authctxt *authctxt, K if (len == 0) break; for (i = 0; devices[i]; i++) { - if (!auth2_method_allowed(authctxt, + if ((kbdintctxt->devices_done & (1 << i)) != 0 || + !auth2_method_allowed(authctxt, "keyboard-interactive", devices[i]->name)) continue; - if (strncmp(kbdintctxt->devices, devices[i]->name, len) == 0) + if (strncmp(kbdintctxt->devices, devices[i]->name, + len) == 0) { kbdintctxt->device = devices[i]; + kbdintctxt->devices_done |= 1 << i; + } } t = kbdintctxt->devices; kbdintctxt->devices = t[len] ? xstrdup(t+len+1) : NULL; Modified: releng/9.3/crypto/openssh/sshconnect.c ============================================================================== --- releng/9.3/crypto/openssh/sshconnect.c Tue Jul 28 19:59:11 2015 (r285979) +++ releng/9.3/crypto/openssh/sshconnect.c Tue Jul 28 19:59:22 2015 (r285980) @@ -1247,29 +1247,39 @@ verify_host_key(char *host, struct socka { int flags = 0; char *fp; + Key *plain = NULL; fp = key_fingerprint(host_key, SSH_FP_MD5, SSH_FP_HEX); debug("Server host key: %s %s", key_type(host_key), fp); free(fp); - /* XXX certs are not yet supported for DNS */ - if (!key_is_cert(host_key) && options.verify_host_key_dns && - verify_host_key_dns(host, hostaddr, host_key, &flags) == 0) { - if (flags & DNS_VERIFY_FOUND) { - - if (options.verify_host_key_dns == 1 && - flags & DNS_VERIFY_MATCH && - flags & DNS_VERIFY_SECURE) - return 0; - - if (flags & DNS_VERIFY_MATCH) { - matching_host_key_dns = 1; - } else { - warn_changed_key(host_key); - error("Update the SSHFP RR in DNS with the new " - "host key to get rid of this message."); + if (options.verify_host_key_dns) { + /* + * XXX certs are not yet supported for DNS, so downgrade + * them and try the plain key. + */ + plain = key_from_private(host_key); + if (key_is_cert(plain)) + key_drop_cert(plain); + if (verify_host_key_dns(host, hostaddr, plain, &flags) == 0) { + if (flags & DNS_VERIFY_FOUND) { + if (options.verify_host_key_dns == 1 && + flags & DNS_VERIFY_MATCH && + flags & DNS_VERIFY_SECURE) { + key_free(plain); + return 0; + } + if (flags & DNS_VERIFY_MATCH) { + matching_host_key_dns = 1; + } else { + warn_changed_key(plain); + error("Update the SSHFP RR in DNS " + "with the new host key to get rid " + "of this message."); + } } } + key_free(plain); } return check_host_key(host, hostaddr, options.port, host_key, RDRW, Modified: releng/9.3/sys/conf/newvers.sh ============================================================================== --- releng/9.3/sys/conf/newvers.sh Tue Jul 28 19:59:11 2015 (r285979) +++ releng/9.3/sys/conf/newvers.sh Tue Jul 28 19:59:22 2015 (r285980) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="9.3" -BRANCH="RELEASE-p20" +BRANCH="RELEASE-p21" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi Modified: releng/9.3/sys/netinet/tcp_reass.c ============================================================================== --- releng/9.3/sys/netinet/tcp_reass.c Tue Jul 28 19:59:11 2015 (r285979) +++ releng/9.3/sys/netinet/tcp_reass.c Tue Jul 28 19:59:22 2015 (r285980) @@ -79,25 +79,22 @@ static int tcp_reass_sysctl_qsize(SYSCTL static SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0, "TCP Segment Reassembly Queue"); -static VNET_DEFINE(int, tcp_reass_maxseg) = 0; -#define V_tcp_reass_maxseg VNET(tcp_reass_maxseg) -SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN, - &VNET_NAME(tcp_reass_maxseg), 0, +static int tcp_reass_maxseg = 0; +SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN, + &tcp_reass_maxseg, 0, "Global maximum number of TCP Segments in Reassembly Queue"); -SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments, +SYSCTL_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments, (CTLTYPE_INT | CTLFLAG_RD), NULL, 0, &tcp_reass_sysctl_qsize, "I", "Global number of TCP Segments currently in Reassembly Queue"); -static VNET_DEFINE(int, tcp_reass_overflows) = 0; -#define V_tcp_reass_overflows VNET(tcp_reass_overflows) -SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, overflows, +static int tcp_reass_overflows = 0; +SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, overflows, CTLTYPE_INT | CTLFLAG_RD, - &VNET_NAME(tcp_reass_overflows), 0, + &tcp_reass_overflows, 0, "Global number of TCP Segment Reassembly Queue Overflows"); -static VNET_DEFINE(uma_zone_t, tcp_reass_zone); -#define V_tcp_reass_zone VNET(tcp_reass_zone) +static uma_zone_t tcp_reass_zone; /* Initialize TCP reassembly queue */ static void @@ -105,36 +102,27 @@ tcp_reass_zone_change(void *tag) { /* Set the zone limit and read back the effective value. */ - V_tcp_reass_maxseg = nmbclusters / 16; - V_tcp_reass_maxseg = uma_zone_set_max(V_tcp_reass_zone, - V_tcp_reass_maxseg); + tcp_reass_maxseg = nmbclusters / 16; + tcp_reass_maxseg = uma_zone_set_max(tcp_reass_zone, + tcp_reass_maxseg); } void -tcp_reass_init(void) +tcp_reass_global_init(void) { - V_tcp_reass_maxseg = nmbclusters / 16; + tcp_reass_maxseg = nmbclusters / 16; TUNABLE_INT_FETCH("net.inet.tcp.reass.maxsegments", - &V_tcp_reass_maxseg); - V_tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), + &tcp_reass_maxseg); + tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); /* Set the zone limit and read back the effective value. */ - V_tcp_reass_maxseg = uma_zone_set_max(V_tcp_reass_zone, - V_tcp_reass_maxseg); + tcp_reass_maxseg = uma_zone_set_max(tcp_reass_zone, + tcp_reass_maxseg); EVENTHANDLER_REGISTER(nmbclusters_change, tcp_reass_zone_change, NULL, EVENTHANDLER_PRI_ANY); } -#ifdef VIMAGE -void -tcp_reass_destroy(void) -{ - - uma_zdestroy(V_tcp_reass_zone); -} -#endif - void tcp_reass_flush(struct tcpcb *tp) { @@ -145,7 +133,7 @@ tcp_reass_flush(struct tcpcb *tp) while ((qe = LIST_FIRST(&tp->t_segq)) != NULL) { LIST_REMOVE(qe, tqe_q); m_freem(qe->tqe_m); - uma_zfree(V_tcp_reass_zone, qe); + uma_zfree(tcp_reass_zone, qe); tp->t_segqlen--; } @@ -159,7 +147,7 @@ tcp_reass_sysctl_qsize(SYSCTL_HANDLER_AR { int qsize; - qsize = uma_zone_get_cur(V_tcp_reass_zone); + qsize = uma_zone_get_cur(tcp_reass_zone); return (sysctl_handle_int(oidp, &qsize, 0, req)); } @@ -207,7 +195,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd */ if ((th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) && tp->t_segqlen >= (so->so_rcv.sb_hiwat / tp->t_maxseg) + 1) { - V_tcp_reass_overflows++; + tcp_reass_overflows++; TCPSTAT_INC(tcps_rcvmemdrop); m_freem(m); *tlenp = 0; @@ -226,7 +214,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd * Use a temporary structure on the stack for the missing segment * when the zone is exhausted. Otherwise we may get stuck. */ - te = uma_zalloc(V_tcp_reass_zone, M_NOWAIT); + te = uma_zalloc(tcp_reass_zone, M_NOWAIT); if (te == NULL) { if (th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) { TCPSTAT_INC(tcps_rcvmemdrop); @@ -277,7 +265,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd TCPSTAT_ADD(tcps_rcvdupbyte, *tlenp); m_freem(m); if (te != &tqs) - uma_zfree(V_tcp_reass_zone, te); + uma_zfree(tcp_reass_zone, te); tp->t_segqlen--; /* * Try to present any queued data @@ -314,7 +302,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd nq = LIST_NEXT(q, tqe_q); LIST_REMOVE(q, tqe_q); m_freem(q->tqe_m); - uma_zfree(V_tcp_reass_zone, q); + uma_zfree(tcp_reass_zone, q); tp->t_segqlen--; q = nq; } @@ -353,7 +341,7 @@ present: else sbappendstream_locked(&so->so_rcv, q->tqe_m); if (q != &tqs) - uma_zfree(V_tcp_reass_zone, q); + uma_zfree(tcp_reass_zone, q); tp->t_segqlen--; q = nq; } while (q && q->tqe_th->th_seq == tp->rcv_nxt); Modified: releng/9.3/sys/netinet/tcp_subr.c ============================================================================== --- releng/9.3/sys/netinet/tcp_subr.c Tue Jul 28 19:59:11 2015 (r285979) +++ releng/9.3/sys/netinet/tcp_subr.c Tue Jul 28 19:59:22 2015 (r285980) @@ -314,7 +314,6 @@ tcp_init(void) tcp_tw_init(); syncache_init(); tcp_hc_init(); - tcp_reass_init(); TUNABLE_INT_FETCH("net.inet.tcp.sack.enable", &V_tcp_do_sack); V_sack_hole_zone = uma_zcreate("sackhole", sizeof(struct sackhole), @@ -324,6 +323,8 @@ tcp_init(void) if (!IS_DEFAULT_VNET(curvnet)) return; + tcp_reass_global_init(); + /* XXX virtualize those bellow? */ tcp_delacktime = TCPTV_DELACK; tcp_keepinit = TCPTV_KEEP_INIT; @@ -371,7 +372,6 @@ void tcp_destroy(void) { - tcp_reass_destroy(); tcp_hc_destroy(); syncache_destroy(); tcp_tw_destroy(); Modified: releng/9.3/sys/netinet/tcp_var.h ============================================================================== --- releng/9.3/sys/netinet/tcp_var.h Tue Jul 28 19:59:11 2015 (r285979) +++ releng/9.3/sys/netinet/tcp_var.h Tue Jul 28 19:59:22 2015 (r285980) @@ -680,11 +680,8 @@ char *tcp_log_addrs(struct in_conninfo * char *tcp_log_vain(struct in_conninfo *, struct tcphdr *, void *, const void *); int tcp_reass(struct tcpcb *, struct tcphdr *, int *, struct mbuf *); -void tcp_reass_init(void); +void tcp_reass_global_init(void); void tcp_reass_flush(struct tcpcb *); -#ifdef VIMAGE -void tcp_reass_destroy(void); -#endif void tcp_input(struct mbuf *, int); u_long tcp_maxmtu(struct in_conninfo *, struct tcp_ifcap *); u_long tcp_maxmtu6(struct in_conninfo *, struct tcp_ifcap *); From owner-svn-src-all@freebsd.org Tue Jul 28 20:24:10 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D19259ADB90; Tue, 28 Jul 2015 20:24:10 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C205F8AD; Tue, 28 Jul 2015 20:24:10 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SKOAeM015177; Tue, 28 Jul 2015 20:24:10 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SKOAgg015176; Tue, 28 Jul 2015 20:24:10 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201507282024.t6SKOAgg015176@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Tue, 28 Jul 2015 20:24:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285981 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 20:24:11 -0000 Author: jeff Date: Tue Jul 28 20:24:09 2015 New Revision: 285981 URL: https://svnweb.freebsd.org/changeset/base/285981 Log: - Eliminate the EMPTYKVA queue. It served as a cache of KVA allocations attached to bufs to avoid the overhead of the vm. This purposes is now better served by vmem. Freeing the kva immediately when a buf is destroyed leads to lower fragmentation and a much simpler scan algorithm. Reviewed by: kib Sponsored by: EMC / Isilon Storage Division Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Tue Jul 28 19:59:22 2015 (r285980) +++ head/sys/kern/vfs_bio.c Tue Jul 28 20:24:09 2015 (r285981) @@ -309,13 +309,12 @@ static int bdirtywait; /* * Definitions for the buffer free lists. */ -#define BUFFER_QUEUES 5 /* number of free buffer queues */ +#define BUFFER_QUEUES 4 /* number of free buffer queues */ #define QUEUE_NONE 0 /* on no queue */ #define QUEUE_CLEAN 1 /* non-B_DELWRI buffers */ #define QUEUE_DIRTY 2 /* B_DELWRI buffers */ -#define QUEUE_EMPTYKVA 3 /* empty buffer headers w/KVA assignment */ -#define QUEUE_EMPTY 4 /* empty buffer headers */ +#define QUEUE_EMPTY 3 /* empty buffer headers */ #define QUEUE_SENTINEL 1024 /* not an queue index, but mark for sentinel */ /* Queues for free buffers with various properties */ @@ -1862,10 +1861,8 @@ brelse(struct buf *bp) bp->b_xflags &= ~(BX_BKGRDWRITE | BX_ALTDATA); if (bp->b_vflags & BV_BKGRDINPROG) panic("losing buffer 1"); - if (bp->b_kvasize) - qindex = QUEUE_EMPTYKVA; - else - qindex = QUEUE_EMPTY; + bufkvafree(bp); + qindex = QUEUE_EMPTY; bp->b_flags |= B_AGE; /* buffers with junk contents */ } else if (bp->b_flags & (B_INVAL | B_NOCACHE | B_RELBUF) || @@ -2251,8 +2248,6 @@ getnewbuf_reuse_bp(struct buf *bp, int q LIST_INIT(&bp->b_dep); } -static int flushingbufs; - static struct buf * getnewbuf_scan(int maxsize, int defrag, int unmapped, int metadata) { @@ -2261,64 +2256,25 @@ getnewbuf_scan(int maxsize, int defrag, KASSERT(!unmapped || !defrag, ("both unmapped and defrag")); - pass = 1; + pass = 0; restart: - atomic_add_int(&getnewbufrestarts, 1); + if (pass != 0) + atomic_add_int(&getnewbufrestarts, 1); - /* - * Setup for scan. If we do not have enough free buffers, - * we setup a degenerate case that immediately fails. Note - * that if we are specially marked process, we are allowed to - * dip into our reserves. - * - * The scanning sequence is nominally: EMPTY->EMPTYKVA->CLEAN - * for the allocation of the mapped buffer. For unmapped, the - * easiest is to start with EMPTY outright. - * - * We start with EMPTYKVA. If the list is empty we backup to EMPTY. - * However, there are a number of cases (defragging, reusing, ...) - * where we cannot backup. - */ nbp = NULL; mtx_lock(&bqclean); - if (!defrag && unmapped) { - nqindex = QUEUE_EMPTY; - nbp = TAILQ_FIRST(&bufqueues[QUEUE_EMPTY]); - } - if (nbp == NULL) { - nqindex = QUEUE_EMPTYKVA; - nbp = TAILQ_FIRST(&bufqueues[QUEUE_EMPTYKVA]); - } - /* - * If no EMPTYKVA buffers and we are either defragging or - * reusing, locate a CLEAN buffer to free or reuse. If - * bufspace useage is low skip this step so we can allocate a - * new buffer. + * If we're not defragging or low on bufspace attempt to make a new + * buf from a header. */ - if (nbp == NULL && (defrag || bufspace >= lobufspace)) { - nqindex = QUEUE_CLEAN; - nbp = TAILQ_FIRST(&bufqueues[QUEUE_CLEAN]); - } - - /* - * If we could not find or were not allowed to reuse a CLEAN - * buffer, check to see if it is ok to use an EMPTY buffer. - * We can only use an EMPTY buffer if allocating its KVA would - * not otherwise run us out of buffer space. No KVA is needed - * for the unmapped allocation. - */ - if (nbp == NULL && defrag == 0 && (bufspace + maxsize < hibufspace || - metadata)) { + if (defrag == 0 && bufspace + maxsize < hibufspace) { nqindex = QUEUE_EMPTY; - nbp = TAILQ_FIRST(&bufqueues[QUEUE_EMPTY]); + nbp = TAILQ_FIRST(&bufqueues[nqindex]); } - /* - * All available buffers might be clean, retry ignoring the - * lobufspace as the last resort. + * All available buffers might be clean or we need to start recycling. */ - if (nbp == NULL && !TAILQ_EMPTY(&bufqueues[QUEUE_CLEAN])) { + if (nbp == NULL) { nqindex = QUEUE_CLEAN; nbp = TAILQ_FIRST(&bufqueues[QUEUE_CLEAN]); } @@ -2332,28 +2288,21 @@ restart: /* * Calculate next bp (we can only use it if we do not - * block or do other fancy things). + * release the bqlock) */ if ((nbp = TAILQ_NEXT(bp, b_freelist)) == NULL) { switch (qindex) { case QUEUE_EMPTY: - nqindex = QUEUE_EMPTYKVA; - nbp = TAILQ_FIRST(&bufqueues[QUEUE_EMPTYKVA]); - if (nbp != NULL) - break; - /* FALLTHROUGH */ - case QUEUE_EMPTYKVA: nqindex = QUEUE_CLEAN; - nbp = TAILQ_FIRST(&bufqueues[QUEUE_CLEAN]); + nbp = TAILQ_FIRST(&bufqueues[nqindex]); if (nbp != NULL) break; /* FALLTHROUGH */ case QUEUE_CLEAN: - if (metadata && pass == 1) { - pass = 2; + if (metadata && pass == 0) { + pass = 1; nqindex = QUEUE_EMPTY; - nbp = TAILQ_FIRST( - &bufqueues[QUEUE_EMPTY]); + nbp = TAILQ_FIRST(&bufqueues[nqindex]); } /* * nbp is NULL. @@ -2399,11 +2348,11 @@ restart: bremfreel(bp); mtx_unlock(&bqclean); + /* * NOTE: nbp is now entirely invalid. We can only restart * the scan from this point on. */ - getnewbuf_reuse_bp(bp, qindex); mtx_assert(&bqclean, MA_NOTOWNED); @@ -2412,7 +2361,6 @@ restart: */ if (defrag) { bp->b_flags |= B_INVAL; - bufkvafree(bp); brelse(bp); defrag = 0; goto restart; @@ -2424,7 +2372,6 @@ restart: */ if (qindex == QUEUE_CLEAN && BUF_LOCKWAITERS(bp)) { bp->b_flags |= B_INVAL; - bufkvafree(bp); brelse(bp); goto restart; } @@ -2437,16 +2384,11 @@ restart: * KVM space. This occurs in rare situations when multiple * processes are blocked in getnewbuf() or allocbuf(). */ - if (bufspace >= hibufspace) - flushingbufs = 1; - if (flushingbufs && bp->b_kvasize != 0) { + if (bufspace >= hibufspace && bp->b_kvasize != 0) { bp->b_flags |= B_INVAL; - bufkvafree(bp); brelse(bp); goto restart; } - if (bufspace < lobufspace) - flushingbufs = 0; break; } return (bp); @@ -2492,7 +2434,6 @@ getnewbuf(struct vnode *vp, int slpflag, * async I/O rather then sync I/O. */ atomic_add_int(&getnewbufcalls, 1); - atomic_subtract_int(&getnewbufrestarts, 1); restart: bp = getnewbuf_scan(maxsize, defrag, (gbflags & (GB_UNMAPPED | GB_KVAALLOC)) == GB_UNMAPPED, metadata); From owner-svn-src-all@freebsd.org Tue Jul 28 20:38:54 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BDB179ADD30; Tue, 28 Jul 2015 20:38:54 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AD5B9E50; Tue, 28 Jul 2015 20:38:54 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SKcsx0019401; Tue, 28 Jul 2015 20:38:54 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SKcsgZ019400; Tue, 28 Jul 2015 20:38:54 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507282038.t6SKcsgZ019400@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 28 Jul 2015 20:38:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r285982 - in stable: 10/release/doc/share/xml 8/release/doc/share/xml 9/release/doc/share/xml X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 20:38:54 -0000 Author: gjb Date: Tue Jul 28 20:38:52 2015 New Revision: 285982 URL: https://svnweb.freebsd.org/changeset/base/285982 Log: Document SA-15:14 through SA-15:17. Sponsored by: The FreeBSD Foundation Modified: stable/8/release/doc/share/xml/security.xml Changes in other areas also in this revision: Modified: stable/10/release/doc/share/xml/security.xml stable/9/release/doc/share/xml/security.xml Modified: stable/8/release/doc/share/xml/security.xml ============================================================================== --- stable/8/release/doc/share/xml/security.xml Tue Jul 28 20:24:09 2015 (r285981) +++ stable/8/release/doc/share/xml/security.xml Tue Jul 28 20:38:52 2015 (r285982) @@ -275,6 +275,29 @@ resource exhaustion due to sessions stuck in LAST_ACK state. + + + FreeBSD-SA-15:15.tcp + 28 July 2015 + resource exhaustion in TCP + reassembly + + + + FreeBSD-SA-15:16.openssh + 28 July 2015 + Multiple vulnerabilities + + + + FreeBSD-SA-15:17.bind + 28 July 2015 + Remote denial of service + vulnerability + From owner-svn-src-all@freebsd.org Tue Jul 28 20:38:53 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F29009ADD24; Tue, 28 Jul 2015 20:38:53 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E233CE4D; Tue, 28 Jul 2015 20:38:53 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SKcrLL019395; Tue, 28 Jul 2015 20:38:53 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SKcrKt019394; Tue, 28 Jul 2015 20:38:53 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507282038.t6SKcrKt019394@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 28 Jul 2015 20:38:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r285982 - in stable: 10/release/doc/share/xml 8/release/doc/share/xml 9/release/doc/share/xml X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 20:38:54 -0000 Author: gjb Date: Tue Jul 28 20:38:52 2015 New Revision: 285982 URL: https://svnweb.freebsd.org/changeset/base/285982 Log: Document SA-15:14 through SA-15:17. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/doc/share/xml/security.xml Changes in other areas also in this revision: Modified: stable/8/release/doc/share/xml/security.xml stable/9/release/doc/share/xml/security.xml Modified: stable/10/release/doc/share/xml/security.xml ============================================================================== --- stable/10/release/doc/share/xml/security.xml Tue Jul 28 20:24:09 2015 (r285981) +++ stable/10/release/doc/share/xml/security.xml Tue Jul 28 20:38:52 2015 (r285982) @@ -133,6 +133,28 @@ resource exhaustion due to sessions stuck in LAST_ACK state. + + + FreeBSD-SA-15:14.bsdpatch + 28 July 2015 + Shell injection vulnerability + + + + FreeBSD-SA-15:15.tcp + 28 July 2015 + resource exhaustion in TCP + reassembly + + + + FreeBSD-SA-15:16.openssh + 28 July 2015 + Multiple vulnerabilities + From owner-svn-src-all@freebsd.org Tue Jul 28 20:38:55 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A23379ADD43; Tue, 28 Jul 2015 20:38:55 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 91E8DE53; Tue, 28 Jul 2015 20:38:55 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SKctvv019407; Tue, 28 Jul 2015 20:38:55 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SKcteP019406; Tue, 28 Jul 2015 20:38:55 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507282038.t6SKcteP019406@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 28 Jul 2015 20:38:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r285982 - in stable: 10/release/doc/share/xml 8/release/doc/share/xml 9/release/doc/share/xml X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 20:38:55 -0000 Author: gjb Date: Tue Jul 28 20:38:52 2015 New Revision: 285982 URL: https://svnweb.freebsd.org/changeset/base/285982 Log: Document SA-15:14 through SA-15:17. Sponsored by: The FreeBSD Foundation Modified: stable/9/release/doc/share/xml/security.xml Changes in other areas also in this revision: Modified: stable/10/release/doc/share/xml/security.xml stable/8/release/doc/share/xml/security.xml Modified: stable/9/release/doc/share/xml/security.xml ============================================================================== --- stable/9/release/doc/share/xml/security.xml Tue Jul 28 20:24:09 2015 (r285981) +++ stable/9/release/doc/share/xml/security.xml Tue Jul 28 20:38:52 2015 (r285982) @@ -170,6 +170,29 @@ resource exhaustion due to sessions stuck in LAST_ACK state. + + + FreeBSD-SA-15:15.tcp + 28 July 2015 + resource exhaustion in TCP + reassembly + + + + FreeBSD-SA-15:16.openssh + 28 July 2015 + Multiple vulnerabilities + + + + FreeBSD-SA-15:17.bind + 28 July 2015 + Remote denial of service + vulnerability + From owner-svn-src-all@freebsd.org Tue Jul 28 20:42:37 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F6BD9AD0D2; Tue, 28 Jul 2015 20:42:37 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7009216AA; Tue, 28 Jul 2015 20:42:37 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SKgb1r023211; Tue, 28 Jul 2015 20:42:37 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SKgbN0023210; Tue, 28 Jul 2015 20:42:37 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507282042.t6SKgbN0023210@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 28 Jul 2015 20:42:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r285983 - releng/10.2/release/doc/share/xml X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 20:42:37 -0000 Author: gjb Date: Tue Jul 28 20:42:36 2015 New Revision: 285983 URL: https://svnweb.freebsd.org/changeset/base/285983 Log: Document SA-15:14 through SA-15:16. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: releng/10.2/release/doc/share/xml/security.xml Modified: releng/10.2/release/doc/share/xml/security.xml ============================================================================== --- releng/10.2/release/doc/share/xml/security.xml Tue Jul 28 20:38:52 2015 (r285982) +++ releng/10.2/release/doc/share/xml/security.xml Tue Jul 28 20:42:36 2015 (r285983) @@ -133,6 +133,28 @@ resource exhaustion due to sessions stuck in LAST_ACK state. + + + FreeBSD-SA-15:14.bsdpatch + 28 July 2015 + Shell injection vulnerability + + + + FreeBSD-SA-15:15.tcp + 28 July 2015 + resource exhaustion in TCP + reassembly + + + + FreeBSD-SA-15:16.openssh + 28 July 2015 + Multiple vulnerabilities + From owner-svn-src-all@freebsd.org Tue Jul 28 20:52:11 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 419729AD5A4; Tue, 28 Jul 2015 20:52:11 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3288DE0; Tue, 28 Jul 2015 20:52:11 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SKqBop027326; Tue, 28 Jul 2015 20:52:11 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SKqBX9027325; Tue, 28 Jul 2015 20:52:11 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201507282052.t6SKqBX9027325@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 28 Jul 2015 20:52:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285984 - head/usr.sbin/pw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 20:52:11 -0000 Author: bapt Date: Tue Jul 28 20:52:10 2015 New Revision: 285984 URL: https://svnweb.freebsd.org/changeset/base/285984 Log: Fix wrong warning printed after changing or updating NIS users PR: 37672 Submitted by: chris+freebsd@chrullrich.de Modified: head/usr.sbin/pw/pw_user.c Modified: head/usr.sbin/pw/pw_user.c ============================================================================== --- head/usr.sbin/pw/pw_user.c Tue Jul 28 20:42:36 2015 (r285983) +++ head/usr.sbin/pw/pw_user.c Tue Jul 28 20:52:10 2015 (r285984) @@ -206,7 +206,7 @@ perform_chgpwent(const char *name, struc rc = chgnispwent(conf.userconf->nispasswd, name, pwd); if (rc == -1) warn("User '%s' not found in NIS passwd", pwd->pw_name); - else + else if (rc != 0) warn("NIS passwd update"); /* NOTE: NIS-only update errors are not fatal */ } @@ -678,7 +678,7 @@ pw_user(int mode, char *name, long id, s rc = addnispwent(cnf->nispasswd, pwd); if (rc == -1) warnx("User '%s' already exists in NIS passwd", pwd->pw_name); - else + else if (rc != 0) warn("NIS passwd update"); /* NOTE: we treat NIS-only update errors as non-fatal */ } From owner-svn-src-all@freebsd.org Tue Jul 28 21:11:01 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29D879ADD30; Tue, 28 Jul 2015 21:11:01 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0DF1FF8E; Tue, 28 Jul 2015 21:11:01 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SLB0PY035205; Tue, 28 Jul 2015 21:11:00 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SLAx0k035167; Tue, 28 Jul 2015 21:10:59 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201507282110.t6SLAx0k035167@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 28 Jul 2015 21:10:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285985 - in head/usr.sbin/pw: . tests X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 21:11:01 -0000 Author: bapt Date: Tue Jul 28 21:10:58 2015 New Revision: 285985 URL: https://svnweb.freebsd.org/changeset/base/285985 Log: Check uid/gid used when creating a user/group are not larger than UID_MAX/GID_MAX PR: 173977 Reported by: nvass@gmx.com Added: head/usr.sbin/pw/tests/pw_groupadd.sh (contents, props changed) Modified: head/usr.sbin/pw/pw.c head/usr.sbin/pw/tests/Makefile head/usr.sbin/pw/tests/pw_useradd.sh Modified: head/usr.sbin/pw/pw.c ============================================================================== --- head/usr.sbin/pw/pw.c Tue Jul 28 20:52:10 2015 (r285984) +++ head/usr.sbin/pw/pw.c Tue Jul 28 21:10:58 2015 (r285985) @@ -269,7 +269,7 @@ main(int argc, char *argv[]) } if (strspn(optarg, "0123456789") != strlen(optarg)) errx(EX_USAGE, "-g expects a number"); - id = strtonum(optarg, 0, LONG_MAX, &errstr); + id = strtonum(optarg, 0, GID_MAX, &errstr); if (errstr != NULL) errx(EX_USAGE, "Bad id '%s': %s", optarg, errstr); @@ -281,7 +281,7 @@ main(int argc, char *argv[]) addarg(&arglist, 'u', optarg); break; } - id = strtonum(optarg, 0, LONG_MAX, &errstr); + id = strtonum(optarg, 0, UID_MAX, &errstr); if (errstr != NULL) errx(EX_USAGE, "Bad id '%s': %s", optarg, errstr); Modified: head/usr.sbin/pw/tests/Makefile ============================================================================== --- head/usr.sbin/pw/tests/Makefile Tue Jul 28 20:52:10 2015 (r285984) +++ head/usr.sbin/pw/tests/Makefile Tue Jul 28 21:10:58 2015 (r285985) @@ -8,6 +8,7 @@ TESTSDIR= ${TESTSBASE}/usr.sbin/pw ATF_TESTS_SH= pw_etcdir \ pw_lock \ pw_config \ + pw_groupadd \ pw_groupdel \ pw_groupmod \ pw_useradd \ Added: head/usr.sbin/pw/tests/pw_groupadd.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pw/tests/pw_groupadd.sh Tue Jul 28 21:10:58 2015 (r285985) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +# Import helper functions +. $(atf_get_srcdir)/helper_functions.shin + +atf_test_case group_add_gid_too_large +group_add_gid_too_large_body() { + populate_etc_skel + atf_check -s exit:64 -e inline:"pw: Bad id '9999999999999': too large\n" \ + ${PW} groupadd -n test1 -g 9999999999999 +} + +atf_init_test_cases() { + atf_add_test_case group_add_gid_too_large +} Modified: head/usr.sbin/pw/tests/pw_useradd.sh ============================================================================== --- head/usr.sbin/pw/tests/pw_useradd.sh Tue Jul 28 20:52:10 2015 (r285984) +++ head/usr.sbin/pw/tests/pw_useradd.sh Tue Jul 28 21:10:58 2015 (r285985) @@ -289,6 +289,13 @@ user_add_uid0_body() { -s exit:0 ${PW} usershow foo } +atf_test_case user_add_uid_too_large +user_add_uid_too_large_body() { + populate_etc_skel + atf_check -s exit:64 -e inline:"pw: Bad id '9999999999999': too large\n" \ + ${PW} useradd -n test1 -u 9999999999999 +} + atf_init_test_cases() { atf_add_test_case user_add atf_add_test_case user_add_noupdate @@ -313,4 +320,5 @@ atf_init_test_cases() { atf_add_test_case user_add_R atf_add_test_case user_add_skel atf_add_test_case user_add_uid0 + atf_add_test_case user_add_uid_too_large } From owner-svn-src-all@freebsd.org Tue Jul 28 21:20:08 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 979C29AD164; Tue, 28 Jul 2015 21:20:08 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 7B963A7C; Tue, 28 Jul 2015 21:20:08 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id 747991373; Tue, 28 Jul 2015 21:20:08 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 4307F8C8F; Tue, 28 Jul 2015 21:20:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id ssIKyIGVizoB; Tue, 28 Jul 2015 21:20:05 +0000 (UTC) Subject: Re: svn commit: r284356 - head/usr.sbin/crunch/crunchgen DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com ABCF28C8A To: Adrian Chadd , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201506132201.t5DM1LCV025599@svn.freebsd.org> From: Bryan Drewery X-Enigmail-Draft-Status: N1110 Organization: FreeBSD Message-ID: <55B7F201.2040305@FreeBSD.org> Date: Tue, 28 Jul 2015 14:20:01 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <201506132201.t5DM1LCV025599@svn.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 21:20:08 -0000 On 6/13/15 3:01 PM, Adrian Chadd wrote: > Author: adrian > Date: Sat Jun 13 22:01:21 2015 > New Revision: 284356 > URL: https://svnweb.freebsd.org/changeset/base/284356 >=20 > Log: > Fix up crunchgen binary generation to work with external cross-build > tools. > =20 > * Allow STRIP to be overridden by the environment This change breaks the the build still. The build uses STRIP as the parameter for install(1), i.e., -s or blank. Once you rebuild usr.sbin/crunch/crunchgen with this change and then build rescue/rescue with 'make STRIP=3D' the following is encountered: rescue sh: rescue: not found *** [rescue] Error code 127 make[1]: stopped in /usr/obj/root/svn/base/rescue/rescue I would suggest changing the name of this, perhaps STRIP_CMD as ports has, or using a different mechanism. Side note, something funky is going on with including /etc/make.conf. When I build with buildworld (clean) I get the error, but not a plain 'make' having STRIP=3D in /etc/make.conf for both. My system is pre-meta-mode merge at r280911. > * Use CC to tie things together, not LD > =20 > Tested: > =20 > * i386, mips32 > =20 > Submitted by: kan >=20 > Modified: > head/usr.sbin/crunch/crunchgen/crunchgen.c >=20 > Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/usr.sbin/crunch/crunchgen/crunchgen.c Sat Jun 13 20:15:44 2015= (r284355) > +++ head/usr.sbin/crunch/crunchgen/crunchgen.c Sat Jun 13 22:01:21 2015= (r284356) > @@ -980,6 +980,7 @@ top_makefile_rules(FILE *outmk) > prog_t *p; > =20 > fprintf(outmk, "LD?=3D ld\n"); > + fprintf(outmk, "STRIP?=3D strip\n"); > if ( subtract_strlst(&libs, &libs_so) ) > fprintf(outmk, "# NOTE: Some LIBS declarations below overridden by L= IBS_SO\n"); > =20 > @@ -1027,7 +1028,7 @@ top_makefile_rules(FILE *outmk) > fprintf(outmk, "\t$(CC) -static -o %s %s.o $(CRUNCHED_OBJS) $(LIBS)\n= ", > execfname, execfname); > fprintf(outmk, ".endif\n"); > - fprintf(outmk, "\tstrip %s\n", execfname); > + fprintf(outmk, "\t$(STRIP) %s\n", execfname); > fprintf(outmk, "realclean: clean subclean\n"); > fprintf(outmk, "clean:\n\trm -f %s *.lo *.o *_stub.c\n", execfname); > fprintf(outmk, "subclean: $(SUBCLEAN_TARGETS)\n"); > @@ -1109,7 +1110,7 @@ prog_makefile_rules(FILE *outmk, prog_t=20 > fprintf(outmk, " $(%s_LIBS)", p->ident); > =20 > fprintf(outmk, "\n"); > - fprintf(outmk, "\t$(LD) -dc -r -o %s.lo %s_stub.o $(%s_OBJPATHS)", > + fprintf(outmk, "\t$(CC) -nostdlibs -dc -r -o %s.lo %s_stub.o $(%s_OBJ= PATHS)", > p->name, p->name, p->ident); > if (p->libs) > fprintf(outmk, " $(%s_LIBS)", p->ident); >=20 --=20 Regards, Bryan Drewery From owner-svn-src-all@freebsd.org Tue Jul 28 21:39:59 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E6CE9AD94B; Tue, 28 Jul 2015 21:39:59 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5EBF7C8; Tue, 28 Jul 2015 21:39:59 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SLdx5n045988; Tue, 28 Jul 2015 21:39:59 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SLdxfZ045987; Tue, 28 Jul 2015 21:39:59 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201507282139.t6SLdxfZ045987@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 28 Jul 2015 21:39:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285986 - head/usr.sbin/crunch/crunchgen X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 21:39:59 -0000 Author: bdrewery Date: Tue Jul 28 21:39:58 2015 New Revision: 285986 URL: https://svnweb.freebsd.org/changeset/base/285986 Log: Fix rescue build after r284356 with STRIP= by using proper STRIPBIN per build(7). This was causing the following error: rescue sh: rescue: not found *** [rescue] Error code 127 make[1]: stopped in /usr/obj/usr/src/rescue/rescue Sponsored by: EMC / Isilon Storage Division Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c ============================================================================== --- head/usr.sbin/crunch/crunchgen/crunchgen.c Tue Jul 28 21:10:58 2015 (r285985) +++ head/usr.sbin/crunch/crunchgen/crunchgen.c Tue Jul 28 21:39:58 2015 (r285986) @@ -980,7 +980,7 @@ top_makefile_rules(FILE *outmk) prog_t *p; fprintf(outmk, "LD?= ld\n"); - fprintf(outmk, "STRIP?= strip\n"); + fprintf(outmk, "STRIPBIN?= strip\n"); if ( subtract_strlst(&libs, &libs_so) ) fprintf(outmk, "# NOTE: Some LIBS declarations below overridden by LIBS_SO\n"); @@ -1028,7 +1028,7 @@ top_makefile_rules(FILE *outmk) fprintf(outmk, "\t$(CC) -static -o %s %s.o $(CRUNCHED_OBJS) $(LIBS)\n", execfname, execfname); fprintf(outmk, ".endif\n"); - fprintf(outmk, "\t$(STRIP) %s\n", execfname); + fprintf(outmk, "\t$(STRIPBIN) %s\n", execfname); fprintf(outmk, "realclean: clean subclean\n"); fprintf(outmk, "clean:\n\trm -f %s *.lo *.o *_stub.c\n", execfname); fprintf(outmk, "subclean: $(SUBCLEAN_TARGETS)\n"); From owner-svn-src-all@freebsd.org Tue Jul 28 21:40:41 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 417E59AD995; Tue, 28 Jul 2015 21:40:41 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 2A94A379; Tue, 28 Jul 2015 21:40:41 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id 2338C1231; Tue, 28 Jul 2015 21:40:41 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id E245D8EA1; Tue, 28 Jul 2015 21:40:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id pWUoYxPW7dVg; Tue, 28 Jul 2015 21:40:38 +0000 (UTC) Subject: Re: svn commit: r284356 - head/usr.sbin/crunch/crunchgen DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com 8A0E68E98 To: Adrian Chadd , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201506132201.t5DM1LCV025599@svn.freebsd.org> <55B7F201.2040305@FreeBSD.org> From: Bryan Drewery Organization: FreeBSD Message-ID: <55B7F6D4.9010804@FreeBSD.org> Date: Tue, 28 Jul 2015 14:40:36 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <55B7F201.2040305@FreeBSD.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 21:40:41 -0000 On 7/28/15 2:20 PM, Bryan Drewery wrote: > On 6/13/15 3:01 PM, Adrian Chadd wrote: >> > Author: adrian >> > Date: Sat Jun 13 22:01:21 2015 >> > New Revision: 284356 >> > URL: https://svnweb.freebsd.org/changeset/base/284356 >> > >> > Log: >> > Fix up crunchgen binary generation to work with external cross-build >> > tools. >> > >> > * Allow STRIP to be overridden by the environment > This change breaks the the build still. The build uses STRIP as the > parameter for install(1), i.e., -s or blank. Once you rebuild > usr.sbin/crunch/crunchgen with this change and then build rescue/rescue > with 'make STRIP=' the following is encountered: > > rescue > sh: rescue: not found > *** [rescue] Error code 127 > > make[1]: stopped in /usr/obj/root/svn/base/rescue/rescue Fixed in r285986. Renamed to STRIPBIN as ports uses and documented in build(7). -- Regards, Bryan Drewery From owner-svn-src-all@freebsd.org Tue Jul 28 21:43:24 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA3459ADBC9; Tue, 28 Jul 2015 21:43:24 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BB048B97; Tue, 28 Jul 2015 21:43:24 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SLhOwi050081; Tue, 28 Jul 2015 21:43:24 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SLhOjM050080; Tue, 28 Jul 2015 21:43:24 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201507282143.t6SLhOjM050080@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 28 Jul 2015 21:43:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r285987 - releng/10.1/sys/conf X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 21:43:24 -0000 Author: delphij Date: Tue Jul 28 21:43:23 2015 New Revision: 285987 URL: https://svnweb.freebsd.org/changeset/base/285987 Log: Correct patchlevel. Noticed by: Piotr Kubaj Approved by: so Modified: releng/10.1/sys/conf/newvers.sh Modified: releng/10.1/sys/conf/newvers.sh ============================================================================== --- releng/10.1/sys/conf/newvers.sh Tue Jul 28 21:39:58 2015 (r285986) +++ releng/10.1/sys/conf/newvers.sh Tue Jul 28 21:43:23 2015 (r285987) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="10.1" -BRANCH="RELEASE-p15" +BRANCH="RELEASE-p16" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@freebsd.org Tue Jul 28 21:47:38 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A42F9ADDA2; Tue, 28 Jul 2015 21:47:38 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 79BB3FF3; Tue, 28 Jul 2015 21:47:38 +0000 (UTC) (envelope-from dumbbell@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SLlcPg050643; Tue, 28 Jul 2015 21:47:38 GMT (envelope-from dumbbell@FreeBSD.org) Received: (from dumbbell@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SLlcNG050640; Tue, 28 Jul 2015 21:47:38 GMT (envelope-from dumbbell@FreeBSD.org) Message-Id: <201507282147.t6SLlcNG050640@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dumbbell set sender to dumbbell@FreeBSD.org using -f From: Jean-Sebastien Pedron Date: Tue, 28 Jul 2015 21:47:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285988 - head/sys/dev/drm2/i915 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 21:47:38 -0000 Author: dumbbell Date: Tue Jul 28 21:47:37 2015 New Revision: 285988 URL: https://svnweb.freebsd.org/changeset/base/285988 Log: drm/i915: Sort functions in i915_gem.c to match Linux 3.8's ordering While here, reduce the style diff with Linux. There is no functional change. The goal is to ease the future update to Linux 3.8's i915 driver. MFC after: 2 months Modified: head/sys/dev/drm2/i915/i915_drv.h head/sys/dev/drm2/i915/i915_gem.c head/sys/dev/drm2/i915/i915_gem_gtt.c Modified: head/sys/dev/drm2/i915/i915_drv.h ============================================================================== --- head/sys/dev/drm2/i915/i915_drv.h Tue Jul 28 21:43:23 2015 (r285987) +++ head/sys/dev/drm2/i915/i915_drv.h Tue Jul 28 21:47:37 2015 (r285988) @@ -1151,8 +1151,6 @@ void i915_disable_pipestat(drm_i915_priv void i915_destroy_error_state(struct drm_device *dev); /* i915_gem.c */ -int i915_gem_create(struct drm_file *file, struct drm_device *dev, uint64_t size, - uint32_t *handle_p); int i915_gem_init_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv); int i915_gem_create_ioctl(struct drm_device *dev, void *data, @@ -1243,7 +1241,6 @@ int i915_gem_object_finish_gpu(struct dr int i915_gem_flush_ring(struct intel_ring_buffer *ring, uint32_t invalidate_domains, uint32_t flush_domains); void i915_gem_release_mmap(struct drm_i915_gem_object *obj); -int i915_gem_object_wait_rendering(struct drm_i915_gem_object *obj); int i915_gem_object_sync(struct drm_i915_gem_object *obj, struct intel_ring_buffer *to); int i915_gem_object_put_fence(struct drm_i915_gem_object *obj); Modified: head/sys/dev/drm2/i915/i915_gem.c ============================================================================== --- head/sys/dev/drm2/i915/i915_gem.c Tue Jul 28 21:43:23 2015 (r285987) +++ head/sys/dev/drm2/i915/i915_gem.c Tue Jul 28 21:47:37 2015 (r285988) @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include #include #include + #include #include #include @@ -69,38 +70,40 @@ __FBSDID("$FreeBSD$"); #include -static void i915_gem_object_flush_cpu_write_domain( - struct drm_i915_gem_object *obj); -static uint32_t i915_gem_get_gtt_size(struct drm_device *dev, uint32_t size, - int tiling_mode); -static uint32_t i915_gem_get_gtt_alignment(struct drm_device *dev, - uint32_t size, int tiling_mode); -static int i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj, - unsigned alignment, bool map_and_fenceable); -static int i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj, - int flags); -static void i915_gem_object_put_pages_gtt(struct drm_i915_gem_object *obj); -static void i915_gem_object_put_pages_range(struct drm_i915_gem_object *obj, - off_t start, off_t end); +#define __user +#define __force +#define __iomem +#define __must_check +#define to_user_ptr(x) ((void *)(uintptr_t)(x)) +#define offset_in_page(x) ((x) & PAGE_MASK) +#define page_to_phys(x) VM_PAGE_TO_PHYS(x) + +static void i915_gem_object_flush_gtt_write_domain(struct drm_i915_gem_object *obj); +static void i915_gem_object_flush_cpu_write_domain(struct drm_i915_gem_object *obj); +static __must_check int i915_gem_object_bind_to_gtt(struct drm_i915_gem_object *obj, + unsigned alignment, + bool map_and_fenceable); +static int i915_gem_phys_pwrite(struct drm_device *dev, + struct drm_i915_gem_object *obj, + struct drm_i915_gem_pwrite *args, + struct drm_file *file); + +static void i915_gem_write_fence(struct drm_device *dev, int reg, + struct drm_i915_gem_object *obj); +static void i915_gem_object_update_fence(struct drm_i915_gem_object *obj, + struct drm_i915_fence_reg *fence, + bool enable); + +static void i915_gem_lowmem(void *arg); +static void i915_gem_object_truncate(struct drm_i915_gem_object *obj); + static int i915_gem_object_get_pages_range(struct drm_i915_gem_object *obj, off_t start, off_t end); -static void i915_gem_object_finish_gtt(struct drm_i915_gem_object *obj); -static void i915_gem_object_truncate(struct drm_i915_gem_object *obj); -static int i915_gem_object_is_purgeable(struct drm_i915_gem_object *obj); -static bool i915_gem_object_is_inactive(struct drm_i915_gem_object *obj); -static int i915_gem_object_needs_bit17_swizzle(struct drm_i915_gem_object *obj); +static void i915_gem_object_put_pages_range(struct drm_i915_gem_object *obj, + off_t start, off_t end); + static vm_page_t i915_gem_wire_page(vm_object_t object, vm_pindex_t pindex, bool *fresh); -static void i915_gem_process_flushing_list(struct intel_ring_buffer *ring, - uint32_t flush_domains); -static void i915_gem_reset_fences(struct drm_device *dev); -static void i915_gem_retire_task_handler(void *arg, int pending); -static void i915_gem_lowmem(void *arg); -static void i915_gem_write_fence(struct drm_device *dev, int reg, - struct drm_i915_gem_object *obj); -static int __wait_seqno(struct intel_ring_buffer *ring, u32 seqno, - bool interruptible); -static int i915_gem_check_olr(struct intel_ring_buffer *ring, u32 seqno); MALLOC_DEFINE(DRM_I915_GEM, "i915gem", "Allocations from i915 gem"); long i915_gem_wired_pages_cnt; @@ -131,18 +134,17 @@ static inline void i915_gem_object_fence obj->fence_reg = I915_FENCE_REG_NONE; } -static void -i915_gem_info_add_obj(struct drm_i915_private *dev_priv, size_t size) +/* some bookkeeping */ +static void i915_gem_info_add_obj(struct drm_i915_private *dev_priv, + size_t size) { - dev_priv->mm.object_count++; dev_priv->mm.object_memory += size; } -static void -i915_gem_info_remove_obj(struct drm_i915_private *dev_priv, size_t size) +static void i915_gem_info_remove_obj(struct drm_i915_private *dev_priv, + size_t size) { - dev_priv->mm.object_count--; dev_priv->mm.object_memory -= size; } @@ -150,10 +152,9 @@ i915_gem_info_remove_obj(struct drm_i915 static int i915_gem_wait_for_error(struct drm_device *dev) { - struct drm_i915_private *dev_priv; + struct drm_i915_private *dev_priv = dev->dev_private; int ret; - dev_priv = dev->dev_private; if (!atomic_load_acq_int(&dev_priv->mm.wedged)) return (0); @@ -171,150 +172,61 @@ i915_gem_wait_for_error(struct drm_devic mtx_unlock(&dev_priv->error_completion_lock); if (atomic_load_acq_int(&dev_priv->mm.wedged)) { + /* GPU is hung, bump the completion count to account for + * the token we just consumed so that we never hit zero and + * end up waiting upon a subsequent completion event that + * will never happen. + */ mtx_lock(&dev_priv->error_completion_lock); dev_priv->error_completion++; mtx_unlock(&dev_priv->error_completion_lock); } - return (0); + return 0; } -int -i915_mutex_lock_interruptible(struct drm_device *dev) +int i915_mutex_lock_interruptible(struct drm_device *dev) { - struct drm_i915_private *dev_priv; int ret; - dev_priv = dev->dev_private; ret = i915_gem_wait_for_error(dev); - if (ret != 0) - return (ret); + if (ret) + return ret; /* * interruptible shall it be. might indeed be if dev_lock is * changed to sx */ - ret = sx_xlock_sig(&dev->dev_struct_lock); - if (ret != 0) - return (-ret); - - return (0); -} - - -void -i915_gem_free_object(struct drm_gem_object *gem_obj) -{ - struct drm_i915_gem_object *obj = to_intel_bo(gem_obj); - struct drm_device *dev; - drm_i915_private_t *dev_priv; - - dev = obj->base.dev; - dev_priv = dev->dev_private; - - CTR1(KTR_DRM, "object_destroy_tail %p", obj); - - if (obj->phys_obj) - i915_gem_detach_phys_object(dev, obj); - - obj->pin_count = 0; - if (i915_gem_object_unbind(obj) == -ERESTARTSYS) { - bool was_interruptible; - - was_interruptible = dev_priv->mm.interruptible; - dev_priv->mm.interruptible = false; - - if (i915_gem_object_unbind(obj)) - printf("i915_gem_free_object: unbind\n"); - - dev_priv->mm.interruptible = was_interruptible; - } - - drm_gem_free_mmap_offset(&obj->base); - drm_gem_object_release(&obj->base); - i915_gem_info_remove_obj(dev_priv, obj->base.size); - - free(obj->bit_17, DRM_I915_GEM); - free(obj, DRM_I915_GEM); -} - -static void -init_ring_lists(struct intel_ring_buffer *ring) -{ + ret = -sx_xlock_sig(&dev->dev_struct_lock); + if (ret) + return ret; - INIT_LIST_HEAD(&ring->active_list); - INIT_LIST_HEAD(&ring->request_list); - INIT_LIST_HEAD(&ring->gpu_write_list); + return 0; } -void -i915_gem_load(struct drm_device *dev) +static bool +i915_gem_object_is_inactive(struct drm_i915_gem_object *obj) { - drm_i915_private_t *dev_priv; - int i; - - dev_priv = dev->dev_private; - - INIT_LIST_HEAD(&dev_priv->mm.active_list); - INIT_LIST_HEAD(&dev_priv->mm.flushing_list); - INIT_LIST_HEAD(&dev_priv->mm.inactive_list); - INIT_LIST_HEAD(&dev_priv->mm.fence_list); - INIT_LIST_HEAD(&dev_priv->mm.gtt_list); - for (i = 0; i < I915_NUM_RINGS; i++) - init_ring_lists(&dev_priv->rings[i]); - for (i = 0; i < I915_MAX_NUM_FENCES; i++) - INIT_LIST_HEAD(&dev_priv->fence_regs[i].lru_list); - TIMEOUT_TASK_INIT(dev_priv->tq, &dev_priv->mm.retire_task, 0, - i915_gem_retire_task_handler, dev_priv); - dev_priv->error_completion = 0; - - /* On GEN3 we really need to make sure the ARB C3 LP bit is set */ - if (IS_GEN3(dev)) { - I915_WRITE(MI_ARB_STATE, - _MASKED_BIT_ENABLE(MI_ARB_C3_LP_WRITE_ENABLE)); - } - - dev_priv->relative_constants_mode = I915_EXEC_CONSTANTS_REL_GENERAL; - - /* Old X drivers will take 0-2 for front, back, depth buffers */ - if (!drm_core_check_feature(dev, DRIVER_MODESET)) - dev_priv->fence_reg_start = 3; - - if (INTEL_INFO(dev)->gen >= 4 || IS_I945G(dev) || IS_I945GM(dev) || - IS_G33(dev)) - dev_priv->num_fence_regs = 16; - else - dev_priv->num_fence_regs = 8; - - /* Initialize fence registers to zero */ - i915_gem_reset_fences(dev); - i915_gem_detect_bit_6_swizzle(dev); - dev_priv->mm.interruptible = true; - - dev_priv->mm.i915_lowmem = EVENTHANDLER_REGISTER(vm_lowmem, - i915_gem_lowmem, dev, EVENTHANDLER_PRI_ANY); + return !obj->active; } int i915_gem_init_ioctl(struct drm_device *dev, void *data, - struct drm_file *file) + struct drm_file *file) { - struct drm_i915_gem_init *args; - drm_i915_private_t *dev_priv; - int error; + struct drm_i915_gem_init *args = data; + drm_i915_private_t *dev_priv = dev->dev_private; + int ret; if (drm_core_check_feature(dev, DRIVER_MODESET)) return -ENODEV; - dev_priv = dev->dev_private; - args = data; - if (args->gtt_start >= args->gtt_end || (args->gtt_end | args->gtt_start) & (PAGE_SIZE - 1)) - return (-EINVAL); + return -EINVAL; if (mtx_initialized(&dev_priv->mm.gtt_space.unused_lock)) - return (-EBUSY); + return -EBUSY; /* GEM with user mode setting was never supported on ilk and later. */ if (INTEL_INFO(dev)->gen >= 5) @@ -325,423 +237,444 @@ i915_gem_init_ioctl(struct drm_device *d * against. */ DRM_LOCK(dev); - error = i915_gem_init_global_gtt(dev, args->gtt_start, - args->gtt_end, args->gtt_end); + ret = i915_gem_init_global_gtt(dev, args->gtt_start, + args->gtt_end, args->gtt_end); DRM_UNLOCK(dev); - return (error); + + return ret; } int -i915_gem_idle(struct drm_device *dev) +i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data, + struct drm_file *file) { - drm_i915_private_t *dev_priv; - int ret; + struct drm_i915_private *dev_priv = dev->dev_private; + struct drm_i915_gem_get_aperture *args = data; + struct drm_i915_gem_object *obj; + size_t pinned; + pinned = 0; DRM_LOCK(dev); + list_for_each_entry(obj, &dev_priv->mm.gtt_list, gtt_list) + if (obj->pin_count) + pinned += obj->gtt_space->size; + DRM_UNLOCK(dev); - dev_priv = dev->dev_private; - if (dev_priv->mm.suspended) { - DRM_UNLOCK(dev); - return (0); - } + args->aper_size = dev_priv->mm.gtt_total; + args->aper_available_size = args->aper_size - pinned; - ret = i915_gpu_idle(dev); - if (ret != 0) { - DRM_UNLOCK(dev); - return (ret); - } - i915_gem_retire_requests(dev); + return 0; +} - /* Under UMS, be paranoid and evict. */ - if (!drm_core_check_feature(dev, DRIVER_MODESET)) { - ret = i915_gem_evict_everything(dev, false); - if (ret != 0) { - DRM_UNLOCK(dev); - return ret; - } - } +static int +i915_gem_create(struct drm_file *file, + struct drm_device *dev, + uint64_t size, + uint32_t *handle_p) +{ + struct drm_i915_gem_object *obj; + int ret; + u32 handle; - i915_gem_reset_fences(dev); + size = roundup(size, PAGE_SIZE); + if (size == 0) + return -EINVAL; - /* Hack! Don't let anybody do execbuf while we don't control the chip. - * We need to replace this with a semaphore, or something. - * And not confound mm.suspended! - */ - dev_priv->mm.suspended = 1; - callout_stop(&dev_priv->hangcheck_timer); + /* Allocate the new object */ + obj = i915_gem_alloc_object(dev, size); + if (obj == NULL) + return -ENOMEM; - i915_kernel_lost_context(dev); - i915_gem_cleanup_ringbuffer(dev); + ret = drm_gem_handle_create(file, &obj->base, &handle); + if (ret) { + drm_gem_object_release(&obj->base); + i915_gem_info_remove_obj(dev->dev_private, obj->base.size); + free(obj, DRM_I915_GEM); + return ret; + } - DRM_UNLOCK(dev); + /* drop reference from allocate - handle holds it now */ + drm_gem_object_unreference(&obj->base); + CTR2(KTR_DRM, "object_create %p %x", obj, size); - /* Cancel the retire work handler, which should be idle now. */ - taskqueue_cancel_timeout(dev_priv->tq, &dev_priv->mm.retire_task, NULL); - return (ret); + *handle_p = handle; + return 0; } -void -i915_gem_init_swizzling(struct drm_device *dev) +int +i915_gem_dumb_create(struct drm_file *file, + struct drm_device *dev, + struct drm_mode_create_dumb *args) { - drm_i915_private_t *dev_priv; - - dev_priv = dev->dev_private; - - if (INTEL_INFO(dev)->gen < 5 || - dev_priv->mm.bit_6_swizzle_x == I915_BIT_6_SWIZZLE_NONE) - return; - - I915_WRITE(DISP_ARB_CTL, I915_READ(DISP_ARB_CTL) | - DISP_TILE_SURFACE_SWIZZLING); - - if (IS_GEN5(dev)) - return; - + /* have to work out size/pitch and return them */ + args->pitch = roundup2(args->width * ((args->bpp + 7) / 8), 64); + args->size = args->pitch * args->height; + return i915_gem_create(file, dev, + args->size, &args->handle); +} - I915_WRITE(TILECTL, I915_READ(TILECTL) | TILECTL_SWZCTL); - if (IS_GEN6(dev)) - I915_WRITE(ARB_MODE, _MASKED_BIT_ENABLE(ARB_MODE_SWIZZLE_SNB)); - else - I915_WRITE(ARB_MODE, _MASKED_BIT_ENABLE(ARB_MODE_SWIZZLE_IVB)); +int i915_gem_dumb_destroy(struct drm_file *file, + struct drm_device *dev, + uint32_t handle) +{ + return drm_gem_handle_delete(file, handle); } -void i915_gem_init_ppgtt(struct drm_device *dev) +/** + * Creates a new mm object and returns a handle to it. + */ +int +i915_gem_create_ioctl(struct drm_device *dev, void *data, + struct drm_file *file) { - drm_i915_private_t *dev_priv; - struct i915_hw_ppgtt *ppgtt; - uint32_t pd_offset, pd_entry; - vm_paddr_t pt_addr; - struct intel_ring_buffer *ring; - u_int first_pd_entry_in_global_pt, i; + struct drm_i915_gem_create *args = data; - dev_priv = dev->dev_private; - ppgtt = dev_priv->mm.aliasing_ppgtt; - if (ppgtt == NULL) - return; + return i915_gem_create(file, dev, + args->size, &args->handle); +} - first_pd_entry_in_global_pt = 512 * 1024 - I915_PPGTT_PD_ENTRIES; - for (i = 0; i < ppgtt->num_pd_entries; i++) { - pt_addr = VM_PAGE_TO_PHYS(ppgtt->pt_pages[i]); - pd_entry = GEN6_PDE_ADDR_ENCODE(pt_addr); - pd_entry |= GEN6_PDE_VALID; - intel_gtt_write(first_pd_entry_in_global_pt + i, pd_entry); - } - intel_gtt_read_pte(first_pd_entry_in_global_pt); - - pd_offset = ppgtt->pd_offset; - pd_offset /= 64; /* in cachelines, */ - pd_offset <<= 16; - - if (INTEL_INFO(dev)->gen == 6) { - uint32_t ecochk, gab_ctl, ecobits; - - ecobits = I915_READ(GAC_ECO_BITS); - I915_WRITE(GAC_ECO_BITS, ecobits | ECOBITS_PPGTT_CACHE64B); - - gab_ctl = I915_READ(GAB_CTL); - I915_WRITE(GAB_CTL, gab_ctl | GAB_CTL_CONT_AFTER_PAGEFAULT); - - ecochk = I915_READ(GAM_ECOCHK); - I915_WRITE(GAM_ECOCHK, ecochk | ECOCHK_SNB_BIT | - ECOCHK_PPGTT_CACHE64B); - I915_WRITE(GFX_MODE, _MASKED_BIT_ENABLE(GFX_PPGTT_ENABLE)); - } else if (INTEL_INFO(dev)->gen >= 7) { - I915_WRITE(GAM_ECOCHK, ECOCHK_PPGTT_CACHE64B); - /* GFX_MODE is per-ring on gen7+ */ - } +static int i915_gem_object_needs_bit17_swizzle(struct drm_i915_gem_object *obj) +{ + drm_i915_private_t *dev_priv = obj->base.dev->dev_private; - for_each_ring(ring, dev_priv, i) { - if (INTEL_INFO(dev)->gen >= 7) - I915_WRITE(RING_MODE_GEN7(ring), - _MASKED_BIT_ENABLE(GFX_PPGTT_ENABLE)); + return dev_priv->mm.bit_6_swizzle_x == I915_BIT_6_SWIZZLE_9_10_17 && + obj->tiling_mode != I915_TILING_NONE; +} - I915_WRITE(RING_PP_DIR_DCLV(ring), PP_DIR_DCLV_2G); - I915_WRITE(RING_PP_DIR_BASE(ring), pd_offset); - } +static inline int +__copy_to_user_inatomic(void __user *to, const void *from, unsigned n) +{ + return (copyout_nofault(from, to, n) != 0 ? n : 0); } - -int -i915_gem_init_hw(struct drm_device *dev) +static inline unsigned long +__copy_from_user_inatomic_nocache(void *to, const void __user *from, + unsigned long n) { - drm_i915_private_t *dev_priv; - int ret; - - dev_priv = dev->dev_private; - i915_gem_init_swizzling(dev); + /* + * XXXKIB. Equivalent Linux function is implemented using + * MOVNTI for aligned moves. For unaligned head and tail, + * normal move is performed. As such, it is not incorrect, if + * only somewhat slower, to use normal copyin. All uses + * except shmem_pwrite_fast() have the destination mapped WC. + */ + return ((copyin_nofault(__DECONST(void *, from), to, n) != 0 ? n : 0)); +} +static inline int +fault_in_multipages_readable(const char __user *uaddr, int size) +{ + char c; + int ret = 0; + const char __user *end = uaddr + size - 1; - ret = intel_init_render_ring_buffer(dev); - if (ret != 0) - return (ret); + if (unlikely(size == 0)) + return ret; - if (HAS_BSD(dev)) { - ret = intel_init_bsd_ring_buffer(dev); + while (uaddr <= end) { + ret = -copyin(uaddr, &c, 1); if (ret != 0) - goto cleanup_render_ring; + return -EFAULT; + uaddr += PAGE_SIZE; } - if (HAS_BLT(dev)) { - ret = intel_init_blt_ring_buffer(dev); - if (ret != 0) - goto cleanup_bsd_ring; + /* Check whether the range spilled into the next page. */ + if (((unsigned long)uaddr & ~PAGE_MASK) == + ((unsigned long)end & ~PAGE_MASK)) { + ret = -copyin(end, &c, 1); } - dev_priv->next_seqno = 1; - i915_gem_context_init(dev); - i915_gem_init_ppgtt(dev); - return (0); - -cleanup_bsd_ring: - intel_cleanup_ring_buffer(&dev_priv->rings[VCS]); -cleanup_render_ring: - intel_cleanup_ring_buffer(&dev_priv->rings[RCS]); - return (ret); + return ret; } -static bool -intel_enable_ppgtt(struct drm_device *dev) +static inline int +fault_in_multipages_writeable(char __user *uaddr, int size) { - if (i915_enable_ppgtt >= 0) - return i915_enable_ppgtt; + int ret = 0; + char __user *end = uaddr + size - 1; - /* Disable ppgtt on SNB if VT-d is on. */ - if (INTEL_INFO(dev)->gen == 6 && intel_iommu_enabled) - return false; + if (unlikely(size == 0)) + return ret; - return true; -} + /* + * Writing zeroes into userspace here is OK, because we know that if + * the zero gets there, we'll be overwriting it. + */ + while (uaddr <= end) { + ret = subyte(uaddr, 0); + if (ret != 0) + return -EFAULT; + uaddr += PAGE_SIZE; + } -int i915_gem_init(struct drm_device *dev) -{ - struct drm_i915_private *dev_priv = dev->dev_private; - unsigned long gtt_size, mappable_size; - int ret; + /* Check whether the range spilled into the next page. */ + if (((unsigned long)uaddr & ~PAGE_MASK) == + ((unsigned long)end & ~PAGE_MASK)) + ret = subyte(end, 0); - gtt_size = dev_priv->mm.gtt.gtt_total_entries << PAGE_SHIFT; - mappable_size = dev_priv->mm.gtt.gtt_mappable_entries << PAGE_SHIFT; + return ret; +} - DRM_LOCK(dev); - if (intel_enable_ppgtt(dev) && HAS_ALIASING_PPGTT(dev)) { - /* PPGTT pdes are stolen from global gtt ptes, so shrink the - * aperture accordingly when using aliasing ppgtt. */ - gtt_size -= I915_PPGTT_PD_ENTRIES*PAGE_SIZE; +static inline int +__copy_to_user_swizzled(char __user *cpu_vaddr, + const char *gpu_vaddr, int gpu_offset, + int length) +{ + int ret, cpu_offset = 0; - i915_gem_init_global_gtt(dev, 0, mappable_size, gtt_size); + while (length > 0) { + int cacheline_end = roundup2(gpu_offset + 1, 64); + int this_length = min(cacheline_end - gpu_offset, length); + int swizzled_gpu_offset = gpu_offset ^ 64; - ret = i915_gem_init_aliasing_ppgtt(dev); - if (ret) { - DRM_UNLOCK(dev); - return ret; - } - } else { - /* Let GEM Manage all of the aperture. - * - * However, leave one page at the end still bound to the scratch - * page. There are a number of places where the hardware - * apparently prefetches past the end of the object, and we've - * seen multiple hangs with the GPU head pointer stuck in a - * batchbuffer bound at the last page of the aperture. One page - * should be enough to keep any prefetching inside of the - * aperture. - */ - i915_gem_init_global_gtt(dev, 0, mappable_size, - gtt_size); - } + ret = __copy_to_user(cpu_vaddr + cpu_offset, + gpu_vaddr + swizzled_gpu_offset, + this_length); + if (ret) + return ret + length; - ret = i915_gem_init_hw(dev); - DRM_UNLOCK(dev); - if (ret != 0) { - i915_gem_cleanup_aliasing_ppgtt(dev); - return (ret); + cpu_offset += this_length; + gpu_offset += this_length; + length -= this_length; } - /* Allow hardware batchbuffers unless told otherwise, but not for KMS. */ - if (!drm_core_check_feature(dev, DRIVER_MODESET)) - dev_priv->dri1.allow_batchbuffer = 1; return 0; } -int -i915_gem_get_aperture_ioctl(struct drm_device *dev, void *data, - struct drm_file *file) +static inline int +__copy_from_user_swizzled(char *gpu_vaddr, int gpu_offset, + const char __user *cpu_vaddr, + int length) { - struct drm_i915_private *dev_priv; - struct drm_i915_gem_get_aperture *args; - struct drm_i915_gem_object *obj; - size_t pinned; + int ret, cpu_offset = 0; - dev_priv = dev->dev_private; - args = data; + while (length > 0) { + int cacheline_end = roundup2(gpu_offset + 1, 64); + int this_length = min(cacheline_end - gpu_offset, length); + int swizzled_gpu_offset = gpu_offset ^ 64; - pinned = 0; - DRM_LOCK(dev); - list_for_each_entry(obj, &dev_priv->mm.gtt_list, gtt_list) - if (obj->pin_count) - pinned += obj->gtt_space->size; - DRM_UNLOCK(dev); + ret = __copy_from_user(gpu_vaddr + swizzled_gpu_offset, + cpu_vaddr + cpu_offset, + this_length); + if (ret) + return ret + length; - args->aper_size = dev_priv->mm.gtt_total; - args->aper_available_size = args->aper_size - pinned; + cpu_offset += this_length; + gpu_offset += this_length; + length -= this_length; + } - return (0); + return 0; } -int -i915_gem_object_pin(struct drm_i915_gem_object *obj, uint32_t alignment, - bool map_and_fenceable) +/* Per-page copy function for the shmem pread fastpath. + * Flushes invalid cachelines before reading the target if + * needs_clflush is set. */ +static int +shmem_pread_fast(vm_page_t page, int shmem_page_offset, int page_length, + char __user *user_data, + bool page_do_bit17_swizzling, bool needs_clflush) { + char *vaddr; + struct sf_buf *sf; int ret; - if (obj->pin_count == DRM_I915_GEM_OBJECT_MAX_PIN_COUNT) - return (-EBUSY); - - if (obj->gtt_space != NULL) { - if ((alignment && obj->gtt_offset & (alignment - 1)) || - (map_and_fenceable && !obj->map_and_fenceable)) { - DRM_DEBUG("bo is already pinned with incorrect alignment:" - " offset=%x, req.alignment=%x, req.map_and_fenceable=%d," - " obj->map_and_fenceable=%d\n", - obj->gtt_offset, alignment, - map_and_fenceable, - obj->map_and_fenceable); - ret = i915_gem_object_unbind(obj); - if (ret != 0) - return (ret); - } - } + if (unlikely(page_do_bit17_swizzling)) + return -EINVAL; - if (obj->gtt_space == NULL) { - ret = i915_gem_object_bind_to_gtt(obj, alignment, - map_and_fenceable); - if (ret) - return (ret); + sched_pin(); + sf = sf_buf_alloc(page, SFB_NOWAIT | SFB_CPUPRIVATE); + if (sf == NULL) { + sched_unpin(); + return (-EFAULT); } + vaddr = (char *)sf_buf_kva(sf); + if (needs_clflush) + drm_clflush_virt_range(vaddr + shmem_page_offset, + page_length); + ret = __copy_to_user_inatomic(user_data, + vaddr + shmem_page_offset, + page_length); + sf_buf_free(sf); + sched_unpin(); - if (!obj->has_global_gtt_mapping && map_and_fenceable) - i915_gem_gtt_bind_object(obj, obj->cache_level); - - obj->pin_count++; - obj->pin_mappable |= map_and_fenceable; - - return 0; + return ret ? -EFAULT : 0; } -void -i915_gem_object_unpin(struct drm_i915_gem_object *obj) +static void +shmem_clflush_swizzled_range(char *addr, unsigned long length, + bool swizzled) { + if (unlikely(swizzled)) { + unsigned long start = (unsigned long) addr; + unsigned long end = (unsigned long) addr + length; - KASSERT(obj->pin_count != 0, ("zero pin count")); - KASSERT(obj->gtt_space != NULL, ("No gtt mapping")); + /* For swizzling simply ensure that we always flush both + * channels. Lame, but simple and it works. Swizzled + * pwrite/pread is far from a hotpath - current userspace + * doesn't use it at all. */ + start = rounddown2(start, 128); + end = roundup2(end, 128); - if (--obj->pin_count == 0) - obj->pin_mappable = false; -} + drm_clflush_virt_range((void *)start, end - start); + } else { + drm_clflush_virt_range(addr, length); + } -int -i915_gem_pin_ioctl(struct drm_device *dev, void *data, - struct drm_file *file) +} + +/* Only difference to the fast-path function is that this can handle bit17 + * and uses non-atomic copy and kmap functions. */ +static int +shmem_pread_slow(vm_page_t page, int shmem_page_offset, int page_length, + char __user *user_data, + bool page_do_bit17_swizzling, bool needs_clflush) { - struct drm_i915_gem_pin *args; - struct drm_i915_gem_object *obj; - struct drm_gem_object *gobj; + char *vaddr; + struct sf_buf *sf; int ret; - args = data; + sf = sf_buf_alloc(page, 0); + vaddr = (char *)sf_buf_kva(sf); + if (needs_clflush) + shmem_clflush_swizzled_range(vaddr + shmem_page_offset, + page_length, + page_do_bit17_swizzling); - ret = i915_mutex_lock_interruptible(dev); - if (ret != 0) - return ret; + if (page_do_bit17_swizzling) + ret = __copy_to_user_swizzled(user_data, + vaddr, shmem_page_offset, + page_length); + else + ret = __copy_to_user(user_data, + vaddr + shmem_page_offset, + page_length); + sf_buf_free(sf); - gobj = drm_gem_object_lookup(dev, file, args->handle); - if (gobj == NULL) { - ret = -ENOENT; - goto unlock; - } - obj = to_intel_bo(gobj); + return ret ? - EFAULT : 0; +} - if (obj->madv != I915_MADV_WILLNEED) { - DRM_ERROR("Attempting to pin a purgeable buffer\n"); - ret = -EINVAL; - goto out; - } +static int +i915_gem_shmem_pread(struct drm_device *dev, + struct drm_i915_gem_object *obj, + struct drm_i915_gem_pread *args, + struct drm_file *file) +{ + char __user *user_data; + ssize_t remain, sremain; + off_t offset, soffset; + int shmem_page_offset, page_length, ret = 0; + int obj_do_bit17_swizzling, page_do_bit17_swizzling; + int prefaulted = 0; + int needs_clflush = 0; - if (obj->pin_filp != NULL && obj->pin_filp != file) { - DRM_ERROR("Already pinned in i915_gem_pin_ioctl(): %d\n", - args->handle); - ret = -EINVAL; - goto out; - } + user_data = to_user_ptr(args->data_ptr); + sremain = remain = args->size; - obj->user_pin_count++; - obj->pin_filp = file; - if (obj->user_pin_count == 1) { - ret = i915_gem_object_pin(obj, args->alignment, true); - if (ret != 0) - goto out; + obj_do_bit17_swizzling = i915_gem_object_needs_bit17_swizzle(obj); + + if (!(obj->base.read_domains & I915_GEM_DOMAIN_CPU)) { + /* If we're not in the cpu read domain, set ourself into the gtt + * read domain and manually flush cachelines (if required). This + * optimizes for the case when the gpu will dirty the data + * anyway again before the next pread happens. */ + needs_clflush = !cpu_cache_is_coherent(dev, obj->cache_level); + ret = i915_gem_object_set_to_gtt_domain(obj, false); + if (ret) + return ret; } - /* XXX - flush the CPU caches for pinned objects - * as the X server doesn't manage domains yet - */ - i915_gem_object_flush_cpu_write_domain(obj); - args->offset = obj->gtt_offset; -out: - drm_gem_object_unreference(&obj->base); -unlock: - DRM_UNLOCK(dev); - return (ret); -} + soffset = offset = args->offset; + ret = i915_gem_object_get_pages_range(obj, soffset, soffset + sremain); + if (ret) + return ret; -int -i915_gem_unpin_ioctl(struct drm_device *dev, void *data, - struct drm_file *file) -{ - struct drm_i915_gem_pin *args; - struct drm_i915_gem_object *obj; - int ret; + i915_gem_object_pin_pages(obj); - args = data; - ret = i915_mutex_lock_interruptible(dev); - if (ret != 0) - return (ret); + VM_OBJECT_WLOCK(obj->base.vm_obj); + for (vm_page_t page = vm_page_find_least(obj->base.vm_obj, + OFF_TO_IDX(offset));; page = vm_page_next(page)) { + VM_OBJECT_WUNLOCK(obj->base.vm_obj); - obj = to_intel_bo(drm_gem_object_lookup(dev, file, args->handle)); - if (&obj->base == NULL) { - ret = -ENOENT; - goto unlock; - } + if (remain <= 0) + break; - if (obj->pin_filp != file) { - DRM_ERROR("Not pinned by caller in i915_gem_pin_ioctl(): %d\n", - args->handle); - ret = -EINVAL; - goto out; - } - obj->user_pin_count--; - if (obj->user_pin_count == 0) { - obj->pin_filp = NULL; - i915_gem_object_unpin(obj); + /* Operation in this page + * + * shmem_page_offset = offset within page in shmem file + * page_length = bytes to copy for this page + */ + shmem_page_offset = offset_in_page(offset); + page_length = remain; + if ((shmem_page_offset + page_length) > PAGE_SIZE) + page_length = PAGE_SIZE - shmem_page_offset; + + page_do_bit17_swizzling = obj_do_bit17_swizzling && + (page_to_phys(page) & (1 << 17)) != 0; + + ret = shmem_pread_fast(page, shmem_page_offset, page_length, + user_data, page_do_bit17_swizzling, + needs_clflush); + if (ret == 0) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Tue Jul 28 21:49:39 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0BC69ADE84; Tue, 28 Jul 2015 21:49:39 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C74942F8; Tue, 28 Jul 2015 21:49:39 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SLndJ0050934; Tue, 28 Jul 2015 21:49:39 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SLndDQ050933; Tue, 28 Jul 2015 21:49:39 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201507282149.t6SLndDQ050933@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 28 Jul 2015 21:49:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285989 - head/usr.sbin/pw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 21:49:40 -0000 Author: bapt Date: Tue Jul 28 21:49:38 2015 New Revision: 285989 URL: https://svnweb.freebsd.org/changeset/base/285989 Log: Reject usermod and userdel if the user concerned is not on the user database supposed to be manipulated This prevent pw usermod creating a new local user when requesting to usermod on a username is defined in LDAP. This issue only happens when modifying the local user database (not inpacting commands when -V or -R are used). PR: 187653 Submitted by: tmwalaszek@gmail.com Modified: head/usr.sbin/pw/pw_user.c Modified: head/usr.sbin/pw/pw_user.c ============================================================================== --- head/usr.sbin/pw/pw_user.c Tue Jul 28 21:47:37 2015 (r285988) +++ head/usr.sbin/pw/pw_user.c Tue Jul 28 21:49:38 2015 (r285989) @@ -310,6 +310,7 @@ pw_user(int mode, char *name, long id, s FILE *fp; char *dmode_c; void *set = NULL; + int valid_type = _PWF_FILES; static struct passwd fakeuser = { @@ -505,6 +506,14 @@ pw_user(int mode, char *name, long id, s errx(EX_NOUSER, "no such user `%s'", name); } + if (conf.userconf->nispasswd && *conf.userconf->nispasswd == '/') + valid_type = _PWF_NIS; + + if (PWF._altdir == PWF_REGULAR && + ((pwd->pw_fields & _PWF_SOURCE) != valid_type)) + errx(EX_NOUSER, "no such %s user `%s'", + valid_type == _PWF_FILES ? "local" : "NIS" , name); + if (name == NULL) name = pwd->pw_name; @@ -1076,6 +1085,7 @@ pw_userdel(char *name, long id) char grname[LOGNAMESIZE]; int rc; struct stat st; + int valid_type = _PWF_FILES; if (id < 0 && name == NULL) errx(EX_DATAERR, "username or id required"); @@ -1086,6 +1096,15 @@ pw_userdel(char *name, long id) errx(EX_NOUSER, "no such uid `%ld'", id); errx(EX_NOUSER, "no such user `%s'", name); } + + if (conf.userconf->nispasswd && *conf.userconf->nispasswd == '/') + valid_type = _PWF_NIS; + + if (PWF._altdir == PWF_REGULAR && + ((pwd->pw_fields & _PWF_SOURCE) != valid_type)) + errx(EX_NOUSER, "no such %s user `%s'", + valid_type == _PWF_FILES ? "local" : "NIS" , name); + uid = pwd->pw_uid; if (name == NULL) name = pwd->pw_name; From owner-svn-src-all@freebsd.org Tue Jul 28 21:50:51 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D05E59AD022; Tue, 28 Jul 2015 21:50:51 +0000 (UTC) (envelope-from jean-sebastien.pedron@dumbbell.fr) Received: from mail.made4.biz (mail.made4.biz [IPv6:2001:41d0:2:c018::1:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B9B38DE; Tue, 28 Jul 2015 21:50:51 +0000 (UTC) (envelope-from jean-sebastien.pedron@dumbbell.fr) Received: from 141.7.19.93.rev.sfr.net ([93.19.7.141] helo=magellan.dumbbell.fr) by mail.made4.biz with esmtpsa (TLSv1.2:DHE-RSA-AES128-SHA:128) (Exim 4.85 (FreeBSD)) (envelope-from ) id 1ZKClt-0000EJ-KU; Tue, 28 Jul 2015 23:50:49 +0200 Subject: Re: svn commit: r285125 - in head/sys: kern sys To: Adrian Chadd , Mateusz Guzik References: <201507040654.t646sGO7044196@repo.freebsd.org> <20150721083922.GB6736@dft-labs.eu> <3863130.vz23U50G0A@ralph.baldwin.cx> <20150722043323.GA23614@dft-labs.eu> Cc: John Baldwin , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" From: =?UTF-8?Q?Jean-S=c3=a9bastien_P=c3=a9dron?= Message-ID: <55B7F930.8010703@dumbbell.fr> Date: Tue, 28 Jul 2015 23:50:40 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="lnQ29oK9dqMgKUtj0CN4vwVVjGK4cXeA9" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 21:50:51 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --lnQ29oK9dqMgKUtj0CN4vwVVjGK4cXeA9 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 23.07.2015 23:36, Adrian Chadd wrote: > I've had no warnings/panics after applying this patch. Can we get it > into -head plz? I'm using this patch for three days and never got the panic again. --=20 Jean-S=C3=A9bastien P=C3=A9dron --lnQ29oK9dqMgKUtj0CN4vwVVjGK4cXeA9 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQJ8BAEBCgBmBQJVt/k5XxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQ2NzA4N0ZEMUFFQUUwRTEyREJDNkE2RjAz OUU5OTc2MUE1RkQ5NENDAAoJEDnpl2Gl/ZTMU18P/0KS1Gk5LT7leBbM4fXPwQfY o7RckrKNQcSHEr765X9dogm9wwiJOtsvvpUAV64xFrT9YEeXWDhVThcZ29igbprP Z7gwgYZwjBboBhyUpKYnxej336x9GxHlIIUPVMJ+hv+IMMYZW/c0XqwD9BTyJ0KK HSftJCLK/CDg8g0gOL/ACF+4nQ6VpyA3RZgwEjm2Ff4G/cy0sGQHk246Qet2UeeW fwH7prvB73p5s4RS9GSEeUbo3GtahHRa85A3zmoTEPRd+izSLj5IDGbJY1j2wQ9f 5uX2d10PjZDva4NrS9tz1Twqd0+oeGRtAId5iZc/MEJJJOqozrIRP7IOVlrGWMNW nf15yt43UnGc1yARSsMyrnRoP283DU1SmpJgnYpe6osn8IEaEYJ4ACJWZttVOIDv 68Y4KY3fIe/x18oF9arEsBNDDUCPVtaNJANgLm/b2MPb4H8yUrON/EapOCNJij2d NNqqk0U1QoBC7BV7+6E+9Xin/cNHQkAkUlaveZKULQTKpHg86PrA2c2tr/VTcWs1 wNVPtuIJKSe3If1rC/oZmUm2HZXV8n86t4wlkwEqk4h4WHymJExNSxD/FfUa+yWm YQZloFHhaFKTNwyMiLzSAXS8qPRp/c4z6byo4We4EFE+7Lfk+sRTI+1BzpoZxgOa 1iv5eOK8XuGLsY28ctVI =E3PR -----END PGP SIGNATURE----- --lnQ29oK9dqMgKUtj0CN4vwVVjGK4cXeA9-- From owner-svn-src-all@freebsd.org Tue Jul 28 21:59:54 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF4A69AD24C; Tue, 28 Jul 2015 21:59:54 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk0-x233.google.com (mail-qk0-x233.google.com [IPv6:2607:f8b0:400d:c09::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 75F7BD8F; Tue, 28 Jul 2015 21:59:54 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by qkdv3 with SMTP id v3so57652048qkd.3; Tue, 28 Jul 2015 14:59:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=XPScGfGj7qKF2O1NwKpit3MBrvqOSKJOJUDIPCVjWnA=; b=OkdvR5FqH96NjEvOH+vn/6Itg6yb2FAm33cjG7X+Y6ufBKAeV3AC+NhuGE/snR1TJF 9vGND0tltmYgvig4KjKj30IPuYiRhY1uFQ7CXHWcLYZjt4s5RAOHwlUD80GoBxFBlZ09 TrtWu4FXBa1UZgJw662dB4py33BDBADFrtCGg98tVNxTHcFxJeBHfOGbIII+9dIrlPWi tJr2w1OvS1C9n0A+3wEN2Ps1phGjnbziTootWl3t+k0qL7VVLss3vvTmMTOK6AaL7D67 +bxAZcwIrh0oU9GulXUPJ1WwRcLfxHjeeZPYSHGRnbc0lbM7hwft+7giFZ7yY2Fa4eu0 fp5g== X-Received: by 10.55.23.151 with SMTP id 23mr52169740qkx.1.1438120793690; Tue, 28 Jul 2015 14:59:53 -0700 (PDT) Received: from muskytusk ([104.236.250.12]) by smtp.gmail.com with ESMTPSA id i36sm12142450qkh.36.2015.07.28.14.59.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Jul 2015 14:59:52 -0700 (PDT) Sender: Mark Johnston Date: Tue, 28 Jul 2015 21:59:12 +0000 From: Mark Johnston To: Gleb Smirnoff Cc: Jason Unovitch , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r285782 - head/usr.bin/netstat Message-ID: <20150728184104.GA94463@muskytusk> References: <201507212357.t6LNvd7K023794@repo.freebsd.org> <20150728143106.GY72729@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150728143106.GY72729@FreeBSD.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 21:59:54 -0000 On Tue, Jul 28, 2015 at 05:31:06PM +0300, Gleb Smirnoff wrote: > Mark, Jason, > > On Tue, Jul 21, 2015 at 11:57:39PM +0000, Mark Johnston wrote: > M> Fix counter reads on platforms where sizeof(uint64_t) != sizeof(uint64_t *). > M> > M> In the kernel, structs such as tcpstat are manipulated as an array of > M> counter_u64_t (uint64_t *), but made visible to userland as an array of > M> uint64_t. kread_counters() was previously copying the counter array into > M> user space and sequentially overwriting each counter with its value. This > M> mostly affects IPsec counters, as other counters are exported via sysctl. > M> > M> PR: 201700 > M> Tested by: Jason Unovitch > > Thanks for fixing the bug after me. > > One question, though: why do you use sizeof(u_long) instead of size of a > pointer? kvm_counter_u64_fetch(3) takes a u_long for the KVA of the counter, so it seemed natural to read an array of counter addresses into an array of u_long. > > M> ============================================================================== > M> --- head/usr.bin/netstat/main.c Tue Jul 21 23:44:36 2015 (r285781) > M> +++ head/usr.bin/netstat/main.c Tue Jul 21 23:57:38 2015 (r285782) > M> @@ -776,19 +776,31 @@ kread_counter(u_long addr) > M> int > M> kread_counters(u_long addr, void *buf, size_t size) > M> { > M> - uint64_t *c = buf; > M> + uint64_t *c; > M> + u_long *counters; > M> + size_t i, n; > M> > M> if (kvmd_init() < 0) > M> return (-1); > M> > M> - if (kread(addr, buf, size) < 0) > M> + if (size % sizeof(uint64_t) != 0) { > M> + xo_warnx("kread_counters: invalid counter set size"); > M> return (-1); > M> + } > M> > M> - while (size != 0) { > M> - *c = kvm_counter_u64_fetch(kvmd, *c); > M> - size -= sizeof(*c); > M> - c++; > M> + n = size / sizeof(uint64_t); > M> + if ((counters = malloc(n * sizeof(u_long))) == NULL) > M> + xo_err(-1, "malloc"); > M> + if (kread(addr, counters, n * sizeof(u_long)) < 0) { > M> + free(counters); > M> + return (-1); > M> } > M> + > M> + c = buf; > M> + for (i = 0; i < n; i++) > M> + c[i] = kvm_counter_u64_fetch(kvmd, counters[i]); > M> + > M> + free(counters); > M> return (0); > M> } > > -- > Totus tuus, Glebius. From owner-svn-src-all@freebsd.org Tue Jul 28 22:48:59 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C8919AD22D; Tue, 28 Jul 2015 22:48:59 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D1EDD57; Tue, 28 Jul 2015 22:48:59 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6SMmxIT077264; Tue, 28 Jul 2015 22:48:59 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6SMmxRb077263; Tue, 28 Jul 2015 22:48:59 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201507282248.t6SMmxRb077263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 28 Jul 2015 22:48:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285990 - head/lib/libc/sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 22:48:59 -0000 Author: bdrewery Date: Tue Jul 28 22:48:58 2015 New Revision: 285990 URL: https://svnweb.freebsd.org/changeset/base/285990 Log: unlink(2): Note the possibility for ENOSPC to be returned on ZFS. PR: 154930 Modified: head/lib/libc/sys/unlink.2 Modified: head/lib/libc/sys/unlink.2 ============================================================================== --- head/lib/libc/sys/unlink.2 Tue Jul 28 21:49:38 2015 (r285989) +++ head/lib/libc/sys/unlink.2 Tue Jul 28 22:48:58 2015 (r285990) @@ -28,7 +28,7 @@ .\" @(#)unlink.2 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd April 25, 2010 +.Dd July 28, 2015 .Dt UNLINK 2 .Os .Sh NAME @@ -151,6 +151,9 @@ The .Fa path argument points outside the process's allocated address space. +.It Bq Er ENOSPC +On file systems supporting copy-on-write or snapshots, there was not enough +free space to record metadata for the delete operation of the file. .El .Pp In addition to the errors returned by the From owner-svn-src-all@freebsd.org Tue Jul 28 22:53:03 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 463849AD41F; Tue, 28 Jul 2015 22:53:03 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by mx1.freebsd.org (Postfix) with ESMTP id 7CBDC1D8; Tue, 28 Jul 2015 22:53:02 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail108.syd.optusnet.com.au (Postfix) with ESMTPS id 2DC621A1ADC; Wed, 29 Jul 2015 08:52:52 +1000 (AEST) Date: Wed, 29 Jul 2015 08:52:52 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Baptiste Daroussin cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r285985 - in head/usr.sbin/pw: . tests In-Reply-To: <201507282110.t6SLAx0k035167@repo.freebsd.org> Message-ID: <20150729080932.S5059@besplex.bde.org> References: <201507282110.t6SLAx0k035167@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=XMDNMlVE c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=kj9zAlcOel0A:10 a=7YfXLusrAAAA:8 a=HdzjfYQfgVDZoVN09S8A:9 a=J1zZFbDsFyZ9_z_e:21 a=GQZ45p5tVgdAolL7:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 22:53:03 -0000 On Tue, 28 Jul 2015, Baptiste Daroussin wrote: > Log: > Check uid/gid used when creating a user/group are not larger than UID_MAX/GID_MAX > > PR: 173977 > Reported by: nvass@gmx.com This is broken in a different way than before. > Modified: head/usr.sbin/pw/pw.c > ============================================================================== > --- head/usr.sbin/pw/pw.c Tue Jul 28 20:52:10 2015 (r285984) > +++ head/usr.sbin/pw/pw.c Tue Jul 28 21:10:58 2015 (r285985) > @@ -269,7 +269,7 @@ main(int argc, char *argv[]) > } > if (strspn(optarg, "0123456789") != strlen(optarg)) > errx(EX_USAGE, "-g expects a number"); > - id = strtonum(optarg, 0, LONG_MAX, &errstr); > + id = strtonum(optarg, 0, GID_MAX, &errstr); `id' still has type long. The assignment overflows on 32-bit arches when the value exceeds 0x7fffffff. That is for half of all valid values. pw is broken in not supporting these values, but at least it detected them as errors in the previous version. Old versions implemented this bug using atoi() with no error checking. The behaviour in the overflowing cases is implementation-defined. Normally this converts large values to negative ones. This defeats the lower limit of 0. The change works accidentally on 64-bit arches. It is assumed that GID_MAX is representable as long long (since strtonum()'s API is too broken to use even intmax_t, and uintmax_t is needed). This assumption is satisfied now. It would break if someone expands gid_t to uint64_t. without expandling long long to int65_t or larger. Then passing GID_MAX would change it to an implementation-defined value. Normally to INT64_MIN. This negative, so there are no values in the range. Similarly for uids. > Added: head/usr.sbin/pw/tests/pw_groupadd.sh > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/usr.sbin/pw/tests/pw_groupadd.sh Tue Jul 28 21:10:58 2015 (r285985) > @@ -0,0 +1,15 @@ > +# $FreeBSD$ > + > +# Import helper functions > +. $(atf_get_srcdir)/helper_functions.shin > + > +atf_test_case group_add_gid_too_large > +group_add_gid_too_large_body() { > + populate_etc_skel > + atf_check -s exit:64 -e inline:"pw: Bad id '9999999999999': too large\n" \ > + ${PW} groupadd -n test1 -g 9999999999999 > +} Check for large valid ids on i386 (should succeed, but currently fail), negative ids (require failure), magic ids like (uid_t)-1 and (uid_t)-2 (should fail, but currently succeed on amd64), and the hex ids (should succeed, but currently fail). (uid_t)-1 is special for some syscalls, so shouldn't be permitted for users. (uid_t)-2 special for nfs (see exports(5)). The magic ids are hard to spell without using hex, but pw is too broken to accept that. For 32-bit ids, the above number should be replaced by 0x100000000 when pw supports hex. Also check that 0xffffffff and 0xfffffffe are not too large, but reserved, and that 0xfffffffd is not too large and not reserved. Bruce From owner-svn-src-all@freebsd.org Tue Jul 28 23:21:11 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8AEAE9ADD34; Tue, 28 Jul 2015 23:21:11 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wi0-x22c.google.com (mail-wi0-x22c.google.com [IPv6:2a00:1450:400c:c05::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 21659795; Tue, 28 Jul 2015 23:21:11 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by wicgb10 with SMTP id gb10so176860338wic.1; Tue, 28 Jul 2015 16:21:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=7jbAcSyA4aY3CDEbqihPOdr/6iZZlRB8JfjpSWlBUGI=; b=oEhtsCpkx3yR7S8RKbd0w0cPPvoTvk2yUll/yD9k7+2KEiUuJsLUp7Xi+0hr2rd6h4 p73i4CAvqXaLoG5ig32MZBMG0/YIvusUtWZvX493Pl4ymGAOfQ1bBMO2O2h/fpsuIoF8 Li+V59u0HIX3RRlR1WfKELoAcx+RW/1bLSkIBpJsXbpDLQz3xqWlZvKDSQwSLI+dwI4u moaoFsVbYFLH9vQJvqQD+FL6+Oorbk1APK7jGelAkU8RAOikP4O0e/9Qe8vjoNuiAcFr lQK233Ci1a15dBNDYOw193ijcXQK7qXQ2xDz6CmbWLc4uf671Yy9rhOnHkjCtpMGO2MH LwSA== X-Received: by 10.180.73.2 with SMTP id h2mr11750807wiv.72.1438125669607; Tue, 28 Jul 2015 16:21:09 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id u7sm21291442wif.3.2015.07.28.16.21.08 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Jul 2015 16:21:08 -0700 (PDT) Sender: Baptiste Daroussin Date: Wed, 29 Jul 2015 01:21:06 +0200 From: Baptiste Daroussin To: Bruce Evans Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r285985 - in head/usr.sbin/pw: . tests Message-ID: <20150728232106.GG28638@ivaldir.etoilebsd.net> References: <201507282110.t6SLAx0k035167@repo.freebsd.org> <20150729080932.S5059@besplex.bde.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="4ndw/alBWmZEhfcZ" Content-Disposition: inline In-Reply-To: <20150729080932.S5059@besplex.bde.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jul 2015 23:21:11 -0000 --4ndw/alBWmZEhfcZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 29, 2015 at 08:52:52AM +1000, Bruce Evans wrote: > On Tue, 28 Jul 2015, Baptiste Daroussin wrote: >=20 > > Log: > > Check uid/gid used when creating a user/group are not larger than UID_= MAX/GID_MAX > > > > PR: 173977 > > Reported by: nvass@gmx.com >=20 > This is broken in a different way than before. >=20 > > Modified: head/usr.sbin/pw/pw.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/usr.sbin/pw/pw.c Tue Jul 28 20:52:10 2015 (r285984) > > +++ head/usr.sbin/pw/pw.c Tue Jul 28 21:10:58 2015 (r285985) > > @@ -269,7 +269,7 @@ main(int argc, char *argv[]) > > } > > if (strspn(optarg, "0123456789") !=3D strlen(optarg)) > > errx(EX_USAGE, "-g expects a number"); > > - id =3D strtonum(optarg, 0, LONG_MAX, &errstr); > > + id =3D strtonum(optarg, 0, GID_MAX, &errstr); >=20 > `id' still has type long. The assignment overflows on 32-bit arches when > the value exceeds 0x7fffffff. That is for half of all valid values. pw > is broken in not supporting these values, but at least it detected them > as errors in the previous version. Old versions implemented this bug > using atoi() with no error checking. So writting a function like strtonum like function with that prototype intmax_t strtonumber(const char *, intmax_t min, intmax_t max, const char *= *); and an unsigned equivalent uintmax_t strtonumber(const char *, uintmax_t min, uintmax_t max, const cha= r **); would do the right thing? Best regards, Bapt --4ndw/alBWmZEhfcZ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlW4DmIACgkQ8kTtMUmk6EwZ/gCgn/AN+ahJg1D4LUOPWmSHgC9P nAAAmQEWweWAbtcDYfml3rDxoOllsffM =fezR -----END PGP SIGNATURE----- --4ndw/alBWmZEhfcZ-- From owner-svn-src-all@freebsd.org Wed Jul 29 00:57:57 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2E7519ADD2B; Wed, 29 Jul 2015 00:57:57 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 188C51C00; Wed, 29 Jul 2015 00:57:57 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6T0vvgq034276; Wed, 29 Jul 2015 00:57:57 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6T0vtsu034270; Wed, 29 Jul 2015 00:57:55 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507290057.t6T0vtsu034270@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 29 Jul 2015 00:57:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r285991 - in releng/10.2/sys/dev: pccbb pci X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 00:57:57 -0000 Author: gjb Date: Wed Jul 29 00:57:54 2015 New Revision: 285991 URL: https://svnweb.freebsd.org/changeset/base/285991 Log: MFS r285863 (jhb): Partially revert r284034. In particular, revert the final change in this MFC (281874). It broke suspend and resume on several Thinkpads (though not all) in 10 even though it works fine on the same laptops in HEAD. PR: 201239 Reported by: Kevin Oberman and several others Approved by: re (kib) Sponsored by: The FreeBSD Foundation Modified: releng/10.2/sys/dev/pccbb/pccbb_pci.c releng/10.2/sys/dev/pci/pci.c releng/10.2/sys/dev/pci/pci_pci.c releng/10.2/sys/dev/pci/pcib_private.h releng/10.2/sys/dev/pci/pcivar.h Directory Properties: releng/10.2/ (props changed) Modified: releng/10.2/sys/dev/pccbb/pccbb_pci.c ============================================================================== --- releng/10.2/sys/dev/pccbb/pccbb_pci.c Tue Jul 28 22:48:58 2015 (r285990) +++ releng/10.2/sys/dev/pccbb/pccbb_pci.c Wed Jul 29 00:57:54 2015 (r285991) @@ -259,6 +259,32 @@ cbb_pci_probe(device_t brdev) } /* + * Still need this because the pci code only does power for type 0 + * header devices. + */ +static void +cbb_powerstate_d0(device_t dev) +{ + u_int32_t membase, irq; + + if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) { + /* Save important PCI config data. */ + membase = pci_read_config(dev, CBBR_SOCKBASE, 4); + irq = pci_read_config(dev, PCIR_INTLINE, 4); + + /* Reset the power state. */ + device_printf(dev, "chip is in D%d power mode " + "-- setting to D0\n", pci_get_powerstate(dev)); + + pci_set_powerstate(dev, PCI_POWERSTATE_D0); + + /* Restore PCI config data. */ + pci_write_config(dev, CBBR_SOCKBASE, membase, 4); + pci_write_config(dev, PCIR_INTLINE, irq, 4); + } +} + +/* * Print out the config space */ static void @@ -295,15 +321,15 @@ cbb_pci_attach(device_t brdev) sc->cbdev = NULL; sc->exca[0].pccarddev = NULL; sc->domain = pci_get_domain(brdev); + sc->bus.sec = pci_read_config(brdev, PCIR_SECBUS_2, 1); + sc->bus.sub = pci_read_config(brdev, PCIR_SUBBUS_2, 1); sc->pribus = pcib_get_bus(parent); #if defined(NEW_PCIB) && defined(PCI_RES_BUS) pci_write_config(brdev, PCIR_PRIBUS_2, sc->pribus, 1); pcib_setup_secbus(brdev, &sc->bus, 1); -#else - sc->bus.sec = pci_read_config(brdev, PCIR_SECBUS_2, 1); - sc->bus.sub = pci_read_config(brdev, PCIR_SUBBUS_2, 1); #endif SLIST_INIT(&sc->rl); + cbb_powerstate_d0(brdev); rid = CBBR_SOCKBASE; sc->base_res = bus_alloc_resource_any(brdev, SYS_RES_MEMORY, &rid, @@ -448,6 +474,11 @@ cbb_chipinit(struct cbb_softc *sc) if (pci_read_config(sc->dev, PCIR_LATTIMER, 1) < 0x20) pci_write_config(sc->dev, PCIR_LATTIMER, 0x20, 1); + /* Restore bus configuration */ + pci_write_config(sc->dev, PCIR_PRIBUS_2, sc->pribus, 1); + pci_write_config(sc->dev, PCIR_SECBUS_2, sc->bus.sec, 1); + pci_write_config(sc->dev, PCIR_SUBBUS_2, sc->bus.sub, 1); + /* Enable DMA, memory access for this card and I/O acces for children */ pci_enable_busmaster(sc->dev); pci_enable_io(sc->dev, SYS_RES_IOPORT); @@ -875,10 +906,15 @@ cbb_pci_resume(device_t brdev) * from D0 and back to D0 cause the bridge to lose its config space, so * all the bus mappings and such are preserved. * - * The PCI layer handles standard PCI registers like the - * command register and BARs, but cbb-specific registers are - * handled here. + * For most drivers, the PCI layer handles this saving. However, since + * there's much black magic and arcane art hidden in these few lines of + * code that would be difficult to transition into the PCI + * layer. chipinit was several years of trial and error to write. */ + pci_write_config(brdev, CBBR_SOCKBASE, rman_get_start(sc->base_res), 4); + DEVPRINTF((brdev, "PCI Memory allocated: %08lx\n", + rman_get_start(sc->base_res))); + sc->chipinit(sc); /* reset interrupt -- Do we really need to do this? */ Modified: releng/10.2/sys/dev/pci/pci.c ============================================================================== --- releng/10.2/sys/dev/pci/pci.c Tue Jul 28 22:48:58 2015 (r285990) +++ releng/10.2/sys/dev/pci/pci.c Wed Jul 29 00:57:54 2015 (r285991) @@ -590,19 +590,9 @@ pci_hdrtypedata(device_t pcib, int b, in cfg->nummaps = PCI_MAXMAPS_0; break; case PCIM_HDRTYPE_BRIDGE: - cfg->bridge.br_seclat = REG(PCIR_SECLAT_1, 1); - cfg->bridge.br_subbus = REG(PCIR_SUBBUS_1, 1); - cfg->bridge.br_secbus = REG(PCIR_SECBUS_1, 1); - cfg->bridge.br_pribus = REG(PCIR_PRIBUS_1, 1); - cfg->bridge.br_control = REG(PCIR_BRIDGECTL_1, 2); cfg->nummaps = PCI_MAXMAPS_1; break; case PCIM_HDRTYPE_CARDBUS: - cfg->bridge.br_seclat = REG(PCIR_SECLAT_2, 1); - cfg->bridge.br_subbus = REG(PCIR_SUBBUS_2, 1); - cfg->bridge.br_secbus = REG(PCIR_SECBUS_2, 1); - cfg->bridge.br_pribus = REG(PCIR_PRIBUS_2, 1); - cfg->bridge.br_control = REG(PCIR_BRIDGECTL_2, 2); cfg->subvendor = REG(PCIR_SUBVEND_2, 2); cfg->subdevice = REG(PCIR_SUBDEV_2, 2); cfg->nummaps = PCI_MAXMAPS_2; @@ -4948,6 +4938,16 @@ pci_cfg_restore(device_t dev, struct pci { /* + * Only do header type 0 devices. Type 1 devices are bridges, + * which we know need special treatment. Type 2 devices are + * cardbus bridges which also require special treatment. + * Other types are unknown, and we err on the side of safety + * by ignoring them. + */ + if ((dinfo->cfg.hdrtype & PCIM_HDRTYPE) != PCIM_HDRTYPE_NORMAL) + return; + + /* * Restore the device to full power mode. We must do this * before we restore the registers because moving from D3 to * D0 will cause the chip's BARs and some other registers to @@ -4957,44 +4957,16 @@ pci_cfg_restore(device_t dev, struct pci */ if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) pci_set_powerstate(dev, PCI_POWERSTATE_D0); + pci_restore_bars(dev); pci_write_config(dev, PCIR_COMMAND, dinfo->cfg.cmdreg, 2); pci_write_config(dev, PCIR_INTLINE, dinfo->cfg.intline, 1); pci_write_config(dev, PCIR_INTPIN, dinfo->cfg.intpin, 1); + pci_write_config(dev, PCIR_MINGNT, dinfo->cfg.mingnt, 1); + pci_write_config(dev, PCIR_MAXLAT, dinfo->cfg.maxlat, 1); pci_write_config(dev, PCIR_CACHELNSZ, dinfo->cfg.cachelnsz, 1); pci_write_config(dev, PCIR_LATTIMER, dinfo->cfg.lattimer, 1); pci_write_config(dev, PCIR_PROGIF, dinfo->cfg.progif, 1); pci_write_config(dev, PCIR_REVID, dinfo->cfg.revid, 1); - switch (dinfo->cfg.hdrtype & PCIM_HDRTYPE) { - case PCIM_HDRTYPE_NORMAL: - pci_write_config(dev, PCIR_MINGNT, dinfo->cfg.mingnt, 1); - pci_write_config(dev, PCIR_MAXLAT, dinfo->cfg.maxlat, 1); - break; - case PCIM_HDRTYPE_BRIDGE: - pci_write_config(dev, PCIR_SECLAT_1, - dinfo->cfg.bridge.br_seclat, 1); - pci_write_config(dev, PCIR_SUBBUS_1, - dinfo->cfg.bridge.br_subbus, 1); - pci_write_config(dev, PCIR_SECBUS_1, - dinfo->cfg.bridge.br_secbus, 1); - pci_write_config(dev, PCIR_PRIBUS_1, - dinfo->cfg.bridge.br_pribus, 1); - pci_write_config(dev, PCIR_BRIDGECTL_1, - dinfo->cfg.bridge.br_control, 2); - break; - case PCIM_HDRTYPE_CARDBUS: - pci_write_config(dev, PCIR_SECLAT_2, - dinfo->cfg.bridge.br_seclat, 1); - pci_write_config(dev, PCIR_SUBBUS_2, - dinfo->cfg.bridge.br_subbus, 1); - pci_write_config(dev, PCIR_SECBUS_2, - dinfo->cfg.bridge.br_secbus, 1); - pci_write_config(dev, PCIR_PRIBUS_2, - dinfo->cfg.bridge.br_pribus, 1); - pci_write_config(dev, PCIR_BRIDGECTL_2, - dinfo->cfg.bridge.br_control, 2); - break; - } - pci_restore_bars(dev); /* * Restore extended capabilities for PCI-Express and PCI-X @@ -5063,57 +5035,40 @@ pci_cfg_save(device_t dev, struct pci_de int ps; /* + * Only do header type 0 devices. Type 1 devices are bridges, which + * we know need special treatment. Type 2 devices are cardbus bridges + * which also require special treatment. Other types are unknown, and + * we err on the side of safety by ignoring them. Powering down + * bridges should not be undertaken lightly. + */ + if ((dinfo->cfg.hdrtype & PCIM_HDRTYPE) != PCIM_HDRTYPE_NORMAL) + return; + + /* * Some drivers apparently write to these registers w/o updating our * cached copy. No harm happens if we update the copy, so do so here * so we can restore them. The COMMAND register is modified by the * bus w/o updating the cache. This should represent the normally - * writable portion of the 'defined' part of type 0/1/2 headers. + * writable portion of the 'defined' part of type 0 headers. In + * theory we also need to save/restore the PCI capability structures + * we know about, but apart from power we don't know any that are + * writable. */ + dinfo->cfg.subvendor = pci_read_config(dev, PCIR_SUBVEND_0, 2); + dinfo->cfg.subdevice = pci_read_config(dev, PCIR_SUBDEV_0, 2); dinfo->cfg.vendor = pci_read_config(dev, PCIR_VENDOR, 2); dinfo->cfg.device = pci_read_config(dev, PCIR_DEVICE, 2); dinfo->cfg.cmdreg = pci_read_config(dev, PCIR_COMMAND, 2); dinfo->cfg.intline = pci_read_config(dev, PCIR_INTLINE, 1); dinfo->cfg.intpin = pci_read_config(dev, PCIR_INTPIN, 1); + dinfo->cfg.mingnt = pci_read_config(dev, PCIR_MINGNT, 1); + dinfo->cfg.maxlat = pci_read_config(dev, PCIR_MAXLAT, 1); dinfo->cfg.cachelnsz = pci_read_config(dev, PCIR_CACHELNSZ, 1); dinfo->cfg.lattimer = pci_read_config(dev, PCIR_LATTIMER, 1); dinfo->cfg.baseclass = pci_read_config(dev, PCIR_CLASS, 1); dinfo->cfg.subclass = pci_read_config(dev, PCIR_SUBCLASS, 1); dinfo->cfg.progif = pci_read_config(dev, PCIR_PROGIF, 1); dinfo->cfg.revid = pci_read_config(dev, PCIR_REVID, 1); - switch (dinfo->cfg.hdrtype & PCIM_HDRTYPE) { - case PCIM_HDRTYPE_NORMAL: - dinfo->cfg.subvendor = pci_read_config(dev, PCIR_SUBVEND_0, 2); - dinfo->cfg.subdevice = pci_read_config(dev, PCIR_SUBDEV_0, 2); - dinfo->cfg.mingnt = pci_read_config(dev, PCIR_MINGNT, 1); - dinfo->cfg.maxlat = pci_read_config(dev, PCIR_MAXLAT, 1); - break; - case PCIM_HDRTYPE_BRIDGE: - dinfo->cfg.bridge.br_seclat = pci_read_config(dev, - PCIR_SECLAT_1, 1); - dinfo->cfg.bridge.br_subbus = pci_read_config(dev, - PCIR_SUBBUS_1, 1); - dinfo->cfg.bridge.br_secbus = pci_read_config(dev, - PCIR_SECBUS_1, 1); - dinfo->cfg.bridge.br_pribus = pci_read_config(dev, - PCIR_PRIBUS_1, 1); - dinfo->cfg.bridge.br_control = pci_read_config(dev, - PCIR_BRIDGECTL_1, 2); - break; - case PCIM_HDRTYPE_CARDBUS: - dinfo->cfg.bridge.br_seclat = pci_read_config(dev, - PCIR_SECLAT_2, 1); - dinfo->cfg.bridge.br_subbus = pci_read_config(dev, - PCIR_SUBBUS_2, 1); - dinfo->cfg.bridge.br_secbus = pci_read_config(dev, - PCIR_SECBUS_2, 1); - dinfo->cfg.bridge.br_pribus = pci_read_config(dev, - PCIR_PRIBUS_2, 1); - dinfo->cfg.bridge.br_control = pci_read_config(dev, - PCIR_BRIDGECTL_2, 2); - dinfo->cfg.subvendor = pci_read_config(dev, PCIR_SUBVEND_2, 2); - dinfo->cfg.subdevice = pci_read_config(dev, PCIR_SUBDEV_2, 2); - break; - } if (dinfo->cfg.pcie.pcie_location != 0) pci_cfg_save_pcie(dev, dinfo); Modified: releng/10.2/sys/dev/pci/pci_pci.c ============================================================================== --- releng/10.2/sys/dev/pci/pci_pci.c Tue Jul 28 22:48:58 2015 (r285990) +++ releng/10.2/sys/dev/pci/pci_pci.c Wed Jul 29 00:57:54 2015 (r285991) @@ -549,22 +549,18 @@ void pcib_setup_secbus(device_t dev, struct pcib_secbus *bus, int min_count) { char buf[64]; - int error, rid, sec_reg; + int error, rid; switch (pci_read_config(dev, PCIR_HDRTYPE, 1) & PCIM_HDRTYPE) { case PCIM_HDRTYPE_BRIDGE: - sec_reg = PCIR_SECBUS_1; bus->sub_reg = PCIR_SUBBUS_1; break; case PCIM_HDRTYPE_CARDBUS: - sec_reg = PCIR_SECBUS_2; bus->sub_reg = PCIR_SUBBUS_2; break; default: panic("not a PCI bridge"); } - bus->sec = pci_read_config(dev, sec_reg, 1); - bus->sub = pci_read_config(dev, bus->sub_reg, 1); bus->dev = dev; bus->rman.rm_start = 0; bus->rman.rm_end = PCI_BUSMAX; @@ -849,16 +845,20 @@ pcib_set_mem_decode(struct pcib_softc *s static void pcib_cfg_save(struct pcib_softc *sc) { -#ifndef NEW_PCIB device_t dev; - uint16_t command; dev = sc->dev; - command = pci_read_config(dev, PCIR_COMMAND, 2); - if (command & PCIM_CMD_PORTEN) + sc->command = pci_read_config(dev, PCIR_COMMAND, 2); + sc->pribus = pci_read_config(dev, PCIR_PRIBUS_1, 1); + sc->bus.sec = pci_read_config(dev, PCIR_SECBUS_1, 1); + sc->bus.sub = pci_read_config(dev, PCIR_SUBBUS_1, 1); + sc->bridgectl = pci_read_config(dev, PCIR_BRIDGECTL_1, 2); + sc->seclat = pci_read_config(dev, PCIR_SECLAT_1, 1); +#ifndef NEW_PCIB + if (sc->command & PCIM_CMD_PORTEN) pcib_get_io_decode(sc); - if (command & PCIM_CMD_MEMEN) + if (sc->command & PCIM_CMD_MEMEN) pcib_get_mem_decode(sc); #endif } @@ -870,18 +870,21 @@ static void pcib_cfg_restore(struct pcib_softc *sc) { device_t dev; -#ifndef NEW_PCIB - uint16_t command; -#endif + dev = sc->dev; + pci_write_config(dev, PCIR_COMMAND, sc->command, 2); + pci_write_config(dev, PCIR_PRIBUS_1, sc->pribus, 1); + pci_write_config(dev, PCIR_SECBUS_1, sc->bus.sec, 1); + pci_write_config(dev, PCIR_SUBBUS_1, sc->bus.sub, 1); + pci_write_config(dev, PCIR_BRIDGECTL_1, sc->bridgectl, 2); + pci_write_config(dev, PCIR_SECLAT_1, sc->seclat, 1); #ifdef NEW_PCIB pcib_write_windows(sc, WIN_IO | WIN_MEM | WIN_PMEM); #else - command = pci_read_config(dev, PCIR_COMMAND, 2); - if (command & PCIM_CMD_PORTEN) + if (sc->command & PCIM_CMD_PORTEN) pcib_set_io_decode(sc); - if (command & PCIM_CMD_MEMEN) + if (sc->command & PCIM_CMD_MEMEN) pcib_set_mem_decode(sc); #endif } @@ -915,11 +918,7 @@ pcib_attach_common(device_t dev) * Get current bridge configuration. */ sc->domain = pci_get_domain(dev); -#if !(defined(NEW_PCIB) && defined(PCI_RES_BUS)) - sc->bus.sec = pci_read_config(dev, PCIR_SECBUS_1, 1); - sc->bus.sub = pci_read_config(dev, PCIR_SUBBUS_1, 1); -#endif - sc->bridgectl = pci_read_config(dev, PCIR_BRIDGECTL_1, 2); + sc->secstat = pci_read_config(dev, PCIR_SECSTAT_1, 2); pcib_cfg_save(sc); /* Modified: releng/10.2/sys/dev/pci/pcib_private.h ============================================================================== --- releng/10.2/sys/dev/pci/pcib_private.h Tue Jul 28 22:48:58 2015 (r285990) +++ releng/10.2/sys/dev/pci/pcib_private.h Wed Jul 29 00:57:54 2015 (r285991) @@ -106,6 +106,7 @@ struct pcib_softc #define PCIB_DISABLE_MSI 0x2 #define PCIB_DISABLE_MSIX 0x4 #define PCIB_ENABLE_ARI 0x8 + uint16_t command; /* command register */ u_int domain; /* domain number */ u_int pribus; /* primary bus number */ struct pcib_secbus bus; /* secondary bus numbers */ @@ -121,7 +122,9 @@ struct pcib_softc uint32_t iobase; /* base address of port window */ uint32_t iolimit; /* topmost address of port window */ #endif + uint16_t secstat; /* secondary bus status register */ uint16_t bridgectl; /* bridge control register */ + uint8_t seclat; /* secondary bus latency timer */ }; #define PCIB_SUPPORTED_ARI_VER 1 Modified: releng/10.2/sys/dev/pci/pcivar.h ============================================================================== --- releng/10.2/sys/dev/pci/pcivar.h Tue Jul 28 22:48:58 2015 (r285990) +++ releng/10.2/sys/dev/pci/pcivar.h Wed Jul 29 00:57:54 2015 (r285991) @@ -39,15 +39,6 @@ typedef uint64_t pci_addr_t; -/* Config registers for PCI-PCI and PCI-Cardbus bridges. */ -struct pcicfg_bridge { - uint8_t br_seclat; - uint8_t br_subbus; - uint8_t br_secbus; - uint8_t br_pribus; - uint16_t br_control; -}; - /* Interesting values for PCI power management */ struct pcicfg_pp { uint16_t pp_cap; /* PCI power management capabilities */ @@ -188,7 +179,6 @@ typedef struct pcicfg { uint8_t slot; /* config space slot address */ uint8_t func; /* config space function number */ - struct pcicfg_bridge bridge; /* Bridges */ struct pcicfg_pp pp; /* Power management */ struct pcicfg_vpd vpd; /* Vital product data */ struct pcicfg_msi msi; /* PCI MSI */ From owner-svn-src-all@freebsd.org Wed Jul 29 01:04:16 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EADEF9AD022; Wed, 29 Jul 2015 01:04:15 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id D6470EE; Wed, 29 Jul 2015 01:04:15 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id C91D11ADE; Wed, 29 Jul 2015 01:04:15 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 73C0194A1; Wed, 29 Jul 2015 01:04:15 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id CEm4uNirYGYz; Wed, 29 Jul 2015 01:04:11 +0000 (UTC) Subject: Re: svn commit: r284598 - head/share/mk DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com F3F8B9498 To: "Simon J. Gerraty" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201506191456.t5JEuPDU074336@svn.freebsd.org> From: Bryan Drewery X-Enigmail-Draft-Status: N1110 Organization: FreeBSD Message-ID: <55B8268A.5030305@FreeBSD.org> Date: Tue, 28 Jul 2015 18:04:10 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <201506191456.t5JEuPDU074336@svn.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 01:04:16 -0000 On 6/19/15 7:56 AM, Simon J. Gerraty wrote: > Author: sjg > Date: Fri Jun 19 14:56:24 2015 > New Revision: 284598 > URL: https://svnweb.freebsd.org/changeset/base/284598 >=20 > Log: > Move include of make.conf back to its old position. > =20 > This means moving include of local.sys.mk and src.sys.mk too. > Introduce new includes to take the early slot, for the purpose > of being able to influence toolchains and the like. > =20 > Differential Revision: D2860 > Reviewed by: imp >=20 > Added: > head/share/mk/local.sys.env.mk > - copied, changed from r284432, head/share/mk/local.sys.mk > head/share/mk/src.sys.env.mk > - copied, changed from r284432, head/share/mk/src.sys.mk > Modified: > head/share/mk/local.sys.mk I'm bothered by the amount of local.* files committed in the tree. I expect, as a user and working in a downstream product, that a local.* file is MINE, not FREEBSD. The pattern of using 'local' is quite common as a *user* file. Why are these named as such? It seems they should just be 'src.' with .sinclude hooks for actual local overrides. local.autodep.mk local.dirdeps.mk local.gendirdeps.mk local.init.mk local.meta.sys.mk local.sys.env.mk local.sys.mk > head/share/mk/src.sys.mk > head/share/mk/sys.mk >=20 ... > +# site customizations that do not depend on anything! > +SRC_ENV_CONF?=3D /etc/src-env.conf > +.if !empty(SRC_ENV_CONF) && !target(_src_env_conf_included_) > +.-include "${SRC_ENV_CONF}" > +_src_env_conf_included_: .NOTMAIN > .endif This needs to be documented in at least src.conf(5). I'm concerned that the need to add this indicates subtle changes elsewhere that may break existing /etc/src.conf setups, but I cannot find an example. > + > # If we were found via .../share/mk we need to replace that > # with ${.PARSEDIR:tA} so that we can be found by > # sub-makes launched from objdir. > @@ -24,5 +22,3 @@ _srcconf_included_: .NOTMAIN > MAKESYSPATH:=3D ${MAKESYSPATH:S,.../share/mk,${.PARSEDIR:tA},} > .export MAKESYSPATH > .endif > -# tempting, but bsd.compiler.mk causes problems this early > -#.include "src.opts.mk" >=20 > Modified: head/share/mk/src.sys.mk > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/share/mk/src.sys.mk Fri Jun 19 14:20:21 2015 (r284597) > +++ head/share/mk/src.sys.mk Fri Jun 19 14:56:24 2015 (r284598) > @@ -5,24 +5,13 @@ > # to preserve historical (and useful) behavior. Changes here need to > # be reflected there so SRCCONF isn't included multiple times. > =20 > -# make sure this is defined in a consistent manner > -SRCTOP:=3D ${.PARSEDIR:tA:H:H} > - > # Allow user to configure things that only effect src tree builds. > SRCCONF?=3D /etc/src.conf > .if (exists(${SRCCONF}) || ${SRCCONF} !=3D "/etc/src.conf") && !target= (_srcconf_included_) > .sinclude "${SRCCONF}" > _srcconf_included_: .NOTMAIN > .endif > -# If we were found via .../share/mk we need to replace that > -# with ${.PARSEDIR:tA} so that we can be found by > -# sub-makes launched from objdir. > -.if ${.MAKEFLAGS:M.../share/mk} !=3D "" > -.MAKEFLAGS:=3D ${.MAKEFLAGS:S,.../share/mk,${.PARSEDIR:tA},} > -.endif > -.if ${MAKESYSPATH:Uno:M*.../*} !=3D "" > -MAKESYSPATH:=3D ${MAKESYSPATH:S,.../share/mk,${.PARSEDIR:tA},} > -.export MAKESYSPATH > -.endif > + > # tempting, but bsd.compiler.mk causes problems this early > +# probably need to remove dependence on bsd.own.mk=20 > #.include "src.opts.mk" >=20 > Modified: head/share/mk/sys.mk > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/share/mk/sys.mk Fri Jun 19 14:20:21 2015 (r284597) > +++ head/share/mk/sys.mk Fri Jun 19 14:56:24 2015 (r284598) > @@ -31,15 +31,9 @@ __DEFAULT_DEPENDENT_OPTIONS=3D \ > =20 > .include > =20 > -# Pull in global settings. > -__MAKE_CONF?=3D/etc/make.conf > -.if exists(${__MAKE_CONF}) > -.include "${__MAKE_CONF}" > -.endif > - > -# Set any local definitions first. Place this early, but it needs > -# MACHINE_CPUARCH to be defined. > -.-include > +# early include for customization > +# see local.sys.mk below > +.-include > =20 > .if ${MK_META_MODE} =3D=3D "yes" > .-include > @@ -360,6 +354,14 @@ YFLAGS ?=3D -d > rm -f ${.PREFIX}.tmp.c > ${CTFCONVERT_CMD} > =20 > +# Pull in global settings. > +__MAKE_CONF?=3D/etc/make.conf > +.if exists(${__MAKE_CONF}) > +.include "${__MAKE_CONF}" > +.endif > + > +# late include for customization > +.-include In local.sys.mk from r284345 is an inclusion of SRCCONF, which is now different and earlier than before. I wonder if this should move back to only being included from bsd.own.mk (there is even a lingering WITHOUT_SRCCONF check in that file). The way it is now is very obscure in terms of when it is actually included and from where. > =20 > .if defined(__MAKE_SHELL) && !empty(__MAKE_SHELL) > SHELL=3D ${__MAKE_SHELL} >=20 --=20 Regards, Bryan Drewery From owner-svn-src-all@freebsd.org Wed Jul 29 02:09:13 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 043C49AD14F; Wed, 29 Jul 2015 02:09:13 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by mx1.freebsd.org (Postfix) with ESMTP id B49131B04; Wed, 29 Jul 2015 02:09:11 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail108.syd.optusnet.com.au (Postfix) with ESMTPS id 9EBE01A5188; Wed, 29 Jul 2015 12:09:08 +1000 (AEST) Date: Wed, 29 Jul 2015 12:09:07 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Baptiste Daroussin cc: Bruce Evans , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r285985 - in head/usr.sbin/pw: . tests In-Reply-To: <20150728232106.GG28638@ivaldir.etoilebsd.net> Message-ID: <20150729110330.O5544@besplex.bde.org> References: <201507282110.t6SLAx0k035167@repo.freebsd.org> <20150729080932.S5059@besplex.bde.org> <20150728232106.GG28638@ivaldir.etoilebsd.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=XMDNMlVE c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=kj9zAlcOel0A:10 a=7YfXLusrAAAA:8 a=3a5ZI3m13Z8Cm56kV6UA:9 a=1vtwie4u5U5GghCb:21 a=S4hxu90T8b2Nxqgm:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 02:09:13 -0000 On Wed, 29 Jul 2015, Baptiste Daroussin wrote: > On Wed, Jul 29, 2015 at 08:52:52AM +1000, Bruce Evans wrote: >> On Tue, 28 Jul 2015, Baptiste Daroussin wrote: >> >>> Log: >>> Check uid/gid used when creating a user/group are not larger than UID_MAX/GID_MAX >>> >>> PR: 173977 >>> Reported by: nvass@gmx.com >> >> This is broken in a different way than before. >> >>> Modified: head/usr.sbin/pw/pw.c >>> ============================================================================== >>> --- head/usr.sbin/pw/pw.c Tue Jul 28 20:52:10 2015 (r285984) >>> +++ head/usr.sbin/pw/pw.c Tue Jul 28 21:10:58 2015 (r285985) >>> @@ -269,7 +269,7 @@ main(int argc, char *argv[]) >>> } >>> if (strspn(optarg, "0123456789") != strlen(optarg)) >>> errx(EX_USAGE, "-g expects a number"); >>> - id = strtonum(optarg, 0, LONG_MAX, &errstr); >>> + id = strtonum(optarg, 0, GID_MAX, &errstr); >> >> `id' still has type long. The assignment overflows on 32-bit arches when >> the value exceeds 0x7fffffff. That is for half of all valid values. pw >> is broken in not supporting these values, but at least it detected them >> as errors in the previous version. Old versions implemented this bug >> using atoi() with no error checking. > > So writting a function like strtonum like function with that prototype > intmax_t strtonumber(const char *, intmax_t min, intmax_t max, const char **); > and an unsigned equivalent > uintmax_t strtonumber(const char *, uintmax_t min, uintmax_t max, const char **); Not completely, since this would restore some of the complications of the strto*() family (there is API explosion, and types to match). These 2 functions don't even handle all the integer ranges (with assymmetric signedness), or hex numbers, or floating point). To match the types for gid_t's with these APIs, you could write: gid_t id = strtounum(optarg, 0, GID_MAX, &errstr); or uintmax_t id = strtounum(optarg, 0, GID_MAX, &errstr); but can't mix these id types with others that need different signedness.. or use plain int/long/u_long for anything. This is not a problem for uids and gids since they usually have the same underlying type. POSIX (XSI) made a mess of this for waitid(idtype_t idtype, id_t id, ...). id can be either a pid, a uid, a gid or a session id. So id_t is specified as an integer type that can "contain" all of these. Representing all of these is generally impossible due to the sign differences, and the conversions made to "contain" seem to be unspecified. FreeBSD actually uses int64_t for id_t and an enum for idtype_t, so simple conversions preserve the value at the cost of bloat. This wouldn't work with 64-bit uid_t. A similar mess can be made for strto*num() by specifying it to work with a container type num_t and making this type opaque so that it is hard to use :-), except there no strict container exists for int64_t and uint64_t. Bruce From owner-svn-src-all@freebsd.org Wed Jul 29 02:21:37 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C7379AD5E6; Wed, 29 Jul 2015 02:21:37 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0ECF61EC; Wed, 29 Jul 2015 02:21:37 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6T2LaCC071446; Wed, 29 Jul 2015 02:21:36 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6T2LaTk071443; Wed, 29 Jul 2015 02:21:36 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201507290221.t6T2LaTk071443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Wed, 29 Jul 2015 02:21:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285992 - in head/usr.bin: ypcat ypmatch ypwhich X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 02:21:37 -0000 Author: araujo (ports committer) Date: Wed Jul 29 02:21:35 2015 New Revision: 285992 URL: https://svnweb.freebsd.org/changeset/base/285992 Log: Compilers will complain the usage of obsolescent variable declarations. Also it will fix the build problem with sparc64. Submitted by: ed@ Modified: head/usr.bin/ypcat/ypcat.c head/usr.bin/ypmatch/ypmatch.c head/usr.bin/ypwhich/ypwhich.c Modified: head/usr.bin/ypcat/ypcat.c ============================================================================== --- head/usr.bin/ypcat/ypcat.c Wed Jul 29 00:57:54 2015 (r285991) +++ head/usr.bin/ypcat/ypcat.c Wed Jul 29 02:21:35 2015 (r285992) @@ -47,9 +47,9 @@ __FBSDID("$FreeBSD$"); #include #include -const struct ypalias { +static const struct ypalias { char *alias, *name; -} static ypaliases[] = { +} ypaliases[] = { { "passwd", "passwd.byname" }, { "master.passwd", "master.passwd.byname" }, { "shadow", "shadow.byname" }, Modified: head/usr.bin/ypmatch/ypmatch.c ============================================================================== --- head/usr.bin/ypmatch/ypmatch.c Wed Jul 29 00:57:54 2015 (r285991) +++ head/usr.bin/ypmatch/ypmatch.c Wed Jul 29 02:21:35 2015 (r285992) @@ -47,9 +47,9 @@ __FBSDID("$FreeBSD$"); #include #include -const struct ypalias { +static const struct ypalias { char *alias, *name; -} static ypaliases[] = { +} ypaliases[] = { { "passwd", "passwd.byname" }, { "master.passwd", "master.passwd.byname" }, { "shadow", "shadow.byname" }, Modified: head/usr.bin/ypwhich/ypwhich.c ============================================================================== --- head/usr.bin/ypwhich/ypwhich.c Wed Jul 29 00:57:54 2015 (r285991) +++ head/usr.bin/ypwhich/ypwhich.c Wed Jul 29 02:21:35 2015 (r285992) @@ -59,9 +59,9 @@ __FBSDID("$FreeBSD$"); extern bool_t xdr_domainname(); -const struct ypalias { +static const struct ypalias { char *alias, *name; -} static ypaliases[] = { +} ypaliases[] = { { "passwd", "passwd.byname" }, { "master.passwd", "master.passwd.byname" }, { "shadow", "shadow.byname" }, From owner-svn-src-all@freebsd.org Wed Jul 29 02:22:39 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E1679AD65A; Wed, 29 Jul 2015 02:22:39 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: from mail-ob0-x235.google.com (mail-ob0-x235.google.com [IPv6:2607:f8b0:4003:c01::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C74F93E4; Wed, 29 Jul 2015 02:22:38 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: by obnw1 with SMTP id w1so98503097obn.3; Tue, 28 Jul 2015 19:22:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=7ZbJr2s013wgEaBa/o2vm3gTh65/uFid+hfl/5za/io=; b=NaN6kjo1wpaDNBv0E3y5r8vykJXYqVcQN6kK293EMvaicDN+6RTFwoDiCe5Ndk5QUV 5JObWkWxjDfJ7v7exr92zYI1wRnLhveowSvMtZlPZ+ZjJA+58hJwiU+Rx5CEiOHWI4u6 jL/NZLMTMNkM83M5RZTU7olZ6Fxgg/zjzl6ezvc6uLsH5QABGCPrg/s7ftQQVtNtKB97 uXCl8edr91+pb4MQ7v9gfLXv1AI4WgWlXpkOu25McP/BpmprIcLvalyYFiTB45Z9k5mS yOAJbx2HvzAPhE7pIl8iA986sYh9VF7bPCOZZsCbPmtF4epsfnjtJRpuPADx5CVj2ZuY MjNg== MIME-Version: 1.0 X-Received: by 10.60.80.229 with SMTP id u5mr39155343oex.27.1438136558073; Tue, 28 Jul 2015 19:22:38 -0700 (PDT) Received: by 10.202.11.193 with HTTP; Tue, 28 Jul 2015 19:22:38 -0700 (PDT) Reply-To: araujo@FreeBSD.org In-Reply-To: References: <201507280232.t6S2WfSq043383@repo.freebsd.org> Date: Wed, 29 Jul 2015 10:22:38 +0800 Message-ID: Subject: Re: svn commit: r285926 - in head: libexec/ypxfr usr.bin/ypcat usr.bin/ypmatch usr.bin/ypwhich usr.sbin/yp_mkdb usr.sbin/yppush usr.sbin/ypserv From: Marcelo Araujo To: Ed Schouten Cc: "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , "src-committers@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 02:22:39 -0000 Hello Ed, Fixed, thank you very much. https://svnweb.freebsd.org/base?view=revision&revision=285992 Best, 2015-07-28 15:05 GMT+08:00 Ed Schouten : > Hi Marcelo, > > Thanks for working on this! > > 2015-07-28 4:32 GMT+02:00 Marcelo Araujo : > > -struct ypalias { > > +const struct ypalias { > > char *alias, *name; > > -} ypaliases[] = { > > +} static ypaliases[] = { > > { "passwd", "passwd.byname" }, > > { "master.passwd", "master.passwd.byname" }, > > { "shadow", "shadow.byname" }, > > I seem to remember that certain compilers (Intel?) are pretty picky > about the ordering of 'static' and 'const'. > > const static int i; // Compiler error. > > It's also inconsistent with the rest of our codebase, where we > typically put 'static' in front of the type. Could you please change > this to the following? > > static const struct ypalias { > ... > } ypaliases[] = { > ... > }; > > Thanks! > > -- > Ed Schouten > Nuxi, 's-Hertogenbosch, the Netherlands > KvK/VAT number: 62051717 > _______________________________________________ > svn-src-head@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > -- -- Marcelo Araujo (__)araujo@FreeBSD.org \\\'',)http://www.FreeBSD.org \/ \ ^ Power To Server. .\. /_) From owner-svn-src-all@freebsd.org Wed Jul 29 02:27:00 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B22DE9AD72C; Wed, 29 Jul 2015 02:27:00 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A19C783B; Wed, 29 Jul 2015 02:27:00 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6T2R0Ww072394; Wed, 29 Jul 2015 02:27:00 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6T2Qwp7072379; Wed, 29 Jul 2015 02:26:58 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201507290226.t6T2Qwp7072379@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Wed, 29 Jul 2015 02:26:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285993 - in head/sys: kern sys ufs/ffs vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 02:27:00 -0000 Author: jeff Date: Wed Jul 29 02:26:57 2015 New Revision: 285993 URL: https://svnweb.freebsd.org/changeset/base/285993 Log: - Make 'struct buf *buf' private to vfs_bio.c. Having a global variable 'buf' is inconvenient and has lead me to some irritating to discover bugs over the years. It also makes it more challenging to refactor the buf allocation system. - Move swbuf and declare it as an extern in vfs_bio.c. This is still not perfect but better than it was before. - Eliminate the unused ffs function that relied on knowledge of the buf array. - Move the shutdown code that iterates over the buf array into vfs_bio.c. Reviewed by: kib Sponsored by: EMC / Isilon Storage Division Modified: head/sys/kern/kern_shutdown.c head/sys/kern/subr_param.c head/sys/kern/vfs_bio.c head/sys/sys/buf.h head/sys/ufs/ffs/ffs_subr.c head/sys/vm/vm_pager.c Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Wed Jul 29 02:21:35 2015 (r285992) +++ head/sys/kern/kern_shutdown.c Wed Jul 29 02:26:57 2015 (r285993) @@ -275,24 +275,13 @@ doadump(boolean_t textdump) return (error); } -static int -isbufbusy(struct buf *bp) -{ - if (((bp->b_flags & (B_INVAL | B_PERSISTENT)) == 0 && - BUF_ISLOCKED(bp)) || - ((bp->b_flags & (B_DELWRI | B_INVAL)) == B_DELWRI)) - return (1); - return (0); -} - /* * Shutdown the system cleanly to prepare for reboot, halt, or power off. */ void kern_reboot(int howto) { - static int first_buf_printf = 1; - static int waittime = -1; + static int once = 0; #if defined(SMP) /* @@ -321,116 +310,9 @@ kern_reboot(int howto) /* * Now sync filesystems */ - if (!cold && (howto & RB_NOSYNC) == 0 && waittime < 0) { - register struct buf *bp; - int iter, nbusy, pbusy; -#ifndef PREEMPTION - int subiter; -#endif - - waittime = 0; - - wdog_kern_pat(WD_LASTVAL); - sys_sync(curthread, NULL); - - /* - * With soft updates, some buffers that are - * written will be remarked as dirty until other - * buffers are written. - */ - for (iter = pbusy = 0; iter < 20; iter++) { - nbusy = 0; - for (bp = &buf[nbuf]; --bp >= buf; ) - if (isbufbusy(bp)) - nbusy++; - if (nbusy == 0) { - if (first_buf_printf) - printf("All buffers synced."); - break; - } - if (first_buf_printf) { - printf("Syncing disks, buffers remaining... "); - first_buf_printf = 0; - } - printf("%d ", nbusy); - if (nbusy < pbusy) - iter = 0; - pbusy = nbusy; - - wdog_kern_pat(WD_LASTVAL); - sys_sync(curthread, NULL); - -#ifdef PREEMPTION - /* - * Drop Giant and spin for a while to allow - * interrupt threads to run. - */ - DROP_GIANT(); - DELAY(50000 * iter); - PICKUP_GIANT(); -#else - /* - * Drop Giant and context switch several times to - * allow interrupt threads to run. - */ - DROP_GIANT(); - for (subiter = 0; subiter < 50 * iter; subiter++) { - thread_lock(curthread); - mi_switch(SW_VOL, NULL); - thread_unlock(curthread); - DELAY(1000); - } - PICKUP_GIANT(); -#endif - } - printf("\n"); - /* - * Count only busy local buffers to prevent forcing - * a fsck if we're just a client of a wedged NFS server - */ - nbusy = 0; - for (bp = &buf[nbuf]; --bp >= buf; ) { - if (isbufbusy(bp)) { -#if 0 -/* XXX: This is bogus. We should probably have a BO_REMOTE flag instead */ - if (bp->b_dev == NULL) { - TAILQ_REMOVE(&mountlist, - bp->b_vp->v_mount, mnt_list); - continue; - } -#endif - nbusy++; - if (show_busybufs > 0) { - printf( - "%d: buf:%p, vnode:%p, flags:%0x, blkno:%jd, lblkno:%jd, buflock:", - nbusy, bp, bp->b_vp, bp->b_flags, - (intmax_t)bp->b_blkno, - (intmax_t)bp->b_lblkno); - BUF_LOCKPRINTINFO(bp); - if (show_busybufs > 1) - vn_printf(bp->b_vp, - "vnode content: "); - } - } - } - if (nbusy) { - /* - * Failed to sync all blocks. Indicate this and don't - * unmount filesystems (thus forcing an fsck on reboot). - */ - printf("Giving up on %d buffers\n", nbusy); - DELAY(5000000); /* 5 seconds */ - } else { - if (!first_buf_printf) - printf("Final sync complete\n"); - /* - * Unmount filesystems - */ - if (panicstr == 0) - vfs_unmountall(); - } - swapoff_all(); - DELAY(100000); /* wait for console output to finish */ + if (!cold && (howto & RB_NOSYNC) == 0 && once == 0) { + once = 1; + bufshutdown(show_busybufs); } print_uptime(); Modified: head/sys/kern/subr_param.c ============================================================================== --- head/sys/kern/subr_param.c Wed Jul 29 02:21:35 2015 (r285992) +++ head/sys/kern/subr_param.c Wed Jul 29 02:26:57 2015 (r285993) @@ -139,13 +139,6 @@ SYSCTL_PROC(_kern, OID_AUTO, vm_guest, C "Virtual machine guest detected?"); /* - * These have to be allocated somewhere; allocating - * them here forces loader errors if this file is omitted - * (if they've been externed everywhere else; hah!). - */ -struct buf *swbuf; - -/* * The elements of this array are ordered based upon the values of the * corresponding enum VM_GUEST members. */ Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Wed Jul 29 02:21:35 2015 (r285992) +++ head/sys/kern/vfs_bio.c Wed Jul 29 02:26:57 2015 (r285993) @@ -64,9 +64,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include +#include #include #include #include @@ -76,6 +78,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "opt_compat.h" #include "opt_swap.h" @@ -91,11 +94,8 @@ struct buf_ops buf_ops_bio = { .bop_bdflush = bufbdflush, }; -/* - * XXX buf is global because kern_shutdown.c and ffs_checkoverlap has - * carnal knowledge of buffers. This knowledge should be moved to vfs_bio.c. - */ -struct buf *buf; /* buffer header pool */ +static struct buf *buf; /* buffer header pool */ +extern struct buf *swbuf; /* Swap buffer header pool. */ caddr_t unmapped_buf; /* Used below and for softdep flushing threads in ufs/ffs/ffs_softdep.c */ @@ -958,6 +958,134 @@ vfs_buf_check_mapped(struct buf *bp) KASSERT(bp->b_data < unmapped_buf || bp->b_data > unmapped_buf + MAXPHYS, ("b_data + b_offset unmapped %p", bp)); } +static int +isbufbusy(struct buf *bp) +{ + if (((bp->b_flags & (B_INVAL | B_PERSISTENT)) == 0 && + BUF_ISLOCKED(bp)) || + ((bp->b_flags & (B_DELWRI | B_INVAL)) == B_DELWRI)) + return (1); + return (0); +} + +/* + * Shutdown the system cleanly to prepare for reboot, halt, or power off. + */ +void +bufshutdown(int show_busybufs) +{ + static int first_buf_printf = 1; + struct buf *bp; + int iter, nbusy, pbusy; +#ifndef PREEMPTION + int subiter; +#endif + + /* + * Sync filesystems for shutdown + */ + wdog_kern_pat(WD_LASTVAL); + sys_sync(curthread, NULL); + + /* + * With soft updates, some buffers that are + * written will be remarked as dirty until other + * buffers are written. + */ + for (iter = pbusy = 0; iter < 20; iter++) { + nbusy = 0; + for (bp = &buf[nbuf]; --bp >= buf; ) + if (isbufbusy(bp)) + nbusy++; + if (nbusy == 0) { + if (first_buf_printf) + printf("All buffers synced."); + break; + } + if (first_buf_printf) { + printf("Syncing disks, buffers remaining... "); + first_buf_printf = 0; + } + printf("%d ", nbusy); + if (nbusy < pbusy) + iter = 0; + pbusy = nbusy; + + wdog_kern_pat(WD_LASTVAL); + sys_sync(curthread, NULL); + +#ifdef PREEMPTION + /* + * Drop Giant and spin for a while to allow + * interrupt threads to run. + */ + DROP_GIANT(); + DELAY(50000 * iter); + PICKUP_GIANT(); +#else + /* + * Drop Giant and context switch several times to + * allow interrupt threads to run. + */ + DROP_GIANT(); + for (subiter = 0; subiter < 50 * iter; subiter++) { + thread_lock(curthread); + mi_switch(SW_VOL, NULL); + thread_unlock(curthread); + DELAY(1000); + } + PICKUP_GIANT(); +#endif + } + printf("\n"); + /* + * Count only busy local buffers to prevent forcing + * a fsck if we're just a client of a wedged NFS server + */ + nbusy = 0; + for (bp = &buf[nbuf]; --bp >= buf; ) { + if (isbufbusy(bp)) { +#if 0 +/* XXX: This is bogus. We should probably have a BO_REMOTE flag instead */ + if (bp->b_dev == NULL) { + TAILQ_REMOVE(&mountlist, + bp->b_vp->v_mount, mnt_list); + continue; + } +#endif + nbusy++; + if (show_busybufs > 0) { + printf( + "%d: buf:%p, vnode:%p, flags:%0x, blkno:%jd, lblkno:%jd, buflock:", + nbusy, bp, bp->b_vp, bp->b_flags, + (intmax_t)bp->b_blkno, + (intmax_t)bp->b_lblkno); + BUF_LOCKPRINTINFO(bp); + if (show_busybufs > 1) + vn_printf(bp->b_vp, + "vnode content: "); + } + } + } + if (nbusy) { + /* + * Failed to sync all blocks. Indicate this and don't + * unmount filesystems (thus forcing an fsck on reboot). + */ + printf("Giving up on %d buffers\n", nbusy); + DELAY(5000000); /* 5 seconds */ + } else { + if (!first_buf_printf) + printf("Final sync complete\n"); + /* + * Unmount filesystems + */ + if (panicstr == 0) + vfs_unmountall(); + } + swapoff_all(); + DELAY(100000); /* wait for console output to finish */ +} static inline void vfs_buf_check_unmapped(struct buf *bp) Modified: head/sys/sys/buf.h ============================================================================== --- head/sys/sys/buf.h Wed Jul 29 02:21:35 2015 (r285992) +++ head/sys/sys/buf.h Wed Jul 29 02:26:57 2015 (r285993) @@ -465,8 +465,6 @@ extern int dirtybufthresh; extern int bdwriteskip; extern int dirtybufferflushes; extern int altbufferflushes; -extern struct buf *buf; /* The buffer headers. */ -extern struct buf *swbuf; /* Swap I/O buffer headers. */ extern int nswbuf; /* Number of swap I/O buffer headers. */ extern int cluster_pbuf_freecnt; /* Number of pbufs for clusters */ extern int vnode_pbuf_freecnt; /* Number of pbufs for vnode pager */ @@ -485,6 +483,7 @@ void runningbufwakeup(struct buf *); void waitrunningbufspace(void); caddr_t kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est); void bufinit(void); +void bufshutdown(int); void bdata2bio(struct buf *bp, struct bio *bip); void bwillwrite(void); int buf_dirty_count_severe(void); Modified: head/sys/ufs/ffs/ffs_subr.c ============================================================================== --- head/sys/ufs/ffs/ffs_subr.c Wed Jul 29 02:21:35 2015 (r285992) +++ head/sys/ufs/ffs/ffs_subr.c Wed Jul 29 02:26:57 2015 (r285993) @@ -55,10 +55,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef KDB -void ffs_checkoverlap(struct buf *, struct inode *); -#endif - /* * Return buffer with the contents of block "offset" from the beginning of * directory "ip". If "res" is non-zero, fill it in with a pointer to the @@ -165,37 +161,6 @@ ffs_fragacct(fs, fragmap, fraglist, cnt) } } -#ifdef KDB -void -ffs_checkoverlap(bp, ip) - struct buf *bp; - struct inode *ip; -{ - struct buf *ebp, *ep; - ufs2_daddr_t start, last; - struct vnode *vp; - - ebp = &buf[nbuf]; - start = bp->b_blkno; - last = start + btodb(bp->b_bcount) - 1; - for (ep = buf; ep < ebp; ep++) { - if (ep == bp || (ep->b_flags & B_INVAL) || - ep->b_vp == NULLVP) - continue; - vp = ip->i_devvp; - /* look for overlap */ - if (ep->b_bcount == 0 || ep->b_blkno > last || - ep->b_blkno + btodb(ep->b_bcount) <= start) - continue; - vprint("Disk overlap", vp); - printf("\tstart %jd, end %jd overlap start %jd, end %jd\n", - (intmax_t)start, (intmax_t)last, (intmax_t)ep->b_blkno, - (intmax_t)(ep->b_blkno + btodb(ep->b_bcount) - 1)); - panic("ffs_checkoverlap: Disk buffer overlap"); - } -} -#endif /* KDB */ - /* * block operations * Modified: head/sys/vm/vm_pager.c ============================================================================== --- head/sys/vm/vm_pager.c Wed Jul 29 02:21:35 2015 (r285992) +++ head/sys/vm/vm_pager.c Wed Jul 29 02:26:57 2015 (r285993) @@ -86,6 +86,8 @@ __FBSDID("$FreeBSD$"); int cluster_pbuf_freecnt = -1; /* unlimited to begin with */ +struct buf *swbuf; + static int dead_pager_getpages(vm_object_t, vm_page_t *, int, int); static vm_object_t dead_pager_alloc(void *, vm_ooffset_t, vm_prot_t, vm_ooffset_t, struct ucred *); From owner-svn-src-all@freebsd.org Wed Jul 29 02:34:26 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B763B9AD9AE; Wed, 29 Jul 2015 02:34:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9B1D0C2B; Wed, 29 Jul 2015 02:34:26 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6T2YQ8q076320; Wed, 29 Jul 2015 02:34:26 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6T2YQu4076316; Wed, 29 Jul 2015 02:34:26 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201507290234.t6T2YQu4076316@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 29 Jul 2015 02:34:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285994 - in head: sbin/sysctl share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 02:34:26 -0000 Author: imp Date: Wed Jul 29 02:34:25 2015 New Revision: 285994 URL: https://svnweb.freebsd.org/changeset/base/285994 Log: Teach sysctl about the new optional suffix after IK to specify precision. Update input as well. Add IK to the manual (it was missing completely). Differential Revision: https://reviews.freebsd.org/D3181 Modified: head/sbin/sysctl/sysctl.c head/share/man/man9/sysctl.9 Modified: head/sbin/sysctl/sysctl.c ============================================================================== --- head/sbin/sysctl/sysctl.c Wed Jul 29 02:26:57 2015 (r285993) +++ head/sbin/sysctl/sysctl.c Wed Jul 29 02:34:25 2015 (r285994) @@ -81,7 +81,7 @@ static int show_var(int *, int); static int sysctl_all(int *oid, int len); static int name2oid(const char *, int *); -static int strIKtoi(const char *, char **); +static int strIKtoi(const char *, char **, const char *); static int ctl_sign[CTLTYPE+1] = { [CTLTYPE_INT] = 1, @@ -336,8 +336,8 @@ parse(const char *string, int lineno) switch (kind & CTLTYPE) { case CTLTYPE_INT: - if (strcmp(fmt, "IK") == 0) - intval = strIKtoi(newvalstr, &endptr); + if (strncmp(fmt, "IK", 2) == 0) + intval = strIKtoi(newvalstr, &endptr, fmt); else intval = (int)strtol(newvalstr, &endptr, 0); @@ -666,12 +666,13 @@ S_bios_smap_xattr(size_t l2, void *p) #endif static int -strIKtoi(const char *str, char **endptrp) +strIKtoi(const char *str, char **endptrp, const char *fmt) { int kelv; float temp; size_t len; const char *p; + int prec, i; assert(errno == 0); @@ -679,16 +680,36 @@ strIKtoi(const char *str, char **endptrp /* caller already checked this */ assert(len > 0); + /* + * A format of "IK" is in deciKelvin. A format of "IK3" is in + * milliKelvin. The single digit following IK is log10 of the + * multiplying factor to convert Kelvin into the untis of this sysctl, + * or the dividing factor to convert the sysctl value to Kelvin. Numbers + * larger than 6 will run into precision issues with 32-bit integers. + * Characters that aren't ASCII digits after the 'K' are ignored. No + * localization is present because this is an interface from the kernel + * to this program (eg not an end-user interface), so isdigit() isn't + * used here. + */ + if (fmt[2] != '\0' && fmt[2] >= '0' && fmt[2] <= '9') + prec = fmt[2] - '0'; + else + prec = 1; p = &str[len - 1]; - if (*p == 'C' || *p == 'F') { + if (*p == 'C' || *p == 'F' || *p == 'K') { temp = strtof(str, endptrp); if (*endptrp != str && *endptrp == p && errno == 0) { if (*p == 'F') temp = (temp - 32) * 5 / 9; *endptrp = NULL; - return (temp * 10 + 2732); + if (*p != 'K') + temp += 273.15; + for (i = 0; i < prec; i++) + temp *= 10.0; + return ((int)(temp + 0.5)); } } else { + /* No unit specified -> treat it as a raw number */ kelv = (int)strtol(str, endptrp, 10); if (*endptrp != str && *endptrp == p && errno == 0) { *endptrp = NULL; @@ -772,7 +793,9 @@ show_var(int *oid, int nlen) size_t intlen; size_t j, len; u_int kind; + float base; int (*func)(size_t, void *); + int prec; /* Silence GCC. */ umv = mv = intlen = 0; @@ -893,8 +916,19 @@ show_var(int *oid, int nlen) else if (fmt[1] == 'K') { if (mv < 0) printf("%jd", mv); - else - printf("%.1fC", (mv - 2732.0) / 10); + else { + /* + * See strIKtoi for details on fmt. + */ + prec = 1; + if (fmt[2] != '\0') + prec = fmt[2] - '0'; + base = 1.0; + for (int i = 0; i < prec; i++) + base *= 10.0; + printf("%.*fC", prec, + (float)mv / base - 273.15); + } } else printf(hflag ? "%'jd" : "%jd", mv); sep1 = " "; Modified: head/share/man/man9/sysctl.9 ============================================================================== --- head/share/man/man9/sysctl.9 Wed Jul 29 02:26:57 2015 (r285993) +++ head/share/man/man9/sysctl.9 Wed Jul 29 02:34:25 2015 (r285994) @@ -318,35 +318,33 @@ which specifies the format of the OID in This format is used as a hint by .Xr sysctl 8 to apply proper data formatting for display purposes. -Currently used format names are: -.Dq N -for node, -.Dq A -for -.Li "char *" , -.Dq I -for -.Li "int" , -.Dq IU -for -.Li "unsigned int" , -.Dq L -for -.Li "long" , -.Dq LU -for -.Li "unsigned long" , -.Dq Q -for -.Li "quad_t" , -.Dq QU -for +.Pp +Current formats: +.Bl -tag -width "S,TYPE" -compact -offset indent +.It Cm N +node +.It Cm A +.Li "char *" +.It Cm I +.Li "int" +.It Cm IK Ns Op Ar n +temperature in Kelvin, multiplied by an optional single digit +power of ten scaling factor: 1 (default) gives deciKelvin, 0 gives Kelvin, 3 +gives milliKelvin +.It Cm IU +.Li "unsigned int" +.It Cm L +.Li "long" +.It Cm LU +.Li "unsigned long" +.It Cm Q +.Li "quad_t" +.It Cm QU .Li "u_quad_t" -and -.Dq S,TYPE -for +.It Cm "S,TYPE" .Li "struct TYPE" -structures. +structures +.El .It Fa descr A pointer to a textual description of the OID. .El From owner-svn-src-all@freebsd.org Wed Jul 29 03:06:09 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E25439AD3E0; Wed, 29 Jul 2015 03:06:09 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D311A1AA0; Wed, 29 Jul 2015 03:06:09 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6T369CJ090578; Wed, 29 Jul 2015 03:06:09 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6T369ih090577; Wed, 29 Jul 2015 03:06:09 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201507290306.t6T369ih090577@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Wed, 29 Jul 2015 03:06:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285995 - head/sys/fs/ext2fs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 03:06:10 -0000 Author: jeff Date: Wed Jul 29 03:06:08 2015 New Revision: 285995 URL: https://svnweb.freebsd.org/changeset/base/285995 Log: - Remove some dead code copied from ffs. Modified: head/sys/fs/ext2fs/ext2_subr.c Modified: head/sys/fs/ext2fs/ext2_subr.c ============================================================================== --- head/sys/fs/ext2fs/ext2_subr.c Wed Jul 29 02:34:25 2015 (r285994) +++ head/sys/fs/ext2fs/ext2_subr.c Wed Jul 29 03:06:08 2015 (r285995) @@ -54,10 +54,6 @@ #include #include -#ifdef KDB -void ext2_checkoverlap(struct buf *, struct inode *); -#endif - /* * Return buffer with the contents of block "offset" from the beginning of * directory "ip". If "res" is non-zero, fill it in with a pointer to the @@ -130,34 +126,6 @@ normal: return (0); } -#ifdef KDB -void -ext2_checkoverlap(struct buf *bp, struct inode *ip) -{ - struct buf *ebp, *ep; - e4fs_daddr_t start, last; - struct vnode *vp; - - ebp = &buf[nbuf]; - start = bp->b_blkno; - last = start + btodb(bp->b_bcount) - 1; - for (ep = buf; ep < ebp; ep++) { - if (ep == bp || (ep->b_flags & B_INVAL)) - continue; - vp = ip->i_ump->um_devvp; - /* look for overlap */ - if (ep->b_bcount == 0 || ep->b_blkno > last || - ep->b_blkno + btodb(ep->b_bcount) <= start) - continue; - vprint("Disk overlap", vp); - printf("\tstart %jd, end %jd overlap start %jd, end %jd\n", - (intmax_t)start, (intmax_t)last, (intmax_t)ep->b_blkno, - (intmax_t)(ep->b_blkno + btodb(ep->b_bcount) - 1)); - panic("ext2_checkoverlap: Disk buffer overlap"); - } -} -#endif /* KDB */ - /* * Update the cluster map because of an allocation of free like ffs. * From owner-svn-src-all@freebsd.org Wed Jul 29 05:53:50 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 434CD9AE54D; Wed, 29 Jul 2015 05:53:50 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-oi0-x22f.google.com (mail-oi0-x22f.google.com [IPv6:2607:f8b0:4003:c06::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0D94092A; Wed, 29 Jul 2015 05:53:50 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by oibn4 with SMTP id n4so81237101oib.3; Tue, 28 Jul 2015 22:53:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=HPS9sfsKR31D4pH1LShgmwr3LvgYOoFPbYvSfSdI5yQ=; b=I9PMlyY44NKtUJuf7p+0Q9mPgZcrD0MbAZ+P1dxx7/OiwlwzpJHydwGSIOnZq2bO5l 27hmOJMcCrhPr7Nu72vCCJ3VqZV2Ra0PoPKsNuNYQ8m509cr1zxQCkcbJwGwkSGAKmyC IiKUFf3rkaxXYkxCHnxaZjDlnwqRJx8UFgQHKxJ3NVd+h9X4bKAh1dZdf75TAg7yQn7K 7xP4f6oQQLmPjEpl8GleFK02smm+IJlFNEA8xciPcy5TTwjFCEk6hCTRGNfHVPzlHeeT soAQfEu+MSTfz10IuBrPipiT/9TQ+TJ7LTRDBOe9pMqDZwBLkzOWxgsYycJQlVomfF6D aa9Q== MIME-Version: 1.0 X-Received: by 10.202.73.83 with SMTP id w80mr5223075oia.102.1438149229401; Tue, 28 Jul 2015 22:53:49 -0700 (PDT) Received: by 10.76.58.17 with HTTP; Tue, 28 Jul 2015 22:53:49 -0700 (PDT) In-Reply-To: <201507290226.t6T2Qwp7072379@repo.freebsd.org> References: <201507290226.t6T2Qwp7072379@repo.freebsd.org> Date: Tue, 28 Jul 2015 22:53:49 -0700 Message-ID: Subject: Re: svn commit: r285993 - in head/sys: kern sys ufs/ffs vm From: Conrad Meyer To: Jeff Roberson Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 05:53:50 -0000 On Tue, Jul 28, 2015 at 7:26 PM, Jeff Roberson wrote: > Author: jeff > Date: Wed Jul 29 02:26:57 2015 > New Revision: 285993 > URL: https://svnweb.freebsd.org/changeset/base/285993 > > Log: > - Make 'struct buf *buf' private to vfs_bio.c. Having a global variable > 'buf' is inconvenient and has lead me to some irritating to discover > bugs over the years. It also makes it more challenging to refactor > the buf allocation system. > - Move swbuf and declare it as an extern in vfs_bio.c. This is still > not perfect but better than it was before. > - Eliminate the unused ffs function that relied on knowledge of the buf > array. > - Move the shutdown code that iterates over the buf array into vfs_bio.c. > > Reviewed by: kib > Sponsored by: EMC / Isilon Storage Division > > Modified: > head/sys/kern/kern_shutdown.c > head/sys/kern/subr_param.c > head/sys/kern/vfs_bio.c > head/sys/sys/buf.h > head/sys/ufs/ffs/ffs_subr.c > head/sys/vm/vm_pager.c > > ... > > Modified: head/sys/kern/vfs_bio.c > ============================================================================== > --- head/sys/kern/vfs_bio.c Wed Jul 29 02:21:35 2015 (r285992) > +++ head/sys/kern/vfs_bio.c Wed Jul 29 02:26:57 2015 (r285993) > ... This section is #ifdef INVARIANTS, breaking build on non-INVARIANTS kernels (missing bufshutdown): > @@ -958,6 +958,134 @@ vfs_buf_check_mapped(struct buf *bp) > KASSERT(bp->b_data < unmapped_buf || bp->b_data > unmapped_buf + > MAXPHYS, ("b_data + b_offset unmapped %p", bp)); > } > +static int > +isbufbusy(struct buf *bp) > +{ > + if (((bp->b_flags & (B_INVAL | B_PERSISTENT)) == 0 && > + BUF_ISLOCKED(bp)) || > + ((bp->b_flags & (B_DELWRI | B_INVAL)) == B_DELWRI)) > + return (1); > + return (0); > +} > + > +/* > + * Shutdown the system cleanly to prepare for reboot, halt, or power off. > + */ > +void > +bufshutdown(int show_busybufs) > +{ > + static int first_buf_printf = 1; > + struct buf *bp; > + int iter, nbusy, pbusy; > +#ifndef PREEMPTION > + int subiter; > +#endif > + > + /* > + * Sync filesystems for shutdown > + */ > + wdog_kern_pat(WD_LASTVAL); > + sys_sync(curthread, NULL); > + > + /* > + * With soft updates, some buffers that are > + * written will be remarked as dirty until other > + * buffers are written. > + */ > + for (iter = pbusy = 0; iter < 20; iter++) { > + nbusy = 0; > + for (bp = &buf[nbuf]; --bp >= buf; ) > + if (isbufbusy(bp)) > + nbusy++; > + if (nbusy == 0) { > + if (first_buf_printf) > + printf("All buffers synced."); > + break; > + } > + if (first_buf_printf) { > + printf("Syncing disks, buffers remaining... "); > + first_buf_printf = 0; > + } > + printf("%d ", nbusy); > + if (nbusy < pbusy) > + iter = 0; > + pbusy = nbusy; > + > + wdog_kern_pat(WD_LASTVAL); > + sys_sync(curthread, NULL); > + > +#ifdef PREEMPTION > + /* > + * Drop Giant and spin for a while to allow > + * interrupt threads to run. > + */ > + DROP_GIANT(); > + DELAY(50000 * iter); > + PICKUP_GIANT(); > +#else > + /* > + * Drop Giant and context switch several times to > + * allow interrupt threads to run. > + */ > + DROP_GIANT(); > + for (subiter = 0; subiter < 50 * iter; subiter++) { > + thread_lock(curthread); > + mi_switch(SW_VOL, NULL); > + thread_unlock(curthread); > + DELAY(1000); > + } > + PICKUP_GIANT(); > +#endif > + } > + printf("\n"); > + /* > + * Count only busy local buffers to prevent forcing > + * a fsck if we're just a client of a wedged NFS server > + */ > + nbusy = 0; > + for (bp = &buf[nbuf]; --bp >= buf; ) { > + if (isbufbusy(bp)) { > +#if 0 > +/* XXX: This is bogus. We should probably have a BO_REMOTE flag instead */ > + if (bp->b_dev == NULL) { > + TAILQ_REMOVE(&mountlist, > + bp->b_vp->v_mount, mnt_list); > + continue; > + } > +#endif > + nbusy++; > + if (show_busybufs > 0) { > + printf( > + "%d: buf:%p, vnode:%p, flags:%0x, blkno:%jd, lblkno:%jd, buflock:", > + nbusy, bp, bp->b_vp, bp->b_flags, > + (intmax_t)bp->b_blkno, > + (intmax_t)bp->b_lblkno); > + BUF_LOCKPRINTINFO(bp); > + if (show_busybufs > 1) > + vn_printf(bp->b_vp, > + "vnode content: "); > + } > + } > + } > + if (nbusy) { > + /* > + * Failed to sync all blocks. Indicate this and don't > + * unmount filesystems (thus forcing an fsck on reboot). > + */ > + printf("Giving up on %d buffers\n", nbusy); > + DELAY(5000000); /* 5 seconds */ > + } else { > + if (!first_buf_printf) > + printf("Final sync complete\n"); > + /* > + * Unmount filesystems > + */ > + if (panicstr == 0) > + vfs_unmountall(); > + } > + swapoff_all(); > + DELAY(100000); /* wait for console output to finish */ > +} Thanks, Conrad From owner-svn-src-all@freebsd.org Wed Jul 29 06:22:43 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F092A9AEAF1; Wed, 29 Jul 2015 06:22:43 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C3A3A15C2; Wed, 29 Jul 2015 06:22:43 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6T6Mhbx073922; Wed, 29 Jul 2015 06:22:43 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6T6MghZ073919; Wed, 29 Jul 2015 06:22:42 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201507290622.t6T6MghZ073919@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Wed, 29 Jul 2015 06:22:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285996 - head/usr.sbin/pw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 06:22:44 -0000 Author: bapt Date: Wed Jul 29 06:22:41 2015 New Revision: 285996 URL: https://svnweb.freebsd.org/changeset/base/285996 Log: Create a strtounum function using the same API as strtonum This function returns uintmax_t Use this function to convert to gid_t/uid_t Modified: head/usr.sbin/pw/Makefile head/usr.sbin/pw/pw.c head/usr.sbin/pw/pw.h Modified: head/usr.sbin/pw/Makefile ============================================================================== --- head/usr.sbin/pw/Makefile Wed Jul 29 03:06:08 2015 (r285995) +++ head/usr.sbin/pw/Makefile Wed Jul 29 06:22:41 2015 (r285996) @@ -3,7 +3,7 @@ PROG= pw MAN= pw.conf.5 pw.8 SRCS= pw.c pw_conf.c pw_user.c pw_group.c pw_log.c pw_nis.c pw_vpw.c \ - grupd.c pwupd.c psdate.c bitmap.c cpdir.c rm_r.c + grupd.c pwupd.c psdate.c bitmap.c cpdir.c rm_r.c strtounum.c WARNS?= 3 Modified: head/usr.sbin/pw/pw.c ============================================================================== --- head/usr.sbin/pw/pw.c Wed Jul 29 03:06:08 2015 (r285995) +++ head/usr.sbin/pw/pw.c Wed Jul 29 06:22:41 2015 (r285996) @@ -199,7 +199,7 @@ main(int argc, char *argv[]) cmdhelp(mode, which); else if (which != -1 && mode != -1) { if (strspn(argv[1], "0123456789") == strlen(argv[1])) { - id = strtonum(argv[1], 0, LONG_MAX, &errstr); + id = strtounum(argv[1], 0, UID_MAX, &errstr); if (errstr != NULL) errx(EX_USAGE, "Bad id '%s': %s", argv[1], errstr); @@ -269,7 +269,7 @@ main(int argc, char *argv[]) } if (strspn(optarg, "0123456789") != strlen(optarg)) errx(EX_USAGE, "-g expects a number"); - id = strtonum(optarg, 0, GID_MAX, &errstr); + id = strtounum(optarg, 0, GID_MAX, &errstr); if (errstr != NULL) errx(EX_USAGE, "Bad id '%s': %s", optarg, errstr); @@ -281,7 +281,7 @@ main(int argc, char *argv[]) addarg(&arglist, 'u', optarg); break; } - id = strtonum(optarg, 0, UID_MAX, &errstr); + id = strtounum(optarg, 0, UID_MAX, &errstr); if (errstr != NULL) errx(EX_USAGE, "Bad id '%s': %s", optarg, errstr); Modified: head/usr.sbin/pw/pw.h ============================================================================== --- head/usr.sbin/pw/pw.h Wed Jul 29 03:06:08 2015 (r285995) +++ head/usr.sbin/pw/pw.h Wed Jul 29 06:22:41 2015 (r285996) @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -101,3 +102,6 @@ char *pw_pwcrypt(char *password); extern const char *Modes[]; extern const char *Which[]; + +uintmax_t strtounum(const char *numstr, uintmax_t minval, uintmax_t maxval, + const char **errmsg); From owner-svn-src-all@freebsd.org Wed Jul 29 06:23:07 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CAABB9AEB24; Wed, 29 Jul 2015 06:23:07 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AFB47185E; Wed, 29 Jul 2015 06:23:07 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6T6N76W073985; Wed, 29 Jul 2015 06:23:07 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6T6N7lq073984; Wed, 29 Jul 2015 06:23:07 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201507290623.t6T6N7lq073984@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Wed, 29 Jul 2015 06:23:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285997 - head/usr.sbin/pw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 06:23:08 -0000 Author: bapt Date: Wed Jul 29 06:23:06 2015 New Revision: 285997 URL: https://svnweb.freebsd.org/changeset/base/285997 Log: Actually add the new code Added: head/usr.sbin/pw/strtounum.c (contents, props changed) Added: head/usr.sbin/pw/strtounum.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.sbin/pw/strtounum.c Wed Jul 29 06:23:06 2015 (r285997) @@ -0,0 +1,73 @@ +/*- + * Copyright (C) Baptiste Daroussin + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY DAVID L. NUGENT AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL DAVID L. NUGENT OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include "pw.h" + +#define INVALID "invalid" +#define TOOSMALL "too small" +#define TOOLARGE "too large" + +uintmax_t +strtounum(const char *numstr, uintmax_t minval, uintmax_t maxval, + const char **errstrp) +{ + uintmax_t ret = 0; + char *ep; + + if (minval > maxval) { + errno = EINVAL; + if (errstrp != NULL) + *errstrp = INVALID; + return (0); + } + + ret = strtoumax(numstr, &ep, 10); + if (errno == EINVAL || numstr == ep || *ep != '\0') { + errno = EINVAL; + if (errstrp != NULL) + *errstrp = INVALID; + return (0); + } else if ((ret == 0 && errno == ERANGE) || ret < minval) { + errno = ERANGE; + if (errstrp != NULL) + *errstrp = TOOSMALL; + return (0); + } else if ((ret == UINTMAX_MAX && errno == ERANGE) || ret > maxval) { + errno = ERANGE; + if (errstrp != NULL) + *errstrp = TOOLARGE; + return (0); + } + + return (ret); +} From owner-svn-src-all@freebsd.org Wed Jul 29 06:31:45 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 692CB9AED23; Wed, 29 Jul 2015 06:31:45 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 593B71D04; Wed, 29 Jul 2015 06:31:45 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6T6VjYK077946; Wed, 29 Jul 2015 06:31:45 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6T6Vj9x077945; Wed, 29 Jul 2015 06:31:45 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201507290631.t6T6Vj9x077945@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Wed, 29 Jul 2015 06:31:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285998 - head/sys/compat/cloudabi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 06:31:45 -0000 Author: ed Date: Wed Jul 29 06:31:44 2015 New Revision: 285998 URL: https://svnweb.freebsd.org/changeset/base/285998 Log: Implement CloudABI's readdir(). Summary: CloudABI's readdir() system call could be thought of as a mixture between FreeBSD's getdents(2) and pread(). Instead of using the file descriptor offset, userspace provides a 64-bit cloudabi_dircookie_t continue reading at a given point. CLOUDABI_DIRCOOKIE_START, having value 0, can be used to return entries at the start of the directory. The file descriptor offset is not used to store the cookie for the reason that in a file descriptor centric environment, it would make sense to allow concurrent use of a single file descriptor. The remaining space returned by the system call should be filled with a partially truncated copy of the next entry. The advantage of doing this is that it gracefully deals with long filenames. If the C library provides a buffer that is too small to hold a single entry, it can still extract the directory entry header, meaning that it can retry the read with a larger buffer or skip it using the cookie. Test Plan: This implementation passes the cloudlibc unit tests at: https://github.com/NuxiNL/cloudlibc/tree/master/src/libc/dirent Reviewers: marcel, kib Reviewed By: kib Subscribers: imp Differential Revision: https://reviews.freebsd.org/D3226 Modified: head/sys/compat/cloudabi/cloudabi_file.c Modified: head/sys/compat/cloudabi/cloudabi_file.c ============================================================================== --- head/sys/compat/cloudabi/cloudabi_file.c Wed Jul 29 06:23:06 2015 (r285997) +++ head/sys/compat/cloudabi/cloudabi_file.c Wed Jul 29 06:31:44 2015 (r285998) @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -35,11 +36,15 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include +#include + static MALLOC_DEFINE(M_CLOUDABI_PATH, "cloudabipath", "CloudABI pathnames"); /* @@ -197,13 +202,180 @@ cloudabi_sys_file_open(struct thread *td return (ENOSYS); } +/* Converts a FreeBSD directory entry structure and writes it to userspace. */ +static int +write_dirent(struct dirent *bde, cloudabi_dircookie_t cookie, struct uio *uio) +{ + cloudabi_dirent_t cde = { + .d_next = cookie, + .d_ino = bde->d_fileno, + .d_namlen = bde->d_namlen, + }; + size_t len; + int error; + + /* Convert file type. */ + switch (bde->d_type) { + case DT_BLK: + cde.d_type = CLOUDABI_FILETYPE_BLOCK_DEVICE; + break; + case DT_CHR: + cde.d_type = CLOUDABI_FILETYPE_CHARACTER_DEVICE; + break; + case DT_DIR: + cde.d_type = CLOUDABI_FILETYPE_DIRECTORY; + break; + case DT_FIFO: + cde.d_type = CLOUDABI_FILETYPE_FIFO; + break; + case DT_LNK: + cde.d_type = CLOUDABI_FILETYPE_SYMBOLIC_LINK; + break; + case DT_REG: + cde.d_type = CLOUDABI_FILETYPE_REGULAR_FILE; + break; + case DT_SOCK: + /* The exact socket type cannot be derived. */ + cde.d_type = CLOUDABI_FILETYPE_SOCKET_STREAM; + break; + default: + cde.d_type = CLOUDABI_FILETYPE_UNKNOWN; + break; + } + + /* Write directory entry structure. */ + len = sizeof(cde) < uio->uio_resid ? sizeof(cde) : uio->uio_resid; + error = uiomove(&cde, len, uio); + if (error != 0) + return (error); + + /* Write filename. */ + len = bde->d_namlen < uio->uio_resid ? bde->d_namlen : uio->uio_resid; + return (uiomove(bde->d_name, len, uio)); +} + int cloudabi_sys_file_readdir(struct thread *td, struct cloudabi_sys_file_readdir_args *uap) { + struct iovec iov = { + .iov_base = uap->buf, + .iov_len = uap->nbyte + }; + struct uio uio = { + .uio_iov = &iov, + .uio_iovcnt = 1, + .uio_resid = iov.iov_len, + .uio_segflg = UIO_USERSPACE, + .uio_rw = UIO_READ, + .uio_td = td + }; + struct file *fp; + struct vnode *vp; + void *readbuf; + cap_rights_t rights; + cloudabi_dircookie_t offset; + int error; - /* Not implemented. */ - return (ENOSYS); + /* Obtain directory vnode. */ + error = getvnode(td, uap->fd, cap_rights_init(&rights, CAP_READ), &fp); + if (error != 0) { + if (error == EINVAL) + return (ENOTDIR); + return (error); + } + if ((fp->f_flag & FREAD) == 0) { + fdrop(fp, td); + return (EBADF); + } + + /* + * Call VOP_READDIR() and convert resulting data until the user + * provided buffer is filled. + */ + readbuf = malloc(MAXBSIZE, M_TEMP, M_WAITOK); + offset = uap->cookie; + vp = fp->f_vnode; + while (uio.uio_resid > 0) { + struct iovec readiov = { + .iov_base = readbuf, + .iov_len = MAXBSIZE + }; + struct uio readuio = { + .uio_iov = &readiov, + .uio_iovcnt = 1, + .uio_rw = UIO_READ, + .uio_segflg = UIO_SYSSPACE, + .uio_td = td, + .uio_resid = MAXBSIZE, + .uio_offset = offset + }; + struct dirent *bde; + unsigned long *cookies, *cookie; + size_t readbuflen; + int eof, ncookies; + + /* Validate file type. */ + vn_lock(vp, LK_SHARED | LK_RETRY); + if (vp->v_type != VDIR) { + VOP_UNLOCK(vp, 0); + error = ENOTDIR; + goto done; + } +#ifdef MAC + error = mac_vnode_check_readdir(td->td_ucred, vp); + if (error != 0) { + VOP_UNLOCK(vp, 0); + goto done; + } +#endif /* MAC */ + + /* Read new directory entries. */ + cookies = NULL; + ncookies = 0; + error = VOP_READDIR(vp, &readuio, fp->f_cred, &eof, + &ncookies, &cookies); + VOP_UNLOCK(vp, 0); + if (error != 0) + goto done; + + /* Convert entries to CloudABI's format. */ + readbuflen = MAXBSIZE - readuio.uio_resid; + bde = readbuf; + cookie = cookies; + while (readbuflen >= offsetof(struct dirent, d_name) && + uio.uio_resid > 0 && ncookies > 0) { + /* Ensure that the returned offset always increases. */ + if (readbuflen >= bde->d_reclen && bde->d_fileno != 0 && + *cookie > offset) { + error = write_dirent(bde, *cookie, &uio); + if (error != 0) { + free(cookies, M_TEMP); + goto done; + } + } + + if (offset < *cookie) + offset = *cookie; + ++cookie; + --ncookies; + readbuflen -= bde->d_reclen; + bde = (struct dirent *)((char *)bde + bde->d_reclen); + } + free(cookies, M_TEMP); + if (eof) + break; + } + +done: + fdrop(fp, td); + free(readbuf, M_TEMP); + if (error != 0) + return (error); + + /* Return number of bytes copied to userspace. */ + td->td_retval[0] = uap->nbyte - uio.uio_resid; + return (0); } int From owner-svn-src-all@freebsd.org Wed Jul 29 06:35:37 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 546849AEE3C; Wed, 29 Jul 2015 06:35:37 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 452461ED0; Wed, 29 Jul 2015 06:35:37 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6T6ZbGv078233; Wed, 29 Jul 2015 06:35:37 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6T6ZbxO078232; Wed, 29 Jul 2015 06:35:37 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201507290635.t6T6ZbxO078232@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Wed, 29 Jul 2015 06:35:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285999 - head/sys/netpfil/pf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 06:35:37 -0000 Author: kp Date: Wed Jul 29 06:35:36 2015 New Revision: 285999 URL: https://svnweb.freebsd.org/changeset/base/285999 Log: pf: Always initialise pf_fragment.fr_flags When we allocate the struct pf_fragment in pf_fillup_fragment() we forgot to initialise the fr_flags field. As a result we sometimes mistakenly thought the fragment to not be a buffered fragment. This resulted in panics because we'd end up freeing the pf_fragment but not removing it from V_pf_fragqueue (believing it to be part of V_pf_cachequeue). The next time we iterated V_pf_fragqueue we'd use a freed object and panic. While here also fix a pf_fragment use after free in pf_normalize_ip(). pf_reassemble() frees the pf_fragment, so we can't use it any more. PR: 201879, 201932 MFC after: 5 days Modified: head/sys/netpfil/pf/pf_norm.c Modified: head/sys/netpfil/pf/pf_norm.c ============================================================================== --- head/sys/netpfil/pf/pf_norm.c Wed Jul 29 06:31:44 2015 (r285998) +++ head/sys/netpfil/pf/pf_norm.c Wed Jul 29 06:35:36 2015 (r285999) @@ -431,6 +431,7 @@ pf_fillup_fragment(struct pf_fragment_cm } *(struct pf_fragment_cmp *)frag = *key; + frag->fr_flags = 0; frag->fr_timeout = time_second; frag->fr_maxlen = frent->fe_len; TAILQ_INIT(&frag->fr_queue); @@ -1284,9 +1285,6 @@ pf_normalize_ip(struct mbuf **m0, int di if (m == NULL) return (PF_DROP); - if (frag != NULL && (frag->fr_flags & PFFRAG_DROP)) - goto drop; - h = mtod(m, struct ip *); } else { /* non-buffering fragment cache (drops or masks overlaps) */ From owner-svn-src-all@freebsd.org Wed Jul 29 07:15:18 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 587499ADACA; Wed, 29 Jul 2015 07:15:18 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 48BCD11DC; Wed, 29 Jul 2015 07:15:18 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6T7FIAk094461; Wed, 29 Jul 2015 07:15:18 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6T7FHGb094456; Wed, 29 Jul 2015 07:15:17 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <201507290715.t6T7FHGb094456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Wed, 29 Jul 2015 07:15:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286000 - head/sys/netipsec X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 07:15:18 -0000 Author: jmg Date: Wed Jul 29 07:15:16 2015 New Revision: 286000 URL: https://svnweb.freebsd.org/changeset/base/286000 Log: RFC4868 section 2.3 requires that the output be half... This fixes problems that was introduced in r285336... I have verified that HMAC-SHA2-256 both ah only and w/ AES-CBC interoperate w/ a NetBSD 6.1.5 vm... Reviewed by: gnn Modified: head/sys/netipsec/xform.h head/sys/netipsec/xform_ah.c head/sys/netipsec/xform_esp.c Modified: head/sys/netipsec/xform.h ============================================================================== --- head/sys/netipsec/xform.h Wed Jul 29 06:35:36 2015 (r285999) +++ head/sys/netipsec/xform.h Wed Jul 29 07:15:16 2015 (r286000) @@ -105,6 +105,7 @@ struct xformsw { #ifdef _KERNEL extern void xform_register(struct xformsw*); extern int xform_init(struct secasvar *sav, int xftype); +extern int xform_ah_authsize(struct auth_hash *esph); struct cryptoini; Modified: head/sys/netipsec/xform_ah.c ============================================================================== --- head/sys/netipsec/xform_ah.c Wed Jul 29 06:35:36 2015 (r285999) +++ head/sys/netipsec/xform_ah.c Wed Jul 29 07:15:16 2015 (r286000) @@ -85,8 +85,8 @@ * Return authenticator size in bytes, based on a field in the * algorithm descriptor. */ -#define AUTHSIZE(sav) \ - ((sav->flags & SADB_X_EXT_OLD) ? 16 : (sav)->tdb_authalgxform->hashsize) +#define AUTHSIZE(sav) ((sav->flags & SADB_X_EXT_OLD) ? 16 : \ + xform_ah_authsize((sav)->tdb_authalgxform)) VNET_DEFINE(int, ah_enable) = 1; /* control flow of packets with AH */ VNET_DEFINE(int, ah_cleartos) = 1; /* clear ip_tos when doing AH calc */ @@ -112,6 +112,35 @@ static unsigned char ipseczeroes[256]; / static int ah_input_cb(struct cryptop*); static int ah_output_cb(struct cryptop*); +int +xform_ah_authsize(struct auth_hash *esph) +{ + int alen; + + if (esph == NULL) + return 0; + + switch (esph->type) { + case CRYPTO_SHA2_256_HMAC: + case CRYPTO_SHA2_384_HMAC: + case CRYPTO_SHA2_512_HMAC: + alen = esph->hashsize / 2; /* RFC4868 2.3 */ + break; + + case CRYPTO_AES_128_NIST_GMAC: + case CRYPTO_AES_192_NIST_GMAC: + case CRYPTO_AES_256_NIST_GMAC: + alen = esph->hashsize; + break; + + default: + alen = AH_HMAC_HASHLEN; + break; + } + + return alen; +} + /* * NB: this is public for use by the PF_KEY support. */ Modified: head/sys/netipsec/xform_esp.c ============================================================================== --- head/sys/netipsec/xform_esp.c Wed Jul 29 06:35:36 2015 (r285999) +++ head/sys/netipsec/xform_esp.c Wed Jul 29 07:15:16 2015 (r286000) @@ -320,7 +320,6 @@ esp_input(struct mbuf *m, struct secasva IPSEC_ASSERT(sav != NULL, ("null SA")); IPSEC_ASSERT(sav->tdb_encalgxform != NULL, ("null encoding xform")); - alen = 0; /* Valid IP Packet length ? */ if ( (skip&3) || (m->m_pkthdr.len&3) ){ DPRINTF(("%s: misaligned packet, skip %u pkt len %u", @@ -335,13 +334,13 @@ esp_input(struct mbuf *m, struct secasva esph = sav->tdb_authalgxform; espx = sav->tdb_encalgxform; - /* Determine the ESP header length */ + /* Determine the ESP header and auth length */ if (sav->flags & SADB_X_EXT_OLD) hlen = sizeof (struct esp) + sav->ivlen; else hlen = sizeof (struct newesp) + sav->ivlen; - /* Authenticator hash size */ - alen = esph ? esph->hashsize : 0; + + alen = xform_ah_authsize(esph); /* * Verify payload length is multiple of encryption algorithm @@ -530,7 +529,7 @@ esp_input_cb(struct cryptop *crp) /* If authentication was performed, check now. */ if (esph != NULL) { - alen = esph->hashsize; + alen = xform_ah_authsize(esph); AHSTAT_INC(ahs_hist[sav->alg_auth]); /* Copy the authenticator from the packet */ m_copydata(m, m->m_pkthdr.len - alen, alen, aalg); @@ -700,10 +699,7 @@ esp_output(struct mbuf *m, struct ipsecr /* XXX clamp padding length a la KAME??? */ padding = ((blks - ((rlen + 2) % blks)) % blks) + 2; - if (esph) - alen = esph->hashsize; - else - alen = 0; + alen = xform_ah_authsize(esph); ESPSTAT_INC(esps_output); @@ -983,21 +979,7 @@ esp_output_cb(struct cryptop *crp) if (esph != NULL) { int alen; - switch (esph->type) { - case CRYPTO_SHA2_256_HMAC: - case CRYPTO_SHA2_384_HMAC: - case CRYPTO_SHA2_512_HMAC: - alen = esph->hashsize/2; - break; - case CRYPTO_AES_128_NIST_GMAC: - case CRYPTO_AES_192_NIST_GMAC: - case CRYPTO_AES_256_NIST_GMAC: - alen = esph->hashsize; - break; - default: - alen = AH_HMAC_HASHLEN; - break; - } + alen = xform_ah_authsize(esph); m_copyback(m, m->m_pkthdr.len - alen, alen, ipseczeroes); } From owner-svn-src-all@freebsd.org Wed Jul 29 08:12:13 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 278639AD420; Wed, 29 Jul 2015 08:12:13 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 16A5416E4; Wed, 29 Jul 2015 08:12:13 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6T8CDgl018516; Wed, 29 Jul 2015 08:12:13 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6T8C6PG018495; Wed, 29 Jul 2015 08:12:06 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201507290812.t6T8C6PG018495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 29 Jul 2015 08:12:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286001 - in head/sys: dev/cxgbe/tom net netinet netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 08:12:13 -0000 Author: ae Date: Wed Jul 29 08:12:05 2015 New Revision: 286001 URL: https://svnweb.freebsd.org/changeset/base/286001 Log: Convert in_ifaddr_lock and in6_ifaddr_lock to rmlock. Both are used to protect access to IP addresses lists and they can be acquired for reading several times per packet. To reduce lock contention it is better to use rmlock here. Reviewed by: gnn (previous version) Obtained from: Yandex LLC Sponsored by: Yandex LLC Differential Revision: https://reviews.freebsd.org/D3149 Modified: head/sys/dev/cxgbe/tom/t4_tom.c head/sys/net/if_spppsubr.c head/sys/net/if_stf.c head/sys/netinet/if_ether.c head/sys/netinet/igmp.c head/sys/netinet/in.c head/sys/netinet/in_mcast.c head/sys/netinet/in_pcb.c head/sys/netinet/in_var.h head/sys/netinet/ip_icmp.c head/sys/netinet/ip_input.c head/sys/netinet/ip_output.c head/sys/netinet/raw_ip.c head/sys/netinet6/in6.c head/sys/netinet6/in6_ifattach.c head/sys/netinet6/in6_src.c head/sys/netinet6/in6_var.h head/sys/netinet6/ip6_input.c Modified: head/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.c Wed Jul 29 07:15:16 2015 (r286000) +++ head/sys/dev/cxgbe/tom/t4_tom.c Wed Jul 29 08:12:05 2015 (r286001) @@ -36,9 +36,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include +#include #include #include #include @@ -762,6 +764,7 @@ t4_clip_task(void *arg, int count) static void update_clip_table(struct adapter *sc, struct tom_data *td) { + struct rm_priotracker in6_ifa_tracker; struct in6_ifaddr *ia; struct in6_addr *lip, tlip; struct clip_head stale; @@ -770,7 +773,7 @@ update_clip_table(struct adapter *sc, st ASSERT_SYNCHRONIZED_OP(sc); - IN6_IFADDR_RLOCK(); + IN6_IFADDR_RLOCK(&in6_ifa_tracker); mtx_lock(&td->clip_table_lock); if (gen == td->clip_gen) @@ -862,7 +865,7 @@ next: td->clip_gen = gen; done: mtx_unlock(&td->clip_table_lock); - IN6_IFADDR_RUNLOCK(); + IN6_IFADDR_RUNLOCK(&in6_ifa_tracker); } static void Modified: head/sys/net/if_spppsubr.c ============================================================================== --- head/sys/net/if_spppsubr.c Wed Jul 29 07:15:16 2015 (r286000) +++ head/sys/net/if_spppsubr.c Wed Jul 29 08:12:05 2015 (r286001) @@ -28,7 +28,9 @@ #include #include +#include #include +#include #include #include #include Modified: head/sys/net/if_stf.c ============================================================================== --- head/sys/net/if_stf.c Wed Jul 29 07:15:16 2015 (r286000) +++ head/sys/net/if_stf.c Wed Jul 29 08:12:05 2015 (r286001) @@ -84,10 +84,12 @@ #include #include #include +#include #include #include #include #include +#include #include #include @@ -530,6 +532,7 @@ stf_checkaddr4(sc, in, inifp) struct in_addr *in; struct ifnet *inifp; /* incoming interface */ { + struct rm_priotracker in_ifa_tracker; struct in_ifaddr *ia4; /* @@ -553,16 +556,16 @@ stf_checkaddr4(sc, in, inifp) /* * reject packets with broadcast */ - IN_IFADDR_RLOCK(); + IN_IFADDR_RLOCK(&in_ifa_tracker); TAILQ_FOREACH(ia4, &V_in_ifaddrhead, ia_link) { if ((ia4->ia_ifa.ifa_ifp->if_flags & IFF_BROADCAST) == 0) continue; if (in->s_addr == ia4->ia_broadaddr.sin_addr.s_addr) { - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); return -1; } } - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); /* * perform ingress filter Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Wed Jul 29 07:15:16 2015 (r286000) +++ head/sys/netinet/if_ether.c Wed Jul 29 08:12:05 2015 (r286001) @@ -42,12 +42,14 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include #include #include #include +#include #include #include @@ -563,6 +565,7 @@ SYSCTL_INT(_net_link_ether_inet, OID_AUT static void in_arpinput(struct mbuf *m) { + struct rm_priotracker in_ifa_tracker; struct arphdr *ah; struct ifnet *ifp = m->m_pkthdr.rcvif; struct llentry *la = NULL; @@ -621,7 +624,7 @@ in_arpinput(struct mbuf *m) * of the receive interface. (This will change slightly * when we have clusters of interfaces). */ - IN_IFADDR_RLOCK(); + IN_IFADDR_RLOCK(&in_ifa_tracker); LIST_FOREACH(ia, INADDR_HASH(itaddr.s_addr), ia_hash) { if (((bridged && ia->ia_ifp->if_bridge == ifp->if_bridge) || ia->ia_ifp == ifp) && @@ -629,7 +632,7 @@ in_arpinput(struct mbuf *m) (ia->ia_ifa.ifa_carp == NULL || (*carp_iamatch_p)(&ia->ia_ifa, &enaddr))) { ifa_ref(&ia->ia_ifa); - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); goto match; } } @@ -638,7 +641,7 @@ in_arpinput(struct mbuf *m) ia->ia_ifp == ifp) && isaddr.s_addr == ia->ia_addr.sin_addr.s_addr) { ifa_ref(&ia->ia_ifa); - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); goto match; } @@ -657,13 +660,13 @@ in_arpinput(struct mbuf *m) if (BDG_MEMBER_MATCHES_ARP(itaddr.s_addr, ifp, ia)) { ifa_ref(&ia->ia_ifa); ifp = ia->ia_ifp; - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); goto match; } } } #undef BDG_MEMBER_MATCHES_ARP - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); /* * No match, use the first inet address on the receive interface @@ -684,13 +687,13 @@ in_arpinput(struct mbuf *m) /* * If bridging, fall back to using any inet address. */ - IN_IFADDR_RLOCK(); + IN_IFADDR_RLOCK(&in_ifa_tracker); if (!bridged || (ia = TAILQ_FIRST(&V_in_ifaddrhead)) == NULL) { - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); goto drop; } ifa_ref(&ia->ia_ifa); - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); match: if (!enaddr) enaddr = (u_int8_t *)IF_LLADDR(ifp); Modified: head/sys/netinet/igmp.c ============================================================================== --- head/sys/netinet/igmp.c Wed Jul 29 07:15:16 2015 (r286000) +++ head/sys/netinet/igmp.c Wed Jul 29 08:12:05 2015 (r286001) @@ -58,6 +58,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -1215,6 +1217,7 @@ static int igmp_input_v1_report(struct ifnet *ifp, /*const*/ struct ip *ip, /*const*/ struct igmp *igmp) { + struct rm_priotracker in_ifa_tracker; struct in_ifaddr *ia; struct in_multi *inm; @@ -1237,7 +1240,7 @@ igmp_input_v1_report(struct ifnet *ifp, * Replace 0.0.0.0 with the subnet address if told to do so. */ if (V_igmp_recvifkludge && in_nullhost(ip->ip_src)) { - IFP_TO_IA(ifp, ia); + IFP_TO_IA(ifp, ia, &in_ifa_tracker); if (ia != NULL) { ip->ip_src.s_addr = htonl(ia->ia_subnet); ifa_free(&ia->ia_ifa); @@ -1323,6 +1326,7 @@ static int igmp_input_v2_report(struct ifnet *ifp, /*const*/ struct ip *ip, /*const*/ struct igmp *igmp) { + struct rm_priotracker in_ifa_tracker; struct in_ifaddr *ia; struct in_multi *inm; @@ -1331,7 +1335,7 @@ igmp_input_v2_report(struct ifnet *ifp, * leave requires knowing that we are the only member of a * group. */ - IFP_TO_IA(ifp, ia); + IFP_TO_IA(ifp, ia, &in_ifa_tracker); if (ia != NULL && in_hosteq(ip->ip_src, IA_SIN(ia)->sin_addr)) { ifa_free(&ia->ia_ifa); return (0); @@ -3487,6 +3491,7 @@ out: static struct mbuf * igmp_v3_encap_report(struct ifnet *ifp, struct mbuf *m) { + struct rm_priotracker in_ifa_tracker; struct igmp_report *igmp; struct ip *ip; int hdrlen, igmpreclen; @@ -3535,7 +3540,7 @@ igmp_v3_encap_report(struct ifnet *ifp, if (m->m_flags & M_IGMP_LOOP) { struct in_ifaddr *ia; - IFP_TO_IA(ifp, ia); + IFP_TO_IA(ifp, ia, &in_ifa_tracker); if (ia != NULL) { ip->ip_src = ia->ia_addr.sin_addr; ifa_free(&ia->ia_ifa); Modified: head/sys/netinet/in.c ============================================================================== --- head/sys/netinet/in.c Wed Jul 29 07:15:16 2015 (r286000) +++ head/sys/netinet/in.c Wed Jul 29 08:12:05 2015 (r286001) @@ -44,7 +44,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include #include @@ -93,17 +95,18 @@ SX_SYSINIT(in_control_sx, &in_control_sx int in_localaddr(struct in_addr in) { + struct rm_priotracker in_ifa_tracker; register u_long i = ntohl(in.s_addr); register struct in_ifaddr *ia; - IN_IFADDR_RLOCK(); + IN_IFADDR_RLOCK(&in_ifa_tracker); TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { if ((i & ia->ia_subnetmask) == ia->ia_subnet) { - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); return (1); } } - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); return (0); } @@ -114,16 +117,17 @@ in_localaddr(struct in_addr in) int in_localip(struct in_addr in) { + struct rm_priotracker in_ifa_tracker; struct in_ifaddr *ia; - IN_IFADDR_RLOCK(); + IN_IFADDR_RLOCK(&in_ifa_tracker); LIST_FOREACH(ia, INADDR_HASH(in.s_addr), ia_hash) { if (IA_SIN(ia)->sin_addr.s_addr == in.s_addr) { - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); return (1); } } - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); return (0); } @@ -158,18 +162,19 @@ in_ifhasaddr(struct ifnet *ifp, struct i static struct in_ifaddr * in_localip_more(struct in_ifaddr *ia) { + struct rm_priotracker in_ifa_tracker; in_addr_t in = IA_SIN(ia)->sin_addr.s_addr; struct in_ifaddr *it; - IN_IFADDR_RLOCK(); + IN_IFADDR_RLOCK(&in_ifa_tracker); LIST_FOREACH(it, INADDR_HASH(in), ia_hash) { if (it != ia && IA_SIN(it)->sin_addr.s_addr == in) { ifa_ref(&it->ia_ifa); - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); return (it); } } - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); return (NULL); } @@ -646,6 +651,7 @@ in_difaddr_ioctl(caddr_t data, struct if int in_addprefix(struct in_ifaddr *target, int flags) { + struct rm_priotracker in_ifa_tracker; struct in_ifaddr *ia; struct in_addr prefix, mask, p, m; int error; @@ -659,7 +665,7 @@ in_addprefix(struct in_ifaddr *target, i prefix.s_addr &= mask.s_addr; } - IN_IFADDR_RLOCK(); + IN_IFADDR_RLOCK(&in_ifa_tracker); /* Look for an existing address with the same prefix, mask, and fib */ TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { if (rtinitflags(ia)) { @@ -687,13 +693,13 @@ in_addprefix(struct in_ifaddr *target, i #ifdef RADIX_MPATH if (ia->ia_addr.sin_addr.s_addr == target->ia_addr.sin_addr.s_addr) { - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); return (EEXIST); } else break; #endif if (V_nosameprefix) { - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); return (EEXIST); } else { int fibnum; @@ -701,12 +707,12 @@ in_addprefix(struct in_ifaddr *target, i fibnum = V_rt_add_addr_allfibs ? RT_ALL_FIBS : target->ia_ifp->if_fib; rt_addrmsg(RTM_ADD, &target->ia_ifa, fibnum); - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); return (0); } } } - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); /* * No-one seem to have this prefix route, so we try to insert it. @@ -725,6 +731,7 @@ in_addprefix(struct in_ifaddr *target, i int in_scrubprefix(struct in_ifaddr *target, u_int flags) { + struct rm_priotracker in_ifa_tracker; struct in_ifaddr *ia; struct in_addr prefix, mask, p, m; int error = 0; @@ -775,7 +782,7 @@ in_scrubprefix(struct in_ifaddr *target, return (0); } - IN_IFADDR_RLOCK(); + IN_IFADDR_RLOCK(&in_ifa_tracker); TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { if (rtinitflags(ia)) { p = ia->ia_dstaddr.sin_addr; @@ -802,7 +809,7 @@ in_scrubprefix(struct in_ifaddr *target, */ if ((ia->ia_flags & IFA_ROUTE) == 0) { ifa_ref(&ia->ia_ifa); - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); error = rtinit(&(target->ia_ifa), (int)RTM_DELETE, rtinitflags(target)); if (error == 0) @@ -821,7 +828,7 @@ in_scrubprefix(struct in_ifaddr *target, return (error); } } - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); /* * remove all L2 entries on the given prefix Modified: head/sys/netinet/in_mcast.c ============================================================================== --- head/sys/netinet/in_mcast.c Wed Jul 29 07:15:16 2015 (r286000) +++ head/sys/netinet/in_mcast.c Wed Jul 29 08:12:05 2015 (r286001) @@ -38,9 +38,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include +#include #include #include #include @@ -1748,6 +1750,7 @@ inp_get_source_filters(struct inpcb *inp int inp_getmoptions(struct inpcb *inp, struct sockopt *sopt) { + struct rm_priotracker in_ifa_tracker; struct ip_mreqn mreqn; struct ip_moptions *imo; struct ifnet *ifp; @@ -1787,7 +1790,7 @@ inp_getmoptions(struct inpcb *inp, struc mreqn.imr_address = imo->imo_multicast_addr; } else if (ifp != NULL) { mreqn.imr_ifindex = ifp->if_index; - IFP_TO_IA(ifp, ia); + IFP_TO_IA(ifp, ia, &in_ifa_tracker); if (ia != NULL) { mreqn.imr_address = IA_SIN(ia)->sin_addr; @@ -1878,6 +1881,7 @@ static struct ifnet * inp_lookup_mcast_ifp(const struct inpcb *inp, const struct sockaddr_in *gsin, const struct in_addr ina) { + struct rm_priotracker in_ifa_tracker; struct ifnet *ifp; KASSERT(gsin->sin_family == AF_INET, ("%s: not AF_INET", __func__)); @@ -1902,7 +1906,7 @@ inp_lookup_mcast_ifp(const struct inpcb struct ifnet *mifp; mifp = NULL; - IN_IFADDR_RLOCK(); + IN_IFADDR_RLOCK(&in_ifa_tracker); TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { mifp = ia->ia_ifp; if (!(mifp->if_flags & IFF_LOOPBACK) && @@ -1911,7 +1915,7 @@ inp_lookup_mcast_ifp(const struct inpcb break; } } - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); } } Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Wed Jul 29 07:15:16 2015 (r286000) +++ head/sys/netinet/in_pcb.c Wed Jul 29 08:12:05 2015 (r286001) @@ -47,11 +47,13 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -992,6 +994,7 @@ in_pcbconnect_setup(struct inpcb *inp, s in_addr_t *laddrp, u_short *lportp, in_addr_t *faddrp, u_short *fportp, struct inpcb **oinpp, struct ucred *cred) { + struct rm_priotracker in_ifa_tracker; struct sockaddr_in *sin = (struct sockaddr_in *)nam; struct in_ifaddr *ia; struct inpcb *oinp; @@ -1028,20 +1031,20 @@ in_pcbconnect_setup(struct inpcb *inp, s * choose the broadcast address for that interface. */ if (faddr.s_addr == INADDR_ANY) { - IN_IFADDR_RLOCK(); + IN_IFADDR_RLOCK(&in_ifa_tracker); faddr = IA_SIN(TAILQ_FIRST(&V_in_ifaddrhead))->sin_addr; - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); if (cred != NULL && (error = prison_get_ip4(cred, &faddr)) != 0) return (error); } else if (faddr.s_addr == (u_long)INADDR_BROADCAST) { - IN_IFADDR_RLOCK(); + IN_IFADDR_RLOCK(&in_ifa_tracker); if (TAILQ_FIRST(&V_in_ifaddrhead)->ia_ifp->if_flags & IFF_BROADCAST) faddr = satosin(&TAILQ_FIRST( &V_in_ifaddrhead)->ia_broadaddr)->sin_addr; - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); } } if (laddr.s_addr == INADDR_ANY) { @@ -1059,7 +1062,7 @@ in_pcbconnect_setup(struct inpcb *inp, s imo = inp->inp_moptions; if (imo->imo_multicast_ifp != NULL) { ifp = imo->imo_multicast_ifp; - IN_IFADDR_RLOCK(); + IN_IFADDR_RLOCK(&in_ifa_tracker); TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { if ((ia->ia_ifp == ifp) && (cred == NULL || @@ -1073,7 +1076,7 @@ in_pcbconnect_setup(struct inpcb *inp, s laddr = ia->ia_addr.sin_addr; error = 0; } - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); } } if (error) Modified: head/sys/netinet/in_var.h ============================================================================== --- head/sys/netinet/in_var.h Wed Jul 29 07:15:16 2015 (r286000) +++ head/sys/netinet/in_var.h Wed Jul 29 08:12:05 2015 (r286001) @@ -119,15 +119,15 @@ VNET_DECLARE(u_long, in_ifaddrhmask); / #define INADDR_HASH(x) \ (&V_in_ifaddrhashtbl[INADDR_HASHVAL(x) & V_in_ifaddrhmask]) -extern struct rwlock in_ifaddr_lock; +extern struct rmlock in_ifaddr_lock; -#define IN_IFADDR_LOCK_ASSERT() rw_assert(&in_ifaddr_lock, RA_LOCKED) -#define IN_IFADDR_RLOCK() rw_rlock(&in_ifaddr_lock) -#define IN_IFADDR_RLOCK_ASSERT() rw_assert(&in_ifaddr_lock, RA_RLOCKED) -#define IN_IFADDR_RUNLOCK() rw_runlock(&in_ifaddr_lock) -#define IN_IFADDR_WLOCK() rw_wlock(&in_ifaddr_lock) -#define IN_IFADDR_WLOCK_ASSERT() rw_assert(&in_ifaddr_lock, RA_WLOCKED) -#define IN_IFADDR_WUNLOCK() rw_wunlock(&in_ifaddr_lock) +#define IN_IFADDR_LOCK_ASSERT() rm_assert(&in_ifaddr_lock, RA_LOCKED) +#define IN_IFADDR_RLOCK(t) rm_rlock(&in_ifaddr_lock, (t)) +#define IN_IFADDR_RLOCK_ASSERT() rm_assert(&in_ifaddr_lock, RA_RLOCKED) +#define IN_IFADDR_RUNLOCK(t) rm_runlock(&in_ifaddr_lock, (t)) +#define IN_IFADDR_WLOCK() rm_wlock(&in_ifaddr_lock) +#define IN_IFADDR_WLOCK_ASSERT() rm_assert(&in_ifaddr_lock, RA_WLOCKED) +#define IN_IFADDR_WUNLOCK() rm_wunlock(&in_ifaddr_lock) /* * Macro for finding the internet address structure (in_ifaddr) @@ -161,18 +161,19 @@ do { \ * Macro for finding the internet address structure (in_ifaddr) corresponding * to a given interface (ifnet structure). */ -#define IFP_TO_IA(ifp, ia) \ +#define IFP_TO_IA(ifp, ia, t) \ /* struct ifnet *ifp; */ \ /* struct in_ifaddr *ia; */ \ + /* struct rm_priotracker *t; */ \ do { \ - IN_IFADDR_RLOCK(); \ + IN_IFADDR_RLOCK((t)); \ for ((ia) = TAILQ_FIRST(&V_in_ifaddrhead); \ (ia) != NULL && (ia)->ia_ifp != (ifp); \ (ia) = TAILQ_NEXT((ia), ia_link)) \ continue; \ if ((ia) != NULL) \ ifa_ref(&(ia)->ia_ifa); \ - IN_IFADDR_RUNLOCK(); \ + IN_IFADDR_RUNLOCK((t)); \ } while (0) /* Modified: head/sys/netinet/ip_icmp.c ============================================================================== --- head/sys/netinet/ip_icmp.c Wed Jul 29 07:15:16 2015 (r286000) +++ head/sys/netinet/ip_icmp.c Wed Jul 29 08:12:05 2015 (r286001) @@ -41,6 +41,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -647,6 +649,7 @@ freeit: static void icmp_reflect(struct mbuf *m) { + struct rm_priotracker in_ifa_tracker; struct ip *ip = mtod(m, struct ip *); struct ifaddr *ifa; struct ifnet *ifp; @@ -672,15 +675,15 @@ icmp_reflect(struct mbuf *m) * If the incoming packet was addressed directly to one of our * own addresses, use dst as the src for the reply. */ - IN_IFADDR_RLOCK(); + IN_IFADDR_RLOCK(&in_ifa_tracker); LIST_FOREACH(ia, INADDR_HASH(t.s_addr), ia_hash) { if (t.s_addr == IA_SIN(ia)->sin_addr.s_addr) { t = IA_SIN(ia)->sin_addr; - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); goto match; } } - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); /* * If the incoming packet was addressed to one of our broadcast Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Wed Jul 29 07:15:16 2015 (r286000) +++ head/sys/netinet/ip_input.c Wed Jul 29 08:12:05 2015 (r286001) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -97,8 +98,8 @@ extern void ipreass_slowtimo(void); extern void ipreass_destroy(void); #endif -struct rwlock in_ifaddr_lock; -RW_SYSINIT(in_ifaddr_lock, &in_ifaddr_lock, "in_ifaddr_lock"); +struct rmlock in_ifaddr_lock; +RM_SYSINIT(in_ifaddr_lock, &in_ifaddr_lock, "in_ifaddr_lock"); VNET_DEFINE(int, rsvp_on); Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Wed Jul 29 07:15:16 2015 (r286000) +++ head/sys/netinet/ip_output.c Wed Jul 29 08:12:05 2015 (r286001) @@ -44,11 +44,13 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include #include +#include #include #include #include @@ -120,6 +122,7 @@ int ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro, int flags, struct ip_moptions *imo, struct inpcb *inp) { + struct rm_priotracker in_ifa_tracker; struct ip *ip; struct ifnet *ifp = NULL; /* keep compiler happy */ struct mbuf *m0; @@ -258,7 +261,7 @@ again: * packets if the interface is specified. */ ifp = imo->imo_multicast_ifp; - IFP_TO_IA(ifp, ia); + IFP_TO_IA(ifp, ia, &in_ifa_tracker); if (ia) have_ia_ref = 1; isbroadcast = 0; /* fool gcc */ Modified: head/sys/netinet/raw_ip.c ============================================================================== --- head/sys/netinet/raw_ip.c Wed Jul 29 07:15:16 2015 (r286000) +++ head/sys/netinet/raw_ip.c Wed Jul 29 08:12:05 2015 (r286001) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -724,6 +725,7 @@ rip_ctloutput(struct socket *so, struct void rip_ctlinput(int cmd, struct sockaddr *sa, void *vip) { + struct rm_priotracker in_ifa_tracker; struct in_ifaddr *ia; struct ifnet *ifp; int err; @@ -731,12 +733,12 @@ rip_ctlinput(int cmd, struct sockaddr *s switch (cmd) { case PRC_IFDOWN: - IN_IFADDR_RLOCK(); + IN_IFADDR_RLOCK(&in_ifa_tracker); TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { if (ia->ia_ifa.ifa_addr == sa && (ia->ia_flags & IFA_ROUTE)) { ifa_ref(&ia->ia_ifa); - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); /* * in_scrubprefix() kills the interface route. */ @@ -753,21 +755,21 @@ rip_ctlinput(int cmd, struct sockaddr *s } } if (ia == NULL) /* If ia matched, already unlocked. */ - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); break; case PRC_IFUP: - IN_IFADDR_RLOCK(); + IN_IFADDR_RLOCK(&in_ifa_tracker); TAILQ_FOREACH(ia, &V_in_ifaddrhead, ia_link) { if (ia->ia_ifa.ifa_addr == sa) break; } if (ia == NULL || (ia->ia_flags & IFA_ROUTE)) { - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); return; } ifa_ref(&ia->ia_ifa); - IN_IFADDR_RUNLOCK(); + IN_IFADDR_RUNLOCK(&in_ifa_tracker); flags = RTF_UP; ifp = ia->ia_ifa.ifa_ifp; Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Wed Jul 29 07:15:16 2015 (r286000) +++ head/sys/netinet6/in6.c Wed Jul 29 08:12:05 2015 (r286001) @@ -80,6 +80,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -1499,9 +1501,10 @@ in6ifa_ifpforlinklocal(struct ifnet *ifp struct in6_ifaddr * in6ifa_ifwithaddr(const struct in6_addr *addr, uint32_t zoneid) { + struct rm_priotracker in6_ifa_tracker; struct in6_ifaddr *ia; - IN6_IFADDR_RLOCK(); + IN6_IFADDR_RLOCK(&in6_ifa_tracker); LIST_FOREACH(ia, IN6ADDR_HASH(addr), ia6_hash) { if (IN6_ARE_ADDR_EQUAL(IA6_IN6(ia), addr)) { if (zoneid != 0 && @@ -1511,7 +1514,7 @@ in6ifa_ifwithaddr(const struct in6_addr break; } } - IN6_IFADDR_RUNLOCK(); + IN6_IFADDR_RUNLOCK(&in6_ifa_tracker); return (ia); } @@ -1649,20 +1652,21 @@ ip6_sprintf(char *ip6buf, const struct i int in6_localaddr(struct in6_addr *in6) { + struct rm_priotracker in6_ifa_tracker; struct in6_ifaddr *ia; if (IN6_IS_ADDR_LOOPBACK(in6) || IN6_IS_ADDR_LINKLOCAL(in6)) return 1; - IN6_IFADDR_RLOCK(); + IN6_IFADDR_RLOCK(&in6_ifa_tracker); TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { if (IN6_ARE_MASKED_ADDR_EQUAL(in6, &ia->ia_addr.sin6_addr, &ia->ia_prefixmask.sin6_addr)) { - IN6_IFADDR_RUNLOCK(); + IN6_IFADDR_RUNLOCK(&in6_ifa_tracker); return 1; } } - IN6_IFADDR_RUNLOCK(); + IN6_IFADDR_RUNLOCK(&in6_ifa_tracker); return (0); } @@ -1674,16 +1678,17 @@ in6_localaddr(struct in6_addr *in6) int in6_localip(struct in6_addr *in6) { + struct rm_priotracker in6_ifa_tracker; struct in6_ifaddr *ia; - IN6_IFADDR_RLOCK(); + IN6_IFADDR_RLOCK(&in6_ifa_tracker); LIST_FOREACH(ia, IN6ADDR_HASH(in6), ia6_hash) { if (IN6_ARE_ADDR_EQUAL(in6, &ia->ia_addr.sin6_addr)) { - IN6_IFADDR_RUNLOCK(); + IN6_IFADDR_RUNLOCK(&in6_ifa_tracker); return (1); } } - IN6_IFADDR_RUNLOCK(); + IN6_IFADDR_RUNLOCK(&in6_ifa_tracker); return (0); } @@ -1720,19 +1725,20 @@ in6_ifhasaddr(struct ifnet *ifp, struct int in6_is_addr_deprecated(struct sockaddr_in6 *sa6) { + struct rm_priotracker in6_ifa_tracker; struct in6_ifaddr *ia; - IN6_IFADDR_RLOCK(); + IN6_IFADDR_RLOCK(&in6_ifa_tracker); LIST_FOREACH(ia, IN6ADDR_HASH(&sa6->sin6_addr), ia6_hash) { if (IN6_ARE_ADDR_EQUAL(IA6_IN6(ia), &sa6->sin6_addr)) { if (ia->ia6_flags & IN6_IFF_DEPRECATED) { - IN6_IFADDR_RUNLOCK(); + IN6_IFADDR_RUNLOCK(&in6_ifa_tracker); return (1); /* true */ } break; } } - IN6_IFADDR_RUNLOCK(); + IN6_IFADDR_RUNLOCK(&in6_ifa_tracker); return (0); /* false */ } Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Wed Jul 29 07:15:16 2015 (r286000) +++ head/sys/netinet6/in6_ifattach.c Wed Jul 29 08:12:05 2015 (r286001) @@ -39,7 +39,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include #include #include Modified: head/sys/netinet6/in6_src.c ============================================================================== --- head/sys/netinet6/in6_src.c Wed Jul 29 07:15:16 2015 (r286000) +++ head/sys/netinet6/in6_src.c Wed Jul 29 08:12:05 2015 (r286001) @@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -178,6 +179,7 @@ in6_selectsrc(struct sockaddr_in6 *dstso struct inpcb *inp, struct route_in6 *ro, struct ucred *cred, struct ifnet **ifpp, struct in6_addr *srcp) { + struct rm_priotracker in6_ifa_tracker; struct in6_addr dst, tmp; struct ifnet *ifp = NULL, *oifp = NULL; struct in6_ifaddr *ia = NULL, *ia_best = NULL; @@ -303,7 +305,7 @@ in6_selectsrc(struct sockaddr_in6 *dstso return (error); rule = 0; - IN6_IFADDR_RLOCK(); + IN6_IFADDR_RLOCK(&in6_ifa_tracker); TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { int new_scope = -1, new_matchlen = -1; struct in6_addrpolicy *new_policy = NULL; @@ -501,7 +503,7 @@ in6_selectsrc(struct sockaddr_in6 *dstso } if ((ia = ia_best) == NULL) { - IN6_IFADDR_RUNLOCK(); + IN6_IFADDR_RUNLOCK(&in6_ifa_tracker); IP6STAT_INC(ip6s_sources_none); return (EADDRNOTAVAIL); } @@ -518,7 +520,7 @@ in6_selectsrc(struct sockaddr_in6 *dstso tmp = ia->ia_addr.sin6_addr; if (cred != NULL && prison_local_ip6(cred, &tmp, (inp != NULL && (inp->inp_flags & IN6P_IPV6_V6ONLY) != 0)) != 0) { - IN6_IFADDR_RUNLOCK(); + IN6_IFADDR_RUNLOCK(&in6_ifa_tracker); IP6STAT_INC(ip6s_sources_none); return (EADDRNOTAVAIL); } @@ -537,7 +539,7 @@ in6_selectsrc(struct sockaddr_in6 *dstso IP6STAT_INC(ip6s_sources_otherscope[best_scope]); if (IFA6_IS_DEPRECATED(ia)) IP6STAT_INC(ip6s_sources_deprecated[best_scope]); - IN6_IFADDR_RUNLOCK(); + IN6_IFADDR_RUNLOCK(&in6_ifa_tracker); return (0); } Modified: head/sys/netinet6/in6_var.h ============================================================================== --- head/sys/netinet6/in6_var.h Wed Jul 29 07:15:16 2015 (r286000) +++ head/sys/netinet6/in6_var.h Wed Jul 29 08:12:05 2015 (r286001) @@ -535,14 +535,14 @@ in6_addrhash(const struct in6_addr *in6) return (fnv_32_buf(&x, sizeof(x), FNV1_32_INIT)); } -extern struct rwlock in6_ifaddr_lock; -#define IN6_IFADDR_LOCK_ASSERT( ) rw_assert(&in6_ifaddr_lock, RA_LOCKED) -#define IN6_IFADDR_RLOCK() rw_rlock(&in6_ifaddr_lock) -#define IN6_IFADDR_RLOCK_ASSERT() rw_assert(&in6_ifaddr_lock, RA_RLOCKED) -#define IN6_IFADDR_RUNLOCK() rw_runlock(&in6_ifaddr_lock) -#define IN6_IFADDR_WLOCK() rw_wlock(&in6_ifaddr_lock) -#define IN6_IFADDR_WLOCK_ASSERT() rw_assert(&in6_ifaddr_lock, RA_WLOCKED) -#define IN6_IFADDR_WUNLOCK() rw_wunlock(&in6_ifaddr_lock) +extern struct rmlock in6_ifaddr_lock; +#define IN6_IFADDR_LOCK_ASSERT() rm_assert(&in6_ifaddr_lock, RA_LOCKED) +#define IN6_IFADDR_RLOCK(t) rm_rlock(&in6_ifaddr_lock, (t)) +#define IN6_IFADDR_RLOCK_ASSERT() rm_assert(&in6_ifaddr_lock, RA_RLOCKED) +#define IN6_IFADDR_RUNLOCK(t) rm_runlock(&in6_ifaddr_lock, (t)) +#define IN6_IFADDR_WLOCK() rm_wlock(&in6_ifaddr_lock) +#define IN6_IFADDR_WLOCK_ASSERT() rm_assert(&in6_ifaddr_lock, RA_WLOCKED) +#define IN6_IFADDR_WUNLOCK() rm_wunlock(&in6_ifaddr_lock) #define in6_ifstat_inc(ifp, tag) \ do { \ Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Wed Jul 29 07:15:16 2015 (r286000) +++ head/sys/netinet6/ip6_input.c Wed Jul 29 08:12:05 2015 (r286001) @@ -82,6 +82,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -144,8 +146,8 @@ VNET_PCPUSTAT_SYSINIT(ip6stat); VNET_PCPUSTAT_SYSUNINIT(ip6stat); #endif /* VIMAGE */ -struct rwlock in6_ifaddr_lock; -RW_SYSINIT(in6_ifaddr_lock, &in6_ifaddr_lock, "in6_ifaddr_lock"); +struct rmlock in6_ifaddr_lock; +RM_SYSINIT(in6_ifaddr_lock, &in6_ifaddr_lock, "in6_ifaddr_lock"); static void ip6_init2(void *); static int ip6_hopopts_input(u_int32_t *, u_int32_t *, struct mbuf **, int *); From owner-svn-src-all@freebsd.org Wed Jul 29 09:57:35 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D52D99AEF9F; Wed, 29 Jul 2015 09:57:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C03E4AD5; Wed, 29 Jul 2015 09:57:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6T9vZtL061727; Wed, 29 Jul 2015 09:57:35 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6T9vZwo061726; Wed, 29 Jul 2015 09:57:35 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201507290957.t6T9vZwo061726@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 29 Jul 2015 09:57:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286002 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 09:57:35 -0000 Author: kib Date: Wed Jul 29 09:57:34 2015 New Revision: 286002 URL: https://svnweb.freebsd.org/changeset/base/286002 Log: Move bufshutdown() out of the #ifdef INVARIANTS block. Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Wed Jul 29 08:12:05 2015 (r286001) +++ head/sys/kern/vfs_bio.c Wed Jul 29 09:57:34 2015 (r286002) @@ -958,6 +958,22 @@ vfs_buf_check_mapped(struct buf *bp) KASSERT(bp->b_data < unmapped_buf || bp->b_data > unmapped_buf + MAXPHYS, ("b_data + b_offset unmapped %p", bp)); } + +static inline void +vfs_buf_check_unmapped(struct buf *bp) +{ + + KASSERT(bp->b_data == unmapped_buf, + ("unmapped buf: corrupted b_data %p", bp)); +} + +#define BUF_CHECK_MAPPED(bp) vfs_buf_check_mapped(bp) +#define BUF_CHECK_UNMAPPED(bp) vfs_buf_check_unmapped(bp) +#else +#define BUF_CHECK_MAPPED(bp) do {} while (0) +#define BUF_CHECK_UNMAPPED(bp) do {} while (0) +#endif + static int isbufbusy(struct buf *bp) { @@ -1087,21 +1103,6 @@ bufshutdown(int show_busybufs) DELAY(100000); /* wait for console output to finish */ } -static inline void -vfs_buf_check_unmapped(struct buf *bp) -{ - - KASSERT(bp->b_data == unmapped_buf, - ("unmapped buf: corrupted b_data %p", bp)); -} - -#define BUF_CHECK_MAPPED(bp) vfs_buf_check_mapped(bp) -#define BUF_CHECK_UNMAPPED(bp) vfs_buf_check_unmapped(bp) -#else -#define BUF_CHECK_MAPPED(bp) do {} while (0) -#define BUF_CHECK_UNMAPPED(bp) do {} while (0) -#endif - static void bpmap_qenter(struct buf *bp) { From owner-svn-src-all@freebsd.org Wed Jul 29 10:18:31 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 020A79AD62E; Wed, 29 Jul 2015 10:18:31 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B682114CB; Wed, 29 Jul 2015 10:18:30 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 3FC801FE022; Wed, 29 Jul 2015 12:18:28 +0200 (CEST) Message-ID: <55B8A8CA.90701@selasky.org> Date: Wed, 29 Jul 2015 12:19:54 +0200 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Warner Losh , =?UTF-8?B?Um9nZXIgUGF1IE1vbm7DqQ==?= CC: Adrian Chadd , Warner Losh , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , Shani Michaeli Subject: Re: svn commit: r285068 - in head/sys: conf modules/agp modules/geom/geom_part/geom_part_apm modules/geom/geom_part/geom_part_bsd modules/geom/geom_part/geom_part_bsd64 modules/geom/geom_part/geom_part... References: <201507030150.t631oRd0039490@repo.freebsd.org> <5596C188.10404@FreeBSD.org> <5596C7E7.5090700@FreeBSD.org> <68C8F69B-56DF-45C3-8DBB-40514CA48D85@bsdimp.com> In-Reply-To: <68C8F69B-56DF-45C3-8DBB-40514CA48D85@bsdimp.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 10:18:31 -0000 On 07/03/15 22:15, Warner Losh wrote: > >> On Jul 3, 2015, at 11:35 AM, Roger Pau MonnĂ© wrote: >> >> El 03/07/15 a les 19.26, Adrian Chadd ha escrit: >>> ok, so why's it make NFS builds so slow? >> >> AFAICT it makes the build process spawn a bunch of concurrent "find" >> processes that weren't previously there. > > OK. I’ll fix it. I knew it might slow things down a little, but this is quite a bit more than “a little”. > > Warner > Hi, Is there a fix for this issue yet? At Mellanox we're also seeing that NFS mounted shares are extremely slow building even a single module. Maybe the output from the find can be cached in a file somehow? --HPS From owner-svn-src-all@freebsd.org Wed Jul 29 10:53:44 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B1019AE05F; Wed, 29 Jul 2015 10:53:44 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E34C88C5; Wed, 29 Jul 2015 10:53:43 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TArht5085621; Wed, 29 Jul 2015 10:53:43 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TArh5u085620; Wed, 29 Jul 2015 10:53:43 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201507291053.t6TArh5u085620@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 29 Jul 2015 10:53:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286003 - head/sys/netpfil/ipfw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 10:53:44 -0000 Author: ae Date: Wed Jul 29 10:53:42 2015 New Revision: 286003 URL: https://svnweb.freebsd.org/changeset/base/286003 Log: Reduce overhead of ipfw's me6 opcode. Skip checks for IPv6 multicast addresses. Use in6_localip() for global unicast. And for IPv6 link-local addresses do search in the IPv6 addresses list. Since LLA are stored in the kernel internal form, use IN6_ARE_MASKED_ADDR_EQUAL() macro with lla_mask for addresses comparison. lla_mask has zero bits in the second word, where we keep sin6_scope_id. Obtained from: Yandex LLC Sponsored by: Yandex LLC Modified: head/sys/netpfil/ipfw/ip_fw2.c Modified: head/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw2.c Wed Jul 29 09:57:34 2015 (r286002) +++ head/sys/netpfil/ipfw/ip_fw2.c Wed Jul 29 10:53:42 2015 (r286003) @@ -503,31 +503,35 @@ flow6id_match( int curr_flow, ipfw_insn_ } /* support for IP6_*_ME opcodes */ +static const struct in6_addr lla_mask = {{{ + 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff +}}}; + static int -search_ip6_addr_net (struct in6_addr * ip6_addr) +ipfw_localip6(struct in6_addr *in6) { - struct ifnet *mdc; - struct ifaddr *mdc2; - struct in6_ifaddr *fdm; - struct in6_addr copia; - - TAILQ_FOREACH(mdc, &V_ifnet, if_link) { - if_addr_rlock(mdc); - TAILQ_FOREACH(mdc2, &mdc->if_addrhead, ifa_link) { - if (mdc2->ifa_addr->sa_family == AF_INET6) { - fdm = (struct in6_ifaddr *)mdc2; - copia = fdm->ia_addr.sin6_addr; - /* need for leaving scope_id in the sock_addr */ - in6_clearscope(&copia); - if (IN6_ARE_ADDR_EQUAL(ip6_addr, &copia)) { - if_addr_runlock(mdc); - return 1; - } - } + struct rm_priotracker in6_ifa_tracker; + struct in6_ifaddr *ia; + + if (IN6_IS_ADDR_MULTICAST(in6)) + return (0); + + if (!IN6_IS_ADDR_LINKLOCAL(in6)) + return (in6_localip(in6)); + + IN6_IFADDR_RLOCK(&in6_ifa_tracker); + TAILQ_FOREACH(ia, &V_in6_ifaddrhead, ia_link) { + if (!IN6_IS_ADDR_LINKLOCAL(&ia->ia_addr.sin6_addr)) + continue; + if (IN6_ARE_MASKED_ADDR_EQUAL(&ia->ia_addr.sin6_addr, + in6, &lla_mask)) { + IN6_IFADDR_RUNLOCK(&in6_ifa_tracker); + return (1); } - if_addr_runlock(mdc); } - return 0; + IN6_IFADDR_RUNLOCK(&in6_ifa_tracker); + return (0); } static int @@ -1597,7 +1601,7 @@ do { \ #ifdef INET6 /* FALLTHROUGH */ case O_IP6_SRC_ME: - match= is_ipv6 && search_ip6_addr_net(&args->f_id.src_ip6); + match= is_ipv6 && ipfw_localip6(&args->f_id.src_ip6); #endif break; @@ -1636,7 +1640,7 @@ do { \ #ifdef INET6 /* FALLTHROUGH */ case O_IP6_DST_ME: - match= is_ipv6 && search_ip6_addr_net(&args->f_id.dst_ip6); + match= is_ipv6 && ipfw_localip6(&args->f_id.dst_ip6); #endif break; From owner-svn-src-all@freebsd.org Wed Jul 29 11:12:57 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6E679AE686; Wed, 29 Jul 2015 11:12:57 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A707914C7; Wed, 29 Jul 2015 11:12:57 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TBCvpi093652; Wed, 29 Jul 2015 11:12:57 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TBCv7A093651; Wed, 29 Jul 2015 11:12:57 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201507291112.t6TBCv7A093651@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 29 Jul 2015 11:12:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286004 - stable/10/sys/netpfil/pf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 11:12:57 -0000 Author: glebius Date: Wed Jul 29 11:12:56 2015 New Revision: 286004 URL: https://svnweb.freebsd.org/changeset/base/286004 Log: Merge r285944: fix typo: delete nsn if we were the last reference. Modified: stable/10/sys/netpfil/pf/pf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netpfil/pf/pf.c ============================================================================== --- stable/10/sys/netpfil/pf/pf.c Wed Jul 29 10:53:42 2015 (r286003) +++ stable/10/sys/netpfil/pf/pf.c Wed Jul 29 11:12:56 2015 (r286004) @@ -3679,7 +3679,7 @@ csfailed: sh = &V_pf_srchash[pf_hashsrc(&nsn->addr, nsn->af)]; PF_HASHROW_LOCK(sh); - if (--nsn->states == 1 && nsn->expire == 0) { + if (--nsn->states == 0 && nsn->expire == 0) { pf_unlink_src_node(nsn); uma_zfree(V_pf_sources_z, nsn); counter_u64_add( From owner-svn-src-all@freebsd.org Wed Jul 29 11:22:21 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3AA0C9AE9B9; Wed, 29 Jul 2015 11:22:21 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E6051DD2; Wed, 29 Jul 2015 11:22:21 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TBMKiv097983; Wed, 29 Jul 2015 11:22:20 GMT (envelope-from zbb@FreeBSD.org) Received: (from zbb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TBMK2X097979; Wed, 29 Jul 2015 11:22:20 GMT (envelope-from zbb@FreeBSD.org) Message-Id: <201507291122.t6TBMK2X097979@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zbb set sender to zbb@FreeBSD.org using -f From: Zbigniew Bodek Date: Wed, 29 Jul 2015 11:22:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286005 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 11:22:21 -0000 Author: zbb Date: Wed Jul 29 11:22:19 2015 New Revision: 286005 URL: https://svnweb.freebsd.org/changeset/base/286005 Log: Add quirk for ThunderX ITS device table size Limit the number of supported device IDs to 0x100000 in order to decrease the size of the ITS device table so that it matches with the HW capabilities. Obtained from: Semihalf Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3131 Modified: head/sys/arm64/arm64/gic_v3_its.c head/sys/arm64/arm64/gic_v3_var.h Modified: head/sys/arm64/arm64/gic_v3_its.c ============================================================================== --- head/sys/arm64/arm64/gic_v3_its.c Wed Jul 29 11:12:56 2015 (r286004) +++ head/sys/arm64/arm64/gic_v3_its.c Wed Jul 29 11:22:19 2015 (r286005) @@ -101,6 +101,8 @@ static void its_cmd_mapi(struct gic_v3_i static void its_cmd_inv(struct gic_v3_its_softc *, struct its_dev *, uint32_t); static void its_cmd_invall(struct gic_v3_its_softc *, struct its_col *); +static uint32_t its_get_devbits(device_t); + static void lpi_init_conftable(struct gic_v3_its_softc *); static void lpi_bitmap_init(struct gic_v3_its_softc *); static void lpi_init_cpu(struct gic_v3_its_softc *); @@ -142,13 +144,19 @@ const char *its_ptab_type[] = { */ /* Cavium ThunderX PCI devid acquire function */ +static uint32_t its_get_devbits_thunder(device_t); static uint32_t its_get_devid_thunder(device_t); static const struct its_quirks its_quirks[] = { { + /* + * Hardware: Cavium ThunderX + * Chip revision: Pass 1.0, Pass 1.1 + */ .cpuid = CPU_ID_RAW(CPU_IMPL_CAVIUM, CPU_PART_THUNDER, 0, 0), .cpuid_mask = CPU_IMPL_MASK | CPU_PART_MASK, .devid_func = its_get_devid_thunder, + .devbits_func = its_get_devbits_thunder, }, }; @@ -299,7 +307,6 @@ its_alloc_tables(struct gic_v3_its_softc { uint64_t gits_baser, gits_tmp; uint64_t type, esize, cache, share, psz; - uint64_t gits_typer; size_t page_size, npages, nitspages, nidents, tn; size_t its_tbl_size; vm_offset_t ptab_vaddr; @@ -308,9 +315,6 @@ its_alloc_tables(struct gic_v3_its_softc page_size = PAGE_SIZE_64K; - /* Read features first */ - gits_typer = gic_its_read(sc, 8, GITS_TYPER); - for (tn = 0; tn < GITS_BASER_NUM; tn++) { gits_baser = gic_its_read(sc, 8, GITS_BASER(tn)); type = GITS_BASER_TYPE(gits_baser); @@ -324,7 +328,7 @@ its_alloc_tables(struct gic_v3_its_softc case GITS_BASER_TYPE_RES7: continue; case GITS_BASER_TYPE_DEV: - nidents = (1 << GITS_TYPER_DEVB(gits_typer)); + nidents = (1 << its_get_devbits(sc->dev)); its_tbl_size = esize * nidents; its_tbl_size = roundup2(its_tbl_size, page_size); npages = howmany(its_tbl_size, PAGE_SIZE); @@ -1447,6 +1451,68 @@ its_get_devid_thunder(device_t pci_dev) return (0); } +static uint32_t +its_get_devbits_thunder(device_t dev) +{ + uint32_t devid_bits; + + /* + * GITS_TYPER[17:13] of ThunderX reports that device IDs + * are to be 21 bits in length. + * The entry size of the ITS table can be read from GITS_BASERn[52:48] + * and on ThunderX is supposed to be 8 bytes in length (for device + * table). Finally the page size that is to be used by ITS to access + * this table will be set to 64KB. + * + * This gives 0x200000 entries of size 0x8 bytes covered by 256 pages + * each of which 64KB in size. The number of pages (minus 1) should + * then be written to GITS_BASERn[7:0]. In that case this value would + * be 0xFF but on ThunderX the maximum value that HW accepts is 0xFD. + * + * Set arbitrary number of device ID bits to 20 in order to limit + * the number of entries in ITS device table to 0x100000 and hence + * the table size to 8MB. + */ + devid_bits = 20; + if (bootverbose) { + device_printf(dev, + "Limiting number of Device ID bits implemented to %d\n", + devid_bits); + } + + return (devid_bits); +} + +static __inline uint32_t +its_get_devbits_default(device_t dev) +{ + uint64_t gits_typer; + struct gic_v3_its_softc *sc; + + sc = device_get_softc(dev); + + gits_typer = gic_its_read(sc, 8, GITS_TYPER); + + return (GITS_TYPER_DEVB(gits_typer)); +} + +static uint32_t +its_get_devbits(device_t dev) +{ + const struct its_quirks *quirk; + size_t i; + + for (i = 0; i < nitems(its_quirks); i++) { + quirk = &its_quirks[i]; + if (CPU_MATCH_RAW(quirk->cpuid_mask, quirk->cpuid)) { + if (quirk->devbits_func != NULL) + return ((*quirk->devbits_func)(dev)); + } + } + + return (its_get_devbits_default(dev)); +} + static __inline uint32_t its_get_devid_default(device_t pci_dev) { Modified: head/sys/arm64/arm64/gic_v3_var.h ============================================================================== --- head/sys/arm64/arm64/gic_v3_var.h Wed Jul 29 11:12:56 2015 (r286004) +++ head/sys/arm64/arm64/gic_v3_var.h Wed Jul 29 11:22:19 2015 (r286005) @@ -235,12 +235,14 @@ struct gic_v3_its_softc { }; /* Stuff that is specific to the vendor's implementation */ +typedef uint32_t (*its_devbits_func_t)(device_t); typedef uint32_t (*its_devid_func_t)(device_t); struct its_quirks { uint64_t cpuid; uint64_t cpuid_mask; its_devid_func_t devid_func; + its_devbits_func_t devbits_func; }; extern devclass_t gic_v3_its_devclass; From owner-svn-src-all@freebsd.org Wed Jul 29 12:42:46 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51A709AD375; Wed, 29 Jul 2015 12:42:46 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 424AE108E; Wed, 29 Jul 2015 12:42:46 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TCgkAe030635; Wed, 29 Jul 2015 12:42:46 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TCgkNR030634; Wed, 29 Jul 2015 12:42:46 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201507291242.t6TCgkNR030634@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Wed, 29 Jul 2015 12:42:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286006 - head/sys/compat/cloudabi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 12:42:46 -0000 Author: ed Date: Wed Jul 29 12:42:45 2015 New Revision: 286006 URL: https://svnweb.freebsd.org/changeset/base/286006 Log: Split up Capsicum to CloudABI rights conversion into two separate routines. CloudABI's openat() ensures that files are opened with the smallest set of relevant rights. For example, when opening a FIFO, unrelated rights like CAP_RECV are automatically removed. To remove unrelated rights, we can just reuse the code for this that was already present in the rights conversion function. Modified: head/sys/compat/cloudabi/cloudabi_fd.c Modified: head/sys/compat/cloudabi/cloudabi_fd.c ============================================================================== --- head/sys/compat/cloudabi/cloudabi_fd.c Wed Jul 29 11:22:19 2015 (r286005) +++ head/sys/compat/cloudabi/cloudabi_fd.c Wed Jul 29 12:42:45 2015 (r286006) @@ -266,24 +266,11 @@ cloudabi_convert_filetype(const struct f } } -/* - * Converts FreeBSD's Capsicum rights to CloudABI's set of rights. - */ +/* Removes rights that conflict with the file descriptor type. */ static void -convert_capabilities(const cap_rights_t *capabilities, - cloudabi_filetype_t filetype, cloudabi_rights_t *base, - cloudabi_rights_t *inheriting) +cloudabi_remove_conflicting_rights(cloudabi_filetype_t filetype, + cloudabi_rights_t *base, cloudabi_rights_t *inheriting) { - cloudabi_rights_t rights; - - /* Convert FreeBSD bits to CloudABI bits. */ - rights = 0; -#define MAPPING(cloudabi, ...) do { \ - if (cap_rights_is_set(capabilities, ##__VA_ARGS__)) \ - rights |= (cloudabi); \ -} while (0); - RIGHTS_MAPPINGS -#undef MAPPING /* * CloudABI has a small number of additional rights bits to @@ -303,7 +290,7 @@ convert_capabilities(const cap_rights_t */ switch (filetype) { case CLOUDABI_FILETYPE_DIRECTORY: - *base = rights & (CLOUDABI_RIGHT_FD_STAT_PUT_FLAGS | + *base &= CLOUDABI_RIGHT_FD_STAT_PUT_FLAGS | CLOUDABI_RIGHT_FD_SYNC | CLOUDABI_RIGHT_FILE_ADVISE | CLOUDABI_RIGHT_FILE_CREATE_DIRECTORY | CLOUDABI_RIGHT_FILE_CREATE_FILE | @@ -323,29 +310,77 @@ convert_capabilities(const cap_rights_t CLOUDABI_RIGHT_FILE_UNLINK | CLOUDABI_RIGHT_POLL_FD_READWRITE | CLOUDABI_RIGHT_SOCK_BIND_DIRECTORY | - CLOUDABI_RIGHT_SOCK_CONNECT_DIRECTORY); - *inheriting = rights; + CLOUDABI_RIGHT_SOCK_CONNECT_DIRECTORY; + *inheriting &= CLOUDABI_RIGHT_FD_DATASYNC | + CLOUDABI_RIGHT_FD_READ | + CLOUDABI_RIGHT_FD_SEEK | + CLOUDABI_RIGHT_FD_STAT_PUT_FLAGS | + CLOUDABI_RIGHT_FD_SYNC | + CLOUDABI_RIGHT_FD_TELL | + CLOUDABI_RIGHT_FD_WRITE | + CLOUDABI_RIGHT_FILE_ADVISE | + CLOUDABI_RIGHT_FILE_ALLOCATE | + CLOUDABI_RIGHT_FILE_CREATE_DIRECTORY | + CLOUDABI_RIGHT_FILE_CREATE_FILE | + CLOUDABI_RIGHT_FILE_CREATE_FIFO | + CLOUDABI_RIGHT_FILE_LINK_SOURCE | + CLOUDABI_RIGHT_FILE_LINK_TARGET | + CLOUDABI_RIGHT_FILE_OPEN | + CLOUDABI_RIGHT_FILE_READDIR | + CLOUDABI_RIGHT_FILE_READLINK | + CLOUDABI_RIGHT_FILE_RENAME_SOURCE | + CLOUDABI_RIGHT_FILE_RENAME_TARGET | + CLOUDABI_RIGHT_FILE_STAT_FGET | + CLOUDABI_RIGHT_FILE_STAT_FPUT_SIZE | + CLOUDABI_RIGHT_FILE_STAT_FPUT_TIMES | + CLOUDABI_RIGHT_FILE_STAT_GET | + CLOUDABI_RIGHT_FILE_STAT_PUT_TIMES | + CLOUDABI_RIGHT_FILE_SYMLINK | + CLOUDABI_RIGHT_FILE_UNLINK | + CLOUDABI_RIGHT_MEM_MAP | + CLOUDABI_RIGHT_MEM_MAP_EXEC | + CLOUDABI_RIGHT_POLL_FD_READWRITE | + CLOUDABI_RIGHT_PROC_EXEC | + CLOUDABI_RIGHT_SOCK_BIND_DIRECTORY | + CLOUDABI_RIGHT_SOCK_CONNECT_DIRECTORY; break; case CLOUDABI_FILETYPE_FIFO: - *base = rights & ~(CLOUDABI_RIGHT_FILE_ADVISE | - CLOUDABI_RIGHT_FILE_ALLOCATE | - CLOUDABI_RIGHT_FILE_READDIR); + *base &= CLOUDABI_RIGHT_FD_READ | + CLOUDABI_RIGHT_FD_STAT_PUT_FLAGS | + CLOUDABI_RIGHT_FD_WRITE | + CLOUDABI_RIGHT_FILE_STAT_FGET | + CLOUDABI_RIGHT_POLL_FD_READWRITE; *inheriting = 0; break; case CLOUDABI_FILETYPE_POLL: - *base = rights & ~CLOUDABI_RIGHT_FILE_ADVISE; + *base &= ~CLOUDABI_RIGHT_FILE_ADVISE; *inheriting = 0; break; case CLOUDABI_FILETYPE_PROCESS: - *base = rights & ~CLOUDABI_RIGHT_FILE_ADVISE; + *base &= ~CLOUDABI_RIGHT_FILE_ADVISE; *inheriting = 0; break; case CLOUDABI_FILETYPE_REGULAR_FILE: - *base = rights & ~CLOUDABI_RIGHT_FILE_READDIR; + *base &= CLOUDABI_RIGHT_FD_DATASYNC | + CLOUDABI_RIGHT_FD_READ | + CLOUDABI_RIGHT_FD_SEEK | + CLOUDABI_RIGHT_FD_STAT_PUT_FLAGS | + CLOUDABI_RIGHT_FD_SYNC | + CLOUDABI_RIGHT_FD_TELL | + CLOUDABI_RIGHT_FD_WRITE | + CLOUDABI_RIGHT_FILE_ADVISE | + CLOUDABI_RIGHT_FILE_ALLOCATE | + CLOUDABI_RIGHT_FILE_STAT_FGET | + CLOUDABI_RIGHT_FILE_STAT_FPUT_SIZE | + CLOUDABI_RIGHT_FILE_STAT_FPUT_TIMES | + CLOUDABI_RIGHT_MEM_MAP | + CLOUDABI_RIGHT_MEM_MAP_EXEC | + CLOUDABI_RIGHT_POLL_FD_READWRITE | + CLOUDABI_RIGHT_PROC_EXEC; *inheriting = 0; break; case CLOUDABI_FILETYPE_SHARED_MEMORY: - *base = rights & ~(CLOUDABI_RIGHT_FD_SEEK | + *base &= ~(CLOUDABI_RIGHT_FD_SEEK | CLOUDABI_RIGHT_FD_TELL | CLOUDABI_RIGHT_FILE_ADVISE | CLOUDABI_RIGHT_FILE_ALLOCATE | @@ -355,7 +390,7 @@ convert_capabilities(const cap_rights_t case CLOUDABI_FILETYPE_SOCKET_DGRAM: case CLOUDABI_FILETYPE_SOCKET_SEQPACKET: case CLOUDABI_FILETYPE_SOCKET_STREAM: - *base = rights & (CLOUDABI_RIGHT_FD_READ | + *base &= CLOUDABI_RIGHT_FD_READ | CLOUDABI_RIGHT_FD_STAT_PUT_FLAGS | CLOUDABI_RIGHT_FD_WRITE | CLOUDABI_RIGHT_FILE_STAT_FGET | @@ -365,16 +400,36 @@ convert_capabilities(const cap_rights_t CLOUDABI_RIGHT_SOCK_CONNECT_SOCKET | CLOUDABI_RIGHT_SOCK_LISTEN | CLOUDABI_RIGHT_SOCK_SHUTDOWN | - CLOUDABI_RIGHT_SOCK_STAT_GET); - *inheriting = rights; + CLOUDABI_RIGHT_SOCK_STAT_GET; break; default: - *base = rights; *inheriting = 0; break; } } +/* Converts FreeBSD's Capsicum rights to CloudABI's set of rights. */ +static void +convert_capabilities(const cap_rights_t *capabilities, + cloudabi_filetype_t filetype, cloudabi_rights_t *base, + cloudabi_rights_t *inheriting) +{ + cloudabi_rights_t rights; + + /* Convert FreeBSD bits to CloudABI bits. */ + rights = 0; +#define MAPPING(cloudabi, ...) do { \ + if (cap_rights_is_set(capabilities, ##__VA_ARGS__)) \ + rights |= (cloudabi); \ +} while (0); + RIGHTS_MAPPINGS +#undef MAPPING + + *base = rights; + *inheriting = rights; + cloudabi_remove_conflicting_rights(filetype, base, inheriting); +} + int cloudabi_sys_fd_stat_get(struct thread *td, struct cloudabi_sys_fd_stat_get_args *uap) From owner-svn-src-all@freebsd.org Wed Jul 29 12:53:22 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 288C59AD688; Wed, 29 Jul 2015 12:53:22 +0000 (UTC) (envelope-from ermal.luci@gmail.com) Received: from mail-yk0-x22c.google.com (mail-yk0-x22c.google.com [IPv6:2607:f8b0:4002:c07::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DCD6C18B1; Wed, 29 Jul 2015 12:53:21 +0000 (UTC) (envelope-from ermal.luci@gmail.com) Received: by ykba194 with SMTP id a194so6527213ykb.0; Wed, 29 Jul 2015 05:53:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=JaOsZ2VR88m8NyRBZqLy8UF+Jxjzu6TXnCLQuO9AQZ8=; b=PUskAo4B7S37DqRNGEhmeKdlh0FQjgRTkxnYZbu72XqNgcLbj5qR82ai/R7V1txpeA QWA7jiY9mubktGeIzD4yJal751VmdKyElX5PplLqcaK8FC7ejmQVXYRohdtRszpRNRSz awMiALcfOAGNmAWLLDaSwCjb1eJJpCqgFeGWAzecclhKPyIuNzpc6KvfldugobKBcXrr SgmLTKDYC9Y+Tp4os5TPQu/T3/dYiaLNSdBH9NN16AkSFvnBQfSDtLMGOZVZugi6arJ2 kcGl1/iVtH1HBe2s1xEuPptPblhBcSlhIaDXq5WGa1F373byePTrDNi2JNpy3IS8CBgv HCyg== MIME-Version: 1.0 X-Received: by 10.170.198.144 with SMTP id p138mr43361632yke.70.1438174400734; Wed, 29 Jul 2015 05:53:20 -0700 (PDT) Sender: ermal.luci@gmail.com Received: by 10.129.83.139 with HTTP; Wed, 29 Jul 2015 05:53:20 -0700 (PDT) In-Reply-To: <201507290715.t6T7FHGb094456@repo.freebsd.org> References: <201507290715.t6T7FHGb094456@repo.freebsd.org> Date: Wed, 29 Jul 2015 14:53:20 +0200 X-Google-Sender-Auth: YTg-pUgGUq5agmzlItWf-43Lhpk Message-ID: Subject: Re: svn commit: r286000 - head/sys/netipsec From: =?UTF-8?Q?Ermal_Lu=C3=A7i?= To: John-Mark Gurney , George Neville-Neil Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 12:53:22 -0000 Hello John-Mark, this was forgotten part on my patches merge from gnn@. Can it be fixed by correcting the patches rather than re-introducing this? Most probably the constant definition is wrong on the transforms and also some part of code removal was missed. On Wed, Jul 29, 2015 at 9:15 AM, John-Mark Gurney wrote: > Author: jmg > Date: Wed Jul 29 07:15:16 2015 > New Revision: 286000 > URL: https://svnweb.freebsd.org/changeset/base/286000 > > Log: > RFC4868 section 2.3 requires that the output be half... This fixes > problems that was introduced in r285336... I have verified that > HMAC-SHA2-256 both ah only and w/ AES-CBC interoperate w/ a NetBSD > 6.1.5 vm... > > Reviewed by: gnn > > Modified: > head/sys/netipsec/xform.h > head/sys/netipsec/xform_ah.c > head/sys/netipsec/xform_esp.c > > Modified: head/sys/netipsec/xform.h > > ============================================================================== > --- head/sys/netipsec/xform.h Wed Jul 29 06:35:36 2015 (r285999) > +++ head/sys/netipsec/xform.h Wed Jul 29 07:15:16 2015 (r286000) > @@ -105,6 +105,7 @@ struct xformsw { > #ifdef _KERNEL > extern void xform_register(struct xformsw*); > extern int xform_init(struct secasvar *sav, int xftype); > +extern int xform_ah_authsize(struct auth_hash *esph); > > struct cryptoini; > > > Modified: head/sys/netipsec/xform_ah.c > > ============================================================================== > --- head/sys/netipsec/xform_ah.c Wed Jul 29 06:35:36 2015 > (r285999) > +++ head/sys/netipsec/xform_ah.c Wed Jul 29 07:15:16 2015 > (r286000) > @@ -85,8 +85,8 @@ > * Return authenticator size in bytes, based on a field in the > * algorithm descriptor. > */ > -#define AUTHSIZE(sav) \ > - ((sav->flags & SADB_X_EXT_OLD) ? 16 : > (sav)->tdb_authalgxform->hashsize) > +#define AUTHSIZE(sav) ((sav->flags & SADB_X_EXT_OLD) ? 16 : \ > + xform_ah_authsize((sav)->tdb_authalgxform)) > > VNET_DEFINE(int, ah_enable) = 1; /* control flow of packets with AH > */ > VNET_DEFINE(int, ah_cleartos) = 1; /* clear ip_tos when doing AH calc > */ > @@ -112,6 +112,35 @@ static unsigned char ipseczeroes[256]; / > static int ah_input_cb(struct cryptop*); > static int ah_output_cb(struct cryptop*); > > +int > +xform_ah_authsize(struct auth_hash *esph) > +{ > + int alen; > + > + if (esph == NULL) > + return 0; > + > + switch (esph->type) { > + case CRYPTO_SHA2_256_HMAC: > + case CRYPTO_SHA2_384_HMAC: > + case CRYPTO_SHA2_512_HMAC: > + alen = esph->hashsize / 2; /* RFC4868 2.3 */ > + break; > + > + case CRYPTO_AES_128_NIST_GMAC: > + case CRYPTO_AES_192_NIST_GMAC: > + case CRYPTO_AES_256_NIST_GMAC: > + alen = esph->hashsize; > + break; > + > + default: > + alen = AH_HMAC_HASHLEN; > + break; > + } > + > + return alen; > +} > + > /* > * NB: this is public for use by the PF_KEY support. > */ > > Modified: head/sys/netipsec/xform_esp.c > > ============================================================================== > --- head/sys/netipsec/xform_esp.c Wed Jul 29 06:35:36 2015 > (r285999) > +++ head/sys/netipsec/xform_esp.c Wed Jul 29 07:15:16 2015 > (r286000) > @@ -320,7 +320,6 @@ esp_input(struct mbuf *m, struct secasva > IPSEC_ASSERT(sav != NULL, ("null SA")); > IPSEC_ASSERT(sav->tdb_encalgxform != NULL, ("null encoding > xform")); > > - alen = 0; > /* Valid IP Packet length ? */ > if ( (skip&3) || (m->m_pkthdr.len&3) ){ > DPRINTF(("%s: misaligned packet, skip %u pkt len %u", > @@ -335,13 +334,13 @@ esp_input(struct mbuf *m, struct secasva > esph = sav->tdb_authalgxform; > espx = sav->tdb_encalgxform; > > - /* Determine the ESP header length */ > + /* Determine the ESP header and auth length */ > if (sav->flags & SADB_X_EXT_OLD) > hlen = sizeof (struct esp) + sav->ivlen; > else > hlen = sizeof (struct newesp) + sav->ivlen; > - /* Authenticator hash size */ > - alen = esph ? esph->hashsize : 0; > + > + alen = xform_ah_authsize(esph); > > /* > * Verify payload length is multiple of encryption algorithm > @@ -530,7 +529,7 @@ esp_input_cb(struct cryptop *crp) > > /* If authentication was performed, check now. */ > if (esph != NULL) { > - alen = esph->hashsize; > + alen = xform_ah_authsize(esph); > AHSTAT_INC(ahs_hist[sav->alg_auth]); > /* Copy the authenticator from the packet */ > m_copydata(m, m->m_pkthdr.len - alen, alen, aalg); > @@ -700,10 +699,7 @@ esp_output(struct mbuf *m, struct ipsecr > /* XXX clamp padding length a la KAME??? */ > padding = ((blks - ((rlen + 2) % blks)) % blks) + 2; > > - if (esph) > - alen = esph->hashsize; > - else > - alen = 0; > + alen = xform_ah_authsize(esph); > > ESPSTAT_INC(esps_output); > > @@ -983,21 +979,7 @@ esp_output_cb(struct cryptop *crp) > if (esph != NULL) { > int alen; > > - switch (esph->type) { > - case CRYPTO_SHA2_256_HMAC: > - case CRYPTO_SHA2_384_HMAC: > - case CRYPTO_SHA2_512_HMAC: > - alen = esph->hashsize/2; > - break; > - case CRYPTO_AES_128_NIST_GMAC: > - case CRYPTO_AES_192_NIST_GMAC: > - case CRYPTO_AES_256_NIST_GMAC: > - alen = esph->hashsize; > - break; > - default: > - alen = AH_HMAC_HASHLEN; > - break; > - } > + alen = xform_ah_authsize(esph); > m_copyback(m, m->m_pkthdr.len - alen, > alen, ipseczeroes); > } > > -- > Ermal > From owner-svn-src-all@freebsd.org Wed Jul 29 12:59:18 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2EBF69AD852; Wed, 29 Jul 2015 12:59:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 102721C2C; Wed, 29 Jul 2015 12:59:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TCxH7h035148; Wed, 29 Jul 2015 12:59:17 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TCxHX4035145; Wed, 29 Jul 2015 12:59:17 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507291259.t6TCxHX4035145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 29 Jul 2015 12:59:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286007 - in stable/10/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 12:59:18 -0000 Author: dim Date: Wed Jul 29 12:59:16 2015 New Revision: 286007 URL: https://svnweb.freebsd.org/changeset/base/286007 Log: Pull in r219009 from upstream llvm trunk (by Adam Nemet): [ISel] Keep matching state consistent when folding during X86 address match In the X86 backend, matching an address is initiated by the 'addr' complex pattern and its friends. During this process we may reassociate and-of-shift into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the shift into the scale of the address. However as demonstrated by the testcase, this can trigger CSE of not only the shift and the AND which the code is prepared for but also the underlying load node. In the testcase this node is sitting in the RecordedNode and MatchScope data structures of the matcher and becomes a deleted node upon CSE. Returning from the complex pattern function, we try to access it again hitting an assert because the node is no longer a load even though this was checked before. Now obviously changing the DAG this late is bending the rules but I think it makes sense somewhat. Outside of addresses we prefer and-of-shift because it may lead to smaller immediates (FoldMaskAndShiftToScale is an even better example because it create a non-canonical node). We currently don't recognize addresses during DAGCombiner where arguably this canonicalization should be performed. On the other hand, having this in the matcher allows us to cover all the cases where an address can be used in an instruction. I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW for the new shift node in FoldMaskedShiftToScaledMask. This RAUW is responsible for initiating the recursive CSE on users (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but it is not strictly necessary since the shift is hooked into the visited user. Of course it's safer to keep the DAG consistent at all times (e.g. for accurate number of uses, etc.). So rather than changing the fundamentals, I've decided to continue along the previous patches and detect the CSE. This patch installs a very targeted DAGUpdateListener for the duration of a complex-pattern match and updates the matching state accordingly. (Previous patches used HandleSDNode to detect the CSE but that's not practical here). The listener is only installed on X86. I tested that there is no measurable overhead due to this while running through the spec2k BC files with llc. The only thing we pay for is the creation of the listener. The callback never ever triggers in spec2k since this is a corner case. Fixes rdar://problem/18206171 This fixes a possible crash in x86 code generation when compiling recent llvm/clang trunk sources. Direct commit to stable/10, since head already has llvm/clang 3.6.1, which includes this fix. Reported by: jonathan, theraven Upstream PR: https://llvm.org/bugs/show_bug.cgi?id=24249 Modified: stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Modified: stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h ============================================================================== --- stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 12:42:45 2015 (r286006) +++ stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 12:59:16 2015 (r286007) @@ -238,6 +238,12 @@ public: const unsigned char *MatcherTable, unsigned TableSize); + /// \brief Return true if complex patterns for this target can mutate the + /// DAG. + virtual bool ComplexPatternFuncMutatesDAG() const { + return false; + } + private: // Calls to these functions are generated by tblgen. Modified: stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ============================================================================== --- stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 12:42:45 2015 (r286006) +++ stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 12:59:16 2015 (r286007) @@ -2345,6 +2345,42 @@ struct MatchScope { bool HasChainNodesMatched, HasGlueResultNodesMatched; }; +/// \\brief A DAG update listener to keep the matching state +/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to +/// change the DAG while matching. X86 addressing mode matcher is an example +/// for this. +class MatchStateUpdater : public SelectionDAG::DAGUpdateListener +{ + SmallVectorImpl > &RecordedNodes; + SmallVectorImpl &MatchScopes; +public: + MatchStateUpdater(SelectionDAG &DAG, + SmallVectorImpl > &RN, + SmallVectorImpl &MS) : + SelectionDAG::DAGUpdateListener(DAG), + RecordedNodes(RN), MatchScopes(MS) { } + + void NodeDeleted(SDNode *N, SDNode *E) { + // Some early-returns here to avoid the search if we deleted the node or + // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we + // do, so it's unnecessary to update matching state at that point). + // Neither of these can occur currently because we only install this + // update listener during matching a complex patterns. + if (!E || E->isMachineOpcode()) + return; + // Performing linear search here does not matter because we almost never + // run this code. You'd have to have a CSE during complex pattern + // matching. + for (auto &I : RecordedNodes) + if (I.first.getNode() == N) + I.first.setNode(E); + + for (auto &I : MatchScopes) + for (auto &J : I.NodeStack) + if (J.getNode() == N) + J.setNode(E); + } +}; } SDNode *SelectionDAGISel:: @@ -2599,6 +2635,14 @@ SelectCodeCommon(SDNode *NodeToMatch, co unsigned CPNum = MatcherTable[MatcherIndex++]; unsigned RecNo = MatcherTable[MatcherIndex++]; assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); + + // If target can modify DAG during matching, keep the matching state + // consistent. + std::unique_ptr MSU; + if (ComplexPatternFuncMutatesDAG()) + MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, + MatchScopes)); + if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, RecordedNodes[RecNo].first, CPNum, RecordedNodes)) Modified: stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp ============================================================================== --- stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 12:42:45 2015 (r286006) +++ stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 12:59:16 2015 (r286007) @@ -290,6 +290,13 @@ namespace { const X86InstrInfo *getInstrInfo() const { return getTargetMachine().getInstrInfo(); } + + /// \brief Address-mode matching performs shift-of-and to and-of-shift + /// reassociation in order to expose more scaled addressing + /// opportunities. + bool ComplexPatternFuncMutatesDAG() const override { + return true; + } }; } From owner-svn-src-all@freebsd.org Wed Jul 29 13:01:01 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6C30D9ADA11; Wed, 29 Jul 2015 13:01:01 +0000 (UTC) (envelope-from ermal.luci@gmail.com) Received: from mail-yk0-x22c.google.com (mail-yk0-x22c.google.com [IPv6:2607:f8b0:4002:c07::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1BC901EAA; Wed, 29 Jul 2015 13:01:01 +0000 (UTC) (envelope-from ermal.luci@gmail.com) Received: by ykay190 with SMTP id y190so6617400yka.3; Wed, 29 Jul 2015 06:01:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=/pZeb3pk0CSivxTfmUXcFfqj9owekwJZvA0JBIT9P90=; b=K2AbHQl4qClFKcAAgJZh3/5X62cThNEkiLq4V8nlWiBIK7LZtLbPaytB1HaM7cyD6M KuePJT3/TKBgwDerA8KVdx4rdBtzZtNRjiS9+HDgb29tdjjIIJzqV8/tEJSa29D/5LIP Ci70DOD6eY1eEOOALz2SppqWRaKLLfgy4uKKj3dYlIch75g9TtMDjQJoBHwi6Zoa9Vvi 0lysf8JWgI2Dtc3BPEKQ1D/27cJPcvy1NybZEJFxfEeDamnmDg/1Lv2WKcCPdhh/6bPA d4QnpvRvil5mxCoD1ZwFfws8prVCQd6vtpnU3XR7Xe4fvsBhFdX0UkMeDscs8A/BpXYq FIfg== MIME-Version: 1.0 X-Received: by 10.129.82.129 with SMTP id g123mr44926177ywb.9.1438174859999; Wed, 29 Jul 2015 06:00:59 -0700 (PDT) Sender: ermal.luci@gmail.com Received: by 10.129.83.139 with HTTP; Wed, 29 Jul 2015 06:00:59 -0700 (PDT) In-Reply-To: <20150728124220.GW72729@FreeBSD.org> References: <201507021810.t62IAgCc003272@repo.freebsd.org> <20150728124220.GW72729@FreeBSD.org> Date: Wed, 29 Jul 2015 15:00:59 +0200 X-Google-Sender-Auth: 2Jcz1FIyvlixB826pH2vbxn1CVQ Message-ID: Subject: Re: svn commit: r285051 - head/sys/netinet From: =?UTF-8?Q?Ermal_Lu=C3=A7i?= To: Gleb Smirnoff Cc: =?UTF-8?Q?Olivier_Cochard=2DLabb=C3=A9?= , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 13:01:01 -0000 On Tue, Jul 28, 2015 at 2:42 PM, Gleb Smirnoff wrote: > Ermal, > > see comments inlined, > > On Thu, Jul 02, 2015 at 06:10:42PM +0000, Ermal Lu=C3=A7i wrote: > E> Author: eri > E> Date: Thu Jul 2 18:10:41 2015 > E> New Revision: 285051 > E> URL: https://svnweb.freebsd.org/changeset/base/285051 > E> > E> Log: > E> Avoid doing multiple route lookups for the same destination IP durin= g > forwarding > E> > E> ip_forward() does a route lookup for testing this packet can be sent > to a known destination, > E> it also can do another route lookup if it detects that an ICMP > redirect is needed, > E> it forgets all of this and handovers to ip_output() to do the same > lookup yet again. > E> > E> This optimisation just does one route lookup during the forwarding > path and handovers that to be considered by ip_output(). > E> > E> Differential Revision: https://reviews.freebsd.org/D2964 > E> Approved by: ae, gnn(mentor) > E> MFC after: 1 week > E> > E> Modified: > E> head/sys/netinet/ip_input.c > E> > E> Modified: head/sys/netinet/ip_input.c > E> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > E> --- head/sys/netinet/ip_input.c Thu Jul 2 17:30:59 2015 > (r285050) > E> +++ head/sys/netinet/ip_input.c Thu Jul 2 18:10:41 2015 > (r285051) > E> @@ -897,6 +897,7 @@ ip_forward(struct mbuf *m, int srcrt) > E> struct ip *ip =3D mtod(m, struct ip *); > E> struct in_ifaddr *ia; > E> struct mbuf *mcopy; > E> + struct sockaddr_in *sin; > E> struct in_addr dest; > E> struct route ro; > E> int error, type =3D 0, code =3D 0, mtu =3D 0; > E> @@ -925,7 +926,22 @@ ip_forward(struct mbuf *m, int srcrt) > E> } > E> #endif > E> > E> - ia =3D ip_rtaddr(ip->ip_dst, M_GETFIB(m)); > E> + bzero(&ro, sizeof(ro)); > E> + sin =3D (struct sockaddr_in *)&ro.ro_dst; > E> + sin->sin_family =3D AF_INET; > E> + sin->sin_len =3D sizeof(*sin); > E> + sin->sin_addr =3D ip->ip_dst; > E> +#ifdef RADIX_MPATH > E> + rtalloc_mpath_fib(&ro, > E> + ntohl(ip->ip_src.s_addr ^ ip->ip_dst.s_addr), > E> + M_GETFIB(m)); > E> +#else > E> + in_rtalloc_ign(&ro, 0, M_GETFIB(m)); > E> +#endif > E> + if (ro.ro_rt !=3D NULL) { > E> + ia =3D ifatoia(ro.ro_rt->rt_ifa); > E> + ifa_ref(&ia->ia_ifa); > E> + } > E> #ifndef IPSEC > E> /* > E> * 'ia' may be NULL if there is no route for this destination. > E> @@ -934,6 +950,7 @@ ip_forward(struct mbuf *m, int srcrt) > E> */ > E> if (!srcrt && ia =3D=3D NULL) { > E> icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, 0, 0); > E> + RO_RTFREE(&ro); > E> return; > E> } > > Here the ifa reference is leaked upon return. > > Gleb, the improvement on the ifa_ref not needed is something to look at but the ifa_ref here is not lost since ia =3D=3D NULL, no? Maybe i am missing something else. Also can we put this on a review? > > But don't hurry with fixing that :) Actually you don't need to ifa_ref() > in this function. You acquired a reference on rtentry in in_rtalloc_ign() > and hold it until RO_RTFREE(). And the rtentry itself always holds a > reference on the ifa. So, there is no reason to put extra reference on > the ifa. > > The ip_output() was already improved in r262747. And ip_forward() can > also be. The only place that touches ia after RO_RTFREE() is EMSGSIZE > handling, this can be moved up before RO_RTFREE(). > > Here is suggested patch. Ermal and Oliver, can you please test/benchmark > it? > > -- > Totus tuus, Glebius. > --=20 Ermal From owner-svn-src-all@freebsd.org Wed Jul 29 13:07:20 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0110E9ADB88; Wed, 29 Jul 2015 13:07:20 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB39F79C; Wed, 29 Jul 2015 13:07:19 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TD7JAK039252; Wed, 29 Jul 2015 13:07:19 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TD7Ju7039251; Wed, 29 Jul 2015 13:07:19 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507291307.t6TD7Ju7039251@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 29 Jul 2015 13:07:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286008 - stable/10/contrib/llvm/patches X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 13:07:20 -0000 Author: dim Date: Wed Jul 29 13:07:18 2015 New Revision: 286008 URL: https://svnweb.freebsd.org/changeset/base/286008 Log: Add llvm patch corresponding to r286007. Added: stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff Added: stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff Wed Jul 29 13:07:18 2015 (r286008) @@ -0,0 +1,214 @@ +Pull in r219009 from upstream llvm trunk (by Adam Nemet): + + [ISel] Keep matching state consistent when folding during X86 address match + + In the X86 backend, matching an address is initiated by the 'addr' complex + pattern and its friends. During this process we may reassociate and-of-shift + into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the + shift into the scale of the address. + + However as demonstrated by the testcase, this can trigger CSE of not only the + shift and the AND which the code is prepared for but also the underlying load + node. In the testcase this node is sitting in the RecordedNode and MatchScope + data structures of the matcher and becomes a deleted node upon CSE. Returning + from the complex pattern function, we try to access it again hitting an assert + because the node is no longer a load even though this was checked before. + + Now obviously changing the DAG this late is bending the rules but I think it + makes sense somewhat. Outside of addresses we prefer and-of-shift because it + may lead to smaller immediates (FoldMaskAndShiftToScale is an even better + example because it create a non-canonical node). We currently don't recognize + addresses during DAGCombiner where arguably this canonicalization should be + performed. On the other hand, having this in the matcher allows us to cover + all the cases where an address can be used in an instruction. + + I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW for + the new shift node in FoldMaskedShiftToScaledMask. This RAUW is responsible + for initiating the recursive CSE on users + (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but it + is not strictly necessary since the shift is hooked into the visited user. Of + course it's safer to keep the DAG consistent at all times (e.g. for accurate + number of uses, etc.). + + So rather than changing the fundamentals, I've decided to continue along the + previous patches and detect the CSE. This patch installs a very targeted + DAGUpdateListener for the duration of a complex-pattern match and updates the + matching state accordingly. (Previous patches used HandleSDNode to detect the + CSE but that's not practical here). The listener is only installed on X86. + + I tested that there is no measurable overhead due to this while running + through the spec2k BC files with llc. The only thing we pay for is the + creation of the listener. The callback never ever triggers in spec2k since + this is a corner case. + + Fixes rdar://problem/18206171 + +This fixes a possible crash in x86 code generation when compiling recent +llvm/clang trunk sources. + +Introduced here: http://svnweb.freebsd.org/changeset/base/286007 + +Index: include/llvm/CodeGen/SelectionDAGISel.h +=================================================================== +--- include/llvm/CodeGen/SelectionDAGISel.h ++++ include/llvm/CodeGen/SelectionDAGISel.h +@@ -238,6 +238,12 @@ class SelectionDAGISel : public MachineFunctionPas + const unsigned char *MatcherTable, + unsigned TableSize); + ++ /// \brief Return true if complex patterns for this target can mutate the ++ /// DAG. ++ virtual bool ComplexPatternFuncMutatesDAG() const { ++ return false; ++ } ++ + private: + + // Calls to these functions are generated by tblgen. +Index: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +=================================================================== +--- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ++++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +@@ -2345,6 +2345,42 @@ struct MatchScope { + bool HasChainNodesMatched, HasGlueResultNodesMatched; + }; + ++/// \\brief A DAG update listener to keep the matching state ++/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to ++/// change the DAG while matching. X86 addressing mode matcher is an example ++/// for this. ++class MatchStateUpdater : public SelectionDAG::DAGUpdateListener ++{ ++ SmallVectorImpl > &RecordedNodes; ++ SmallVectorImpl &MatchScopes; ++public: ++ MatchStateUpdater(SelectionDAG &DAG, ++ SmallVectorImpl > &RN, ++ SmallVectorImpl &MS) : ++ SelectionDAG::DAGUpdateListener(DAG), ++ RecordedNodes(RN), MatchScopes(MS) { } ++ ++ void NodeDeleted(SDNode *N, SDNode *E) { ++ // Some early-returns here to avoid the search if we deleted the node or ++ // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we ++ // do, so it's unnecessary to update matching state at that point). ++ // Neither of these can occur currently because we only install this ++ // update listener during matching a complex patterns. ++ if (!E || E->isMachineOpcode()) ++ return; ++ // Performing linear search here does not matter because we almost never ++ // run this code. You'd have to have a CSE during complex pattern ++ // matching. ++ for (auto &I : RecordedNodes) ++ if (I.first.getNode() == N) ++ I.first.setNode(E); ++ ++ for (auto &I : MatchScopes) ++ for (auto &J : I.NodeStack) ++ if (J.getNode() == N) ++ J.setNode(E); ++ } ++}; + } + + SDNode *SelectionDAGISel:: +@@ -2599,6 +2635,14 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsign + unsigned CPNum = MatcherTable[MatcherIndex++]; + unsigned RecNo = MatcherTable[MatcherIndex++]; + assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); ++ ++ // If target can modify DAG during matching, keep the matching state ++ // consistent. ++ std::unique_ptr MSU; ++ if (ComplexPatternFuncMutatesDAG()) ++ MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, ++ MatchScopes)); ++ + if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, + RecordedNodes[RecNo].first, CPNum, + RecordedNodes)) +Index: lib/Target/X86/X86ISelDAGToDAG.cpp +=================================================================== +--- lib/Target/X86/X86ISelDAGToDAG.cpp ++++ lib/Target/X86/X86ISelDAGToDAG.cpp +@@ -290,6 +290,13 @@ namespace { + const X86InstrInfo *getInstrInfo() const { + return getTargetMachine().getInstrInfo(); + } ++ ++ /// \brief Address-mode matching performs shift-of-and to and-of-shift ++ /// reassociation in order to expose more scaled addressing ++ /// opportunities. ++ bool ComplexPatternFuncMutatesDAG() const override { ++ return true; ++ } + }; + } + +Index: test/CodeGen/X86/addr-mode-matcher.ll +=================================================================== +--- test/CodeGen/X86/addr-mode-matcher.ll ++++ test/CodeGen/X86/addr-mode-matcher.ll +@@ -0,0 +1,62 @@ ++; RUN: llc < %s | FileCheck %s ++ ++; This testcase used to hit an assert during ISel. For details, see the big ++; comment inside the function. ++ ++; CHECK-LABEL: foo: ++; The AND should be turned into a subreg access. ++; CHECK-NOT: and ++; The shift (leal) should be folded into the scale of the address in the load. ++; CHECK-NOT: leal ++; CHECK: movl {{.*}},4), ++ ++target datalayout = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128" ++target triple = "i386-apple-macosx10.6.0" ++ ++define void @foo(i32 %a) { ++bb: ++ br label %bb1692 ++ ++bb1692: ++ %tmp1694 = phi i32 [ 0, %bb ], [ %tmp1745, %bb1692 ] ++ %xor = xor i32 0, %tmp1694 ++ ++; %load1 = (load (and (shl %xor, 2), 1020)) ++ %tmp1701 = shl i32 %xor, 2 ++ %tmp1702 = and i32 %tmp1701, 1020 ++ %tmp1703 = getelementptr inbounds [1028 x i8]* null, i32 0, i32 %tmp1702 ++ %tmp1704 = bitcast i8* %tmp1703 to i32* ++ %load1 = load i32* %tmp1704, align 4 ++ ++; %load2 = (load (shl (and %xor, 255), 2)) ++ %tmp1698 = and i32 %xor, 255 ++ %tmp1706 = shl i32 %tmp1698, 2 ++ %tmp1707 = getelementptr inbounds [1028 x i8]* null, i32 0, i32 %tmp1706 ++ %tmp1708 = bitcast i8* %tmp1707 to i32* ++ %load2 = load i32* %tmp1708, align 4 ++ ++ %tmp1710 = or i32 %load2, %a ++ ++; While matching xor we address-match %load1. The and-of-shift reassocication ++; in address matching transform this into into a shift-of-and and the resuting ++; node becomes identical to %load2. CSE replaces %load1 which leaves its ++; references in MatchScope and RecordedNodes stale. ++ %tmp1711 = xor i32 %load1, %tmp1710 ++ ++ %tmp1744 = getelementptr inbounds [256 x i32]* null, i32 0, i32 %tmp1711 ++ store i32 0, i32* %tmp1744, align 4 ++ %tmp1745 = add i32 %tmp1694, 1 ++ indirectbr i8* undef, [label %bb1756, label %bb1692] ++ ++bb1756: ++ br label %bb2705 ++ ++bb2705: ++ indirectbr i8* undef, [label %bb5721, label %bb5736] ++ ++bb5721: ++ br label %bb2705 ++ ++bb5736: ++ ret void ++} From owner-svn-src-all@freebsd.org Wed Jul 29 13:14:37 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24E929ADDE2; Wed, 29 Jul 2015 13:14:37 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F20EBC31; Wed, 29 Jul 2015 13:14:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TDEaAP043338; Wed, 29 Jul 2015 13:14:36 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TDEZ9Q043332; Wed, 29 Jul 2015 13:14:35 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507291314.t6TDEZ9Q043332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 29 Jul 2015 13:14:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r286009 - in stable/9/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86 patches X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 13:14:37 -0000 Author: dim Date: Wed Jul 29 13:14:34 2015 New Revision: 286009 URL: https://svnweb.freebsd.org/changeset/base/286009 Log: Merge r286007 from stable/10: Pull in r219009 from upstream llvm trunk (by Adam Nemet): [ISel] Keep matching state consistent when folding during X86 address match In the X86 backend, matching an address is initiated by the 'addr' complex pattern and its friends. During this process we may reassociate and-of-shift into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the shift into the scale of the address. However as demonstrated by the testcase, this can trigger CSE of not only the shift and the AND which the code is prepared for but also the underlying load node. In the testcase this node is sitting in the RecordedNode and MatchScope data structures of the matcher and becomes a deleted node upon CSE. Returning from the complex pattern function, we try to access it again hitting an assert because the node is no longer a load even though this was checked before. Now obviously changing the DAG this late is bending the rules but I think it makes sense somewhat. Outside of addresses we prefer and-of-shift because it may lead to smaller immediates (FoldMaskAndShiftToScale is an even better example because it create a non-canonical node). We currently don't recognize addresses during DAGCombiner where arguably this canonicalization should be performed. On the other hand, having this in the matcher allows us to cover all the cases where an address can be used in an instruction. I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW for the new shift node in FoldMaskedShiftToScaledMask. This RAUW is responsible for initiating the recursive CSE on users (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but it is not strictly necessary since the shift is hooked into the visited user. Of course it's safer to keep the DAG consistent at all times (e.g. for accurate number of uses, etc.). So rather than changing the fundamentals, I've decided to continue along the previous patches and detect the CSE. This patch installs a very targeted DAGUpdateListener for the duration of a complex-pattern match and updates the matching state accordingly. (Previous patches used HandleSDNode to detect the CSE but that's not practical here). The listener is only installed on X86. I tested that there is no measurable overhead due to this while running through the spec2k BC files with llc. The only thing we pay for is the creation of the listener. The callback never ever triggers in spec2k since this is a corner case. Fixes rdar://problem/18206171 This fixes a possible crash in x86 code generation when compiling recent llvm/clang trunk sources. Direct commit to stable/10, since head already has llvm/clang 3.6.1, which includes this fix. Reported by: jonathan, theraven Upstream PR: https://llvm.org/bugs/show_bug.cgi?id=24249 Merge r286008 from stable/10: Add llvm patch corresponding to r286007. Added: stable/9/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff - copied unchanged from r286008, stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff Modified: stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Directory Properties: stable/9/ (props changed) stable/9/contrib/ (props changed) stable/9/contrib/llvm/ (props changed) Modified: stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h ============================================================================== --- stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 13:07:18 2015 (r286008) +++ stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 13:14:34 2015 (r286009) @@ -238,6 +238,12 @@ public: const unsigned char *MatcherTable, unsigned TableSize); + /// \brief Return true if complex patterns for this target can mutate the + /// DAG. + virtual bool ComplexPatternFuncMutatesDAG() const { + return false; + } + private: // Calls to these functions are generated by tblgen. Modified: stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ============================================================================== --- stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 13:07:18 2015 (r286008) +++ stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 13:14:34 2015 (r286009) @@ -2345,6 +2345,42 @@ struct MatchScope { bool HasChainNodesMatched, HasGlueResultNodesMatched; }; +/// \\brief A DAG update listener to keep the matching state +/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to +/// change the DAG while matching. X86 addressing mode matcher is an example +/// for this. +class MatchStateUpdater : public SelectionDAG::DAGUpdateListener +{ + SmallVectorImpl > &RecordedNodes; + SmallVectorImpl &MatchScopes; +public: + MatchStateUpdater(SelectionDAG &DAG, + SmallVectorImpl > &RN, + SmallVectorImpl &MS) : + SelectionDAG::DAGUpdateListener(DAG), + RecordedNodes(RN), MatchScopes(MS) { } + + void NodeDeleted(SDNode *N, SDNode *E) { + // Some early-returns here to avoid the search if we deleted the node or + // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we + // do, so it's unnecessary to update matching state at that point). + // Neither of these can occur currently because we only install this + // update listener during matching a complex patterns. + if (!E || E->isMachineOpcode()) + return; + // Performing linear search here does not matter because we almost never + // run this code. You'd have to have a CSE during complex pattern + // matching. + for (auto &I : RecordedNodes) + if (I.first.getNode() == N) + I.first.setNode(E); + + for (auto &I : MatchScopes) + for (auto &J : I.NodeStack) + if (J.getNode() == N) + J.setNode(E); + } +}; } SDNode *SelectionDAGISel:: @@ -2599,6 +2635,14 @@ SelectCodeCommon(SDNode *NodeToMatch, co unsigned CPNum = MatcherTable[MatcherIndex++]; unsigned RecNo = MatcherTable[MatcherIndex++]; assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); + + // If target can modify DAG during matching, keep the matching state + // consistent. + std::unique_ptr MSU; + if (ComplexPatternFuncMutatesDAG()) + MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, + MatchScopes)); + if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, RecordedNodes[RecNo].first, CPNum, RecordedNodes)) Modified: stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp ============================================================================== --- stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 13:07:18 2015 (r286008) +++ stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 13:14:34 2015 (r286009) @@ -290,6 +290,13 @@ namespace { const X86InstrInfo *getInstrInfo() const { return getTargetMachine().getInstrInfo(); } + + /// \brief Address-mode matching performs shift-of-and to and-of-shift + /// reassociation in order to expose more scaled addressing + /// opportunities. + bool ComplexPatternFuncMutatesDAG() const override { + return true; + } }; } Copied: stable/9/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff (from r286008, stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff Wed Jul 29 13:14:34 2015 (r286009, copy of r286008, stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff) @@ -0,0 +1,214 @@ +Pull in r219009 from upstream llvm trunk (by Adam Nemet): + + [ISel] Keep matching state consistent when folding during X86 address match + + In the X86 backend, matching an address is initiated by the 'addr' complex + pattern and its friends. During this process we may reassociate and-of-shift + into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the + shift into the scale of the address. + + However as demonstrated by the testcase, this can trigger CSE of not only the + shift and the AND which the code is prepared for but also the underlying load + node. In the testcase this node is sitting in the RecordedNode and MatchScope + data structures of the matcher and becomes a deleted node upon CSE. Returning + from the complex pattern function, we try to access it again hitting an assert + because the node is no longer a load even though this was checked before. + + Now obviously changing the DAG this late is bending the rules but I think it + makes sense somewhat. Outside of addresses we prefer and-of-shift because it + may lead to smaller immediates (FoldMaskAndShiftToScale is an even better + example because it create a non-canonical node). We currently don't recognize + addresses during DAGCombiner where arguably this canonicalization should be + performed. On the other hand, having this in the matcher allows us to cover + all the cases where an address can be used in an instruction. + + I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW for + the new shift node in FoldMaskedShiftToScaledMask. This RAUW is responsible + for initiating the recursive CSE on users + (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but it + is not strictly necessary since the shift is hooked into the visited user. Of + course it's safer to keep the DAG consistent at all times (e.g. for accurate + number of uses, etc.). + + So rather than changing the fundamentals, I've decided to continue along the + previous patches and detect the CSE. This patch installs a very targeted + DAGUpdateListener for the duration of a complex-pattern match and updates the + matching state accordingly. (Previous patches used HandleSDNode to detect the + CSE but that's not practical here). The listener is only installed on X86. + + I tested that there is no measurable overhead due to this while running + through the spec2k BC files with llc. The only thing we pay for is the + creation of the listener. The callback never ever triggers in spec2k since + this is a corner case. + + Fixes rdar://problem/18206171 + +This fixes a possible crash in x86 code generation when compiling recent +llvm/clang trunk sources. + +Introduced here: http://svnweb.freebsd.org/changeset/base/286007 + +Index: include/llvm/CodeGen/SelectionDAGISel.h +=================================================================== +--- include/llvm/CodeGen/SelectionDAGISel.h ++++ include/llvm/CodeGen/SelectionDAGISel.h +@@ -238,6 +238,12 @@ class SelectionDAGISel : public MachineFunctionPas + const unsigned char *MatcherTable, + unsigned TableSize); + ++ /// \brief Return true if complex patterns for this target can mutate the ++ /// DAG. ++ virtual bool ComplexPatternFuncMutatesDAG() const { ++ return false; ++ } ++ + private: + + // Calls to these functions are generated by tblgen. +Index: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +=================================================================== +--- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ++++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +@@ -2345,6 +2345,42 @@ struct MatchScope { + bool HasChainNodesMatched, HasGlueResultNodesMatched; + }; + ++/// \\brief A DAG update listener to keep the matching state ++/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to ++/// change the DAG while matching. X86 addressing mode matcher is an example ++/// for this. ++class MatchStateUpdater : public SelectionDAG::DAGUpdateListener ++{ ++ SmallVectorImpl > &RecordedNodes; ++ SmallVectorImpl &MatchScopes; ++public: ++ MatchStateUpdater(SelectionDAG &DAG, ++ SmallVectorImpl > &RN, ++ SmallVectorImpl &MS) : ++ SelectionDAG::DAGUpdateListener(DAG), ++ RecordedNodes(RN), MatchScopes(MS) { } ++ ++ void NodeDeleted(SDNode *N, SDNode *E) { ++ // Some early-returns here to avoid the search if we deleted the node or ++ // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we ++ // do, so it's unnecessary to update matching state at that point). ++ // Neither of these can occur currently because we only install this ++ // update listener during matching a complex patterns. ++ if (!E || E->isMachineOpcode()) ++ return; ++ // Performing linear search here does not matter because we almost never ++ // run this code. You'd have to have a CSE during complex pattern ++ // matching. ++ for (auto &I : RecordedNodes) ++ if (I.first.getNode() == N) ++ I.first.setNode(E); ++ ++ for (auto &I : MatchScopes) ++ for (auto &J : I.NodeStack) ++ if (J.getNode() == N) ++ J.setNode(E); ++ } ++}; + } + + SDNode *SelectionDAGISel:: +@@ -2599,6 +2635,14 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsign + unsigned CPNum = MatcherTable[MatcherIndex++]; + unsigned RecNo = MatcherTable[MatcherIndex++]; + assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); ++ ++ // If target can modify DAG during matching, keep the matching state ++ // consistent. ++ std::unique_ptr MSU; ++ if (ComplexPatternFuncMutatesDAG()) ++ MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, ++ MatchScopes)); ++ + if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, + RecordedNodes[RecNo].first, CPNum, + RecordedNodes)) +Index: lib/Target/X86/X86ISelDAGToDAG.cpp +=================================================================== +--- lib/Target/X86/X86ISelDAGToDAG.cpp ++++ lib/Target/X86/X86ISelDAGToDAG.cpp +@@ -290,6 +290,13 @@ namespace { + const X86InstrInfo *getInstrInfo() const { + return getTargetMachine().getInstrInfo(); + } ++ ++ /// \brief Address-mode matching performs shift-of-and to and-of-shift ++ /// reassociation in order to expose more scaled addressing ++ /// opportunities. ++ bool ComplexPatternFuncMutatesDAG() const override { ++ return true; ++ } + }; + } + +Index: test/CodeGen/X86/addr-mode-matcher.ll +=================================================================== +--- test/CodeGen/X86/addr-mode-matcher.ll ++++ test/CodeGen/X86/addr-mode-matcher.ll +@@ -0,0 +1,62 @@ ++; RUN: llc < %s | FileCheck %s ++ ++; This testcase used to hit an assert during ISel. For details, see the big ++; comment inside the function. ++ ++; CHECK-LABEL: foo: ++; The AND should be turned into a subreg access. ++; CHECK-NOT: and ++; The shift (leal) should be folded into the scale of the address in the load. ++; CHECK-NOT: leal ++; CHECK: movl {{.*}},4), ++ ++target datalayout = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128" ++target triple = "i386-apple-macosx10.6.0" ++ ++define void @foo(i32 %a) { ++bb: ++ br label %bb1692 ++ ++bb1692: ++ %tmp1694 = phi i32 [ 0, %bb ], [ %tmp1745, %bb1692 ] ++ %xor = xor i32 0, %tmp1694 ++ ++; %load1 = (load (and (shl %xor, 2), 1020)) ++ %tmp1701 = shl i32 %xor, 2 ++ %tmp1702 = and i32 %tmp1701, 1020 ++ %tmp1703 = getelementptr inbounds [1028 x i8]* null, i32 0, i32 %tmp1702 ++ %tmp1704 = bitcast i8* %tmp1703 to i32* ++ %load1 = load i32* %tmp1704, align 4 ++ ++; %load2 = (load (shl (and %xor, 255), 2)) ++ %tmp1698 = and i32 %xor, 255 ++ %tmp1706 = shl i32 %tmp1698, 2 ++ %tmp1707 = getelementptr inbounds [1028 x i8]* null, i32 0, i32 %tmp1706 ++ %tmp1708 = bitcast i8* %tmp1707 to i32* ++ %load2 = load i32* %tmp1708, align 4 ++ ++ %tmp1710 = or i32 %load2, %a ++ ++; While matching xor we address-match %load1. The and-of-shift reassocication ++; in address matching transform this into into a shift-of-and and the resuting ++; node becomes identical to %load2. CSE replaces %load1 which leaves its ++; references in MatchScope and RecordedNodes stale. ++ %tmp1711 = xor i32 %load1, %tmp1710 ++ ++ %tmp1744 = getelementptr inbounds [256 x i32]* null, i32 0, i32 %tmp1711 ++ store i32 0, i32* %tmp1744, align 4 ++ %tmp1745 = add i32 %tmp1694, 1 ++ indirectbr i8* undef, [label %bb1756, label %bb1692] ++ ++bb1756: ++ br label %bb2705 ++ ++bb2705: ++ indirectbr i8* undef, [label %bb5721, label %bb5736] ++ ++bb5721: ++ br label %bb2705 ++ ++bb5736: ++ ret void ++} From owner-svn-src-all@freebsd.org Wed Jul 29 13:21:55 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4714C9ADFCC for ; Wed, 29 Jul 2015 13:21:55 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-oi0-f42.google.com (mail-oi0-f42.google.com [209.85.218.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0275810C7 for ; Wed, 29 Jul 2015 13:21:54 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by oixx19 with SMTP id x19so4804981oix.0 for ; Wed, 29 Jul 2015 06:21:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=BFbNw80eeas51pWAM/9AzpvFuIvU6dqqPlbFUs2hdjk=; b=ezstV88hwFFwPr4gqA97qjzweux92tjs265ghjJaFle6/QPkCFbuGyYmkIlnrueuAz GylMA7HWnPLbNCkkbS2mEzOZuYqmXPO1Vdz6wuvibtX5A+Q/CqAR3T5508ZwNIivUCSf 5w6uWS2Z/uSzYwjUA1/eOf+75TAG+0NVSU5LX3UJtjGjtf2E0f8nZXgHlAACKq0x+tp+ NCYEMw9GXHElBnsqZvnP+SRmBDCqkGBsSA/msAkTg1BnDLHU9x4rUEKreZRtM5QkG9ou n0F9IgMxlOHpQh5mt01dHrKxBpF1xm+DgUOnTqQETOfEr4S1MCOyC6EE6zjrAUijeaNc SU1A== X-Gm-Message-State: ALoCoQnUwdvxoiuW2JfRPg+JnyQU97rBHN7DN6klIfVBjF9QEj2KshB4YnpLOyYQIKv8waflsrX2 MIME-Version: 1.0 X-Received: by 10.202.208.70 with SMTP id h67mr35302471oig.74.1438176107459; Wed, 29 Jul 2015 06:21:47 -0700 (PDT) Received: by 10.76.0.46 with HTTP; Wed, 29 Jul 2015 06:21:47 -0700 (PDT) X-Originating-IP: [84.27.222.46] In-Reply-To: <201507291259.t6TCxHX4035145@repo.freebsd.org> References: <201507291259.t6TCxHX4035145@repo.freebsd.org> Date: Wed, 29 Jul 2015 15:21:47 +0200 Message-ID: Subject: Re: svn commit: r286007 - in stable/10/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86 From: Ed Schouten To: Dimitry Andric Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 13:21:55 -0000 Hi Dimitry, 2015-07-29 14:59 GMT+02:00 Dimitry Andric : > + std::unique_ptr MSU; Is it safe to use std::unique_ptr<> in FreeBSD 10 sources? As in, would it still allow upgrading to 10.2 from 9.x and 10.{0,1}? -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK/VAT number: 62051717 From owner-svn-src-all@freebsd.org Wed Jul 29 13:36:19 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 552669AC50D; Wed, 29 Jul 2015 13:36:19 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3EDD618AB; Wed, 29 Jul 2015 13:36:19 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TDaJtC051460; Wed, 29 Jul 2015 13:36:19 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TDaIbn051458; Wed, 29 Jul 2015 13:36:18 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201507291336.t6TDaIbn051458@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 29 Jul 2015 13:36:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286010 - head/usr.bin/ar X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 13:36:19 -0000 Author: emaste Date: Wed Jul 29 13:36:17 2015 New Revision: 286010 URL: https://svnweb.freebsd.org/changeset/base/286010 Log: ar: enable deterministic mode by default Ar cannot handle UIDs with more than 6 digits, and storing the mtime, uid, gid and mode provides little to negative value anyhow for ar's uses. Turn on deterministic (-D) mode by default; it can be disabled by the user with -U. PR: 196929 Relnotes: Yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3190 Modified: head/usr.bin/ar/ar.1 head/usr.bin/ar/ar.c Modified: head/usr.bin/ar/ar.1 ============================================================================== --- head/usr.bin/ar/ar.1 Wed Jul 29 13:14:34 2015 (r286009) +++ head/usr.bin/ar/ar.1 Wed Jul 29 13:36:17 2015 (r286010) @@ -210,6 +210,7 @@ and 0644 instead of file mode from the m .Ar . This ensures that checksums on the resulting archives are reproducible when member contents are identical. +This option is enabled by default. If multiple .Fl D and Modified: head/usr.bin/ar/ar.c ============================================================================== --- head/usr.bin/ar/ar.c Wed Jul 29 13:14:34 2015 (r286009) +++ head/usr.bin/ar/ar.c Wed Jul 29 13:36:17 2015 (r286010) @@ -104,6 +104,8 @@ main(int argc, char **argv) bsdar = &bsdar_storage; memset(bsdar, 0, sizeof(*bsdar)); + /* Enable deterministic mode by default. */ + bsdar->options |= AR_D; if ((bsdar->progname = getprogname()) == NULL) bsdar->progname = "ar"; From owner-svn-src-all@freebsd.org Wed Jul 29 13:36:20 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 064509AC511; Wed, 29 Jul 2015 13:36:20 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B5E2B18AE; Wed, 29 Jul 2015 13:36:19 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [192.168.2.12] (ip9135eb11.speed.planet.nl [145.53.235.17]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id EE75D18C72; Wed, 29 Jul 2015 15:36:15 +0200 (CEST) Subject: Re: svn commit: r286007 - in stable/10/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2102\)) Content-Type: multipart/signed; boundary="Apple-Mail=_3CF51DFE-9729-4780-847A-C3194CC486B4"; protocol="application/pgp-signature"; micalg=pgp-sha1 X-Pgp-Agent: GPGMail 2.5 From: Dimitry Andric In-Reply-To: Date: Wed, 29 Jul 2015 15:36:09 +0200 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Message-Id: <5EDE437E-8D2E-4ADC-A90A-730CD9726AEC@FreeBSD.org> References: <201507291259.t6TCxHX4035145@repo.freebsd.org> To: Ed Schouten X-Mailer: Apple Mail (2.2102) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 13:36:20 -0000 --Apple-Mail=_3CF51DFE-9729-4780-847A-C3194CC486B4 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On 29 Jul 2015, at 15:21, Ed Schouten wrote: > 2015-07-29 14:59 GMT+02:00 Dimitry Andric : >> + std::unique_ptr MSU; > > Is it safe to use std::unique_ptr<> in FreeBSD 10 sources? As in, > would it still allow upgrading to 10.2 from 9.x and 10.{0,1}? Hmm, that's a good one. I keep forgetting that this needs to be buildable with obsolete compilers. :-( I'll have a look if this can be fixed using pre-C++11 constructs, or otherwise revert the fix. This could make it more difficult to upgrade later, though I did not see the crash reported by Jonathan myself. -Dimitry --Apple-Mail=_3CF51DFE-9729-4780-847A-C3194CC486B4 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.27 iEYEARECAAYFAlW41s8ACgkQsF6jCi4glqNjrwCfQCzhCezZtPDi4L2duVUF0qU0 tQIAn1i5hNu6C/u//oChe7G6h8n9EHje =GsEi -----END PGP SIGNATURE----- --Apple-Mail=_3CF51DFE-9729-4780-847A-C3194CC486B4-- From owner-svn-src-all@freebsd.org Wed Jul 29 13:49:35 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54E339ACA12; Wed, 29 Jul 2015 13:49:35 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 389E4261; Wed, 29 Jul 2015 13:49:35 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TDnZMG055743; Wed, 29 Jul 2015 13:49:35 GMT (envelope-from pluknet@FreeBSD.org) Received: (from pluknet@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TDnZnD055742; Wed, 29 Jul 2015 13:49:35 GMT (envelope-from pluknet@FreeBSD.org) Message-Id: <201507291349.t6TDnZnD055742@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pluknet set sender to pluknet@FreeBSD.org using -f From: Sergey Kandaurov Date: Wed, 29 Jul 2015 13:49:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286011 - head/tests/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 13:49:35 -0000 Author: pluknet Date: Wed Jul 29 13:49:34 2015 New Revision: 286011 URL: https://svnweb.freebsd.org/changeset/base/286011 Log: Fixed shutdown(2) unix(4) tests for SOCK_SEQPACKET after r285910 (by ed). Modified: head/tests/sys/kern/unix_seqpacket_test.c Modified: head/tests/sys/kern/unix_seqpacket_test.c ============================================================================== --- head/tests/sys/kern/unix_seqpacket_test.c Wed Jul 29 13:36:17 2015 (r286010) +++ head/tests/sys/kern/unix_seqpacket_test.c Wed Jul 29 13:49:34 2015 (r286011) @@ -751,35 +751,79 @@ ATF_TC_BODY(send_recv_with_connect, tc) ATF_TC_WITHOUT_HEAD(shutdown_send); ATF_TC_BODY(shutdown_send, tc) { - int s; - const char data[] = "data"; + struct sockaddr_un sun; + /* ATF's isolation mechanisms will guarantee uniqueness of this file */ + const char *path = "sock"; + const char *data = "data"; ssize_t ssize; + int s, err, s2; s = socket(PF_LOCAL, SOCK_SEQPACKET, 0); ATF_REQUIRE(s >= 0); - ATF_CHECK_EQ(0, shutdown(s, SHUT_RDWR)); + + bzero(&sun, sizeof(sun)); + sun.sun_family = AF_LOCAL; + sun.sun_len = sizeof(sun); + strlcpy(sun.sun_path, path, sizeof(sun.sun_path)); + err = bind(s, (struct sockaddr *)&sun, sizeof(sun)); + err = listen(s, -1); + ATF_CHECK_EQ(0, err); + + /* Create the other socket */ + s2 = socket(PF_LOCAL, SOCK_SEQPACKET, 0); + ATF_REQUIRE(s2 >= 0); + err = connect(s2, (struct sockaddr*)&sun, sizeof(sun)); + if (err != 0) { + perror("connect"); + atf_tc_fail("connect(2) failed"); + } + + ATF_CHECK_EQ(0, shutdown(s2, SHUT_RDWR)); /* USE MSG_NOSIGNAL so we don't get SIGPIPE */ - ssize = send(s, data, sizeof(data), MSG_EOR | MSG_NOSIGNAL); + ssize = send(s2, data, sizeof(data), MSG_EOR | MSG_NOSIGNAL); ATF_CHECK_EQ(EPIPE, errno); ATF_CHECK_EQ(-1, ssize); close(s); + close(s2); } /* send(2) should cause SIGPIPE on a shutdown socket */ ATF_TC_WITHOUT_HEAD(shutdown_send_sigpipe); ATF_TC_BODY(shutdown_send_sigpipe, tc) { - int s; - const char data[] = "data"; + struct sockaddr_un sun; + /* ATF's isolation mechanisms will guarantee uniqueness of this file */ + const char *path = "sock"; + const char *data = "data"; ssize_t ssize; + int s, err, s2; s = socket(PF_LOCAL, SOCK_SEQPACKET, 0); ATF_REQUIRE(s >= 0); - ATF_CHECK_EQ(0, shutdown(s, SHUT_RDWR)); + + bzero(&sun, sizeof(sun)); + sun.sun_family = AF_LOCAL; + sun.sun_len = sizeof(sun); + strlcpy(sun.sun_path, path, sizeof(sun.sun_path)); + err = bind(s, (struct sockaddr *)&sun, sizeof(sun)); + err = listen(s, -1); + ATF_CHECK_EQ(0, err); + + /* Create the other socket */ + s2 = socket(PF_LOCAL, SOCK_SEQPACKET, 0); + ATF_REQUIRE(s2 >= 0); + err = connect(s2, (struct sockaddr*)&sun, sizeof(sun)); + if (err != 0) { + perror("connect"); + atf_tc_fail("connect(2) failed"); + } + + ATF_CHECK_EQ(0, shutdown(s2, SHUT_RDWR)); ATF_REQUIRE(SIG_ERR != signal(SIGPIPE, shutdown_send_sigpipe_handler)); - ssize = send(s, data, sizeof(data), MSG_EOR); + ssize = send(s2, data, sizeof(data), MSG_EOR); ATF_CHECK_EQ(1, got_sigpipe); close(s); + close(s2); } /* nonblocking send(2) and recv(2) a single short record */ From owner-svn-src-all@freebsd.org Wed Jul 29 14:07:31 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 664619AD7F7; Wed, 29 Jul 2015 14:07:31 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49DDDFCA; Wed, 29 Jul 2015 14:07:31 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TE7VKJ063716; Wed, 29 Jul 2015 14:07:31 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TE7Uxc063711; Wed, 29 Jul 2015 14:07:30 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507291407.t6TE7Uxc063711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 29 Jul 2015 14:07:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r286012 - in stable: 10/contrib/llvm/include/llvm/CodeGen 10/contrib/llvm/lib/CodeGen/SelectionDAG 10/contrib/llvm/lib/Target/X86 10/contrib/llvm/patches 9/contrib/llvm/include/llvm/Cod... X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 14:07:31 -0000 Author: dim Date: Wed Jul 29 14:07:29 2015 New Revision: 286012 URL: https://svnweb.freebsd.org/changeset/base/286012 Log: Revert r286007-r286009 for now, until I can figure out how to make the fix compile with older gcc and libstdc++. Deleted: stable/9/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff Modified: stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Directory Properties: stable/9/ (props changed) stable/9/contrib/ (props changed) stable/9/contrib/llvm/ (props changed) Changes in other areas also in this revision: Deleted: stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff Modified: stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Modified: stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h ============================================================================== --- stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 13:49:34 2015 (r286011) +++ stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 14:07:29 2015 (r286012) @@ -238,12 +238,6 @@ public: const unsigned char *MatcherTable, unsigned TableSize); - /// \brief Return true if complex patterns for this target can mutate the - /// DAG. - virtual bool ComplexPatternFuncMutatesDAG() const { - return false; - } - private: // Calls to these functions are generated by tblgen. Modified: stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ============================================================================== --- stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 13:49:34 2015 (r286011) +++ stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 14:07:29 2015 (r286012) @@ -2345,42 +2345,6 @@ struct MatchScope { bool HasChainNodesMatched, HasGlueResultNodesMatched; }; -/// \\brief A DAG update listener to keep the matching state -/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to -/// change the DAG while matching. X86 addressing mode matcher is an example -/// for this. -class MatchStateUpdater : public SelectionDAG::DAGUpdateListener -{ - SmallVectorImpl > &RecordedNodes; - SmallVectorImpl &MatchScopes; -public: - MatchStateUpdater(SelectionDAG &DAG, - SmallVectorImpl > &RN, - SmallVectorImpl &MS) : - SelectionDAG::DAGUpdateListener(DAG), - RecordedNodes(RN), MatchScopes(MS) { } - - void NodeDeleted(SDNode *N, SDNode *E) { - // Some early-returns here to avoid the search if we deleted the node or - // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we - // do, so it's unnecessary to update matching state at that point). - // Neither of these can occur currently because we only install this - // update listener during matching a complex patterns. - if (!E || E->isMachineOpcode()) - return; - // Performing linear search here does not matter because we almost never - // run this code. You'd have to have a CSE during complex pattern - // matching. - for (auto &I : RecordedNodes) - if (I.first.getNode() == N) - I.first.setNode(E); - - for (auto &I : MatchScopes) - for (auto &J : I.NodeStack) - if (J.getNode() == N) - J.setNode(E); - } -}; } SDNode *SelectionDAGISel:: @@ -2635,14 +2599,6 @@ SelectCodeCommon(SDNode *NodeToMatch, co unsigned CPNum = MatcherTable[MatcherIndex++]; unsigned RecNo = MatcherTable[MatcherIndex++]; assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); - - // If target can modify DAG during matching, keep the matching state - // consistent. - std::unique_ptr MSU; - if (ComplexPatternFuncMutatesDAG()) - MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, - MatchScopes)); - if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, RecordedNodes[RecNo].first, CPNum, RecordedNodes)) Modified: stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp ============================================================================== --- stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 13:49:34 2015 (r286011) +++ stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 14:07:29 2015 (r286012) @@ -290,13 +290,6 @@ namespace { const X86InstrInfo *getInstrInfo() const { return getTargetMachine().getInstrInfo(); } - - /// \brief Address-mode matching performs shift-of-and to and-of-shift - /// reassociation in order to expose more scaled addressing - /// opportunities. - bool ComplexPatternFuncMutatesDAG() const override { - return true; - } }; } From owner-svn-src-all@freebsd.org Wed Jul 29 14:07:33 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C5989AD7FF; Wed, 29 Jul 2015 14:07:33 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E4320FCD; Wed, 29 Jul 2015 14:07:32 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TE7Wvg063724; Wed, 29 Jul 2015 14:07:32 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TE7VCo063721; Wed, 29 Jul 2015 14:07:32 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507291407.t6TE7VCo063721@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 29 Jul 2015 14:07:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286012 - in stable: 10/contrib/llvm/include/llvm/CodeGen 10/contrib/llvm/lib/CodeGen/SelectionDAG 10/contrib/llvm/lib/Target/X86 10/contrib/llvm/patches 9/contrib/llvm/include/llvm/Cod... X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 14:07:33 -0000 Author: dim Date: Wed Jul 29 14:07:29 2015 New Revision: 286012 URL: https://svnweb.freebsd.org/changeset/base/286012 Log: Revert r286007-r286009 for now, until I can figure out how to make the fix compile with older gcc and libstdc++. Deleted: stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff Modified: stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Changes in other areas also in this revision: Deleted: stable/9/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff Modified: stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Directory Properties: stable/9/ (props changed) stable/9/contrib/ (props changed) stable/9/contrib/llvm/ (props changed) Modified: stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h ============================================================================== --- stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 13:49:34 2015 (r286011) +++ stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 14:07:29 2015 (r286012) @@ -238,12 +238,6 @@ public: const unsigned char *MatcherTable, unsigned TableSize); - /// \brief Return true if complex patterns for this target can mutate the - /// DAG. - virtual bool ComplexPatternFuncMutatesDAG() const { - return false; - } - private: // Calls to these functions are generated by tblgen. Modified: stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ============================================================================== --- stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 13:49:34 2015 (r286011) +++ stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 14:07:29 2015 (r286012) @@ -2345,42 +2345,6 @@ struct MatchScope { bool HasChainNodesMatched, HasGlueResultNodesMatched; }; -/// \\brief A DAG update listener to keep the matching state -/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to -/// change the DAG while matching. X86 addressing mode matcher is an example -/// for this. -class MatchStateUpdater : public SelectionDAG::DAGUpdateListener -{ - SmallVectorImpl > &RecordedNodes; - SmallVectorImpl &MatchScopes; -public: - MatchStateUpdater(SelectionDAG &DAG, - SmallVectorImpl > &RN, - SmallVectorImpl &MS) : - SelectionDAG::DAGUpdateListener(DAG), - RecordedNodes(RN), MatchScopes(MS) { } - - void NodeDeleted(SDNode *N, SDNode *E) { - // Some early-returns here to avoid the search if we deleted the node or - // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we - // do, so it's unnecessary to update matching state at that point). - // Neither of these can occur currently because we only install this - // update listener during matching a complex patterns. - if (!E || E->isMachineOpcode()) - return; - // Performing linear search here does not matter because we almost never - // run this code. You'd have to have a CSE during complex pattern - // matching. - for (auto &I : RecordedNodes) - if (I.first.getNode() == N) - I.first.setNode(E); - - for (auto &I : MatchScopes) - for (auto &J : I.NodeStack) - if (J.getNode() == N) - J.setNode(E); - } -}; } SDNode *SelectionDAGISel:: @@ -2635,14 +2599,6 @@ SelectCodeCommon(SDNode *NodeToMatch, co unsigned CPNum = MatcherTable[MatcherIndex++]; unsigned RecNo = MatcherTable[MatcherIndex++]; assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); - - // If target can modify DAG during matching, keep the matching state - // consistent. - std::unique_ptr MSU; - if (ComplexPatternFuncMutatesDAG()) - MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, - MatchScopes)); - if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, RecordedNodes[RecNo].first, CPNum, RecordedNodes)) Modified: stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp ============================================================================== --- stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 13:49:34 2015 (r286011) +++ stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 14:07:29 2015 (r286012) @@ -290,13 +290,6 @@ namespace { const X86InstrInfo *getInstrInfo() const { return getTargetMachine().getInstrInfo(); } - - /// \brief Address-mode matching performs shift-of-and to and-of-shift - /// reassociation in order to expose more scaled addressing - /// opportunities. - bool ComplexPatternFuncMutatesDAG() const override { - return true; - } }; } From owner-svn-src-all@freebsd.org Wed Jul 29 14:07:45 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 628069AD87C; Wed, 29 Jul 2015 14:07:45 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 455D1132D; Wed, 29 Jul 2015 14:07:45 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TE7jWK063777; Wed, 29 Jul 2015 14:07:45 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TE7isl063774; Wed, 29 Jul 2015 14:07:44 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201507291407.t6TE7isl063774@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 29 Jul 2015 14:07:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286013 - in head/sys: net netinet netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 14:07:45 -0000 Author: ae Date: Wed Jul 29 14:07:43 2015 New Revision: 286013 URL: https://svnweb.freebsd.org/changeset/base/286013 Log: Eliminate the use of m_copydata() in gif_encapcheck(). ip_encap already has inspected mbuf's data, at least an IP header. And it is safe to use mtod() and do direct access to needed fields. Add M_ASSERTPKTHDR() to gif_encapcheck(), since the code expects that mbuf has a packet header. Move the code from gif_validate[46] into in[6]_gif_encapcheck(), also remove "martian filters" checks. According to RFC 4213 it is enough to verify that the source address is the address of the encapsulator, as configured on the decapsulator. Reviewed by: melifaro Obtained from: Yandex LLC Sponsored by: Yandex LLC Modified: head/sys/net/if_gif.c head/sys/netinet/in_gif.c head/sys/netinet6/in6_gif.c Modified: head/sys/net/if_gif.c ============================================================================== --- head/sys/net/if_gif.c Wed Jul 29 14:07:29 2015 (r286012) +++ head/sys/net/if_gif.c Wed Jul 29 14:07:43 2015 (r286013) @@ -280,9 +280,9 @@ int gif_encapcheck(const struct mbuf *m, int off, int proto, void *arg) { GIF_RLOCK_TRACKER; + const struct ip *ip; struct gif_softc *sc; int ret; - uint8_t ver; sc = (struct gif_softc *)arg; if (sc == NULL || (GIF2IFP(sc)->if_flags & IFF_UP) == 0) @@ -309,11 +309,12 @@ gif_encapcheck(const struct mbuf *m, int } /* Bail on short packets */ + M_ASSERTPKTHDR(m); if (m->m_pkthdr.len < sizeof(struct ip)) goto done; - m_copydata(m, 0, 1, &ver); - switch (ver >> 4) { + ip = mtod(m, const struct ip *); + switch (ip->ip_v) { #ifdef INET case 4: if (sc->gif_family != AF_INET) Modified: head/sys/netinet/in_gif.c ============================================================================== --- head/sys/netinet/in_gif.c Wed Jul 29 14:07:29 2015 (r286012) +++ head/sys/netinet/in_gif.c Wed Jul 29 14:07:43 2015 (r286013) @@ -67,8 +67,6 @@ __FBSDID("$FreeBSD$"); #include -static int gif_validate4(const struct ip *, struct gif_softc *, - struct ifnet *); static int in_gif_input(struct mbuf **, int *, int); extern struct domain inetdomain; @@ -163,16 +161,22 @@ in_gif_input(struct mbuf **mp, int *offp } /* - * validate outer address. + * we know that we are in IFF_UP, outer address available, and outer family + * matched the physical addr family. see gif_encapcheck(). */ -static int -gif_validate4(const struct ip *ip, struct gif_softc *sc, struct ifnet *ifp) +int +in_gif_encapcheck(const struct mbuf *m, int off, int proto, void *arg) { + const struct ip *ip; + struct gif_softc *sc; int ret; + /* sanity check done in caller */ + sc = (struct gif_softc *)arg; GIF_RLOCK_ASSERT(sc); /* check for address match */ + ip = mtod(m, const struct ip *); if (sc->gif_iphdr->ip_src.s_addr != ip->ip_dst.s_addr) return (0); ret = 32; @@ -182,18 +186,8 @@ gif_validate4(const struct ip *ip, struc } else ret += 32; - /* martian filters on outer source - NOT done in ip_input! */ - if (IN_MULTICAST(ntohl(ip->ip_src.s_addr))) - return (0); - switch ((ntohl(ip->ip_src.s_addr) & 0xff000000) >> 24) { - case 0: - case 127: - case 255: - return (0); - } - /* ingress filters on outer source */ - if ((GIF2IFP(sc)->if_flags & IFF_LINK2) == 0 && ifp) { + if ((GIF2IFP(sc)->if_flags & IFF_LINK2) == 0) { struct sockaddr_in sin; struct rtentry *rt; @@ -204,8 +198,8 @@ gif_validate4(const struct ip *ip, struc /* XXX MRT check for the interface we would use on output */ rt = in_rtalloc1((struct sockaddr *)&sin, 0, 0UL, sc->gif_fibnum); - if (!rt || rt->rt_ifp != ifp) { - if (rt) + if (rt == NULL || rt->rt_ifp != m->m_pkthdr.rcvif) { + if (rt != NULL) RTFREE_LOCKED(rt); return (0); } @@ -214,26 +208,6 @@ gif_validate4(const struct ip *ip, struc return (ret); } -/* - * we know that we are in IFF_UP, outer address available, and outer family - * matched the physical addr family. see gif_encapcheck(). - */ -int -in_gif_encapcheck(const struct mbuf *m, int off, int proto, void *arg) -{ - struct ip ip; - struct gif_softc *sc; - struct ifnet *ifp; - - /* sanity check done in caller */ - sc = (struct gif_softc *)arg; - GIF_RLOCK_ASSERT(sc); - - m_copydata(m, 0, sizeof(ip), (caddr_t)&ip); - ifp = ((m->m_flags & M_PKTHDR) != 0) ? m->m_pkthdr.rcvif : NULL; - return (gif_validate4(&ip, sc, ifp)); -} - int in_gif_attach(struct gif_softc *sc) { Modified: head/sys/netinet6/in6_gif.c ============================================================================== --- head/sys/netinet6/in6_gif.c Wed Jul 29 14:07:29 2015 (r286012) +++ head/sys/netinet6/in6_gif.c Wed Jul 29 14:07:43 2015 (r286013) @@ -81,8 +81,6 @@ SYSCTL_DECL(_net_inet6_ip6); SYSCTL_INT(_net_inet6_ip6, IPV6CTL_GIF_HLIM, gifhlim, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip6_gif_hlim), 0, ""); -static int gif_validate6(const struct ip6_hdr *, struct gif_softc *, - struct ifnet *); static int in6_gif_input(struct mbuf **, int *, int); extern struct domain inet6domain; @@ -174,20 +172,26 @@ in6_gif_input(struct mbuf **mp, int *off } /* - * validate outer address. + * we know that we are in IFF_UP, outer address available, and outer family + * matched the physical addr family. see gif_encapcheck(). */ -static int -gif_validate6(const struct ip6_hdr *ip6, struct gif_softc *sc, - struct ifnet *ifp) +int +in6_gif_encapcheck(const struct mbuf *m, int off, int proto, void *arg) { + const struct ip6_hdr *ip6; + struct gif_softc *sc; int ret; + /* sanity check done in caller */ + sc = (struct gif_softc *)arg; GIF_RLOCK_ASSERT(sc); + /* * Check for address match. Note that the check is for an incoming * packet. We should compare the *source* address in our configuration * and the *destination* address of the packet, and vice versa. */ + ip6 = mtod(m, const struct ip6_hdr *); if (!IN6_ARE_ADDR_EQUAL(&sc->gif_ip6hdr->ip6_src, &ip6->ip6_dst)) return (0); ret = 128; @@ -197,10 +201,8 @@ gif_validate6(const struct ip6_hdr *ip6, } else ret += 128; - /* martian filters on outer source - done in ip6_input */ - /* ingress filters on outer source */ - if ((GIF2IFP(sc)->if_flags & IFF_LINK2) == 0 && ifp) { + if ((GIF2IFP(sc)->if_flags & IFF_LINK2) == 0) { struct sockaddr_in6 sin6; struct rtentry *rt; @@ -212,37 +214,16 @@ gif_validate6(const struct ip6_hdr *ip6, rt = in6_rtalloc1((struct sockaddr *)&sin6, 0, 0UL, sc->gif_fibnum); - if (!rt || rt->rt_ifp != ifp) { - if (rt) + if (rt == NULL || rt->rt_ifp != m->m_pkthdr.rcvif) { + if (rt != NULL) RTFREE_LOCKED(rt); return (0); } RTFREE_LOCKED(rt); } - return (ret); } -/* - * we know that we are in IFF_UP, outer address available, and outer family - * matched the physical addr family. see gif_encapcheck(). - */ -int -in6_gif_encapcheck(const struct mbuf *m, int off, int proto, void *arg) -{ - struct ip6_hdr ip6; - struct gif_softc *sc; - struct ifnet *ifp; - - /* sanity check done in caller */ - sc = (struct gif_softc *)arg; - GIF_RLOCK_ASSERT(sc); - - m_copydata(m, 0, sizeof(ip6), (caddr_t)&ip6); - ifp = ((m->m_flags & M_PKTHDR) != 0) ? m->m_pkthdr.rcvif : NULL; - return (gif_validate6(&ip6, sc, ifp)); -} - int in6_gif_attach(struct gif_softc *sc) { From owner-svn-src-all@freebsd.org Wed Jul 29 14:16:27 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AD8D09ADC33; Wed, 29 Jul 2015 14:16:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9C4031A7C; Wed, 29 Jul 2015 14:16:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TEGRHD067761; Wed, 29 Jul 2015 14:16:27 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TEGQg6067758; Wed, 29 Jul 2015 14:16:26 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201507291416.t6TEGQg6067758@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 29 Jul 2015 14:16:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r286014 - in releng/10.2/sys: net netpfil/pf X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 14:16:27 -0000 Author: glebius Date: Wed Jul 29 14:16:25 2015 New Revision: 286014 URL: https://svnweb.freebsd.org/changeset/base/286014 Log: Merge r285939-285941,285943,286004 from stable/10: - Protect against ioctl() vs ioctl() races. - Always lock hash row of a source node when updating its 'states' counter. [1] - Don't dereference NULL is pf_get_mtag() fails. [2] - During module unload drop locks before destroying UMA zone. PR: 182401 [1] PR: 200222 [2] Approved by: re (gjb) Modified: releng/10.2/sys/net/pfvar.h releng/10.2/sys/netpfil/pf/pf.c releng/10.2/sys/netpfil/pf/pf_ioctl.c Directory Properties: releng/10.2/ (props changed) Modified: releng/10.2/sys/net/pfvar.h ============================================================================== --- releng/10.2/sys/net/pfvar.h Wed Jul 29 14:07:43 2015 (r286013) +++ releng/10.2/sys/net/pfvar.h Wed Jul 29 14:16:25 2015 (r286014) @@ -1549,7 +1549,6 @@ extern struct pf_state *pf_find_state_a extern struct pf_src_node *pf_find_src_node(struct pf_addr *, struct pf_rule *, sa_family_t, int); extern void pf_unlink_src_node(struct pf_src_node *); -extern void pf_unlink_src_node_locked(struct pf_src_node *); extern u_int pf_free_src_nodes(struct pf_src_node_list *); extern void pf_print_state(struct pf_state *); extern void pf_print_flags(u_int8_t); Modified: releng/10.2/sys/netpfil/pf/pf.c ============================================================================== --- releng/10.2/sys/netpfil/pf/pf.c Wed Jul 29 14:07:43 2015 (r286013) +++ releng/10.2/sys/netpfil/pf/pf.c Wed Jul 29 14:16:25 2015 (r286014) @@ -655,7 +655,10 @@ pf_find_src_node(struct pf_addr *src, st ((af == AF_INET && n->addr.v4.s_addr == src->v4.s_addr) || (af == AF_INET6 && bcmp(&n->addr, src, sizeof(*src)) == 0))) break; - if (n != NULL || returnlocked == 0) + if (n != NULL) { + n->states++; + PF_HASHROW_UNLOCK(sh); + } else if (returnlocked == 0) PF_HASHROW_UNLOCK(sh); return (n); @@ -699,6 +702,7 @@ pf_insert_src_node(struct pf_src_node ** LIST_INSERT_HEAD(&sh->nodes, *sn, entry); (*sn)->creation = time_uptime; (*sn)->ruletype = rule->action; + (*sn)->states = 1; if ((*sn)->rule.ptr != NULL) counter_u64_add((*sn)->rule.ptr->src_nodes, 1); PF_HASHROW_UNLOCK(sh); @@ -715,37 +719,13 @@ pf_insert_src_node(struct pf_src_node ** } void -pf_unlink_src_node_locked(struct pf_src_node *src) +pf_unlink_src_node(struct pf_src_node *src) { -#ifdef INVARIANTS - struct pf_srchash *sh; - sh = &V_pf_srchash[pf_hashsrc(&src->addr, src->af)]; - PF_HASHROW_ASSERT(sh); -#endif + PF_HASHROW_ASSERT(&V_pf_srchash[pf_hashsrc(&src->addr, src->af)]); LIST_REMOVE(src, entry); if (src->rule.ptr) counter_u64_add(src->rule.ptr->src_nodes, -1); - counter_u64_add(V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS], 1); -} - -void -pf_unlink_src_node(struct pf_src_node *src) -{ - struct pf_srchash *sh; - - sh = &V_pf_srchash[pf_hashsrc(&src->addr, src->af)]; - PF_HASHROW_LOCK(sh); - pf_unlink_src_node_locked(src); - PF_HASHROW_UNLOCK(sh); -} - -static void -pf_free_src_node(struct pf_src_node *sn) -{ - - KASSERT(sn->states == 0, ("%s: %p has refs", __func__, sn)); - uma_zfree(V_pf_sources_z, sn); } u_int @@ -755,10 +735,12 @@ pf_free_src_nodes(struct pf_src_node_lis u_int count = 0; LIST_FOREACH_SAFE(sn, head, entry, tmp) { - pf_free_src_node(sn); + uma_zfree(V_pf_sources_z, sn); count++; } + counter_u64_add(V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS], count); + return (count); } @@ -1550,7 +1532,7 @@ pf_purge_expired_src_nodes() PF_HASHROW_LOCK(sh); LIST_FOREACH_SAFE(cur, &sh->nodes, entry, next) if (cur->states == 0 && cur->expire <= time_uptime) { - pf_unlink_src_node_locked(cur); + pf_unlink_src_node(cur); LIST_INSERT_HEAD(&freelist, cur, entry); } else if (cur->rule.ptr != NULL) cur->rule.ptr->rule_flag |= PFRULE_REFS; @@ -1565,27 +1547,31 @@ pf_purge_expired_src_nodes() static void pf_src_tree_remove_state(struct pf_state *s) { - u_int32_t timeout; + struct pf_src_node *sn; + struct pf_srchash *sh; + uint32_t timeout; + + timeout = s->rule.ptr->timeout[PFTM_SRC_NODE] ? + s->rule.ptr->timeout[PFTM_SRC_NODE] : + V_pf_default_rule.timeout[PFTM_SRC_NODE]; if (s->src_node != NULL) { + sn = s->src_node; + sh = &V_pf_srchash[pf_hashsrc(&sn->addr, sn->af)]; + PF_HASHROW_LOCK(sh); if (s->src.tcp_est) - --s->src_node->conn; - if (--s->src_node->states == 0) { - timeout = s->rule.ptr->timeout[PFTM_SRC_NODE]; - if (!timeout) - timeout = - V_pf_default_rule.timeout[PFTM_SRC_NODE]; - s->src_node->expire = time_uptime + timeout; - } + --sn->conn; + if (--sn->states == 0) + sn->expire = time_uptime + timeout; + PF_HASHROW_UNLOCK(sh); } if (s->nat_src_node != s->src_node && s->nat_src_node != NULL) { - if (--s->nat_src_node->states == 0) { - timeout = s->rule.ptr->timeout[PFTM_SRC_NODE]; - if (!timeout) - timeout = - V_pf_default_rule.timeout[PFTM_SRC_NODE]; - s->nat_src_node->expire = time_uptime + timeout; - } + sn = s->nat_src_node; + sh = &V_pf_srchash[pf_hashsrc(&sn->addr, sn->af)]; + PF_HASHROW_LOCK(sh); + if (--sn->states == 0) + sn->expire = time_uptime + timeout; + PF_HASHROW_UNLOCK(sh); } s->src_node = s->nat_src_node = NULL; } @@ -3571,15 +3557,12 @@ pf_create_state(struct pf_rule *r, struc s->creation = time_uptime; s->expire = time_uptime; - if (sn != NULL) { + if (sn != NULL) s->src_node = sn; - s->src_node->states++; - } if (nsn != NULL) { /* XXX We only modify one side for now. */ PF_ACPY(&nsn->raddr, &nk->addr[1], pd->af); s->nat_src_node = nsn; - s->nat_src_node->states++; } if (pd->proto == IPPROTO_TCP) { if ((pd->flags & PFDESC_TCP_NORM) && pf_normalize_tcp_init(m, @@ -3677,14 +3660,32 @@ csfailed: if (nk != NULL) uma_zfree(V_pf_state_key_z, nk); - if (sn != NULL && sn->states == 0 && sn->expire == 0) { - pf_unlink_src_node(sn); - pf_free_src_node(sn); + if (sn != NULL) { + struct pf_srchash *sh; + + sh = &V_pf_srchash[pf_hashsrc(&sn->addr, sn->af)]; + PF_HASHROW_LOCK(sh); + if (--sn->states == 0 && sn->expire == 0) { + pf_unlink_src_node(sn); + uma_zfree(V_pf_sources_z, sn); + counter_u64_add( + V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS], 1); + } + PF_HASHROW_UNLOCK(sh); } - if (nsn != sn && nsn != NULL && nsn->states == 0 && nsn->expire == 0) { - pf_unlink_src_node(nsn); - pf_free_src_node(nsn); + if (nsn != sn && nsn != NULL) { + struct pf_srchash *sh; + + sh = &V_pf_srchash[pf_hashsrc(&nsn->addr, nsn->af)]; + PF_HASHROW_LOCK(sh); + if (--nsn->states == 0 && nsn->expire == 0) { + pf_unlink_src_node(nsn); + uma_zfree(V_pf_sources_z, nsn); + counter_u64_add( + V_pf_status.scounters[SCNT_SRC_NODE_REMOVALS], 1); + } + PF_HASHROW_UNLOCK(sh); } return (PF_DROP); @@ -5911,13 +5912,14 @@ done: ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) { action = PF_DROP; REASON_SET(&reason, PFRES_MEMORY); + } else { + if (pqid || (pd.tos & IPTOS_LOWDELAY)) + pd.pf_mtag->qid = r->pqid; + else + pd.pf_mtag->qid = r->qid; + /* Add hints for ecn. */ + pd.pf_mtag->hdr = h; } - if (pqid || (pd.tos & IPTOS_LOWDELAY)) - pd.pf_mtag->qid = r->pqid; - else - pd.pf_mtag->qid = r->qid; - /* add hints for ecn */ - pd.pf_mtag->hdr = h; } #endif /* ALTQ */ @@ -5956,9 +5958,11 @@ done: log = 1; DPFPRINTF(PF_DEBUG_MISC, ("pf: failed to allocate tag\n")); + } else { + pd.pf_mtag->flags |= + PF_FASTFWD_OURS_PRESENT; + m->m_flags &= ~M_FASTFWD_OURS; } - pd.pf_mtag->flags |= PF_FASTFWD_OURS_PRESENT; - m->m_flags &= ~M_FASTFWD_OURS; } ip_divert_ptr(*m0, dir == PF_IN ? DIR_IN : DIR_OUT); *m0 = NULL; @@ -6340,13 +6344,14 @@ done: ((pd.pf_mtag = pf_get_mtag(m)) == NULL)) { action = PF_DROP; REASON_SET(&reason, PFRES_MEMORY); + } else { + if (pd.tos & IPTOS_LOWDELAY) + pd.pf_mtag->qid = r->pqid; + else + pd.pf_mtag->qid = r->qid; + /* Add hints for ecn. */ + pd.pf_mtag->hdr = h; } - if (pd.tos & IPTOS_LOWDELAY) - pd.pf_mtag->qid = r->pqid; - else - pd.pf_mtag->qid = r->qid; - /* add hints for ecn */ - pd.pf_mtag->hdr = h; } #endif /* ALTQ */ Modified: releng/10.2/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- releng/10.2/sys/netpfil/pf/pf_ioctl.c Wed Jul 29 14:07:43 2015 (r286013) +++ releng/10.2/sys/netpfil/pf/pf_ioctl.c Wed Jul 29 14:16:25 2015 (r286014) @@ -188,6 +188,7 @@ static volatile VNET_DEFINE(int, pf_pfil VNET_DEFINE(int, pf_end_threads); struct rwlock pf_rules_lock; +struct sx pf_ioctl_lock; /* pfsync */ pfsync_state_import_t *pfsync_state_import_ptr = NULL; @@ -1090,20 +1091,18 @@ pfioctl(struct cdev *dev, u_long cmd, ca switch (cmd) { case DIOCSTART: - PF_RULES_WLOCK(); + sx_xlock(&pf_ioctl_lock); if (V_pf_status.running) error = EEXIST; else { int cpu; - PF_RULES_WUNLOCK(); error = hook_pf(); if (error) { DPFPRINTF(PF_DEBUG_MISC, ("pf: pfil registration failed\n")); break; } - PF_RULES_WLOCK(); V_pf_status.running = 1; V_pf_status.since = time_second; @@ -1112,27 +1111,23 @@ pfioctl(struct cdev *dev, u_long cmd, ca DPFPRINTF(PF_DEBUG_MISC, ("pf: started\n")); } - PF_RULES_WUNLOCK(); break; case DIOCSTOP: - PF_RULES_WLOCK(); + sx_xlock(&pf_ioctl_lock); if (!V_pf_status.running) error = ENOENT; else { V_pf_status.running = 0; - PF_RULES_WUNLOCK(); error = dehook_pf(); if (error) { V_pf_status.running = 1; DPFPRINTF(PF_DEBUG_MISC, ("pf: pfil unregistration failed\n")); } - PF_RULES_WLOCK(); V_pf_status.since = time_second; DPFPRINTF(PF_DEBUG_MISC, ("pf: stopped\n")); } - PF_RULES_WUNLOCK(); break; case DIOCADDRULE: { @@ -3256,6 +3251,8 @@ DIOCCHANGEADDR_error: break; } fail: + if (sx_xlocked(&pf_ioctl_lock)) + sx_xunlock(&pf_ioctl_lock); CURVNET_RESTORE(); return (error); @@ -3433,7 +3430,7 @@ pf_kill_srcnodes(struct pfioc_src_node_k &psnk->psnk_dst.addr.v.a.addr, &psnk->psnk_dst.addr.v.a.mask, &sn->raddr, sn->af)) { - pf_unlink_src_node_locked(sn); + pf_unlink_src_node(sn); LIST_INSERT_HEAD(&kill, sn, entry); sn->expire = 1; } @@ -3446,18 +3443,10 @@ pf_kill_srcnodes(struct pfioc_src_node_k PF_HASHROW_LOCK(ih); LIST_FOREACH(s, &ih->states, entry) { - if (s->src_node && s->src_node->expire == 1) { -#ifdef INVARIANTS - s->src_node->states--; -#endif + if (s->src_node && s->src_node->expire == 1) s->src_node = NULL; - } - if (s->nat_src_node && s->nat_src_node->expire == 1) { -#ifdef INVARIANTS - s->nat_src_node->states--; -#endif + if (s->nat_src_node && s->nat_src_node->expire == 1) s->nat_src_node = NULL; - } } PF_HASHROW_UNLOCK(ih); } @@ -3728,6 +3717,7 @@ pf_load(void) VNET_LIST_RUNLOCK(); rw_init(&pf_rules_lock, "pf rulesets"); + sx_init(&pf_ioctl_lock, "pf ioctl"); pf_dev = make_dev(&pf_cdevsw, 0, 0, 0, 0600, PF_NAME); if ((error = pfattach()) != 0) @@ -3741,9 +3731,7 @@ pf_unload(void) { int error = 0; - PF_RULES_WLOCK(); V_pf_status.running = 0; - PF_RULES_WUNLOCK(); swi_remove(V_pf_swi_cookie); error = dehook_pf(); if (error) { @@ -3762,6 +3750,7 @@ pf_unload(void) wakeup_one(pf_purge_thread); rw_sleep(pf_purge_thread, &pf_rules_lock, 0, "pftmo", 0); } + PF_RULES_WUNLOCK(); pf_normalize_cleanup(); pfi_cleanup(); pfr_cleanup(); @@ -3769,9 +3758,9 @@ pf_unload(void) pf_cleanup(); if (IS_DEFAULT_VNET(curvnet)) pf_mtag_cleanup(); - PF_RULES_WUNLOCK(); destroy_dev(pf_dev); rw_destroy(&pf_rules_lock); + sx_destroy(&pf_ioctl_lock); return (error); } From owner-svn-src-all@freebsd.org Wed Jul 29 14:24:16 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B53DA9ADEE4 for ; Wed, 29 Jul 2015 14:24:16 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mail-pd0-f179.google.com (mail-pd0-f179.google.com [209.85.192.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7F8201F3A for ; Wed, 29 Jul 2015 14:24:16 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: by pdbbh15 with SMTP id bh15so6830672pdb.1 for ; Wed, 29 Jul 2015 07:24:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:message-id:references:to; bh=jTvarZ1r7W5Hdna1t0Y5T79itV0Tlrsi7cKb/M8Z0qE=; b=dOFVx21ZF37xJPfTtOLBUaX9JTiXaT6Fz8+U6Hd0SITt85STpLYe8eVOfjg8TWqsXu 6C+jfcBkNDzjU9woIvsRUYYKZ4JRhYfDTyPee8Vw3pzTTDNRsWTObjFrD2nDr36zsXco 4Ef3FWS53Ace9RLQCoFYR3/cuJGIPn3qz/Ue+SIl2CXrRLbWJ6L81i1yjYhKOiLxGNur sDNAh60CSRfHQf+Yt1HAPftjIQwPFh/rbOBkCr9NqOf1l0ruX/XDdJ+n15EydAwRhtP7 2xGupAyt6tk3C2nRXB+lH+sPPvODlYCdTUSefbFnrwqr5NWZxOJ3fT06fApbOJ4KL7sU 10MA== X-Gm-Message-State: ALoCoQkCRuViTGp64gOkiv+W5UkhLOrhXpbLFTod9z64Qv/4IvOg6eWcwVnOF1OUM8tQilnMbYXQ X-Received: by 10.70.93.36 with SMTP id cr4mr92282609pdb.68.1438179849792; Wed, 29 Jul 2015 07:24:09 -0700 (PDT) Received: from [10.64.26.97] ([69.53.236.236]) by smtp.gmail.com with ESMTPSA id t2sm41133471pdo.81.2015.07.29.07.24.07 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Jul 2015 07:24:08 -0700 (PDT) Sender: Warner Losh Subject: Re: svn commit: r285068 - in head/sys: conf modules/agp modules/geom/geom_part/geom_part_apm modules/geom/geom_part/geom_part_bsd modules/geom/geom_part/geom_part_bsd64 modules/geom/geom_part/geom_part... Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2102\)) Content-Type: multipart/signed; boundary="Apple-Mail=_29673326-E588-4BE3-9EF0-0D5BA2D35A67"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail 2.5 From: Warner Losh In-Reply-To: <55B8A8CA.90701@selasky.org> Date: Wed, 29 Jul 2015 08:24:06 -0600 Cc: =?utf-8?Q?Roger_Pau_Monn=C3=A9?= , Adrian Chadd , Warner Losh , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , Shani Michaeli Message-Id: <3414D44A-A22F-4693-9F84-A8E880C0B185@bsdimp.com> References: <201507030150.t631oRd0039490@repo.freebsd.org> <5596C188.10404@FreeBSD.org> <5596C7E7.5090700@FreeBSD.org> <68C8F69B-56DF-45C3-8DBB-40514CA48D85@bsdimp.com> <55B8A8CA.90701@selasky.org> To: Hans Petter Selasky X-Mailer: Apple Mail (2.2102) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 14:24:16 -0000 --Apple-Mail=_29673326-E588-4BE3-9EF0-0D5BA2D35A67 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jul 29, 2015, at 4:19 AM, Hans Petter Selasky = wrote: >=20 > On 07/03/15 22:15, Warner Losh wrote: >>=20 >>> On Jul 3, 2015, at 11:35 AM, Roger Pau Monn=C3=A9 = wrote: >>>=20 >>> El 03/07/15 a les 19.26, Adrian Chadd ha escrit: >>>> ok, so why's it make NFS builds so slow? >>>=20 >>> AFAICT it makes the build process spawn a bunch of concurrent "find" >>> processes that weren't previously there. >>=20 >> OK. I=E2=80=99ll fix it. I knew it might slow things down a little, = but this is quite a bit more than =E2=80=9Ca little=E2=80=9D. >>=20 >> Warner >>=20 >=20 > Hi, >=20 > Is there a fix for this issue yet? At Mellanox we're also seeing that = NFS mounted shares are extremely slow building even a single module. = Maybe the output from the find can be cached in a file somehow? Committed the fix within a day of this message (so three weeks ago): https://svnweb.freebsd.org/base?view=3Drevision&revision=3D285124 Is it not working? this is the first negative report I=E2=80=99ve heard = since Adrian and Roger posted. I spiked the test-build with a find that = recorded every time it ran. W/o the fix, it runs a lot. With the fix it = ran once. Is this not the case still? Warner --Apple-Mail=_29673326-E588-4BE3-9EF0-0D5BA2D35A67 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJVuOIHAAoJEGwc0Sh9sBEAlWsQAKbNnofPXfL6XQTY5VSVtVPS CfqsjTqqWFaeB+F0yQkH7DGi/V55YaCx5Ugh/AZPteFnhAE13D447D7HRgLE/aTr gFQUnXpmXFUg2r4+/BdS+27dKMBdeYpPmAf3U30sFhTPT4tQKnMm+4JqbIyURMJi hhDegcRlv7aXkt8CrusrO3z2hJe6JiWgVoakW7PG4hZFLX4VgSmu6dQ2Y7eWhEhV s7yNXVyOVSlSxZn4CNNHmVOQ5vL7YQgDQtbwMmHCHUD9rfB/a5/vl1mZhqj88SqT E1hCUYEsB7X8nGPkSzWtwe1u0bU5FAzrbwcotsfyQPY+z1U2qKtP0jocQXrAOL7c UVbk8SvGlAss/4N1e70rUKiyaRYNevifS3nEx67qvPtwt6rMBrZdkyOIMh8b5Qsr ltetGAfFPi2ns/LGG6y6O4/EYfUT6n4+flR0L1uakffAfZQM2xFemO21D9spUVDM Ha8MgjnKIowlqaS14wUqq3L2BWDLVrSJ98glxiNyqt5V6TMHE6dP8GE2pmhyjsh8 a4h85i9oLkxv7MYvCZ5QK1zibf4gL+5gqGaO09t3TBpf5ZEtJZdq0bJYxOEbi8if EizLUMIqypIUhxHnN5XRSwcP/6sqLDx62ef7+kiXVt1hGM655iEmT8pfTnpyv+G6 LzOm2GJQxuPY/KK1PW+U =ahPL -----END PGP SIGNATURE----- --Apple-Mail=_29673326-E588-4BE3-9EF0-0D5BA2D35A67-- From owner-svn-src-all@freebsd.org Wed Jul 29 15:05:49 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C110B9AE7AB; Wed, 29 Jul 2015 15:05:49 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebius.int.ru", Issuer "cell.glebius.int.ru" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 48E681501; Wed, 29 Jul 2015 15:05:48 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.9/8.14.9) with ESMTP id t6TF5it1006709 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 29 Jul 2015 18:05:45 +0300 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.9/8.14.9/Submit) id t6TF5ijE006706; Wed, 29 Jul 2015 18:05:44 +0300 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 29 Jul 2015 18:05:44 +0300 From: Gleb Smirnoff To: Ermal =?iso-8859-1?Q?Lu=E7i?= Cc: Olivier =?iso-8859-1?Q?Cochard-Labb=E9?= , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r285051 - head/sys/netinet Message-ID: <20150729150544.GM97401@FreeBSD.org> References: <201507021810.t62IAgCc003272@repo.freebsd.org> <20150728124220.GW72729@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 15:05:49 -0000 Ermal, On Wed, Jul 29, 2015 at 03:00:59PM +0200, Ermal Luçi wrote: E> > E> @@ -934,6 +950,7 @@ ip_forward(struct mbuf *m, int srcrt) E> > E> */ E> > E> if (!srcrt && ia == NULL) { E> > E> icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, 0, 0); E> > E> + RO_RTFREE(&ro); E> > E> return; E> > E> } E> > E> > Here the ifa reference is leaked upon return. E> > E> > E> Gleb, E> E> the improvement on the ifa_ref not needed is something to look at but the E> ifa_ref here is not lost since ia == NULL, no? E> Maybe i am missing something else. Sure you are right. Mea culpa. E> Also can we put this on a review? It is possible. Let's just wait for Olivier to return and ask him to do a benchmark :) -- Totus tuus, Glebius. From owner-svn-src-all@freebsd.org Wed Jul 29 15:33:02 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 645239AEDB2; Wed, 29 Jul 2015 15:33:02 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 42F32255; Wed, 29 Jul 2015 15:33:02 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TFX2Af000159; Wed, 29 Jul 2015 15:33:02 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TFX02i000151; Wed, 29 Jul 2015 15:33:00 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201507291533.t6TFX02i000151@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Wed, 29 Jul 2015 15:33:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286015 - in head/sys/mips: conf rmi rmi/dev/iic X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 15:33:02 -0000 Author: sbruno Date: Wed Jul 29 15:32:59 2015 New Revision: 286015 URL: https://svnweb.freebsd.org/changeset/base/286015 Log: Make Broadcom XLR use shared ds1374 RTC driver. Remove its identical and redundant ds1374u version. Differential Revision: D3225 Submitted by: kevin.bowling@kev009.com Deleted: head/sys/mips/rmi/dev/iic/ds1374u.c Modified: head/sys/mips/conf/XLR head/sys/mips/conf/XLR64 head/sys/mips/conf/XLRN32 head/sys/mips/rmi/files.xlr head/sys/mips/rmi/xlr_i2c.c Modified: head/sys/mips/conf/XLR ============================================================================== --- head/sys/mips/conf/XLR Wed Jul 29 14:16:25 2015 (r286014) +++ head/sys/mips/conf/XLR Wed Jul 29 15:32:59 2015 (r286015) @@ -135,7 +135,7 @@ device ic device iic device iicbb device iicbus -device ds1374u # RTC on XLR boards +device ds1374 # RTC on XLR boards device max6657 # Temparature sensor on XLR boards device at24co2n # EEPROM on XLR boards Modified: head/sys/mips/conf/XLR64 ============================================================================== --- head/sys/mips/conf/XLR64 Wed Jul 29 14:16:25 2015 (r286014) +++ head/sys/mips/conf/XLR64 Wed Jul 29 15:32:59 2015 (r286015) @@ -109,7 +109,7 @@ device ic device iic device iicbb device iicbus -device ds1374u # RTC on XLR boards +device ds1374 # RTC on XLR boards device max6657 # Temparature sensor on XLR boards device at24co2n # EEPROM on XLR boards Modified: head/sys/mips/conf/XLRN32 ============================================================================== --- head/sys/mips/conf/XLRN32 Wed Jul 29 14:16:25 2015 (r286014) +++ head/sys/mips/conf/XLRN32 Wed Jul 29 15:32:59 2015 (r286015) @@ -113,7 +113,7 @@ device ic device iic device iicbb device iicbus -device ds1374u # RTC on XLR boards +device ds1374 # RTC on XLR boards device max6657 # Temparature sensor on XLR boards device at24co2n # EEPROM on XLR boards Modified: head/sys/mips/rmi/files.xlr ============================================================================== --- head/sys/mips/rmi/files.xlr Wed Jul 29 14:16:25 2015 (r286014) +++ head/sys/mips/rmi/files.xlr Wed Jul 29 15:32:59 2015 (r286015) @@ -22,6 +22,5 @@ mips/rmi/dev/sec/rmisec.c optional rmi mips/rmi/dev/sec/rmilib.c optional rmisec mips/rmi/dev/xlr/rge.c optional rge mips/rmi/dev/nlge/if_nlge.c optional nlge -mips/rmi/dev/iic/ds1374u.c optional ds1374u mips/rmi/dev/iic/max6657.c optional max6657 mips/rmi/dev/iic/at24co2n.c optional at24co2n Modified: head/sys/mips/rmi/xlr_i2c.c ============================================================================== --- head/sys/mips/rmi/xlr_i2c.c Wed Jul 29 14:16:25 2015 (r286014) +++ head/sys/mips/rmi/xlr_i2c.c Wed Jul 29 15:32:59 2015 (r286015) @@ -187,7 +187,7 @@ xlr_i2c_attach(device_t dev) return -1; } if(xlr_board_info.xlr_i2c_device[I2C_RTC].enabled == 1) { - tmpd = device_add_child(sc->iicbus, "ds1374u", 0); + tmpd = device_add_child(sc->iicbus, "ds1374_rtc", 0); device_set_ivars(tmpd, &xlr_board_info.xlr_i2c_device[I2C_RTC]); } if(xlr_board_info.xlr_i2c_device[I2C_THERMAL].enabled == 1) { From owner-svn-src-all@freebsd.org Wed Jul 29 15:40:38 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D32289AEFAD; Wed, 29 Jul 2015 15:40:38 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "gold.funkthat.com", Issuer "gold.funkthat.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 93E468D5; Wed, 29 Jul 2015 15:40:38 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (localhost [127.0.0.1]) by gold.funkthat.com (8.14.5/8.14.5) with ESMTP id t6TFebvw007226 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 29 Jul 2015 08:40:37 -0700 (PDT) (envelope-from jmg@gold.funkthat.com) Received: (from jmg@localhost) by gold.funkthat.com (8.14.5/8.14.5/Submit) id t6TFebb9007225; Wed, 29 Jul 2015 08:40:37 -0700 (PDT) (envelope-from jmg) Date: Wed, 29 Jul 2015 08:40:37 -0700 From: John-Mark Gurney To: Ermal =?iso-8859-1?Q?Lu=E7i?= Cc: George Neville-Neil , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r286000 - head/sys/netipsec Message-ID: <20150729154036.GG78154@funkthat.com> References: <201507290715.t6T7FHGb094456@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 9.1-PRERELEASE amd64 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? User-Agent: Mutt/1.5.21 (2010-09-15) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (gold.funkthat.com [127.0.0.1]); Wed, 29 Jul 2015 08:40:37 -0700 (PDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 15:40:38 -0000 Ermal Lui wrote this message on Wed, Jul 29, 2015 at 14:53 +0200: > this was forgotten part on my patches merge from gnn@. > Can it be fixed by correcting the patches rather than re-introducing this? > > Most probably the constant definition is wrong on the transforms and also > some part of code removal was missed. No, it cannot be fixed by changing opencrypto/xform.c to truncate the hash size... The reason it cannot be is that OCF is not an IPsec only framework... Geli also uses the HMAC constructions, and I have not confirmed if they use the full hash size or not... I would be open to adding a field to the crypto descriptor that limited how much of the hash is copied out... It would have been helpful to comment more of these changes... If you make a change for a reason (RFC, etc), then throw that in the comments, which allows someone following to understand why and prevent their removal... At least if they were commented as to why they changed, we would have known to rework the change... > On Wed, Jul 29, 2015 at 9:15 AM, John-Mark Gurney wrote: > > > Author: jmg > > Date: Wed Jul 29 07:15:16 2015 > > New Revision: 286000 > > URL: https://svnweb.freebsd.org/changeset/base/286000 > > > > Log: > > RFC4868 section 2.3 requires that the output be half... This fixes > > problems that was introduced in r285336... I have verified that > > HMAC-SHA2-256 both ah only and w/ AES-CBC interoperate w/ a NetBSD > > 6.1.5 vm... > > > > Reviewed by: gnn -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-all@freebsd.org Wed Jul 29 15:42:23 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71E4F9AE0F1; Wed, 29 Jul 2015 15:42:23 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2ECD4C2B; Wed, 29 Jul 2015 15:42:23 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TFgNhG004284; Wed, 29 Jul 2015 15:42:23 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TFgNhc004283; Wed, 29 Jul 2015 15:42:23 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201507291542.t6TFgNhc004283@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 29 Jul 2015 15:42:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286016 - head/tools/build/options X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 15:42:23 -0000 Author: emaste Date: Wed Jul 29 15:42:22 2015 New Revision: 286016 URL: https://svnweb.freebsd.org/changeset/base/286016 Log: Include c++filt and readelf in WITHOUT_ELFTOOLCHAIN_TOOLS Modified: head/tools/build/options/WITHOUT_ELFTOOLCHAIN_TOOLS Modified: head/tools/build/options/WITHOUT_ELFTOOLCHAIN_TOOLS ============================================================================== --- head/tools/build/options/WITHOUT_ELFTOOLCHAIN_TOOLS Wed Jul 29 15:32:59 2015 (r286015) +++ head/tools/build/options/WITHOUT_ELFTOOLCHAIN_TOOLS Wed Jul 29 15:42:22 2015 (r286016) @@ -1,7 +1,9 @@ .\" $FreeBSD$ Set to use .Xr addr2line 1 , +.Xr c++filt 1 , .Xr nm 1 , +.Xr readelf 1 , .Xr size 1 , .Xr strings 1 , and From owner-svn-src-all@freebsd.org Wed Jul 29 15:44:53 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82F289AE1B0; Wed, 29 Jul 2015 15:44:53 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3F8A0E89; Wed, 29 Jul 2015 15:44:51 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 266421FE022; Wed, 29 Jul 2015 17:44:50 +0200 (CEST) Message-ID: <55B8F547.2010008@selasky.org> Date: Wed, 29 Jul 2015 17:46:15 +0200 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Warner Losh CC: =?UTF-8?B?Um9nZXIgUGF1IE1vbm7DqQ==?= , Adrian Chadd , Warner Losh , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , Shani Michaeli Subject: Re: svn commit: r285068 - in head/sys: conf modules/agp modules/geom/geom_part/geom_part_apm modules/geom/geom_part/geom_part_bsd modules/geom/geom_part/geom_part_bsd64 modules/geom/geom_part/geom_part... References: <201507030150.t631oRd0039490@repo.freebsd.org> <5596C188.10404@FreeBSD.org> <5596C7E7.5090700@FreeBSD.org> <68C8F69B-56DF-45C3-8DBB-40514CA48D85@bsdimp.com> <55B8A8CA.90701@selasky.org> <3414D44A-A22F-4693-9F84-A8E880C0B185@bsdimp.com> In-Reply-To: <3414D44A-A22F-4693-9F84-A8E880C0B185@bsdimp.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 15:44:53 -0000 On 07/29/15 16:24, Warner Losh wrote: > >> On Jul 29, 2015, at 4:19 AM, Hans Petter Selasky wrote: >> >> On 07/03/15 22:15, Warner Losh wrote: >>> >>>> On Jul 3, 2015, at 11:35 AM, Roger Pau MonnĂ© wrote: >>>> >>>> El 03/07/15 a les 19.26, Adrian Chadd ha escrit: >>>>> ok, so why's it make NFS builds so slow? >>>> >>>> AFAICT it makes the build process spawn a bunch of concurrent "find" >>>> processes that weren't previously there. >>> >>> OK. I’ll fix it. I knew it might slow things down a little, but this is quite a bit more than “a little”. >>> >>> Warner >>> >> >> Hi, >> >> Is there a fix for this issue yet? At Mellanox we're also seeing that NFS mounted shares are extremely slow building even a single module. Maybe the output from the find can be cached in a file somehow? > > Committed the fix within a day of this message (so three weeks ago): > > https://svnweb.freebsd.org/base?view=revision&revision=285124 > > Is it not working? this is the first negative report I’ve heard since Adrian and Roger posted. I spiked the test-build with a find that recorded every time it ran. W/o the fix, it runs a lot. With the fix it ran once. Is this not the case still? Hi, In this particular case one "find of /sys" takes 11-16 seconds over NFS, so building a single KMOD takes 16 seconds too. It's not possible to eliminate the find entirely during repeated builds? --HPS From owner-svn-src-all@freebsd.org Wed Jul 29 16:37:37 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09D5C9AC393; Wed, 29 Jul 2015 16:37:37 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE7302794; Wed, 29 Jul 2015 16:37:36 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TGbalt027066; Wed, 29 Jul 2015 16:37:36 GMT (envelope-from brueffer@FreeBSD.org) Received: (from brueffer@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TGba5m027065; Wed, 29 Jul 2015 16:37:36 GMT (envelope-from brueffer@FreeBSD.org) Message-Id: <201507291637.t6TGba5m027065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brueffer set sender to brueffer@FreeBSD.org using -f From: Christian Brueffer Date: Wed, 29 Jul 2015 16:37:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286017 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 16:37:37 -0000 Author: brueffer Date: Wed Jul 29 16:37:36 2015 New Revision: 286017 URL: https://svnweb.freebsd.org/changeset/base/286017 Log: Remove the AUTHORS section until it's clear who exactly wrote the driver. Modified: head/share/man/man4/pms.4 Modified: head/share/man/man4/pms.4 ============================================================================== --- head/share/man/man4/pms.4 Wed Jul 29 15:42:22 2015 (r286016) +++ head/share/man/man4/pms.4 Wed Jul 29 16:37:36 2015 (r286017) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 23, 2015 +.Dd July 29, 2015 .Dt PMS 4 .Os .Sh NAME @@ -124,5 +124,3 @@ The .Nm device driver first appeared in .Fx 10.2 . -.Sh AUTHORS -.An Achim Leubner Aq Mt Achim.Leubner@pmcs.com From owner-svn-src-all@freebsd.org Wed Jul 29 16:40:50 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 060179AC487; Wed, 29 Jul 2015 16:40:50 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EA2DC2A00; Wed, 29 Jul 2015 16:40:49 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TGenRr028450; Wed, 29 Jul 2015 16:40:49 GMT (envelope-from brueffer@FreeBSD.org) Received: (from brueffer@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TGenb1028447; Wed, 29 Jul 2015 16:40:49 GMT (envelope-from brueffer@FreeBSD.org) Message-Id: <201507291640.t6TGenb1028447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brueffer set sender to brueffer@FreeBSD.org using -f From: Christian Brueffer Date: Wed, 29 Jul 2015 16:40:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286018 - stable/10/share/man/man4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 16:40:50 -0000 Author: brueffer Date: Wed Jul 29 16:40:48 2015 New Revision: 286018 URL: https://svnweb.freebsd.org/changeset/base/286018 Log: MFC: r285858, r286017 Add a basic manpage for the pms driver. Added: stable/10/share/man/man4/pms.4 - copied, changed from r285858, head/share/man/man4/pms.4 Modified: stable/10/share/man/man4/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/Makefile ============================================================================== --- stable/10/share/man/man4/Makefile Wed Jul 29 16:37:36 2015 (r286017) +++ stable/10/share/man/man4/Makefile Wed Jul 29 16:40:48 2015 (r286018) @@ -382,6 +382,7 @@ MAN= aac.4 \ ${_pflog.4} \ ${_pfsync.4} \ pim.4 \ + pms.4 \ polling.4 \ ppbus.4 \ ppc.4 \ Copied and modified: stable/10/share/man/man4/pms.4 (from r285858, head/share/man/man4/pms.4) ============================================================================== --- head/share/man/man4/pms.4 Fri Jul 24 21:48:53 2015 (r285858, copy source) +++ stable/10/share/man/man4/pms.4 Wed Jul 29 16:40:48 2015 (r286018) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 23, 2015 +.Dd July 29, 2015 .Dt PMS 4 .Os .Sh NAME @@ -124,5 +124,3 @@ The .Nm device driver first appeared in .Fx 10.2 . -.Sh AUTHORS -.An Achim Leubner Aq Mt Achim.Leubner@pmcs.com From owner-svn-src-all@freebsd.org Wed Jul 29 16:45:47 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E52309AC750; Wed, 29 Jul 2015 16:45:47 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-ig0-x22c.google.com (mail-ig0-x22c.google.com [IPv6:2607:f8b0:4001:c05::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B20952F50; Wed, 29 Jul 2015 16:45:47 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by igr7 with SMTP id 7so150028600igr.0; Wed, 29 Jul 2015 09:45:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=R3PDnHJNR3Lt19UeT/rbnJ20EbifOQXjraOoKantk/c=; b=iOLCzVkFh3BPaFQlzjyKoufEhE2ykFbRggTpGrWlkzEYHlbopyLSr0MSzEZqntpXL1 t+T4Gnx7L1at8zTxnQZyImItvApHbFG/AHNY7dQFkCSyWQu3NPYh1jrSVY7mQwOo/kgu J4KyWBV7JWK7xKgEg6mX4j69EtUGfHO/P1lQQERwsEUWn5zjA6RAltRnQT3unzXZNOgj eRkycaTvH5Rja0L2HUaQBhODqrhDo2KqlmQMI30SfhAZGWzRRM6v1T9L3JKviix2ZLyQ TIV7bhzhWkZrKFjkI2FLMUMgL/hFebIH/78uSZ9kDI1VBEjZBdyRtBGdKrjzUgrUspus 5zFA== MIME-Version: 1.0 X-Received: by 10.50.40.42 with SMTP id u10mr7221565igk.71.1438188347045; Wed, 29 Jul 2015 09:45:47 -0700 (PDT) Sender: chmeeedalf@gmail.com Received: by 10.36.121.149 with HTTP; Wed, 29 Jul 2015 09:45:46 -0700 (PDT) In-Reply-To: <201507291336.t6TDaIbn051458@repo.freebsd.org> References: <201507291336.t6TDaIbn051458@repo.freebsd.org> Date: Wed, 29 Jul 2015 09:45:46 -0700 X-Google-Sender-Auth: 64DymN13AmEA3kMgfmXlILIF7VU Message-ID: Subject: Re: svn commit: r286010 - head/usr.bin/ar From: Justin Hibbits To: Ed Maste Cc: src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 16:45:48 -0000 This breaks ports building. When building ports-mgmt/pkg: ar: fatal: Option -D is not permitted in mode -x - Justin On Wed, Jul 29, 2015 at 6:36 AM, Ed Maste wrote: > Author: emaste > Date: Wed Jul 29 13:36:17 2015 > New Revision: 286010 > URL: https://svnweb.freebsd.org/changeset/base/286010 > > Log: > ar: enable deterministic mode by default > > Ar cannot handle UIDs with more than 6 digits, and storing the mtime, > uid, gid and mode provides little to negative value anyhow for ar's > uses. Turn on deterministic (-D) mode by default; it can be disabled by > the user with -U. > > PR: 196929 > Relnotes: Yes > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D3190 > > Modified: > head/usr.bin/ar/ar.1 > head/usr.bin/ar/ar.c > > Modified: head/usr.bin/ar/ar.1 > ============================================================================== > --- head/usr.bin/ar/ar.1 Wed Jul 29 13:14:34 2015 (r286009) > +++ head/usr.bin/ar/ar.1 Wed Jul 29 13:36:17 2015 (r286010) > @@ -210,6 +210,7 @@ and 0644 instead of file mode from the m > .Ar . > This ensures that checksums on the resulting archives are reproducible > when member contents are identical. > +This option is enabled by default. > If multiple > .Fl D > and > > Modified: head/usr.bin/ar/ar.c > ============================================================================== > --- head/usr.bin/ar/ar.c Wed Jul 29 13:14:34 2015 (r286009) > +++ head/usr.bin/ar/ar.c Wed Jul 29 13:36:17 2015 (r286010) > @@ -104,6 +104,8 @@ main(int argc, char **argv) > > bsdar = &bsdar_storage; > memset(bsdar, 0, sizeof(*bsdar)); > + /* Enable deterministic mode by default. */ > + bsdar->options |= AR_D; > > if ((bsdar->progname = getprogname()) == NULL) > bsdar->progname = "ar"; > From owner-svn-src-all@freebsd.org Wed Jul 29 16:48:30 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 24BCF9AC887; Wed, 29 Jul 2015 16:48:30 +0000 (UTC) (envelope-from gnn@neville-neil.com) Received: from smtp.hungerhost.com (smtp.hungerhost.com [216.38.53.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EFF586B3; Wed, 29 Jul 2015 16:48:29 +0000 (UTC) (envelope-from gnn@neville-neil.com) Received: from pool-108-54-164-204.nycmny.fios.verizon.net ([108.54.164.204]:51609 helo=[192.168.1.11]) by vps.hungerhost.com with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.85) (envelope-from ) id 1ZKUWo-0000vW-Pe; Wed, 29 Jul 2015 12:48:26 -0400 From: "George Neville-Neil" To: "Gleb Smirnoff" Cc: "Ermal =?utf-8?q?Lu=C3=A7i?=" , "Olivier =?utf-8?q?Cochard-Labb=C3=A9?=" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r285051 - head/sys/netinet Date: Wed, 29 Jul 2015 12:48:15 -0400 Message-ID: In-Reply-To: <20150729150544.GM97401@FreeBSD.org> References: <201507021810.t62IAgCc003272@repo.freebsd.org> <20150728124220.GW72729@FreeBSD.org> <20150729150544.GM97401@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Mailer: MailMate (1.9.2r5107) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vps.hungerhost.com X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - neville-neil.com X-Get-Message-Sender-Via: vps.hungerhost.com: authenticated_id: gnn@neville-neil.com X-Source: X-Source-Args: X-Source-Dir: X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 16:48:30 -0000 On 29 Jul 2015, at 11:05, Gleb Smirnoff wrote: > Ermal, > > On Wed, Jul 29, 2015 at 03:00:59PM +0200, Ermal Luçi wrote: > E> > E> @@ -934,6 +950,7 @@ ip_forward(struct mbuf *m, int srcrt) > E> > E> */ > E> > E> if (!srcrt && ia == NULL) { > E> > E> icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, 0, > 0); > E> > E> + RO_RTFREE(&ro); > E> > E> return; > E> > E> } > E> > > E> > Here the ifa reference is leaked upon return. > E> > > E> > > E> Gleb, > E> > E> the improvement on the ifa_ref not needed is something to look at > but the > E> ifa_ref here is not lost since ia == NULL, no? > E> Maybe i am missing something else. > > Sure you are right. Mea culpa. > > E> Also can we put this on a review? > > It is possible. Let's just wait for Olivier to return and ask him to > do a benchmark :) > Olivier isnt' the only one that can do a benchmark. I can chuck this up in the Sentex lab, that's what it's for. Give me a brief outline and I'll code something up in Conductor. Best, George From owner-svn-src-all@freebsd.org Wed Jul 29 16:59:07 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C6FC39ACBA2 for ; Wed, 29 Jul 2015 16:59:07 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mail-pd0-f177.google.com (mail-pd0-f177.google.com [209.85.192.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8B1CC103F for ; Wed, 29 Jul 2015 16:59:07 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: by pdjr16 with SMTP id r16so9023682pdj.3 for ; Wed, 29 Jul 2015 09:59:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:message-id:references:to; bh=adm2fAJHd63GVZk7VkfAzKrIne+FI4wPS9e9ymwj0vQ=; b=Nf9s8JqHo+RZKpGLCS18frB8s6ZFLdqA7RlBijmbfh163+mxhpfyBkEdf9kg1Vl7fw pgYz/CsiSJCFu3/Rps0NCYX0BZf7Cbqfh8HMLVqNFOcRvTehrkakgYW/4moVNZB3RaPq arVN32aho7IWj33RB1ZfHPDe9H/qDW0gOEKBaUUm0vhIy46cFwfjWhQDA8AN29Pmdpg1 JgXYc7onFKuEUs24J5xG5T0R7zIN0/o7z2KmFIUTu8kOf+xT1UL5Lsfi+ZS4grqU9tG9 gIg9YbwtD3mPY1gUDOz2EZtQPk+3PX511DDHGKBk32Mg16AybYJ3JebcVPIhYe0tBqSd /92g== X-Gm-Message-State: ALoCoQmy2U40eJMP2TPrZSY+ue/Y35v/LDrnKNN7SGXGo8TBJldgNhMrKX2/JV2gfJqoaohkIt/V X-Received: by 10.70.39.74 with SMTP id n10mr95458937pdk.57.1438189145953; Wed, 29 Jul 2015 09:59:05 -0700 (PDT) Received: from [10.64.26.97] ([69.53.236.236]) by smtp.gmail.com with ESMTPSA id j9sm36280560pdl.65.2015.07.29.09.59.03 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Jul 2015 09:59:05 -0700 (PDT) Sender: Warner Losh Subject: Re: svn commit: r285068 - in head/sys: conf modules/agp modules/geom/geom_part/geom_part_apm modules/geom/geom_part/geom_part_bsd modules/geom/geom_part/geom_part_bsd64 modules/geom/geom_part/geom_part... Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2102\)) Content-Type: multipart/signed; boundary="Apple-Mail=_AC997849-22F2-4471-800E-1E8AC318E927"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail 2.5 From: Warner Losh In-Reply-To: <55B8F547.2010008@selasky.org> Date: Wed, 29 Jul 2015 10:59:02 -0600 Cc: =?utf-8?Q?Roger_Pau_Monn=C3=A9?= , Adrian Chadd , Warner Losh , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , Shani Michaeli Message-Id: <2779441E-E53E-4DB4-84CF-36A0CFCB4C08@bsdimp.com> References: <201507030150.t631oRd0039490@repo.freebsd.org> <5596C188.10404@FreeBSD.org> <5596C7E7.5090700@FreeBSD.org> <68C8F69B-56DF-45C3-8DBB-40514CA48D85@bsdimp.com> <55B8A8CA.90701@selasky.org> <3414D44A-A22F-4693-9F84-A8E880C0B185@bsdimp.com> <55B8F547.2010008@selasky.org> To: Hans Petter Selasky X-Mailer: Apple Mail (2.2102) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 16:59:07 -0000 --Apple-Mail=_AC997849-22F2-4471-800E-1E8AC318E927 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jul 29, 2015, at 9:46 AM, Hans Petter Selasky = wrote: >=20 > On 07/29/15 16:24, Warner Losh wrote: >>=20 >>> On Jul 29, 2015, at 4:19 AM, Hans Petter Selasky = wrote: >>>=20 >>> On 07/03/15 22:15, Warner Losh wrote: >>>>=20 >>>>> On Jul 3, 2015, at 11:35 AM, Roger Pau Monn=C3=A9 = wrote: >>>>>=20 >>>>> El 03/07/15 a les 19.26, Adrian Chadd ha escrit: >>>>>> ok, so why's it make NFS builds so slow? >>>>>=20 >>>>> AFAICT it makes the build process spawn a bunch of concurrent = "find" >>>>> processes that weren't previously there. >>>>=20 >>>> OK. I=E2=80=99ll fix it. I knew it might slow things down a little, = but this is quite a bit more than =E2=80=9Ca little=E2=80=9D. >>>>=20 >>>> Warner >>>>=20 >>>=20 >>> Hi, >>>=20 >>> Is there a fix for this issue yet? At Mellanox we're also seeing = that NFS mounted shares are extremely slow building even a single = module. Maybe the output from the find can be cached in a file somehow? >>=20 >> Committed the fix within a day of this message (so three weeks ago): >>=20 >> https://svnweb.freebsd.org/base?view=3Drevision&revision=3D285124 >>=20 >> Is it not working? this is the first negative report I=E2=80=99ve = heard since Adrian and Roger posted. I spiked the test-build with a find = that recorded every time it ran. W/o the fix, it runs a lot. With the = fix it ran once. Is this not the case still? >=20 > Hi, >=20 > In this particular case one "find of /sys" takes 11-16 seconds over = NFS, so building a single KMOD takes 16 seconds too. It's not possible = to eliminate the find entirely during repeated builds? 16 seconds? That=E2=80=99s a really slow NFS server and at least 11 = seconds longer than it should take :(. Make doesn=E2=80=99t really have the ability to cache results = run-to-run, but I=E2=80=99ll poke at other options. In the mean time, = you can do something like: setenv _MPATH `(cd $MAKEOBJDIRPREFIX/path/sys/GENERIC; make -V = _MPATH)` to cache the value. Not ideal, but likely good enough for repeated = module builds. If I can=E2=80=99t come up with anything clever, I=E2=80=99= ll just commit the current list=E2=80=A6 I hate doing that, but I also = hadn=E2=80=99t counted upon find taking so stinkin=E2=80=99 long... Warner --Apple-Mail=_AC997849-22F2-4471-800E-1E8AC318E927 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJVuQZXAAoJEGwc0Sh9sBEADogP/1XKaPQLCihfGhisydpSkBvv rSM3CZmAPEN5B3e3XhIXd52llEQCRGz6AYP1qsA8La0xozCE72RMmfIC3JRILRGU VjjcsNoj0P7zogCuPOv7ULfqYhTDLZijH/kEBaaUYYzbLKNxxr0bKjWVABSg8SvI v8CgEHOywMVpfJ3dKWnlCAPJ+d7OtSO66TWOOvfKfxtiP+Y3enVRYY/5adWM725g QO6Iiru2kxwXdQc7sEli0t/Y6IxnbIm7yH4bQ2eRVVoibQcG1MyOuOJ36PX3QHhe NW2kCrcEZibXE/S4Sob0zMd0uPLjjCuSnSli9pAhympTyll6pitGYR3UPG3uy0CJ P8F47kLmzMJF0FeDaWbmuCXf/4vaIOlK3CReFqvsj0Bx2tgIJaJnIAY221ac3gll F0fiislge597vd4JJZIfcRNYvWfa2bAvovNTPXM4LzzUTl/33ILaqB0R+jX+HwaA J3xNzjYPchYKIbiB45XldoIymdxOiBIc0TnEqiVv9aH0Prm7lH9i4cE8MjFJsNN1 oxBDhfBW8ncBzcXq7+OahNoIYpNpDmJuVuCZ+BkBVfhTulEnt8Xk9oCIp7qRPmFH xSSRSqAg3YubPZuWKjbV2pAnIx5QH9r8RALTCg3j9fCZZn7WGanYHYnhjSsqMo+p aJ/1aKGZnpHKgNVXSAXh =12Oc -----END PGP SIGNATURE----- --Apple-Mail=_AC997849-22F2-4471-800E-1E8AC318E927-- From owner-svn-src-all@freebsd.org Wed Jul 29 17:02:33 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 365449ACDD3 for ; Wed, 29 Jul 2015 17:02:33 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mail-pd0-f180.google.com (mail-pd0-f180.google.com [209.85.192.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0A08818F1 for ; Wed, 29 Jul 2015 17:02:32 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: by pdrg1 with SMTP id g1so8940997pdr.2 for ; Wed, 29 Jul 2015 10:02:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:message-id:references:to; bh=PkGOQE/SK7uk4+XhLwNNLbz8pXjWh3dTvlxv67BUMmg=; b=M2vNKvg8t2iO6sahFkdkTs4UliorjjN7NzGKR1Sk1lgL24LyHvGyeoi0MMX0otG8AE UhsqRzBvq/kedff9YJvkyZ3BCm+SV07mJqv7DrsNIpa43xEH0YCQ9k5kMfto5j24raFz ZQ3fy/9K+CqdXXCoyG4IYICIL+w3YWvDJzPvrrEFZG2TqhWnqtTogxa79ZRIhRQ/cbe6 ffO2hzaakZT+THvUMrb29c9pfMbg8SKwvxZ5paejiYyGXheKMufVahhn3cDQpKZfFFWE tmHLAx53SocFOSkjdWuqWPrEkJoKbLCQKbIn3U6JF9LicEiEjuRexerRKOq9r6IfU0Zy Lddw== X-Gm-Message-State: ALoCoQl3YFzDuEaBvVa6Iw0ua03Qg3PcQdYRkCpXVFN/Cfy0JF87NyqTePpLm1OKmhO//oyZAJOT X-Received: by 10.70.56.33 with SMTP id x1mr95746270pdp.47.1438189352196; Wed, 29 Jul 2015 10:02:32 -0700 (PDT) Received: from [10.64.26.97] ([69.53.236.236]) by smtp.gmail.com with ESMTPSA id v8sm41715163pdm.89.2015.07.29.10.02.30 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Jul 2015 10:02:31 -0700 (PDT) Sender: Warner Losh Subject: Re: svn commit: r284345 - in head: . bin/cat bin/chflags bin/chio bin/chmod bin/cp bin/csh bin/date bin/dd bin/df bin/domainname bin/echo bin/ed bin/expr bin/freebsd-version bin/getfacl bin/hostname bi... Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2102\)) Content-Type: multipart/signed; boundary="Apple-Mail=_4F737D03-5B4B-4F30-8D1D-E45AE9DA639F"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail 2.5 From: Warner Losh In-Reply-To: <20150726204948.GD1522@ivaldir.etoilebsd.net> Date: Wed, 29 Jul 2015 11:02:29 -0600 Cc: "Simon J. Gerraty" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: References: <201506131920.t5DJKwMH033508@svn.freebsd.org> <20150726204948.GD1522@ivaldir.etoilebsd.net> To: Baptiste Daroussin X-Mailer: Apple Mail (2.2102) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 17:02:33 -0000 --Apple-Mail=_4F737D03-5B4B-4F30-8D1D-E45AE9DA639F Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Jul 26, 2015, at 2:49 PM, Baptiste Daroussin = wrote: >=20 > On Sat, Jun 13, 2015 at 07:20:58PM +0000, Simon J. Gerraty wrote: >> Author: sjg >> Date: Sat Jun 13 19:20:56 2015 >> New Revision: 284345 >> URL: https://svnweb.freebsd.org/changeset/base/284345 >>=20 >> Log: >> Add META_MODE support. >>=20 >> Off by default, build behaves normally. >> WITH_META_MODE we get auto objdir creation, the ability to >> start build from anywhere in the tree. >>=20 >> Still need to add real targets under targets/ to build packages. >>=20 >> Differential Revision: D2796 >> Reviewed by: brooks imp >=20 > This breaks using fmake from ports because of usage of :U in sys.mk >=20 > fmake has to be supported until 9 is EOLed otherwise this is a major = pain for > all developers, having the ability to use fmake allows people to = ensure syntax > is compatible with FreeBSD 9 (not that I'm just speaking about sys.mk = not other > parts) It looks like this fixes things. Anybody have any objections to it? We = can kill it when we EOL FreeBSD 9 here in a bit. https://reviews.freebsd.org/D3228 Warner --Apple-Mail=_4F737D03-5B4B-4F30-8D1D-E45AE9DA639F Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJVuQclAAoJEGwc0Sh9sBEAiVgP/iYGfLT3g+PNF8oPUk7hSepY mjQNeFaBnm6rszDGPoiDF+zGWc0Y9KmvsbTAQ7AnhH0kzhBRrNFRKL2X8KxrarXe t0D2Vt1nqqZLF6jTQMOm76xKbF0bJANy3Ajs2UhCR7zEZrHtjFUAQvqVRzJP825A zly06L8WkNnLpMtGl+k01cpf3s9za29tBMgMOsIYeUonkcHQvPd/2EqwGQVWYqNH VanOrHzPSkW8NMzgPMR2TLEwlQ9tSXbFM7LV0gxkhpozkN5NpN2Ql5H4pt+SK0PJ a0EuuEGE1CrzQcwKXWt5vCZvLXlEKNW39oj45URLPKwFS2tbDbnvoEiUp909FShd PN5LiDLbOJp7NXVmahPJZCE019MPBmoalaTQXA6hZZ2ex91RUwchojlLYhD5cg15 2LpA+mFYM7Li3Q6a5zG4GqKBjne9H0N25B200T+URBsHitfbDDLA6glv8JcGOfTx A/rffISxtRnynGWNPAJQsfrv9ByvfDga0csCFjNQL7GVUQ8tsbxvXpIhsVCDk3pT xwHA1OhQbzKHy3HIpHjzPhIfZaIvBMtV/xEKDyy9fKq4klvMoRrPjm1HtGmUFoo4 TurJ84qswB22gTJOyOYQRr/1jlHOTktK0gXLtGUeEhtw+QFd+DzReAXX8D03H2VN f2AAYj6+h8b8sGB+m7Lw =ka8m -----END PGP SIGNATURE----- --Apple-Mail=_4F737D03-5B4B-4F30-8D1D-E45AE9DA639F-- From owner-svn-src-all@freebsd.org Wed Jul 29 17:05:43 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E37C09ACFB2; Wed, 29 Jul 2015 17:05:43 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D336F1BEA; Wed, 29 Jul 2015 17:05:43 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TH5heG040573; Wed, 29 Jul 2015 17:05:43 GMT (envelope-from brueffer@FreeBSD.org) Received: (from brueffer@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TH5heQ040572; Wed, 29 Jul 2015 17:05:43 GMT (envelope-from brueffer@FreeBSD.org) Message-Id: <201507291705.t6TH5heQ040572@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brueffer set sender to brueffer@FreeBSD.org using -f From: Christian Brueffer Date: Wed, 29 Jul 2015 17:05:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286019 - stable/10/release/doc/en_US.ISO8859-1/hardware X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 17:05:44 -0000 Author: brueffer Date: Wed Jul 29 17:05:42 2015 New Revision: 286019 URL: https://svnweb.freebsd.org/changeset/base/286019 Log: MFC: r285859 Auto-generate hardware notes for pms(4). Modified: stable/10/release/doc/en_US.ISO8859-1/hardware/article.xml Directory Properties: stable/10/ (props changed) Modified: stable/10/release/doc/en_US.ISO8859-1/hardware/article.xml ============================================================================== --- stable/10/release/doc/en_US.ISO8859-1/hardware/article.xml Wed Jul 29 16:40:48 2015 (r286018) +++ stable/10/release/doc/en_US.ISO8859-1/hardware/article.xml Wed Jul 29 17:05:42 2015 (r286019) @@ -765,6 +765,8 @@ &hwlist.nsp; + &hwlist.pms; + &hwlist.pst; &hwlist.siis; From owner-svn-src-all@freebsd.org Wed Jul 29 17:11:44 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A85569AE176; Wed, 29 Jul 2015 17:11:44 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io0-x22e.google.com (mail-io0-x22e.google.com [IPv6:2607:f8b0:4001:c06::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 79F8C117; Wed, 29 Jul 2015 17:11:44 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by ioea135 with SMTP id a135so28140289ioe.1; Wed, 29 Jul 2015 10:11:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=U1ijMlDZhdXc7OejlmdF0z68UI6Th7dtDzJ5PZDh6JU=; b=rJqJ9F0/EFYecXUmubxkMygv7dqMW+n/y50w6wT7kGvOIGWn/pCkTug0v3CwgXu5N7 oglynPR5IRwdQ7pp/Cvzdj9q14avmX34phfa3RYzJsIY2ZJ1pJm1XVlufiFtq39WeyDs E/CoHvGsrD/LXzL0Egf5WnMgcjadUhpUhdCKZcCz8/a6VHco/k0vd1Hp+9wHOQRYO1Rw Bw/m0T+0/QF5I43P1n4ELUoBE1v2fG3S9A1zpODlJPyOJn3r560iTLrTcZRSNXqWwTk5 B8nrxtRkThh9ibwOloraCnFJASZYuQ1484LlzPrXlCL1uNil/QiUVMb1WGPMkeS3maAt kysw== X-Received: by 10.107.47.152 with SMTP id v24mr3438007iov.180.1438189903915; Wed, 29 Jul 2015 10:11:43 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.136.200 with HTTP; Wed, 29 Jul 2015 10:11:24 -0700 (PDT) In-Reply-To: References: <201507291336.t6TDaIbn051458@repo.freebsd.org> From: Ed Maste Date: Wed, 29 Jul 2015 13:11:24 -0400 X-Google-Sender-Auth: uPyNXb333fad1upYhC5fbO5tARU Message-ID: Subject: Re: svn commit: r286010 - head/usr.bin/ar To: Justin Hibbits Cc: src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 17:11:44 -0000 >> Author: emaste >> Date: Wed Jul 29 13:36:17 2015 >> New Revision: 286010 >> URL: https://svnweb.freebsd.org/changeset/base/286010 >> >> Log: >> ar: enable deterministic mode by default > > This breaks ports building. When building ports-mgmt/pkg: > > ar: fatal: Option -D is not permitted in mode -x Indeed, sorry about that. A possible fix in review: https://reviews.freebsd.org/D3237 From owner-svn-src-all@freebsd.org Wed Jul 29 17:15:45 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 208AA9AE24A; Wed, 29 Jul 2015 17:15:45 +0000 (UTC) (envelope-from ermal.luci@gmail.com) Received: from mail-yk0-x22a.google.com (mail-yk0-x22a.google.com [IPv6:2607:f8b0:4002:c07::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CDD36325; Wed, 29 Jul 2015 17:15:44 +0000 (UTC) (envelope-from ermal.luci@gmail.com) Received: by ykay190 with SMTP id y190so13353479yka.3; Wed, 29 Jul 2015 10:15:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=+nJBlHuwcyaeIxIVE440ivrs+PqYXCCfQJb5aHBYbLo=; b=L+yGVKJK/QUiUGkyFl0qkrvKaL0EVqZsQkRRPTYrk1/Zb8H3VVWf4JwsYqyAJRMs6q 8+mOjP2qvn9u/Sfz0TjqOWTC+vUAA+oouNYe+PXdtfyt6GtbrTPEzSVBA8zMJuuh5JCm ogxFcVcAXdLAk48LouSsGvSzhJBgyHdYsgMXNtgZx8463WBGcA0iQD5XsblcjlPl5Y9f MrCh+FmJ/VSpe+mDOYfuGovLWU8CXtdIo5lctRhZS8YgQq6A73z+BR9L1S9Tk5EY7Y8l MzLGH3YKQ8S1uOI4WFvPjn/Wil529Mi4Lpfd5LmhqrqDzMdhnHKH/DjbaJ0jVWnY10GL pamg== MIME-Version: 1.0 X-Received: by 10.170.198.144 with SMTP id p138mr45384882yke.70.1438190144071; Wed, 29 Jul 2015 10:15:44 -0700 (PDT) Sender: ermal.luci@gmail.com Received: by 10.129.83.139 with HTTP; Wed, 29 Jul 2015 10:15:44 -0700 (PDT) In-Reply-To: References: <201507021810.t62IAgCc003272@repo.freebsd.org> <20150728124220.GW72729@FreeBSD.org> <20150729150544.GM97401@FreeBSD.org> Date: Wed, 29 Jul 2015 19:15:44 +0200 X-Google-Sender-Auth: pNwg4G_KbBFpe6AJlpUAYyVMBl0 Message-ID: Subject: Re: svn commit: r285051 - head/sys/netinet From: =?UTF-8?Q?Ermal_Lu=C3=A7i?= To: George Neville-Neil Cc: Gleb Smirnoff , =?UTF-8?Q?Olivier_Cochard=2DLabb=C3=A9?= , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 17:15:45 -0000 On Wed, Jul 29, 2015 at 6:48 PM, George Neville-Neil wrote: > > > On 29 Jul 2015, at 11:05, Gleb Smirnoff wrote: > > Ermal, >> >> On Wed, Jul 29, 2015 at 03:00:59PM +0200, Ermal Lu=C3=A7i wrote: >> E> > E> @@ -934,6 +950,7 @@ ip_forward(struct mbuf *m, int srcrt) >> E> > E> */ >> E> > E> if (!srcrt && ia =3D=3D NULL) { >> E> > E> icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, 0, 0= ); >> E> > E> + RO_RTFREE(&ro); >> E> > E> return; >> E> > E> } >> E> > >> E> > Here the ifa reference is leaked upon return. >> E> > >> E> > >> E> Gleb, >> E> >> E> the improvement on the ifa_ref not needed is something to look at but >> the >> E> ifa_ref here is not lost since ia =3D=3D NULL, no? >> E> Maybe i am missing something else. >> >> Sure you are right. Mea culpa. >> >> E> Also can we put this on a review? >> >> It is possible. Let's just wait for Olivier to return and ask him to >> do a benchmark :) >> >> > Olivier isnt' the only one that can do a benchmark. I can chuck this up > in the > Sentex lab, that's what it's for. Give me a brief outline and I'll code > something > up in Conductor. > The outline is simple. Just forwarding performance in terms of PPS for normal forwarding with the patch suggested from Gleb builtin. pmcstat data would be useful as well during this bench :) > > Best, > George > --=20 Ermal From owner-svn-src-all@freebsd.org Wed Jul 29 17:16:55 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7B1489AE287; Wed, 29 Jul 2015 17:16:55 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5296477B; Wed, 29 Jul 2015 17:16:55 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6THGtAv044687; Wed, 29 Jul 2015 17:16:55 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6THGsqF044685; Wed, 29 Jul 2015 17:16:54 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201507291716.t6THGsqF044685@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Wed, 29 Jul 2015 17:16:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286020 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 17:16:55 -0000 Author: ed Date: Wed Jul 29 17:16:53 2015 New Revision: 286020 URL: https://svnweb.freebsd.org/changeset/base/286020 Log: Introduce falloc_caps() to create descriptors with capabilties in place. falloc_noinstall() followed by finstall() allows you to create and install file descriptors with custom capabilities. Add falloc_caps() that can do both of these actions in one go. This will be used by CloudABI to create pipes with custom capabilities. Reviewed by: mjg Modified: head/sys/kern/kern_descrip.c head/sys/sys/filedesc.h Modified: head/sys/kern/kern_descrip.c ============================================================================== --- head/sys/kern/kern_descrip.c Wed Jul 29 17:05:42 2015 (r286019) +++ head/sys/kern/kern_descrip.c Wed Jul 29 17:16:53 2015 (r286020) @@ -1707,7 +1707,8 @@ fdallocn(struct thread *td, int minfd, i * release the FILEDESC lock. */ int -falloc(struct thread *td, struct file **resultfp, int *resultfd, int flags) +falloc_caps(struct thread *td, struct file **resultfp, int *resultfd, int flags, + struct filecaps *fcaps) { struct file *fp; int error, fd; @@ -1716,7 +1717,7 @@ falloc(struct thread *td, struct file ** if (error) return (error); /* no reference held on error */ - error = finstall(td, fp, &fd, flags, NULL); + error = finstall(td, fp, &fd, flags, fcaps); if (error) { fdrop(fp, td); /* one reference (fp only) */ return (error); Modified: head/sys/sys/filedesc.h ============================================================================== --- head/sys/sys/filedesc.h Wed Jul 29 17:05:42 2015 (r286019) +++ head/sys/sys/filedesc.h Wed Jul 29 17:16:53 2015 (r286020) @@ -146,6 +146,10 @@ enum { /* Flags for kern_dup(). */ #define FDDUP_FLAG_CLOEXEC 0x1 /* Atomically set UF_EXCLOSE. */ +/* For backward compatibility. */ +#define falloc(td, resultfp, resultfd, flags) \ + falloc_caps(td, resultfp, resultfd, flags, NULL) + struct thread; void filecaps_init(struct filecaps *fcaps); @@ -156,8 +160,8 @@ void filecaps_free(struct filecaps *fcap int closef(struct file *fp, struct thread *td); int dupfdopen(struct thread *td, struct filedesc *fdp, int dfd, int mode, int openerror, int *indxp); -int falloc(struct thread *td, struct file **resultfp, int *resultfd, - int flags); +int falloc_caps(struct thread *td, struct file **resultfp, int *resultfd, + int flags, struct filecaps *fcaps); int falloc_noinstall(struct thread *td, struct file **resultfp); void _finstall(struct filedesc *fdp, struct file *fp, int fd, int flags, struct filecaps *fcaps); From owner-svn-src-all@freebsd.org Wed Jul 29 17:17:10 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B27B99AE2B9; Wed, 29 Jul 2015 17:17:10 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5B11C8C4; Wed, 29 Jul 2015 17:17:09 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 8E8121FE022; Wed, 29 Jul 2015 19:17:08 +0200 (CEST) Message-ID: <55B90AEA.2040806@selasky.org> Date: Wed, 29 Jul 2015 19:18:34 +0200 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Warner Losh CC: =?UTF-8?B?Um9nZXIgUGF1IE1vbm7DqQ==?= , Adrian Chadd , Warner Losh , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , Shani Michaeli Subject: Re: svn commit: r285068 - in head/sys: conf modules/agp modules/geom/geom_part/geom_part_apm modules/geom/geom_part/geom_part_bsd modules/geom/geom_part/geom_part_bsd64 modules/geom/geom_part/geom_part... References: <201507030150.t631oRd0039490@repo.freebsd.org> <5596C188.10404@FreeBSD.org> <5596C7E7.5090700@FreeBSD.org> <68C8F69B-56DF-45C3-8DBB-40514CA48D85@bsdimp.com> <55B8A8CA.90701@selasky.org> <3414D44A-A22F-4693-9F84-A8E880C0B185@bsdimp.com> <55B8F547.2010008@selasky.org> <2779441E-E53E-4DB4-84CF-36A0CFCB4C08@bsdimp.com> In-Reply-To: <2779441E-E53E-4DB4-84CF-36A0CFCB4C08@bsdimp.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 17:17:10 -0000 On 07/29/15 18:59, Warner Losh wrote: > >> On Jul 29, 2015, at 9:46 AM, Hans Petter Selasky wrote: >> >> On 07/29/15 16:24, Warner Losh wrote: >>> >>>> On Jul 29, 2015, at 4:19 AM, Hans Petter Selasky wrote: >>>> >>>> On 07/03/15 22:15, Warner Losh wrote: >>>>> >>>>>> On Jul 3, 2015, at 11:35 AM, Roger Pau Monné wrote: >>>>>> >>>>>> El 03/07/15 a les 19.26, Adrian Chadd ha escrit: >>>>>>> ok, so why's it make NFS builds so slow? >>>>>> >>>>>> AFAICT it makes the build process spawn a bunch of concurrent "find" >>>>>> processes that weren't previously there. >>>>> >>>>> OK. I’ll fix it. I knew it might slow things down a little, but this is quite a bit more than “a little”. >>>>> >>>>> Warner >>>>> >>>> >>>> Hi, >>>> >>>> Is there a fix for this issue yet? At Mellanox we're also seeing that NFS mounted shares are extremely slow building even a single module. Maybe the output from the find can be cached in a file somehow? >>> >>> Committed the fix within a day of this message (so three weeks ago): >>> >>> https://svnweb.freebsd.org/base?view=revision&revision=285124 >>> >>> Is it not working? this is the first negative report I’ve heard since Adrian and Roger posted. I spiked the test-build with a find that recorded every time it ran. W/o the fix, it runs a lot. With the fix it ran once. Is this not the case still? >> >> Hi, >> >> In this particular case one "find of /sys" takes 11-16 seconds over NFS, so building a single KMOD takes 16 seconds too. It's not possible to eliminate the find entirely during repeated builds? > > 16 seconds? That’s a really slow NFS server and at least 11 seconds longer than it should take :(. Hi, I think it is a local NFS caching issue. Else it would be faster. BTW: I think I see a small typo there: > Index: kmod.mk > =================================================================== > --- kmod.mk (revision 286002) > +++ kmod.mk (working copy) > @@ -361,7 +361,7 @@ > .endif > .PATH.m: ${_MPATH} > .for _s in ${SRCS:M*_if.[ch]} > -.if eixsts(${_s:R}.m}) > +.if exists(${_s:R}.m}) > CLEANFILES+= ${_s} > .endif > .endfor # _s > > Make doesn’t really have the ability to cache results run-to-run, but I’ll poke at other options. In the mean time, you can do something like: > setenv _MPATH `(cd $MAKEOBJDIRPREFIX/path/sys/GENERIC; make -V _MPATH)` I'll pass it on. > to cache the value. Not ideal, but likely good enough for repeated module builds. If I can’t come up with anything clever, I’ll just commit the current list… > I hate doing that, but I also hadn’t counted upon find taking so stinkin’ long... I think "find" is fine, tough maybe store the result in a file or something which is checked into the svn .... --HPS From owner-svn-src-all@freebsd.org Wed Jul 29 17:18:30 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37AF29AE306; Wed, 29 Jul 2015 17:18:30 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 27A23A44; Wed, 29 Jul 2015 17:18:30 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6THIUYF044800; Wed, 29 Jul 2015 17:18:30 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6THIS52044796; Wed, 29 Jul 2015 17:18:28 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201507291718.t6THIS52044796@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Wed, 29 Jul 2015 17:18:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286021 - in head/sys: compat/cloudabi compat/linux kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 17:18:30 -0000 Author: ed Date: Wed Jul 29 17:18:27 2015 New Revision: 286021 URL: https://svnweb.freebsd.org/changeset/base/286021 Log: Make pipes in CloudABI work. Summary: Pipes in CloudABI are unidirectional. The reason for this is that CloudABI attempts to provide a uniform runtime environment across different flavours of UNIX. Instead of implementing a custom pipe that is unidirectional, we can simply reuse Capsicum permission bits to support this. This is nice, because CloudABI already attempts to restrict permission bits to correspond with the operations that apply to a certain file descriptor. Replace kern_pipe() and kern_pipe2() by a single kern_pipe() that takes a pair of filecaps. These filecaps are passed to the newly introduced falloc_caps() function that creates the descriptors with rights in place. Test Plan: CloudABI pipes seem to be created with proper rights in place: https://github.com/NuxiNL/cloudlibc/blob/master/src/libc/unistd/pipe_test.c#L44 Reviewers: jilles, mjg Reviewed By: mjg Subscribers: imp Differential Revision: https://reviews.freebsd.org/D3236 Modified: head/sys/compat/cloudabi/cloudabi_fd.c head/sys/compat/linux/linux_file.c head/sys/kern/sys_pipe.c head/sys/sys/syscallsubr.h Modified: head/sys/compat/cloudabi/cloudabi_fd.c ============================================================================== --- head/sys/compat/cloudabi/cloudabi_fd.c Wed Jul 29 17:16:53 2015 (r286020) +++ head/sys/compat/cloudabi/cloudabi_fd.c Wed Jul 29 17:18:27 2015 (r286021) @@ -120,10 +120,24 @@ int cloudabi_sys_fd_create2(struct thread *td, struct cloudabi_sys_fd_create2_args *uap) { + struct filecaps fcaps1 = {}, fcaps2 = {}; int fds[2]; int error; switch (uap->type) { + case CLOUDABI_FILETYPE_FIFO: + /* + * CloudABI pipes are unidirectional. Restrict rights on + * the pipe to simulate this. + */ + cap_rights_init(&fcaps1.fc_rights, CAP_EVENT, CAP_FCNTL, + CAP_FSTAT, CAP_READ); + fcaps1.fc_fcntls = CAP_FCNTL_SETFL; + cap_rights_init(&fcaps2.fc_rights, CAP_EVENT, CAP_FCNTL, + CAP_FSTAT, CAP_WRITE); + fcaps2.fc_fcntls = CAP_FCNTL_SETFL; + error = kern_pipe(td, fds, 0, &fcaps1, &fcaps2); + break; case CLOUDABI_FILETYPE_SOCKET_DGRAM: error = kern_socketpair(td, AF_UNIX, SOCK_DGRAM, 0, fds); break; Modified: head/sys/compat/linux/linux_file.c ============================================================================== --- head/sys/compat/linux/linux_file.c Wed Jul 29 17:16:53 2015 (r286020) +++ head/sys/compat/linux/linux_file.c Wed Jul 29 17:18:27 2015 (r286021) @@ -1582,7 +1582,7 @@ linux_pipe(struct thread *td, struct lin printf(ARGS(pipe, "*")); #endif - error = kern_pipe2(td, fildes, 0); + error = kern_pipe(td, fildes, 0, NULL, NULL); if (error) return (error); @@ -1609,7 +1609,7 @@ linux_pipe2(struct thread *td, struct li flags |= O_NONBLOCK; if ((args->flags & LINUX_O_CLOEXEC) != 0) flags |= O_CLOEXEC; - error = kern_pipe2(td, fildes, flags); + error = kern_pipe(td, fildes, flags, NULL, NULL); if (error) return (error); Modified: head/sys/kern/sys_pipe.c ============================================================================== --- head/sys/kern/sys_pipe.c Wed Jul 29 17:16:53 2015 (r286020) +++ head/sys/kern/sys_pipe.c Wed Jul 29 17:18:27 2015 (r286021) @@ -397,14 +397,8 @@ pipe_dtor(struct pipe *dpipe) * the zone pick up the pieces via pipeclose(). */ int -kern_pipe(struct thread *td, int fildes[2]) -{ - - return (kern_pipe2(td, fildes, 0)); -} - -int -kern_pipe2(struct thread *td, int fildes[2], int flags) +kern_pipe(struct thread *td, int fildes[2], int flags, struct filecaps *fcaps1, + struct filecaps *fcaps2) { struct file *rf, *wf; struct pipe *rpipe, *wpipe; @@ -414,13 +408,13 @@ kern_pipe2(struct thread *td, int fildes pipe_paircreate(td, &pp); rpipe = &pp->pp_rpipe; wpipe = &pp->pp_wpipe; - error = falloc(td, &rf, &fd, flags); + error = falloc_caps(td, &rf, &fd, flags, fcaps1); if (error) { pipeclose(rpipe); pipeclose(wpipe); return (error); } - /* An extra reference on `rf' has been held for us by falloc(). */ + /* An extra reference on `rf' has been held for us by falloc_caps(). */ fildes[0] = fd; fflags = FREAD | FWRITE; @@ -434,7 +428,7 @@ kern_pipe2(struct thread *td, int fildes * side while we are blocked trying to allocate the write side. */ finit(rf, fflags, DTYPE_PIPE, rpipe, &pipeops); - error = falloc(td, &wf, &fd, flags); + error = falloc_caps(td, &wf, &fd, flags, fcaps2); if (error) { fdclose(td, rf, fildes[0]); fdrop(rf, td); @@ -442,7 +436,7 @@ kern_pipe2(struct thread *td, int fildes pipeclose(wpipe); return (error); } - /* An extra reference on `wf' has been held for us by falloc(). */ + /* An extra reference on `wf' has been held for us by falloc_caps(). */ finit(wf, fflags, DTYPE_PIPE, wpipe, &pipeops); fdrop(wf, td); fildes[1] = fd; @@ -458,7 +452,7 @@ sys_pipe(struct thread *td, struct pipe_ int error; int fildes[2]; - error = kern_pipe(td, fildes); + error = kern_pipe(td, fildes, 0, NULL, NULL); if (error) return (error); @@ -475,7 +469,7 @@ sys_pipe2(struct thread *td, struct pipe if (uap->flags & ~(O_CLOEXEC | O_NONBLOCK)) return (EINVAL); - error = kern_pipe2(td, fildes, uap->flags); + error = kern_pipe(td, fildes, uap->flags, NULL, NULL); if (error) return (error); error = copyout(fildes, uap->fildes, 2 * sizeof(int)); Modified: head/sys/sys/syscallsubr.h ============================================================================== --- head/sys/sys/syscallsubr.h Wed Jul 29 17:16:53 2015 (r286020) +++ head/sys/sys/syscallsubr.h Wed Jul 29 17:18:27 2015 (r286021) @@ -35,6 +35,7 @@ #include struct file; +struct filecaps; enum idtype; struct itimerval; struct image_args; @@ -150,8 +151,8 @@ int kern_openat(struct thread *td, int f enum uio_seg pathseg, int flags, int mode); int kern_pathconf(struct thread *td, char *path, enum uio_seg pathseg, int name, u_long flags); -int kern_pipe(struct thread *td, int fildes[2]); -int kern_pipe2(struct thread *td, int fildes[2], int flags); +int kern_pipe(struct thread *td, int fildes[2], int flags, + struct filecaps *fcaps1, struct filecaps *fcaps2); int kern_poll(struct thread *td, struct pollfd *fds, u_int nfds, struct timespec *tsp, sigset_t *uset); int kern_posix_fadvise(struct thread *td, int fd, off_t offset, off_t len, From owner-svn-src-all@freebsd.org Wed Jul 29 17:23:21 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 880B19AE472; Wed, 29 Jul 2015 17:23:21 +0000 (UTC) (envelope-from ermal.luci@gmail.com) Received: from mail-yk0-x22f.google.com (mail-yk0-x22f.google.com [IPv6:2607:f8b0:4002:c07::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3F6D0FA4; Wed, 29 Jul 2015 17:23:21 +0000 (UTC) (envelope-from ermal.luci@gmail.com) Received: by ykba194 with SMTP id a194so13665301ykb.0; Wed, 29 Jul 2015 10:23:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=o3rfOeQCBgK8YhQbKC/HqowXlO5swI9eXVndo6IoWT8=; b=LDAOl69ecm0GWocyo9K5hvQVY1kPImNI/JeknDTpjg6x1lLMbrD/DPXak+y49bYcyE 6LDicvCXQnnJVHZJ0N6pmj5tpQFaxK+tnfFqNzLMdSegH4wgr9D9UkmY4NOsBDXFbPw8 VOYt3C3wRb65ekBy5SopyYJmuDT124Z+f+/czv/RDfoIdEi83gozJ7B3L3W6JyXG8aOz q8QpBrzzKRGvM1TCGC10Ra+oEn8tjsgwtiTzwuoyAP8L5CsXxjXpCW37BdhXuaOi6URG xZbgMDjxAn/twJ2ySiUQL55wpeKauWq0GptPUGNI0j5ibvkyxzGlJIC8zIfYYG/4TIB1 aP+A== MIME-Version: 1.0 X-Received: by 10.170.150.7 with SMTP id r7mr45845759ykc.48.1438190600227; Wed, 29 Jul 2015 10:23:20 -0700 (PDT) Sender: ermal.luci@gmail.com Received: by 10.129.83.139 with HTTP; Wed, 29 Jul 2015 10:23:20 -0700 (PDT) In-Reply-To: <20150729154036.GG78154@funkthat.com> References: <201507290715.t6T7FHGb094456@repo.freebsd.org> <20150729154036.GG78154@funkthat.com> Date: Wed, 29 Jul 2015 19:23:20 +0200 X-Google-Sender-Auth: LgyKWPwELnSzmEQYN-398X_PHbI Message-ID: Subject: Re: svn commit: r286000 - head/sys/netipsec From: =?UTF-8?Q?Ermal_Lu=C3=A7i?= To: John-Mark Gurney Cc: George Neville-Neil , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 17:23:21 -0000 On Wed, Jul 29, 2015 at 5:40 PM, John-Mark Gurney wrote: > Ermal Lui wrote this message on Wed, Jul 29, 2015 at 14:53 +0200: > > this was forgotten part on my patches merge from gnn@. > > Can it be fixed by correcting the patches rather than re-introducing > this? > > > > Most probably the constant definition is wrong on the transforms and also > > some part of code removal was missed. > > No, it cannot be fixed by changing opencrypto/xform.c to truncate the > hash size... The reason it cannot be is that OCF is not an IPsec only > framework... > > Geli also uses the HMAC constructions, and I have not confirmed if they > use the full hash size or not... I would be open to adding a field to > the crypto descriptor that limited how much of the hash is copied out... > > It would have been helpful to comment more of these changes... If you > make a change for a reason (RFC, etc), then throw that in the comments, > which allows someone following to understand why and prevent their > removal... At least if they were commented as to why they changed, we > would have known to rework the change... > > Yes you are right but according to me this is standard practice being done allover SSL/IPSec.... I am not sure which standard GELI follows to comment on that! Also then it would be better to review the declarations on the transform since they are apparently not generic, no? > > On Wed, Jul 29, 2015 at 9:15 AM, John-Mark Gurney > wrote: > > > > > Author: jmg > > > Date: Wed Jul 29 07:15:16 2015 > > > New Revision: 286000 > > > URL: https://svnweb.freebsd.org/changeset/base/286000 > > > > > > Log: > > > RFC4868 section 2.3 requires that the output be half... This fixes > > > problems that was introduced in r285336... I have verified that > > > HMAC-SHA2-256 both ah only and w/ AES-CBC interoperate w/ a NetBSD > > > 6.1.5 vm... > > > > > > Reviewed by: gnn > > -- > John-Mark Gurney Voice: +1 415 225 5579 > > "All that I will do, has been done, All that I have, has not." > -- Ermal From owner-svn-src-all@freebsd.org Wed Jul 29 17:25:19 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 842629AE4DD; Wed, 29 Jul 2015 17:25:19 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6800F1136; Wed, 29 Jul 2015 17:25:19 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6THPJCL048730; Wed, 29 Jul 2015 17:25:19 GMT (envelope-from brueffer@FreeBSD.org) Received: (from brueffer@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6THPIqh048728; Wed, 29 Jul 2015 17:25:18 GMT (envelope-from brueffer@FreeBSD.org) Message-Id: <201507291725.t6THPIqh048728@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brueffer set sender to brueffer@FreeBSD.org using -f From: Christian Brueffer Date: Wed, 29 Jul 2015 17:25:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r286022 - releng/10.2/share/man/man4 X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 17:25:19 -0000 Author: brueffer Date: Wed Jul 29 17:25:18 2015 New Revision: 286022 URL: https://svnweb.freebsd.org/changeset/base/286022 Log: MFC: r285858, r286017 Add a basic manpage for the pms driver. Approved by: re (gjb) Added: releng/10.2/share/man/man4/pms.4 - copied unchanged from r286018, stable/10/share/man/man4/pms.4 Modified: releng/10.2/share/man/man4/Makefile Directory Properties: releng/10.2/ (props changed) Modified: releng/10.2/share/man/man4/Makefile ============================================================================== --- releng/10.2/share/man/man4/Makefile Wed Jul 29 17:18:27 2015 (r286021) +++ releng/10.2/share/man/man4/Makefile Wed Jul 29 17:25:18 2015 (r286022) @@ -382,6 +382,7 @@ MAN= aac.4 \ ${_pflog.4} \ ${_pfsync.4} \ pim.4 \ + pms.4 \ polling.4 \ ppbus.4 \ ppc.4 \ Copied: releng/10.2/share/man/man4/pms.4 (from r286018, stable/10/share/man/man4/pms.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ releng/10.2/share/man/man4/pms.4 Wed Jul 29 17:25:18 2015 (r286022, copy of r286018, stable/10/share/man/man4/pms.4) @@ -0,0 +1,126 @@ +.\" Copyright (c) 2015 Christian Brueffer +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd July 29, 2015 +.Dt PMS 4 +.Os +.Sh NAME +.Nm pms +.Nd "PMC-Sierra PM8001/8081/8088/8089/8074/8076/8077 SAS/SATA HBA Controller driver" +.Sh SYNOPSIS +To compile the driver into the kernel, +place the following line in the +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device pms" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +pms_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for the PMC-Sierra PM8001/8081/8088/8089/8074/8076/8077 +range of SAS/SATA HBA controllers. +.Sh HARDWARE +The +.Nm +driver supports the following hardware: +.Pp +.Bl -bullet -compact +.It +Tachyon TS Fibre Channel Card +.It +Tachyon TL Fibre Channel Card +.It +Tachyon XL2 Fibre Channel Card +.It +Tachyon DX2 Fibre Channel Card +.It +Tachyon DX2+ Fibre Channel Card +.It +Tachyon DX4+ Fibre Channel Card +.It +Tachyon QX2 Fibre Channel Card +.It +Tachyon QX4 Fibre Channel Card +.It +Tachyon DE4 Fibre Channel Card +.It +Tachyon QE4 Fibre Channel Card +.It +Tachyon XL10 Fibre Channel Card +.It +PMC Sierra SPC SAS-SATA Card +.It +PMC Sierra SPC-V SAS-SATA Card +.It +PMC Sierra SPC-VE SAS-SATA Card +.It +PMC Sierra SPC-V 16 Port SAS-SATA Card +.It +PMC Sierra SPC-VE 16 Port SAS-SATA Card +.It +PMC Sierra SPC-V SAS-SATA Card 12Gig +.It +PMC Sierra SPC-VE SAS-SATA Card 12Gig +.It +PMC Sierra SPC-V 16 Port SAS-SATA Card 12Gig +.It +PMC Sierra SPC-VE 16 Port SAS-SATA Card 12Gig +.It +Adaptec Hialeah 4/8 Port SAS-SATA HBA Card 6Gig +.It +Adaptec Hialeah 4/8 Port SAS-SATA RAID Card 6Gig +.It +Adaptec Hialeah 8/16 Port SAS-SATA HBA Card 6Gig +.It +Adaptec Hialeah 8/16 Port SAS-SATA RAID Card 6Gig +.It +Adaptec Hialeah 8/16 Port SAS-SATA HBA Encryption Card 6Gig +.It +Adaptec Hialeah 8/16 Port SAS-SATA RAID Encryption Card 6Gig +.It +Adaptec Delray 8 Port SAS-SATA HBA Card 12Gig +.It +Adaptec Delray 8 Port SAS-SATA HBA Encryption Card 12Gig +.It +Adaptec Delray 16 Port SAS-SATA HBA Card 12Gig +.It +Adaptec Delray 16 Port SAS-SATA HBA Encryption Card 12Gig +.El +.Sh SEE ALSO +.Xr cam 4 , +.Xr camcontrol 8 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 10.2 . From owner-svn-src-all@freebsd.org Wed Jul 29 17:28:05 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 484589AE51D; Wed, 29 Jul 2015 17:28:05 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3841313DC; Wed, 29 Jul 2015 17:28:05 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6THS5hC048923; Wed, 29 Jul 2015 17:28:05 GMT (envelope-from brueffer@FreeBSD.org) Received: (from brueffer@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6THS5Zb048922; Wed, 29 Jul 2015 17:28:05 GMT (envelope-from brueffer@FreeBSD.org) Message-Id: <201507291728.t6THS5Zb048922@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brueffer set sender to brueffer@FreeBSD.org using -f From: Christian Brueffer Date: Wed, 29 Jul 2015 17:28:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r286023 - releng/10.2/release/doc/en_US.ISO8859-1/hardware X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 17:28:05 -0000 Author: brueffer Date: Wed Jul 29 17:28:04 2015 New Revision: 286023 URL: https://svnweb.freebsd.org/changeset/base/286023 Log: MFC: r285859 (via r286019) Auto-generate hardware notes for pms(4). Approved by: re (gjb) Modified: releng/10.2/release/doc/en_US.ISO8859-1/hardware/article.xml Directory Properties: releng/10.2/ (props changed) Modified: releng/10.2/release/doc/en_US.ISO8859-1/hardware/article.xml ============================================================================== --- releng/10.2/release/doc/en_US.ISO8859-1/hardware/article.xml Wed Jul 29 17:25:18 2015 (r286022) +++ releng/10.2/release/doc/en_US.ISO8859-1/hardware/article.xml Wed Jul 29 17:28:04 2015 (r286023) @@ -765,6 +765,8 @@ &hwlist.nsp; + &hwlist.pms; + &hwlist.pst; &hwlist.siis; From owner-svn-src-all@freebsd.org Wed Jul 29 17:34:27 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A46B9AE6C6; Wed, 29 Jul 2015 17:34:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 617E01A33; Wed, 29 Jul 2015 17:34:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6THYRHc053014; Wed, 29 Jul 2015 17:34:27 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6THYRjB053013; Wed, 29 Jul 2015 17:34:27 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201507291734.t6THYRjB053013@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 29 Jul 2015 17:34:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286024 - head/usr.bin/ar X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 17:34:27 -0000 Author: emaste Date: Wed Jul 29 17:34:26 2015 New Revision: 286024 URL: https://svnweb.freebsd.org/changeset/base/286024 Log: ar: Fix deterministic mode default with options other than -q or -r Reported by: jhibbits Reviewed by: jhibbits Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3237 Modified: head/usr.bin/ar/ar.c Modified: head/usr.bin/ar/ar.c ============================================================================== --- head/usr.bin/ar/ar.c Wed Jul 29 17:28:04 2015 (r286023) +++ head/usr.bin/ar/ar.c Wed Jul 29 17:34:26 2015 (r286024) @@ -100,12 +100,12 @@ main(int argc, char **argv) struct bsdar *bsdar, bsdar_storage; char *p; size_t len; - int i, opt; + int i, opt, Dflag, Uflag; bsdar = &bsdar_storage; memset(bsdar, 0, sizeof(*bsdar)); - /* Enable deterministic mode by default. */ - bsdar->options |= AR_D; + Dflag = 0; + Uflag = 0; if ((bsdar->progname = getprogname()) == NULL) bsdar->progname = "ar"; @@ -122,10 +122,12 @@ main(int argc, char **argv) /* Ignored. */ break; case 'D': - bsdar->options |= AR_D; + Dflag = 1; + Uflag = 0; break; case 'U': - bsdar->options &= ~AR_D; + Uflag = 1; + Dflag = 0; break; case 'V': ranlib_version(); @@ -182,7 +184,8 @@ main(int argc, char **argv) set_mode(bsdar, opt); break; case 'D': - bsdar->options |= AR_D; + Dflag = 1; + Uflag = 0; break; case 'f': case 'T': @@ -222,7 +225,8 @@ main(int argc, char **argv) set_mode(bsdar, opt); break; case 'U': - bsdar->options &= ~AR_D; + Uflag = 1; + Dflag = 0; break; case 'u': bsdar->options |= AR_U; @@ -275,6 +279,10 @@ main(int argc, char **argv) argv++; } + /* Set determinstic mode for -D, and by default without -U. */ + if (Dflag || (Uflag == 0 && (bsdar->mode == 'q' || bsdar->mode == 'r'))) + bsdar->options |= AR_D; + if (bsdar->options & AR_A) only_mode(bsdar, "-a", "mqr"); if (bsdar->options & AR_B) @@ -283,8 +291,10 @@ main(int argc, char **argv) only_mode(bsdar, "-c", "qr"); if (bsdar->options & AR_CC) only_mode(bsdar, "-C", "x"); - if (bsdar->options & AR_D) + if (Dflag) only_mode(bsdar, "-D", "qr"); + if (Uflag) + only_mode(bsdar, "-U", "qr"); if (bsdar->options & AR_O) only_mode(bsdar, "-o", "x"); if (bsdar->options & AR_SS) From owner-svn-src-all@freebsd.org Wed Jul 29 17:46:17 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 701649AE8FE; Wed, 29 Jul 2015 17:46:17 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 469D01EEF; Wed, 29 Jul 2015 17:46:17 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6THkHKO057139; Wed, 29 Jul 2015 17:46:17 GMT (envelope-from eri@FreeBSD.org) Received: (from eri@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6THkH8v057138; Wed, 29 Jul 2015 17:46:17 GMT (envelope-from eri@FreeBSD.org) Message-Id: <201507291746.t6THkH8v057138@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eri set sender to eri@FreeBSD.org using -f From: Ermal Luçi Date: Wed, 29 Jul 2015 17:46:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286025 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 17:46:17 -0000 Author: eri Date: Wed Jul 29 17:46:16 2015 New Revision: 286025 URL: https://svnweb.freebsd.org/changeset/base/286025 Log: MFC r285051 Avoid doing multiple route lookups for the same destination IP during forwarding. Differential Revision: https://reviews.freebsd.org/D2964 Modified: stable/10/sys/netinet/ip_input.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/ip_input.c ============================================================================== --- stable/10/sys/netinet/ip_input.c Wed Jul 29 17:34:26 2015 (r286024) +++ stable/10/sys/netinet/ip_input.c Wed Jul 29 17:46:16 2015 (r286025) @@ -1345,6 +1345,7 @@ ip_forward(struct mbuf *m, int srcrt) struct ip *ip = mtod(m, struct ip *); struct in_ifaddr *ia; struct mbuf *mcopy; + struct sockaddr_in *sin; struct in_addr dest; struct route ro; int error, type = 0, code = 0, mtu = 0; @@ -1366,7 +1367,22 @@ ip_forward(struct mbuf *m, int srcrt) } #endif - ia = ip_rtaddr(ip->ip_dst, M_GETFIB(m)); + bzero(&ro, sizeof(ro)); + sin = (struct sockaddr_in *)&ro.ro_dst; + sin->sin_family = AF_INET; + sin->sin_len = sizeof(*sin); + sin->sin_addr = ip->ip_dst; +#ifdef RADIX_MPATH + rtalloc_mpath_fib(&ro, + ntohl(ip->ip_src.s_addr ^ ip->ip_dst.s_addr), + M_GETFIB(m)); +#else + in_rtalloc_ign(&ro, 0, M_GETFIB(m)); +#endif + if (ro.ro_rt != NULL) { + ia = ifatoia(ro.ro_rt->rt_ifa); + ifa_ref(&ia->ia_ifa); + } #ifndef IPSEC /* * 'ia' may be NULL if there is no route for this destination. @@ -1375,6 +1391,7 @@ ip_forward(struct mbuf *m, int srcrt) */ if (!srcrt && ia == NULL) { icmp_error(m, ICMP_UNREACH, ICMP_UNREACH_HOST, 0, 0); + RO_RTFREE(&ro); return; } #endif @@ -1431,16 +1448,8 @@ ip_forward(struct mbuf *m, int srcrt) dest.s_addr = 0; if (!srcrt && V_ipsendredirects && ia != NULL && ia->ia_ifp == m->m_pkthdr.rcvif) { - struct sockaddr_in *sin; struct rtentry *rt; - bzero(&ro, sizeof(ro)); - sin = (struct sockaddr_in *)&ro.ro_dst; - sin->sin_family = AF_INET; - sin->sin_len = sizeof(*sin); - sin->sin_addr = ip->ip_dst; - in_rtalloc_ign(&ro, 0, M_GETFIB(m)); - rt = ro.ro_rt; if (rt && (rt->rt_flags & (RTF_DYNAMIC|RTF_MODIFIED)) == 0 && @@ -1459,16 +1468,8 @@ ip_forward(struct mbuf *m, int srcrt) code = ICMP_REDIRECT_HOST; } } - if (rt) - RTFREE(rt); } - /* - * Try to cache the route MTU from ip_output so we can consider it for - * the ICMP_UNREACH_NEEDFRAG "Next-Hop MTU" field described in RFC1191. - */ - bzero(&ro, sizeof(ro)); - error = ip_output(m, NULL, &ro, IP_FORWARDING, NULL, NULL); if (error == EMSGSIZE && ro.ro_rt) From owner-svn-src-all@freebsd.org Wed Jul 29 17:50:15 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14C049AE9ED; Wed, 29 Jul 2015 17:50:15 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0503E264; Wed, 29 Jul 2015 17:50:15 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6THoEva057957; Wed, 29 Jul 2015 17:50:14 GMT (envelope-from eri@FreeBSD.org) Received: (from eri@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6THoELf057956; Wed, 29 Jul 2015 17:50:14 GMT (envelope-from eri@FreeBSD.org) Message-Id: <201507291750.t6THoELf057956@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eri set sender to eri@FreeBSD.org using -f From: Ermal Luçi Date: Wed, 29 Jul 2015 17:50:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286026 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 17:50:15 -0000 Author: eri Date: Wed Jul 29 17:50:14 2015 New Revision: 286026 URL: https://svnweb.freebsd.org/changeset/base/286026 Log: MFC 285325 Correct issue presented in r285051 by properly initializing variable. Differential Revision: https://reviews.freebsd.org/D3036 Modified: stable/10/sys/netinet/ip_input.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/ip_input.c ============================================================================== --- stable/10/sys/netinet/ip_input.c Wed Jul 29 17:46:16 2015 (r286025) +++ stable/10/sys/netinet/ip_input.c Wed Jul 29 17:50:14 2015 (r286026) @@ -1382,7 +1382,8 @@ ip_forward(struct mbuf *m, int srcrt) if (ro.ro_rt != NULL) { ia = ifatoia(ro.ro_rt->rt_ifa); ifa_ref(&ia->ia_ifa); - } + } else + ia = NULL; #ifndef IPSEC /* * 'ia' may be NULL if there is no route for this destination. From owner-svn-src-all@freebsd.org Wed Jul 29 17:59:16 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7C3859AEB98; Wed, 29 Jul 2015 17:59:16 +0000 (UTC) (envelope-from pkelsey@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B891C01; Wed, 29 Jul 2015 17:59:16 +0000 (UTC) (envelope-from pkelsey@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6THxGKl061569; Wed, 29 Jul 2015 17:59:16 GMT (envelope-from pkelsey@FreeBSD.org) Received: (from pkelsey@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6THxEZ2061562; Wed, 29 Jul 2015 17:59:14 GMT (envelope-from pkelsey@FreeBSD.org) Message-Id: <201507291759.t6THxEZ2061562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pkelsey set sender to pkelsey@FreeBSD.org using -f From: Patrick Kelsey Date: Wed, 29 Jul 2015 17:59:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286027 - in head/sys: netinet sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 17:59:16 -0000 Author: pkelsey Date: Wed Jul 29 17:59:13 2015 New Revision: 286027 URL: https://svnweb.freebsd.org/changeset/base/286027 Log: Revert r265338, r271089 and r271123 as those changes do not handle non-inline urgent data and introduce an mbuf exhaustion attack vector similar to FreeBSD-SA-15:15.tcp, but not requiring VNETs. Address the issue described in FreeBSD-SA-15:15.tcp. Reviewed by: glebius Approved by: so Approved by: jmallett (mentor) Security: FreeBSD-SA-15:15.tcp Sponsored by: Norse Corp, Inc. Modified: head/sys/netinet/tcp_input.c head/sys/netinet/tcp_reass.c head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_usrreq.c head/sys/netinet/tcp_var.h head/sys/sys/mbuf.h Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Wed Jul 29 17:50:14 2015 (r286026) +++ head/sys/netinet/tcp_input.c Wed Jul 29 17:59:13 2015 (r286027) @@ -1665,7 +1665,8 @@ tcp_do_segment(struct mbuf *m, struct tc tp->snd_nxt == tp->snd_max && tiwin && tiwin == tp->snd_wnd && ((tp->t_flags & (TF_NEEDSYN|TF_NEEDFIN)) == 0) && - tp->t_segq == NULL && ((to.to_flags & TOF_TS) == 0 || + LIST_EMPTY(&tp->t_segq) && + ((to.to_flags & TOF_TS) == 0 || TSTMP_GEQ(to.to_tsval, tp->ts_recent)) ) { /* @@ -2903,7 +2904,8 @@ dodata: /* XXX */ * immediately when segments are out of order (so * fast retransmit can work). */ - if (th->th_seq == tp->rcv_nxt && tp->t_segq == NULL && + if (th->th_seq == tp->rcv_nxt && + LIST_EMPTY(&tp->t_segq) && TCPS_HAVEESTABLISHED(tp->t_state)) { if (DELAY_ACK(tp, tlen)) tp->t_flags |= TF_DELACK; Modified: head/sys/netinet/tcp_reass.c ============================================================================== --- head/sys/netinet/tcp_reass.c Wed Jul 29 17:50:14 2015 (r286026) +++ head/sys/netinet/tcp_reass.c Wed Jul 29 17:59:13 2015 (r286027) @@ -71,33 +71,80 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef TCPDEBUG +#include +#endif /* TCPDEBUG */ + +static SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0, + "TCP Segment Reassembly Queue"); + +static int tcp_reass_maxseg = 0; +SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN, + &tcp_reass_maxseg, 0, + "Global maximum number of TCP Segments in Reassembly Queue"); + +static uma_zone_t tcp_reass_zone; +SYSCTL_UMA_CUR(_net_inet_tcp_reass, OID_AUTO, cursegments, CTLFLAG_VNET, + &tcp_reass_zone, + "Global number of TCP Segments currently in Reassembly Queue"); + +/* Initialize TCP reassembly queue */ +static void +tcp_reass_zone_change(void *tag) +{ + + /* Set the zone limit and read back the effective value. */ + tcp_reass_maxseg = nmbclusters / 16; + tcp_reass_maxseg = uma_zone_set_max(tcp_reass_zone, + tcp_reass_maxseg); +} + +void +tcp_reass_global_init(void) +{ + + tcp_reass_maxseg = nmbclusters / 16; + TUNABLE_INT_FETCH("net.inet.tcp.reass.maxsegments", + &tcp_reass_maxseg); + tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent), + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE); + /* Set the zone limit and read back the effective value. */ + tcp_reass_maxseg = uma_zone_set_max(tcp_reass_zone, + tcp_reass_maxseg); + EVENTHANDLER_REGISTER(nmbclusters_change, + tcp_reass_zone_change, NULL, EVENTHANDLER_PRI_ANY); +} void tcp_reass_flush(struct tcpcb *tp) { - struct mbuf *m; + struct tseg_qent *qe; INP_WLOCK_ASSERT(tp->t_inpcb); - while ((m = tp->t_segq) != NULL) { - tp->t_segq = m->m_nextpkt; - tp->t_segqlen -= m->m_pkthdr.len; - m_freem(m); + while ((qe = LIST_FIRST(&tp->t_segq)) != NULL) { + LIST_REMOVE(qe, tqe_q); + m_freem(qe->tqe_m); + uma_zfree(tcp_reass_zone, qe); + tp->t_segqlen--; } KASSERT((tp->t_segqlen == 0), - ("TCP reass queue %p length is %d instead of 0 after flush.", + ("TCP reass queue %p segment count is %d instead of 0 after flush.", tp, tp->t_segqlen)); } -#define M_TCPHDR(m) ((struct tcphdr *)((m)->m_pkthdr.pkt_tcphdr)) - int tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m) { + struct tseg_qent *q; + struct tseg_qent *p = NULL; + struct tseg_qent *nq; + struct tseg_qent *te = NULL; struct socket *so = tp->t_inpcb->inp_socket; - struct mbuf *mq, *mp; - int flags, wakeup; + char *s = NULL; + int flags; + struct tseg_qent tqs; INP_WLOCK_ASSERT(tp->t_inpcb); @@ -113,10 +160,6 @@ tcp_reass(struct tcpcb *tp, struct tcphd if (th == NULL) goto present; - M_ASSERTPKTHDR(m); - KASSERT(*tlenp == m->m_pkthdr.len, ("%s: tlenp %u len %u", __func__, - *tlenp, m->m_pkthdr.len)); - /* * Limit the number of segments that can be queued to reduce the * potential for mbuf exhaustion. For best performance, we want to be @@ -127,15 +170,17 @@ tcp_reass(struct tcpcb *tp, struct tcphd * Always let the missing segment through which caused this queue. * NB: Access to the socket buffer is left intentionally unlocked as we * can tolerate stale information here. + * + * XXXLAS: Using sbspace(so->so_rcv) instead of so->so_rcv.sb_hiwat + * should work but causes packets to be dropped when they shouldn't. + * Investigate why and re-evaluate the below limit after the behaviour + * is understood. */ if ((th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) && - tp->t_segqlen + m->m_pkthdr.len >= sbspace(&so->so_rcv)) { - char *s; - + tp->t_segqlen >= (so->so_rcv.sb_hiwat / tp->t_maxseg) + 1) { TCPSTAT_INC(tcps_rcvreassfull); *tlenp = 0; - if ((s = tcp_log_addrs(&tp->t_inpcb->inp_inc, th, NULL, - NULL))) { + if ((s = tcp_log_addrs(&tp->t_inpcb->inp_inc, th, NULL, NULL))) { log(LOG_DEBUG, "%s; %s: queue limit reached, " "segment dropped\n", s, __func__); free(s, M_TCPLOG); @@ -145,13 +190,46 @@ tcp_reass(struct tcpcb *tp, struct tcphd } /* + * Allocate a new queue entry. If we can't, or hit the zone limit + * just drop the pkt. + * + * Use a temporary structure on the stack for the missing segment + * when the zone is exhausted. Otherwise we may get stuck. + */ + te = uma_zalloc(tcp_reass_zone, M_NOWAIT); + if (te == NULL) { + if (th->th_seq != tp->rcv_nxt || !TCPS_HAVEESTABLISHED(tp->t_state)) { + TCPSTAT_INC(tcps_rcvmemdrop); + m_freem(m); + *tlenp = 0; + if ((s = tcp_log_addrs(&tp->t_inpcb->inp_inc, th, NULL, + NULL))) { + log(LOG_DEBUG, "%s; %s: global zone limit " + "reached, segment dropped\n", s, __func__); + free(s, M_TCPLOG); + } + return (0); + } else { + bzero(&tqs, sizeof(struct tseg_qent)); + te = &tqs; + if ((s = tcp_log_addrs(&tp->t_inpcb->inp_inc, th, NULL, + NULL))) { + log(LOG_DEBUG, + "%s; %s: global zone limit reached, using " + "stack for missing segment\n", s, __func__); + free(s, M_TCPLOG); + } + } + } + tp->t_segqlen++; + + /* * Find a segment which begins after this one does. */ - mp = NULL; - for (mq = tp->t_segq; mq != NULL; mq = mq->m_nextpkt) { - if (SEQ_GT(M_TCPHDR(mq)->th_seq, th->th_seq)) + LIST_FOREACH(q, &tp->t_segq, tqe_q) { + if (SEQ_GT(q->tqe_th->th_seq, th->th_seq)) break; - mp = mq; + p = q; } /* @@ -159,16 +237,18 @@ tcp_reass(struct tcpcb *tp, struct tcphd * our data already. If so, drop the data from the incoming * segment. If it provides all of our data, drop us. */ - if (mp != NULL) { + if (p != NULL) { int i; - /* conversion to int (in i) handles seq wraparound */ - i = M_TCPHDR(mp)->th_seq + mp->m_pkthdr.len - th->th_seq; + i = p->tqe_th->th_seq + p->tqe_len - th->th_seq; if (i > 0) { if (i >= *tlenp) { TCPSTAT_INC(tcps_rcvduppack); TCPSTAT_ADD(tcps_rcvdupbyte, *tlenp); m_freem(m); + if (te != &tqs) + uma_zfree(tcp_reass_zone, te); + tp->t_segqlen--; /* * Try to present any queued data * at the left window edge to the user. @@ -190,54 +270,37 @@ tcp_reass(struct tcpcb *tp, struct tcphd * While we overlap succeeding segments trim them or, * if they are completely covered, dequeue them. */ - while (mq) { - struct mbuf *nq; - int i; - - i = (th->th_seq + *tlenp) - M_TCPHDR(mq)->th_seq; + while (q) { + int i = (th->th_seq + *tlenp) - q->tqe_th->th_seq; if (i <= 0) break; - if (i < mq->m_pkthdr.len) { - M_TCPHDR(mq)->th_seq += i; - m_adj(mq, i); - tp->t_segqlen -= i; + if (i < q->tqe_len) { + q->tqe_th->th_seq += i; + q->tqe_len -= i; + m_adj(q->tqe_m, i); break; } - nq = mq->m_nextpkt; - tp->t_segqlen -= mq->m_pkthdr.len; - m_freem(mq); - if (mp) - mp->m_nextpkt = nq; - else - tp->t_segq = nq; - mq = nq; + nq = LIST_NEXT(q, tqe_q); + LIST_REMOVE(q, tqe_q); + m_freem(q->tqe_m); + uma_zfree(tcp_reass_zone, q); + tp->t_segqlen--; + q = nq; } - /* - * Insert the new segment queue entry into place. Try to collapse - * mbuf chains if segments are adjacent. - */ - if (mp) { - if (M_TCPHDR(mp)->th_seq + mp->m_pkthdr.len == th->th_seq) - m_catpkt(mp, m); - else { - m->m_nextpkt = mp->m_nextpkt; - mp->m_nextpkt = m; - m->m_pkthdr.pkt_tcphdr = th; - } + /* Insert the new segment queue entry into place. */ + te->tqe_m = m; + te->tqe_th = th; + te->tqe_len = *tlenp; + + if (p == NULL) { + LIST_INSERT_HEAD(&tp->t_segq, te, tqe_q); } else { - mq = tp->t_segq; - tp->t_segq = m; - if (mq && th->th_seq + *tlenp == M_TCPHDR(mq)->th_seq) { - m->m_nextpkt = mq->m_nextpkt; - mq->m_nextpkt = NULL; - m_catpkt(m, mq); - } else - m->m_nextpkt = mq; - m->m_pkthdr.pkt_tcphdr = th; + KASSERT(te != &tqs, ("%s: temporary stack based entry not " + "first element in queue", __func__)); + LIST_INSERT_AFTER(p, te, tqe_q); } - tp->t_segqlen += *tlenp; present: /* @@ -246,30 +309,25 @@ present: */ if (!TCPS_HAVEESTABLISHED(tp->t_state)) return (0); - - flags = 0; - wakeup = 0; + q = LIST_FIRST(&tp->t_segq); + if (!q || q->tqe_th->th_seq != tp->rcv_nxt) + return (0); SOCKBUF_LOCK(&so->so_rcv); - while ((mq = tp->t_segq) != NULL && - M_TCPHDR(mq)->th_seq == tp->rcv_nxt) { - tp->t_segq = mq->m_nextpkt; - - tp->rcv_nxt += mq->m_pkthdr.len; - tp->t_segqlen -= mq->m_pkthdr.len; - flags = M_TCPHDR(mq)->th_flags & TH_FIN; - + do { + tp->rcv_nxt += q->tqe_len; + flags = q->tqe_th->th_flags & TH_FIN; + nq = LIST_NEXT(q, tqe_q); + LIST_REMOVE(q, tqe_q); if (so->so_rcv.sb_state & SBS_CANTRCVMORE) - m_freem(mq); - else { - mq->m_nextpkt = NULL; - sbappendstream_locked(&so->so_rcv, mq, 0); - wakeup = 1; - } - } + m_freem(q->tqe_m); + else + sbappendstream_locked(&so->so_rcv, q->tqe_m, 0); + if (q != &tqs) + uma_zfree(tcp_reass_zone, q); + tp->t_segqlen--; + q = nq; + } while (q && q->tqe_th->th_seq == tp->rcv_nxt); ND6_HINT(tp); - if (wakeup) - sorwakeup_locked(so); - else - SOCKBUF_UNLOCK(&so->so_rcv); + sorwakeup_locked(so); return (flags); } Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Wed Jul 29 17:50:14 2015 (r286026) +++ head/sys/netinet/tcp_subr.c Wed Jul 29 17:59:13 2015 (r286027) @@ -385,6 +385,8 @@ tcp_init(void) if (!IS_DEFAULT_VNET(curvnet)) return; + tcp_reass_global_init(); + /* XXX virtualize those bellow? */ tcp_delacktime = TCPTV_DELACK; tcp_keepinit = TCPTV_KEEP_INIT; Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Wed Jul 29 17:50:14 2015 (r286026) +++ head/sys/netinet/tcp_usrreq.c Wed Jul 29 17:59:13 2015 (r286027) @@ -1977,7 +1977,7 @@ db_print_tcpcb(struct tcpcb *tp, const c db_print_indent(indent); db_printf("t_segq first: %p t_segqlen: %d t_dupacks: %d\n", - tp->t_segq, tp->t_segqlen, tp->t_dupacks); + LIST_FIRST(&tp->t_segq), tp->t_segqlen, tp->t_dupacks); db_print_indent(indent); db_printf("tt_rexmt: %p tt_persist: %p tt_keep: %p\n", Modified: head/sys/netinet/tcp_var.h ============================================================================== --- head/sys/netinet/tcp_var.h Wed Jul 29 17:50:14 2015 (r286026) +++ head/sys/netinet/tcp_var.h Wed Jul 29 17:59:13 2015 (r286027) @@ -46,6 +46,15 @@ VNET_DECLARE(int, tcp_do_rfc1323); #endif /* _KERNEL */ +/* TCP segment queue entry */ +struct tseg_qent { + LIST_ENTRY(tseg_qent) tqe_q; + int tqe_len; /* TCP segment data length */ + struct tcphdr *tqe_th; /* a pointer to tcp header */ + struct mbuf *tqe_m; /* mbuf contains packet */ +}; +LIST_HEAD(tsegqe_head, tseg_qent); + struct sackblk { tcp_seq start; /* start seq no. of sack block */ tcp_seq end; /* end seq no. */ @@ -91,7 +100,7 @@ do { \ * Organized for 16 byte cacheline efficiency. */ struct tcpcb { - struct mbuf *t_segq; /* segment reassembly queue */ + struct tsegqe_head t_segq; /* segment reassembly queue */ void *t_pspare[2]; /* new reassembly queue */ int t_segqlen; /* segment reassembly queue length */ int t_dupacks; /* consecutive dup acks recd */ @@ -667,6 +676,7 @@ char *tcp_log_addrs(struct in_conninfo * char *tcp_log_vain(struct in_conninfo *, struct tcphdr *, void *, const void *); int tcp_reass(struct tcpcb *, struct tcphdr *, int *, struct mbuf *); +void tcp_reass_global_init(void); void tcp_reass_flush(struct tcpcb *); int tcp_input(struct mbuf **, int *, int); u_long tcp_maxmtu(struct in_conninfo *, struct tcp_ifcap *); Modified: head/sys/sys/mbuf.h ============================================================================== --- head/sys/sys/mbuf.h Wed Jul 29 17:50:14 2015 (r286026) +++ head/sys/sys/mbuf.h Wed Jul 29 17:59:13 2015 (r286027) @@ -150,7 +150,6 @@ struct pkthdr { #define tso_segsz PH_per.sixteen[1] #define csum_phsum PH_per.sixteen[2] #define csum_data PH_per.thirtytwo[1] -#define pkt_tcphdr PH_loc.ptr /* * Description of external storage mapped into mbuf; valid only if M_EXT is From owner-svn-src-all@freebsd.org Wed Jul 29 18:04:03 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08FF19AECE4; Wed, 29 Jul 2015 18:04:03 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ED5FEFCE; Wed, 29 Jul 2015 18:04:02 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TI428I065404; Wed, 29 Jul 2015 18:04:02 GMT (envelope-from eri@FreeBSD.org) Received: (from eri@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TI42iH065403; Wed, 29 Jul 2015 18:04:02 GMT (envelope-from eri@FreeBSD.org) Message-Id: <201507291804.t6TI42iH065403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eri set sender to eri@FreeBSD.org using -f From: Ermal Luçi Date: Wed, 29 Jul 2015 18:04:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286028 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 18:04:03 -0000 Author: eri Date: Wed Jul 29 18:04:01 2015 New Revision: 286028 URL: https://svnweb.freebsd.org/changeset/base/286028 Log: ip_output normalization and fixes ip_output has a big chunk of code used to handle special cases with pfil consumers which also forces a reloop on it. Gather all this code together to make it readable and properly handle the reloop cases. Some of the issues identified: M_IP_NEXTHOP is not handled properly in existing code. route reference leaking is possible with in FIB number change route flags checking is not consistent in the function Differential Revision: https://reviews.freebsd.org/D3022 Reviewed by: gnn Approved by: gnn(mentor) MFC after: 4 weeks Modified: head/sys/netinet/ip_output.c Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Wed Jul 29 17:59:13 2015 (r286027) +++ head/sys/netinet/ip_output.c Wed Jul 29 18:04:01 2015 (r286028) @@ -106,6 +106,94 @@ static void ip_mloopback extern int in_mcast_loop; extern struct protosw inetsw[]; +static inline int +ip_output_pfil(struct mbuf *m, struct ifnet *ifp, struct inpcb *inp, + struct sockaddr_in *dst, int *fibnum, int *error) +{ + struct m_tag *fwd_tag = NULL; + struct in_addr odst; + struct ip *ip; + + ip = mtod(m, struct ip *); + + /* Run through list of hooks for output packets. */ + odst.s_addr = ip->ip_dst.s_addr; + *error = pfil_run_hooks(&V_inet_pfil_hook, &m, ifp, PFIL_OUT, inp); + if ((*error) != 0 || m == NULL) + return 1; /* Finished */ + + ip = mtod(m, struct ip *); + + /* See if destination IP address was changed by packet filter. */ + if (odst.s_addr != ip->ip_dst.s_addr) { + m->m_flags |= M_SKIP_FIREWALL; + /* If destination is now ourself drop to ip_input(). */ + if (in_localip(ip->ip_dst)) { + m->m_flags |= M_FASTFWD_OURS; + if (m->m_pkthdr.rcvif == NULL) + m->m_pkthdr.rcvif = V_loif; + if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { + m->m_pkthdr.csum_flags |= + CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + m->m_pkthdr.csum_data = 0xffff; + } + m->m_pkthdr.csum_flags |= + CSUM_IP_CHECKED | CSUM_IP_VALID; +#ifdef SCTP + if (m->m_pkthdr.csum_flags & CSUM_SCTP) + m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; +#endif + *error = netisr_queue(NETISR_IP, m); + return 1; /* Finished */ + } + + bzero(dst, sizeof(*dst)); + dst->sin_family = AF_INET; + dst->sin_len = sizeof(*dst); + dst->sin_addr = ip->ip_dst; + + return -1; /* Reloop */ + } + /* See if fib was changed by packet filter. */ + if ((*fibnum) != M_GETFIB(m)) { + m->m_flags |= M_SKIP_FIREWALL; + *fibnum = M_GETFIB(m); + return -1; /* Reloop for FIB change */ + } + + /* See if local, if yes, send it to netisr with IP_FASTFWD_OURS. */ + if (m->m_flags & M_FASTFWD_OURS) { + if (m->m_pkthdr.rcvif == NULL) + m->m_pkthdr.rcvif = V_loif; + if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { + m->m_pkthdr.csum_flags |= + CSUM_DATA_VALID | CSUM_PSEUDO_HDR; + m->m_pkthdr.csum_data = 0xffff; + } +#ifdef SCTP + if (m->m_pkthdr.csum_flags & CSUM_SCTP) + m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; +#endif + m->m_pkthdr.csum_flags |= + CSUM_IP_CHECKED | CSUM_IP_VALID; + + *error = netisr_queue(NETISR_IP, m); + return 1; /* Finished */ + } + /* Or forward to some other address? */ + if ((m->m_flags & M_IP_NEXTHOP) && + ((fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL)) != NULL)) { + bcopy((fwd_tag+1), dst, sizeof(struct sockaddr_in)); + m->m_flags |= M_SKIP_FIREWALL; + m->m_flags &= ~M_IP_NEXTHOP; + m_tag_delete(m, fwd_tag); + + return -1; /* Reloop for CHANGE of dst */ + } + + return 0; +} + /* * IP output. The packet in mbuf chain m contains a skeletal IP * header (with len, off, ttl, proto, tos, src, dst). @@ -136,11 +224,8 @@ ip_output(struct mbuf *m, struct mbuf *o uint16_t ip_len, ip_off; struct route iproute; struct rtentry *rte; /* cache for ro->ro_rt */ - struct in_addr odst; - struct m_tag *fwd_tag = NULL; uint32_t fibnum; int have_ia_ref; - int needfiblookup; #ifdef IPSEC int no_route_but_check_spd = 0; #endif @@ -194,32 +279,20 @@ ip_output(struct mbuf *m, struct mbuf *o */ gw = dst = (struct sockaddr_in *)&ro->ro_dst; fibnum = (inp != NULL) ? inp->inp_inc.inc_fibnum : M_GETFIB(m); -again: - ia = NULL; - have_ia_ref = 0; + rte = ro->ro_rt; /* - * If there is a cached route, check that it is to the same - * destination and is still up. If not, free it and try again. * The address family should also be checked in case of sharing * the cache with IPv6. */ - rte = ro->ro_rt; - if (rte && ((rte->rt_flags & RTF_UP) == 0 || - rte->rt_ifp == NULL || - !RT_LINK_IS_UP(rte->rt_ifp) || - dst->sin_family != AF_INET || - dst->sin_addr.s_addr != ip->ip_dst.s_addr)) { - RO_RTFREE(ro); - ro->ro_lle = NULL; - rte = NULL; - gw = dst; - } - if (rte == NULL && fwd_tag == NULL) { + if (rte == NULL || dst->sin_family != AF_INET) { bzero(dst, sizeof(*dst)); dst->sin_family = AF_INET; dst->sin_len = sizeof(*dst); dst->sin_addr = ip->ip_dst; } +again: + ia = NULL; + have_ia_ref = 0; /* * If routing to interface only, short circuit routing lookup. * The use of an all-ones broadcast address implies this; an @@ -282,6 +355,7 @@ again: rte = ro->ro_rt; } if (rte == NULL || + (rte->rt_flags & RTF_UP) == 0 || rte->rt_ifp == NULL || !RT_LINK_IS_UP(rte->rt_ifp)) { #ifdef IPSEC @@ -307,6 +381,7 @@ again: else isbroadcast = in_broadcast(gw->sin_addr, ifp); } + /* * Calculate MTU. If we have a route that is up, use that, * otherwise use the interface's MTU. @@ -318,6 +393,7 @@ again: /* Catch a possible divide by zero later. */ KASSERT(mtu > 0, ("%s: mtu %d <= 0, rte=%p (rt_flags=0x%08x) ifp=%p", __func__, mtu, rte, (rte != NULL) ? rte->rt_flags : 0, ifp)); + if (IN_MULTICAST(ntohl(ip->ip_dst.s_addr))) { m->m_flags |= M_MCAST; /* @@ -475,87 +551,29 @@ sendit: #endif /* IPSEC */ /* Jump over all PFIL processing if hooks are not active. */ - if (!PFIL_HOOKED(&V_inet_pfil_hook)) - goto passout; - - /* Run through list of hooks for output packets. */ - odst.s_addr = ip->ip_dst.s_addr; - error = pfil_run_hooks(&V_inet_pfil_hook, &m, ifp, PFIL_OUT, inp); - if (error != 0 || m == NULL) - goto done; + if (PFIL_HOOKED(&V_inet_pfil_hook)) { + switch (ip_output_pfil(m, ifp, inp, dst, &fibnum, &error)) { + case 1: /* Finished */ + goto done; - ip = mtod(m, struct ip *); - needfiblookup = 0; + case 0: /* Continue normally */ + ip = mtod(m, struct ip *); + break; - /* See if destination IP address was changed by packet filter. */ - if (odst.s_addr != ip->ip_dst.s_addr) { - m->m_flags |= M_SKIP_FIREWALL; - /* If destination is now ourself drop to ip_input(). */ - if (in_localip(ip->ip_dst)) { - m->m_flags |= M_FASTFWD_OURS; - if (m->m_pkthdr.rcvif == NULL) - m->m_pkthdr.rcvif = V_loif; - if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { - m->m_pkthdr.csum_flags |= - CSUM_DATA_VALID | CSUM_PSEUDO_HDR; - m->m_pkthdr.csum_data = 0xffff; - } - m->m_pkthdr.csum_flags |= - CSUM_IP_CHECKED | CSUM_IP_VALID; -#ifdef SCTP - if (m->m_pkthdr.csum_flags & CSUM_SCTP) - m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; -#endif - error = netisr_queue(NETISR_IP, m); - goto done; - } else { + case -1: /* Need to try again */ + /* Reset everything for a new round */ + RO_RTFREE(ro); if (have_ia_ref) ifa_free(&ia->ia_ifa); - needfiblookup = 1; /* Redo the routing table lookup. */ - } - } - /* See if fib was changed by packet filter. */ - if (fibnum != M_GETFIB(m)) { - m->m_flags |= M_SKIP_FIREWALL; - fibnum = M_GETFIB(m); - RO_RTFREE(ro); - needfiblookup = 1; - } - if (needfiblookup) - goto again; + ro->ro_lle = NULL; + rte = NULL; + gw = dst; + ip = mtod(m, struct ip *); + goto again; - /* See if local, if yes, send it to netisr with IP_FASTFWD_OURS. */ - if (m->m_flags & M_FASTFWD_OURS) { - if (m->m_pkthdr.rcvif == NULL) - m->m_pkthdr.rcvif = V_loif; - if (m->m_pkthdr.csum_flags & CSUM_DELAY_DATA) { - m->m_pkthdr.csum_flags |= - CSUM_DATA_VALID | CSUM_PSEUDO_HDR; - m->m_pkthdr.csum_data = 0xffff; } -#ifdef SCTP - if (m->m_pkthdr.csum_flags & CSUM_SCTP) - m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; -#endif - m->m_pkthdr.csum_flags |= - CSUM_IP_CHECKED | CSUM_IP_VALID; - - error = netisr_queue(NETISR_IP, m); - goto done; - } - /* Or forward to some other address? */ - if ((m->m_flags & M_IP_NEXTHOP) && - (fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL)) != NULL) { - bcopy((fwd_tag+1), dst, sizeof(struct sockaddr_in)); - m->m_flags |= M_SKIP_FIREWALL; - m->m_flags &= ~M_IP_NEXTHOP; - m_tag_delete(m, fwd_tag); - if (have_ia_ref) - ifa_free(&ia->ia_ifa); - goto again; } -passout: /* 127/8 must not appear on wire - RFC1122. */ if ((ntohl(ip->ip_dst.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET || (ntohl(ip->ip_src.s_addr) >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET) { From owner-svn-src-all@freebsd.org Wed Jul 29 18:33:12 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6BF0C9AE261; Wed, 29 Jul 2015 18:33:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 565D81D54; Wed, 29 Jul 2015 18:33:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TIXCnR077407; Wed, 29 Jul 2015 18:33:12 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TIXCFS077405; Wed, 29 Jul 2015 18:33:12 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201507291833.t6TIXCFS077405@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 29 Jul 2015 18:33:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286029 - head/tools/build/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 18:33:12 -0000 Author: emaste Date: Wed Jul 29 18:33:11 2015 New Revision: 286029 URL: https://svnweb.freebsd.org/changeset/base/286029 Log: Update OLD_FILES for tools provided by ELF Tool Chain or Binutils Sponsored by: The FreeBSD Foundation Modified: head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Wed Jul 29 18:04:01 2015 (r286028) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Wed Jul 29 18:33:11 2015 (r286029) @@ -186,7 +186,6 @@ OLD_FILES+=usr/bin/as OLD_FILES+=usr/bin/ld OLD_FILES+=usr/bin/objcopy OLD_FILES+=usr/bin/objdump -OLD_FILES+=usr/bin/readelf OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.x OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xbn OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xc @@ -204,7 +203,6 @@ OLD_FILES+=usr/share/man/man1/as.1.gz OLD_FILES+=usr/share/man/man1/ld.1.gz OLD_FILES+=usr/share/man/man1/objcopy.1.gz OLD_FILES+=usr/share/man/man1/objdump.1.gz -OLD_FILES+=usr/share/man/man1/readelf.1.gz OLD_FILES+=usr/share/man/man7/as.7.gz OLD_FILES+=usr/share/man/man7/ld.7.gz OLD_FILES+=usr/share/man/man7/ldint.7.gz @@ -1653,6 +1651,21 @@ OLD_FILES+=usr/bin/elfcopy OLD_FILES+=usr/share/man/man1/elfcopy.1.gz .endif +.if ${MK_ELFTOOLCHAIN_TOOLS} == no && ${MK_BINUTILS} == no +OLD_FILES+=usr/bin/addr2line +OLD_FILES+=usr/bin/nm +OLD_FILES+=usr/bin/readelf +OLD_FILES+=usr/bin/size +OLD_FILES+=usr/bin/strings +OLD_FILES+=usr/bin/strip +OLD_FILES+=usr/share/man/man1/addr2line.1.gz +OLD_FILES+=usr/share/man/man1/nm.1.gz +OLD_FILES+=usr/share/man/man1/readelf.1.gz +OLD_FILES+=usr/share/man/man1/size.1.gz +OLD_FILES+=usr/share/man/man1/strings.1.gz +OLD_FILES+=usr/share/man/man1/strip.1.gz +.endif + #.if ${MK_EXAMPLES} == no # to be filled in #.endif From owner-svn-src-all@freebsd.org Wed Jul 29 18:43:42 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A32C29AE4D1 for ; Wed, 29 Jul 2015 18:43:42 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qg0-f54.google.com (mail-qg0-f54.google.com [209.85.192.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 584913C6 for ; Wed, 29 Jul 2015 18:43:41 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by qgeu79 with SMTP id u79so8927962qge.1 for ; Wed, 29 Jul 2015 11:43:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version:content-type; bh=K7OcXmxMsB6Od0rr77H66WPkr3zzKVn4T5ybJAcFz80=; b=WfzSjgamuTvMPFocyX/S/ILy4th8BIkV1VhuL6RsHFXdLYp3vTv6kfp2Cqs2lFCChr 4cS96T2aXYhAS6KjjXOcVb7vZIcwXvPrNHsCngVdEY7+huvzZw2Gw/+hBV3tciRmc7P7 /2QDwHThYlV1cgpOQ8ingqQA/9qR61/EJILlJtQ8AmFK7aIg4UN4iTz3MeReiqT9aE32 xco9RJ0IBT9GIpiov+0igH9uF7CoFKsVba77p4UlM+uuWsHUlbTVN4r5bv1mmHV3S4iQ 11yHL5tJn9KfF2+txX6hF/IvwKVXaUR5Hry+Zpe8WVcjua2cgzCC1rw8jrKBCp2iscqL YVYw== X-Gm-Message-State: ALoCoQkTtMFN3Wx2I1no279m5f6DGFhftk0mRhvwFQyoLfERB5P1VRs+dIRYxZnA08yLocv1U8jNcYvm6pkKUL3qd8Ndelyzpk5TwQG1CZwwl96pC3WII/W37UgmFpQunPFhSdNbYhRw+bN8SQ8osQj4BLOY0Y+nGbt8mZc1GBXPrLTy7pyOWLi5Asp1n7PTnxxAYqMEdzpJ X-Received: by 10.140.83.84 with SMTP id i78mr64696327qgd.14.1438195415707; Wed, 29 Jul 2015 11:43:35 -0700 (PDT) Received: from hbsd-dev-laptop.localnet ([136.160.244.66]) by smtp.gmail.com with ESMTPSA id q26sm14384187qkq.33.2015.07.29.11.43.34 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Jul 2015 11:43:34 -0700 (PDT) From: Shawn Webb To: svn-src-all@freebsd.org Cc: Patrick Kelsey , src-committers@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r286027 - in head/sys: netinet sys Date: Wed, 29 Jul 2015 14:43:31 -0400 Message-ID: <1544505.mLGqfis2xi@hbsd-dev-laptop> Organization: HardenedBSD User-Agent: KMail/4.14.3 (FreeBSD/11.0-CURRENT-HBSD; KDE/4.14.3; amd64; ; ) In-Reply-To: <201507291759.t6THxEZ2061562@repo.freebsd.org> References: <201507291759.t6THxEZ2061562@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2162866.BYog7Hna3T"; micalg="pgp-sha256"; protocol="application/pgp-signature" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 18:43:42 -0000 --nextPart2162866.BYog7Hna3T Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" On Wednesday, 29 July 2015 05:59:14 PM Patrick Kelsey wrote: > Author: pkelsey > Date: Wed Jul 29 17:59:13 2015 > New Revision: 286027 > URL: https://svnweb.freebsd.org/changeset/base/286027 >=20 > Log: > Revert r265338, r271089 and r271123 as those changes do not handle > non-inline urgent data and introduce an mbuf exhaustion attack vect= or > similar to FreeBSD-SA-15:15.tcp, but not requiring VNETs. >=20 > Address the issue described in FreeBSD-SA-15:15.tcp. >=20 > Reviewed by:=09glebius > Approved by:=09so > Approved by:=09jmallett (mentor) > Security:=09FreeBSD-SA-15:15.tcp > Sponsored by:=09Norse Corp, Inc. Does this commit need to be MFC'd to stable/10? Or is this only for HEA= D? Thanks, =2D-=20 Shawn Webb HardenedBSD GPG Key ID: 0x6A84658F52456EEE GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89 3D9E 6A84 658F 5245 6EEE --nextPart2162866.BYog7Hna3T Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCAAGBQJVuR7TAAoJEGqEZY9SRW7uSB8P/2S4Sn98K9EaL2M8et/Oyoaz JmY76DKgUNHudpVZo5eSh+XtsINHevn8re/QB97jORl3GJ6hre/AaexJtFvFN1+N kTUEROqgtW3UWGlHijQzuE+p1OwPNdjFZPm4bWP23fKfQgdvZ26cg+iyPqiZ14bc phpIZdsC0aHp9tvPT9QcdKWOwaTGEQ2f3sbIvf2Gg0Qpu0bnsqk5UfVUtUKgPkP7 lM54uKlJqVVo25NG1wayE4GF7X0LrQzZlXet7kNZHyqPAu5s9rHOHD+8w9i6dQkf zk22BsLTxtlTqejVilQF2BLXhx56Wf1P1ZVi0qkbanAAzPIw82P3w8HLjaX0cTed 7kS/GIFm2XFgpO+It4rsYEXpj8vCEBhgipaMQVyuCp8742s4qoFc6cjBVueeAvR/ dlI4YznTTxlG6IJXw0jUwH3cCYEv1oG8j6K6ZzpCZFrFMg8CPZMtwdV7kaH5Qsii QhDt+FZ55FFIlaIjtOe9xAFzQu2GxcJ7Zu25wNgR5PfboaqT0f+TPlykX8z9CgwX h3eujk7eu/dxu+QAD/HglDNOktt4LQZ6bJE6mfBAommPIXUTL31mQhJjdBlRP40Q nPEfozaWq/8wBByLdpzkOirJiOz8lb/bsDami6ihNLLFF5fB4sBFUHpj7k1bIk3A Lnf9HVY7gxcIoIvgmD1u =qpxh -----END PGP SIGNATURE----- --nextPart2162866.BYog7Hna3T-- From owner-svn-src-all@freebsd.org Wed Jul 29 18:45:41 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A11229AE578; Wed, 29 Jul 2015 18:45:41 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 813F46C5; Wed, 29 Jul 2015 18:45:41 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TIjfcL081844; Wed, 29 Jul 2015 18:45:41 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TIjd4G081835; Wed, 29 Jul 2015 18:45:39 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201507291845.t6TIjd4G081835@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 29 Jul 2015 18:45:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286030 - in head: gnu/usr.bin/binutils share/mk tools/build/mk tools/build/options usr.bin/elfcopy X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 18:45:41 -0000 Author: emaste Date: Wed Jul 29 18:45:38 2015 New Revision: 286030 URL: https://svnweb.freebsd.org/changeset/base/286030 Log: Allow ELF Tool Chain elfcopy to be installed as objcopy ELF Tool Chain elfcopy is nearly a drop-in replacement for GNU objcopy, but does not currently support PE output which is needed for building x86 UEFI bits. Add a src.conf knob to allow installing it as objcopy and set it by default for aarch64 only, where we don't have a native binutils. Reviewed by: bapt Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D2887 Added: head/tools/build/options/WITHOUT_ELFCOPY_AS_OBJCOPY (contents, props changed) head/tools/build/options/WITH_ELFCOPY_AS_OBJCOPY (contents, props changed) Modified: head/gnu/usr.bin/binutils/Makefile head/share/mk/src.opts.mk head/tools/build/mk/OptionalObsoleteFiles.inc head/usr.bin/elfcopy/Makefile Modified: head/gnu/usr.bin/binutils/Makefile ============================================================================== --- head/gnu/usr.bin/binutils/Makefile Wed Jul 29 18:33:11 2015 (r286029) +++ head/gnu/usr.bin/binutils/Makefile Wed Jul 29 18:45:38 2015 (r286030) @@ -11,7 +11,7 @@ SUBDIR= doc\ as \ ld \ ${_nm} \ - objcopy \ + ${_objcopy} \ objdump \ ${_readelf} \ ${_size} \ @@ -26,5 +26,8 @@ _size= size _strings= strings _strip= strip .endif +.if ${MK_ELFTOOLCHAIN_TOOLS} == "no" || ${MK_ELFCOPY_AS_OBJCOPY} == "no" +_objcopy= objcopy +.endif .include Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Wed Jul 29 18:33:11 2015 (r286029) +++ head/share/mk/src.opts.mk Wed Jul 29 18:45:38 2015 (r286030) @@ -234,6 +234,9 @@ __DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTST .endif .if ${__T} == "aarch64" BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GCC GCC_BOOTSTRAP GDB +__DEFAULT_YES_OPTIONS+=ELFCOPY_AS_OBJCOPY +.else +__DEFAULT_NO_OPTIONS+=ELFCOPY_AS_OBJCOPY .endif # LLVM lacks support for FreeBSD 64-bit atomic operations for ARMv4/ARMv5 .if ${__T} == "arm" || ${__T} == "armeb" Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Wed Jul 29 18:33:11 2015 (r286029) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Wed Jul 29 18:45:38 2015 (r286030) @@ -184,7 +184,9 @@ OLD_DIRS+=usr/share/examples/bhyve .if ${MK_BINUTILS} == no OLD_FILES+=usr/bin/as OLD_FILES+=usr/bin/ld +.if ${MK_ELFTOOLCHAIN_TOOLS} != no && ${MK_ELFCOPY_AS_OBJCOPY} == no OLD_FILES+=usr/bin/objcopy +.endif OLD_FILES+=usr/bin/objdump OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.x OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xbn @@ -201,7 +203,9 @@ OLD_FILES+=usr/libdata/ldscripts/elf_x86 OLD_FILES+=usr/libdata/ldscripts/elf_x86_64_fbsd.xw OLD_FILES+=usr/share/man/man1/as.1.gz OLD_FILES+=usr/share/man/man1/ld.1.gz +.if ${MK_ELFTOOLCHAIN_TOOLS} != no && ${MK_ELFCOPY_AS_OBJCOPY} == no OLD_FILES+=usr/share/man/man1/objcopy.1.gz +.endif OLD_FILES+=usr/share/man/man1/objdump.1.gz OLD_FILES+=usr/share/man/man7/as.7.gz OLD_FILES+=usr/share/man/man7/ld.7.gz @@ -1646,7 +1650,8 @@ OLD_FILES+=usr/share/nls/ru_RU.KOI8-R/ee OLD_FILES+=usr/share/nls/uk_UA.KOI8-U/ee.cat .endif -.if ${MK_ELFTOOLCHAIN_TOOLS} == no +.if ${MK_ELFTOOLCHAIN_TOOLS} == no || \ + (${MK_ELFTOOLCHAIN_TOOLS} != no && MK_ELFCOPY_AS_OBJCOPY != no) OLD_FILES+=usr/bin/elfcopy OLD_FILES+=usr/share/man/man1/elfcopy.1.gz .endif Added: head/tools/build/options/WITHOUT_ELFCOPY_AS_OBJCOPY ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/options/WITHOUT_ELFCOPY_AS_OBJCOPY Wed Jul 29 18:45:38 2015 (r286030) @@ -0,0 +1,4 @@ +.\" $FreeBSD$ +Set to build and install +.Xr objcopy 1 +from GNU Binutils, instead of the one from ELF Tool Chain. Added: head/tools/build/options/WITH_ELFCOPY_AS_OBJCOPY ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/options/WITH_ELFCOPY_AS_OBJCOPY Wed Jul 29 18:45:38 2015 (r286030) @@ -0,0 +1,4 @@ +.\" $FreeBSD$ +Set to build and install ELF Tool Chain's elfcopy as +.Xr objcopy 1 , +instead of the one from GNU Binutils. Modified: head/usr.bin/elfcopy/Makefile ============================================================================== --- head/usr.bin/elfcopy/Makefile Wed Jul 29 18:33:11 2015 (r286029) +++ head/usr.bin/elfcopy/Makefile Wed Jul 29 18:45:38 2015 (r286030) @@ -7,7 +7,15 @@ ELFCOPYDIR= ${ELFTCDIR}/elfcopy .PATH: ${ELFCOPYDIR} +.if ${MK_ELFCOPY_AS_OBJCOPY} != "no" +PROG= objcopy +objcopy.1: elfcopy.1 + sed -e 's/\.Dt ELFCOPY 1/.Dt OBJCOPY 1/' \ + -e 's/\.Nm elfcopy/.Nm objcopy/' < ${.ALLSRC} > ${.TARGET} +CLEANFILES+= objcopy.1 +.else PROG= elfcopy +.endif SRCS= archive.c ascii.c binary.c main.c sections.c segments.c symbols.c @@ -17,8 +25,8 @@ LIBADD= archive elftc elf CFLAGS+=-I${ELFTCDIR}/libelftc -I${ELFTCDIR}/common -MAN= elfcopy.1 strip.1 +MAN= ${PROG}.1 strip.1 -LINKS= ${BINDIR}/elfcopy ${BINDIR}/strip +LINKS= ${BINDIR}/${PROG} ${BINDIR}/strip .include From owner-svn-src-all@freebsd.org Wed Jul 29 18:49:15 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7DE149AE5FD; Wed, 29 Jul 2015 18:49:15 +0000 (UTC) (envelope-from pkelsey@gmail.com) Received: from mail-yk0-x229.google.com (mail-yk0-x229.google.com [IPv6:2607:f8b0:4002:c07::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3EEF58B0; Wed, 29 Jul 2015 18:49:15 +0000 (UTC) (envelope-from pkelsey@gmail.com) Received: by ykay190 with SMTP id y190so15604245yka.3; Wed, 29 Jul 2015 11:49:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=h63LKlyCALoqywe+qDuK1Q2fTNYkj4zd8kRe8b8hlkg=; b=BKzVjTB1brEQDT/cKKnp0gg4we4dO4W68ge5ZnHPJZvvgnB9x0kN12jpiH+BBE3Uzg LoljFjSu7vS0dVTtfVviJDgNyt4MY0YPl2I2hjeHsdocghxo78tbVhNAm1Eg6qwbkmsu BAbZoms+96sa8EK5sLInT81yDP2wTxRthz11qTdg1o2V7knxxO8+q1d9DZeBdKUDxcq6 JCsVpInh7tfoGY8/paY+Hr0h1DZSfIdm3A4RWnKLuhIJ0lVeCMlWuBMXR9NZITJPY4uB +71NKR5rtvYueSPnfLQYDafKEuqe9trb/s+4QpPgAOTcUEa4aaBziOHlIU4I4K6XYCAQ 7trw== MIME-Version: 1.0 X-Received: by 10.129.36.14 with SMTP id k14mr45920619ywk.64.1438195754487; Wed, 29 Jul 2015 11:49:14 -0700 (PDT) Sender: pkelsey@gmail.com Received: by 10.129.138.68 with HTTP; Wed, 29 Jul 2015 11:49:14 -0700 (PDT) In-Reply-To: <1544505.mLGqfis2xi@hbsd-dev-laptop> References: <201507291759.t6THxEZ2061562@repo.freebsd.org> <1544505.mLGqfis2xi@hbsd-dev-laptop> Date: Wed, 29 Jul 2015 14:49:14 -0400 X-Google-Sender-Auth: tC4jxCTXQL-AFNTlQypY5M2lglA Message-ID: Subject: Re: svn commit: r286027 - in head/sys: netinet sys From: Patrick Kelsey To: Shawn Webb Cc: svn-src-all@freebsd.org, svn-src-head@freebsd.org, src-committers@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 18:49:15 -0000 On Wed, Jul 29, 2015 at 2:43 PM, Shawn Webb wrote: > On Wednesday, 29 July 2015 05:59:14 PM Patrick Kelsey wrote: > > Author: pkelsey > > Date: Wed Jul 29 17:59:13 2015 > > New Revision: 286027 > > URL: https://svnweb.freebsd.org/changeset/base/286027 > > > > Log: > > Revert r265338, r271089 and r271123 as those changes do not handle > > non-inline urgent data and introduce an mbuf exhaustion attack vector > > similar to FreeBSD-SA-15:15.tcp, but not requiring VNETs. > > > > Address the issue described in FreeBSD-SA-15:15.tcp. > > > > Reviewed by: glebius > > Approved by: so > > Approved by: jmallett (mentor) > > Security: FreeBSD-SA-15:15.tcp > > Sponsored by: Norse Corp, Inc. > > Does this commit need to be MFC'd to stable/10? Or is this only for HEAD? > The reverted revisions were only on HEAD after stable/10 was created and never MFC'd. stable/10 only required the fix for FreeBSD-SA-15:15.tcp, which was committed in r285976. -Patrick From owner-svn-src-all@freebsd.org Wed Jul 29 18:55:52 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64B989AE74C; Wed, 29 Jul 2015 18:55:52 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F077C40; Wed, 29 Jul 2015 18:55:52 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TItqKB085892; Wed, 29 Jul 2015 18:55:52 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TItqIj085891; Wed, 29 Jul 2015 18:55:52 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201507291855.t6TItqIj085891@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 29 Jul 2015 18:55:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286031 - head/share/man/man5 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 18:55:52 -0000 Author: emaste Date: Wed Jul 29 18:55:51 2015 New Revision: 286031 URL: https://svnweb.freebsd.org/changeset/base/286031 Log: Regenerate src.conf(5) after r286016 and r286030 Modified: head/share/man/man5/src.conf.5 Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Wed Jul 29 18:45:38 2015 (r286030) +++ head/share/man/man5/src.conf.5 Wed Jul 29 18:55:51 2015 (r286031) @@ -1,7 +1,7 @@ .\" DO NOT EDIT-- this file is automatically generated. -.\" from FreeBSD: head/tools/build/options/makeman 255964 2013-10-01 07:22:04Z des +.\" from FreeBSD: head/tools/build/options/makeman 284708 2015-06-22 20:21:57Z sjg .\" $FreeBSD$ -.Dd June 22, 2015 +.Dd July 29, 2015 .Dt SRC.CONF 5 .Os .Sh NAME @@ -127,7 +127,7 @@ Set to not build .Xr autofs 4 related programs, libraries, and kernel modules. .It Va WITH_AUTO_OBJ -.\" $FreeBSD$ +.\" from FreeBSD: head/tools/build/options/WITH_AUTO_OBJ 284708 2015-06-22 20:21:57Z sjg Enable automatic creation of objdirs. .It Va WITHOUT_BHYVE .\" from FreeBSD: head/tools/build/options/WITHOUT_BHYVE 277727 2015-01-26 06:44:48Z ngie @@ -142,6 +142,9 @@ Set to not build or install binutils (as ld, nm, objcopy, objdump, readelf, size and strip) as part of the normal system build. The resulting system cannot build programs from source. +.Pp +It is a default setting on +arm64/aarch64. .It Va WITHOUT_BINUTILS_BOOTSTRAP .\" from FreeBSD: head/tools/build/options/WITHOUT_BINUTILS_BOOTSTRAP 264660 2014-04-18 17:03:58Z imp Set to not build binutils (as, c++-filt, gconv, @@ -151,6 +154,9 @@ as part of the bootstrap process. The option does not work for build targets unless some alternative toolchain is provided. .Ef +.Pp +It is a default setting on +arm64/aarch64. .It Va WITHOUT_BLUETOOTH .\" from FreeBSD: head/tools/build/options/WITHOUT_BLUETOOTH 156932 2006-03-21 07:50:50Z ru Set to not build Bluetooth related kernel modules, programs and libraries. @@ -243,7 +249,7 @@ When set, it also enforces the following Set to build the Clang C/C++ compiler during the normal phase of the build. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, i386/i386, pc98/i386, powerpc/powerpc and powerpc/powerpc64. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, arm64/aarch64, i386/i386, pc98/i386, powerpc/powerpc and powerpc/powerpc64. .It Va WITHOUT_CLANG_BOOTSTRAP .\" from FreeBSD: head/tools/build/options/WITHOUT_CLANG_BOOTSTRAP 273177 2014-10-16 18:28:11Z skreuzer Set to not build the Clang C/C++ compiler during the bootstrap phase of the build. @@ -258,7 +264,7 @@ mips/mipsel, mips/mips, mips/mips64el, m Set to build the Clang C/C++ compiler during the bootstrap phase of the build. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, i386/i386 and pc98/i386. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, arm64/aarch64, i386/i386 and pc98/i386. .It Va WITH_CLANG_EXTRAS .\" from FreeBSD: head/tools/build/options/WITH_CLANG_EXTRAS 231057 2012-02-05 23:56:22Z dim Set to build additional clang and llvm tools, such as bugpoint. @@ -275,7 +281,7 @@ Set to build the ARCMigrate, Rewriter an Clang C/C++ compiler. .Pp It is a default setting on -amd64/amd64, i386/i386, pc98/i386, powerpc/powerpc and powerpc/powerpc64. +amd64/amd64, arm64/aarch64, i386/i386, pc98/i386, powerpc/powerpc and powerpc/powerpc64. .It Va WITHOUT_CLANG_IS_CC .\" from FreeBSD: head/tools/build/options/WITHOUT_CLANG_IS_CC 242629 2012-11-05 21:53:23Z brooks Set to install the GCC compiler as @@ -295,7 +301,7 @@ and .Pa /usr/bin/cpp . .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, i386/i386 and pc98/i386. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, arm64/aarch64, i386/i386 and pc98/i386. .It Va WITHOUT_CPP .\" from FreeBSD: head/tools/build/options/WITHOUT_CPP 156932 2006-03-21 07:50:50Z ru Set to not build @@ -396,7 +402,7 @@ and are located automatically by .\" from FreeBSD: head/tools/build/options/WITHOUT_DICT 156932 2006-03-21 07:50:50Z ru Set to not build the Webster dictionary files. .It Va WITH_DIRDEPS_CACHE -.\" $FreeBSD$ +.\" from FreeBSD: head/tools/build/options/WITH_DIRDEPS_CACHE 284708 2015-06-22 20:21:57Z sjg Cache result of dirdeps.mk which can save significant time for subsequent builds. Depends on @@ -429,11 +435,29 @@ and related programs. .It Va WITH_EISA .\" from FreeBSD: head/tools/build/options/WITH_EISA 264654 2014-04-18 16:53:06Z imp Set to build EISA kernel modules. +.It Va WITHOUT_ELFCOPY_AS_OBJCOPY +.\" from FreeBSD: head/tools/build/options/WITHOUT_ELFCOPY_AS_OBJCOPY 286030 2015-07-29 18:45:38Z emaste +Set to build and install +.Xr objcopy 1 +from GNU Binutils, instead of the one from ELF Tool Chain. +.Pp +It is a default setting on +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, pc98/i386, powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64. +.It Va WITH_ELFCOPY_AS_OBJCOPY +.\" from FreeBSD: head/tools/build/options/WITH_ELFCOPY_AS_OBJCOPY 286030 2015-07-29 18:45:38Z emaste +Set to build and install ELF Tool Chain's elfcopy as +.Xr objcopy 1 , +instead of the one from GNU Binutils. +.Pp +It is a default setting on +arm64/aarch64. .It Va WITHOUT_ELFTOOLCHAIN_TOOLS -.\" from FreeBSD: head/tools/build/options/WITHOUT_ELFTOOLCHAIN_TOOLS 276796 2015-01-07 22:02:37Z emaste +.\" from FreeBSD: head/tools/build/options/WITHOUT_ELFTOOLCHAIN_TOOLS 286016 2015-07-29 15:42:22Z emaste Set to use .Xr addr2line 1 , +.Xr c++filt 1 , .Xr nm 1 , +.Xr readelf 1 , .Xr size 1 , .Xr strings 1 , and @@ -462,11 +486,6 @@ and .\" from FreeBSD: head/tools/build/options/WITHOUT_FLOPPY 221540 2011-05-06 19:13:03Z ru Set to not build or install programs for operating floppy disk driver. -.It Va WITH_FMAKE -.\" from FreeBSD: head/tools/build/options/WITH_FMAKE 275138 2014-11-26 20:43:09Z gjb -Causes the old FreeBSD -.Xr make 1 -program to be built and installed as fmake. .It Va WITHOUT_FMTREE .\" from FreeBSD: head/tools/build/options/WITHOUT_FMTREE 261299 2014-01-30 21:37:43Z brooks Set to not build and install @@ -503,7 +522,7 @@ Set to not build games. Set to not build and install gcc and g++ as part of the normal build process. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, i386/i386 and pc98/i386. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, arm64/aarch64, i386/i386 and pc98/i386. .It Va WITH_GCC .\" from FreeBSD: head/tools/build/options/WITH_GCC 255326 2013-09-06 20:49:48Z zeising Set to build and install gcc and g++. @@ -518,7 +537,7 @@ unless an alternative compiler is provid XCC. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, i386/i386 and pc98/i386. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, arm64/aarch64, i386/i386 and pc98/i386. .It Va WITH_GCC_BOOTSTRAP .\" from FreeBSD: head/tools/build/options/WITH_GCC_BOOTSTRAP 264660 2014-04-18 17:03:58Z imp Set to build gcc and g++ as part of the bootstrap process. @@ -534,6 +553,9 @@ tool. .\" from FreeBSD: head/tools/build/options/WITHOUT_GDB 156932 2006-03-21 07:50:50Z ru Set to not build .Xr gdb 1 . +.Pp +It is a default setting on +arm64/aarch64. .It Va WITHOUT_GNU .\" from FreeBSD: head/tools/build/options/WITHOUT_GNU 174550 2007-12-12 16:43:17Z ru Set to not build contributed GNU software as a part of the base system. @@ -554,7 +576,7 @@ Do not build the GNU C++ stack (g++, lib This is the default on platforms where clang is the system compiler. .Pp It is a default setting on -amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, i386/i386 and pc98/i386. +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm/armv6hf, arm64/aarch64, i386/i386 and pc98/i386. .It Va WITH_GNUCXX .\" from FreeBSD: head/tools/build/options/WITH_GNUCXX 255321 2013-09-06 20:08:03Z theraven Build the GNU C++ stack (g++, libstdc++). @@ -861,11 +883,11 @@ Set to not build utilities for manual pa .Xr manctl 8 , and related support files. .It Va WITH_META_FILES -.\" $FreeBSD$ +.\" from FreeBSD: head/tools/build/options/WITH_META_FILES 284708 2015-06-22 20:21:57Z sjg Create meta files during non META_MODE build. The meta files can be useful for debugging. .It Va WITH_META_MODE -.\" $FreeBSD$ +.\" from FreeBSD: head/tools/build/options/WITH_META_MODE 284708 2015-06-22 20:21:57Z sjg Enable building in meta mode. .Pp The build is driven by dirdeps.mk using DIRDEPS stored in @@ -1153,7 +1175,7 @@ Set to not build kernel modules that inc .\" from FreeBSD: head/tools/build/options/WITHOUT_SSP 180012 2008-06-25 21:33:28Z ru Set to not build world with propolice stack smashing protection. .It Va WITH_STAGING -.\" $FreeBSD$ +.\" from FreeBSD: head/tools/build/options/WITH_STAGING 284708 2015-06-22 20:21:57Z sjg Enable staging of files to a stage tree. This can be best thought of as auto-install to .Va DESTDIR @@ -1173,13 +1195,13 @@ is set explicitly) is set explicitly) .El .It Va WITH_STAGING_MAN -.\" $FreeBSD$ +.\" from FreeBSD: head/tools/build/options/WITH_STAGING_MAN 284708 2015-06-22 20:21:57Z sjg Enable staging of MAN pages to stage tree. .It Va WITH_STAGING_PROG -.\" $FreeBSD$ +.\" from FreeBSD: head/tools/build/options/WITH_STAGING_PROG 284708 2015-06-22 20:21:57Z sjg Enable staging of PROGs to stage tree. .It Va WITH_STALE_STAGED -.\" $FreeBSD$ +.\" from FreeBSD: head/tools/build/options/WITH_STALE_STAGED 284708 2015-06-22 20:21:57Z sjg Check staged files are not stale. .It Va WITH_SVN .\" from FreeBSD: head/tools/build/options/WITH_SVN 252561 2013-07-03 12:36:47Z zeising @@ -1206,7 +1228,7 @@ Set to not build .Xr sysinstall 8 and related programs. .It Va WITH_SYSROOT -.\" $FreeBSD$ +.\" from FreeBSD: head/tools/build/options/WITH_SYSROOT 284708 2015-06-22 20:21:57Z sjg Enable use of sysroot during build. Depends on .Va WITH_META_MODE . From owner-svn-src-all@freebsd.org Wed Jul 29 19:06:54 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84AF19AE95F; Wed, 29 Jul 2015 19:06:54 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 755E71132; Wed, 29 Jul 2015 19:06:54 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TJ6s7M090236; Wed, 29 Jul 2015 19:06:54 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TJ6sIu090235; Wed, 29 Jul 2015 19:06:54 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201507291906.t6TJ6sIu090235@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 29 Jul 2015 19:06:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286032 - head/share/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 19:06:54 -0000 Author: emaste Date: Wed Jul 29 19:06:53 2015 New Revision: 286032 URL: https://svnweb.freebsd.org/changeset/base/286032 Log: Use default CLANG build options for ARM We previously disabled CLANG_FULL on (little-endian) ARM because the build failed. This is no longer the case and as of Clang 3.5 we cannot build any part of the in-tree Clang with in-tree GCC, so it's no longer necessary to disable CLANG_FULL. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D2525 Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Wed Jul 29 18:55:51 2015 (r286031) +++ head/share/mk/src.opts.mk Wed Jul 29 19:06:53 2015 (r286032) @@ -214,15 +214,11 @@ __TT=${MACHINE} # If the compiler is not C++11 capable, disable clang and use gcc instead. __DEFAULT_YES_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX __DEFAULT_NO_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC -.elif ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386" -# On x86 and arm64, clang is enabled, and will be installed as the default cc. +.elif ${__T} == "aarch64" || ${__T} == "amd64" || ${__TT} == "arm" || \ + ${__T} == "i386" +# On x86 and arm, clang is enabled, and will be installed as the default cc. __DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_FULL CLANG_IS_CC __DEFAULT_NO_OPTIONS+=GCC GCC_BOOTSTRAP GNUCXX -.elif ${__TT} == "arm" -# On arm, clang is enabled, and it is installed as the default cc, but -# since gcc is unable to build the full clang, disable it by default. -__DEFAULT_YES_OPTIONS+=CLANG CLANG_BOOTSTRAP CLANG_IS_CC -__DEFAULT_NO_OPTIONS+=CLANG_FULL GCC GCC_BOOTSTRAP GNUCXX .elif ${__T:Mpowerpc*} # On powerpc, clang is enabled, but gcc is installed as the default cc. __DEFAULT_YES_OPTIONS+=CLANG CLANG_FULL GCC GCC_BOOTSTRAP GNUCXX From owner-svn-src-all@freebsd.org Wed Jul 29 19:25:30 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3254E9AEDF7; Wed, 29 Jul 2015 19:25:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 163A51D6F; Wed, 29 Jul 2015 19:25:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TJPTIJ098206; Wed, 29 Jul 2015 19:25:29 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TJPTSM098203; Wed, 29 Jul 2015 19:25:29 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507291925.t6TJPTSM098203@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 29 Jul 2015 19:25:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286033 - in stable/10/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 19:25:30 -0000 Author: dim Date: Wed Jul 29 19:25:28 2015 New Revision: 286033 URL: https://svnweb.freebsd.org/changeset/base/286033 Log: Reapply r286007, modified to compile with pre-C++11 compilers: Pull in r219009 from upstream llvm trunk (by Adam Nemet): [ISel] Keep matching state consistent when folding during X86 address match In the X86 backend, matching an address is initiated by the 'addr' complex pattern and its friends. During this process we may reassociate and-of-shift into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the shift into the scale of the address. However as demonstrated by the testcase, this can trigger CSE of not only the shift and the AND which the code is prepared for but also the underlying load node. In the testcase this node is sitting in the RecordedNode and MatchScope data structures of the matcher and becomes a deleted node upon CSE. Returning from the complex pattern function, we try to access it again hitting an assert because the node is no longer a load even though this was checked before. Now obviously changing the DAG this late is bending the rules but I think it makes sense somewhat. Outside of addresses we prefer and-of-shift because it may lead to smaller immediates (FoldMaskAndShiftToScale is an even better example because it create a non-canonical node). We currently don't recognize addresses during DAGCombiner where arguably this canonicalization should be performed. On the other hand, having this in the matcher allows us to cover all the cases where an address can be used in an instruction. I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW for the new shift node in FoldMaskedShiftToScaledMask. This RAUW is responsible for initiating the recursive CSE on users (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but it is not strictly necessary since the shift is hooked into the visited user. Of course it's safer to keep the DAG consistent at all times (e.g. for accurate number of uses, etc.). So rather than changing the fundamentals, I've decided to continue along the previous patches and detect the CSE. This patch installs a very targeted DAGUpdateListener for the duration of a complex-pattern match and updates the matching state accordingly. (Previous patches used HandleSDNode to detect the CSE but that's not practical here). The listener is only installed on X86. I tested that there is no measurable overhead due to this while running through the spec2k BC files with llc. The only thing we pay for is the creation of the listener. The callback never ever triggers in spec2k since this is a corner case. Fixes rdar://problem/18206171 This fixes a possible crash in x86 code generation when compiling recent llvm/clang trunk sources. Direct commit to stable/10, since head already has llvm/clang 3.6.1, which includes this fix. Reported by: jonathan, theraven Upstream PR: https://llvm.org/bugs/show_bug.cgi?id=24249 Modified: stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Modified: stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h ============================================================================== --- stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 19:06:53 2015 (r286032) +++ stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 19:25:28 2015 (r286033) @@ -238,6 +238,12 @@ public: const unsigned char *MatcherTable, unsigned TableSize); + /// \brief Return true if complex patterns for this target can mutate the + /// DAG. + virtual bool ComplexPatternFuncMutatesDAG() const { + return false; + } + private: // Calls to these functions are generated by tblgen. Modified: stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ============================================================================== --- stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 19:06:53 2015 (r286032) +++ stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 19:25:28 2015 (r286033) @@ -2345,6 +2345,45 @@ struct MatchScope { bool HasChainNodesMatched, HasGlueResultNodesMatched; }; +/// \\brief A DAG update listener to keep the matching state +/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to +/// change the DAG while matching. X86 addressing mode matcher is an example +/// for this. +class MatchStateUpdater : public SelectionDAG::DAGUpdateListener +{ + SmallVectorImpl > &RecordedNodes; + SmallVectorImpl &MatchScopes; +public: + MatchStateUpdater(SelectionDAG &DAG, + SmallVectorImpl > &RN, + SmallVectorImpl &MS) : + SelectionDAG::DAGUpdateListener(DAG), + RecordedNodes(RN), MatchScopes(MS) { } + + void NodeDeleted(SDNode *N, SDNode *E) { + // Some early-returns here to avoid the search if we deleted the node or + // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we + // do, so it's unnecessary to update matching state at that point). + // Neither of these can occur currently because we only install this + // update listener during matching a complex patterns. + if (!E || E->isMachineOpcode()) + return; + // Performing linear search here does not matter because we almost never + // run this code. You'd have to have a CSE during complex pattern + // matching. + for (SmallVectorImpl >::iterator I = + RecordedNodes.begin(), IE = RecordedNodes.end(); I != IE; ++I) + if (I->first.getNode() == N) + I->first.setNode(E); + + for (SmallVectorImpl::iterator I = MatchScopes.begin(), + IE = MatchScopes.end(); I != IE; ++I) + for (SmallVector::iterator J = I->NodeStack.begin(), + JE = I->NodeStack.end(); J != JE; ++J) + if (J->getNode() == N) + J->setNode(E); + } +}; } SDNode *SelectionDAGISel:: @@ -2599,6 +2638,14 @@ SelectCodeCommon(SDNode *NodeToMatch, co unsigned CPNum = MatcherTable[MatcherIndex++]; unsigned RecNo = MatcherTable[MatcherIndex++]; assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); + + // If target can modify DAG during matching, keep the matching state + // consistent. + OwningPtr MSU; + if (ComplexPatternFuncMutatesDAG()) + MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, + MatchScopes)); + if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, RecordedNodes[RecNo].first, CPNum, RecordedNodes)) Modified: stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp ============================================================================== --- stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 19:06:53 2015 (r286032) +++ stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 19:25:28 2015 (r286033) @@ -290,6 +290,13 @@ namespace { const X86InstrInfo *getInstrInfo() const { return getTargetMachine().getInstrInfo(); } + + /// \brief Address-mode matching performs shift-of-and to and-of-shift + /// reassociation in order to expose more scaled addressing + /// opportunities. + bool ComplexPatternFuncMutatesDAG() const { + return true; + } }; } From owner-svn-src-all@freebsd.org Wed Jul 29 19:27:58 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49E1C9AEE6A; Wed, 29 Jul 2015 19:27:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 38FC91F4D; Wed, 29 Jul 2015 19:27:58 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TJRwLD098371; Wed, 29 Jul 2015 19:27:58 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TJRwcH098369; Wed, 29 Jul 2015 19:27:58 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507291927.t6TJRwcH098369@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 29 Jul 2015 19:27:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286034 - stable/10/contrib/llvm/patches X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 19:27:58 -0000 Author: dim Date: Wed Jul 29 19:27:57 2015 New Revision: 286034 URL: https://svnweb.freebsd.org/changeset/base/286034 Log: Add updated llvm patch corresponding to r286033. Added: stable/10/contrib/llvm/patches/patch-r286033-llvm-r219009-x86-codegen-crash.diff Added: stable/10/contrib/llvm/patches/patch-r286033-llvm-r219009-x86-codegen-crash.diff ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/llvm/patches/patch-r286033-llvm-r219009-x86-codegen-crash.diff Wed Jul 29 19:27:57 2015 (r286034) @@ -0,0 +1,217 @@ +Pull in r219009 from upstream llvm trunk (by Adam Nemet): + + [ISel] Keep matching state consistent when folding during X86 address match + + In the X86 backend, matching an address is initiated by the 'addr' complex + pattern and its friends. During this process we may reassociate and-of-shift + into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the + shift into the scale of the address. + + However as demonstrated by the testcase, this can trigger CSE of not only the + shift and the AND which the code is prepared for but also the underlying load + node. In the testcase this node is sitting in the RecordedNode and MatchScope + data structures of the matcher and becomes a deleted node upon CSE. Returning + from the complex pattern function, we try to access it again hitting an assert + because the node is no longer a load even though this was checked before. + + Now obviously changing the DAG this late is bending the rules but I think it + makes sense somewhat. Outside of addresses we prefer and-of-shift because it + may lead to smaller immediates (FoldMaskAndShiftToScale is an even better + example because it create a non-canonical node). We currently don't recognize + addresses during DAGCombiner where arguably this canonicalization should be + performed. On the other hand, having this in the matcher allows us to cover + all the cases where an address can be used in an instruction. + + I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW for + the new shift node in FoldMaskedShiftToScaledMask. This RAUW is responsible + for initiating the recursive CSE on users + (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but it + is not strictly necessary since the shift is hooked into the visited user. Of + course it's safer to keep the DAG consistent at all times (e.g. for accurate + number of uses, etc.). + + So rather than changing the fundamentals, I've decided to continue along the + previous patches and detect the CSE. This patch installs a very targeted + DAGUpdateListener for the duration of a complex-pattern match and updates the + matching state accordingly. (Previous patches used HandleSDNode to detect the + CSE but that's not practical here). The listener is only installed on X86. + + I tested that there is no measurable overhead due to this while running + through the spec2k BC files with llc. The only thing we pay for is the + creation of the listener. The callback never ever triggers in spec2k since + this is a corner case. + + Fixes rdar://problem/18206171 + +This fixes a possible crash in x86 code generation when compiling recent +llvm/clang trunk sources. + +Introduced here: http://svnweb.freebsd.org/changeset/base/286033 + +Index: include/llvm/CodeGen/SelectionDAGISel.h +=================================================================== +--- include/llvm/CodeGen/SelectionDAGISel.h ++++ include/llvm/CodeGen/SelectionDAGISel.h +@@ -238,6 +238,12 @@ class SelectionDAGISel : public MachineFunctionPas + const unsigned char *MatcherTable, + unsigned TableSize); + ++ /// \brief Return true if complex patterns for this target can mutate the ++ /// DAG. ++ virtual bool ComplexPatternFuncMutatesDAG() const { ++ return false; ++ } ++ + private: + + // Calls to these functions are generated by tblgen. +Index: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +=================================================================== +--- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ++++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +@@ -2345,6 +2345,45 @@ struct MatchScope { + bool HasChainNodesMatched, HasGlueResultNodesMatched; + }; + ++/// \\brief A DAG update listener to keep the matching state ++/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to ++/// change the DAG while matching. X86 addressing mode matcher is an example ++/// for this. ++class MatchStateUpdater : public SelectionDAG::DAGUpdateListener ++{ ++ SmallVectorImpl > &RecordedNodes; ++ SmallVectorImpl &MatchScopes; ++public: ++ MatchStateUpdater(SelectionDAG &DAG, ++ SmallVectorImpl > &RN, ++ SmallVectorImpl &MS) : ++ SelectionDAG::DAGUpdateListener(DAG), ++ RecordedNodes(RN), MatchScopes(MS) { } ++ ++ void NodeDeleted(SDNode *N, SDNode *E) { ++ // Some early-returns here to avoid the search if we deleted the node or ++ // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we ++ // do, so it's unnecessary to update matching state at that point). ++ // Neither of these can occur currently because we only install this ++ // update listener during matching a complex patterns. ++ if (!E || E->isMachineOpcode()) ++ return; ++ // Performing linear search here does not matter because we almost never ++ // run this code. You'd have to have a CSE during complex pattern ++ // matching. ++ for (SmallVectorImpl >::iterator I = ++ RecordedNodes.begin(), IE = RecordedNodes.end(); I != IE; ++I) ++ if (I->first.getNode() == N) ++ I->first.setNode(E); ++ ++ for (SmallVectorImpl::iterator I = MatchScopes.begin(), ++ IE = MatchScopes.end(); I != IE; ++I) ++ for (SmallVector::iterator J = I->NodeStack.begin(), ++ JE = I->NodeStack.end(); J != JE; ++J) ++ if (J->getNode() == N) ++ J->setNode(E); ++ } ++}; + } + + SDNode *SelectionDAGISel:: +@@ -2599,6 +2638,14 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsign + unsigned CPNum = MatcherTable[MatcherIndex++]; + unsigned RecNo = MatcherTable[MatcherIndex++]; + assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); ++ ++ // If target can modify DAG during matching, keep the matching state ++ // consistent. ++ OwningPtr MSU; ++ if (ComplexPatternFuncMutatesDAG()) ++ MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, ++ MatchScopes)); ++ + if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, + RecordedNodes[RecNo].first, CPNum, + RecordedNodes)) +Index: lib/Target/X86/X86ISelDAGToDAG.cpp +=================================================================== +--- lib/Target/X86/X86ISelDAGToDAG.cpp ++++ lib/Target/X86/X86ISelDAGToDAG.cpp +@@ -290,6 +290,13 @@ namespace { + const X86InstrInfo *getInstrInfo() const { + return getTargetMachine().getInstrInfo(); + } ++ ++ /// \brief Address-mode matching performs shift-of-and to and-of-shift ++ /// reassociation in order to expose more scaled addressing ++ /// opportunities. ++ bool ComplexPatternFuncMutatesDAG() const { ++ return true; ++ } + }; + } + +Index: test/CodeGen/X86/addr-mode-matcher.ll +=================================================================== +--- test/CodeGen/X86/addr-mode-matcher.ll ++++ test/CodeGen/X86/addr-mode-matcher.ll +@@ -0,0 +1,62 @@ ++; RUN: llc < %s | FileCheck %s ++ ++; This testcase used to hit an assert during ISel. For details, see the big ++; comment inside the function. ++ ++; CHECK-LABEL: foo: ++; The AND should be turned into a subreg access. ++; CHECK-NOT: and ++; The shift (leal) should be folded into the scale of the address in the load. ++; CHECK-NOT: leal ++; CHECK: movl {{.*}},4), ++ ++target datalayout = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128" ++target triple = "i386-apple-macosx10.6.0" ++ ++define void @foo(i32 %a) { ++bb: ++ br label %bb1692 ++ ++bb1692: ++ %tmp1694 = phi i32 [ 0, %bb ], [ %tmp1745, %bb1692 ] ++ %xor = xor i32 0, %tmp1694 ++ ++; %load1 = (load (and (shl %xor, 2), 1020)) ++ %tmp1701 = shl i32 %xor, 2 ++ %tmp1702 = and i32 %tmp1701, 1020 ++ %tmp1703 = getelementptr inbounds [1028 x i8]* null, i32 0, i32 %tmp1702 ++ %tmp1704 = bitcast i8* %tmp1703 to i32* ++ %load1 = load i32* %tmp1704, align 4 ++ ++; %load2 = (load (shl (and %xor, 255), 2)) ++ %tmp1698 = and i32 %xor, 255 ++ %tmp1706 = shl i32 %tmp1698, 2 ++ %tmp1707 = getelementptr inbounds [1028 x i8]* null, i32 0, i32 %tmp1706 ++ %tmp1708 = bitcast i8* %tmp1707 to i32* ++ %load2 = load i32* %tmp1708, align 4 ++ ++ %tmp1710 = or i32 %load2, %a ++ ++; While matching xor we address-match %load1. The and-of-shift reassocication ++; in address matching transform this into into a shift-of-and and the resuting ++; node becomes identical to %load2. CSE replaces %load1 which leaves its ++; references in MatchScope and RecordedNodes stale. ++ %tmp1711 = xor i32 %load1, %tmp1710 ++ ++ %tmp1744 = getelementptr inbounds [256 x i32]* null, i32 0, i32 %tmp1711 ++ store i32 0, i32* %tmp1744, align 4 ++ %tmp1745 = add i32 %tmp1694, 1 ++ indirectbr i8* undef, [label %bb1756, label %bb1692] ++ ++bb1756: ++ br label %bb2705 ++ ++bb2705: ++ indirectbr i8* undef, [label %bb5721, label %bb5736] ++ ++bb5721: ++ br label %bb2705 ++ ++bb5736: ++ ret void ++} From owner-svn-src-all@freebsd.org Wed Jul 29 19:37:34 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7A2029AD12C; Wed, 29 Jul 2015 19:37:34 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 684947D8; Wed, 29 Jul 2015 19:37:34 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TJbYUe002568; Wed, 29 Jul 2015 19:37:34 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TJbXAP002561; Wed, 29 Jul 2015 19:37:33 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507291937.t6TJbXAP002561@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 29 Jul 2015 19:37:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r286035 - in stable/9/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86 patches X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 19:37:34 -0000 Author: dim Date: Wed Jul 29 19:37:32 2015 New Revision: 286035 URL: https://svnweb.freebsd.org/changeset/base/286035 Log: Merge r286033 from stable/10: Reapply r286007, modified to compile with pre-C++11 compilers: Pull in r219009 from upstream llvm trunk (by Adam Nemet): [ISel] Keep matching state consistent when folding during X86 address match In the X86 backend, matching an address is initiated by the 'addr' complex pattern and its friends. During this process we may reassociate and-of-shift into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the shift into the scale of the address. However as demonstrated by the testcase, this can trigger CSE of not only the shift and the AND which the code is prepared for but also the underlying load node. In the testcase this node is sitting in the RecordedNode and MatchScope data structures of the matcher and becomes a deleted node upon CSE. Returning from the complex pattern function, we try to access it again hitting an assert because the node is no longer a load even though this was checked before. Now obviously changing the DAG this late is bending the rules but I think it makes sense somewhat. Outside of addresses we prefer and-of-shift because it may lead to smaller immediates (FoldMaskAndShiftToScale is an even better example because it create a non-canonical node). We currently don't recognize addresses during DAGCombiner where arguably this canonicalization should be performed. On the other hand, having this in the matcher allows us to cover all the cases where an address can be used in an instruction. I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW for the new shift node in FoldMaskedShiftToScaledMask. This RAUW is responsible for initiating the recursive CSE on users (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but it is not strictly necessary since the shift is hooked into the visited user. Of course it's safer to keep the DAG consistent at all times (e.g. for accurate number of uses, etc.). So rather than changing the fundamentals, I've decided to continue along the previous patches and detect the CSE. This patch installs a very targeted DAGUpdateListener for the duration of a complex-pattern match and updates the matching state accordingly. (Previous patches used HandleSDNode to detect the CSE but that's not practical here). The listener is only installed on X86. I tested that there is no measurable overhead due to this while running through the spec2k BC files with llc. The only thing we pay for is the creation of the listener. The callback never ever triggers in spec2k since this is a corner case. Fixes rdar://problem/18206171 This fixes a possible crash in x86 code generation when compiling recent llvm/clang trunk sources. Direct commit to stable/10, since head already has llvm/clang 3.6.1, which includes this fix. Reported by: jonathan, theraven Upstream PR: https://llvm.org/bugs/show_bug.cgi?id=24249 Merge r286034 from stable/10: Add updated llvm patch corresponding to r286033. Added: stable/9/contrib/llvm/patches/patch-r286033-llvm-r219009-x86-codegen-crash.diff - copied unchanged from r286034, stable/10/contrib/llvm/patches/patch-r286033-llvm-r219009-x86-codegen-crash.diff Modified: stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Directory Properties: stable/9/ (props changed) stable/9/contrib/ (props changed) stable/9/contrib/llvm/ (props changed) Modified: stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h ============================================================================== --- stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 19:27:57 2015 (r286034) +++ stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 19:37:32 2015 (r286035) @@ -238,6 +238,12 @@ public: const unsigned char *MatcherTable, unsigned TableSize); + /// \brief Return true if complex patterns for this target can mutate the + /// DAG. + virtual bool ComplexPatternFuncMutatesDAG() const { + return false; + } + private: // Calls to these functions are generated by tblgen. Modified: stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ============================================================================== --- stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 19:27:57 2015 (r286034) +++ stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 19:37:32 2015 (r286035) @@ -2345,6 +2345,45 @@ struct MatchScope { bool HasChainNodesMatched, HasGlueResultNodesMatched; }; +/// \\brief A DAG update listener to keep the matching state +/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to +/// change the DAG while matching. X86 addressing mode matcher is an example +/// for this. +class MatchStateUpdater : public SelectionDAG::DAGUpdateListener +{ + SmallVectorImpl > &RecordedNodes; + SmallVectorImpl &MatchScopes; +public: + MatchStateUpdater(SelectionDAG &DAG, + SmallVectorImpl > &RN, + SmallVectorImpl &MS) : + SelectionDAG::DAGUpdateListener(DAG), + RecordedNodes(RN), MatchScopes(MS) { } + + void NodeDeleted(SDNode *N, SDNode *E) { + // Some early-returns here to avoid the search if we deleted the node or + // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we + // do, so it's unnecessary to update matching state at that point). + // Neither of these can occur currently because we only install this + // update listener during matching a complex patterns. + if (!E || E->isMachineOpcode()) + return; + // Performing linear search here does not matter because we almost never + // run this code. You'd have to have a CSE during complex pattern + // matching. + for (SmallVectorImpl >::iterator I = + RecordedNodes.begin(), IE = RecordedNodes.end(); I != IE; ++I) + if (I->first.getNode() == N) + I->first.setNode(E); + + for (SmallVectorImpl::iterator I = MatchScopes.begin(), + IE = MatchScopes.end(); I != IE; ++I) + for (SmallVector::iterator J = I->NodeStack.begin(), + JE = I->NodeStack.end(); J != JE; ++J) + if (J->getNode() == N) + J->setNode(E); + } +}; } SDNode *SelectionDAGISel:: @@ -2599,6 +2638,14 @@ SelectCodeCommon(SDNode *NodeToMatch, co unsigned CPNum = MatcherTable[MatcherIndex++]; unsigned RecNo = MatcherTable[MatcherIndex++]; assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); + + // If target can modify DAG during matching, keep the matching state + // consistent. + OwningPtr MSU; + if (ComplexPatternFuncMutatesDAG()) + MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, + MatchScopes)); + if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, RecordedNodes[RecNo].first, CPNum, RecordedNodes)) Modified: stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp ============================================================================== --- stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 19:27:57 2015 (r286034) +++ stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 19:37:32 2015 (r286035) @@ -290,6 +290,13 @@ namespace { const X86InstrInfo *getInstrInfo() const { return getTargetMachine().getInstrInfo(); } + + /// \brief Address-mode matching performs shift-of-and to and-of-shift + /// reassociation in order to expose more scaled addressing + /// opportunities. + bool ComplexPatternFuncMutatesDAG() const { + return true; + } }; } Copied: stable/9/contrib/llvm/patches/patch-r286033-llvm-r219009-x86-codegen-crash.diff (from r286034, stable/10/contrib/llvm/patches/patch-r286033-llvm-r219009-x86-codegen-crash.diff) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/contrib/llvm/patches/patch-r286033-llvm-r219009-x86-codegen-crash.diff Wed Jul 29 19:37:32 2015 (r286035, copy of r286034, stable/10/contrib/llvm/patches/patch-r286033-llvm-r219009-x86-codegen-crash.diff) @@ -0,0 +1,217 @@ +Pull in r219009 from upstream llvm trunk (by Adam Nemet): + + [ISel] Keep matching state consistent when folding during X86 address match + + In the X86 backend, matching an address is initiated by the 'addr' complex + pattern and its friends. During this process we may reassociate and-of-shift + into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the + shift into the scale of the address. + + However as demonstrated by the testcase, this can trigger CSE of not only the + shift and the AND which the code is prepared for but also the underlying load + node. In the testcase this node is sitting in the RecordedNode and MatchScope + data structures of the matcher and becomes a deleted node upon CSE. Returning + from the complex pattern function, we try to access it again hitting an assert + because the node is no longer a load even though this was checked before. + + Now obviously changing the DAG this late is bending the rules but I think it + makes sense somewhat. Outside of addresses we prefer and-of-shift because it + may lead to smaller immediates (FoldMaskAndShiftToScale is an even better + example because it create a non-canonical node). We currently don't recognize + addresses during DAGCombiner where arguably this canonicalization should be + performed. On the other hand, having this in the matcher allows us to cover + all the cases where an address can be used in an instruction. + + I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW for + the new shift node in FoldMaskedShiftToScaledMask. This RAUW is responsible + for initiating the recursive CSE on users + (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but it + is not strictly necessary since the shift is hooked into the visited user. Of + course it's safer to keep the DAG consistent at all times (e.g. for accurate + number of uses, etc.). + + So rather than changing the fundamentals, I've decided to continue along the + previous patches and detect the CSE. This patch installs a very targeted + DAGUpdateListener for the duration of a complex-pattern match and updates the + matching state accordingly. (Previous patches used HandleSDNode to detect the + CSE but that's not practical here). The listener is only installed on X86. + + I tested that there is no measurable overhead due to this while running + through the spec2k BC files with llc. The only thing we pay for is the + creation of the listener. The callback never ever triggers in spec2k since + this is a corner case. + + Fixes rdar://problem/18206171 + +This fixes a possible crash in x86 code generation when compiling recent +llvm/clang trunk sources. + +Introduced here: http://svnweb.freebsd.org/changeset/base/286033 + +Index: include/llvm/CodeGen/SelectionDAGISel.h +=================================================================== +--- include/llvm/CodeGen/SelectionDAGISel.h ++++ include/llvm/CodeGen/SelectionDAGISel.h +@@ -238,6 +238,12 @@ class SelectionDAGISel : public MachineFunctionPas + const unsigned char *MatcherTable, + unsigned TableSize); + ++ /// \brief Return true if complex patterns for this target can mutate the ++ /// DAG. ++ virtual bool ComplexPatternFuncMutatesDAG() const { ++ return false; ++ } ++ + private: + + // Calls to these functions are generated by tblgen. +Index: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +=================================================================== +--- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ++++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +@@ -2345,6 +2345,45 @@ struct MatchScope { + bool HasChainNodesMatched, HasGlueResultNodesMatched; + }; + ++/// \\brief A DAG update listener to keep the matching state ++/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to ++/// change the DAG while matching. X86 addressing mode matcher is an example ++/// for this. ++class MatchStateUpdater : public SelectionDAG::DAGUpdateListener ++{ ++ SmallVectorImpl > &RecordedNodes; ++ SmallVectorImpl &MatchScopes; ++public: ++ MatchStateUpdater(SelectionDAG &DAG, ++ SmallVectorImpl > &RN, ++ SmallVectorImpl &MS) : ++ SelectionDAG::DAGUpdateListener(DAG), ++ RecordedNodes(RN), MatchScopes(MS) { } ++ ++ void NodeDeleted(SDNode *N, SDNode *E) { ++ // Some early-returns here to avoid the search if we deleted the node or ++ // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we ++ // do, so it's unnecessary to update matching state at that point). ++ // Neither of these can occur currently because we only install this ++ // update listener during matching a complex patterns. ++ if (!E || E->isMachineOpcode()) ++ return; ++ // Performing linear search here does not matter because we almost never ++ // run this code. You'd have to have a CSE during complex pattern ++ // matching. ++ for (SmallVectorImpl >::iterator I = ++ RecordedNodes.begin(), IE = RecordedNodes.end(); I != IE; ++I) ++ if (I->first.getNode() == N) ++ I->first.setNode(E); ++ ++ for (SmallVectorImpl::iterator I = MatchScopes.begin(), ++ IE = MatchScopes.end(); I != IE; ++I) ++ for (SmallVector::iterator J = I->NodeStack.begin(), ++ JE = I->NodeStack.end(); J != JE; ++J) ++ if (J->getNode() == N) ++ J->setNode(E); ++ } ++}; + } + + SDNode *SelectionDAGISel:: +@@ -2599,6 +2638,14 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsign + unsigned CPNum = MatcherTable[MatcherIndex++]; + unsigned RecNo = MatcherTable[MatcherIndex++]; + assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); ++ ++ // If target can modify DAG during matching, keep the matching state ++ // consistent. ++ OwningPtr MSU; ++ if (ComplexPatternFuncMutatesDAG()) ++ MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, ++ MatchScopes)); ++ + if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, + RecordedNodes[RecNo].first, CPNum, + RecordedNodes)) +Index: lib/Target/X86/X86ISelDAGToDAG.cpp +=================================================================== +--- lib/Target/X86/X86ISelDAGToDAG.cpp ++++ lib/Target/X86/X86ISelDAGToDAG.cpp +@@ -290,6 +290,13 @@ namespace { + const X86InstrInfo *getInstrInfo() const { + return getTargetMachine().getInstrInfo(); + } ++ ++ /// \brief Address-mode matching performs shift-of-and to and-of-shift ++ /// reassociation in order to expose more scaled addressing ++ /// opportunities. ++ bool ComplexPatternFuncMutatesDAG() const { ++ return true; ++ } + }; + } + +Index: test/CodeGen/X86/addr-mode-matcher.ll +=================================================================== +--- test/CodeGen/X86/addr-mode-matcher.ll ++++ test/CodeGen/X86/addr-mode-matcher.ll +@@ -0,0 +1,62 @@ ++; RUN: llc < %s | FileCheck %s ++ ++; This testcase used to hit an assert during ISel. For details, see the big ++; comment inside the function. ++ ++; CHECK-LABEL: foo: ++; The AND should be turned into a subreg access. ++; CHECK-NOT: and ++; The shift (leal) should be folded into the scale of the address in the load. ++; CHECK-NOT: leal ++; CHECK: movl {{.*}},4), ++ ++target datalayout = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128" ++target triple = "i386-apple-macosx10.6.0" ++ ++define void @foo(i32 %a) { ++bb: ++ br label %bb1692 ++ ++bb1692: ++ %tmp1694 = phi i32 [ 0, %bb ], [ %tmp1745, %bb1692 ] ++ %xor = xor i32 0, %tmp1694 ++ ++; %load1 = (load (and (shl %xor, 2), 1020)) ++ %tmp1701 = shl i32 %xor, 2 ++ %tmp1702 = and i32 %tmp1701, 1020 ++ %tmp1703 = getelementptr inbounds [1028 x i8]* null, i32 0, i32 %tmp1702 ++ %tmp1704 = bitcast i8* %tmp1703 to i32* ++ %load1 = load i32* %tmp1704, align 4 ++ ++; %load2 = (load (shl (and %xor, 255), 2)) ++ %tmp1698 = and i32 %xor, 255 ++ %tmp1706 = shl i32 %tmp1698, 2 ++ %tmp1707 = getelementptr inbounds [1028 x i8]* null, i32 0, i32 %tmp1706 ++ %tmp1708 = bitcast i8* %tmp1707 to i32* ++ %load2 = load i32* %tmp1708, align 4 ++ ++ %tmp1710 = or i32 %load2, %a ++ ++; While matching xor we address-match %load1. The and-of-shift reassocication ++; in address matching transform this into into a shift-of-and and the resuting ++; node becomes identical to %load2. CSE replaces %load1 which leaves its ++; references in MatchScope and RecordedNodes stale. ++ %tmp1711 = xor i32 %load1, %tmp1710 ++ ++ %tmp1744 = getelementptr inbounds [256 x i32]* null, i32 0, i32 %tmp1711 ++ store i32 0, i32* %tmp1744, align 4 ++ %tmp1745 = add i32 %tmp1694, 1 ++ indirectbr i8* undef, [label %bb1756, label %bb1692] ++ ++bb1756: ++ br label %bb2705 ++ ++bb2705: ++ indirectbr i8* undef, [label %bb5721, label %bb5736] ++ ++bb5721: ++ br label %bb2705 ++ ++bb5736: ++ ret void ++} From owner-svn-src-all@freebsd.org Wed Jul 29 19:57:59 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F48F9AD695; Wed, 29 Jul 2015 19:57:59 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "gold.funkthat.com", Issuer "gold.funkthat.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 7079BFE6; Wed, 29 Jul 2015 19:57:59 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (localhost [127.0.0.1]) by gold.funkthat.com (8.14.5/8.14.5) with ESMTP id t6TJvrrs015090 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 29 Jul 2015 12:57:53 -0700 (PDT) (envelope-from jmg@gold.funkthat.com) Received: (from jmg@localhost) by gold.funkthat.com (8.14.5/8.14.5/Submit) id t6TJvrUG015089; Wed, 29 Jul 2015 12:57:53 -0700 (PDT) (envelope-from jmg) Date: Wed, 29 Jul 2015 12:57:53 -0700 From: John-Mark Gurney To: Ermal =?iso-8859-1?Q?Lu=E7i?= Cc: George Neville-Neil , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r286000 - head/sys/netipsec Message-ID: <20150729195753.GM78154@funkthat.com> References: <201507290715.t6T7FHGb094456@repo.freebsd.org> <20150729154036.GG78154@funkthat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 9.1-PRERELEASE amd64 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? User-Agent: Mutt/1.5.21 (2010-09-15) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (gold.funkthat.com [127.0.0.1]); Wed, 29 Jul 2015 12:57:53 -0700 (PDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 19:57:59 -0000 Ermal Lui wrote this message on Wed, Jul 29, 2015 at 19:23 +0200: > On Wed, Jul 29, 2015 at 5:40 PM, John-Mark Gurney wrote: > > > Ermal Lui wrote this message on Wed, Jul 29, 2015 at 14:53 +0200: > > > this was forgotten part on my patches merge from gnn@. > > > Can it be fixed by correcting the patches rather than re-introducing > > this? > > > > > > Most probably the constant definition is wrong on the transforms and also > > > some part of code removal was missed. > > > > No, it cannot be fixed by changing opencrypto/xform.c to truncate the > > hash size... The reason it cannot be is that OCF is not an IPsec only > > framework... > > > > Geli also uses the HMAC constructions, and I have not confirmed if they > > use the full hash size or not... I would be open to adding a field to > > the crypto descriptor that limited how much of the hash is copied out... > > > > It would have been helpful to comment more of these changes... If you > > make a change for a reason (RFC, etc), then throw that in the comments, > > which allows someone following to understand why and prevent their > > removal... At least if they were commented as to why they changed, we > > would have known to rework the change... > > > Yes you are right but according to me this is standard practice being done > allover SSL/IPSec.... > I am not sure which standard GELI follows to comment on that! This also depends upon all future protocols following that standard, and no one needing those extra bits for validation, etc. > Also then it would be better to review the declarations on the transform > since they are apparently not generic, no? The declarations in xform.c need to be what the algorithm specifies, not what gets used by the various protocols... Any deviation from the algorithm specification should be delt with in protocol code, not here... This prevenst a future problem where a prtocol doesn't use that convention, and then it becomes a mess to unwind where these changes were, and fix them all... It's stuff like this which is part of the reason I decided to call GCM, NIST_GCM... OpenBSD has a hacked version that is only good for IPsec, apparently TLS and anything else that does the crazy lets put part of the IV w/ the key... The xform tables are already terribly overloaded, and I wanted to split them out into parameters and implementation, but because IPsec and others reach into those tables, it makes it more difficult... > > > On Wed, Jul 29, 2015 at 9:15 AM, John-Mark Gurney > > wrote: > > > > > > > Author: jmg > > > > Date: Wed Jul 29 07:15:16 2015 > > > > New Revision: 286000 > > > > URL: https://svnweb.freebsd.org/changeset/base/286000 > > > > > > > > Log: > > > > RFC4868 section 2.3 requires that the output be half... This fixes > > > > problems that was introduced in r285336... I have verified that > > > > HMAC-SHA2-256 both ah only and w/ AES-CBC interoperate w/ a NetBSD > > > > 6.1.5 vm... > > > > > > > > Reviewed by: gnn -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-all@freebsd.org Wed Jul 29 20:02:21 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9300A9AD8F3; Wed, 29 Jul 2015 20:02:21 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 83D14161B; Wed, 29 Jul 2015 20:02:21 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TK2L7u014408; Wed, 29 Jul 2015 20:02:21 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TK2L6M014407; Wed, 29 Jul 2015 20:02:21 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201507292002.t6TK2L6M014407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 29 Jul 2015 20:02:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286036 - head/tools/build/options X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 20:02:21 -0000 Author: emaste Date: Wed Jul 29 20:02:20 2015 New Revision: 286036 URL: https://svnweb.freebsd.org/changeset/base/286036 Log: Remove mention of non-existent gconv tool I believe this is a typo of gcov, but gcov is not controlled by WITHOUT_BINUTILS anyhow. Sponsored by: The FreeBSD Foundation Modified: head/tools/build/options/WITHOUT_BINUTILS Modified: head/tools/build/options/WITHOUT_BINUTILS ============================================================================== --- head/tools/build/options/WITHOUT_BINUTILS Wed Jul 29 19:37:32 2015 (r286035) +++ head/tools/build/options/WITHOUT_BINUTILS Wed Jul 29 20:02:20 2015 (r286036) @@ -1,5 +1,5 @@ .\" $FreeBSD$ -Set to not build or install binutils (as, c++-filt, gconv, +Set to not build or install binutils (as, c++-filt, ld, nm, objcopy, objdump, readelf, size and strip) as part of the normal system build. The resulting system cannot build programs from source. From owner-svn-src-all@freebsd.org Wed Jul 29 20:10:37 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B68A09ADC1C; Wed, 29 Jul 2015 20:10:37 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A208F1C04; Wed, 29 Jul 2015 20:10:37 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TKAbcj017214; Wed, 29 Jul 2015 20:10:37 GMT (envelope-from eri@FreeBSD.org) Received: (from eri@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TKAbjL017213; Wed, 29 Jul 2015 20:10:37 GMT (envelope-from eri@FreeBSD.org) Message-Id: <201507292010.t6TKAbjL017213@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eri set sender to eri@FreeBSD.org using -f From: Ermal Luçi Date: Wed, 29 Jul 2015 20:10:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286037 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 20:10:37 -0000 Author: eri Date: Wed Jul 29 20:10:36 2015 New Revision: 286037 URL: https://svnweb.freebsd.org/changeset/base/286037 Log: Avoid double reference decrement when firewalls force relooping of packets When firewalls force a reloop of packets and the caller supplied a route the reference to the route might be reduced twice creating issues. This is especially the scenario when a packet is looped because of operation in the firewall but the new route lookup gives a down route. Differential Revision: https://reviews.freebsd.org/D3037 Reviewed by: gnn Approved by: gnn(mentor) Modified: head/sys/netinet/ip_output.c Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Wed Jul 29 20:02:20 2015 (r286036) +++ head/sys/netinet/ip_output.c Wed Jul 29 20:10:36 2015 (r286037) @@ -681,6 +681,13 @@ sendit: done: if (ro == &iproute) RO_RTFREE(ro); + else if (rte == NULL) + /* + * If the caller supplied a route but somehow the reference + * to it has been released need to prevent the caller + * calling RTFREE on it again. + */ + ro->ro_rt = NULL; if (have_ia_ref) ifa_free(&ia->ia_ifa); return (error); From owner-svn-src-all@freebsd.org Wed Jul 29 20:17:28 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1084E9ADCFE; Wed, 29 Jul 2015 20:17:28 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 00AED1CD; Wed, 29 Jul 2015 20:17:28 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TKHRSi018713; Wed, 29 Jul 2015 20:17:27 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TKHRNS018712; Wed, 29 Jul 2015 20:17:27 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507292017.t6TKHRNS018712@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 29 Jul 2015 20:17:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r286038 - releng/10.2/release/doc/en_US.ISO8859-1/hardware X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 20:17:28 -0000 Author: gjb Date: Wed Jul 29 20:17:26 2015 New Revision: 286038 URL: https://svnweb.freebsd.org/changeset/base/286038 Log: Update copyright after r286023. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: releng/10.2/release/doc/en_US.ISO8859-1/hardware/article.xml Modified: releng/10.2/release/doc/en_US.ISO8859-1/hardware/article.xml ============================================================================== --- releng/10.2/release/doc/en_US.ISO8859-1/hardware/article.xml Wed Jul 29 20:10:36 2015 (r286037) +++ releng/10.2/release/doc/en_US.ISO8859-1/hardware/article.xml Wed Jul 29 20:17:26 2015 (r286038) @@ -31,6 +31,7 @@ 2012 2013 2014 + 2015 The &os; Documentation Project From owner-svn-src-all@freebsd.org Wed Jul 29 20:17:30 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7EAAD9ADD0C; Wed, 29 Jul 2015 20:17:30 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6F7681D0; Wed, 29 Jul 2015 20:17:30 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TKHUYA018754; Wed, 29 Jul 2015 20:17:30 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TKHUsV018753; Wed, 29 Jul 2015 20:17:30 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507292017.t6TKHUsV018753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 29 Jul 2015 20:17:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r286039 - releng/10.2/release/doc/en_US.ISO8859-1/hardware X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 20:17:30 -0000 Author: gjb Date: Wed Jul 29 20:17:29 2015 New Revision: 286039 URL: https://svnweb.freebsd.org/changeset/base/286039 Log: Add ixl(4) to the hardware notes. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: releng/10.2/release/doc/en_US.ISO8859-1/hardware/article.xml Modified: releng/10.2/release/doc/en_US.ISO8859-1/hardware/article.xml ============================================================================== --- releng/10.2/release/doc/en_US.ISO8859-1/hardware/article.xml Wed Jul 29 20:17:26 2015 (r286038) +++ releng/10.2/release/doc/en_US.ISO8859-1/hardware/article.xml Wed Jul 29 20:17:29 2015 (r286039) @@ -900,6 +900,8 @@ &hwlist.ixgbe; + &hwlist.ixl; + &hwlist.jme; &hwlist.kue; From owner-svn-src-all@freebsd.org Wed Jul 29 20:47:29 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D0609AE4F4; Wed, 29 Jul 2015 20:47:29 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 00A2E1FF4; Wed, 29 Jul 2015 20:47:29 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TKlSqA031034; Wed, 29 Jul 2015 20:47:28 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TKlSOr031031; Wed, 29 Jul 2015 20:47:28 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201507292047.t6TKlSOr031031@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Wed, 29 Jul 2015 20:47:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286040 - in head/sys: arm/arm i386/i386 mips/mips X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 20:47:29 -0000 Author: sbruno Date: Wed Jul 29 20:47:27 2015 New Revision: 286040 URL: https://svnweb.freebsd.org/changeset/base/286040 Log: Remove dead functions pmap_pvdump and pads. Differential Revision: D3206 Submitted by: kevin.bowling@kev009.com Reviewed by: alc Modified: head/sys/arm/arm/pmap-v6-new.c head/sys/i386/i386/pmap.c head/sys/mips/mips/pmap.c Modified: head/sys/arm/arm/pmap-v6-new.c ============================================================================== --- head/sys/arm/arm/pmap-v6-new.c Wed Jul 29 20:17:29 2015 (r286039) +++ head/sys/arm/arm/pmap-v6-new.c Wed Jul 29 20:47:27 2015 (r286040) @@ -162,7 +162,6 @@ __FBSDID("$FreeBSD$"); static void pmap_zero_page_check(vm_page_t m); void pmap_debug(int level); int pmap_pid_dump(int pid); -void pmap_pvdump(vm_paddr_t pa); #define PDEBUG(_lev_,_stat_) \ if (pmap_debug_level >= (_lev_)) \ @@ -6345,62 +6344,6 @@ pmap_pid_dump(int pid) return (npte2); } -/* - * Print address space of pmap. - */ -static void -pads(pmap_t pmap) -{ - int i, j; - vm_paddr_t va; - pt1_entry_t pte1; - pt2_entry_t *pte2p, pte2; - - if (pmap == kernel_pmap) - return; - for (i = 0; i < NPTE1_IN_PT1; i++) { - pte1 = pte1_load(&pmap->pm_pt1[i]); - if (pte1_is_section(pte1)) { - /* - * QQQ: Do something here! - */ - } else if (pte1_is_link(pte1)) { - for (j = 0; j < NPTE2_IN_PT2; j++) { - va = (i << PTE1_SHIFT) + (j << PAGE_SHIFT); - if (pmap == kernel_pmap && va < KERNBASE) - continue; - if (pmap != kernel_pmap && va >= KERNBASE && - (va < UPT2V_MIN_ADDRESS || - va >= UPT2V_MAX_ADDRESS)) - continue; - - pte2p = pmap_pte2(pmap, va); - pte2 = pte2_load(pte2p); - pmap_pte2_release(pte2p); - if (!pte2_is_valid(pte2)) - continue; - printf("%x:%x ", va, pte2); - } - } - } -} - -void -pmap_pvdump(vm_paddr_t pa) -{ - pv_entry_t pv; - pmap_t pmap; - vm_page_t m; - - printf("pa %x", pa); - m = PHYS_TO_VM_PAGE(pa); - TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) { - pmap = PV_PMAP(pv); - printf(" -> pmap %p, va %x", (void *)pmap, pv->pv_va); - pads(pmap); - } - printf(" "); -} #endif #ifdef DDB Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Wed Jul 29 20:17:29 2015 (r286039) +++ head/sys/i386/i386/pmap.c Wed Jul 29 20:47:27 2015 (r286040) @@ -5461,51 +5461,3 @@ pmap_pid_dump(int pid) return (npte); } #endif - -#if defined(DEBUG) - -static void pads(pmap_t pm); -void pmap_pvdump(vm_paddr_t pa); - -/* print address space of pmap*/ -static void -pads(pmap_t pm) -{ - int i, j; - vm_paddr_t va; - pt_entry_t *ptep; - - if (pm == kernel_pmap) - return; - for (i = 0; i < NPDEPTD; i++) - if (pm->pm_pdir[i]) - for (j = 0; j < NPTEPG; j++) { - va = (i << PDRSHIFT) + (j << PAGE_SHIFT); - if (pm == kernel_pmap && va < KERNBASE) - continue; - if (pm != kernel_pmap && va > UPT_MAX_ADDRESS) - continue; - ptep = pmap_pte(pm, va); - if (pmap_pte_v(ptep)) - printf("%x:%x ", va, *ptep); - }; - -} - -void -pmap_pvdump(vm_paddr_t pa) -{ - pv_entry_t pv; - pmap_t pmap; - vm_page_t m; - - printf("pa %x", pa); - m = PHYS_TO_VM_PAGE(pa); - TAILQ_FOREACH(pv, &m->md.pv_list, pv_next) { - pmap = PV_PMAP(pv); - printf(" -> pmap %p, va %x", (void *)pmap, pv->pv_va); - pads(pmap); - } - printf(" "); -} -#endif Modified: head/sys/mips/mips/pmap.c ============================================================================== --- head/sys/mips/mips/pmap.c Wed Jul 29 20:17:29 2015 (r286039) +++ head/sys/mips/mips/pmap.c Wed Jul 29 20:47:27 2015 (r286040) @@ -3294,56 +3294,6 @@ DB_SHOW_COMMAND(ptable, ddb_pid_dump) } #endif -#if defined(DEBUG) - -static void pads(pmap_t pm); -void pmap_pvdump(vm_offset_t pa); - -/* print address space of pmap*/ -static void -pads(pmap_t pm) -{ - unsigned va, i, j; - pt_entry_t *ptep; - - if (pm == kernel_pmap) - return; - for (i = 0; i < NPTEPG; i++) - if (pm->pm_segtab[i]) - for (j = 0; j < NPTEPG; j++) { - va = (i << SEGSHIFT) + (j << PAGE_SHIFT); - if (pm == kernel_pmap && va < KERNBASE) - continue; - if (pm != kernel_pmap && - va >= VM_MAXUSER_ADDRESS) - continue; - ptep = pmap_pte(pm, va); - if (pte_test(ptep, PTE_V)) - printf("%x:%x ", va, *(int *)ptep); - } - -} - -void -pmap_pvdump(vm_offset_t pa) -{ - register pv_entry_t pv; - vm_page_t m; - - printf("pa %x", pa); - m = PHYS_TO_VM_PAGE(pa); - for (pv = TAILQ_FIRST(&m->md.pv_list); pv; - pv = TAILQ_NEXT(pv, pv_list)) { - printf(" -> pmap %p, va %x", (void *)pv->pv_pmap, pv->pv_va); - pads(pv->pv_pmap); - } - printf(" "); -} - -/* N/C */ -#endif - - /* * Allocate TLB address space tag (called ASID or TLBPID) and return it. * It takes almost as much or more time to search the TLB for a From owner-svn-src-all@freebsd.org Wed Jul 29 20:50:49 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A5EAB9AE5F2; Wed, 29 Jul 2015 20:50:49 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9583F39C; Wed, 29 Jul 2015 20:50:49 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TKonS8033633; Wed, 29 Jul 2015 20:50:49 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TKonNw033629; Wed, 29 Jul 2015 20:50:49 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201507292050.t6TKonNw033629@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Wed, 29 Jul 2015 20:50:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286041 - head/sys/dev/mii X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 20:50:49 -0000 Author: sbruno Date: Wed Jul 29 20:50:48 2015 New Revision: 286041 URL: https://svnweb.freebsd.org/changeset/base/286041 Log: Add support for BCM5466 PHY Differential Revision: D3232 Submitted by: kevin.bowling@kev009.com Modified: head/sys/dev/mii/brgphy.c head/sys/dev/mii/miidevs Modified: head/sys/dev/mii/brgphy.c ============================================================================== --- head/sys/dev/mii/brgphy.c Wed Jul 29 20:47:27 2015 (r286040) +++ head/sys/dev/mii/brgphy.c Wed Jul 29 20:50:48 2015 (r286041) @@ -131,6 +131,7 @@ static const struct mii_phydesc brgphys[ MII_PHY_DESC(BROADCOM, BCM5752), MII_PHY_DESC(BROADCOM, BCM5780), MII_PHY_DESC(BROADCOM, BCM5708C), + MII_PHY_DESC(BROADCOM, BCM5466), MII_PHY_DESC(BROADCOM2, BCM5482), MII_PHY_DESC(BROADCOM2, BCM5708S), MII_PHY_DESC(BROADCOM2, BCM5709C), Modified: head/sys/dev/mii/miidevs ============================================================================== --- head/sys/dev/mii/miidevs Wed Jul 29 20:47:27 2015 (r286040) +++ head/sys/dev/mii/miidevs Wed Jul 29 20:50:48 2015 (r286041) @@ -170,6 +170,7 @@ model BROADCOM BCM54K2 0x002e BCM54K2 1 model BROADCOM BCM5714 0x0034 BCM5714 1000BASE-T media interface model BROADCOM BCM5780 0x0035 BCM5780 1000BASE-T media interface model BROADCOM BCM5708C 0x0036 BCM5708C 1000BASE-T media interface +model BROADCOM BCM5466 0x003b BCM5466 1000BASE-T media interface model BROADCOM2 BCM5325 0x0003 BCM5325 10/100 5-port PHY switch model BROADCOM2 BCM5906 0x0004 BCM5906 10/100baseTX media interface model BROADCOM2 BCM5481 0x000a BCM5481 1000BASE-T media interface From owner-svn-src-all@freebsd.org Wed Jul 29 21:15:51 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E6199AEBBD; Wed, 29 Jul 2015 21:15:51 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4612B154D; Wed, 29 Jul 2015 21:15:51 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TLFpVK043042; Wed, 29 Jul 2015 21:15:51 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TLFptm043041; Wed, 29 Jul 2015 21:15:51 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201507292115.t6TLFptm043041@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 29 Jul 2015 21:15:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286042 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 21:15:51 -0000 Author: imp Date: Wed Jul 29 21:15:50 2015 New Revision: 286042 URL: https://svnweb.freebsd.org/changeset/base/286042 Log: Clarify historical practice of not removing old entries. Add entry for stable/10 branch that was forgotten when it was created. Update end date to be correct. Modified: head/UPDATING Modified: head/UPDATING ============================================================================== --- head/UPDATING Wed Jul 29 20:50:48 2015 (r286041) +++ head/UPDATING Wed Jul 29 21:15:50 2015 (r286042) @@ -578,6 +578,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11 # pkg install pkg; ldd /usr/local/sbin/pkg | grep bsdyml 20131010: + The stable/10 branch has been created in subversion from head + revision r256279. + +20131010: The rc.d/jail script has been updated to support jail(8) configuration file. The "jail__*" rc.conf(5) variables for per-jail configuration are automatically converted to @@ -1120,6 +1124,13 @@ COMMON ITEMS: around can lead to problems if pam has changed too much from your starting point to allow continued authentication after the upgrade. + This file should be read as a log of events. When a later event changes + information of a prior event, the prior event should not be deleted. + Instead, a pointer to the entry with the new information should be + placed in the old entry. Readers of this file should also sanity check + older entries before relying on them blindly. Authors of new entries + should write them with this in mind. + ZFS notes --------- When upgrading the boot ZFS pool to a new version, always follow @@ -1290,7 +1301,7 @@ FORMAT: This file contains a list, in reverse chronological order, of major breakages in tracking -current. It is not guaranteed to be a complete -list of such breakages, and only contains entries since October 10, 2007. +list of such breakages, and only contains entries since September 23, 2011. If you need to see UPDATING entries from before that date, you will need to fetch an UPDATING file from an older FreeBSD release. From owner-svn-src-all@freebsd.org Wed Jul 29 21:29:51 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3027A9AEDA6; Wed, 29 Jul 2015 21:29:51 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 20A371EC0; Wed, 29 Jul 2015 21:29:51 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TLTo8x047233; Wed, 29 Jul 2015 21:29:50 GMT (envelope-from jimharris@FreeBSD.org) Received: (from jimharris@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TLToWb047232; Wed, 29 Jul 2015 21:29:50 GMT (envelope-from jimharris@FreeBSD.org) Message-Id: <201507292129.t6TLToWb047232@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jimharris set sender to jimharris@FreeBSD.org using -f From: Jim Harris Date: Wed, 29 Jul 2015 21:29:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286043 - head/sys/dev/nvme X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 21:29:51 -0000 Author: jimharris Date: Wed Jul 29 21:29:50 2015 New Revision: 286043 URL: https://svnweb.freebsd.org/changeset/base/286043 Log: nvme: do not notify a consumer about failures that occur during initialization MFC after: 3 days Sponsored by: Intel Modified: head/sys/dev/nvme/nvme.c Modified: head/sys/dev/nvme/nvme.c ============================================================================== --- head/sys/dev/nvme/nvme.c Wed Jul 29 21:15:50 2015 (r286042) +++ head/sys/dev/nvme/nvme.c Wed Jul 29 21:29:50 2015 (r286043) @@ -390,6 +390,15 @@ nvme_notify_fail_consumers(struct nvme_c struct nvme_consumer *cons; uint32_t i; + /* + * This controller failed during initialization (i.e. IDENTIFY + * command failed or timed out). Do not notify any nvme + * consumers of the failure here, since the consumer does not + * even know about the controller yet. + */ + if (!ctrlr->is_initialized) + return; + for (i = 0; i < NVME_MAX_CONSUMERS; i++) { cons = &nvme_consumer[i]; if (cons->id != INVALID_CONSUMER_ID && cons->fail_fn != NULL) From owner-svn-src-all@freebsd.org Wed Jul 29 21:41:16 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D41989AE1C8; Wed, 29 Jul 2015 21:41:16 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C4BEA9B0; Wed, 29 Jul 2015 21:41:16 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TLfGA5053159; Wed, 29 Jul 2015 21:41:16 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TLfGOk053158; Wed, 29 Jul 2015 21:41:16 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201507292141.t6TLfGOk053158@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 29 Jul 2015 21:41:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286044 - head/tools/build/mk X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 21:41:16 -0000 Author: emaste Date: Wed Jul 29 21:41:15 2015 New Revision: 286044 URL: https://svnweb.freebsd.org/changeset/base/286044 Log: MK_ELFCOPY_AS_OBJCOPY should be a variable PR: 201978 Submitted by: O. Hartmann Differential Revision: https://reviews.freebsd.org/D2887 Modified: head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Wed Jul 29 21:29:50 2015 (r286043) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Wed Jul 29 21:41:15 2015 (r286044) @@ -1651,7 +1651,7 @@ OLD_FILES+=usr/share/nls/uk_UA.KOI8-U/ee .endif .if ${MK_ELFTOOLCHAIN_TOOLS} == no || \ - (${MK_ELFTOOLCHAIN_TOOLS} != no && MK_ELFCOPY_AS_OBJCOPY != no) + (${MK_ELFTOOLCHAIN_TOOLS} != no && ${MK_ELFCOPY_AS_OBJCOPY} != no) OLD_FILES+=usr/bin/elfcopy OLD_FILES+=usr/share/man/man1/elfcopy.1.gz .endif From owner-svn-src-all@freebsd.org Wed Jul 29 22:51:55 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8DFB9AE03F; Wed, 29 Jul 2015 22:51:55 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BB0C71178; Wed, 29 Jul 2015 22:51:55 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TMptS1084619; Wed, 29 Jul 2015 22:51:55 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TMptw4084618; Wed, 29 Jul 2015 22:51:55 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201507292251.t6TMptw4084618@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Wed, 29 Jul 2015 22:51:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286045 - head/usr.sbin/pw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 22:51:56 -0000 Author: bapt Date: Wed Jul 29 22:51:54 2015 New Revision: 286045 URL: https://svnweb.freebsd.org/changeset/base/286045 Log: Actually set the proper license Reported by: trasz Modified: head/usr.sbin/pw/strtounum.c Modified: head/usr.sbin/pw/strtounum.c ============================================================================== --- head/usr.sbin/pw/strtounum.c Wed Jul 29 21:41:15 2015 (r286044) +++ head/usr.sbin/pw/strtounum.c Wed Jul 29 22:51:54 2015 (r286045) @@ -1,26 +1,27 @@ /*- * Copyright (C) Baptiste Daroussin + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer + * in this position and unchanged. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY DAVID L. NUGENT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL DAVID L. NUGENT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include From owner-svn-src-all@freebsd.org Wed Jul 29 23:06:31 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47C869AE34D; Wed, 29 Jul 2015 23:06:31 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 37AB21C33; Wed, 29 Jul 2015 23:06:31 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TN6Vv9089181; Wed, 29 Jul 2015 23:06:31 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TN6Vda089180; Wed, 29 Jul 2015 23:06:31 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201507292306.t6TN6Vda089180@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Wed, 29 Jul 2015 23:06:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286046 - head/sys/fs/nfsserver X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 23:06:31 -0000 Author: rmacklem Date: Wed Jul 29 23:06:30 2015 New Revision: 286046 URL: https://svnweb.freebsd.org/changeset/base/286046 Log: This patch fixes a problem where, if the NFSv4 server has a previous unconfirmed clientid structure for the same client on the last hash list, this old entry would not be removed/deleted. I do not think this bug would have caused serious problems, since the new entry would have been before the old one on the list. This old entry would have eventually been scavenged/removed. Detected while reading the code looking for another bug. MFC after: 3 days Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdstate.c Wed Jul 29 22:51:54 2015 (r286045) +++ head/sys/fs/nfsserver/nfs_nfsdstate.c Wed Jul 29 23:06:30 2015 (r286046) @@ -220,7 +220,8 @@ nfsrv_setclient(struct nfsrv_descript *n break; } } - i++; + if (gotit == 0) + i++; } if (!gotit || (clp->lc_flags & (LCL_NEEDSCONFIRM | LCL_ADMINREVOKED))) { From owner-svn-src-all@freebsd.org Wed Jul 29 23:26:15 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1B349AE621; Wed, 29 Jul 2015 23:26:15 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D2480AD5; Wed, 29 Jul 2015 23:26:15 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TNQFjJ097200; Wed, 29 Jul 2015 23:26:15 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TNQFYc097199; Wed, 29 Jul 2015 23:26:15 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201507292326.t6TNQFYc097199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Wed, 29 Jul 2015 23:26:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286047 - head/usr.sbin/pw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 23:26:16 -0000 Author: bapt Date: Wed Jul 29 23:26:14 2015 New Revision: 286047 URL: https://svnweb.freebsd.org/changeset/base/286047 Log: Cleanup includes Modified: head/usr.sbin/pw/rm_r.c Modified: head/usr.sbin/pw/rm_r.c ============================================================================== --- head/usr.sbin/pw/rm_r.c Wed Jul 29 23:06:30 2015 (r286046) +++ head/usr.sbin/pw/rm_r.c Wed Jul 29 23:26:14 2015 (r286047) @@ -29,15 +29,12 @@ static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ -#include -#include -#include -#include #include -#include -#include + #include #include +#include +#include #include "pwupd.h" From owner-svn-src-all@freebsd.org Wed Jul 29 23:34:39 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 187C59AE7B1; Wed, 29 Jul 2015 23:34:39 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 09368104C; Wed, 29 Jul 2015 23:34:39 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TNYces001575; Wed, 29 Jul 2015 23:34:38 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TNYcdj001574; Wed, 29 Jul 2015 23:34:38 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507292334.t6TNYcdj001574@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 29 Jul 2015 23:34:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r286048 - releng/10.2/release X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 23:34:39 -0000 Author: gjb Date: Wed Jul 29 23:34:38 2015 New Revision: 286048 URL: https://svnweb.freebsd.org/changeset/base/286048 Log: Set the default VHD file format to the fixed-size image for the 10.2-RELEASE, as the issue preventing the dynamic-size image from booting is not yet resolved. This is a direct commit to releng/10.2. Approved by: re (kib) Sponsored by: The FreeBSD Foundation Modified: releng/10.2/release/Makefile.vm Modified: releng/10.2/release/Makefile.vm ============================================================================== --- releng/10.2/release/Makefile.vm Wed Jul 29 23:26:14 2015 (r286047) +++ releng/10.2/release/Makefile.vm Wed Jul 29 23:34:38 2015 (r286048) @@ -6,7 +6,7 @@ # VMTARGETS= vm-image -VMFORMATS?= vhd vmdk qcow2 raw +VMFORMATS?= vhdf vmdk qcow2 raw VMSIZE?= 20G VMBASE?= vm From owner-svn-src-all@freebsd.org Wed Jul 29 23:37:17 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64EBE9AE7FC; Wed, 29 Jul 2015 23:37:17 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 34E6811D0; Wed, 29 Jul 2015 23:37:17 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TNbH4O001746; Wed, 29 Jul 2015 23:37:17 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TNbGPN001744; Wed, 29 Jul 2015 23:37:16 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <201507292337.t6TNbGPN001744@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Wed, 29 Jul 2015 23:37:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286049 - head/sys/crypto/aesni X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 23:37:17 -0000 Author: jmg Date: Wed Jul 29 23:37:15 2015 New Revision: 286049 URL: https://svnweb.freebsd.org/changeset/base/286049 Log: const'ify an arg that we don't update... Modified: head/sys/crypto/aesni/aesni.h head/sys/crypto/aesni/aesni_ghash.c Modified: head/sys/crypto/aesni/aesni.h ============================================================================== --- head/sys/crypto/aesni/aesni.h Wed Jul 29 23:34:38 2015 (r286048) +++ head/sys/crypto/aesni/aesni.h Wed Jul 29 23:37:15 2015 (r286049) @@ -104,7 +104,7 @@ void AES_GCM_encrypt(const unsigned char const unsigned char *key, int nr); int AES_GCM_decrypt(const unsigned char *in, unsigned char *out, const unsigned char *addt, const unsigned char *ivec, - unsigned char *tag, uint32_t nbytes, uint32_t abytes, int ibytes, + const unsigned char *tag, uint32_t nbytes, uint32_t abytes, int ibytes, const unsigned char *key, int nr); int aesni_cipher_setup_common(struct aesni_session *ses, const uint8_t *key, Modified: head/sys/crypto/aesni/aesni_ghash.c ============================================================================== --- head/sys/crypto/aesni/aesni_ghash.c Wed Jul 29 23:34:38 2015 (r286048) +++ head/sys/crypto/aesni/aesni_ghash.c Wed Jul 29 23:37:15 2015 (r286049) @@ -528,7 +528,7 @@ AES_GCM_encrypt(const unsigned char *in, int AES_GCM_decrypt(const unsigned char *in, unsigned char *out, const unsigned char *addt, const unsigned char *ivec, - unsigned char *tag, uint32_t nbytes, uint32_t abytes, int ibytes, + const unsigned char *tag, uint32_t nbytes, uint32_t abytes, int ibytes, const unsigned char *key, int nr) { int i, j ,k; @@ -677,7 +677,7 @@ AES_GCM_decrypt(const unsigned char *in, X = _mm_shuffle_epi8(X, BSWAP_MASK); T = _mm_xor_si128(X, T); - if (!m128icmp(T, _mm_loadu_si128((__m128i*)tag))) + if (!m128icmp(T, _mm_loadu_si128((const __m128i*)tag))) return 0; //in case the authentication failed ctr1 = _mm_shuffle_epi8(Y, BSWAP_EPI64); From owner-svn-src-all@freebsd.org Wed Jul 29 23:59:18 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F03A29AECA1; Wed, 29 Jul 2015 23:59:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BE4B31E04; Wed, 29 Jul 2015 23:59:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TNxI7V009955; Wed, 29 Jul 2015 23:59:18 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TNxIBb009954; Wed, 29 Jul 2015 23:59:18 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201507292359.t6TNxIBb009954@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 29 Jul 2015 23:59:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286050 - head/sys/i386/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Jul 2015 23:59:19 -0000 Author: kib Date: Wed Jul 29 23:59:17 2015 New Revision: 286050 URL: https://svnweb.freebsd.org/changeset/base/286050 Log: MFamd64 r285934: Remove store/load (= full) barrier from the i386 atomic_load_acq_*(). Noted by: alc (long time ago) Reviewed by: alc, bde Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/i386/include/atomic.h Modified: head/sys/i386/include/atomic.h ============================================================================== --- head/sys/i386/include/atomic.h Wed Jul 29 23:37:15 2015 (r286049) +++ head/sys/i386/include/atomic.h Wed Jul 29 23:59:17 2015 (r286050) @@ -233,13 +233,13 @@ atomic_testandset_int(volatile u_int *p, * IA32 memory model, a simple store guarantees release semantics. * * However, a load may pass a store if they are performed on distinct - * addresses, so for atomic_load_acq we introduce a Store/Load barrier - * before the load in SMP kernels. We use "lock addl $0,mem", as - * recommended by the AMD Software Optimization Guide, and not mfence. - * In the kernel, we use a private per-cpu cache line as the target - * for the locked addition, to avoid introducing false data - * dependencies. In userspace, a word at the top of the stack is - * utilized. + * addresses, so we need Store/Load barrier for sequentially + * consistent fences in SMP kernels. We use "lock addl $0,mem" for a + * Store/Load barrier, as recommended by the AMD Software Optimization + * Guide, and not mfence. In the kernel, we use a private per-cpu + * cache line as the target for the locked addition, to avoid + * introducing false data dependencies. In userspace, a word at the + * top of the stack is utilized. * * For UP kernels, however, the memory of the single processor is * always consistent, so we only need to stop the compiler from @@ -282,22 +282,12 @@ __storeload_barrier(void) } #endif /* _KERNEL*/ -/* - * C11-standard acq/rel semantics only apply when the variable in the - * call is the same for acq as it is for rel. However, our previous - * (x86) implementations provided much stronger ordering than required - * (essentially what is called seq_cst order in C11). This - * implementation provides the historical strong ordering since some - * callers depend on it. - */ - #define ATOMIC_LOAD(TYPE) \ static __inline u_##TYPE \ atomic_load_acq_##TYPE(volatile u_##TYPE *p) \ { \ u_##TYPE res; \ \ - __storeload_barrier(); \ res = *p; \ __compiler_membar(); \ return (res); \ From owner-svn-src-all@freebsd.org Thu Jul 30 00:13:21 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66BCD9AEFB0; Thu, 30 Jul 2015 00:13:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57079A95; Thu, 30 Jul 2015 00:13:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6U0DL8n017923; Thu, 30 Jul 2015 00:13:21 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6U0DKml017921; Thu, 30 Jul 2015 00:13:20 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201507300013.t6U0DKml017921@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 30 Jul 2015 00:13:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286051 - in head/sys/i386: i386 include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 00:13:21 -0000 Author: kib Date: Thu Jul 30 00:13:20 2015 New Revision: 286051 URL: https://svnweb.freebsd.org/changeset/base/286051 Log: Use private cache line for the locked nop in *mb() on i386. Suggested by: alc Reviewed by: alc, bde Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Modified: head/sys/i386/i386/vm_machdep.c head/sys/i386/include/atomic.h Modified: head/sys/i386/i386/vm_machdep.c ============================================================================== --- head/sys/i386/i386/vm_machdep.c Wed Jul 29 23:59:17 2015 (r286050) +++ head/sys/i386/i386/vm_machdep.c Thu Jul 30 00:13:20 2015 (r286051) @@ -111,8 +111,8 @@ _Static_assert(OFFSETOF_CURTHREAD == off "OFFSETOF_CURTHREAD does not correspond with offset of pc_curthread."); _Static_assert(OFFSETOF_CURPCB == offsetof(struct pcpu, pc_curpcb), "OFFSETOF_CURPCB does not correspond with offset of pc_curpcb."); -_Static_assert(OFFSETOF_MONITORBUF == offsetof(struct pcpu, pc_monitorbuf), - "OFFSETOF_MONINORBUF does not correspond with offset of pc_monitorbuf."); +_Static_assert(__OFFSETOF_MONITORBUF == offsetof(struct pcpu, pc_monitorbuf), + "__OFFSETOF_MONINORBUF does not correspond with offset of pc_monitorbuf."); static void cpu_reset_real(void); #ifdef SMP Modified: head/sys/i386/include/atomic.h ============================================================================== --- head/sys/i386/include/atomic.h Wed Jul 29 23:59:17 2015 (r286050) +++ head/sys/i386/include/atomic.h Thu Jul 30 00:13:20 2015 (r286051) @@ -37,9 +37,31 @@ #include #endif -#define mb() __asm __volatile("lock; addl $0,(%%esp)" : : : "memory", "cc") -#define wmb() __asm __volatile("lock; addl $0,(%%esp)" : : : "memory", "cc") -#define rmb() __asm __volatile("lock; addl $0,(%%esp)" : : : "memory", "cc") +#ifndef __OFFSETOF_MONITORBUF +/* + * __OFFSETOF_MONITORBUF == __pcpu_offset(pc_monitorbuf). + * + * The open-coded number is used instead of the symbolic expression to + * avoid a dependency on sys/pcpu.h in machine/atomic.h consumers. + * An assertion in i386/vm_machdep.c ensures that the value is correct. + */ +#define __OFFSETOF_MONITORBUF 0x180 + +static __inline void +__mbk(void) +{ + + __asm __volatile("lock; addl $0,%%fs:%0" + : "+m" (*(u_int *)__OFFSETOF_MONITORBUF) : : "memory", "cc"); +} + +static __inline void +__mbu(void) +{ + + __asm __volatile("lock; addl $0,(%%esp)" : : : "memory", "cc"); +} +#endif /* * Various simple operations on memory, each of which is atomic in the @@ -246,40 +268,15 @@ atomic_testandset_int(volatile u_int *p, * reordering accesses in a way that violates the semantics of acquire * and release. */ -#if defined(_KERNEL) - -/* - * OFFSETOF_MONITORBUF == __pcpu_offset(pc_monitorbuf). - * - * The open-coded number is used instead of the symbolic expression to - * avoid a dependency on sys/pcpu.h in machine/atomic.h consumers. - * An assertion in i386/vm_machdep.c ensures that the value is correct. - */ -#define OFFSETOF_MONITORBUF 0x180 +#if defined(_KERNEL) #if defined(SMP) -static __inline void -__storeload_barrier(void) -{ - - __asm __volatile("lock; addl $0,%%fs:%0" - : "+m" (*(u_int *)OFFSETOF_MONITORBUF) : : "memory", "cc"); -} +#define __storeload_barrier() __mbk() #else /* _KERNEL && UP */ -static __inline void -__storeload_barrier(void) -{ - - __compiler_membar(); -} +#define __storeload_barrier() __compiler_membar() #endif /* SMP */ #else /* !_KERNEL */ -static __inline void -__storeload_barrier(void) -{ - - __asm __volatile("lock; addl $0,(%%esp)" : : : "memory", "cc"); -} +#define __storeload_barrier() __mbu() #endif /* _KERNEL*/ #define ATOMIC_LOAD(TYPE) \ @@ -776,4 +773,14 @@ u_long atomic_swap_long(volatile u_long #endif /* !WANT_FUNCTIONS */ +#if defined(_KERNEL) +#define mb() __mbk() +#define wmb() __mbk() +#define rmb() __mbk() +#else +#define mb() __mbu() +#define wmb() __mbu() +#define rmb() __mbu() +#endif + #endif /* !_MACHINE_ATOMIC_H_ */ From owner-svn-src-all@freebsd.org Thu Jul 30 00:24:22 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99FDF9A611E; Thu, 30 Jul 2015 00:24:22 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89D6FE55; Thu, 30 Jul 2015 00:24:22 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6U0OMCT022015; Thu, 30 Jul 2015 00:24:22 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6U0OM7v022014; Thu, 30 Jul 2015 00:24:22 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201507300024.t6U0OM7v022014@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Thu, 30 Jul 2015 00:24:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286052 - stable/10/sys/arm/allwinner/a20 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 00:24:22 -0000 Author: marius Date: Thu Jul 30 00:24:21 2015 New Revision: 286052 URL: https://svnweb.freebsd.org/changeset/base/286052 Log: MFC: r281752 Make a comment reflect reality. Modified: stable/10/sys/arm/allwinner/a20/a20_mp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/arm/allwinner/a20/a20_mp.c ============================================================================== --- stable/10/sys/arm/allwinner/a20/a20_mp.c Thu Jul 30 00:13:20 2015 (r286051) +++ stable/10/sys/arm/allwinner/a20/a20_mp.c Thu Jul 30 00:24:21 2015 (r286052) @@ -25,6 +25,7 @@ #include __FBSDID("$FreeBSD$"); + #include #include #include @@ -68,7 +69,7 @@ platform_mp_setmaxid(void) if (mp_ncpus != 0) return; - /* Read current CP15 Cache Size ID Register */ + /* Read the number of cores from the CP15 L2 Control Register. */ __asm __volatile("mrc p15, 1, %0, c9, c0, 2" : "=r" (ncpu)); ncpu = ((ncpu >> 24) & 0x3) + 1; From owner-svn-src-all@freebsd.org Thu Jul 30 00:28:28 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6078A9A6199; Thu, 30 Jul 2015 00:28:28 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 442D210D5; Thu, 30 Jul 2015 00:28:28 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6U0SSEV022397; Thu, 30 Jul 2015 00:28:28 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6U0SSqp022396; Thu, 30 Jul 2015 00:28:28 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201507300028.t6U0SSqp022396@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Thu, 30 Jul 2015 00:28:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286053 - stable/10/sys/dev/mii X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 00:28:28 -0000 Author: marius Date: Thu Jul 30 00:28:27 2015 New Revision: 286053 URL: https://svnweb.freebsd.org/changeset/base/286053 Log: MFC: r284447, r284552 Merge from NetBSD: o rev. 1.10: Nuke trailing whitespace. o rev. 1.15: Fix typo in comment. o rev. 1.16: Add the following registers from IEEE 802.3-2009 Clause 22: - PSE control register (0x0b) - PSE status register (0x0c) - MMD access control register (0x0d) - MMD access address data register (0x0e) o rev. 1.17 (comments only): The bit location of link ability is different between 1000Base-X and others (see Annex 28B.2 and 28D). o rev. 1.18: Nuke dupe word. Obtained from: NetBSD Sponsored by: genua mbh Modified: stable/10/sys/dev/mii/mii.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/mii/mii.h ============================================================================== --- stable/10/sys/dev/mii/mii.h Thu Jul 30 00:24:21 2015 (r286052) +++ stable/10/sys/dev/mii/mii.h Thu Jul 30 00:28:27 2015 (r286053) @@ -1,4 +1,4 @@ -/* $NetBSD: mii.h,v 1.9 2001/05/31 03:07:14 thorpej Exp $ */ +/* $NetBSD: mii.h,v 1.18 2014/06/16 14:43:22 msaitoh Exp $ */ /*- * Copyright (c) 1997 Manuel Bouyer. All rights reserved. @@ -87,7 +87,7 @@ /* * Note that the EXTSTAT bit indicates that there is extended status * info available in register 15, but 802.3 section 22.2.4.3 also - * states that that all 1000 Mb/s capable PHYs will set this bit to 1. + * states that all 1000 Mb/s capable PHYs will set this bit to 1. */ #define BMSR_MEDIAMASK (BMSR_100T4|BMSR_100TXFDX|BMSR_100TXHDX| \ @@ -111,6 +111,7 @@ #define ANAR_NP 0x8000 /* Next page (ro) */ #define ANAR_ACK 0x4000 /* link partner abilities acknowledged (ro) */ #define ANAR_RF 0x2000 /* remote fault (ro) */ + /* Annex 28B.2 */ #define ANAR_FC 0x0400 /* local device supports PAUSE */ #define ANAR_T4 0x0200 /* local device supports 100bT4 */ #define ANAR_TX_FD 0x0100 /* local device supports 100bTx FD */ @@ -123,6 +124,7 @@ #define ANAR_PAUSE_ASYM (2 << 10) #define ANAR_PAUSE_TOWARDS (3 << 10) + /* Annex 28D */ #define ANAR_X_FD 0x0020 /* local device supports 1000BASE-X FD */ #define ANAR_X_HD 0x0040 /* local device supports 1000BASE-X HD */ #define ANAR_X_PAUSE_NONE (0 << 7) @@ -184,12 +186,47 @@ #define GTSR_MAN_MS_FLT 0x8000 /* master/slave config fault */ #define GTSR_MS_RES 0x4000 /* result: 1 = master, 0 = slave */ #define GTSR_LRS 0x2000 /* local rx status, 1 = ok */ -#define GTSR_RRS 0x1000 /* remove rx status, 1 = ok */ +#define GTSR_RRS 0x1000 /* remote rx status, 1 = ok */ #define GTSR_LP_1000TFDX 0x0800 /* link partner 1000baseT FDX capable */ #define GTSR_LP_1000THDX 0x0400 /* link partner 1000baseT HDX capable */ #define GTSR_LP_ASM_DIR 0x0200 /* link partner asym. pause dir. capable */ #define GTSR_IDLE_ERR 0x00ff /* IDLE error count */ +#define MII_PSECR 0x0b /* PSE control register */ +#define PSECR_PACTLMASK 0x000c /* pair control mask */ +#define PSECR_PSEENMASK 0x0003 /* PSE enable mask */ +#define PSECR_PINOUTB 0x0008 /* PSE pinout Alternative B */ +#define PSECR_PINOUTA 0x0004 /* PSE pinout Alternative A */ +#define PSECR_FOPOWTST 0x0002 /* Force Power Test Mode */ +#define PSECR_PSEEN 0x0001 /* PSE Enabled */ +#define PSECR_PSEDIS 0x0000 /* PSE Disabled */ + +#define MII_PSESR 0x0c /* PSE status register */ +#define PSESR_PWRDENIED 0x1000 /* Power Denied */ +#define PSESR_VALSIG 0x0800 /* Valid PD signature detected */ +#define PSESR_INVALSIG 0x0400 /* Invalid PD signature detected */ +#define PSESR_SHORTCIRC 0x0200 /* Short circuit condition detected */ +#define PSESR_OVERLOAD 0x0100 /* Overload condition detected */ +#define PSESR_MPSABSENT 0x0080 /* MPS absent condition detected */ +#define PSESR_PDCLMASK 0x0070 /* PD Class mask */ +#define PSESR_STATMASK 0x000e /* PSE Status mask */ +#define PSESR_PAIRCTABL 0x0001 /* PAIR Control Ability */ +#define PSESR_PDCL_4 (4 << 4) /* Class 4 */ +#define PSESR_PDCL_3 (3 << 4) /* Class 3 */ +#define PSESR_PDCL_2 (2 << 4) /* Class 2 */ +#define PSESR_PDCL_1 (1 << 4) /* Class 1 */ +#define PSESR_PDCL_0 (0 << 4) /* Class 0 */ + +#define MII_MMDACR 0x0d /* MMD access control register */ +#define MMDACR_FUNCMASK 0xc000 /* function */ +#define MMDACR_DADDRMASK 0x001f /* device address */ +#define MMDACR_FN_ADDRESS (0 << 14) /* address */ +#define MMDACR_FN_DATANPI (1 << 14) /* data, no post increment */ +#define MMDACR_FN_DATAPIRW (2 << 14) /* data, post increment on r/w */ +#define MMDACR_FN_DATAPIW (3 << 14) /* data, post increment on wr only */ + +#define MII_MMDAADR 0x0e /* MMD access address data register */ + #define MII_EXTSR 0x0f /* Extended status register */ #define EXTSR_1000XFDX 0x8000 /* 1000X full-duplex capable */ #define EXTSR_1000XHDX 0x4000 /* 1000X half-duplex capable */ From owner-svn-src-all@freebsd.org Thu Jul 30 00:28:34 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 123AD9A61DB; Thu, 30 Jul 2015 00:28:34 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DA4C3116B; Thu, 30 Jul 2015 00:28:33 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6U0SXUL022445; Thu, 30 Jul 2015 00:28:33 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6U0SXHv022444; Thu, 30 Jul 2015 00:28:33 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201507300028.t6U0SXHv022444@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Thu, 30 Jul 2015 00:28:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r286054 - stable/9/sys/dev/mii X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 00:28:34 -0000 Author: marius Date: Thu Jul 30 00:28:32 2015 New Revision: 286054 URL: https://svnweb.freebsd.org/changeset/base/286054 Log: MFC: r284447, r284552 Merge from NetBSD: o rev. 1.10: Nuke trailing whitespace. o rev. 1.15: Fix typo in comment. o rev. 1.16: Add the following registers from IEEE 802.3-2009 Clause 22: - PSE control register (0x0b) - PSE status register (0x0c) - MMD access control register (0x0d) - MMD access address data register (0x0e) o rev. 1.17 (comments only): The bit location of link ability is different between 1000Base-X and others (see Annex 28B.2 and 28D). o rev. 1.18: Nuke dupe word. Obtained from: NetBSD Sponsored by: genua mbh Modified: stable/9/sys/dev/mii/mii.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/mii/mii.h ============================================================================== --- stable/9/sys/dev/mii/mii.h Thu Jul 30 00:28:27 2015 (r286053) +++ stable/9/sys/dev/mii/mii.h Thu Jul 30 00:28:32 2015 (r286054) @@ -1,4 +1,4 @@ -/* $NetBSD: mii.h,v 1.9 2001/05/31 03:07:14 thorpej Exp $ */ +/* $NetBSD: mii.h,v 1.18 2014/06/16 14:43:22 msaitoh Exp $ */ /*- * Copyright (c) 1997 Manuel Bouyer. All rights reserved. @@ -87,7 +87,7 @@ /* * Note that the EXTSTAT bit indicates that there is extended status * info available in register 15, but 802.3 section 22.2.4.3 also - * states that that all 1000 Mb/s capable PHYs will set this bit to 1. + * states that all 1000 Mb/s capable PHYs will set this bit to 1. */ #define BMSR_MEDIAMASK (BMSR_100T4|BMSR_100TXFDX|BMSR_100TXHDX| \ @@ -111,6 +111,7 @@ #define ANAR_NP 0x8000 /* Next page (ro) */ #define ANAR_ACK 0x4000 /* link partner abilities acknowledged (ro) */ #define ANAR_RF 0x2000 /* remote fault (ro) */ + /* Annex 28B.2 */ #define ANAR_FC 0x0400 /* local device supports PAUSE */ #define ANAR_T4 0x0200 /* local device supports 100bT4 */ #define ANAR_TX_FD 0x0100 /* local device supports 100bTx FD */ @@ -123,6 +124,7 @@ #define ANAR_PAUSE_ASYM (2 << 10) #define ANAR_PAUSE_TOWARDS (3 << 10) + /* Annex 28D */ #define ANAR_X_FD 0x0020 /* local device supports 1000BASE-X FD */ #define ANAR_X_HD 0x0040 /* local device supports 1000BASE-X HD */ #define ANAR_X_PAUSE_NONE (0 << 7) @@ -184,12 +186,47 @@ #define GTSR_MAN_MS_FLT 0x8000 /* master/slave config fault */ #define GTSR_MS_RES 0x4000 /* result: 1 = master, 0 = slave */ #define GTSR_LRS 0x2000 /* local rx status, 1 = ok */ -#define GTSR_RRS 0x1000 /* remove rx status, 1 = ok */ +#define GTSR_RRS 0x1000 /* remote rx status, 1 = ok */ #define GTSR_LP_1000TFDX 0x0800 /* link partner 1000baseT FDX capable */ #define GTSR_LP_1000THDX 0x0400 /* link partner 1000baseT HDX capable */ #define GTSR_LP_ASM_DIR 0x0200 /* link partner asym. pause dir. capable */ #define GTSR_IDLE_ERR 0x00ff /* IDLE error count */ +#define MII_PSECR 0x0b /* PSE control register */ +#define PSECR_PACTLMASK 0x000c /* pair control mask */ +#define PSECR_PSEENMASK 0x0003 /* PSE enable mask */ +#define PSECR_PINOUTB 0x0008 /* PSE pinout Alternative B */ +#define PSECR_PINOUTA 0x0004 /* PSE pinout Alternative A */ +#define PSECR_FOPOWTST 0x0002 /* Force Power Test Mode */ +#define PSECR_PSEEN 0x0001 /* PSE Enabled */ +#define PSECR_PSEDIS 0x0000 /* PSE Disabled */ + +#define MII_PSESR 0x0c /* PSE status register */ +#define PSESR_PWRDENIED 0x1000 /* Power Denied */ +#define PSESR_VALSIG 0x0800 /* Valid PD signature detected */ +#define PSESR_INVALSIG 0x0400 /* Invalid PD signature detected */ +#define PSESR_SHORTCIRC 0x0200 /* Short circuit condition detected */ +#define PSESR_OVERLOAD 0x0100 /* Overload condition detected */ +#define PSESR_MPSABSENT 0x0080 /* MPS absent condition detected */ +#define PSESR_PDCLMASK 0x0070 /* PD Class mask */ +#define PSESR_STATMASK 0x000e /* PSE Status mask */ +#define PSESR_PAIRCTABL 0x0001 /* PAIR Control Ability */ +#define PSESR_PDCL_4 (4 << 4) /* Class 4 */ +#define PSESR_PDCL_3 (3 << 4) /* Class 3 */ +#define PSESR_PDCL_2 (2 << 4) /* Class 2 */ +#define PSESR_PDCL_1 (1 << 4) /* Class 1 */ +#define PSESR_PDCL_0 (0 << 4) /* Class 0 */ + +#define MII_MMDACR 0x0d /* MMD access control register */ +#define MMDACR_FUNCMASK 0xc000 /* function */ +#define MMDACR_DADDRMASK 0x001f /* device address */ +#define MMDACR_FN_ADDRESS (0 << 14) /* address */ +#define MMDACR_FN_DATANPI (1 << 14) /* data, no post increment */ +#define MMDACR_FN_DATAPIRW (2 << 14) /* data, post increment on r/w */ +#define MMDACR_FN_DATAPIW (3 << 14) /* data, post increment on wr only */ + +#define MII_MMDAADR 0x0e /* MMD access address data register */ + #define MII_EXTSR 0x0f /* Extended status register */ #define EXTSR_1000XFDX 0x8000 /* 1000X full-duplex capable */ #define EXTSR_1000XHDX 0x4000 /* 1000X half-duplex capable */ From owner-svn-src-all@freebsd.org Thu Jul 30 00:37:45 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD8649A6385; Thu, 30 Jul 2015 00:37:45 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id 2292819A9; Thu, 30 Jul 2015 00:37:45 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id 733F0D61441; Thu, 30 Jul 2015 10:37:36 +1000 (AEST) Date: Thu, 30 Jul 2015 10:37:35 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Baptiste Daroussin cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r285997 - head/usr.sbin/pw In-Reply-To: <201507290623.t6T6N7lq073984@repo.freebsd.org> Message-ID: <20150730081432.K1227@besplex.bde.org> References: <201507290623.t6T6N7lq073984@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=ItbjC+Lg c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=kj9zAlcOel0A:10 a=ggwqMiiw5Lm5OyZwFVMA:9 a=l4etjENkHRSCMygt:21 a=kJAK3V7p5b8bB8-w:21 a=ddZeHNemqATHP_5K:21 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 00:37:46 -0000 On Wed, 29 Jul 2015, Baptiste Daroussin wrote: > Log: > Actually add the new code I shouldn't have asked for this. It gives more to clean up. It has 1 large bug and many style bugs. > Added: head/usr.sbin/pw/strtounum.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/usr.sbin/pw/strtounum.c Wed Jul 29 06:23:06 2015 (r285997) > @@ -0,0 +1,73 @@ > ... > +#define INVALID "invalid" > +#define TOOSMALL "too small" > +#define TOOLARGE "too large" Style bugs: - space instead of tab after #define - not even consistent space instead of tab after #define - unsorted defines. The unsorting is for bug compatible with strtonum.c. strtonum.c doesn't have the tab bugs. It uses these definitions to obfuscate the code even better. Here the definintions are of string literals which are used only once except for INVALID. The obfuscation is to add a layer of indirection to these literals. This might save a few bytes of object code for a 1975 compiler by avoiding duplication of the "invalid". strtonum.c uses the larger obfuscation of indirection through a table. This allows it to have more compact code (basically by setting the index and falling through to common code for returning). This probably saves a few bytes of object code even for current compilers. > +uintmax_t > +strtounum(const char *numstr, uintmax_t minval, uintmax_t maxval, > + const char **errstrp) > +{ > + uintmax_t ret = 0; Style bug: initialization in declaration. strtonum.c has the same bug. The bug is larger here. Here, the result of the initialization is not even used. In strtonum.c, it is part of the obfuscations. The variable must be inititialized early so that it is initialized after falling through to the common code at the end. But initializing in its declaration obfuscates that it is being initialixed for this reason. > + char *ep; Style bug: unsorted declarations. Pointers should be sorted before scalars. strtonum.c has the same bug. The rest of the initializations are much cleaner than in strtonum.c. There are no more, but strtonum has a mess to set up the table, and another valriable initialized in its declaration to use after falling through. The table is static and const, but is declared as auto and non-const. This is a good pessimization for old compilers. They will laboriously construct it on every entry to the function. > + > + if (minval > maxval) { > + errno = EINVAL; > + if (errstrp != NULL) > + *errstrp = INVALID; > + return (0); strtonum.c uses its fall-through obfuscations here and elsewhere. It sets only an index variable here, and falls through to its general code that looks up the errno and string associated with this index. This is much better, except it should just set *errstrp to "invalid", or better change the API by changing this string to something like "doofus" to indicate that it is a programming error and not invalid input. The change is easier without the complications from the table or an API to preserve. > + } > + Style bug: extra blank line. > + ret = strtoumax(numstr, &ep, 10); Large bug here. The setting of errno to 0 is missing. This bug is not in strtonum.c. > + if (errno == EINVAL || numstr == ep || *ep != '\0') { Style bugs: - unportable code - dead code - backwards order of check in dead code Setting errno to EINVAL for certain errors is a POSIX extension. It is not in C99. This style bug is made fatal by not setting errno to 0 before calling the function. On success, errno has its previous value which may be EINVAL. All this unportability does is allow you to omit the numstr == ep check, but the above doesn't even omit it. Using the unportable check takes twice as much code for a non-broken version, or 3 times as much with the redundancy: Broken: if (errno == EINVAL ... Correct: errno = 0; ... if (errno == EINVAL ... Broken and redundant: if (errno == EINVAL || numstr == ep ... Correct and redundant: errno = 0; ... if (errno == EINVAL || numstr == ep ... except errno must be set to 0 in most uses so that the ERANGE check is not broken and then using the unportability doesn't take more code. The backwards order is numstr == ep instead of ep == numstr. > + errno = EINVAL; > + if (errstrp != NULL) > + *errstrp = INVALID; This is the only definition that is used twice. It is still clearer to return the literal "invalid". > + return (0); > + } else if ((ret == 0 && errno == ERANGE) || ret < minval) { Style bug: redndant 'else'. The 'if' clause always returns, so 'else' here has no effect except to obfuscate that. An 'else if' ladder with some redundant else's can be clearer if in more complicated cases if it is done consistently. Style bug: nonsense check of the non-error value 0. ret can never be 0 after an actual range error, since strtoumax() returns UINTMAX_MAX for range errors. ret can be 0 with errno = ERANGE only becase of the missing initialization of errno. > + errno = ERANGE; > + if (errstrp != NULL) > + *errstrp = TOOSMALL; > + return (0); > + } else if ((ret == UINTMAX_MAX && errno == ERANGE) || ret > maxval) { Style bug: redundant 'else'. Style bug: redundant check of the not-always-error value UINTMAX_MAX. strtonum.c has to do redundant checks for not-always-error values INTMAX_MIN and INTMAX_MAX to distinguish the 2 "ends" of a range error. For unsigned values, there is only one "end" -- ERANGE always means too large. Normally it is a bug to look at the "end" value[s], since ERANGE tells you if there is a range error. I always suspect that code which does such checks gets other details of range checking wrong and works around the bugs in most cases by using bogus checks of the "end" value[s]. The checked turned out to be almost no-ops here, but the range checking was very broken. > + errno = ERANGE; > + if (errstrp != NULL) > + *errstrp = TOOLARGE; > + return (0); > + } > + Stykle bug: extra blank line. > + return (ret); Style bug: inconsistent redundant 'else' clause. This is the contents of a redundant 'else' clause that we reach at the end of the 'else if' ladder. This clause is closely associated with the ladder, but is obfuscated by separating it first by the blank line and then by not using a redundant 'else' for it. > +} Fixing these bugs gives: X #include X __FBSDID("$FreeBSD$"); X X #include X #include X #include X #include X X #include "pw.h" X X uintmax_t X strtounum(const char *numstr, uintmax_t minval, uintmax_t maxval, X const char **errstrp) X { X char *ep; X uintmax_t ret; X X if (minval > maxval) { X errno = EINVAL; X if (errstrp != NULL) X *errstrp = "invalid"; X return (0); X } X errno = 0; X ret = strtoumax(numstr, &ep, 10); X if (ep == numstr || *ep != '\0') { X errno = EINVAL; X if (errstrp != NULL) X *errstrp = "invalid"; X return (0); X } X if (ret < minval) { X errno = ERANGE; X if (errstrp != NULL) X *errstrp = "too small"; X return (0); X } X if (errno == ERANGE || ret > maxval) { X errno = ERANGE; X if (errstrp != NULL) X *errstrp = "too large"; X return (0); X } X return (ret); X } This can be shortened a little at a cost of a minor obfuscation: call strtoumax before checking (minval > maxval) and use the same error handling code. Some variable names could be improved. numstr is the same as in strtonum.c, but the man page uses the better name nptr. nptr is actually better for the implementation than the man page, but the implementation should use simply np. errstrp is used by both strtonum.c and strtounum.c, but the man page spells it errstrp. I like to use a p suffix for all pointers. This is not so important for man pages. C99 and FreeBSD man pages and implementation use consistent names for the strtol family: - the string to be converted is always named 'nptr' - the pointer for returning the position reached is always named 'endptr' I.e., they consistently use a 'p' suffix but spell it verbostly as 'ptr'. It would be better to expand 'n' to 'num' than 'p' to 'ptr', but they don't do that. endptr is doubly indirect so it should have too 'p's but it only has 1 'ptr. strtonum introduces many inconsistencies: - it still uses 'nptr' in the man page but not in the implementation - it uses 'str' in 'errstr' in the man page. That emphasizes the string and not the not the pointer. Sort of backwards. It uses 'errstrp' in the implementation. That is basically 2 'p' suffixes with the inner one distinguished as being for a string. This is good, but the man page needs such details more than the implementatin. I would just use np and errpp in the implementation. Also, change ep to endp so that the 'e' in it is more obviously unrelated to errors. Another easy fix: apart from intmax_t, strto*num() hasn't caught up with C99 'restrict' yet. See the strtol() prototype for this. I think it can be fixed without breaking the API too much. Bruce From owner-svn-src-all@freebsd.org Thu Jul 30 02:06:32 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4609E9A7281; Thu, 30 Jul 2015 02:06:32 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 34A41891; Thu, 30 Jul 2015 02:06:32 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6U26WFA063209; Thu, 30 Jul 2015 02:06:32 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6U26Ui5063202; Thu, 30 Jul 2015 02:06:30 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201507300206.t6U26Ui5063202@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Thu, 30 Jul 2015 02:06:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286055 - in stable/10/sys: kern sparc64/include sparc64/sparc64 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 02:06:32 -0000 Author: marius Date: Thu Jul 30 02:06:29 2015 New Revision: 286055 URL: https://svnweb.freebsd.org/changeset/base/286055 Log: MFC: r285839 o Revert the other functional half of r239864, i. e. the merge of r134227 from x86 to use smp_ipi_mtx spin lock not only for smp_rendezvous_cpus() but also for the MD cache invalidation, TLB demapping and remote register reading IPIs due to the following reasons: - The cross-IPI SMP deadlock x86 otherwise is subject to can't happen on sparc64. That's because on sparc64, spin locks don't disable interrupts completely but only raise the processor interrupt level to PIL_TICK. This means that IPIs still get delivered and direct dispatch IPIs such as the cache invalidation etc. IPIs in question are still executed. - In smp_rendezvous_cpus(), smp_ipi_mtx is held not only while sending an IPI_RENDEZVOUS, but until all CPUs have processed smp_rendezvous_action(). Consequently, smp_ipi_mtx may be locked for an extended amount of time as queued IPIs (as opposed to the direct ones) such as IPI_RENDEZVOUS are scheduled via a soft interrupt. Moreover, given that this soft interrupt is only delivered at PIL_RENDEZVOUS, processing of smp_rendezvous_action() on a target may be interrupted by f. e. a tick interrupt at PIL_TICK, in turn leading to the target in question trying to send an IPI by itself while IPI_RENDEZVOUS isn't fully handled, yet, and, thus, resulting in a deadlock. o As mentioned in the commit message of r245850, on least some sun4u platforms concurrent sending of IPIs by different CPUs is fatal. Therefore, hold the reintroduced MD ipi_mtx also while delivering cross-traps via MI helpers, i. e. ipi_{all_but_self,cpu,selected}(). o Akin to x86, let the last CPU to process cpu_mp_bootstrap() set smp_started instead of the BSP in cpu_mp_unleash(). This ensures that all APs actually are started, when smp_started is no longer 0. o In all MD and MI IPI helpers, check for smp_started == 1 rather than for smp_cpus > 1 or nothing at all. This avoids races during boot causing IPIs trying to be delivered to APs that in fact aren't up and running, yet. While at it, move setting of the cpu_ipi_{selected,single}() pointers to the appropriate delivery functions from mp_init() to cpu_mp_start() where it's better suited and allows to get rid of the global isjbus variable. o Given that now concurrent IPI delivery no longer is possible, also nuke the delays before completely disabling interrupts again in the CPU-specific cross-trap delivery functions, previously giving other CPUs a window for sending IPIs on their part. Actually, we now should be able to entirely get rid of completely disabling interrupts in these functions. Such a change needs more testing, though. o In {s,}tick_get_timecount_mp(), make the {s,}tick variable static. While not necessary for correctness, this avoids page faults when accessing the stack of a foreign CPU as {s,}tick now is locked into the TLBs as part of static kernel data. Hence, {s,}tick_get_timecount_mp() always execute as fast as possible, avoiding jitter. PR: 201245 Modified: stable/10/sys/kern/subr_witness.c stable/10/sys/sparc64/include/smp.h stable/10/sys/sparc64/sparc64/machdep.c stable/10/sys/sparc64/sparc64/mp_machdep.c stable/10/sys/sparc64/sparc64/tick.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/subr_witness.c ============================================================================== --- stable/10/sys/kern/subr_witness.c Thu Jul 30 00:28:32 2015 (r286054) +++ stable/10/sys/kern/subr_witness.c Thu Jul 30 02:06:29 2015 (r286055) @@ -666,6 +666,9 @@ static struct witness_order_list_entry o */ { "intrcnt", &lock_class_mtx_spin }, { "icu", &lock_class_mtx_spin }, +#if defined(SMP) && defined(__sparc64__) + { "ipi", &lock_class_mtx_spin }, +#endif #ifdef __i386__ { "allpmaps", &lock_class_mtx_spin }, { "descriptor tables", &lock_class_mtx_spin }, Modified: stable/10/sys/sparc64/include/smp.h ============================================================================== --- stable/10/sys/sparc64/include/smp.h Thu Jul 30 00:28:32 2015 (r286054) +++ stable/10/sys/sparc64/include/smp.h Thu Jul 30 02:06:29 2015 (r286055) @@ -39,13 +39,15 @@ #ifndef LOCORE +#include #include +#include +#include #include #include #include #include -#include #include #define IDR_BUSY 0x0000000000000001ULL @@ -96,6 +98,7 @@ struct ipi_tlb_args { }; #define ita_va ita_start +struct pcb; struct pcpu; extern struct pcb stoppcbs[]; @@ -108,8 +111,9 @@ extern cpu_ipi_selected_t *cpu_ipi_selec typedef void cpu_ipi_single_t(u_int, u_long, u_long, u_long); extern cpu_ipi_single_t *cpu_ipi_single; -void mp_init(u_int cpu_impl); +void mp_init(void); +extern struct mtx ipi_mtx; extern struct ipi_cache_args ipi_cache_args; extern struct ipi_rd_args ipi_rd_args; extern struct ipi_tlb_args ipi_tlb_args; @@ -139,23 +143,37 @@ ipi_all_but_self(u_int ipi) { cpuset_t cpus; + if (__predict_false(smp_started == 0)) + return; cpus = all_cpus; + sched_pin(); CPU_CLR(PCPU_GET(cpuid), &cpus); + mtx_lock_spin(&ipi_mtx); cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_level, ipi); + mtx_unlock_spin(&ipi_mtx); + sched_unpin(); } static __inline void ipi_selected(cpuset_t cpus, u_int ipi) { + if (__predict_false(smp_started == 0 || CPU_EMPTY(&cpus))) + return; + mtx_lock_spin(&ipi_mtx); cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_level, ipi); + mtx_unlock_spin(&ipi_mtx); } static __inline void ipi_cpu(int cpu, u_int ipi) { + if (__predict_false(smp_started == 0)) + return; + mtx_lock_spin(&ipi_mtx); cpu_ipi_single(cpu, 0, (u_long)tl_ipi_level, ipi); + mtx_unlock_spin(&ipi_mtx); } #if defined(_MACHINE_PMAP_H_) && defined(_SYS_MUTEX_H_) @@ -165,11 +183,11 @@ ipi_dcache_page_inval(void *func, vm_pad { struct ipi_cache_args *ica; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); ica = &ipi_cache_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); ica->ica_mask = all_cpus; CPU_CLR(PCPU_GET(cpuid), &ica->ica_mask); ica->ica_pa = pa; @@ -182,11 +200,11 @@ ipi_icache_page_inval(void *func, vm_pad { struct ipi_cache_args *ica; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); ica = &ipi_cache_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); ica->ica_mask = all_cpus; CPU_CLR(PCPU_GET(cpuid), &ica->ica_mask); ica->ica_pa = pa; @@ -199,11 +217,11 @@ ipi_rd(u_int cpu, void *func, u_long *va { struct ipi_rd_args *ira; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); ira = &ipi_rd_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); CPU_SETOF(cpu, &ira->ira_mask); ira->ira_val = val; cpu_ipi_single(cpu, 0, (u_long)func, (u_long)ira); @@ -216,7 +234,7 @@ ipi_tlb_context_demap(struct pmap *pm) struct ipi_tlb_args *ita; cpuset_t cpus; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); cpus = pm->pm_active; @@ -227,7 +245,7 @@ ipi_tlb_context_demap(struct pmap *pm) return (NULL); } ita = &ipi_tlb_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); ita->ita_mask = cpus; ita->ita_pmap = pm; cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_tlb_context_demap, @@ -241,7 +259,7 @@ ipi_tlb_page_demap(struct pmap *pm, vm_o struct ipi_tlb_args *ita; cpuset_t cpus; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); cpus = pm->pm_active; @@ -252,7 +270,7 @@ ipi_tlb_page_demap(struct pmap *pm, vm_o return (NULL); } ita = &ipi_tlb_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); ita->ita_mask = cpus; ita->ita_pmap = pm; ita->ita_va = va; @@ -266,7 +284,7 @@ ipi_tlb_range_demap(struct pmap *pm, vm_ struct ipi_tlb_args *ita; cpuset_t cpus; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); cpus = pm->pm_active; @@ -277,7 +295,7 @@ ipi_tlb_range_demap(struct pmap *pm, vm_ return (NULL); } ita = &ipi_tlb_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); ita->ita_mask = cpus; ita->ita_pmap = pm; ita->ita_start = start; @@ -292,10 +310,10 @@ ipi_wait(void *cookie) { volatile cpuset_t *mask; - if ((mask = cookie) != NULL) { + if (__predict_false((mask = cookie) != NULL)) { while (!CPU_EMPTY(mask)) ; - mtx_unlock_spin(&smp_ipi_mtx); + mtx_unlock_spin(&ipi_mtx); sched_unpin(); } } Modified: stable/10/sys/sparc64/sparc64/machdep.c ============================================================================== --- stable/10/sys/sparc64/sparc64/machdep.c Thu Jul 30 00:28:32 2015 (r286054) +++ stable/10/sys/sparc64/sparc64/machdep.c Thu Jul 30 02:06:29 2015 (r286055) @@ -503,7 +503,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_l } #ifdef SMP - mp_init(cpu_impl); + mp_init(); #endif /* Modified: stable/10/sys/sparc64/sparc64/mp_machdep.c ============================================================================== --- stable/10/sys/sparc64/sparc64/mp_machdep.c Thu Jul 30 00:28:32 2015 (r286054) +++ stable/10/sys/sparc64/sparc64/mp_machdep.c Thu Jul 30 02:06:29 2015 (r286055) @@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -113,12 +114,13 @@ struct ipi_rd_args ipi_rd_args; struct ipi_tlb_args ipi_tlb_args; struct pcb stoppcbs[MAXCPU]; +struct mtx ipi_mtx; + cpu_ipi_selected_t *cpu_ipi_selected; cpu_ipi_single_t *cpu_ipi_single; static vm_offset_t mp_tramp; static u_int cpuid_to_mid[MAXCPU]; -static int isjbus; static volatile cpuset_t shutdown_cpus; static void ap_count(phandle_t node, u_int mid, u_int cpu_impl); @@ -138,7 +140,7 @@ static cpu_ipi_single_t spitfire_ipi_sin SYSINIT(cpu_mp_unleash, SI_SUB_SMP, SI_ORDER_FIRST, cpu_mp_unleash, NULL); void -mp_init(u_int cpu_impl) +mp_init(void) { struct tte *tp; int i; @@ -157,24 +159,6 @@ mp_init(u_int cpu_impl) } for (i = 0; i < PAGE_SIZE; i += sizeof(vm_offset_t)) flush(mp_tramp + i); - - /* - * On UP systems cpu_ipi_selected() can be called while - * cpu_mp_start() wasn't so initialize these here. - */ - if (cpu_impl == CPU_IMPL_ULTRASPARCIIIi || - cpu_impl == CPU_IMPL_ULTRASPARCIIIip) { - isjbus = 1; - cpu_ipi_selected = jalapeno_ipi_selected; - cpu_ipi_single = jalapeno_ipi_single; - } else if (cpu_impl == CPU_IMPL_SPARC64V || - cpu_impl >= CPU_IMPL_ULTRASPARCIII) { - cpu_ipi_selected = cheetah_ipi_selected; - cpu_ipi_single = cheetah_ipi_single; - } else { - cpu_ipi_selected = spitfire_ipi_selected; - cpu_ipi_single = spitfire_ipi_single; - } } static void @@ -219,7 +203,7 @@ foreach_ap(phandle_t node, void (*func)( * Probe for other CPUs. */ void -cpu_mp_setmaxid() +cpu_mp_setmaxid(void) { CPU_SETOF(curcpu, &all_cpus); @@ -277,6 +261,25 @@ sun4u_startcpu(phandle_t cpu, void *func void cpu_mp_start(void) { + u_int cpu_impl, isjbus; + + mtx_init(&ipi_mtx, "ipi", NULL, MTX_SPIN); + + isjbus = 0; + cpu_impl = PCPU_GET(impl); + if (cpu_impl == CPU_IMPL_ULTRASPARCIIIi || + cpu_impl == CPU_IMPL_ULTRASPARCIIIip) { + isjbus = 1; + cpu_ipi_selected = jalapeno_ipi_selected; + cpu_ipi_single = jalapeno_ipi_single; + } else if (cpu_impl == CPU_IMPL_SPARC64V || + cpu_impl >= CPU_IMPL_ULTRASPARCIII) { + cpu_ipi_selected = cheetah_ipi_selected; + cpu_ipi_single = cheetah_ipi_single; + } else { + cpu_ipi_selected = spitfire_ipi_selected; + cpu_ipi_single = spitfire_ipi_single; + } intr_setup(PIL_AST, cpu_ipi_ast, -1, NULL, NULL); intr_setup(PIL_RENDEZVOUS, (ih_func_t *)smp_rendezvous_action, @@ -360,7 +363,7 @@ cpu_mp_announce(void) } static void -cpu_mp_unleash(void *v) +cpu_mp_unleash(void *v __unused) { volatile struct cpu_start_args *csa; struct pcpu *pc; @@ -407,7 +410,6 @@ cpu_mp_unleash(void *v) membar(StoreLoad); csa->csa_count = 0; - smp_started = 1; } void @@ -464,6 +466,9 @@ cpu_mp_bootstrap(struct pcpu *pc) while (csa->csa_count != 0) ; + if (smp_cpus == mp_ncpus) + atomic_store_rel_int(&smp_started, 1); + /* Start per-CPU event timers. */ cpu_initclocks_ap(); @@ -530,7 +535,7 @@ cpu_ipi_stop(struct trapframe *tf __unus } static void -cpu_ipi_preempt(struct trapframe *tf) +cpu_ipi_preempt(struct trapframe *tf __unused) { sched_preempt(curthread); @@ -573,9 +578,11 @@ spitfire_ipi_single(u_int cpu, u_long d0 u_int mid; int i; + mtx_assert(&ipi_mtx, MA_OWNED); KASSERT(cpu != curcpu, ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_BUSY) == 0, ("%s: outstanding dispatch", __func__)); + mid = cpuid_to_mid[cpu]; for (i = 0; i < IPI_RETRIES; i++) { s = intr_disable(); @@ -601,12 +608,6 @@ spitfire_ipi_single(u_int cpu, u_long d0 intr_restore(s); if ((ids & (IDR_BUSY | IDR_NACK)) == 0) return; - /* - * Leave interrupts enabled for a bit before retrying - * in order to avoid deadlocks if the other CPU is also - * trying to send an IPI. - */ - DELAY(2); } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI to module 0x%u\n", @@ -624,10 +625,12 @@ cheetah_ipi_single(u_int cpu, u_long d0, u_int mid; int i; + mtx_assert(&ipi_mtx, MA_OWNED); KASSERT(cpu != curcpu, ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_CHEETAH_ALL_BUSY) == 0, ("%s: outstanding dispatch", __func__)); + mid = cpuid_to_mid[cpu]; for (i = 0; i < IPI_RETRIES; i++) { s = intr_disable(); @@ -644,12 +647,6 @@ cheetah_ipi_single(u_int cpu, u_long d0, intr_restore(s); if ((ids & (IDR_BUSY | IDR_NACK)) == 0) return; - /* - * Leave interrupts enabled for a bit before retrying - * in order to avoid deadlocks if the other CPU is also - * trying to send an IPI. - */ - DELAY(2); } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI to module 0x%u\n", @@ -669,13 +666,14 @@ cheetah_ipi_selected(cpuset_t cpus, u_lo u_int cpu; int i; + mtx_assert(&ipi_mtx, MA_OWNED); + KASSERT(!CPU_EMPTY(&cpus), ("%s: no CPUs to IPI", __func__)); KASSERT(!CPU_ISSET(curcpu, &cpus), ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_CHEETAH_ALL_BUSY) == 0, ("%s: outstanding dispatch", __func__)); - if (CPU_EMPTY(&cpus)) - return; + ids = 0; for (i = 0; i < IPI_RETRIES * mp_ncpus; i++) { s = intr_disable(); @@ -709,12 +707,6 @@ cheetah_ipi_selected(cpuset_t cpus, u_lo } if (CPU_EMPTY(&cpus)) return; - /* - * Leave interrupts enabled for a bit before retrying - * in order to avoid deadlocks if the other CPUs are - * also trying to send IPIs. - */ - DELAY(2 * mp_ncpus); } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI (cpus=%s ids=0x%lu)\n", @@ -732,10 +724,12 @@ jalapeno_ipi_single(u_int cpu, u_long d0 u_int busy, busynack, mid; int i; + mtx_assert(&ipi_mtx, MA_OWNED); KASSERT(cpu != curcpu, ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_CHEETAH_ALL_BUSY) == 0, ("%s: outstanding dispatch", __func__)); + mid = cpuid_to_mid[cpu]; busy = IDR_BUSY << (2 * mid); busynack = (IDR_BUSY | IDR_NACK) << (2 * mid); @@ -754,12 +748,6 @@ jalapeno_ipi_single(u_int cpu, u_long d0 intr_restore(s); if ((ids & busynack) == 0) return; - /* - * Leave interrupts enabled for a bit before retrying - * in order to avoid deadlocks if the other CPU is also - * trying to send an IPI. - */ - DELAY(2); } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI to module 0x%u\n", @@ -778,13 +766,14 @@ jalapeno_ipi_selected(cpuset_t cpus, u_l u_int cpu; int i; + mtx_assert(&ipi_mtx, MA_OWNED); + KASSERT(!CPU_EMPTY(&cpus), ("%s: no CPUs to IPI", __func__)); KASSERT(!CPU_ISSET(curcpu, &cpus), ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_CHEETAH_ALL_BUSY) == 0, ("%s: outstanding dispatch", __func__)); - if (CPU_EMPTY(&cpus)) - return; + ids = 0; for (i = 0; i < IPI_RETRIES * mp_ncpus; i++) { s = intr_disable(); @@ -811,12 +800,6 @@ jalapeno_ipi_selected(cpuset_t cpus, u_l if ((ids & (IDR_NACK << (2 * cpuid_to_mid[cpu]))) == 0) CPU_CLR(cpu, &cpus); - /* - * Leave interrupts enabled for a bit before retrying - * in order to avoid deadlocks if the other CPUs are - * also trying to send IPIs. - */ - DELAY(2 * mp_ncpus); } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI (cpus=%s ids=0x%lu)\n", Modified: stable/10/sys/sparc64/sparc64/tick.c ============================================================================== --- stable/10/sys/sparc64/sparc64/tick.c Thu Jul 30 00:28:32 2015 (r286054) +++ stable/10/sys/sparc64/sparc64/tick.c Thu Jul 30 02:06:29 2015 (r286055) @@ -31,8 +31,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include #include #include #include @@ -46,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -326,7 +323,7 @@ tick_get_timecount_up(struct timecounter static u_int stick_get_timecount_mp(struct timecounter *tc) { - u_long stick; + static u_long stick; sched_pin(); if (curcpu == 0) @@ -340,7 +337,7 @@ stick_get_timecount_mp(struct timecounte static u_int tick_get_timecount_mp(struct timecounter *tc) { - u_long tick; + static u_long tick; sched_pin(); if (curcpu == 0) From owner-svn-src-all@freebsd.org Thu Jul 30 02:06:37 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 570C99A72C9; Thu, 30 Jul 2015 02:06:37 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A6638DA; Thu, 30 Jul 2015 02:06:37 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6U26bES063272; Thu, 30 Jul 2015 02:06:37 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6U26Zrf063267; Thu, 30 Jul 2015 02:06:35 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201507300206.t6U26Zrf063267@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Thu, 30 Jul 2015 02:06:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r286056 - in stable/9/sys: kern sparc64/include sparc64/sparc64 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 02:06:37 -0000 Author: marius Date: Thu Jul 30 02:06:34 2015 New Revision: 286056 URL: https://svnweb.freebsd.org/changeset/base/286056 Log: MFC: r285839 o Revert the other functional half of r239864 (MFCed to stable/9 in r241681), i. e. the merge of r134227 from x86 to use smp_ipi_mtx spin lock not only for smp_rendezvous_cpus() but also for the MD cache invalidation, TLB demapping and remote register reading IPIs due to the following reasons: - The cross-IPI SMP deadlock x86 otherwise is subject to can't happen on sparc64. That's because on sparc64, spin locks don't disable interrupts completely but only raise the processor interrupt level to PIL_TICK. This means that IPIs still get delivered and direct dispatch IPIs such as the cache invalidation etc. IPIs in question are still executed. - In smp_rendezvous_cpus(), smp_ipi_mtx is held not only while sending an IPI_RENDEZVOUS, but until all CPUs have processed smp_rendezvous_action(). Consequently, smp_ipi_mtx may be locked for an extended amount of time as queued IPIs (as opposed to the direct ones) such as IPI_RENDEZVOUS are scheduled via a soft interrupt. Moreover, given that this soft interrupt is only delivered at PIL_RENDEZVOUS, processing of smp_rendezvous_action() on a target may be interrupted by f. e. a tick interrupt at PIL_TICK, in turn leading to the target in question trying to send an IPI by itself while IPI_RENDEZVOUS isn't fully handled, yet, and, thus, resulting in a deadlock. o As mentioned in the commit message of r245850, on least some sun4u platforms concurrent sending of IPIs by different CPUs is fatal. Therefore, hold the reintroduced MD ipi_mtx also while delivering cross-traps via MI helpers, i. e. ipi_{all_but_self,cpu,selected}(). o Akin to x86, let the last CPU to process cpu_mp_bootstrap() set smp_started instead of the BSP in cpu_mp_unleash(). This ensures that all APs actually are started, when smp_started is no longer 0. o In all MD and MI IPI helpers, check for smp_started == 1 rather than for smp_cpus > 1 or nothing at all. This avoids races during boot causing IPIs trying to be delivered to APs that in fact aren't up and running, yet. While at it, move setting of the cpu_ipi_{selected,single}() pointers to the appropriate delivery functions from mp_init() to cpu_mp_start() where it's better suited and allows to get rid of the global isjbus variable. o Given that now concurrent IPI delivery no longer is possible, also nuke the delays before completely disabling interrupts again in the CPU-specific cross-trap delivery functions, previously giving other CPUs a window for sending IPIs on their part. Actually, we now should be able to entirely get rid of completely disabling interrupts in these functions. Such a change needs more testing, though. o In {s,}tick_get_timecount_mp(), make the {s,}tick variable static. While not necessary for correctness, this avoids page faults when accessing the stack of a foreign CPU as {s,}tick now is locked into the TLBs as part of static kernel data. Hence, {s,}tick_get_timecount_mp() always execute as fast as possible, avoiding jitter. PR: 201245 Modified: stable/9/sys/kern/subr_witness.c stable/9/sys/sparc64/include/smp.h stable/9/sys/sparc64/sparc64/machdep.c stable/9/sys/sparc64/sparc64/mp_machdep.c stable/9/sys/sparc64/sparc64/tick.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/subr_witness.c ============================================================================== --- stable/9/sys/kern/subr_witness.c Thu Jul 30 02:06:29 2015 (r286055) +++ stable/9/sys/kern/subr_witness.c Thu Jul 30 02:06:34 2015 (r286056) @@ -662,6 +662,9 @@ static struct witness_order_list_entry o */ { "intrcnt", &lock_class_mtx_spin }, { "icu", &lock_class_mtx_spin }, +#if defined(SMP) && defined(__sparc64__) + { "ipi", &lock_class_mtx_spin }, +#endif #ifdef __i386__ { "allpmaps", &lock_class_mtx_spin }, { "descriptor tables", &lock_class_mtx_spin }, Modified: stable/9/sys/sparc64/include/smp.h ============================================================================== --- stable/9/sys/sparc64/include/smp.h Thu Jul 30 02:06:29 2015 (r286055) +++ stable/9/sys/sparc64/include/smp.h Thu Jul 30 02:06:34 2015 (r286056) @@ -39,13 +39,15 @@ #ifndef LOCORE +#include #include +#include +#include #include #include #include #include -#include #include #define IDR_BUSY 0x0000000000000001ULL @@ -96,6 +98,7 @@ struct ipi_tlb_args { }; #define ita_va ita_start +struct pcb; struct pcpu; extern struct pcb stoppcbs[]; @@ -108,8 +111,9 @@ extern cpu_ipi_selected_t *cpu_ipi_selec typedef void cpu_ipi_single_t(u_int, u_long, u_long, u_long); extern cpu_ipi_single_t *cpu_ipi_single; -void mp_init(u_int cpu_impl); +void mp_init(void); +extern struct mtx ipi_mtx; extern struct ipi_cache_args ipi_cache_args; extern struct ipi_rd_args ipi_rd_args; extern struct ipi_tlb_args ipi_tlb_args; @@ -139,23 +143,37 @@ ipi_all_but_self(u_int ipi) { cpuset_t cpus; + if (__predict_false(smp_started == 0)) + return; cpus = all_cpus; + sched_pin(); CPU_CLR(PCPU_GET(cpuid), &cpus); + mtx_lock_spin(&ipi_mtx); cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_level, ipi); + mtx_unlock_spin(&ipi_mtx); + sched_unpin(); } static __inline void ipi_selected(cpuset_t cpus, u_int ipi) { + if (__predict_false(smp_started == 0 || CPU_EMPTY(&cpus))) + return; + mtx_lock_spin(&ipi_mtx); cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_level, ipi); + mtx_unlock_spin(&ipi_mtx); } static __inline void ipi_cpu(int cpu, u_int ipi) { + if (__predict_false(smp_started == 0)) + return; + mtx_lock_spin(&ipi_mtx); cpu_ipi_single(cpu, 0, (u_long)tl_ipi_level, ipi); + mtx_unlock_spin(&ipi_mtx); } #if defined(_MACHINE_PMAP_H_) && defined(_SYS_MUTEX_H_) @@ -165,11 +183,11 @@ ipi_dcache_page_inval(void *func, vm_pad { struct ipi_cache_args *ica; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); ica = &ipi_cache_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); ica->ica_mask = all_cpus; CPU_CLR(PCPU_GET(cpuid), &ica->ica_mask); ica->ica_pa = pa; @@ -182,11 +200,11 @@ ipi_icache_page_inval(void *func, vm_pad { struct ipi_cache_args *ica; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); ica = &ipi_cache_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); ica->ica_mask = all_cpus; CPU_CLR(PCPU_GET(cpuid), &ica->ica_mask); ica->ica_pa = pa; @@ -199,11 +217,11 @@ ipi_rd(u_int cpu, void *func, u_long *va { struct ipi_rd_args *ira; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); ira = &ipi_rd_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); CPU_SETOF(cpu, &ira->ira_mask); ira->ira_val = val; cpu_ipi_single(cpu, 0, (u_long)func, (u_long)ira); @@ -216,7 +234,7 @@ ipi_tlb_context_demap(struct pmap *pm) struct ipi_tlb_args *ita; cpuset_t cpus; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); cpus = pm->pm_active; @@ -227,7 +245,7 @@ ipi_tlb_context_demap(struct pmap *pm) return (NULL); } ita = &ipi_tlb_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); ita->ita_mask = cpus; ita->ita_pmap = pm; cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_tlb_context_demap, @@ -241,7 +259,7 @@ ipi_tlb_page_demap(struct pmap *pm, vm_o struct ipi_tlb_args *ita; cpuset_t cpus; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); cpus = pm->pm_active; @@ -252,7 +270,7 @@ ipi_tlb_page_demap(struct pmap *pm, vm_o return (NULL); } ita = &ipi_tlb_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); ita->ita_mask = cpus; ita->ita_pmap = pm; ita->ita_va = va; @@ -266,7 +284,7 @@ ipi_tlb_range_demap(struct pmap *pm, vm_ struct ipi_tlb_args *ita; cpuset_t cpus; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); cpus = pm->pm_active; @@ -277,7 +295,7 @@ ipi_tlb_range_demap(struct pmap *pm, vm_ return (NULL); } ita = &ipi_tlb_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); ita->ita_mask = cpus; ita->ita_pmap = pm; ita->ita_start = start; @@ -292,10 +310,10 @@ ipi_wait(void *cookie) { volatile cpuset_t *mask; - if ((mask = cookie) != NULL) { + if (__predict_false((mask = cookie) != NULL)) { while (!CPU_EMPTY(mask)) ; - mtx_unlock_spin(&smp_ipi_mtx); + mtx_unlock_spin(&ipi_mtx); sched_unpin(); } } Modified: stable/9/sys/sparc64/sparc64/machdep.c ============================================================================== --- stable/9/sys/sparc64/sparc64/machdep.c Thu Jul 30 02:06:29 2015 (r286055) +++ stable/9/sys/sparc64/sparc64/machdep.c Thu Jul 30 02:06:34 2015 (r286056) @@ -507,7 +507,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_l } #ifdef SMP - mp_init(cpu_impl); + mp_init(); #endif /* Modified: stable/9/sys/sparc64/sparc64/mp_machdep.c ============================================================================== --- stable/9/sys/sparc64/sparc64/mp_machdep.c Thu Jul 30 02:06:29 2015 (r286055) +++ stable/9/sys/sparc64/sparc64/mp_machdep.c Thu Jul 30 02:06:34 2015 (r286056) @@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -113,12 +114,13 @@ struct ipi_rd_args ipi_rd_args; struct ipi_tlb_args ipi_tlb_args; struct pcb stoppcbs[MAXCPU]; +struct mtx ipi_mtx; + cpu_ipi_selected_t *cpu_ipi_selected; cpu_ipi_single_t *cpu_ipi_single; static vm_offset_t mp_tramp; static u_int cpuid_to_mid[MAXCPU]; -static int isjbus; static volatile cpuset_t shutdown_cpus; static void ap_count(phandle_t node, u_int mid, u_int cpu_impl); @@ -138,7 +140,7 @@ static cpu_ipi_single_t spitfire_ipi_sin SYSINIT(cpu_mp_unleash, SI_SUB_SMP, SI_ORDER_FIRST, cpu_mp_unleash, NULL); void -mp_init(u_int cpu_impl) +mp_init(void) { struct tte *tp; int i; @@ -157,24 +159,6 @@ mp_init(u_int cpu_impl) } for (i = 0; i < PAGE_SIZE; i += sizeof(vm_offset_t)) flush(mp_tramp + i); - - /* - * On UP systems cpu_ipi_selected() can be called while - * cpu_mp_start() wasn't so initialize these here. - */ - if (cpu_impl == CPU_IMPL_ULTRASPARCIIIi || - cpu_impl == CPU_IMPL_ULTRASPARCIIIip) { - isjbus = 1; - cpu_ipi_selected = jalapeno_ipi_selected; - cpu_ipi_single = jalapeno_ipi_single; - } else if (cpu_impl == CPU_IMPL_SPARC64V || - cpu_impl >= CPU_IMPL_ULTRASPARCIII) { - cpu_ipi_selected = cheetah_ipi_selected; - cpu_ipi_single = cheetah_ipi_single; - } else { - cpu_ipi_selected = spitfire_ipi_selected; - cpu_ipi_single = spitfire_ipi_single; - } } static void @@ -219,7 +203,7 @@ foreach_ap(phandle_t node, void (*func)( * Probe for other CPUs. */ void -cpu_mp_setmaxid() +cpu_mp_setmaxid(void) { CPU_SETOF(curcpu, &all_cpus); @@ -277,6 +261,25 @@ sun4u_startcpu(phandle_t cpu, void *func void cpu_mp_start(void) { + u_int cpu_impl, isjbus; + + mtx_init(&ipi_mtx, "ipi", NULL, MTX_SPIN); + + isjbus = 0; + cpu_impl = PCPU_GET(impl); + if (cpu_impl == CPU_IMPL_ULTRASPARCIIIi || + cpu_impl == CPU_IMPL_ULTRASPARCIIIip) { + isjbus = 1; + cpu_ipi_selected = jalapeno_ipi_selected; + cpu_ipi_single = jalapeno_ipi_single; + } else if (cpu_impl == CPU_IMPL_SPARC64V || + cpu_impl >= CPU_IMPL_ULTRASPARCIII) { + cpu_ipi_selected = cheetah_ipi_selected; + cpu_ipi_single = cheetah_ipi_single; + } else { + cpu_ipi_selected = spitfire_ipi_selected; + cpu_ipi_single = spitfire_ipi_single; + } intr_setup(PIL_AST, cpu_ipi_ast, -1, NULL, NULL); intr_setup(PIL_RENDEZVOUS, (ih_func_t *)smp_rendezvous_action, @@ -359,7 +362,7 @@ cpu_mp_announce(void) } static void -cpu_mp_unleash(void *v) +cpu_mp_unleash(void *v __unused) { volatile struct cpu_start_args *csa; struct pcpu *pc; @@ -406,7 +409,6 @@ cpu_mp_unleash(void *v) membar(StoreLoad); csa->csa_count = 0; - smp_started = 1; } void @@ -463,6 +465,9 @@ cpu_mp_bootstrap(struct pcpu *pc) while (csa->csa_count != 0) ; + if (smp_cpus == mp_ncpus) + atomic_store_rel_int(&smp_started, 1); + /* Start per-CPU event timers. */ cpu_initclocks_ap(); @@ -529,7 +534,7 @@ cpu_ipi_stop(struct trapframe *tf __unus } static void -cpu_ipi_preempt(struct trapframe *tf) +cpu_ipi_preempt(struct trapframe *tf __unused) { sched_preempt(curthread); @@ -572,9 +577,11 @@ spitfire_ipi_single(u_int cpu, u_long d0 u_int mid; int i; + mtx_assert(&ipi_mtx, MA_OWNED); KASSERT(cpu != curcpu, ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_BUSY) == 0, ("%s: outstanding dispatch", __func__)); + mid = cpuid_to_mid[cpu]; for (i = 0; i < IPI_RETRIES; i++) { s = intr_disable(); @@ -600,12 +607,6 @@ spitfire_ipi_single(u_int cpu, u_long d0 intr_restore(s); if ((ids & (IDR_BUSY | IDR_NACK)) == 0) return; - /* - * Leave interrupts enabled for a bit before retrying - * in order to avoid deadlocks if the other CPU is also - * trying to send an IPI. - */ - DELAY(2); } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI to module 0x%u\n", @@ -623,10 +624,12 @@ cheetah_ipi_single(u_int cpu, u_long d0, u_int mid; int i; + mtx_assert(&ipi_mtx, MA_OWNED); KASSERT(cpu != curcpu, ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_CHEETAH_ALL_BUSY) == 0, ("%s: outstanding dispatch", __func__)); + mid = cpuid_to_mid[cpu]; for (i = 0; i < IPI_RETRIES; i++) { s = intr_disable(); @@ -643,12 +646,6 @@ cheetah_ipi_single(u_int cpu, u_long d0, intr_restore(s); if ((ids & (IDR_BUSY | IDR_NACK)) == 0) return; - /* - * Leave interrupts enabled for a bit before retrying - * in order to avoid deadlocks if the other CPU is also - * trying to send an IPI. - */ - DELAY(2); } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI to module 0x%u\n", @@ -668,13 +665,14 @@ cheetah_ipi_selected(cpuset_t cpus, u_lo u_int cpu; int i; + mtx_assert(&ipi_mtx, MA_OWNED); + KASSERT(!CPU_EMPTY(&cpus), ("%s: no CPUs to IPI", __func__)); KASSERT(!CPU_ISSET(curcpu, &cpus), ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_CHEETAH_ALL_BUSY) == 0, ("%s: outstanding dispatch", __func__)); - if (CPU_EMPTY(&cpus)) - return; + ids = 0; for (i = 0; i < IPI_RETRIES * mp_ncpus; i++) { s = intr_disable(); @@ -708,12 +706,6 @@ cheetah_ipi_selected(cpuset_t cpus, u_lo } if (CPU_EMPTY(&cpus)) return; - /* - * Leave interrupts enabled for a bit before retrying - * in order to avoid deadlocks if the other CPUs are - * also trying to send IPIs. - */ - DELAY(2 * mp_ncpus); } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI (cpus=%s ids=0x%lu)\n", @@ -731,10 +723,12 @@ jalapeno_ipi_single(u_int cpu, u_long d0 u_int busy, busynack, mid; int i; + mtx_assert(&ipi_mtx, MA_OWNED); KASSERT(cpu != curcpu, ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_CHEETAH_ALL_BUSY) == 0, ("%s: outstanding dispatch", __func__)); + mid = cpuid_to_mid[cpu]; busy = IDR_BUSY << (2 * mid); busynack = (IDR_BUSY | IDR_NACK) << (2 * mid); @@ -753,12 +747,6 @@ jalapeno_ipi_single(u_int cpu, u_long d0 intr_restore(s); if ((ids & busynack) == 0) return; - /* - * Leave interrupts enabled for a bit before retrying - * in order to avoid deadlocks if the other CPU is also - * trying to send an IPI. - */ - DELAY(2); } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI to module 0x%u\n", @@ -777,13 +765,14 @@ jalapeno_ipi_selected(cpuset_t cpus, u_l u_int cpu; int i; + mtx_assert(&ipi_mtx, MA_OWNED); + KASSERT(!CPU_EMPTY(&cpus), ("%s: no CPUs to IPI", __func__)); KASSERT(!CPU_ISSET(curcpu, &cpus), ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_CHEETAH_ALL_BUSY) == 0, ("%s: outstanding dispatch", __func__)); - if (CPU_EMPTY(&cpus)) - return; + ids = 0; for (i = 0; i < IPI_RETRIES * mp_ncpus; i++) { s = intr_disable(); @@ -810,12 +799,6 @@ jalapeno_ipi_selected(cpuset_t cpus, u_l if ((ids & (IDR_NACK << (2 * cpuid_to_mid[cpu]))) == 0) CPU_CLR(cpu, &cpus); - /* - * Leave interrupts enabled for a bit before retrying - * in order to avoid deadlocks if the other CPUs are - * also trying to send IPIs. - */ - DELAY(2 * mp_ncpus); } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI (cpus=%s ids=0x%lu)\n", Modified: stable/9/sys/sparc64/sparc64/tick.c ============================================================================== --- stable/9/sys/sparc64/sparc64/tick.c Thu Jul 30 02:06:29 2015 (r286055) +++ stable/9/sys/sparc64/sparc64/tick.c Thu Jul 30 02:06:34 2015 (r286056) @@ -31,8 +31,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include #include #include #include @@ -46,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -328,7 +325,7 @@ tick_get_timecount_up(struct timecounter static u_int stick_get_timecount_mp(struct timecounter *tc) { - u_long stick; + static u_long stick; sched_pin(); if (curcpu == 0) @@ -342,7 +339,7 @@ stick_get_timecount_mp(struct timecounte static u_int tick_get_timecount_mp(struct timecounter *tc) { - u_long tick; + static u_long tick; sched_pin(); if (curcpu == 0) From owner-svn-src-all@freebsd.org Thu Jul 30 02:09:05 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 49F459A7399; Thu, 30 Jul 2015 02:09:05 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3A802BF2; Thu, 30 Jul 2015 02:09:05 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6U295ko063505; Thu, 30 Jul 2015 02:09:05 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6U2944l063502; Thu, 30 Jul 2015 02:09:04 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201507300209.t6U2944l063502@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Thu, 30 Jul 2015 02:09:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286057 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 02:09:05 -0000 Author: loos Date: Thu Jul 30 02:09:03 2015 New Revision: 286057 URL: https://svnweb.freebsd.org/changeset/base/286057 Log: Follow r256586 and rename the kernel version of the Free() macro to R_Free(). This matches the other macros and reduces the chances to clash with other headers. This also fixes the build of radix.c outside of the kernel environment. Reviewed by: glebius Modified: head/sys/net/radix.c head/sys/net/radix.h head/sys/net/route.c Modified: head/sys/net/radix.c ============================================================================== --- head/sys/net/radix.c Thu Jul 30 02:06:34 2015 (r286056) +++ head/sys/net/radix.c Thu Jul 30 02:09:03 2015 (r286057) @@ -533,7 +533,7 @@ rn_addmask(void *n_arg, struct radix_nod x = rn_insert(cp, maskhead, &maskduplicated, x); if (maskduplicated) { log(LOG_ERR, "rn_addmask: mask impossibly already in tree"); - Free(saved_x); + R_Free(saved_x); return (x); } /* @@ -829,7 +829,7 @@ rn_delete(void *v_arg, void *netmask_arg for (mp = &x->rn_mklist; (m = *mp); mp = &m->rm_mklist) if (m == saved_m) { *mp = m->rm_mklist; - Free(m); + R_Free(m); break; } if (m == 0) { @@ -920,7 +920,7 @@ on1: struct radix_mask *mm = m->rm_mklist; x->rn_mklist = 0; if (--(m->rm_refs) < 0) - Free(m); + R_Free(m); m = mm; } if (m) @@ -1152,7 +1152,7 @@ rn_detachhead_internal(void **head) rnh = *head; /* Free nodes. */ - Free(rnh); + R_Free(rnh); *head = NULL; } @@ -1186,7 +1186,7 @@ rn_freeentry(struct radix_node *rn, void x = (struct radix_node *)rn_delete(rn + 2, NULL, rnh); if (x != NULL) - Free(x); + R_Free(x); return (0); } Modified: head/sys/net/radix.h ============================================================================== --- head/sys/net/radix.h Thu Jul 30 02:06:34 2015 (r286056) +++ head/sys/net/radix.h Thu Jul 30 02:09:03 2015 (r286057) @@ -137,7 +137,7 @@ struct radix_node_head { #else #define R_Malloc(p, t, n) (p = (t) malloc((unsigned long)(n), M_RTABLE, M_NOWAIT)) #define R_Zalloc(p, t, n) (p = (t) malloc((unsigned long)(n), M_RTABLE, M_NOWAIT | M_ZERO)) -#define Free(p) free((caddr_t)p, M_RTABLE); +#define R_Free(p) free((caddr_t)p, M_RTABLE); #define RADIX_NODE_HEAD_LOCK_INIT(rnh) \ rw_init_flags(&(rnh)->rnh_lock, "radix node head", 0) Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Thu Jul 30 02:06:34 2015 (r286056) +++ head/sys/net/route.c Thu Jul 30 02:09:03 2015 (r286057) @@ -519,7 +519,7 @@ rtfree(struct rtentry *rt) * This also frees the gateway, as they are always malloc'd * together. */ - Free(rt_key(rt)); + R_Free(rt_key(rt)); /* * and the rtentry itself of course @@ -1352,7 +1352,7 @@ rtrequest1_fib(int req, struct rt_addrin if (rn_mpath_capable(rnh) && rt_mpath_conflict(rnh, rt, netmask)) { ifa_free(rt->rt_ifa); - Free(rt_key(rt)); + R_Free(rt_key(rt)); uma_zfree(V_rtzone, rt); senderr(EEXIST); } @@ -1419,7 +1419,7 @@ rtrequest1_fib(int req, struct rt_addrin */ if (rn == NULL) { ifa_free(rt->rt_ifa); - Free(rt_key(rt)); + R_Free(rt_key(rt)); uma_zfree(V_rtzone, rt); #ifdef FLOWTABLE if (rt0 != NULL) @@ -1641,7 +1641,7 @@ rt_setgate(struct rtentry *rt, struct so * Free()/free() handle a NULL argument just fine. */ bcopy(dst, new, dlen); - Free(rt_key(rt)); /* free old block, if any */ + R_Free(rt_key(rt)); /* free old block, if any */ rt_key(rt) = (struct sockaddr *)new; rt->rt_gateway = (struct sockaddr *)(new + dlen); } From owner-svn-src-all@freebsd.org Thu Jul 30 02:22:39 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40B689A7777; Thu, 30 Jul 2015 02:22:39 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 176991335; Thu, 30 Jul 2015 02:22:39 +0000 (UTC) (envelope-from whu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6U2Mc1T071281; Thu, 30 Jul 2015 02:22:38 GMT (envelope-from whu@FreeBSD.org) Received: (from whu@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6U2Mcl1071280; Thu, 30 Jul 2015 02:22:38 GMT (envelope-from whu@FreeBSD.org) Message-Id: <201507300222.t6U2Mcl1071280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: whu set sender to whu@FreeBSD.org using -f From: Wei Hu Date: Thu, 30 Jul 2015 02:22:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r286058 - releng/10.2/sys/dev/hyperv/netvsc X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 02:22:39 -0000 Author: whu Date: Thu Jul 30 02:22:38 2015 New Revision: 286058 URL: https://svnweb.freebsd.org/changeset/base/286058 Log: MFC r285928 Do not enable UDP checksum offloading when running on the Hyper-V on Windows Server 2012 and earlier hosts. Submitted by: whu Reviewed by: royger Approved by: re (gjb) Sponsored by: Microsoft OSTC Differential Revision: https://reviews.freebsd.org/D3102 Modified: releng/10.2/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Directory Properties: releng/10.2/ (props changed) Modified: releng/10.2/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c ============================================================================== --- releng/10.2/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Jul 30 02:09:03 2015 (r286057) +++ releng/10.2/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Thu Jul 30 02:22:38 2015 (r286058) @@ -343,7 +343,15 @@ netvsc_attach(device_t dev) IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_TSO; ifp->if_capenable |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_HWCSUM | IFCAP_TSO; - ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_TSO; + /* + * Only enable UDP checksum offloading when it is on 2012R2 or + * later. UDP checksum offloading doesn't work on earlier + * Windows releases. + */ + if (hv_vmbus_protocal_version >= HV_VMBUS_VERSION_WIN8_1) + ifp->if_hwassist = CSUM_TCP | CSUM_UDP | CSUM_TSO; + else + ifp->if_hwassist = CSUM_TCP | CSUM_TSO; ret = hv_rf_on_device_add(device_ctx, &device_info); if (ret != 0) { @@ -1110,7 +1118,17 @@ hn_ioctl(struct ifnet *ifp, u_long cmd, ifp->if_hwassist &= ~(CSUM_TCP | CSUM_UDP); } else { ifp->if_capenable |= IFCAP_TXCSUM; - ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP); + /* + * Only enable UDP checksum offloading on + * Windows Server 2012R2 or later releases. + */ + if (hv_vmbus_protocal_version >= + HV_VMBUS_VERSION_WIN8_1) { + ifp->if_hwassist |= + (CSUM_TCP | CSUM_UDP); + } else { + ifp->if_hwassist |= CSUM_TCP; + } } } From owner-svn-src-all@freebsd.org Thu Jul 30 02:23:11 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 123AE9A77C1; Thu, 30 Jul 2015 02:23:11 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 022F314D1; Thu, 30 Jul 2015 02:23:11 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6U2NAkD071357; Thu, 30 Jul 2015 02:23:10 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6U2NA0N071354; Thu, 30 Jul 2015 02:23:10 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201507300223.t6U2NA0N071354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Thu, 30 Jul 2015 02:23:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286059 - stable/10/sys/dev/uart X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 02:23:11 -0000 Author: marius Date: Thu Jul 30 02:23:09 2015 New Revision: 286059 URL: https://svnweb.freebsd.org/changeset/base/286059 Log: MFC: r285843 - Since r253161, uart_intr() abuses FILTER_SCHEDULE_THREAD for signaling uart_bus_attach() during its test that 20 iterations weren't sufficient for clearing all pending interrupts, assuming this means that hardware is broken and doesn't deassert interrupts. However, under pressure, 20 iterations also can be insufficient for clearing all pending interrupts, leading to a panic as intr_event_handle() tries to schedule an interrupt handler not registered. Solve this by introducing a flag that is set in test mode and otherwise restores pre-r253161 behavior of uart_intr(). The approach of additionally registering uart_intr() as handler as suggested in PR 194979 is not taken as that in turn would abuse special pccard and pccbb handling code of intr_event_handle(). [1] - Const'ify uart_driver_name. - Fix some minor style bugs. PR: 194979 [1] Reviewed by: marcel (earlier version) Modified: stable/10/sys/dev/uart/uart_bus.h stable/10/sys/dev/uart/uart_core.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/uart/uart_bus.h ============================================================================== --- stable/10/sys/dev/uart/uart_bus.h Thu Jul 30 02:22:38 2015 (r286058) +++ stable/10/sys/dev/uart/uart_bus.h Thu Jul 30 02:23:09 2015 (r286059) @@ -98,6 +98,7 @@ struct uart_softc { int sc_polled:1; /* This UART has no interrupts. */ int sc_txbusy:1; /* This UART is transmitting. */ int sc_isquelch:1; /* This UART has input squelched. */ + int sc_testintr:1; /* This UART is under int. testing. */ struct uart_devinfo *sc_sysdev; /* System device (or NULL). */ @@ -134,7 +135,7 @@ struct uart_softc { }; extern devclass_t uart_devclass; -extern char uart_driver_name[]; +extern const char uart_driver_name[]; int uart_bus_attach(device_t dev); int uart_bus_detach(device_t dev); @@ -156,14 +157,16 @@ void uart_tty_intr(void *arg); static __inline int uart_rx_empty(struct uart_softc *sc) { + return ((sc->sc_rxget == sc->sc_rxput) ? 1 : 0); } static __inline int uart_rx_full(struct uart_softc *sc) { - return ((sc->sc_rxput + 1 < sc->sc_rxbufsz) - ? (sc->sc_rxput + 1 == sc->sc_rxget) : (sc->sc_rxget == 0)); + + return ((sc->sc_rxput + 1 < sc->sc_rxbufsz) ? + (sc->sc_rxput + 1 == sc->sc_rxget) : (sc->sc_rxget == 0)); } static __inline int Modified: stable/10/sys/dev/uart/uart_core.c ============================================================================== --- stable/10/sys/dev/uart/uart_core.c Thu Jul 30 02:22:38 2015 (r286058) +++ stable/10/sys/dev/uart/uart_core.c Thu Jul 30 02:23:09 2015 (r286059) @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); #include "uart_if.h" devclass_t uart_devclass; -char uart_driver_name[] = "uart"; +const char uart_driver_name[] = "uart"; SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs = SLIST_HEAD_INITIALIZER(uart_sysdevs); @@ -248,13 +248,14 @@ static int uart_intr(void *arg) { struct uart_softc *sc = arg; - int cnt, ipend; + int cnt, ipend, testintr; if (sc->sc_leaving) return (FILTER_STRAY); cnt = 0; - while (cnt < 20 && (ipend = UART_IPEND(sc)) != 0) { + testintr = sc->sc_testintr; + while ((!testintr || cnt < 20) && (ipend = UART_IPEND(sc)) != 0) { cnt++; if (ipend & SER_INT_OVERRUN) uart_intr_overrun(sc); @@ -265,7 +266,7 @@ uart_intr(void *arg) if (ipend & SER_INT_SIGCHG) uart_intr_sigchg(sc); if (ipend & SER_INT_TXIDLE) - uart_intr_txidle(sc); + uart_intr_txidle(sc); } if (sc->sc_polled) { @@ -274,7 +275,8 @@ uart_intr(void *arg) } return ((cnt == 0) ? FILTER_STRAY : - ((cnt == 20) ? FILTER_SCHEDULE_THREAD : FILTER_HANDLED)); + ((testintr && cnt == 20) ? FILTER_SCHEDULE_THREAD : + FILTER_HANDLED)); } serdev_intr_t * @@ -421,7 +423,7 @@ uart_bus_attach(device_t dev) /* * Protect ourselves against interrupts while we're not completely * finished attaching and initializing. We don't expect interrupts - * until after UART_ATTACH() though. + * until after UART_ATTACH(), though. */ sc->sc_leaving = 1; @@ -501,7 +503,9 @@ uart_bus_attach(device_t dev) pps_init(&sc->sc_pps); sc->sc_leaving = 0; + sc->sc_testintr = 1; filt = uart_intr(sc); + sc->sc_testintr = 0; /* * Don't use interrupts if we couldn't clear any pending interrupt From owner-svn-src-all@freebsd.org Thu Jul 30 02:45:38 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74F7B9A7CDF; Thu, 30 Jul 2015 02:45:38 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5C0FE1F9A; Thu, 30 Jul 2015 02:45:38 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6U2jc5t079640; Thu, 30 Jul 2015 02:45:38 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6U2jaWJ079635; Thu, 30 Jul 2015 02:45:36 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201507300245.t6U2jaWJ079635@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Thu, 30 Jul 2015 02:45:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r286060 - in releng/10.2/sys: kern sparc64/include sparc64/sparc64 X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 02:45:38 -0000 Author: marius Date: Thu Jul 30 02:45:35 2015 New Revision: 286060 URL: https://svnweb.freebsd.org/changeset/base/286060 Log: MFC: r285839 (r286055 in stable/10) o Revert the other functional half of r239864, i. e. the merge of r134227 from x86 to use smp_ipi_mtx spin lock not only for smp_rendezvous_cpus() but also for the MD cache invalidation, TLB demapping and remote register reading IPIs due to the following reasons: - The cross-IPI SMP deadlock x86 otherwise is subject to can't happen on sparc64. That's because on sparc64, spin locks don't disable interrupts completely but only raise the processor interrupt level to PIL_TICK. This means that IPIs still get delivered and direct dispatch IPIs such as the cache invalidation etc. IPIs in question are still executed. - In smp_rendezvous_cpus(), smp_ipi_mtx is held not only while sending an IPI_RENDEZVOUS, but until all CPUs have processed smp_rendezvous_action(). Consequently, smp_ipi_mtx may be locked for an extended amount of time as queued IPIs (as opposed to the direct ones) such as IPI_RENDEZVOUS are scheduled via a soft interrupt. Moreover, given that this soft interrupt is only delivered at PIL_RENDEZVOUS, processing of smp_rendezvous_action() on a target may be interrupted by f. e. a tick interrupt at PIL_TICK, in turn leading to the target in question trying to send an IPI by itself while IPI_RENDEZVOUS isn't fully handled, yet, and, thus, resulting in a deadlock. o As mentioned in the commit message of r245850, on least some sun4u platforms concurrent sending of IPIs by different CPUs is fatal. Therefore, hold the reintroduced MD ipi_mtx also while delivering cross-traps via MI helpers, i. e. ipi_{all_but_self,cpu,selected}(). o Akin to x86, let the last CPU to process cpu_mp_bootstrap() set smp_started instead of the BSP in cpu_mp_unleash(). This ensures that all APs actually are started, when smp_started is no longer 0. o In all MD and MI IPI helpers, check for smp_started == 1 rather than for smp_cpus > 1 or nothing at all. This avoids races during boot causing IPIs trying to be delivered to APs that in fact aren't up and running, yet. While at it, move setting of the cpu_ipi_{selected,single}() pointers to the appropriate delivery functions from mp_init() to cpu_mp_start() where it's better suited and allows to get rid of the global isjbus variable. o Given that now concurrent IPI delivery no longer is possible, also nuke the delays before completely disabling interrupts again in the CPU-specific cross-trap delivery functions, previously giving other CPUs a window for sending IPIs on their part. Actually, we now should be able to entirely get rid of completely disabling interrupts in these functions. Such a change needs more testing, though. o In {s,}tick_get_timecount_mp(), make the {s,}tick variable static. While not necessary for correctness, this avoids page faults when accessing the stack of a foreign CPU as {s,}tick now is locked into the TLBs as part of static kernel data. Hence, {s,}tick_get_timecount_mp() always execute as fast as possible, avoiding jitter. PR: 201245 Approved by: re (gjb) Modified: releng/10.2/sys/kern/subr_witness.c releng/10.2/sys/sparc64/include/smp.h releng/10.2/sys/sparc64/sparc64/machdep.c releng/10.2/sys/sparc64/sparc64/mp_machdep.c releng/10.2/sys/sparc64/sparc64/tick.c Directory Properties: releng/10.2/ (props changed) Modified: releng/10.2/sys/kern/subr_witness.c ============================================================================== --- releng/10.2/sys/kern/subr_witness.c Thu Jul 30 02:23:09 2015 (r286059) +++ releng/10.2/sys/kern/subr_witness.c Thu Jul 30 02:45:35 2015 (r286060) @@ -666,6 +666,9 @@ static struct witness_order_list_entry o */ { "intrcnt", &lock_class_mtx_spin }, { "icu", &lock_class_mtx_spin }, +#if defined(SMP) && defined(__sparc64__) + { "ipi", &lock_class_mtx_spin }, +#endif #ifdef __i386__ { "allpmaps", &lock_class_mtx_spin }, { "descriptor tables", &lock_class_mtx_spin }, Modified: releng/10.2/sys/sparc64/include/smp.h ============================================================================== --- releng/10.2/sys/sparc64/include/smp.h Thu Jul 30 02:23:09 2015 (r286059) +++ releng/10.2/sys/sparc64/include/smp.h Thu Jul 30 02:45:35 2015 (r286060) @@ -39,13 +39,15 @@ #ifndef LOCORE +#include #include +#include +#include #include #include #include #include -#include #include #define IDR_BUSY 0x0000000000000001ULL @@ -96,6 +98,7 @@ struct ipi_tlb_args { }; #define ita_va ita_start +struct pcb; struct pcpu; extern struct pcb stoppcbs[]; @@ -108,8 +111,9 @@ extern cpu_ipi_selected_t *cpu_ipi_selec typedef void cpu_ipi_single_t(u_int, u_long, u_long, u_long); extern cpu_ipi_single_t *cpu_ipi_single; -void mp_init(u_int cpu_impl); +void mp_init(void); +extern struct mtx ipi_mtx; extern struct ipi_cache_args ipi_cache_args; extern struct ipi_rd_args ipi_rd_args; extern struct ipi_tlb_args ipi_tlb_args; @@ -139,23 +143,37 @@ ipi_all_but_self(u_int ipi) { cpuset_t cpus; + if (__predict_false(smp_started == 0)) + return; cpus = all_cpus; + sched_pin(); CPU_CLR(PCPU_GET(cpuid), &cpus); + mtx_lock_spin(&ipi_mtx); cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_level, ipi); + mtx_unlock_spin(&ipi_mtx); + sched_unpin(); } static __inline void ipi_selected(cpuset_t cpus, u_int ipi) { + if (__predict_false(smp_started == 0 || CPU_EMPTY(&cpus))) + return; + mtx_lock_spin(&ipi_mtx); cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_level, ipi); + mtx_unlock_spin(&ipi_mtx); } static __inline void ipi_cpu(int cpu, u_int ipi) { + if (__predict_false(smp_started == 0)) + return; + mtx_lock_spin(&ipi_mtx); cpu_ipi_single(cpu, 0, (u_long)tl_ipi_level, ipi); + mtx_unlock_spin(&ipi_mtx); } #if defined(_MACHINE_PMAP_H_) && defined(_SYS_MUTEX_H_) @@ -165,11 +183,11 @@ ipi_dcache_page_inval(void *func, vm_pad { struct ipi_cache_args *ica; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); ica = &ipi_cache_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); ica->ica_mask = all_cpus; CPU_CLR(PCPU_GET(cpuid), &ica->ica_mask); ica->ica_pa = pa; @@ -182,11 +200,11 @@ ipi_icache_page_inval(void *func, vm_pad { struct ipi_cache_args *ica; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); ica = &ipi_cache_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); ica->ica_mask = all_cpus; CPU_CLR(PCPU_GET(cpuid), &ica->ica_mask); ica->ica_pa = pa; @@ -199,11 +217,11 @@ ipi_rd(u_int cpu, void *func, u_long *va { struct ipi_rd_args *ira; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); ira = &ipi_rd_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); CPU_SETOF(cpu, &ira->ira_mask); ira->ira_val = val; cpu_ipi_single(cpu, 0, (u_long)func, (u_long)ira); @@ -216,7 +234,7 @@ ipi_tlb_context_demap(struct pmap *pm) struct ipi_tlb_args *ita; cpuset_t cpus; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); cpus = pm->pm_active; @@ -227,7 +245,7 @@ ipi_tlb_context_demap(struct pmap *pm) return (NULL); } ita = &ipi_tlb_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); ita->ita_mask = cpus; ita->ita_pmap = pm; cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_tlb_context_demap, @@ -241,7 +259,7 @@ ipi_tlb_page_demap(struct pmap *pm, vm_o struct ipi_tlb_args *ita; cpuset_t cpus; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); cpus = pm->pm_active; @@ -252,7 +270,7 @@ ipi_tlb_page_demap(struct pmap *pm, vm_o return (NULL); } ita = &ipi_tlb_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); ita->ita_mask = cpus; ita->ita_pmap = pm; ita->ita_va = va; @@ -266,7 +284,7 @@ ipi_tlb_range_demap(struct pmap *pm, vm_ struct ipi_tlb_args *ita; cpuset_t cpus; - if (smp_cpus == 1) + if (__predict_false(smp_started == 0)) return (NULL); sched_pin(); cpus = pm->pm_active; @@ -277,7 +295,7 @@ ipi_tlb_range_demap(struct pmap *pm, vm_ return (NULL); } ita = &ipi_tlb_args; - mtx_lock_spin(&smp_ipi_mtx); + mtx_lock_spin(&ipi_mtx); ita->ita_mask = cpus; ita->ita_pmap = pm; ita->ita_start = start; @@ -292,10 +310,10 @@ ipi_wait(void *cookie) { volatile cpuset_t *mask; - if ((mask = cookie) != NULL) { + if (__predict_false((mask = cookie) != NULL)) { while (!CPU_EMPTY(mask)) ; - mtx_unlock_spin(&smp_ipi_mtx); + mtx_unlock_spin(&ipi_mtx); sched_unpin(); } } Modified: releng/10.2/sys/sparc64/sparc64/machdep.c ============================================================================== --- releng/10.2/sys/sparc64/sparc64/machdep.c Thu Jul 30 02:23:09 2015 (r286059) +++ releng/10.2/sys/sparc64/sparc64/machdep.c Thu Jul 30 02:45:35 2015 (r286060) @@ -503,7 +503,7 @@ sparc64_init(caddr_t mdp, u_long o1, u_l } #ifdef SMP - mp_init(cpu_impl); + mp_init(); #endif /* Modified: releng/10.2/sys/sparc64/sparc64/mp_machdep.c ============================================================================== --- releng/10.2/sys/sparc64/sparc64/mp_machdep.c Thu Jul 30 02:23:09 2015 (r286059) +++ releng/10.2/sys/sparc64/sparc64/mp_machdep.c Thu Jul 30 02:45:35 2015 (r286060) @@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -113,12 +114,13 @@ struct ipi_rd_args ipi_rd_args; struct ipi_tlb_args ipi_tlb_args; struct pcb stoppcbs[MAXCPU]; +struct mtx ipi_mtx; + cpu_ipi_selected_t *cpu_ipi_selected; cpu_ipi_single_t *cpu_ipi_single; static vm_offset_t mp_tramp; static u_int cpuid_to_mid[MAXCPU]; -static int isjbus; static volatile cpuset_t shutdown_cpus; static void ap_count(phandle_t node, u_int mid, u_int cpu_impl); @@ -138,7 +140,7 @@ static cpu_ipi_single_t spitfire_ipi_sin SYSINIT(cpu_mp_unleash, SI_SUB_SMP, SI_ORDER_FIRST, cpu_mp_unleash, NULL); void -mp_init(u_int cpu_impl) +mp_init(void) { struct tte *tp; int i; @@ -157,24 +159,6 @@ mp_init(u_int cpu_impl) } for (i = 0; i < PAGE_SIZE; i += sizeof(vm_offset_t)) flush(mp_tramp + i); - - /* - * On UP systems cpu_ipi_selected() can be called while - * cpu_mp_start() wasn't so initialize these here. - */ - if (cpu_impl == CPU_IMPL_ULTRASPARCIIIi || - cpu_impl == CPU_IMPL_ULTRASPARCIIIip) { - isjbus = 1; - cpu_ipi_selected = jalapeno_ipi_selected; - cpu_ipi_single = jalapeno_ipi_single; - } else if (cpu_impl == CPU_IMPL_SPARC64V || - cpu_impl >= CPU_IMPL_ULTRASPARCIII) { - cpu_ipi_selected = cheetah_ipi_selected; - cpu_ipi_single = cheetah_ipi_single; - } else { - cpu_ipi_selected = spitfire_ipi_selected; - cpu_ipi_single = spitfire_ipi_single; - } } static void @@ -219,7 +203,7 @@ foreach_ap(phandle_t node, void (*func)( * Probe for other CPUs. */ void -cpu_mp_setmaxid() +cpu_mp_setmaxid(void) { CPU_SETOF(curcpu, &all_cpus); @@ -277,6 +261,25 @@ sun4u_startcpu(phandle_t cpu, void *func void cpu_mp_start(void) { + u_int cpu_impl, isjbus; + + mtx_init(&ipi_mtx, "ipi", NULL, MTX_SPIN); + + isjbus = 0; + cpu_impl = PCPU_GET(impl); + if (cpu_impl == CPU_IMPL_ULTRASPARCIIIi || + cpu_impl == CPU_IMPL_ULTRASPARCIIIip) { + isjbus = 1; + cpu_ipi_selected = jalapeno_ipi_selected; + cpu_ipi_single = jalapeno_ipi_single; + } else if (cpu_impl == CPU_IMPL_SPARC64V || + cpu_impl >= CPU_IMPL_ULTRASPARCIII) { + cpu_ipi_selected = cheetah_ipi_selected; + cpu_ipi_single = cheetah_ipi_single; + } else { + cpu_ipi_selected = spitfire_ipi_selected; + cpu_ipi_single = spitfire_ipi_single; + } intr_setup(PIL_AST, cpu_ipi_ast, -1, NULL, NULL); intr_setup(PIL_RENDEZVOUS, (ih_func_t *)smp_rendezvous_action, @@ -360,7 +363,7 @@ cpu_mp_announce(void) } static void -cpu_mp_unleash(void *v) +cpu_mp_unleash(void *v __unused) { volatile struct cpu_start_args *csa; struct pcpu *pc; @@ -407,7 +410,6 @@ cpu_mp_unleash(void *v) membar(StoreLoad); csa->csa_count = 0; - smp_started = 1; } void @@ -464,6 +466,9 @@ cpu_mp_bootstrap(struct pcpu *pc) while (csa->csa_count != 0) ; + if (smp_cpus == mp_ncpus) + atomic_store_rel_int(&smp_started, 1); + /* Start per-CPU event timers. */ cpu_initclocks_ap(); @@ -530,7 +535,7 @@ cpu_ipi_stop(struct trapframe *tf __unus } static void -cpu_ipi_preempt(struct trapframe *tf) +cpu_ipi_preempt(struct trapframe *tf __unused) { sched_preempt(curthread); @@ -573,9 +578,11 @@ spitfire_ipi_single(u_int cpu, u_long d0 u_int mid; int i; + mtx_assert(&ipi_mtx, MA_OWNED); KASSERT(cpu != curcpu, ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_BUSY) == 0, ("%s: outstanding dispatch", __func__)); + mid = cpuid_to_mid[cpu]; for (i = 0; i < IPI_RETRIES; i++) { s = intr_disable(); @@ -601,12 +608,6 @@ spitfire_ipi_single(u_int cpu, u_long d0 intr_restore(s); if ((ids & (IDR_BUSY | IDR_NACK)) == 0) return; - /* - * Leave interrupts enabled for a bit before retrying - * in order to avoid deadlocks if the other CPU is also - * trying to send an IPI. - */ - DELAY(2); } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI to module 0x%u\n", @@ -624,10 +625,12 @@ cheetah_ipi_single(u_int cpu, u_long d0, u_int mid; int i; + mtx_assert(&ipi_mtx, MA_OWNED); KASSERT(cpu != curcpu, ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_CHEETAH_ALL_BUSY) == 0, ("%s: outstanding dispatch", __func__)); + mid = cpuid_to_mid[cpu]; for (i = 0; i < IPI_RETRIES; i++) { s = intr_disable(); @@ -644,12 +647,6 @@ cheetah_ipi_single(u_int cpu, u_long d0, intr_restore(s); if ((ids & (IDR_BUSY | IDR_NACK)) == 0) return; - /* - * Leave interrupts enabled for a bit before retrying - * in order to avoid deadlocks if the other CPU is also - * trying to send an IPI. - */ - DELAY(2); } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI to module 0x%u\n", @@ -669,13 +666,14 @@ cheetah_ipi_selected(cpuset_t cpus, u_lo u_int cpu; int i; + mtx_assert(&ipi_mtx, MA_OWNED); + KASSERT(!CPU_EMPTY(&cpus), ("%s: no CPUs to IPI", __func__)); KASSERT(!CPU_ISSET(curcpu, &cpus), ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_CHEETAH_ALL_BUSY) == 0, ("%s: outstanding dispatch", __func__)); - if (CPU_EMPTY(&cpus)) - return; + ids = 0; for (i = 0; i < IPI_RETRIES * mp_ncpus; i++) { s = intr_disable(); @@ -709,12 +707,6 @@ cheetah_ipi_selected(cpuset_t cpus, u_lo } if (CPU_EMPTY(&cpus)) return; - /* - * Leave interrupts enabled for a bit before retrying - * in order to avoid deadlocks if the other CPUs are - * also trying to send IPIs. - */ - DELAY(2 * mp_ncpus); } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI (cpus=%s ids=0x%lu)\n", @@ -732,10 +724,12 @@ jalapeno_ipi_single(u_int cpu, u_long d0 u_int busy, busynack, mid; int i; + mtx_assert(&ipi_mtx, MA_OWNED); KASSERT(cpu != curcpu, ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_CHEETAH_ALL_BUSY) == 0, ("%s: outstanding dispatch", __func__)); + mid = cpuid_to_mid[cpu]; busy = IDR_BUSY << (2 * mid); busynack = (IDR_BUSY | IDR_NACK) << (2 * mid); @@ -754,12 +748,6 @@ jalapeno_ipi_single(u_int cpu, u_long d0 intr_restore(s); if ((ids & busynack) == 0) return; - /* - * Leave interrupts enabled for a bit before retrying - * in order to avoid deadlocks if the other CPU is also - * trying to send an IPI. - */ - DELAY(2); } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI to module 0x%u\n", @@ -778,13 +766,14 @@ jalapeno_ipi_selected(cpuset_t cpus, u_l u_int cpu; int i; + mtx_assert(&ipi_mtx, MA_OWNED); + KASSERT(!CPU_EMPTY(&cpus), ("%s: no CPUs to IPI", __func__)); KASSERT(!CPU_ISSET(curcpu, &cpus), ("%s: CPU can't IPI itself", __func__)); KASSERT((ldxa(0, ASI_INTR_DISPATCH_STATUS) & IDR_CHEETAH_ALL_BUSY) == 0, ("%s: outstanding dispatch", __func__)); - if (CPU_EMPTY(&cpus)) - return; + ids = 0; for (i = 0; i < IPI_RETRIES * mp_ncpus; i++) { s = intr_disable(); @@ -811,12 +800,6 @@ jalapeno_ipi_selected(cpuset_t cpus, u_l if ((ids & (IDR_NACK << (2 * cpuid_to_mid[cpu]))) == 0) CPU_CLR(cpu, &cpus); - /* - * Leave interrupts enabled for a bit before retrying - * in order to avoid deadlocks if the other CPUs are - * also trying to send IPIs. - */ - DELAY(2 * mp_ncpus); } if (kdb_active != 0 || panicstr != NULL) printf("%s: couldn't send IPI (cpus=%s ids=0x%lu)\n", Modified: releng/10.2/sys/sparc64/sparc64/tick.c ============================================================================== --- releng/10.2/sys/sparc64/sparc64/tick.c Thu Jul 30 02:23:09 2015 (r286059) +++ releng/10.2/sys/sparc64/sparc64/tick.c Thu Jul 30 02:45:35 2015 (r286060) @@ -31,8 +31,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include #include #include #include @@ -46,7 +44,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -326,7 +323,7 @@ tick_get_timecount_up(struct timecounter static u_int stick_get_timecount_mp(struct timecounter *tc) { - u_long stick; + static u_long stick; sched_pin(); if (curcpu == 0) @@ -340,7 +337,7 @@ stick_get_timecount_mp(struct timecounte static u_int tick_get_timecount_mp(struct timecounter *tc) { - u_long tick; + static u_long tick; sched_pin(); if (curcpu == 0) From owner-svn-src-all@freebsd.org Thu Jul 30 02:47:21 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FCB29A7D8D; Thu, 30 Jul 2015 02:47:21 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 8E055298; Thu, 30 Jul 2015 02:47:21 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by freefall.freebsd.org (Postfix) with ESMTP id E38E117A5; Thu, 30 Jul 2015 02:47:20 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Date: Thu, 30 Jul 2015 02:47:19 +0000 From: Glen Barber To: Warner Losh Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r286042 - head Message-ID: <20150730024719.GQ55605@FreeBSD.org> References: <201507292115.t6TLFptm043041@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="jigfid2yHjNFZUTO" Content-Disposition: inline In-Reply-To: <201507292115.t6TLFptm043041@repo.freebsd.org> X-Operating-System: FreeBSD 11.0-CURRENT amd64 X-SCUD-Definition: Sudden Completely Unexpected Dataloss X-SULE-Definition: Sudden Unexpected Learning Event X-PEKBAC-Definition: Problem Exists, Keyboard Between Admin/Computer User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 02:47:21 -0000 --jigfid2yHjNFZUTO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Jul 29, 2015 at 09:15:51PM +0000, Warner Losh wrote: > Author: imp > Date: Wed Jul 29 21:15:50 2015 > New Revision: 286042 > URL: https://svnweb.freebsd.org/changeset/base/286042 >=20 > Log: > Clarify historical practice of not removing old entries. Add entry for > stable/10 branch that was forgotten when it was created. Update end > date to be correct. >=20 > Modified: > head/UPDATING >=20 > Modified: head/UPDATING > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/UPDATING Wed Jul 29 20:50:48 2015 (r286041) > +++ head/UPDATING Wed Jul 29 21:15:50 2015 (r286042) > @@ -578,6 +578,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11 > # pkg install pkg; ldd /usr/local/sbin/pkg | grep bsdyml > =20 > 20131010: > + The stable/10 branch has been created in subversion from head > + revision r256279. > + > +20131010: Doh. Thanks. :\ Glen --jigfid2yHjNFZUTO Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJVuZA3AAoJEAMUWKVHj+KTkcQP/2Q0uZxWSmQiOVjHcicxHOHf y6e4hqNLAmmmG5ZZdaxvbhCFRhYih0QJX6sAld94PBuZ7VbkHjubMwzafiwsPSQA HTuYvjVkLwve6uwwjBUoUacHg5OzbtefpF1kxdrqcvCuILmmbhtIVMg0EmIYkxsl EA2sDnbdqJjNIWLdFh3WDknCCnLfpn7SusZH+vNf627RviwHNRUoPR82IR39lj9G pGT2261FrleU2uW3QQq2q7Xum1t5jpHJUYlE1XL4yEKQMX96AKllP/oGc/BAIYrQ FxpG360qdNr/e+MMnH3EZ40kF4H50OLaG48/1b++VlwoHvLtcf/uWcZpT0LIgmfw zxJiQiReLKHinjY3tT5+1JcdubJaplM0tH8KacLnNrWj0Ty4v5lZT62TtBQPJnGR ar6dEuncYQVi0Zf8F2bzD8YqY1iQtTbQbyQ8Wh3lhvWTnceALzmkLTUqzg25Y/KC tbHJ8goqqKfDnHV0rW9+aCJyVLhvHInsjsSH/ibDzh36fCCgRuxD1SD1krEHghiO nacMmXaAHvhBfQbhDkkpAcrOlzrFmFs62yYRuLViKXwoQLL1RQuLInfFwa1unL14 50ePTkvsfT9VW12F7QR10SfvJvUJqzaJFsLEvVnfJlvplcP5wiX7CVIWgtnddoaR jiFaUdySGHxbi7ERSoZ4 =/+qf -----END PGP SIGNATURE----- --jigfid2yHjNFZUTO-- From owner-svn-src-all@freebsd.org Thu Jul 30 03:06:13 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 175DE9AE1AE; Thu, 30 Jul 2015 03:06:13 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 07E511111; Thu, 30 Jul 2015 03:06:13 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6U36Cem088820; Thu, 30 Jul 2015 03:06:12 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6U36Cpe088818; Thu, 30 Jul 2015 03:06:12 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201507300306.t6U36Cpe088818@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Thu, 30 Jul 2015 03:06:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r286061 - releng/10.2/sys/dev/uart X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 03:06:13 -0000 Author: marius Date: Thu Jul 30 03:06:11 2015 New Revision: 286061 URL: https://svnweb.freebsd.org/changeset/base/286061 Log: MFC: r285843 (r286059 in stable/10) - Since r253161, uart_intr() abuses FILTER_SCHEDULE_THREAD for signaling uart_bus_attach() during its test that 20 iterations weren't sufficient for clearing all pending interrupts, assuming this means that hardware is broken and doesn't deassert interrupts. However, under pressure, 20 iterations also can be insufficient for clearing all pending interrupts, leading to a panic as intr_event_handle() tries to schedule an interrupt handler not registered. Solve this by introducing a flag that is set in test mode and otherwise restores pre-r253161 behavior of uart_intr(). The approach of additionally registering uart_intr() as handler as suggested in PR 194979 is not taken as that in turn would abuse special pccard and pccbb handling code of intr_event_handle(). [1] - Const'ify uart_driver_name. - Fix some minor style bugs. PR: 194979 [1] Reviewed by: marcel (earlier version) Approved by: re (gjb) Modified: releng/10.2/sys/dev/uart/uart_bus.h releng/10.2/sys/dev/uart/uart_core.c Directory Properties: releng/10.2/ (props changed) Modified: releng/10.2/sys/dev/uart/uart_bus.h ============================================================================== --- releng/10.2/sys/dev/uart/uart_bus.h Thu Jul 30 02:45:35 2015 (r286060) +++ releng/10.2/sys/dev/uart/uart_bus.h Thu Jul 30 03:06:11 2015 (r286061) @@ -98,6 +98,7 @@ struct uart_softc { int sc_polled:1; /* This UART has no interrupts. */ int sc_txbusy:1; /* This UART is transmitting. */ int sc_isquelch:1; /* This UART has input squelched. */ + int sc_testintr:1; /* This UART is under int. testing. */ struct uart_devinfo *sc_sysdev; /* System device (or NULL). */ @@ -134,7 +135,7 @@ struct uart_softc { }; extern devclass_t uart_devclass; -extern char uart_driver_name[]; +extern const char uart_driver_name[]; int uart_bus_attach(device_t dev); int uart_bus_detach(device_t dev); @@ -156,14 +157,16 @@ void uart_tty_intr(void *arg); static __inline int uart_rx_empty(struct uart_softc *sc) { + return ((sc->sc_rxget == sc->sc_rxput) ? 1 : 0); } static __inline int uart_rx_full(struct uart_softc *sc) { - return ((sc->sc_rxput + 1 < sc->sc_rxbufsz) - ? (sc->sc_rxput + 1 == sc->sc_rxget) : (sc->sc_rxget == 0)); + + return ((sc->sc_rxput + 1 < sc->sc_rxbufsz) ? + (sc->sc_rxput + 1 == sc->sc_rxget) : (sc->sc_rxget == 0)); } static __inline int Modified: releng/10.2/sys/dev/uart/uart_core.c ============================================================================== --- releng/10.2/sys/dev/uart/uart_core.c Thu Jul 30 02:45:35 2015 (r286060) +++ releng/10.2/sys/dev/uart/uart_core.c Thu Jul 30 03:06:11 2015 (r286061) @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); #include "uart_if.h" devclass_t uart_devclass; -char uart_driver_name[] = "uart"; +const char uart_driver_name[] = "uart"; SLIST_HEAD(uart_devinfo_list, uart_devinfo) uart_sysdevs = SLIST_HEAD_INITIALIZER(uart_sysdevs); @@ -248,13 +248,14 @@ static int uart_intr(void *arg) { struct uart_softc *sc = arg; - int cnt, ipend; + int cnt, ipend, testintr; if (sc->sc_leaving) return (FILTER_STRAY); cnt = 0; - while (cnt < 20 && (ipend = UART_IPEND(sc)) != 0) { + testintr = sc->sc_testintr; + while ((!testintr || cnt < 20) && (ipend = UART_IPEND(sc)) != 0) { cnt++; if (ipend & SER_INT_OVERRUN) uart_intr_overrun(sc); @@ -265,7 +266,7 @@ uart_intr(void *arg) if (ipend & SER_INT_SIGCHG) uart_intr_sigchg(sc); if (ipend & SER_INT_TXIDLE) - uart_intr_txidle(sc); + uart_intr_txidle(sc); } if (sc->sc_polled) { @@ -274,7 +275,8 @@ uart_intr(void *arg) } return ((cnt == 0) ? FILTER_STRAY : - ((cnt == 20) ? FILTER_SCHEDULE_THREAD : FILTER_HANDLED)); + ((testintr && cnt == 20) ? FILTER_SCHEDULE_THREAD : + FILTER_HANDLED)); } serdev_intr_t * @@ -421,7 +423,7 @@ uart_bus_attach(device_t dev) /* * Protect ourselves against interrupts while we're not completely * finished attaching and initializing. We don't expect interrupts - * until after UART_ATTACH() though. + * until after UART_ATTACH(), though. */ sc->sc_leaving = 1; @@ -501,7 +503,9 @@ uart_bus_attach(device_t dev) pps_init(&sc->sc_pps); sc->sc_leaving = 0; + sc->sc_testintr = 1; filt = uart_intr(sc); + sc->sc_testintr = 0; /* * Don't use interrupts if we couldn't clear any pending interrupt From owner-svn-src-all@freebsd.org Thu Jul 30 03:50:03 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B80DA9AE82D; Thu, 30 Jul 2015 03:50:03 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A72DC61B; Thu, 30 Jul 2015 03:50:03 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6U3o3Xe005456; Thu, 30 Jul 2015 03:50:03 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6U3o2j9005453; Thu, 30 Jul 2015 03:50:02 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201507300350.t6U3o2j9005453@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Thu, 30 Jul 2015 03:50:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286062 - in head/sys: dev/xen/blkfront xen/interface/io X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 03:50:03 -0000 Author: cperciva Date: Thu Jul 30 03:50:01 2015 New Revision: 286062 URL: https://svnweb.freebsd.org/changeset/base/286062 Log: Add support for Xen blkif indirect segment I/Os. This makes it possible for the blkfront driver to perform I/Os of up to 2 MB, subject to support from the blkback to which it is connected and the initiation of such large I/Os by the rest of the kernel. In practice, the I/O size is increased from 40 kB to 128 kB. The changes to xen/interface/io/blkif.h consist merely of merging updates from the upstream Xen repository. In dev/xen/blkfront/block.h we add some convenience macros and structure fields used for indirect-page I/Os: The device records its negotiated limit on the number of indirect pages used, while each I/O command structure gains permanently allocated page(s) for indirect page references and the Xen grant references for those pages. In dev/xen/blkfront/blkfront.c we now check in xbd_queue_cb whether a request is small enough to handle without an indirection page, and either follow the previous behaviour or use new code for issuing an indirect segment I/O. In xbd_connect we read the size of indirect segment I/Os supported by the backend and select the maximum size we will use; then allocate the pages and Xen grant references for each I/O command structure. In xbd_free those grants and pages are released. A new loader tunable, hw.xbd.xbd_enable_indirect, can be set to 0 in order to disable this functionality; it works by pretending that the backend does not support this feature. Some backends exhibit a loss of performance with large I/Os, so users may wish to test with and without this functionality enabled. Reviewed by: royger MFC after: 3 days Relnotes: yes Modified: head/sys/dev/xen/blkfront/blkfront.c head/sys/dev/xen/blkfront/block.h head/sys/xen/interface/io/blkif.h Modified: head/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- head/sys/dev/xen/blkfront/blkfront.c Thu Jul 30 03:06:11 2015 (r286061) +++ head/sys/dev/xen/blkfront/blkfront.c Thu Jul 30 03:50:01 2015 (r286062) @@ -84,6 +84,11 @@ static void xbd_startio(struct xbd_softc /*---------------------------- Global Static Data ----------------------------*/ static MALLOC_DEFINE(M_XENBLOCKFRONT, "xbd", "Xen Block Front driver data"); +static int xbd_enable_indirect = 1; +SYSCTL_NODE(_hw, OID_AUTO, xbd, CTLFLAG_RD, 0, "xbd driver parameters"); +SYSCTL_INT(_hw_xbd, OID_AUTO, xbd_enable_indirect, CTLFLAG_RDTUN, + &xbd_enable_indirect, 0, "Enable xbd indirect segments"); + /*---------------------------- Command Processing ----------------------------*/ static void xbd_freeze(struct xbd_softc *sc, xbd_flag_t xbd_flag) @@ -205,7 +210,6 @@ xbd_queue_cb(void *arg, bus_dma_segment_ { struct xbd_softc *sc; struct xbd_command *cm; - blkif_request_t *ring_req; int op; cm = arg; @@ -218,22 +222,47 @@ xbd_queue_cb(void *arg, bus_dma_segment_ return; } - KASSERT(nsegs <= BLKIF_MAX_SEGMENTS_PER_REQUEST, + KASSERT(nsegs <= sc->xbd_max_request_segments, ("Too many segments in a blkfront I/O")); - /* Fill out a communications ring structure. */ - ring_req = RING_GET_REQUEST(&sc->xbd_ring, sc->xbd_ring.req_prod_pvt); - sc->xbd_ring.req_prod_pvt++; - ring_req->id = cm->cm_id; - ring_req->operation = cm->cm_operation; - ring_req->sector_number = cm->cm_sector_number; - ring_req->handle = (blkif_vdev_t)(uintptr_t)sc->xbd_disk; - ring_req->nr_segments = nsegs; - cm->cm_nseg = nsegs; - xbd_mksegarray(segs, nsegs, &cm->cm_gref_head, - xenbus_get_otherend_id(sc->xbd_dev), - cm->cm_operation == BLKIF_OP_WRITE, - cm->cm_sg_refs, ring_req->seg); + if (nsegs <= BLKIF_MAX_SEGMENTS_PER_REQUEST) { + blkif_request_t *ring_req; + + /* Fill out a blkif_request_t structure. */ + ring_req = (blkif_request_t *) + RING_GET_REQUEST(&sc->xbd_ring, sc->xbd_ring.req_prod_pvt); + sc->xbd_ring.req_prod_pvt++; + ring_req->id = cm->cm_id; + ring_req->operation = cm->cm_operation; + ring_req->sector_number = cm->cm_sector_number; + ring_req->handle = (blkif_vdev_t)(uintptr_t)sc->xbd_disk; + ring_req->nr_segments = nsegs; + cm->cm_nseg = nsegs; + xbd_mksegarray(segs, nsegs, &cm->cm_gref_head, + xenbus_get_otherend_id(sc->xbd_dev), + cm->cm_operation == BLKIF_OP_WRITE, + cm->cm_sg_refs, ring_req->seg); + } else { + blkif_request_indirect_t *ring_req; + + /* Fill out a blkif_request_indirect_t structure. */ + ring_req = (blkif_request_indirect_t *) + RING_GET_REQUEST(&sc->xbd_ring, sc->xbd_ring.req_prod_pvt); + sc->xbd_ring.req_prod_pvt++; + ring_req->id = cm->cm_id; + ring_req->operation = BLKIF_OP_INDIRECT; + ring_req->indirect_op = cm->cm_operation; + ring_req->sector_number = cm->cm_sector_number; + ring_req->handle = (blkif_vdev_t)(uintptr_t)sc->xbd_disk; + ring_req->nr_segments = nsegs; + cm->cm_nseg = nsegs; + xbd_mksegarray(segs, nsegs, &cm->cm_gref_head, + xenbus_get_otherend_id(sc->xbd_dev), + cm->cm_operation == BLKIF_OP_WRITE, + cm->cm_sg_refs, cm->cm_indirectionpages); + memcpy(ring_req->indirect_grefs, &cm->cm_indirectionrefs, + sizeof(grant_ref_t) * sc->xbd_max_request_indirectpages); + } if (cm->cm_operation == BLKIF_OP_READ) op = BUS_DMASYNC_PREREAD; @@ -1015,6 +1044,16 @@ xbd_free(struct xbd_softc *sc) cm->cm_sg_refs = NULL; } + if (cm->cm_indirectionpages != NULL) { + gnttab_end_foreign_access_references( + sc->xbd_max_request_indirectpages, + &cm->cm_indirectionrefs[0]); + contigfree(cm->cm_indirectionpages, PAGE_SIZE * + sc->xbd_max_request_indirectpages, + M_XENBLOCKFRONT); + cm->cm_indirectionpages = NULL; + } + bus_dmamap_destroy(sc->xbd_io_dmat, cm->cm_map); } free(sc->xbd_shadow, M_XENBLOCKFRONT); @@ -1051,9 +1090,6 @@ xbd_initialize(struct xbd_softc *sc) */ max_ring_page_order = 0; sc->xbd_ring_pages = 1; - sc->xbd_max_request_segments = BLKIF_MAX_SEGMENTS_PER_REQUEST; - sc->xbd_max_request_size = - XBD_SEGS_TO_SIZE(sc->xbd_max_request_segments); /* * Protocol negotiation. @@ -1167,7 +1203,7 @@ xbd_connect(struct xbd_softc *sc) unsigned long sectors, sector_size; unsigned int binfo; int err, feature_barrier, feature_flush; - int i; + int i, j; if (sc->xbd_state == XBD_STATE_CONNECTED || sc->xbd_state == XBD_STATE_SUSPENDED) @@ -1198,6 +1234,22 @@ xbd_connect(struct xbd_softc *sc) if (err == 0 && feature_flush != 0) sc->xbd_flags |= XBDF_FLUSH; + err = xs_gather(XST_NIL, xenbus_get_otherend_path(dev), + "feature-max-indirect-segments", "%" PRIu32, + &sc->xbd_max_request_segments, NULL); + if ((err != 0) || (xbd_enable_indirect == 0)) + sc->xbd_max_request_segments = 0; + if (sc->xbd_max_request_segments > XBD_MAX_INDIRECT_SEGMENTS) + sc->xbd_max_request_segments = XBD_MAX_INDIRECT_SEGMENTS; + if (sc->xbd_max_request_segments > XBD_SIZE_TO_SEGS(MAXPHYS)) + sc->xbd_max_request_segments = XBD_SIZE_TO_SEGS(MAXPHYS); + sc->xbd_max_request_indirectpages = + XBD_INDIRECT_SEGS_TO_PAGES(sc->xbd_max_request_segments); + if (sc->xbd_max_request_segments < BLKIF_MAX_SEGMENTS_PER_REQUEST) + sc->xbd_max_request_segments = BLKIF_MAX_SEGMENTS_PER_REQUEST; + sc->xbd_max_request_size = + XBD_SEGS_TO_SIZE(sc->xbd_max_request_segments); + /* Allocate datastructures based on negotiated values. */ err = bus_dma_tag_create( bus_get_dma_tag(sc->xbd_dev), /* parent */ @@ -1230,6 +1282,7 @@ xbd_connect(struct xbd_softc *sc) for (i = 0; i < sc->xbd_max_requests; i++) { struct xbd_command *cm; + void * indirectpages; cm = &sc->xbd_shadow[i]; cm->cm_sg_refs = malloc( @@ -1242,6 +1295,24 @@ xbd_connect(struct xbd_softc *sc) cm->cm_sc = sc; if (bus_dmamap_create(sc->xbd_io_dmat, 0, &cm->cm_map) != 0) break; + if (sc->xbd_max_request_indirectpages > 0) { + indirectpages = contigmalloc( + PAGE_SIZE * sc->xbd_max_request_indirectpages, + M_XENBLOCKFRONT, M_ZERO, 0, ~0, PAGE_SIZE, 0); + } else { + indirectpages = NULL; + } + for (j = 0; j < sc->xbd_max_request_indirectpages; j++) { + if (gnttab_grant_foreign_access( + xenbus_get_otherend_id(sc->xbd_dev), + (vtomach(indirectpages) >> PAGE_SHIFT) + j, + 1 /* grant read-only access */, + &cm->cm_indirectionrefs[j])) + break; + } + if (j < sc->xbd_max_request_indirectpages) + break; + cm->cm_indirectionpages = indirectpages; xbd_free_command(cm); } Modified: head/sys/dev/xen/blkfront/block.h ============================================================================== --- head/sys/dev/xen/blkfront/block.h Thu Jul 30 03:06:11 2015 (r286061) +++ head/sys/dev/xen/blkfront/block.h Thu Jul 30 03:50:01 2015 (r286062) @@ -75,11 +75,25 @@ __CONST_RING_SIZE(blkif, PAGE_SIZE * XBD_MAX_RING_PAGES) /** - * The maximum mapped region size per request we will allow in a negotiated - * block-front/back communication channel. + * The maximum number of blkif segments which can be provided per indirect + * page in an indirect request. */ -#define XBD_MAX_REQUEST_SIZE \ - MIN(MAXPHYS, XBD_SEGS_TO_SIZE(BLKIF_MAX_SEGMENTS_PER_REQUEST)) +#define XBD_MAX_SEGMENTS_PER_PAGE \ + (PAGE_SIZE / sizeof(struct blkif_request_segment)) + +/** + * The maximum number of blkif segments which can be provided in an indirect + * request. + */ +#define XBD_MAX_INDIRECT_SEGMENTS \ + (BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST * XBD_MAX_SEGMENTS_PER_PAGE) + +/** + * Compute the number of indirect segment pages required for an I/O with the + * specified number of indirect segments. + */ +#define XBD_INDIRECT_SEGS_TO_PAGES(segs) \ + ((segs + XBD_MAX_SEGMENTS_PER_PAGE - 1) / XBD_MAX_SEGMENTS_PER_PAGE) typedef enum { XBDCF_Q_MASK = 0xFF, @@ -111,6 +125,8 @@ struct xbd_command { blkif_sector_t cm_sector_number; int cm_status; xbd_cbcf_t *cm_complete; + void *cm_indirectionpages; + grant_ref_t cm_indirectionrefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST]; }; typedef enum { @@ -165,6 +181,7 @@ struct xbd_softc { uint32_t xbd_max_requests; uint32_t xbd_max_request_segments; uint32_t xbd_max_request_size; + uint32_t xbd_max_request_indirectpages; grant_ref_t xbd_ring_ref[XBD_MAX_RING_PAGES]; blkif_front_ring_t xbd_ring; xen_intr_handle_t xen_intr_handle; Modified: head/sys/xen/interface/io/blkif.h ============================================================================== --- head/sys/xen/interface/io/blkif.h Thu Jul 30 03:06:11 2015 (r286061) +++ head/sys/xen/interface/io/blkif.h Thu Jul 30 03:50:01 2015 (r286062) @@ -97,6 +97,28 @@ * * The type of the backing device/object. * + * + * direct-io-safe + * Values: 0/1 (boolean) + * Default Value: 0 + * + * The underlying storage is not affected by the direct IO memory + * lifetime bug. See: + * http://lists.xen.org/archives/html/xen-devel/2012-12/msg01154.html + * + * Therefore this option gives the backend permission to use + * O_DIRECT, notwithstanding that bug. + * + * That is, if this option is enabled, use of O_DIRECT is safe, + * in circumstances where we would normally have avoided it as a + * workaround for that bug. This option is not relevant for all + * backends, and even not necessarily supported for those for + * which it is relevant. A backend which knows that it is not + * affected by the bug can ignore this option. + * + * This option doesn't require a backend to use O_DIRECT, so it + * should not be used to try to control the caching behaviour. + * *--------------------------------- Features --------------------------------- * * feature-barrier @@ -126,6 +148,34 @@ * of this type may still be returned at any time with the * BLKIF_RSP_EOPNOTSUPP result code. * + * feature-persistent + * Values: 0/1 (boolean) + * Default Value: 0 + * Notes: 7 + * + * A value of "1" indicates that the backend can keep the grants used + * by the frontend driver mapped, so the same set of grants should be + * used in all transactions. The maximum number of grants the backend + * can map persistently depends on the implementation, but ideally it + * should be RING_SIZE * BLKIF_MAX_SEGMENTS_PER_REQUEST. Using this + * feature the backend doesn't need to unmap each grant, preventing + * costly TLB flushes. The backend driver should only map grants + * persistently if the frontend supports it. If a backend driver chooses + * to use the persistent protocol when the frontend doesn't support it, + * it will probably hit the maximum number of persistently mapped grants + * (due to the fact that the frontend won't be reusing the same grants), + * and fall back to non-persistent mode. Backend implementations may + * shrink or expand the number of persistently mapped grants without + * notifying the frontend depending on memory constraints (this might + * cause a performance degradation). + * + * If a backend driver wants to limit the maximum number of persistently + * mapped grants to a value less than RING_SIZE * + * BLKIF_MAX_SEGMENTS_PER_REQUEST a LRU strategy should be used to + * discard the grants that are less commonly used. Using a LRU in the + * backend driver paired with a LIFO queue in the frontend will + * allow us to have better performance in this scenario. + * *----------------------- Request Transport Parameters ------------------------ * * max-ring-page-order @@ -147,6 +197,16 @@ * *------------------------- Backend Device Properties ------------------------- * + * discard-enable + * Values: 0/1 (boolean) + * Default Value: 1 + * + * This optional property, set by the toolstack, instructs the backend + * to offer discard to the frontend. If the property is missing the + * backend should offer discard if the backing storage actually supports + * it. This optional property, set by the toolstack, requests that the + * backend offer, or not offer, discard to the frontend. + * * discard-alignment * Values: * Default Value: 0 @@ -166,6 +226,7 @@ * discard-secure * Values: 0/1 (boolean) * Default Value: 0 + * Notes: 10 * * A value of "1" indicates that the backend can process BLKIF_OP_DISCARD * requests with the BLKIF_DISCARD_SECURE flag set. @@ -180,13 +241,17 @@ * sector-size * Values: * - * The size, in bytes, of the individually addressible data blocks - * on the backend device. + * The logical sector size, in bytes, of the backend device. + * + * physical-sector-size + * Values: + * + * The physical sector size, in bytes, of the backend device. * * sectors * Values: * - * The size of the backend device, expressed in units of its native + * The size of the backend device, expressed in units of its logical * sector size ("sector-size"). * ***************************************************************************** @@ -243,6 +308,27 @@ * The size of the frontend allocated request ring buffer in units of * machine pages. The value must be a power of 2. * + * feature-persistent + * Values: 0/1 (boolean) + * Default Value: 0 + * Notes: 7, 8, 9 + * + * A value of "1" indicates that the frontend will reuse the same grants + * for all transactions, allowing the backend to map them with write + * access (even when it should be read-only). If the frontend hits the + * maximum number of allowed persistently mapped grants, it can fallback + * to non persistent mode. This will cause a performance degradation, + * since the the backend driver will still try to map those grants + * persistently. Since the persistent grants protocol is compatible with + * the previous protocol, a frontend driver can choose to work in + * persistent mode even when the backend doesn't support it. + * + * It is recommended that the frontend driver stores the persistently + * mapped grants in a LIFO queue, so a subset of all persistently mapped + * grants gets used commonly. This is done in case the backend driver + * decides to limit the maximum number of persistently mapped grants + * to a value less than RING_SIZE * BLKIF_MAX_SEGMENTS_PER_REQUEST. + * *------------------------- Virtual Device Properties ------------------------- * * device-type @@ -262,17 +348,23 @@ * ----- * (1) Multi-page ring buffer scheme first developed in the Citrix XenServer * PV drivers. - * (2) Multi-page ring buffer scheme first used in some Red Hat distributions + * (2) Multi-page ring buffer scheme first used in some RedHat distributions * including a distribution deployed on certain nodes of the Amazon * EC2 cluster. * (3) Support for multi-page ring buffers was implemented independently, - * in slightly different forms, by both Citrix and Red Hat/Amazon. + * in slightly different forms, by both Citrix and RedHat/Amazon. * For full interoperability, block front and backends should publish * identical ring parameters, adjusted for unit differences, to the * XenStore nodes used in both schemes. - * (4) Devices that support discard functionality may internally allocate - * space (discardable extents) in units that are larger than the - * exported logical block size. + * (4) Devices that support discard functionality may internally allocate space + * (discardable extents) in units that are larger than the exported logical + * block size. If the backing device has such discardable extents the + * backend should provide both discard-granularity and discard-alignment. + * Providing just one of the two may be considered an error by the frontend. + * Backends supporting discard should include discard-granularity and + * discard-alignment even if it supports discarding individual sectors. + * Frontends should assume discard-alignment == 0 and discard-granularity + * == sector size if these keys are missing. * (5) The discard-alignment parameter allows a physical device to be * partitioned into virtual devices that do not necessarily begin or * end on a discardable extent boundary. @@ -280,6 +372,19 @@ * 'ring-ref' is used to communicate the grant reference for this * page to the backend. When using a multi-page ring, the 'ring-ref' * node is not created. Instead 'ring-ref0' - 'ring-refN' are used. + * (7) When using persistent grants data has to be copied from/to the page + * where the grant is currently mapped. The overhead of doing this copy + * however doesn't suppress the speed improvement of not having to unmap + * the grants. + * (8) The frontend driver has to allow the backend driver to map all grants + * with write access, even when they should be mapped read-only, since + * further requests may reuse these grants and require write permissions. + * (9) Linux implementation doesn't have a limit on the maximum number of + * grants that can be persistently mapped in the frontend driver, but + * due to the frontent driver implementation it should never be bigger + * than RING_SIZE * BLKIF_MAX_SEGMENTS_PER_REQUEST. + *(10) The discard-secure property may be present and will be set to 1 if the + * backing device supports secure discard. */ /* @@ -404,6 +509,30 @@ #define BLKIF_OP_DISCARD 5 /* + * Recognized if "feature-max-indirect-segments" in present in the backend + * xenbus info. The "feature-max-indirect-segments" node contains the maximum + * number of segments allowed by the backend per request. If the node is + * present, the frontend might use blkif_request_indirect structs in order to + * issue requests with more than BLKIF_MAX_SEGMENTS_PER_REQUEST (11). The + * maximum number of indirect segments is fixed by the backend, but the + * frontend can issue requests with any number of indirect segments as long as + * it's less than the number provided by the backend. The indirect_grefs field + * in blkif_request_indirect should be filled by the frontend with the + * grant references of the pages that are holding the indirect segments. + * These pages are filled with an array of blkif_request_segment that hold the + * information about the segments. The number of indirect pages to use is + * determined by the number of segments an indirect request contains. Every + * indirect page can contain a maximum of + * (PAGE_SIZE / sizeof(struct blkif_request_segment)) segments, so to + * calculate the number of indirect pages to use we have to do + * ceil(indirect_segments / (PAGE_SIZE / sizeof(struct blkif_request_segment))). + * + * If a backend does not recognize BLKIF_OP_INDIRECT, it should *not* + * create the "feature-max-indirect-segments" node! + */ +#define BLKIF_OP_INDIRECT 6 + +/* * Maximum scatter/gather segments per request. * This is carefully chosen so that sizeof(blkif_ring_t) <= PAGE_SIZE. * NB. This could be 12 if the ring indexes weren't stored in the same page. @@ -411,11 +540,17 @@ #define BLKIF_MAX_SEGMENTS_PER_REQUEST 11 /* + * Maximum number of indirect pages to use per request. + */ +#define BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST 8 + +/* * NB. first_sect and last_sect in blkif_request_segment, as well as * sector_number in blkif_request, are always expressed in 512-byte units. * However they must be properly aligned to the real sector size of the - * physical disk, which is reported in the "sector-size" node in the backend - * xenbus info. Also the xenbus "sectors" node is expressed in 512-byte units. + * physical disk, which is reported in the "physical-sector-size" node in + * the backend xenbus info. Also the xenbus "sectors" node is expressed in + * 512-byte units. */ struct blkif_request_segment { grant_ref_t gref; /* reference to I/O buffer frame */ @@ -453,6 +588,20 @@ struct blkif_request_discard { }; typedef struct blkif_request_discard blkif_request_discard_t; +struct blkif_request_indirect { + uint8_t operation; /* BLKIF_OP_INDIRECT */ + uint8_t indirect_op; /* BLKIF_OP_{READ/WRITE} */ + uint16_t nr_segments; /* number of segments */ + uint64_t id; /* private guest value, echoed in resp */ + blkif_sector_t sector_number;/* start sector idx on disk (r/w only) */ + blkif_vdev_t handle; /* same as for read/write requests */ + grant_ref_t indirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST]; +#ifdef __i386__ + uint64_t pad; /* Make it 64 byte aligned on i386 */ +#endif +}; +typedef struct blkif_request_indirect blkif_request_indirect_t; + struct blkif_response { uint64_t id; /* copied from request */ uint8_t operation; /* copied from request */ @@ -484,7 +633,7 @@ DEFINE_RING_TYPES(blkif, struct blkif_re /* * Local variables: * mode: C - * c-set-style: "BSD" + * c-file-style: "BSD" * c-basic-offset: 4 * tab-width: 4 * indent-tabs-mode: nil From owner-svn-src-all@freebsd.org Thu Jul 30 04:01:01 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3B159AE967; Thu, 30 Jul 2015 04:01:01 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 89968BBA; Thu, 30 Jul 2015 04:01:01 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6U411R7011494; Thu, 30 Jul 2015 04:01:01 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6U411w0011493; Thu, 30 Jul 2015 04:01:01 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201507300401.t6U411w0011493@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Thu, 30 Jul 2015 04:01:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286063 - head/release/tools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 04:01:01 -0000 Author: cperciva Date: Thu Jul 30 04:01:00 2015 New Revision: 286063 URL: https://svnweb.freebsd.org/changeset/base/286063 Log: Disable blkif indirect segment I/Os in EC2 by default due to performance issues on some EC2 instance types. Users may want to experiment with removing this from loader.conf and measuring the performance impact on the EC2 instances they are using. Modified: head/release/tools/ec2.conf Modified: head/release/tools/ec2.conf ============================================================================== --- head/release/tools/ec2.conf Thu Jul 30 03:50:01 2015 (r286062) +++ head/release/tools/ec2.conf Thu Jul 30 04:01:00 2015 (r286063) @@ -70,6 +70,11 @@ vm_extra_pre_umount() { # nodes, but apply the workaround just in case. echo 'hw.broken_txfifo="1"' >> ${DESTDIR}/boot/loader.conf + # Some EC2 instances suffer a significant (~40%) reduction in + # throughput when using blkif indirect segment I/Os. Disable this + # by default for now. + echo 'hw.xbd.xbd_enable_indirect="0"' >> ${DESTDIR}/boot/loader.conf + # The first time the AMI boots, the installed "first boot" scripts # should be allowed to run: # * ec2_configinit (download and process EC2 user-data) From owner-svn-src-all@freebsd.org Thu Jul 30 04:53:55 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D9289AD17E; Thu, 30 Jul 2015 04:53:55 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F117B1F30; Thu, 30 Jul 2015 04:53:54 +0000 (UTC) (envelope-from jamie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6U4rseh033497; Thu, 30 Jul 2015 04:53:54 GMT (envelope-from jamie@FreeBSD.org) Received: (from jamie@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6U4rsLf033495; Thu, 30 Jul 2015 04:53:54 GMT (envelope-from jamie@FreeBSD.org) Message-Id: <201507300453.t6U4rsLf033495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jamie set sender to jamie@FreeBSD.org using -f From: Jamie Gritton Date: Thu, 30 Jul 2015 04:53:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286064 - stable/10/usr.sbin/jexec X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 04:53:55 -0000 Author: jamie Date: Thu Jul 30 04:53:53 2015 New Revision: 286064 URL: https://svnweb.freebsd.org/changeset/base/286064 Log: MFC r285420: Run a shell in the jail when no command is specified. Add a new flag, -l, for a clean environment, same as jail(8) exec.clean. Change the GET_USER_INFO macro into a function. PR: 201300 Submitted by: Willem Jan Withagen Modified: stable/10/usr.sbin/jexec/jexec.8 stable/10/usr.sbin/jexec/jexec.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/jexec/jexec.8 ============================================================================== --- stable/10/usr.sbin/jexec/jexec.8 Thu Jul 30 04:01:00 2015 (r286063) +++ stable/10/usr.sbin/jexec/jexec.8 Thu Jul 30 04:53:53 2015 (r286064) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 27, 2009 +.Dd Jul 11, 2015 .Dt JEXEC 8 .Os .Sh NAME @@ -33,8 +33,9 @@ .Nd "execute a command inside an existing jail" .Sh SYNOPSIS .Nm +.Op Fl l .Op Fl u Ar username | Fl U Ar username -.Ar jail command ... +.Ar jail Op Ar command ... .Sh DESCRIPTION The .Nm @@ -43,9 +44,17 @@ utility executes inside the .Ar jail identified by its jid or name. +If +.Ar command +is not specified then the user's shell is used. .Pp The following options are available: .Bl -tag -width indent +.It Fl l +Execute in a clean environment. +The environment is discarded except for +.Ev HOME , SHELL , TERM , USER , +and anything from the login class capability database for the user. .It Fl u Ar username The user name from host environment as whom the .Ar command Modified: stable/10/usr.sbin/jexec/jexec.c ============================================================================== --- stable/10/usr.sbin/jexec/jexec.c Thu Jul 30 04:01:00 2015 (r286063) +++ stable/10/usr.sbin/jexec/jexec.c Thu Jul 30 04:53:53 2015 (r286064) @@ -40,49 +40,37 @@ #include #include #include +#include +#include #include #include #include -#include #include -static void usage(void); +extern char **environ; -#define GET_USER_INFO do { \ - pwd = getpwnam(username); \ - if (pwd == NULL) { \ - if (errno) \ - err(1, "getpwnam: %s", username); \ - else \ - errx(1, "%s: no such user", username); \ - } \ - lcap = login_getpwclass(pwd); \ - if (lcap == NULL) \ - err(1, "getpwclass: %s", username); \ - ngroups = ngroups_max; \ - if (getgrouplist(username, pwd->pw_gid, groups, &ngroups) != 0) \ - err(1, "getgrouplist: %s", username); \ -} while (0) +static void get_user_info(const char *username, const struct passwd **pwdp, + login_cap_t **lcapp); +static void usage(void); int main(int argc, char *argv[]) { int jid; login_cap_t *lcap = NULL; - struct passwd *pwd = NULL; - gid_t *groups = NULL; - int ch, ngroups, uflag, Uflag; - long ngroups_max; - char *username; + int ch, clean, uflag, Uflag; + char *cleanenv; + const struct passwd *pwd = NULL; + const char *username, *shell, *term; - ch = uflag = Uflag = 0; + ch = clean = uflag = Uflag = 0; username = NULL; - ngroups_max = sysconf(_SC_NGROUPS_MAX) + 1; - if ((groups = malloc(sizeof(gid_t) * ngroups_max)) == NULL) - err(1, "malloc"); - while ((ch = getopt(argc, argv, "nu:U:")) != -1) { + while ((ch = getopt(argc, argv, "lnu:U:")) != -1) { switch (ch) { + case 'l': + clean = 1; + break; case 'n': /* Specified name, now unused */ break; @@ -100,12 +88,15 @@ main(int argc, char *argv[]) } argc -= optind; argv += optind; - if (argc < 2) + if (argc < 1) usage(); if (uflag && Uflag) usage(); - if (uflag) - GET_USER_INFO; + if (uflag || (clean && !Uflag)) + /* User info from the home environment */ + get_user_info(username, &pwd, &lcap); + + /* Attach to the jail */ jid = jail_getid(argv[0]); if (jid < 0) errx(1, "%s", jail_errmsg); @@ -113,28 +104,88 @@ main(int argc, char *argv[]) err(1, "jail_attach(%d)", jid); if (chdir("/") == -1) err(1, "chdir(): /"); - if (username != NULL) { + + /* Set up user environment */ + if (clean || username != NULL) { if (Uflag) - GET_USER_INFO; - if (setgroups(ngroups, groups) != 0) - err(1, "setgroups"); + /* User info from the jail environment */ + get_user_info(username, &pwd, &lcap); + if (clean) { + term = getenv("TERM"); + cleanenv = NULL; + environ = &cleanenv; + setenv("PATH", "/bin:/usr/bin", 1); + if (term != NULL) + setenv("TERM", term, 1); + } if (setgid(pwd->pw_gid) != 0) err(1, "setgid"); - if (setusercontext(lcap, pwd, pwd->pw_uid, - LOGIN_SETALL & ~LOGIN_SETGROUP & ~LOGIN_SETLOGIN) != 0) + if (setusercontext(lcap, pwd, pwd->pw_uid, username + ? LOGIN_SETALL & ~LOGIN_SETGROUP & ~LOGIN_SETLOGIN + : LOGIN_SETPATH | LOGIN_SETENV) != 0) err(1, "setusercontext"); login_close(lcap); + setenv("USER", pwd->pw_name, 1); + setenv("HOME", pwd->pw_dir, 1); + setenv("SHELL", + *pwd->pw_shell ? pwd->pw_shell : _PATH_BSHELL, 1); + if (clean && chdir(pwd->pw_dir) < 0) + err(1, "chdir: %s", pwd->pw_dir); + endpwent(); + } + + /* Run the specified command, or the shell */ + if (argc > 1) { + if (execvp(argv[1], argv + 1) < 0) + err(1, "execvp: %s", argv[1]); + } else { + if (!(shell = getenv("SHELL"))) + shell = _PATH_BSHELL; + if (execlp(shell, shell, "-i", NULL) < 0) + err(1, "execlp: %s", shell); } - if (execvp(argv[1], argv + 1) == -1) - err(1, "execvp(): %s", argv[1]); exit(0); } static void +get_user_info(const char *username, const struct passwd **pwdp, + login_cap_t **lcapp) +{ + uid_t uid; + const struct passwd *pwd; + + errno = 0; + if (username) { + pwd = getpwnam(username); + if (pwd == NULL) { + if (errno) + err(1, "getpwnam: %s", username); + else + errx(1, "%s: no such user", username); + } + } else { + uid = getuid(); + pwd = getpwuid(uid); + if (pwd == NULL) { + if (errno) + err(1, "getpwuid: %d", uid); + else + errx(1, "unknown uid: %d", uid); + } + } + *pwdp = pwd; + *lcapp = login_getpwclass(pwd); + if (*lcapp == NULL) + err(1, "getpwclass: %s", pwd->pw_name); + if (initgroups(pwd->pw_name, pwd->pw_gid) < 0) + err(1, "initgroups: %s", pwd->pw_name); +} + +static void usage(void) { fprintf(stderr, "%s\n", - "usage: jexec [-u username | -U username] jail command ..."); + "usage: jexec [-l] [-u username | -U username] jail [command ...]"); exit(1); } From owner-svn-src-all@freebsd.org Thu Jul 30 05:04:45 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF5109AD33C; Thu, 30 Jul 2015 05:04:45 +0000 (UTC) (envelope-from root@sierra.onthenet.com.au) Received: from sierra.onthenet.com.au (sierra.onthenet.com.au [121.50.214.253]) by mx1.freebsd.org (Postfix) with ESMTP id 54B6F6AF; Thu, 30 Jul 2015 05:04:45 +0000 (UTC) (envelope-from root@sierra.onthenet.com.au) Received: by sierra.onthenet.com.au (Postfix, from userid 0) id 49DCE3EC6D3; Thu, 30 Jul 2015 14:57:43 +1000 (AEST) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mx2.freebsd.org (mx2.freebsd.org [8.8.178.116]) by sierra.onthenet.com.au (Postfix) with ESMTP id B5C722FD649 for ; Wed, 29 Jul 2015 22:59:33 +1000 (AEST) Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.freebsd.org (Postfix) with ESMTPS id F2F2C3D09 for ; Wed, 29 Jul 2015 12:59:27 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 6EBCF1D6B for ; Wed, 29 Jul 2015 12:59:26 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix) id DD5401BA2; Wed, 29 Jul 2015 12:59:24 +0000 (UTC) Delivered-To: grehan@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by freefall.freebsd.org (Postfix) with ESMTP id 099011B22; Wed, 29 Jul 2015 12:59:23 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 376611C9E; Wed, 29 Jul 2015 12:59:23 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 538) id 19C151AF0; Wed, 29 Jul 2015 12:59:23 +0000 (UTC) Delivered-To: src-committers@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by freefall.freebsd.org (Postfix) with ESMTP id 2DCC41AAC for ; Wed, 29 Jul 2015 12:59:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 102721C2C; Wed, 29 Jul 2015 12:59:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TCxH7h035148; Wed, 29 Jul 2015 12:59:17 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TCxHX4035145; Wed, 29 Jul 2015 12:59:17 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507291259.t6TCxHX4035145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 29 Jul 2015 12:59:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286007 - in stable/10/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk X-Loop: FreeBSD.org Sender: owner-src-committers@freebsd.org X-MailScanner-Information: Please contact the ISP for more information X-MailScanner: Not scanned: please contact your Internet E-Mail Service Provider for details X-Spam-Flag: not spam (whitelisted), SpamAssassin (not cached, score=-5.119, required 5, BAYES_00 -1.90, HEADER_FROM_DIFFERENT_DOMAINS 0.00, KAM_ASCII_DIVIDERS 0.80, KAM_LAZY_DOMAIN_SECURITY 1.00, RCVD_IN_DNSWL_HI -5.00, RCVD_IN_MSPIKE_H4 -0.01, RCVD_IN_MSPIKE_WL -0.01) X-MailScanner-From: root@sierra.onthenet.com.au X-Spam-Status: No X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 05:04:45 -0000 Author: dim Date: Wed Jul 29 12:59:16 2015 New Revision: 286007 URL: https://svnweb.freebsd.org/changeset/base/286007 Log: Pull in r219009 from upstream llvm trunk (by Adam Nemet): [ISel] Keep matching state consistent when folding during X86 address match In the X86 backend, matching an address is initiated by the 'addr' complex pattern and its friends. During this process we may reassociate and-of-shift into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the shift into the scale of the address. However as demonstrated by the testcase, this can trigger CSE of not only the shift and the AND which the code is prepared for but also the underlying load node. In the testcase this node is sitting in the RecordedNode and MatchScope data structures of the matcher and becomes a deleted node upon CSE. Returning from the complex pattern function, we try to access it again hitting an assert because the node is no longer a load even though this was checked before. Now obviously changing the DAG this late is bending the rules but I think it makes sense somewhat. Outside of addresses we prefer and-of-shift because it may lead to smaller immediates (FoldMaskAndShiftToScale is an even better example because it create a non-canonical node). We currently don't recognize addresses during DAGCombiner where arguably this canonicalization should be performed. On the other hand, having this in the matcher allows us to cover all the cases where an address can be used in an instruction. I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW for the new shift node in FoldMaskedShiftToScaledMask. This RAUW is responsible for initiating the recursive CSE on users (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but it is not strictly necessary since the shift is hooked into the visited user. Of course it's safer to keep the DAG consistent at all times (e.g. for accurate number of uses, etc.). So rather than changing the fundamentals, I've decided to continue along the previous patches and detect the CSE. This patch installs a very targeted DAGUpdateListener for the duration of a complex-pattern match and updates the matching state accordingly. (Previous patches used HandleSDNode to detect the CSE but that's not practical here). The listener is only installed on X86. I tested that there is no measurable overhead due to this while running through the spec2k BC files with llc. The only thing we pay for is the creation of the listener. The callback never ever triggers in spec2k since this is a corner case. Fixes rdar://problem/18206171 This fixes a possible crash in x86 code generation when compiling recent llvm/clang trunk sources. Direct commit to stable/10, since head already has llvm/clang 3.6.1, which includes this fix. Reported by: jonathan, theraven Upstream PR: https://llvm.org/bugs/show_bug.cgi?id=24249 Modified: stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Modified: stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h ============================================================================== --- stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 12:42:45 2015 (r286006) +++ stable/10/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 12:59:16 2015 (r286007) @@ -238,6 +238,12 @@ public: const unsigned char *MatcherTable, unsigned TableSize); + /// \brief Return true if complex patterns for this target can mutate the + /// DAG. + virtual bool ComplexPatternFuncMutatesDAG() const { + return false; + } + private: // Calls to these functions are generated by tblgen. Modified: stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ============================================================================== --- stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 12:42:45 2015 (r286006) +++ stable/10/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 12:59:16 2015 (r286007) @@ -2345,6 +2345,42 @@ struct MatchScope { bool HasChainNodesMatched, HasGlueResultNodesMatched; }; +/// \\brief A DAG update listener to keep the matching state +/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to +/// change the DAG while matching. X86 addressing mode matcher is an example +/// for this. +class MatchStateUpdater : public SelectionDAG::DAGUpdateListener +{ + SmallVectorImpl > &RecordedNodes; + SmallVectorImpl &MatchScopes; +public: + MatchStateUpdater(SelectionDAG &DAG, + SmallVectorImpl > &RN, + SmallVectorImpl &MS) : + SelectionDAG::DAGUpdateListener(DAG), + RecordedNodes(RN), MatchScopes(MS) { } + + void NodeDeleted(SDNode *N, SDNode *E) { + // Some early-returns here to avoid the search if we deleted the node or + // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we + // do, so it's unnecessary to update matching state at that point). + // Neither of these can occur currently because we only install this + // update listener during matching a complex patterns. + if (!E || E->isMachineOpcode()) + return; + // Performing linear search here does not matter because we almost never + // run this code. You'd have to have a CSE during complex pattern + // matching. + for (auto &I : RecordedNodes) + if (I.first.getNode() == N) + I.first.setNode(E); + + for (auto &I : MatchScopes) + for (auto &J : I.NodeStack) + if (J.getNode() == N) + J.setNode(E); + } +}; } SDNode *SelectionDAGISel:: @@ -2599,6 +2635,14 @@ SelectCodeCommon(SDNode *NodeToMatch, co unsigned CPNum = MatcherTable[MatcherIndex++]; unsigned RecNo = MatcherTable[MatcherIndex++]; assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); + + // If target can modify DAG during matching, keep the matching state + // consistent. + std::unique_ptr MSU; + if (ComplexPatternFuncMutatesDAG()) + MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, + MatchScopes)); + if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, RecordedNodes[RecNo].first, CPNum, RecordedNodes)) Modified: stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp ============================================================================== --- stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 12:42:45 2015 (r286006) +++ stable/10/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 12:59:16 2015 (r286007) @@ -290,6 +290,13 @@ namespace { const X86InstrInfo *getInstrInfo() const { return getTargetMachine().getInstrInfo(); } + + /// \brief Address-mode matching performs shift-of-and to and-of-shift + /// reassociation in order to expose more scaled addressing + /// opportunities. + bool ComplexPatternFuncMutatesDAG() const override { + return true; + } }; } From owner-svn-src-all@freebsd.org Thu Jul 30 05:06:24 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 058EB9AD39A; Thu, 30 Jul 2015 05:06:24 +0000 (UTC) (envelope-from root@sierra.onthenet.com.au) Received: from sierra.onthenet.com.au (sierra.onthenet.com.au [121.50.214.253]) by mx1.freebsd.org (Postfix) with ESMTP id A14B075D; Thu, 30 Jul 2015 05:06:23 +0000 (UTC) (envelope-from root@sierra.onthenet.com.au) Received: by sierra.onthenet.com.au (Postfix, from userid 0) id A460A32E987; Thu, 30 Jul 2015 14:58:00 +1000 (AEST) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mx2.freebsd.org (mx2.freebsd.org [8.8.178.116]) by sierra.onthenet.com.au (Postfix) with ESMTP id DA04C21DB41 for ; Wed, 29 Jul 2015 21:22:30 +1000 (AEST) Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.freebsd.org (Postfix) with ESMTPS id 1D79B65208 for ; Wed, 29 Jul 2015 11:22:28 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id F26531E37 for ; Wed, 29 Jul 2015 11:22:25 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix) id D7AF5145B; Wed, 29 Jul 2015 11:22:25 +0000 (UTC) Delivered-To: grehan@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by freefall.freebsd.org (Postfix) with ESMTP id 3FC321431; Wed, 29 Jul 2015 11:22:25 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 1552D1E07; Wed, 29 Jul 2015 11:22:25 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 538) id 0F513142D; Wed, 29 Jul 2015 11:22:25 +0000 (UTC) Delivered-To: src-committers@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by freefall.freebsd.org (Postfix) with ESMTP id 3D00E13FE for ; Wed, 29 Jul 2015 11:22:21 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1E6051DD2; Wed, 29 Jul 2015 11:22:21 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TBMKiv097983; Wed, 29 Jul 2015 11:22:20 GMT (envelope-from zbb@FreeBSD.org) Received: (from zbb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TBMK2X097979; Wed, 29 Jul 2015 11:22:20 GMT (envelope-from zbb@FreeBSD.org) Message-Id: <201507291122.t6TBMK2X097979@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zbb set sender to zbb@FreeBSD.org using -f From: Zbigniew Bodek Date: Wed, 29 Jul 2015 11:22:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286005 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk X-Loop: FreeBSD.org Sender: owner-src-committers@freebsd.org X-MailScanner-Information: Please contact the ISP for more information X-MailScanner: Not scanned: please contact your Internet E-Mail Service Provider for details X-Spam-Flag: not spam (whitelisted), SpamAssassin (not cached, score=-5.119, required 5, BAYES_00 -1.90, HEADER_FROM_DIFFERENT_DOMAINS 0.00, KAM_ASCII_DIVIDERS 0.80, KAM_LAZY_DOMAIN_SECURITY 1.00, RCVD_IN_DNSWL_HI -5.00, RCVD_IN_MSPIKE_H4 -0.01, RCVD_IN_MSPIKE_WL -0.01) X-MailScanner-From: root@sierra.onthenet.com.au X-Spam-Status: No X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 05:06:24 -0000 Author: zbb Date: Wed Jul 29 11:22:19 2015 New Revision: 286005 URL: https://svnweb.freebsd.org/changeset/base/286005 Log: Add quirk for ThunderX ITS device table size Limit the number of supported device IDs to 0x100000 in order to decrease the size of the ITS device table so that it matches with the HW capabilities. Obtained from: Semihalf Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3131 Modified: head/sys/arm64/arm64/gic_v3_its.c head/sys/arm64/arm64/gic_v3_var.h Modified: head/sys/arm64/arm64/gic_v3_its.c ============================================================================== --- head/sys/arm64/arm64/gic_v3_its.c Wed Jul 29 11:12:56 2015 (r286004) +++ head/sys/arm64/arm64/gic_v3_its.c Wed Jul 29 11:22:19 2015 (r286005) @@ -101,6 +101,8 @@ static void its_cmd_mapi(struct gic_v3_i static void its_cmd_inv(struct gic_v3_its_softc *, struct its_dev *, uint32_t); static void its_cmd_invall(struct gic_v3_its_softc *, struct its_col *); +static uint32_t its_get_devbits(device_t); + static void lpi_init_conftable(struct gic_v3_its_softc *); static void lpi_bitmap_init(struct gic_v3_its_softc *); static void lpi_init_cpu(struct gic_v3_its_softc *); @@ -142,13 +144,19 @@ const char *its_ptab_type[] = { */ /* Cavium ThunderX PCI devid acquire function */ +static uint32_t its_get_devbits_thunder(device_t); static uint32_t its_get_devid_thunder(device_t); static const struct its_quirks its_quirks[] = { { + /* + * Hardware: Cavium ThunderX + * Chip revision: Pass 1.0, Pass 1.1 + */ .cpuid = CPU_ID_RAW(CPU_IMPL_CAVIUM, CPU_PART_THUNDER, 0, 0), .cpuid_mask = CPU_IMPL_MASK | CPU_PART_MASK, .devid_func = its_get_devid_thunder, + .devbits_func = its_get_devbits_thunder, }, }; @@ -299,7 +307,6 @@ its_alloc_tables(struct gic_v3_its_softc { uint64_t gits_baser, gits_tmp; uint64_t type, esize, cache, share, psz; - uint64_t gits_typer; size_t page_size, npages, nitspages, nidents, tn; size_t its_tbl_size; vm_offset_t ptab_vaddr; @@ -308,9 +315,6 @@ its_alloc_tables(struct gic_v3_its_softc page_size = PAGE_SIZE_64K; - /* Read features first */ - gits_typer = gic_its_read(sc, 8, GITS_TYPER); - for (tn = 0; tn < GITS_BASER_NUM; tn++) { gits_baser = gic_its_read(sc, 8, GITS_BASER(tn)); type = GITS_BASER_TYPE(gits_baser); @@ -324,7 +328,7 @@ its_alloc_tables(struct gic_v3_its_softc case GITS_BASER_TYPE_RES7: continue; case GITS_BASER_TYPE_DEV: - nidents = (1 << GITS_TYPER_DEVB(gits_typer)); + nidents = (1 << its_get_devbits(sc->dev)); its_tbl_size = esize * nidents; its_tbl_size = roundup2(its_tbl_size, page_size); npages = howmany(its_tbl_size, PAGE_SIZE); @@ -1447,6 +1451,68 @@ its_get_devid_thunder(device_t pci_dev) return (0); } +static uint32_t +its_get_devbits_thunder(device_t dev) +{ + uint32_t devid_bits; + + /* + * GITS_TYPER[17:13] of ThunderX reports that device IDs + * are to be 21 bits in length. + * The entry size of the ITS table can be read from GITS_BASERn[52:48] + * and on ThunderX is supposed to be 8 bytes in length (for device + * table). Finally the page size that is to be used by ITS to access + * this table will be set to 64KB. + * + * This gives 0x200000 entries of size 0x8 bytes covered by 256 pages + * each of which 64KB in size. The number of pages (minus 1) should + * then be written to GITS_BASERn[7:0]. In that case this value would + * be 0xFF but on ThunderX the maximum value that HW accepts is 0xFD. + * + * Set arbitrary number of device ID bits to 20 in order to limit + * the number of entries in ITS device table to 0x100000 and hence + * the table size to 8MB. + */ + devid_bits = 20; + if (bootverbose) { + device_printf(dev, + "Limiting number of Device ID bits implemented to %d\n", + devid_bits); + } + + return (devid_bits); +} + +static __inline uint32_t +its_get_devbits_default(device_t dev) +{ + uint64_t gits_typer; + struct gic_v3_its_softc *sc; + + sc = device_get_softc(dev); + + gits_typer = gic_its_read(sc, 8, GITS_TYPER); + + return (GITS_TYPER_DEVB(gits_typer)); +} + +static uint32_t +its_get_devbits(device_t dev) +{ + const struct its_quirks *quirk; + size_t i; + + for (i = 0; i < nitems(its_quirks); i++) { + quirk = &its_quirks[i]; + if (CPU_MATCH_RAW(quirk->cpuid_mask, quirk->cpuid)) { + if (quirk->devbits_func != NULL) + return ((*quirk->devbits_func)(dev)); + } + } + + return (its_get_devbits_default(dev)); +} + static __inline uint32_t its_get_devid_default(device_t pci_dev) { Modified: head/sys/arm64/arm64/gic_v3_var.h ============================================================================== --- head/sys/arm64/arm64/gic_v3_var.h Wed Jul 29 11:12:56 2015 (r286004) +++ head/sys/arm64/arm64/gic_v3_var.h Wed Jul 29 11:22:19 2015 (r286005) @@ -235,12 +235,14 @@ struct gic_v3_its_softc { }; /* Stuff that is specific to the vendor's implementation */ +typedef uint32_t (*its_devbits_func_t)(device_t); typedef uint32_t (*its_devid_func_t)(device_t); struct its_quirks { uint64_t cpuid; uint64_t cpuid_mask; its_devid_func_t devid_func; + its_devbits_func_t devbits_func; }; extern devclass_t gic_v3_its_devclass; From owner-svn-src-all@freebsd.org Thu Jul 30 05:07:27 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EDC7E9AD3EB; Thu, 30 Jul 2015 05:07:27 +0000 (UTC) (envelope-from root@sierra.onthenet.com.au) Received: from sierra.onthenet.com.au (sierra.onthenet.com.au [121.50.214.253]) by mx1.freebsd.org (Postfix) with ESMTP id 8B28E7CE; Thu, 30 Jul 2015 05:07:27 +0000 (UTC) (envelope-from root@sierra.onthenet.com.au) Received: by sierra.onthenet.com.au (Postfix, from userid 0) id 62D41E88C6; Thu, 30 Jul 2015 14:56:59 +1000 (AEST) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mx2.freebsd.org (mx2.freebsd.org [8.8.178.116]) by sierra.onthenet.com.au (Postfix) with ESMTP id 3161736DC69 for ; Wed, 29 Jul 2015 22:53:33 +1000 (AEST) Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.freebsd.org (Postfix) with ESMTPS id 1548637F1 for ; Wed, 29 Jul 2015 12:53:31 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 0D4A2192A for ; Wed, 29 Jul 2015 12:53:28 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix) id E699E186A; Wed, 29 Jul 2015 12:53:27 +0000 (UTC) Delivered-To: grehan@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by freefall.freebsd.org (Postfix) with ESMTP id 4602E181B; Wed, 29 Jul 2015 12:53:27 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 125B218D2; Wed, 29 Jul 2015 12:53:27 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 538) id 0CA8A1819; Wed, 29 Jul 2015 12:53:27 +0000 (UTC) Delivered-To: src-committers@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by freefall.freebsd.org (Postfix) with ESMTP id 2B6711803; Wed, 29 Jul 2015 12:53:22 +0000 (UTC) (envelope-from ermal.luci@gmail.com) Received: from mail-yk0-x22c.google.com (mail-yk0-x22c.google.com [IPv6:2607:f8b0:4002:c07::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DCD6C18B1; Wed, 29 Jul 2015 12:53:21 +0000 (UTC) (envelope-from ermal.luci@gmail.com) Received: by ykba194 with SMTP id a194so6527213ykb.0; Wed, 29 Jul 2015 05:53:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=JaOsZ2VR88m8NyRBZqLy8UF+Jxjzu6TXnCLQuO9AQZ8=; b=PUskAo4B7S37DqRNGEhmeKdlh0FQjgRTkxnYZbu72XqNgcLbj5qR82ai/R7V1txpeA QWA7jiY9mubktGeIzD4yJal751VmdKyElX5PplLqcaK8FC7ejmQVXYRohdtRszpRNRSz awMiALcfOAGNmAWLLDaSwCjb1eJJpCqgFeGWAzecclhKPyIuNzpc6KvfldugobKBcXrr SgmLTKDYC9Y+Tp4os5TPQu/T3/dYiaLNSdBH9NN16AkSFvnBQfSDtLMGOZVZugi6arJ2 kcGl1/iVtH1HBe2s1xEuPptPblhBcSlhIaDXq5WGa1F373byePTrDNi2JNpy3IS8CBgv HCyg== MIME-Version: 1.0 X-Received: by 10.170.198.144 with SMTP id p138mr43361632yke.70.1438174400734; Wed, 29 Jul 2015 05:53:20 -0700 (PDT) Received: by 10.129.83.139 with HTTP; Wed, 29 Jul 2015 05:53:20 -0700 (PDT) In-Reply-To: <201507290715.t6T7FHGb094456@repo.freebsd.org> References: <201507290715.t6T7FHGb094456@repo.freebsd.org> Date: Wed, 29 Jul 2015 14:53:20 +0200 X-Google-Sender-Auth: YTg-pUgGUq5agmzlItWf-43Lhpk Message-ID: Subject: Re: svn commit: r286000 - head/sys/netipsec From: =?UTF-8?Q?Ermal_Lu=C3=A7i?= To: John-Mark Gurney , George Neville-Neil Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Precedence: bulk X-Loop: FreeBSD.org Sender: owner-src-committers@freebsd.org X-MailScanner-Information: Please contact the ISP for more information X-MailScanner: Not scanned: please contact your Internet E-Mail Service Provider for details X-Spam-Flag: not spam (whitelisted), SpamAssassin (not cached, score=-6.808, required 5, autolearn=not spam, BAYES_00 -1.90, DKIM_SIGNED 0.10, HEADER_FROM_DIFFERENT_DOMAINS 0.00, HTML_MESSAGE 0.00, RCVD_IN_DNSWL_HI -5.00, RCVD_IN_MSPIKE_H4 -0.01, RCVD_IN_MSPIKE_WL -0.01, T_DKIM_INVALID 0.01) X-MailScanner-From: root@sierra.onthenet.com.au X-Spam-Status: No Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 05:07:28 -0000 Hello John-Mark, this was forgotten part on my patches merge from gnn@. Can it be fixed by correcting the patches rather than re-introducing this? Most probably the constant definition is wrong on the transforms and also some part of code removal was missed. On Wed, Jul 29, 2015 at 9:15 AM, John-Mark Gurney wrote: > Author: jmg > Date: Wed Jul 29 07:15:16 2015 > New Revision: 286000 > URL: https://svnweb.freebsd.org/changeset/base/286000 > > Log: > RFC4868 section 2.3 requires that the output be half... This fixes > problems that was introduced in r285336... I have verified that > HMAC-SHA2-256 both ah only and w/ AES-CBC interoperate w/ a NetBSD > 6.1.5 vm... > > Reviewed by: gnn > > Modified: > head/sys/netipsec/xform.h > head/sys/netipsec/xform_ah.c > head/sys/netipsec/xform_esp.c > > Modified: head/sys/netipsec/xform.h > > ============================================================================== > --- head/sys/netipsec/xform.h Wed Jul 29 06:35:36 2015 (r285999) > +++ head/sys/netipsec/xform.h Wed Jul 29 07:15:16 2015 (r286000) > @@ -105,6 +105,7 @@ struct xformsw { > #ifdef _KERNEL > extern void xform_register(struct xformsw*); > extern int xform_init(struct secasvar *sav, int xftype); > +extern int xform_ah_authsize(struct auth_hash *esph); > > struct cryptoini; > > > Modified: head/sys/netipsec/xform_ah.c > > ============================================================================== > --- head/sys/netipsec/xform_ah.c Wed Jul 29 06:35:36 2015 > (r285999) > +++ head/sys/netipsec/xform_ah.c Wed Jul 29 07:15:16 2015 > (r286000) > @@ -85,8 +85,8 @@ > * Return authenticator size in bytes, based on a field in the > * algorithm descriptor. > */ > -#define AUTHSIZE(sav) \ > - ((sav->flags & SADB_X_EXT_OLD) ? 16 : > (sav)->tdb_authalgxform->hashsize) > +#define AUTHSIZE(sav) ((sav->flags & SADB_X_EXT_OLD) ? 16 : \ > + xform_ah_authsize((sav)->tdb_authalgxform)) > > VNET_DEFINE(int, ah_enable) = 1; /* control flow of packets with AH > */ > VNET_DEFINE(int, ah_cleartos) = 1; /* clear ip_tos when doing AH calc > */ > @@ -112,6 +112,35 @@ static unsigned char ipseczeroes[256]; / > static int ah_input_cb(struct cryptop*); > static int ah_output_cb(struct cryptop*); > > +int > +xform_ah_authsize(struct auth_hash *esph) > +{ > + int alen; > + > + if (esph == NULL) > + return 0; > + > + switch (esph->type) { > + case CRYPTO_SHA2_256_HMAC: > + case CRYPTO_SHA2_384_HMAC: > + case CRYPTO_SHA2_512_HMAC: > + alen = esph->hashsize / 2; /* RFC4868 2.3 */ > + break; > + > + case CRYPTO_AES_128_NIST_GMAC: > + case CRYPTO_AES_192_NIST_GMAC: > + case CRYPTO_AES_256_NIST_GMAC: > + alen = esph->hashsize; > + break; > + > + default: > + alen = AH_HMAC_HASHLEN; > + break; > + } > + > + return alen; > +} > + > /* > * NB: this is public for use by the PF_KEY support. > */ > > Modified: head/sys/netipsec/xform_esp.c > > ============================================================================== > --- head/sys/netipsec/xform_esp.c Wed Jul 29 06:35:36 2015 > (r285999) > +++ head/sys/netipsec/xform_esp.c Wed Jul 29 07:15:16 2015 > (r286000) > @@ -320,7 +320,6 @@ esp_input(struct mbuf *m, struct secasva > IPSEC_ASSERT(sav != NULL, ("null SA")); > IPSEC_ASSERT(sav->tdb_encalgxform != NULL, ("null encoding > xform")); > > - alen = 0; > /* Valid IP Packet length ? */ > if ( (skip&3) || (m->m_pkthdr.len&3) ){ > DPRINTF(("%s: misaligned packet, skip %u pkt len %u", > @@ -335,13 +334,13 @@ esp_input(struct mbuf *m, struct secasva > esph = sav->tdb_authalgxform; > espx = sav->tdb_encalgxform; > > - /* Determine the ESP header length */ > + /* Determine the ESP header and auth length */ > if (sav->flags & SADB_X_EXT_OLD) > hlen = sizeof (struct esp) + sav->ivlen; > else > hlen = sizeof (struct newesp) + sav->ivlen; > - /* Authenticator hash size */ > - alen = esph ? esph->hashsize : 0; > + > + alen = xform_ah_authsize(esph); > > /* > * Verify payload length is multiple of encryption algorithm > @@ -530,7 +529,7 @@ esp_input_cb(struct cryptop *crp) > > /* If authentication was performed, check now. */ > if (esph != NULL) { > - alen = esph->hashsize; > + alen = xform_ah_authsize(esph); > AHSTAT_INC(ahs_hist[sav->alg_auth]); > /* Copy the authenticator from the packet */ > m_copydata(m, m->m_pkthdr.len - alen, alen, aalg); > @@ -700,10 +699,7 @@ esp_output(struct mbuf *m, struct ipsecr > /* XXX clamp padding length a la KAME??? */ > padding = ((blks - ((rlen + 2) % blks)) % blks) + 2; > > - if (esph) > - alen = esph->hashsize; > - else > - alen = 0; > + alen = xform_ah_authsize(esph); > > ESPSTAT_INC(esps_output); > > @@ -983,21 +979,7 @@ esp_output_cb(struct cryptop *crp) > if (esph != NULL) { > int alen; > > - switch (esph->type) { > - case CRYPTO_SHA2_256_HMAC: > - case CRYPTO_SHA2_384_HMAC: > - case CRYPTO_SHA2_512_HMAC: > - alen = esph->hashsize/2; > - break; > - case CRYPTO_AES_128_NIST_GMAC: > - case CRYPTO_AES_192_NIST_GMAC: > - case CRYPTO_AES_256_NIST_GMAC: > - alen = esph->hashsize; > - break; > - default: > - alen = AH_HMAC_HASHLEN; > - break; > - } > + alen = xform_ah_authsize(esph); > m_copyback(m, m->m_pkthdr.len - alen, > alen, ipseczeroes); > } > > -- > Ermal > From owner-svn-src-all@freebsd.org Thu Jul 30 05:08:32 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 318229AD433; Thu, 30 Jul 2015 05:08:32 +0000 (UTC) (envelope-from root@sierra.onthenet.com.au) Received: from sierra.onthenet.com.au (sierra.onthenet.com.au [121.50.214.253]) by mx1.freebsd.org (Postfix) with ESMTP id C99F183C; Thu, 30 Jul 2015 05:08:31 +0000 (UTC) (envelope-from root@sierra.onthenet.com.au) Received: by sierra.onthenet.com.au (Postfix, from userid 0) id 2B21C2FF6A4; Thu, 30 Jul 2015 14:56:55 +1000 (AEST) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mx2.freebsd.org (mx2.freebsd.org [8.8.178.116]) by sierra.onthenet.com.au (Postfix) with ESMTP id 2694232EA6B for ; Wed, 29 Jul 2015 23:14:46 +1000 (AEST) Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.freebsd.org (Postfix) with ESMTPS id 35AA5657AF for ; Wed, 29 Jul 2015 13:14:43 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 0C599C61 for ; Wed, 29 Jul 2015 13:14:43 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix) id C81521290; Wed, 29 Jul 2015 13:14:42 +0000 (UTC) Delivered-To: grehan@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by freefall.freebsd.org (Postfix) with ESMTP id 511A41265; Wed, 29 Jul 2015 13:14:42 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 0F478C42; Wed, 29 Jul 2015 13:14:42 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 538) id 0A3581263; Wed, 29 Jul 2015 13:14:42 +0000 (UTC) Delivered-To: src-committers@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by freefall.freebsd.org (Postfix) with ESMTP id 41654125B for ; Wed, 29 Jul 2015 13:14:37 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F20EBC31; Wed, 29 Jul 2015 13:14:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TDEaAP043338; Wed, 29 Jul 2015 13:14:36 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TDEZ9Q043332; Wed, 29 Jul 2015 13:14:35 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201507291314.t6TDEZ9Q043332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 29 Jul 2015 13:14:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r286009 - in stable/9/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86 patches X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk X-Loop: FreeBSD.org Sender: owner-src-committers@freebsd.org X-MailScanner-Information: Please contact the ISP for more information X-MailScanner: Not scanned: please contact your Internet E-Mail Service Provider for details X-Spam-Flag: not spam (whitelisted), SpamAssassin (not cached, score=-5.119, required 5, BAYES_00 -1.90, HEADER_FROM_DIFFERENT_DOMAINS 0.00, KAM_ASCII_DIVIDERS 0.80, KAM_LAZY_DOMAIN_SECURITY 1.00, RCVD_IN_DNSWL_HI -5.00, RCVD_IN_MSPIKE_H4 -0.01, RCVD_IN_MSPIKE_WL -0.01) X-MailScanner-From: root@sierra.onthenet.com.au X-Spam-Status: No X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 05:08:32 -0000 Author: dim Date: Wed Jul 29 13:14:34 2015 New Revision: 286009 URL: https://svnweb.freebsd.org/changeset/base/286009 Log: Merge r286007 from stable/10: Pull in r219009 from upstream llvm trunk (by Adam Nemet): [ISel] Keep matching state consistent when folding during X86 address match In the X86 backend, matching an address is initiated by the 'addr' complex pattern and its friends. During this process we may reassociate and-of-shift into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the shift into the scale of the address. However as demonstrated by the testcase, this can trigger CSE of not only the shift and the AND which the code is prepared for but also the underlying load node. In the testcase this node is sitting in the RecordedNode and MatchScope data structures of the matcher and becomes a deleted node upon CSE. Returning from the complex pattern function, we try to access it again hitting an assert because the node is no longer a load even though this was checked before. Now obviously changing the DAG this late is bending the rules but I think it makes sense somewhat. Outside of addresses we prefer and-of-shift because it may lead to smaller immediates (FoldMaskAndShiftToScale is an even better example because it create a non-canonical node). We currently don't recognize addresses during DAGCombiner where arguably this canonicalization should be performed. On the other hand, having this in the matcher allows us to cover all the cases where an address can be used in an instruction. I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW for the new shift node in FoldMaskedShiftToScaledMask. This RAUW is responsible for initiating the recursive CSE on users (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but it is not strictly necessary since the shift is hooked into the visited user. Of course it's safer to keep the DAG consistent at all times (e.g. for accurate number of uses, etc.). So rather than changing the fundamentals, I've decided to continue along the previous patches and detect the CSE. This patch installs a very targeted DAGUpdateListener for the duration of a complex-pattern match and updates the matching state accordingly. (Previous patches used HandleSDNode to detect the CSE but that's not practical here). The listener is only installed on X86. I tested that there is no measurable overhead due to this while running through the spec2k BC files with llc. The only thing we pay for is the creation of the listener. The callback never ever triggers in spec2k since this is a corner case. Fixes rdar://problem/18206171 This fixes a possible crash in x86 code generation when compiling recent llvm/clang trunk sources. Direct commit to stable/10, since head already has llvm/clang 3.6.1, which includes this fix. Reported by: jonathan, theraven Upstream PR: https://llvm.org/bugs/show_bug.cgi?id=24249 Merge r286008 from stable/10: Add llvm patch corresponding to r286007. Added: stable/9/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff - copied unchanged from r286008, stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff Modified: stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Directory Properties: stable/9/ (props changed) stable/9/contrib/ (props changed) stable/9/contrib/llvm/ (props changed) Modified: stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h ============================================================================== --- stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 13:07:18 2015 (r286008) +++ stable/9/contrib/llvm/include/llvm/CodeGen/SelectionDAGISel.h Wed Jul 29 13:14:34 2015 (r286009) @@ -238,6 +238,12 @@ public: const unsigned char *MatcherTable, unsigned TableSize); + /// \brief Return true if complex patterns for this target can mutate the + /// DAG. + virtual bool ComplexPatternFuncMutatesDAG() const { + return false; + } + private: // Calls to these functions are generated by tblgen. Modified: stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ============================================================================== --- stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 13:07:18 2015 (r286008) +++ stable/9/contrib/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Jul 29 13:14:34 2015 (r286009) @@ -2345,6 +2345,42 @@ struct MatchScope { bool HasChainNodesMatched, HasGlueResultNodesMatched; }; +/// \\brief A DAG update listener to keep the matching state +/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to +/// change the DAG while matching. X86 addressing mode matcher is an example +/// for this. +class MatchStateUpdater : public SelectionDAG::DAGUpdateListener +{ + SmallVectorImpl > &RecordedNodes; + SmallVectorImpl &MatchScopes; +public: + MatchStateUpdater(SelectionDAG &DAG, + SmallVectorImpl > &RN, + SmallVectorImpl &MS) : + SelectionDAG::DAGUpdateListener(DAG), + RecordedNodes(RN), MatchScopes(MS) { } + + void NodeDeleted(SDNode *N, SDNode *E) { + // Some early-returns here to avoid the search if we deleted the node or + // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we + // do, so it's unnecessary to update matching state at that point). + // Neither of these can occur currently because we only install this + // update listener during matching a complex patterns. + if (!E || E->isMachineOpcode()) + return; + // Performing linear search here does not matter because we almost never + // run this code. You'd have to have a CSE during complex pattern + // matching. + for (auto &I : RecordedNodes) + if (I.first.getNode() == N) + I.first.setNode(E); + + for (auto &I : MatchScopes) + for (auto &J : I.NodeStack) + if (J.getNode() == N) + J.setNode(E); + } +}; } SDNode *SelectionDAGISel:: @@ -2599,6 +2635,14 @@ SelectCodeCommon(SDNode *NodeToMatch, co unsigned CPNum = MatcherTable[MatcherIndex++]; unsigned RecNo = MatcherTable[MatcherIndex++]; assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); + + // If target can modify DAG during matching, keep the matching state + // consistent. + std::unique_ptr MSU; + if (ComplexPatternFuncMutatesDAG()) + MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, + MatchScopes)); + if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, RecordedNodes[RecNo].first, CPNum, RecordedNodes)) Modified: stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp ============================================================================== --- stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 13:07:18 2015 (r286008) +++ stable/9/contrib/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp Wed Jul 29 13:14:34 2015 (r286009) @@ -290,6 +290,13 @@ namespace { const X86InstrInfo *getInstrInfo() const { return getTargetMachine().getInstrInfo(); } + + /// \brief Address-mode matching performs shift-of-and to and-of-shift + /// reassociation in order to expose more scaled addressing + /// opportunities. + bool ComplexPatternFuncMutatesDAG() const override { + return true; + } }; } Copied: stable/9/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff (from r286008, stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff Wed Jul 29 13:14:34 2015 (r286009, copy of r286008, stable/10/contrib/llvm/patches/patch-r286007-llvm-r219009-x86-codegen-crash.diff) @@ -0,0 +1,214 @@ +Pull in r219009 from upstream llvm trunk (by Adam Nemet): + + [ISel] Keep matching state consistent when folding during X86 address match + + In the X86 backend, matching an address is initiated by the 'addr' complex + pattern and its friends. During this process we may reassociate and-of-shift + into shift-of-and (FoldMaskedShiftToScaledMask) to allow folding of the + shift into the scale of the address. + + However as demonstrated by the testcase, this can trigger CSE of not only the + shift and the AND which the code is prepared for but also the underlying load + node. In the testcase this node is sitting in the RecordedNode and MatchScope + data structures of the matcher and becomes a deleted node upon CSE. Returning + from the complex pattern function, we try to access it again hitting an assert + because the node is no longer a load even though this was checked before. + + Now obviously changing the DAG this late is bending the rules but I think it + makes sense somewhat. Outside of addresses we prefer and-of-shift because it + may lead to smaller immediates (FoldMaskAndShiftToScale is an even better + example because it create a non-canonical node). We currently don't recognize + addresses during DAGCombiner where arguably this canonicalization should be + performed. On the other hand, having this in the matcher allows us to cover + all the cases where an address can be used in an instruction. + + I've also talked a little bit to Dan Gohman on llvm-dev who added the RAUW for + the new shift node in FoldMaskedShiftToScaledMask. This RAUW is responsible + for initiating the recursive CSE on users + (http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-September/076903.html) but it + is not strictly necessary since the shift is hooked into the visited user. Of + course it's safer to keep the DAG consistent at all times (e.g. for accurate + number of uses, etc.). + + So rather than changing the fundamentals, I've decided to continue along the + previous patches and detect the CSE. This patch installs a very targeted + DAGUpdateListener for the duration of a complex-pattern match and updates the + matching state accordingly. (Previous patches used HandleSDNode to detect the + CSE but that's not practical here). The listener is only installed on X86. + + I tested that there is no measurable overhead due to this while running + through the spec2k BC files with llc. The only thing we pay for is the + creation of the listener. The callback never ever triggers in spec2k since + this is a corner case. + + Fixes rdar://problem/18206171 + +This fixes a possible crash in x86 code generation when compiling recent +llvm/clang trunk sources. + +Introduced here: http://svnweb.freebsd.org/changeset/base/286007 + +Index: include/llvm/CodeGen/SelectionDAGISel.h +=================================================================== +--- include/llvm/CodeGen/SelectionDAGISel.h ++++ include/llvm/CodeGen/SelectionDAGISel.h +@@ -238,6 +238,12 @@ class SelectionDAGISel : public MachineFunctionPas + const unsigned char *MatcherTable, + unsigned TableSize); + ++ /// \brief Return true if complex patterns for this target can mutate the ++ /// DAG. ++ virtual bool ComplexPatternFuncMutatesDAG() const { ++ return false; ++ } ++ + private: + + // Calls to these functions are generated by tblgen. +Index: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +=================================================================== +--- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp ++++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +@@ -2345,6 +2345,42 @@ struct MatchScope { + bool HasChainNodesMatched, HasGlueResultNodesMatched; + }; + ++/// \\brief A DAG update listener to keep the matching state ++/// (i.e. RecordedNodes and MatchScope) uptodate if the target is allowed to ++/// change the DAG while matching. X86 addressing mode matcher is an example ++/// for this. ++class MatchStateUpdater : public SelectionDAG::DAGUpdateListener ++{ ++ SmallVectorImpl > &RecordedNodes; ++ SmallVectorImpl &MatchScopes; ++public: ++ MatchStateUpdater(SelectionDAG &DAG, ++ SmallVectorImpl > &RN, ++ SmallVectorImpl &MS) : ++ SelectionDAG::DAGUpdateListener(DAG), ++ RecordedNodes(RN), MatchScopes(MS) { } ++ ++ void NodeDeleted(SDNode *N, SDNode *E) { ++ // Some early-returns here to avoid the search if we deleted the node or ++ // if the update comes from MorphNodeTo (MorphNodeTo is the last thing we ++ // do, so it's unnecessary to update matching state at that point). ++ // Neither of these can occur currently because we only install this ++ // update listener during matching a complex patterns. ++ if (!E || E->isMachineOpcode()) ++ return; ++ // Performing linear search here does not matter because we almost never ++ // run this code. You'd have to have a CSE during complex pattern ++ // matching. ++ for (auto &I : RecordedNodes) ++ if (I.first.getNode() == N) ++ I.first.setNode(E); ++ ++ for (auto &I : MatchScopes) ++ for (auto &J : I.NodeStack) ++ if (J.getNode() == N) ++ J.setNode(E); ++ } ++}; + } + + SDNode *SelectionDAGISel:: +@@ -2599,6 +2635,14 @@ SelectCodeCommon(SDNode *NodeToMatch, const unsign + unsigned CPNum = MatcherTable[MatcherIndex++]; + unsigned RecNo = MatcherTable[MatcherIndex++]; + assert(RecNo < RecordedNodes.size() && "Invalid CheckComplexPat"); ++ ++ // If target can modify DAG during matching, keep the matching state ++ // consistent. ++ std::unique_ptr MSU; ++ if (ComplexPatternFuncMutatesDAG()) ++ MSU.reset(new MatchStateUpdater(*CurDAG, RecordedNodes, ++ MatchScopes)); ++ + if (!CheckComplexPattern(NodeToMatch, RecordedNodes[RecNo].second, + RecordedNodes[RecNo].first, CPNum, + RecordedNodes)) +Index: lib/Target/X86/X86ISelDAGToDAG.cpp +=================================================================== +--- lib/Target/X86/X86ISelDAGToDAG.cpp ++++ lib/Target/X86/X86ISelDAGToDAG.cpp +@@ -290,6 +290,13 @@ namespace { + const X86InstrInfo *getInstrInfo() const { + return getTargetMachine().getInstrInfo(); + } ++ ++ /// \brief Address-mode matching performs shift-of-and to and-of-shift ++ /// reassociation in order to expose more scaled addressing ++ /// opportunities. ++ bool ComplexPatternFuncMutatesDAG() const override { ++ return true; ++ } + }; + } + +Index: test/CodeGen/X86/addr-mode-matcher.ll +=================================================================== +--- test/CodeGen/X86/addr-mode-matcher.ll ++++ test/CodeGen/X86/addr-mode-matcher.ll +@@ -0,0 +1,62 @@ ++; RUN: llc < %s | FileCheck %s ++ ++; This testcase used to hit an assert during ISel. For details, see the big ++; comment inside the function. ++ ++; CHECK-LABEL: foo: ++; The AND should be turned into a subreg access. ++; CHECK-NOT: and ++; The shift (leal) should be folded into the scale of the address in the load. ++; CHECK-NOT: leal ++; CHECK: movl {{.*}},4), ++ ++target datalayout = "e-m:o-p:32:32-f64:32:64-f80:128-n8:16:32-S128" ++target triple = "i386-apple-macosx10.6.0" ++ ++define void @foo(i32 %a) { ++bb: ++ br label %bb1692 ++ ++bb1692: ++ %tmp1694 = phi i32 [ 0, %bb ], [ %tmp1745, %bb1692 ] ++ %xor = xor i32 0, %tmp1694 ++ ++; %load1 = (load (and (shl %xor, 2), 1020)) ++ %tmp1701 = shl i32 %xor, 2 ++ %tmp1702 = and i32 %tmp1701, 1020 ++ %tmp1703 = getelementptr inbounds [1028 x i8]* null, i32 0, i32 %tmp1702 ++ %tmp1704 = bitcast i8* %tmp1703 to i32* ++ %load1 = load i32* %tmp1704, align 4 ++ ++; %load2 = (load (shl (and %xor, 255), 2)) ++ %tmp1698 = and i32 %xor, 255 ++ %tmp1706 = shl i32 %tmp1698, 2 ++ %tmp1707 = getelementptr inbounds [1028 x i8]* null, i32 0, i32 %tmp1706 ++ %tmp1708 = bitcast i8* %tmp1707 to i32* ++ %load2 = load i32* %tmp1708, align 4 ++ ++ %tmp1710 = or i32 %load2, %a ++ ++; While matching xor we address-match %load1. The and-of-shift reassocication ++; in address matching transform this into into a shift-of-and and the resuting ++; node becomes identical to %load2. CSE replaces %load1 which leaves its ++; references in MatchScope and RecordedNodes stale. ++ %tmp1711 = xor i32 %load1, %tmp1710 ++ ++ %tmp1744 = getelementptr inbounds [256 x i32]* null, i32 0, i32 %tmp1711 ++ store i32 0, i32* %tmp1744, align 4 ++ %tmp1745 = add i32 %tmp1694, 1 ++ indirectbr i8* undef, [label %bb1756, label %bb1692] ++ ++bb1756: ++ br label %bb2705 ++ ++bb2705: ++ indirectbr i8* undef, [label %bb5721, label %bb5736] ++ ++bb5721: ++ br label %bb2705 ++ ++bb5736: ++ ret void ++} From owner-svn-src-all@freebsd.org Thu Jul 30 05:10:07 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8205B9AD49F; Thu, 30 Jul 2015 05:10:07 +0000 (UTC) (envelope-from root@sierra.onthenet.com.au) Received: from sierra.onthenet.com.au (sierra.onthenet.com.au [121.50.214.253]) by mx1.freebsd.org (Postfix) with ESMTP id 13E358A6; Thu, 30 Jul 2015 05:10:07 +0000 (UTC) (envelope-from root@sierra.onthenet.com.au) Received: by sierra.onthenet.com.au (Postfix, from userid 0) id 116D04C8A61; Thu, 30 Jul 2015 14:57:01 +1000 (AEST) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mx2.freebsd.org (mx2.freebsd.org [8.8.178.116]) by sierra.onthenet.com.au (Postfix) with ESMTP id 386E721CCF2 for ; Wed, 29 Jul 2015 23:36:34 +1000 (AEST) Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.freebsd.org (Postfix) with ESMTPS id 6370F65F57 for ; Wed, 29 Jul 2015 13:36:28 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 89D911A18 for ; Wed, 29 Jul 2015 13:36:26 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix) id BD98C189F; Wed, 29 Jul 2015 13:36:25 +0000 (UTC) Delivered-To: grehan@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by freefall.freebsd.org (Postfix) with ESMTP id 5D2DB1874; Wed, 29 Jul 2015 13:36:25 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 23BAA19BC; Wed, 29 Jul 2015 13:36:25 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 538) id 0A8DD1845; Wed, 29 Jul 2015 13:36:23 +0000 (UTC) Delivered-To: src-committers@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by freefall.freebsd.org (Postfix) with ESMTP id 524F91751 for ; Wed, 29 Jul 2015 13:36:19 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3EDD618AB; Wed, 29 Jul 2015 13:36:19 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6TDaJtC051460; Wed, 29 Jul 2015 13:36:19 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6TDaIbn051458; Wed, 29 Jul 2015 13:36:18 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201507291336.t6TDaIbn051458@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 29 Jul 2015 13:36:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286010 - head/usr.bin/ar X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk X-Loop: FreeBSD.org Sender: owner-src-committers@freebsd.org X-MailScanner-Information: Please contact the ISP for more information X-MailScanner: Not scanned: please contact your Internet E-Mail Service Provider for details X-Spam-Flag: not spam (whitelisted), SpamAssassin (not cached, score=-5.119, required 5, BAYES_00 -1.90, HEADER_FROM_DIFFERENT_DOMAINS 0.00, KAM_ASCII_DIVIDERS 0.80, KAM_LAZY_DOMAIN_SECURITY 1.00, RCVD_IN_DNSWL_HI -5.00, RCVD_IN_MSPIKE_H4 -0.01, RCVD_IN_MSPIKE_WL -0.01) X-MailScanner-From: root@sierra.onthenet.com.au X-Spam-Status: No X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 05:10:07 -0000 Author: emaste Date: Wed Jul 29 13:36:17 2015 New Revision: 286010 URL: https://svnweb.freebsd.org/changeset/base/286010 Log: ar: enable deterministic mode by default Ar cannot handle UIDs with more than 6 digits, and storing the mtime, uid, gid and mode provides little to negative value anyhow for ar's uses. Turn on deterministic (-D) mode by default; it can be disabled by the user with -U. PR: 196929 Relnotes: Yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3190 Modified: head/usr.bin/ar/ar.1 head/usr.bin/ar/ar.c Modified: head/usr.bin/ar/ar.1 ============================================================================== --- head/usr.bin/ar/ar.1 Wed Jul 29 13:14:34 2015 (r286009) +++ head/usr.bin/ar/ar.1 Wed Jul 29 13:36:17 2015 (r286010) @@ -210,6 +210,7 @@ and 0644 instead of file mode from the m .Ar . This ensures that checksums on the resulting archives are reproducible when member contents are identical. +This option is enabled by default. If multiple .Fl D and Modified: head/usr.bin/ar/ar.c ============================================================================== --- head/usr.bin/ar/ar.c Wed Jul 29 13:14:34 2015 (r286009) +++ head/usr.bin/ar/ar.c Wed Jul 29 13:36:17 2015 (r286010) @@ -104,6 +104,8 @@ main(int argc, char **argv) bsdar = &bsdar_storage; memset(bsdar, 0, sizeof(*bsdar)); + /* Enable deterministic mode by default. */ + bsdar->options |= AR_D; if ((bsdar->progname = getprogname()) == NULL) bsdar->progname = "ar"; From owner-svn-src-all@freebsd.org Thu Jul 30 06:06:49 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E9E029ADC30; Thu, 30 Jul 2015 06:06:48 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id 083BC1CFA; Thu, 30 Jul 2015 06:06:47 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail109.syd.optusnet.com.au (Postfix) with ESMTPS id 65ACDD62BFF; Thu, 30 Jul 2015 16:06:39 +1000 (AEST) Date: Thu, 30 Jul 2015 16:06:39 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Warner Losh cc: Hans Petter Selasky , =?utf-8?Q?Roger_Pau_Monn=C3=A9?= , Adrian Chadd , Warner Losh , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , Shani Michaeli Subject: Re: svn commit: r285068 - in head/sys: conf modules/agp modules/geom/geom_part/geom_part_apm modules/geom/geom_part/geom_part_bsd modules/geom/geom_part/geom_part_bsd64 modules/geom/geom_part/geom_part... In-Reply-To: <2779441E-E53E-4DB4-84CF-36A0CFCB4C08@bsdimp.com> Message-ID: <20150730135259.C2050@besplex.bde.org> References: <201507030150.t631oRd0039490@repo.freebsd.org> <5596C188.10404@FreeBSD.org> <5596C7E7.5090700@FreeBSD.org> <68C8F69B-56DF-45C3-8DBB-40514CA48D85@bsdimp.com> <55B8A8CA.90701@selasky.org> <3414D44A-A22F-4693-9F84-A8E880C0B185@bsdimp.com> <55B8F547.2010008@selasky.org> <2779441E-E53E-4DB4-84CF-36A0CFCB4C08@bsdimp.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=ItbjC+Lg c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=kj9zAlcOel0A:10 a=ndaoGXS1AAAA:8 a=95inkREc4AnWJPzKaJMA:9 a=PEqzJO3-QseUefnm:21 a=wRmMVqGdGscQzIu3:21 a=CjuIK1q_8ugA:10 a=Zn7JbPeRIQgA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 06:06:49 -0000 On Wed, 29 Jul 2015, Warner Losh wrote: >> On Jul 29, 2015, at 9:46 AM, Hans Petter Selasky wrote: >> In this particular case one "find of /sys" takes 11-16 seconds over NFS, so building a single KMOD takes 16 seconds too. It's not possible to eliminate the find entirely during repeated builds? > > 16 seconds? That\xe2\x80\x99s a really slow NFS server and at least 11 seconds longer than it should take :(. 11 seconds? Building full (FreeBSD-4) kernel takes 4.5 here seconds with a tuned nfs, starting with a warm cache after "make depend". makeworld takes 130 seconds over nfs, with nfs costing about 15 seconds of that, starting with a cold cache on the client and a warm cache on the server, and doing sufficient "make depend" steps (most are optimized out in ny version to save 10% with make -j1 and much more with make -j8; "make depend" and "make install" are not parallelized so they are the slowest parts of makeworld). It is mysterious that makeworld starting with a warm cache on the client is slightly slower. This took some fighting with network latency and nfs's lack of caching of attributes (it caches everything, but checks attributes on every first-open). For find, I think this results in an RPC or two for opening every directory in the traversal, but the caching works for regular files. "find ." on /usr/src takes: 0.27 real 0.03 user 0.24 sys on the server 3.27 real 0.05 user 0.40 sys on the client (3x faster) Lookup Access Fsstat Getattr Other Total (client nfsstat delta:) 1759 408 6987 14374 1 23529 while cached du -a takes: 0.58 real 0.09 user 0.48 sys on the server 10.30 real 0.09 user 0.78 sys on the client Lookup Access Fsstat Getattr Other Total (client nfsstat delta:) 49655 6987 6986 13979 6 77613 /usr/src has 6986 directories and 49643 files. There seems to be 1 Fsstat and 2 Getattr's per directory, 1 Access per directory for du -a, and 1 Lookup per file for du -a. The caching helped more for Lookup and Access for "find .. After mounting with -nocto: find .: 1.20 real 0.04 user 0.32 sys Fsstat Other Total 6987 16 7003 du -a: 6.83 real 0.04 user 0.69 sys Lookup Access Fsstat Other Total 42666 237 6986 3 49892 There are still too many Fsstats. This reminds me of an old pessimization in opendir(). It calls fstatfs() for almost every directory to support unionfs although unionfs never workded correctly and is almost never used. At least nfs3 never cached Fsstat in any FreeBSD implementation, so "find ." has to do lots of Fsstat RPCs. The caching works perfectly to avoid almost all other RPCs. There are still too many Lookups. The Lookup count for du -a now seems to be the number of files less than the number of directories. Apparently, lookups are only cached right for directories. After waiting a bit for cache timeouts to expire, du -a does 49000+ Lookups to look up the directories too. The files get cached if you read them. This gives the silly behaviour that tar cvvf runs much faster than du -a with a warm cache, since caching actually works for it (except for Fsstat): tar cvvf /dev/zero (nocto): 2.41 real 0.17 user 1.40 sys Fsstat Other Total 6986 10 6996 I had to fudge this test a little to avoid cache timeouts. I ran it a few times and picked the fastest ones. The default cache timeouts are 3-30 seconds for files and 30-60 seconds for directories (depending on the age of the file). tar with a cold cache takes longer than that, so it takes a few runs to get everything cached. Caching everything is only possible since the caching works for reads. So the first run of tar cvvf caches all the data so that subsequent runs have a chance of completing faster than the attribute cache times out. du -a has without nocto a high variance since it takes a significant fraction of the cache timeout. I don't use nocto in production since it reduces robustness and I want to make nfs caching work better without it. Caching can also be improved and robustness unimproved by increasing the cache timeouts. These default and current settings of these are hard to determine since their documentation is incorrect and mount(8) still doesn't support retrieving any mount options that are not in old flags. The default for acdirmin is still documented as being 30. This was too large, so it was changed to 3 in the code. The man page hasn't caught up with the change. 3 seems too low. The default for acdirmax is still 60. The defaults for nametimeo and negnametimeo are only documented as manifest constants, so they they are always correct in the man page because they are invisible there. NFS_DEFAULT_NEGNAMETIMEO is too long and has value 60. For the ac* timeouts, there is a hint that the actual timeout (between the min and the max) depends on the age of the file. For negnametimeo, there is no hint that the actual timeout is often determined by changes in the directory. negnametimeo seems to be just defense against bugs in the attribute caching. I don't know of any similar timeout for data. Such a timeout would flush the data cache quite often when nothing has changed, just in case we don't detect an actual change due to buggy timestamps or buggy caching of timestamps. Bruce From owner-svn-src-all@freebsd.org Thu Jul 30 06:14:49 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54FE19ADE22; Thu, 30 Jul 2015 06:14:49 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2BEB81D4; Thu, 30 Jul 2015 06:14:49 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6U6EnQE065981; Thu, 30 Jul 2015 06:14:49 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6U6EmJR065979; Thu, 30 Jul 2015 06:14:48 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201507300614.t6U6EmJR065979@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Thu, 30 Jul 2015 06:14:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286066 - head/usr.sbin/pw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 06:14:49 -0000 Author: bapt Date: Thu Jul 30 06:14:47 2015 New Revision: 286066 URL: https://svnweb.freebsd.org/changeset/base/286066 Log: Improve strtounum Fix many style bugs Better variable naming Use C99 'restrict' were apropriate Fix potential errno race Submitted by: bde Modified: head/usr.sbin/pw/pw.h head/usr.sbin/pw/strtounum.c Modified: head/usr.sbin/pw/pw.h ============================================================================== --- head/usr.sbin/pw/pw.h Thu Jul 30 05:13:12 2015 (r286065) +++ head/usr.sbin/pw/pw.h Thu Jul 30 06:14:47 2015 (r286066) @@ -103,5 +103,5 @@ char *pw_pwcrypt(char *password); extern const char *Modes[]; extern const char *Which[]; -uintmax_t strtounum(const char *numstr, uintmax_t minval, uintmax_t maxval, - const char **errmsg); +uintmax_t strtounum(const char * __restrict, uintmax_t, uintmax_t, + const char ** __restrict); Modified: head/usr.sbin/pw/strtounum.c ============================================================================== --- head/usr.sbin/pw/strtounum.c Thu Jul 30 05:13:12 2015 (r286065) +++ head/usr.sbin/pw/strtounum.c Thu Jul 30 06:14:47 2015 (r286066) @@ -34,41 +34,38 @@ __FBSDID("$FreeBSD$"); #include "pw.h" -#define INVALID "invalid" -#define TOOSMALL "too small" -#define TOOLARGE "too large" - uintmax_t -strtounum(const char *numstr, uintmax_t minval, uintmax_t maxval, - const char **errstrp) +strtounum(const char * __restrict np, uintmax_t minval, uintmax_t maxval, + const char ** __restrict errpp) { - uintmax_t ret = 0; - char *ep; + char *endp; + uintmax_t ret; if (minval > maxval) { errno = EINVAL; - if (errstrp != NULL) - *errstrp = INVALID; + if (errpp != NULL) + *errpp = "invalid"; return (0); } - - ret = strtoumax(numstr, &ep, 10); - if (errno == EINVAL || numstr == ep || *ep != '\0') { + errno = 0; + ret = strtoumax(np, &endp, 10); + if (endp == np || *endp != '\0') { errno = EINVAL; - if (errstrp != NULL) - *errstrp = INVALID; + if (errpp != NULL) + *errpp = "invalid"; return (0); - } else if ((ret == 0 && errno == ERANGE) || ret < minval) { + } + if (ret < minval) { errno = ERANGE; - if (errstrp != NULL) - *errstrp = TOOSMALL; + if (errpp != NULL) + *errpp = "too small"; return (0); - } else if ((ret == UINTMAX_MAX && errno == ERANGE) || ret > maxval) { + } + if (errno == ERANGE || ret > maxval) { errno = ERANGE; - if (errstrp != NULL) - *errstrp = TOOLARGE; + if (errpp != NULL) + *errpp = "too large"; return (0); } - return (ret); } From owner-svn-src-all@freebsd.org Thu Jul 30 07:24:05 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 271529AEDE5; Thu, 30 Jul 2015 07:24:05 +0000 (UTC) (envelope-from kmacybsd@gmail.com) Received: from mail-pa0-x234.google.com (mail-pa0-x234.google.com [IPv6:2607:f8b0:400e:c03::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EAEBD843; Thu, 30 Jul 2015 07:24:04 +0000 (UTC) (envelope-from kmacybsd@gmail.com) Received: by padck2 with SMTP id ck2so19069577pad.0; Thu, 30 Jul 2015 00:24:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=lEBEly6YSrHJGEAEFdMLa4MoX8SwycGo/s50zxCmL3g=; b=JdLoL0zK6PdSoxPp14+aHcwwBRrNiasHgw7XMsCD8CHhd4CNwhhbBfDa8N53GnH0Bc FRcpnh6dSClpBg6XX8vxc0XItteMX4XdKrfMwanOqDSmVylkDbmzaHfbUZlycD78ovx4 KHW+LtLeVI/1szaKlKMxZKr9RZ7UoVok4RWrXEItnv6m+szFQdiBGuLu0tkTAhrkruUx 47mEM+uyljruySJ5Cl13evo/BLwAI6fDIlqg6wFxqMg4K0HzOwNJwcGES0cwRwrGLHR1 BYUw0vpRhCnwjMrOI/tD6AYz5n8pwEjMNIUjTML7ig7rKdsXAQ8809vfd4PzRu1TchHs J4tQ== MIME-Version: 1.0 X-Received: by 10.66.55.66 with SMTP id q2mr102678590pap.94.1438241044390; Thu, 30 Jul 2015 00:24:04 -0700 (PDT) Sender: kmacybsd@gmail.com Received: by 10.66.236.36 with HTTP; Thu, 30 Jul 2015 00:24:04 -0700 (PDT) In-Reply-To: <201507020832.t628W3WJ002944@repo.freebsd.org> References: <201507020832.t628W3WJ002944@repo.freebsd.org> Date: Thu, 30 Jul 2015 00:24:04 -0700 X-Google-Sender-Auth: xwVfBLks0DdEYtwYFWxf0Kgm_zE Message-ID: Subject: Re: svn commit: r285021 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs From: "K. Macy" To: Andriy Gapon Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , Xin Li Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 07:24:05 -0000 Just FYI this change introduces a deadlock with with the spa_namespace_lock. Mount will be holding this lock while trying to acquire the spa_namespace_lock. zfskern on the other hand holds the spa_namespace_lock when calling zfs_freebsd_access which in turn tries to acquire the teardown lock. static int zfs_access(vnode_t *vp, int mode, int flag, cred_t *cr, caller_context_t *ct) { znode_t *zp = VTOZ(vp); zfsvfs_t *zfsvfs = zp->z_zfsvfs; int error; ZFS_ENTER(zfsvfs); where: /* Called on entry to each ZFS vnode and vfs operation */ #define ZFS_ENTER(zfsvfs) \ { \ rrm_enter_read(&(zfsvfs)->z_teardown_lock, FTAG); \ if ((zfsvfs)->z_unmounted) { \ ZFS_EXIT(zfsvfs); \ return (EIO); \ } \ I think this makes a pretty strong case for the need to educate WITNESS about rrm locks. Cheers. -K On Thu, Jul 2, 2015 at 1:32 AM, Andriy Gapon wrote: > Author: avg > Date: Thu Jul 2 08:32:02 2015 > New Revision: 285021 > URL: https://svnweb.freebsd.org/changeset/base/285021 > > Log: > zfs_mount(MS_REMOUNT): protect zfs_(un)register_callbacks calls > > We now take z_teardown_lock as a writer to ensure that there is no I/O > while the filesystem state is in a flux. Also, zfs_suspend_fs() -> > zfsvfs_teardown() call zfs_unregister_callbacks() and zfs_resume_fs() -> > zfsvfs_setup() call zfs_unregister_callbacks(). Previously there was no > synchronization between those calls and the calls in the re-mounting > case. That could lead to concurrent execution and a crash. > > PR: 180060 > Differential Revision: https://reviews.freebsd.org/D2865 > Suggested by: mahrens > Reviewed by: delphij, pho, mahrens, will > MFC after: 13 days > Sponsored by: ClusterHQ > > Modified: > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Jul 2 08:25:45 2015 (r285020) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Jul 2 08:32:02 2015 (r285021) > @@ -1717,9 +1717,19 @@ zfs_mount(vfs_t *vfsp) > * according to those options set in the current VFS options. > */ > if (vfsp->vfs_flag & MS_REMOUNT) { > - /* refresh mount options */ > - zfs_unregister_callbacks(vfsp->vfs_data); > + zfsvfs_t *zfsvfs = vfsp->vfs_data; > + > + /* > + * Refresh mount options with z_teardown_lock blocking I/O while > + * the filesystem is in an inconsistent state. > + * The lock also serializes this code with filesystem > + * manipulations between entry to zfs_suspend_fs() and return > + * from zfs_resume_fs(). > + */ > + rrm_enter(&zfsvfs->z_teardown_lock, RW_WRITER, FTAG); > + zfs_unregister_callbacks(zfsvfs); > error = zfs_register_callbacks(vfsp); > + rrm_exit(&zfsvfs->z_teardown_lock, FTAG); > goto out; > } > > _______________________________________________ > svn-src-head@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" From owner-svn-src-all@freebsd.org Thu Jul 30 08:40:28 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69A7E9ADEBD; Thu, 30 Jul 2015 08:40:28 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from theravensnest.org (theraven.freebsd.your.org [216.14.102.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cloud.theravensnest.org", Issuer "StartCom Class 1 Primary Intermediate Server CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 297BE7F1; Thu, 30 Jul 2015 08:40:27 +0000 (UTC) (envelope-from theraven@FreeBSD.org) Received: from [192.168.0.7] (cpc16-cmbg15-2-0-cust60.5-4.cable.virginm.net [86.5.162.61]) (authenticated bits=0) by theravensnest.org (8.15.1/8.15.1) with ESMTPSA id t6U8eLdm046102 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 30 Jul 2015 08:40:23 GMT (envelope-from theraven@FreeBSD.org) X-Authentication-Warning: theravensnest.org: Host cpc16-cmbg15-2-0-cust60.5-4.cable.virginm.net [86.5.162.61] claimed to be [192.168.0.7] Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) Subject: Re: svn commit: r286007 - in stable/10/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86 From: David Chisnall In-Reply-To: <5EDE437E-8D2E-4ADC-A90A-730CD9726AEC@FreeBSD.org> Date: Thu, 30 Jul 2015 09:41:14 +0100 Cc: Ed Schouten , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <78074160-BFE5-4D1A-A59E-E3D706A3C35F@FreeBSD.org> References: <201507291259.t6TCxHX4035145@repo.freebsd.org> <5EDE437E-8D2E-4ADC-A90A-730CD9726AEC@FreeBSD.org> To: Dimitry Andric X-Mailer: Apple Mail (2.2098) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 08:40:28 -0000 On 29 Jul 2015, at 14:36, Dimitry Andric wrote: >=20 > I'll have a look if this can be fixed using pre-C++11 constructs LLVM 3.4 had its own unique pointer template (llvm::OwningPtr? The = doxygen docs for 3.4 are no longer online, unfortunately). I don=E2=80=99= t think that unique_ptr from libc++ requires any C++11 features, so = another option would be to simply copy it into this file with some = #ifdefs. David From owner-svn-src-all@freebsd.org Thu Jul 30 10:09:08 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A58C49AB15C; Thu, 30 Jul 2015 10:09:08 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 95A4CFC8; Thu, 30 Jul 2015 10:09:08 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UA98PM059429; Thu, 30 Jul 2015 10:09:08 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UA98pk059428; Thu, 30 Jul 2015 10:09:08 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201507301009.t6UA98pk059428@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 30 Jul 2015 10:09:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r286067 - stable/8/crypto/openssh X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 10:09:08 -0000 Author: delphij Date: Thu Jul 30 10:09:07 2015 New Revision: 286067 URL: https://svnweb.freebsd.org/changeset/base/286067 Log: Fix a regression introduced with previous OpenSSH by explicitly initializing devices_done. Submitted by: jkim Modified: stable/8/crypto/openssh/auth2-chall.c Modified: stable/8/crypto/openssh/auth2-chall.c ============================================================================== --- stable/8/crypto/openssh/auth2-chall.c Thu Jul 30 06:14:47 2015 (r286066) +++ stable/8/crypto/openssh/auth2-chall.c Thu Jul 30 10:09:07 2015 (r286067) @@ -131,6 +131,7 @@ kbdint_alloc(const char *devs) kbdintctxt->ctxt = NULL; kbdintctxt->device = NULL; kbdintctxt->nreq = 0; + kbdintctxt->devices_done = 0; return kbdintctxt; } From owner-svn-src-all@freebsd.org Thu Jul 30 10:09:33 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 644989AB1AB; Thu, 30 Jul 2015 10:09:33 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3B9331112; Thu, 30 Jul 2015 10:09:33 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UA9Xlj059490; Thu, 30 Jul 2015 10:09:33 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UA9WF5059486; Thu, 30 Jul 2015 10:09:32 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201507301009.t6UA9WF5059486@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 30 Jul 2015 10:09:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r286068 - in releng/8.4: . crypto/openssh sys/conf X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 10:09:33 -0000 Author: delphij Date: Thu Jul 30 10:09:31 2015 New Revision: 286068 URL: https://svnweb.freebsd.org/changeset/base/286068 Log: Fix a regression introduced with previous SA-15:16.openssl changeset. The problem is specific to FreeBSD 8.x. Submitted by: jkim Pointy hat to: delphij Approved by: so Modified: releng/8.4/UPDATING releng/8.4/crypto/openssh/auth2-chall.c releng/8.4/sys/conf/newvers.sh Modified: releng/8.4/UPDATING ============================================================================== --- releng/8.4/UPDATING Thu Jul 30 10:09:07 2015 (r286067) +++ releng/8.4/UPDATING Thu Jul 30 10:09:31 2015 (r286068) @@ -15,6 +15,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. debugging tools present in HEAD were left in place because sun4v support still needs work to become production ready. +20150730: p36 FreeBSD-SA-15:16.openssh [REVISED] + Fix a regression introduced in SA-15:16 patch that would break + keyboard-interactive authentication. + 20150728: p35 FreeBSD-SA-15:15.tcp FreeBSD-SA-15:16.openssh FreeBSD-SA-15:17.bind Modified: releng/8.4/crypto/openssh/auth2-chall.c ============================================================================== --- releng/8.4/crypto/openssh/auth2-chall.c Thu Jul 30 10:09:07 2015 (r286067) +++ releng/8.4/crypto/openssh/auth2-chall.c Thu Jul 30 10:09:31 2015 (r286068) @@ -131,6 +131,7 @@ kbdint_alloc(const char *devs) kbdintctxt->ctxt = NULL; kbdintctxt->device = NULL; kbdintctxt->nreq = 0; + kbdintctxt->devices_done = 0; return kbdintctxt; } Modified: releng/8.4/sys/conf/newvers.sh ============================================================================== --- releng/8.4/sys/conf/newvers.sh Thu Jul 30 10:09:07 2015 (r286067) +++ releng/8.4/sys/conf/newvers.sh Thu Jul 30 10:09:31 2015 (r286068) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="8.4" -BRANCH="RELEASE-p35" +BRANCH="RELEASE-p36" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@freebsd.org Thu Jul 30 10:26:45 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B5A029AB622; Thu, 30 Jul 2015 10:26:45 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A60A31E5C; Thu, 30 Jul 2015 10:26:45 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UAQjfn067373; Thu, 30 Jul 2015 10:26:45 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UAQi53067370; Thu, 30 Jul 2015 10:26:44 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201507301026.t6UAQi53067370@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 30 Jul 2015 10:26:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286069 - in head/sys: modules modules/if_stf net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 10:26:45 -0000 Author: ae Date: Thu Jul 30 10:26:43 2015 New Revision: 286069 URL: https://svnweb.freebsd.org/changeset/base/286069 Log: Build if_stf(4) module only when both INET and INET6 support are enabled. Modified: head/sys/modules/Makefile head/sys/modules/if_stf/Makefile head/sys/net/if_stf.c Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Thu Jul 30 10:09:31 2015 (r286068) +++ head/sys/modules/Makefile Thu Jul 30 10:26:43 2015 (r286069) @@ -149,7 +149,7 @@ SUBDIR= \ ${_if_me} \ if_lagg \ ${_if_ndis} \ - if_stf \ + ${_if_stf} \ if_tap \ if_tun \ if_vlan \ @@ -411,6 +411,11 @@ _if_gif= if_gif _if_gre= if_gre .endif +.if (${MK_INET_SUPPORT} != "no" && ${MK_INET6_SUPPORT} != "no") || \ + defined(ALL_MODULES) +_if_stf= if_stf +.endif + .if ${MK_INET_SUPPORT} != "no" || defined(ALL_MODULES) _if_me= if_me _ipdivert= ipdivert Modified: head/sys/modules/if_stf/Makefile ============================================================================== --- head/sys/modules/if_stf/Makefile Thu Jul 30 10:09:31 2015 (r286068) +++ head/sys/modules/if_stf/Makefile Thu Jul 30 10:26:43 2015 (r286069) @@ -3,6 +3,6 @@ .PATH: ${.CURDIR}/../../net KMOD= if_stf -SRCS= if_stf.c opt_inet.h opt_inet6.h +SRCS= if_stf.c .include Modified: head/sys/net/if_stf.c ============================================================================== --- head/sys/net/if_stf.c Thu Jul 30 10:09:31 2015 (r286068) +++ head/sys/net/if_stf.c Thu Jul 30 10:26:43 2015 (r286069) @@ -74,9 +74,6 @@ * Note that there is no way to be 100% secure. */ -#include "opt_inet.h" -#include "opt_inet6.h" - #include #include #include From owner-svn-src-all@freebsd.org Thu Jul 30 10:52:34 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13B6F9AE6E9; Thu, 30 Jul 2015 10:52:34 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:7b8:3a7:1:2d0:b7ff:fea0:8c26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B9B0419FD; Thu, 30 Jul 2015 10:52:33 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2a03:fc02:2:1:4496:97e0:41:4130] (unknown [IPv6:2a03:fc02:2:1:4496:97e0:41:4130]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id E12252A4F3; Thu, 30 Jul 2015 12:52:29 +0200 (CEST) Subject: Re: svn commit: r286007 - in stable/10/contrib/llvm: include/llvm/CodeGen lib/CodeGen/SelectionDAG lib/Target/X86 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2102\)) Content-Type: multipart/signed; boundary="Apple-Mail=_F3304726-48B8-4727-BC0C-5FA400C860FA"; protocol="application/pgp-signature"; micalg=pgp-sha1 X-Pgp-Agent: GPGMail 2.5 From: Dimitry Andric In-Reply-To: <78074160-BFE5-4D1A-A59E-E3D706A3C35F@FreeBSD.org> Date: Thu, 30 Jul 2015 12:52:19 +0200 Cc: Ed Schouten , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Message-Id: <7CF09DE7-5581-4FE2-B131-86947C0FEC8E@FreeBSD.org> References: <201507291259.t6TCxHX4035145@repo.freebsd.org> <5EDE437E-8D2E-4ADC-A90A-730CD9726AEC@FreeBSD.org> <78074160-BFE5-4D1A-A59E-E3D706A3C35F@FreeBSD.org> To: David Chisnall X-Mailer: Apple Mail (2.2102) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 10:52:34 -0000 --Apple-Mail=_F3304726-48B8-4727-BC0C-5FA400C860FA Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On 30 Jul 2015, at 10:41, David Chisnall wrote: > > On 29 Jul 2015, at 14:36, Dimitry Andric wrote: >> >> I'll have a look if this can be fixed using pre-C++11 constructs > > LLVM 3.4 had its own unique pointer template (llvm::OwningPtr? Yes, in r286033 I have used that instead, replaced the C++11 range-based for loops with old fashioned ones, and removed one use of the 'override' keyword. It now compiles fine with g++ 4.2.1 and libstdc++. -Dimitry --Apple-Mail=_F3304726-48B8-4727-BC0C-5FA400C860FA Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.27 iEYEARECAAYFAlW6AewACgkQsF6jCi4glqP9rwCghHWPeblrcmzw0fIPMwkyradk 7v4AnRZiTRdoCD6Z1SZZ0rDFuti1i+VF =owqK -----END PGP SIGNATURE----- --Apple-Mail=_F3304726-48B8-4727-BC0C-5FA400C860FA-- From owner-svn-src-all@freebsd.org Thu Jul 30 12:41:55 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF75B9ADD32; Thu, 30 Jul 2015 12:41:55 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AAC541A4F; Thu, 30 Jul 2015 12:41:55 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UCftEe024428; Thu, 30 Jul 2015 12:41:55 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UCftU3024427; Thu, 30 Jul 2015 12:41:55 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201507301241.t6UCftU3024427@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 30 Jul 2015 12:41:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286070 - in head/contrib/elftoolchain: ar elfdump X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 12:41:55 -0000 Author: emaste Date: Thu Jul 30 12:41:54 2015 New Revision: 286070 URL: https://svnweb.freebsd.org/changeset/base/286070 Log: Add ELF Tool Chain's ar(1) and elfdump(1) to contrib ELF Tool Chain built on FreeBSD's ar and elfdump, but has a number of improvements and enhancements. Bring them into contrib in order to start integrating into our build. Added: - copied from r286069, vendor/elftoolchain/dist/ar/ - copied from r286069, vendor/elftoolchain/dist/elfdump/ Directory Properties: head/contrib/elftoolchain/ar/ (props changed) head/contrib/elftoolchain/elfdump/ (props changed) From owner-svn-src-all@freebsd.org Thu Jul 30 13:45:34 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4D399AEC2F; Thu, 30 Jul 2015 13:45:34 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B5B20E; Thu, 30 Jul 2015 13:45:34 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UDjYAw049875; Thu, 30 Jul 2015 13:45:34 GMT (envelope-from zbb@FreeBSD.org) Received: (from zbb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UDjYWH049874; Thu, 30 Jul 2015 13:45:34 GMT (envelope-from zbb@FreeBSD.org) Message-Id: <201507301345.t6UDjYWH049874@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zbb set sender to zbb@FreeBSD.org using -f From: Zbigniew Bodek Date: Thu, 30 Jul 2015 13:45:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286071 - head/sys/arm/annapurna/alpine/hal X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 13:45:34 -0000 Author: zbb Date: Thu Jul 30 13:45:34 2015 New Revision: 286071 URL: https://svnweb.freebsd.org/changeset/base/286071 Log: Remove obsolete vendor code from Alpine platform support This is a clean-up patch from a serie delivering support for Annapurna Labs Alpine PoC. The HAL files have already been added to sys/contrib/alpine-hal so there is no need for them in the platform directory. This patch removes obsolete files. Reviewed by: andrew Obtained from: Semihalf Sponsored by: Annapurna Labs Differential Revision: https://reviews.freebsd.org/D3248 Deleted: head/sys/arm/annapurna/alpine/hal/ From owner-svn-src-all@freebsd.org Thu Jul 30 13:59:39 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A739F9AEE2C; Thu, 30 Jul 2015 13:59:39 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9789EA30; Thu, 30 Jul 2015 13:59:39 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UDxdOa054059; Thu, 30 Jul 2015 13:59:39 GMT (envelope-from zbb@FreeBSD.org) Received: (from zbb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UDxdIx054058; Thu, 30 Jul 2015 13:59:39 GMT (envelope-from zbb@FreeBSD.org) Message-Id: <201507301359.t6UDxdIx054058@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zbb set sender to zbb@FreeBSD.org using -f From: Zbigniew Bodek Date: Thu, 30 Jul 2015 13:59:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286072 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 13:59:39 -0000 Author: zbb Date: Thu Jul 30 13:59:38 2015 New Revision: 286072 URL: https://svnweb.freebsd.org/changeset/base/286072 Log: Enable IRQ during syscalls on ARM64 FreeBSD provides a feature called Adaptive Mutexes, which allows a thread to spin for a while when the mutex is taken instead of immediately going to sleep. This causes issues when called from syscall handler if interrupts are masked. If every other core also attempts to access the same mutex there is a chance that all of them are spinning on the same lock at the same time. If interrupts are disabled, no kernel preemtion can occur and the system becomes unresponsive. This patch enables interrupts when syscall is being executed and masks them as soon as it is completed. Reviewed by: andrew Obtained from: Semihalf Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3246 Modified: head/sys/arm64/arm64/trap.c Modified: head/sys/arm64/arm64/trap.c ============================================================================== --- head/sys/arm64/arm64/trap.c Thu Jul 30 13:45:34 2015 (r286071) +++ head/sys/arm64/arm64/trap.c Thu Jul 30 13:59:38 2015 (r286072) @@ -319,6 +319,12 @@ do_el0_sync(struct trapframe *frame) #endif break; case EXCP_SVC: + /* + * Ensure the svc_handler is being run with interrupts enabled. + * They will be automatically restored when returning from + * exception handler. + */ + intr_enable(); svc_handler(frame); break; case EXCP_INSN_ABORT_L: From owner-svn-src-all@freebsd.org Thu Jul 30 14:20:40 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54AF39AF1E9; Thu, 30 Jul 2015 14:20:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 44B66195A; Thu, 30 Jul 2015 14:20:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UEKews063892; Thu, 30 Jul 2015 14:20:40 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UEKbxE063881; Thu, 30 Jul 2015 14:20:37 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201507301420.t6UEKbxE063881@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 30 Jul 2015 14:20:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286073 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 14:20:40 -0000 Author: emaste Date: Thu Jul 30 14:20:36 2015 New Revision: 286073 URL: https://svnweb.freebsd.org/changeset/base/286073 Log: Add ARM64TODO markers to unimplemented functionality Reviewed by: andrew Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D2389 Modified: head/sys/arm64/arm64/elf_machdep.c head/sys/arm64/arm64/machdep.c head/sys/arm64/arm64/mem.c head/sys/arm64/arm64/pmap.c head/sys/arm64/arm64/stack_machdep.c head/sys/arm64/arm64/trap.c head/sys/arm64/arm64/uio_machdep.c head/sys/arm64/arm64/vm_machdep.c Modified: head/sys/arm64/arm64/elf_machdep.c ============================================================================== --- head/sys/arm64/arm64/elf_machdep.c Thu Jul 30 13:59:38 2015 (r286072) +++ head/sys/arm64/arm64/elf_machdep.c Thu Jul 30 14:20:36 2015 (r286073) @@ -137,7 +137,7 @@ elf_reloc_local(linker_file_t lf, Elf_Ad int type, elf_lookup_fn lookup __unused) { - panic("elf_reloc_local"); + panic("ARM64TODO: elf_reloc_local"); } /* Process one elf relocation with addend. */ @@ -146,7 +146,7 @@ elf_reloc(linker_file_t lf, Elf_Addr rel elf_lookup_fn lookup) { - panic("elf_reloc"); + panic("ARM64TODO: elf_reloc"); } int Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Thu Jul 30 13:59:38 2015 (r286072) +++ head/sys/arm64/arm64/machdep.c Thu Jul 30 14:20:36 2015 (r286073) @@ -209,21 +209,21 @@ int fill_dbregs(struct thread *td, struct dbreg *regs) { - panic("fill_dbregs"); + panic("ARM64TODO: fill_dbregs"); } int set_dbregs(struct thread *td, struct dbreg *regs) { - panic("set_dbregs"); + panic("ARM64TODO: set_dbregs"); } int ptrace_set_pc(struct thread *td, u_long addr) { - panic("ptrace_set_pc"); + panic("ARM64TODO: ptrace_set_pc"); return (0); } @@ -376,7 +376,7 @@ void cpu_halt(void) { - panic("cpu_halt"); + panic("ARM64TODO: cpu_halt"); } /* @@ -387,7 +387,7 @@ void cpu_flush_dcache(void *ptr, size_t len) { - /* TBD */ + /* ARM64TODO TBD */ } /* Get current clock frequency for the given CPU ID. */ @@ -395,7 +395,7 @@ int cpu_est_clockrate(int cpu_id, uint64_t *rate) { - panic("cpu_est_clockrate"); + panic("ARM64TODO: cpu_est_clockrate"); } void Modified: head/sys/arm64/arm64/mem.c ============================================================================== --- head/sys/arm64/arm64/mem.c Thu Jul 30 13:59:38 2015 (r286072) +++ head/sys/arm64/arm64/mem.c Thu Jul 30 14:20:36 2015 (r286073) @@ -42,6 +42,6 @@ int memrw(struct cdev *dev, struct uio *uio, int flags) { - panic("memrw"); + panic("ARM64TODO: memrw"); } Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Thu Jul 30 13:59:38 2015 (r286072) +++ head/sys/arm64/arm64/pmap.c Thu Jul 30 14:20:36 2015 (r286073) @@ -1434,7 +1434,7 @@ static vm_page_t reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **lockp) { - panic("reclaim_pv_chunk"); + panic("ARM64TODO: reclaim_pv_chunk"); } /* @@ -2881,7 +2881,7 @@ retry: * at all. We need to be able to set it in * the exception handler. */ - panic("TODO: safe_to_clear_referenced\n"); + panic("ARM64TODO: safe_to_clear_referenced\n"); } else if ((pmap_load(l3) & ATTR_SW_WIRED) == 0) { /* * Wired pages cannot be paged out so @@ -2949,7 +2949,7 @@ pmap_clear_modify(vm_page_t m) if ((m->aflags & PGA_WRITEABLE) == 0) return; - /* TODO: We lack support for tracking if a page is modified */ + /* ARM64TODO: We lack support for tracking if a page is modified */ } void * @@ -2971,7 +2971,7 @@ void pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma) { - panic("pmap_page_set_memattr"); + panic("ARM64TODO: pmap_page_set_memattr"); } /* @@ -2981,7 +2981,7 @@ int pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *locked_pa) { - panic("pmap_mincore"); + panic("ARM64TODO: pmap_mincore"); } void @@ -3001,7 +3001,7 @@ void pmap_sync_icache(pmap_t pm, vm_offset_t va, vm_size_t sz) { - panic("pmap_sync_icache"); + panic("ARM64TODO: pmap_sync_icache"); } /* @@ -3085,7 +3085,7 @@ pmap_unmap_io_transient(vm_page_t page[] for (i = 0; i < count; i++) { paddr = VM_PAGE_TO_PHYS(page[i]); if (paddr >= DMAP_MAX_PHYSADDR) { - panic("pmap_unmap_io_transient: TODO: Unmap data"); + panic("ARM64TODO: pmap_unmap_io_transient: Unmap data"); } } } Modified: head/sys/arm64/arm64/stack_machdep.c ============================================================================== --- head/sys/arm64/arm64/stack_machdep.c Thu Jul 30 13:59:38 2015 (r286072) +++ head/sys/arm64/arm64/stack_machdep.c Thu Jul 30 14:20:36 2015 (r286073) @@ -49,12 +49,12 @@ stack_save_td(struct stack *st, struct t if (TD_IS_RUNNING(td)) panic("stack_save_td: running"); - stack_zero(st); + stack_zero(st); /* ARM64TODO */ } void stack_save(struct stack *st) { - stack_zero(st); + stack_zero(st); /* ARM64TODO */ } Modified: head/sys/arm64/arm64/trap.c ============================================================================== --- head/sys/arm64/arm64/trap.c Thu Jul 30 13:59:38 2015 (r286072) +++ head/sys/arm64/arm64/trap.c Thu Jul 30 14:20:36 2015 (r286073) @@ -119,7 +119,7 @@ cpu_fetch_syscall_args(struct thread *td sa->narg = sa->callp->sy_narg; memcpy(sa->args, ap, nap * sizeof(register_t)); if (sa->narg > nap) - panic("TODO: Could we have more then 8 args?"); + panic("ARM64TODO: Could we have more then 8 args?"); td->td_retval[0] = 0; td->td_retval[1] = 0; @@ -341,6 +341,6 @@ void do_el0_error(struct trapframe *frame) { - panic("do_el0_error"); + panic("ARM64TODO: do_el0_error"); } Modified: head/sys/arm64/arm64/uio_machdep.c ============================================================================== --- head/sys/arm64/arm64/uio_machdep.c Thu Jul 30 13:59:38 2015 (r286072) +++ head/sys/arm64/arm64/uio_machdep.c Thu Jul 30 14:20:36 2015 (r286073) @@ -124,7 +124,7 @@ uiomove_fromphys(vm_page_t ma[], vm_offs } out: if (__predict_false(mapped)) { - panic("TODO 3"); + panic("ARM64TODO: uiomove_fromphys"); pmap_unmap_io_transient(&ma[offset >> PAGE_SHIFT], &vaddr, 1, TRUE); } Modified: head/sys/arm64/arm64/vm_machdep.c ============================================================================== --- head/sys/arm64/arm64/vm_machdep.c Thu Jul 30 13:59:38 2015 (r286072) +++ head/sys/arm64/arm64/vm_machdep.c Thu Jul 30 14:20:36 2015 (r286073) @@ -263,13 +263,13 @@ void * uma_small_alloc(uma_zone_t zone, vm_size_t bytes, u_int8_t *flags, int wait) { - panic("uma_small_alloc"); + panic("ARM64TODO: uma_small_alloc"); } void uma_small_free(void *mem, vm_size_t size, u_int8_t flags) { - panic("uma_small_free"); + panic("ARM64TODO: uma_small_free"); } From owner-svn-src-all@freebsd.org Thu Jul 30 14:31:13 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1AF769AF452; Thu, 30 Jul 2015 14:31:13 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0B20730B; Thu, 30 Jul 2015 14:31:13 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UEVC1u068947; Thu, 30 Jul 2015 14:31:12 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UEVAY0068935; Thu, 30 Jul 2015 14:31:10 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201507301431.t6UEVAY0068935@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 30 Jul 2015 14:31:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286074 - in head/contrib/gcc: . doc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 14:31:13 -0000 Author: pfg Date: Thu Jul 30 14:31:09 2015 New Revision: 286074 URL: https://svnweb.freebsd.org/changeset/base/286074 Log: GCC: Add a new option "-fstack-protector-strong" This includes additional functions to be protected: those that have local array definitions, or have references to local frame addresses. This is a new option in GCC-4.9 that was relicensed by Han Shen from Google under GPLv2 for OpenBSD. Obtained from: OpenBSD (2014-01-14) MFC after: 2 weeks Modified: head/contrib/gcc/c-cppbuiltin.c head/contrib/gcc/cfgexpand.c head/contrib/gcc/common.opt head/contrib/gcc/doc/cpp.texi head/contrib/gcc/doc/gcc.1 head/contrib/gcc/doc/invoke.texi head/contrib/gcc/gcc.c Modified: head/contrib/gcc/c-cppbuiltin.c ============================================================================== --- head/contrib/gcc/c-cppbuiltin.c Thu Jul 30 14:20:36 2015 (r286073) +++ head/contrib/gcc/c-cppbuiltin.c Thu Jul 30 14:31:09 2015 (r286074) @@ -553,7 +553,9 @@ c_cpp_builtins (cpp_reader *pfile) /* Make the choice of the stack protector runtime visible to source code. The macro names and values here were chosen for compatibility with an earlier implementation, i.e. ProPolice. */ - if (flag_stack_protect == 2) + if (flag_stack_protect == 3) + cpp_define (pfile, "__SSP_STRONG__=3"); + else if (flag_stack_protect == 2) cpp_define (pfile, "__SSP_ALL__=2"); else if (flag_stack_protect == 1) cpp_define (pfile, "__SSP__=1"); Modified: head/contrib/gcc/cfgexpand.c ============================================================================== --- head/contrib/gcc/cfgexpand.c Thu Jul 30 14:20:36 2015 (r286073) +++ head/contrib/gcc/cfgexpand.c Thu Jul 30 14:31:09 2015 (r286074) @@ -810,6 +810,12 @@ clear_tree_used (tree block) clear_tree_used (t); } +enum { + SPCT_FLAG_DEFAULT = 1, + SPCT_FLAG_ALL = 2, + SPCT_FLAG_STRONG = 3 +}; + /* Examine TYPE and determine a bit mask of the following features. */ #define SPCT_HAS_LARGE_CHAR_ARRAY 1 @@ -879,7 +885,8 @@ stack_protect_decl_phase (tree decl) if (bits & SPCT_HAS_SMALL_CHAR_ARRAY) has_short_buffer = true; - if (flag_stack_protect == 2) + if (flag_stack_protect == SPCT_FLAG_ALL + || flag_stack_protect == SPCT_FLAG_STRONG) { if ((bits & (SPCT_HAS_SMALL_CHAR_ARRAY | SPCT_HAS_LARGE_CHAR_ARRAY)) && !(bits & SPCT_HAS_AGGREGATE)) @@ -947,12 +954,36 @@ create_stack_guard (void) cfun->stack_protect_guard = guard; } +/* Helper routine to check if a record or union contains an array field. */ + +static int +record_or_union_type_has_array_p (tree tree_type) +{ + tree fields = TYPE_FIELDS (tree_type); + tree f; + + for (f = fields; f; f = TREE_CHAIN (f)) + if (TREE_CODE (f) == FIELD_DECL) + { + tree field_type = TREE_TYPE (f); + if ((TREE_CODE (field_type) == RECORD_TYPE + || TREE_CODE (field_type) == UNION_TYPE + || TREE_CODE (field_type) == QUAL_UNION_TYPE) + && record_or_union_type_has_array_p (field_type)) + return 1; + if (TREE_CODE (field_type) == ARRAY_TYPE) + return 1; + } + return 0; +} + /* Expand all variables used in the function. */ static void expand_used_vars (void) { tree t, outer_block = DECL_INITIAL (current_function_decl); + bool gen_stack_protect_signal = false; /* Compute the phase of the stack frame for this function. */ { @@ -972,6 +1003,29 @@ expand_used_vars (void) has_protected_decls = false; has_short_buffer = false; + if (flag_stack_protect == SPCT_FLAG_STRONG) + for (t = cfun->unexpanded_var_list; t; t = TREE_CHAIN (t)) + { + tree var = TREE_VALUE (t); + if (!is_global_var (var)) + { + tree var_type = TREE_TYPE (var); + /* Examine local referenced variables that have their addresses + * taken, contain an array, or are arrays. */ + if (TREE_CODE (var) == VAR_DECL + && (TREE_CODE (var_type) == ARRAY_TYPE + || TREE_ADDRESSABLE (var) + || ((TREE_CODE (var_type) == RECORD_TYPE + || TREE_CODE (var_type) == UNION_TYPE + || TREE_CODE (var_type) == QUAL_UNION_TYPE) + && record_or_union_type_has_array_p (var_type)))) + { + gen_stack_protect_signal = true; + break; + } + } + } + /* At this point all variables on the unexpanded_var_list with TREE_USED set are not associated with any block scope. Lay them out. */ for (t = cfun->unexpanded_var_list; t; t = TREE_CHAIN (t)) @@ -1032,12 +1086,26 @@ expand_used_vars (void) dump_stack_var_partition (); } - /* There are several conditions under which we should create a - stack guard: protect-all, alloca used, protected decls present. */ - if (flag_stack_protect == 2 - || (flag_stack_protect - && (current_function_calls_alloca || has_protected_decls))) - create_stack_guard (); + switch (flag_stack_protect) + { + case SPCT_FLAG_ALL: + create_stack_guard (); + break; + + case SPCT_FLAG_STRONG: + if (gen_stack_protect_signal + || current_function_calls_alloca || has_protected_decls) + create_stack_guard (); + break; + + case SPCT_FLAG_DEFAULT: + if (current_function_calls_alloca || has_protected_decls) + create_stack_guard(); + break; + + default: + ; + } /* Assign rtl to each variable based on these partitions. */ if (stack_vars_num > 0) Modified: head/contrib/gcc/common.opt ============================================================================== --- head/contrib/gcc/common.opt Thu Jul 30 14:20:36 2015 (r286073) +++ head/contrib/gcc/common.opt Thu Jul 30 14:31:09 2015 (r286074) @@ -878,6 +878,10 @@ fstack-protector-all Common Report RejectNegative Var(flag_stack_protect, 2) VarExists Use a stack protection method for every function +fstack-protector-strong +Common Report RejectNegative Var(flag_stack_protect, 3) +Use a smart stack protection method for certain functions + fstrength-reduce Common Does nothing. Preserved for backward compatibility. Modified: head/contrib/gcc/doc/cpp.texi ============================================================================== --- head/contrib/gcc/doc/cpp.texi Thu Jul 30 14:20:36 2015 (r286073) +++ head/contrib/gcc/doc/cpp.texi Thu Jul 30 14:31:09 2015 (r286074) @@ -2134,6 +2134,10 @@ use. This macro is defined, with value 2, when @option{-fstack-protector-all} is in use. +@item __SSP_STRONG__ +This macro is defined, with value 3, when @option{-fstack-protector-strong} is +in use. + @item __TIMESTAMP__ This macro expands to a string constant that describes the date and time of the last modification of the current source file. The string constant Modified: head/contrib/gcc/doc/gcc.1 ============================================================================== --- head/contrib/gcc/doc/gcc.1 Thu Jul 30 14:20:36 2015 (r286073) +++ head/contrib/gcc/doc/gcc.1 Thu Jul 30 14:31:09 2015 (r286074) @@ -339,7 +339,7 @@ in the following sections. \&\fB\-fsched2\-use\-superblocks \&\-fsched2\-use\-traces \-fsee \-freschedule\-modulo\-scheduled\-loops \&\-fsection\-anchors \-fsignaling\-nans \-fsingle\-precision\-constant -\&\-fstack\-protector \-fstack\-protector\-all +\&\-fstack\-protector \-fstack\-protector\-all \-fstack\-protector\-strong \&\-fstrict\-aliasing \-fstrict\-overflow \-ftracer \-fthread\-jumps \&\-funroll\-all\-loops \-funroll\-loops \-fpeel\-loops \&\-fsplit\-ivs\-in\-unroller \-funswitch\-loops @@ -5193,6 +5193,11 @@ If a guard check fails, an error message .IP "\fB\-fstack\-protector\-all\fR" 4 .IX Item "-fstack-protector-all" Like \fB\-fstack\-protector\fR except that all functions are protected. +.IP "\fB\-fstack\-protector\-strong\fR" 4 +.IX Item "-fstack-protector-strong" +Like \fB\-fstack\-protector\fR but includes additional functions to +be protected \-\-\- those that have local array definitions, or have +references to local frame addresses. .IP "\fB\-fsection\-anchors\fR" 4 .IX Item "-fsection-anchors" Try to reduce the number of symbolic address calculations by using Modified: head/contrib/gcc/doc/invoke.texi ============================================================================== --- head/contrib/gcc/doc/invoke.texi Thu Jul 30 14:20:36 2015 (r286073) +++ head/contrib/gcc/doc/invoke.texi Thu Jul 30 14:31:09 2015 (r286074) @@ -331,7 +331,7 @@ in the following sections. -fsched2-use-superblocks @gol -fsched2-use-traces -fsee -freschedule-modulo-scheduled-loops @gol -fsection-anchors -fsignaling-nans -fsingle-precision-constant @gol --fstack-protector -fstack-protector-all @gol +-fstack-protector -fstack-protector-all -fstack-protector-strong @gol -fstrict-aliasing -fstrict-overflow -ftracer -fthread-jumps @gol -funroll-all-loops -funroll-loops -fpeel-loops @gol -fsplit-ivs-in-unroller -funswitch-loops @gol @@ -5810,6 +5810,11 @@ If a guard check fails, an error message @item -fstack-protector-all Like @option{-fstack-protector} except that all functions are protected. +@item -fstack-protector-strong +Like @option{-fstack-protector} but includes additional functions to +be protected --- those that have local array definitions, or have +references to local frame addresses. + @item -fsection-anchors @opindex fsection-anchors Try to reduce the number of symbolic address calculations by using Modified: head/contrib/gcc/gcc.c ============================================================================== --- head/contrib/gcc/gcc.c Thu Jul 30 14:20:36 2015 (r286073) +++ head/contrib/gcc/gcc.c Thu Jul 30 14:31:09 2015 (r286074) @@ -680,7 +680,7 @@ proper position among the other output f #ifdef TARGET_LIBC_PROVIDES_SSP #define LINK_SSP_SPEC "%{fstack-protector:}" #else -#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-all:-lssp_nonshared -lssp}" +#define LINK_SSP_SPEC "%{fstack-protector|fstack-protector-strong|fstack-protector-all:-lssp_nonshared -lssp}" #endif #endif From owner-svn-src-all@freebsd.org Thu Jul 30 14:44:15 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02E0C9AF8A4; Thu, 30 Jul 2015 14:44:15 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E80B9F95; Thu, 30 Jul 2015 14:44:14 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UEiEBs075345; Thu, 30 Jul 2015 14:44:14 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UEiEgO075343; Thu, 30 Jul 2015 14:44:14 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201507301444.t6UEiEgO075343@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Thu, 30 Jul 2015 14:44:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-svnadmin@freebsd.org Subject: svn commit: r286075 - svnadmin/conf X-SVN-Group: svnadmin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 14:44:15 -0000 Author: bapt Date: Thu Jul 30 14:44:13 2015 New Revision: 286075 URL: https://svnweb.freebsd.org/changeset/base/286075 Log: Add Allan Jude as a new src committer. marcel@ and I will be mentoring him Approved by: core Modified: svnadmin/conf/access svnadmin/conf/mentors Modified: svnadmin/conf/access ============================================================================== --- svnadmin/conf/access Thu Jul 30 14:31:09 2015 (r286074) +++ svnadmin/conf/access Thu Jul 30 14:44:13 2015 (r286075) @@ -23,6 +23,7 @@ adrian ae agc akiyama +allanjude alc alfred ambrisko Modified: svnadmin/conf/mentors ============================================================================== --- svnadmin/conf/mentors Thu Jul 30 14:31:09 2015 (r286074) +++ svnadmin/conf/mentors Thu Jul 30 14:44:13 2015 (r286075) @@ -12,6 +12,7 @@ # Mentee Mentor Optional comment achim scottl Co-mentor: emaste agc scottl Co-mentor: emax +allanjude bapt Co-mentor: marcel benl philip Co-mentor: simon carl jimharris cem markj From owner-svn-src-all@freebsd.org Thu Jul 30 15:28:07 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 631579AFF14; Thu, 30 Jul 2015 15:28:07 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 53D2293E; Thu, 30 Jul 2015 15:28:07 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UFS7VA091540; Thu, 30 Jul 2015 15:28:07 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UFS7oo091539; Thu, 30 Jul 2015 15:28:07 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201507301528.t6UFS7oo091539@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: Roger Pau Monné Date: Thu, 30 Jul 2015 15:28:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286076 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 15:28:07 -0000 Author: royger Date: Thu Jul 30 15:28:06 2015 New Revision: 286076 URL: https://svnweb.freebsd.org/changeset/base/286076 Log: vfs: fix off-by-one error in vfs_buf_check_mapped The check added in r285872 can trigger for valid buffers if the buffer space used happens to be just after unmapped_buf in KVA space. Discussed with: kib Sponsored by: Citrix Systems R&D Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Thu Jul 30 14:44:13 2015 (r286075) +++ head/sys/kern/vfs_bio.c Thu Jul 30 15:28:06 2015 (r286076) @@ -955,7 +955,7 @@ vfs_buf_check_mapped(struct buf *bp) ("mapped buf: b_kvabase was not updated %p", bp)); KASSERT(bp->b_data != unmapped_buf, ("mapped buf: b_data was not updated %p", bp)); - KASSERT(bp->b_data < unmapped_buf || bp->b_data > unmapped_buf + + KASSERT(bp->b_data < unmapped_buf || bp->b_data => unmapped_buf + MAXPHYS, ("b_data + b_offset unmapped %p", bp)); } From owner-svn-src-all@freebsd.org Thu Jul 30 15:43:27 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1B7A9AE48E; Thu, 30 Jul 2015 15:43:27 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 927FD147C; Thu, 30 Jul 2015 15:43:27 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UFhRRP099381; Thu, 30 Jul 2015 15:43:27 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UFhRoK099380; Thu, 30 Jul 2015 15:43:27 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201507301543.t6UFhRoK099380@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: Roger Pau Monné Date: Thu, 30 Jul 2015 15:43:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286077 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 15:43:27 -0000 Author: royger Date: Thu Jul 30 15:43:26 2015 New Revision: 286077 URL: https://svnweb.freebsd.org/changeset/base/286077 Log: vfs: fill fallout from r286076 This right operator is >= not =>. Reported by: cem Modified: head/sys/kern/vfs_bio.c Modified: head/sys/kern/vfs_bio.c ============================================================================== --- head/sys/kern/vfs_bio.c Thu Jul 30 15:28:06 2015 (r286076) +++ head/sys/kern/vfs_bio.c Thu Jul 30 15:43:26 2015 (r286077) @@ -955,7 +955,7 @@ vfs_buf_check_mapped(struct buf *bp) ("mapped buf: b_kvabase was not updated %p", bp)); KASSERT(bp->b_data != unmapped_buf, ("mapped buf: b_data was not updated %p", bp)); - KASSERT(bp->b_data < unmapped_buf || bp->b_data => unmapped_buf + + KASSERT(bp->b_data < unmapped_buf || bp->b_data >= unmapped_buf + MAXPHYS, ("b_data + b_offset unmapped %p", bp)); } From owner-svn-src-all@freebsd.org Thu Jul 30 15:47:55 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 664219AE532; Thu, 30 Jul 2015 15:47:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 37F8D1660; Thu, 30 Jul 2015 15:47:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UFlt0Y099638; Thu, 30 Jul 2015 15:47:55 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UFlsJx099636; Thu, 30 Jul 2015 15:47:54 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201507301547.t6UFlsJx099636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 30 Jul 2015 15:47:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286078 - in head/sys: amd64/include i386/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 15:47:55 -0000 Author: kib Date: Thu Jul 30 15:47:53 2015 New Revision: 286078 URL: https://svnweb.freebsd.org/changeset/base/286078 Log: Improve comments. Submitted by: bde MFC after: 2 weeks Modified: head/sys/amd64/include/atomic.h head/sys/i386/include/atomic.h Modified: head/sys/amd64/include/atomic.h ============================================================================== --- head/sys/amd64/include/atomic.h Thu Jul 30 15:43:26 2015 (r286077) +++ head/sys/amd64/include/atomic.h Thu Jul 30 15:47:53 2015 (r286078) @@ -272,10 +272,10 @@ atomic_testandset_long(volatile u_long * * addresses, so we need a Store/Load barrier for sequentially * consistent fences in SMP kernels. We use "lock addl $0,mem" for a * Store/Load barrier, as recommended by the AMD Software Optimization - * Guide, and not mfence. In the kernel, we use a private per-cpu - * cache line as the target for the locked addition, to avoid - * introducing false data dependencies. In user space, we use a word - * in the stack's red zone (-8(%rsp)). + * Guide, and not mfence. To avoid false data dependencies, we use a + * special address for "mem". In the kernel, we use a private per-cpu + * cache line. In user space, we use a word in the stack's red zone + * (-8(%rsp)). * * For UP kernels, however, the memory of the single processor is * always consistent, so we only need to stop the compiler from Modified: head/sys/i386/include/atomic.h ============================================================================== --- head/sys/i386/include/atomic.h Thu Jul 30 15:43:26 2015 (r286077) +++ head/sys/i386/include/atomic.h Thu Jul 30 15:47:53 2015 (r286078) @@ -259,9 +259,9 @@ atomic_testandset_int(volatile u_int *p, * consistent fences in SMP kernels. We use "lock addl $0,mem" for a * Store/Load barrier, as recommended by the AMD Software Optimization * Guide, and not mfence. In the kernel, we use a private per-cpu - * cache line as the target for the locked addition, to avoid - * introducing false data dependencies. In userspace, a word at the - * top of the stack is utilized. + * cache line for "mem", to avoid introducing false data + * dependencies. In user space, we use the word at the top of the + * stack. * * For UP kernels, however, the memory of the single processor is * always consistent, so we only need to stop the compiler from From owner-svn-src-all@freebsd.org Thu Jul 30 16:06:14 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A28B9AE8C4; Thu, 30 Jul 2015 16:06:14 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5242419E; Thu, 30 Jul 2015 16:06:14 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UG6EGK008097; Thu, 30 Jul 2015 16:06:14 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UG6E3x008096; Thu, 30 Jul 2015 16:06:14 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507301606.t6UG6E3x008096@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 30 Jul 2015 16:06:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286079 - stable/10/sys/netpfil/pf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 16:06:14 -0000 Author: gjb Date: Thu Jul 30 16:06:13 2015 New Revision: 286079 URL: https://svnweb.freebsd.org/changeset/base/286079 Log: MFC r285999 (kp): pf: Always initialise pf_fragment.fr_flags When we allocate the struct pf_fragment in pf_fillup_fragment() we forgot to initialise the fr_flags field. As a result we sometimes mistakenly thought the fragment to not be a buffered fragment. This resulted in panics because we'd end up freeing the pf_fragment but not removing it from V_pf_fragqueue (believing it to be part of V_pf_cachequeue). The next time we iterated V_pf_fragqueue we'd use a freed object and panic. While here also fix a pf_fragment use after free in pf_normalize_ip(). pf_reassemble() frees the pf_fragment, so we can't use it any more. X-MFS-To: releng/10.2 Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/netpfil/pf/pf_norm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netpfil/pf/pf_norm.c ============================================================================== --- stable/10/sys/netpfil/pf/pf_norm.c Thu Jul 30 15:47:53 2015 (r286078) +++ stable/10/sys/netpfil/pf/pf_norm.c Thu Jul 30 16:06:13 2015 (r286079) @@ -433,6 +433,7 @@ pf_fillup_fragment(struct pf_fragment_cm } *(struct pf_fragment_cmp *)frag = *key; + frag->fr_flags = 0; frag->fr_timeout = time_second; frag->fr_maxlen = frent->fe_len; TAILQ_INIT(&frag->fr_queue); @@ -1298,9 +1299,6 @@ pf_normalize_ip(struct mbuf **m0, int di } } #endif - if (frag != NULL && (frag->fr_flags & PFFRAG_DROP)) - goto drop; - h = mtod(m, struct ip *); } else { /* non-buffering fragment cache (drops or masks overlaps) */ From owner-svn-src-all@freebsd.org Thu Jul 30 16:17:45 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CBB29AEAD7; Thu, 30 Jul 2015 16:17:45 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0D6D09E7; Thu, 30 Jul 2015 16:17:45 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UGHit2012201; Thu, 30 Jul 2015 16:17:44 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UGHiBh012200; Thu, 30 Jul 2015 16:17:44 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201507301617.t6UGHiBh012200@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Thu, 30 Jul 2015 16:17:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286080 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 16:17:45 -0000 Author: andrew Date: Thu Jul 30 16:17:44 2015 New Revision: 286080 URL: https://svnweb.freebsd.org/changeset/base/286080 Log: Add enough of pmap_page_set_memattr to run gstat. It still needs to split the DMAP 1G pages so we set the attributes only on the specified page. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/pmap.c Modified: head/sys/arm64/arm64/pmap.c ============================================================================== --- head/sys/arm64/arm64/pmap.c Thu Jul 30 16:06:13 2015 (r286079) +++ head/sys/arm64/arm64/pmap.c Thu Jul 30 16:17:44 2015 (r286080) @@ -2971,7 +2971,17 @@ void pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma) { - panic("ARM64TODO: pmap_page_set_memattr"); + m->md.pv_memattr = ma; + + /* + * ARM64TODO: Implement the below (from the amd64 pmap) + * If "m" is a normal page, update its direct mapping. This update + * can be relied upon to perform any cache operations that are + * required for data coherence. + */ + if ((m->flags & PG_FICTITIOUS) == 0 && + PHYS_IN_DMAP(VM_PAGE_TO_PHYS(m))) + panic("ARM64TODO: pmap_page_set_memattr"); } /* From owner-svn-src-all@freebsd.org Thu Jul 30 17:02:24 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79D8B9AF2A8; Thu, 30 Jul 2015 17:02:24 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A8B31F30; Thu, 30 Jul 2015 17:02:24 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UH2OFo032082; Thu, 30 Jul 2015 17:02:24 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UH2Oqc032081; Thu, 30 Jul 2015 17:02:24 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201507301702.t6UH2Oqc032081@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Thu, 30 Jul 2015 17:02:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286081 - head/share/misc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 17:02:24 -0000 Author: allanjude Date: Thu Jul 30 17:02:23 2015 New Revision: 286081 URL: https://svnweb.freebsd.org/changeset/base/286081 Log: Updat the committers graph Approved by: marcel (mentor) Differential Revision: https://reviews.freebsd.org/D3251 Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Thu Jul 30 16:17:44 2015 (r286080) +++ head/share/misc/committers-src.dot Thu Jul 30 17:02:23 2015 (r286081) @@ -106,6 +106,7 @@ adrian [label="Adrian Chadd\nadrian@Free ae [label="Andrey V. Elsukov\nae@FreeBSD.org\n2010/06/03"] akiyama [label="Shunsuke Akiyama\nakiyama@FreeBSD.org\n2000/06/19"] alc [label="Alan Cox\nalc@FreeBSD.org\n1999/02/23"] +allanjude [label="Allan Jude\nallanjude@FreeBSD.org\n2015/07/30"] ambrisko [label="Doug Ambrisko\nambrisko@FreeBSD.org\n2001/12/19"] anchie [label="Ana Kukec\nanchie@FreeBSD.org\n2010/04/14"] andre [label="Andre Oppermann\nandre@FreeBSD.org\n2003/11/12"] @@ -346,6 +347,7 @@ avg -> art avg -> pluknet avg -> smh +bapt -> allanjude bapt -> bdrewery benno -> grehan @@ -572,6 +574,7 @@ kib -> zont kmacy -> lstewart +marcel -> allanjude marcel -> art marcel -> arun marcel -> marius From owner-svn-src-all@freebsd.org Thu Jul 30 17:04:17 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 794E59AF355; Thu, 30 Jul 2015 17:04:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 67594262; Thu, 30 Jul 2015 17:04:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UH4HTP032352; Thu, 30 Jul 2015 17:04:17 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UH4G3o032348; Thu, 30 Jul 2015 17:04:16 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201507301704.t6UH4G3o032348@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Thu, 30 Jul 2015 17:04:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286082 - in stable/10: contrib/libarchive/libarchive contrib/libarchive/libarchive/test lib/libarchive/test X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 17:04:17 -0000 Author: bdrewery Date: Thu Jul 30 17:04:15 2015 New Revision: 286082 URL: https://svnweb.freebsd.org/changeset/base/286082 Log: MFC r285972: MFV r285970: Apply upstream changeset bf4f6ec64e: Fix issue 356: properly skip a sparse file entry in a tar file. PR: 201506 Relnotes: yes Added: stable/10/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.c - copied unchanged from r285972, head/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.c stable/10/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu - copied unchanged from r285972, head/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu Modified: stable/10/contrib/libarchive/libarchive/archive_read_support_format_tar.c stable/10/lib/libarchive/test/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/libarchive/libarchive/archive_read_support_format_tar.c ============================================================================== --- stable/10/contrib/libarchive/libarchive/archive_read_support_format_tar.c Thu Jul 30 17:02:23 2015 (r286081) +++ stable/10/contrib/libarchive/libarchive/archive_read_support_format_tar.c Thu Jul 30 17:04:15 2015 (r286082) @@ -585,13 +585,23 @@ static int archive_read_format_tar_skip(struct archive_read *a) { int64_t bytes_skipped; + int64_t request; + struct sparse_block *p; struct tar* tar; tar = (struct tar *)(a->format->data); - bytes_skipped = __archive_read_consume(a, - tar->entry_bytes_remaining + tar->entry_padding + - tar->entry_bytes_unconsumed); + /* Do not consume the hole of a sparse file. */ + request = 0; + for (p = tar->sparse_list; p != NULL; p = p->next) { + if (!p->hole) + request += p->remaining; + } + if (request > tar->entry_bytes_remaining) + request = tar->entry_bytes_remaining; + request += tar->entry_padding + tar->entry_bytes_unconsumed; + + bytes_skipped = __archive_read_consume(a, request); if (bytes_skipped < 0) return (ARCHIVE_FATAL); Copied: stable/10/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.c (from r285972, head/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.c Thu Jul 30 17:04:15 2015 (r286082, copy of r285972, head/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.c) @@ -0,0 +1,135 @@ +/*- + * Copyright (c) 2014 Michihiro NAKAJIMA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD"); + +/* + * To test skip a sparse file entry, this test does not read file data. + */ +DEFINE_TEST(test_read_format_gtar_sparse_skip_entry) +{ +#ifndef __FreeBSD__ /* Backport test. */ + const char *refname = "test_read_format_gtar_sparse_skip_entry.tar.Z.uu"; +#else + const char *refname = "test_read_format_gtar_sparse_skip_entry.tar.Z"; +#endif + struct archive *a; + struct archive_entry *ae; + const void *p; + size_t s; + int64_t o; + +#ifndef __FreeBSD__ /* Backport test. */ + copy_reference_file(refname); +#else + extract_reference_file(refname); +#endif + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_filename(a, refname, 10240)); + + /* Verify regular first file. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("a", archive_entry_pathname(ae)); + assertEqualInt(10737418244, archive_entry_size(ae)); +#ifndef __FreeBSD__ /* Backport test. */ + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), + ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); +#endif + + /* Verify regular second file. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("b", archive_entry_pathname(ae)); + assertEqualInt(4, archive_entry_size(ae)); +#ifndef __FreeBSD__ /* Backport test. */ + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), + ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); +#endif + + + /* End of archive. */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + /* Verify archive format. */ + assertEqualIntA(a, ARCHIVE_FILTER_COMPRESS, archive_filter_code(a, 0)); + assertEqualIntA(a, ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE, + archive_format(a)); + + /* Close the archive. */ + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + + + /* + * Read just one block of a sparse file and skip it. + */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_filename(a, refname, 10240)); + + /* Verify regular first file. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("a", archive_entry_pathname(ae)); + assertEqualInt(10737418244, archive_entry_size(ae)); +#ifndef __FreeBSD__ /* Backport test. */ + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), + ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); +#endif + assertEqualInt(0, archive_read_data_block(a, &p, &s, &o)); + assertEqualInt(4096, s); + assertEqualInt(0, o); + + + /* Verify regular second file. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("b", archive_entry_pathname(ae)); + assertEqualInt(4, archive_entry_size(ae)); +#ifndef __FreeBSD__ /* Backport test. */ + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), + ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); +#endif + + + /* End of archive. */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + /* Verify archive format. */ + assertEqualIntA(a, ARCHIVE_FILTER_COMPRESS, archive_filter_code(a, 0)); + assertEqualIntA(a, ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE, + archive_format(a)); + + /* Close the archive. */ + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} + Copied: stable/10/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu (from r285972, head/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu Thu Jul 30 17:04:15 2015 (r286082, copy of r285972, head/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu) @@ -0,0 +1,15 @@ +begin 644 - +M'YV04,+@05(F#)DRBD:;,V!@T8-6)NE&'#10T<-#;>R(%CAEV28_3R9?LW\(P8-F[`<#%C +M)@T<->#6>`PBC.2^E07;J#'#Q>J-F5DJ<`GBB),J+N;`<3JGC(LV8=2\D<-V +M]DO;N'7S]MTFC9OA/6#,CE'[=N[=$V +M9]RY=212"9YD1EOO*&`DE!&*>645%9IY9589JGE +MEEQVZ>678(8IYIADEFGFF6BFJ>::;+;IYIMPQBGGG'36:>>=>.:IYYY\]NGG +MGX`&*NB@A!9JJ)YB](D@1PZ>U&B#*468484RT11###7<8!8(&-)4PX=^DN@4 +B5%*E6.J*746JTHN'2LFDDZW&*NNLM-9JZZVXYJKKKKR&!0`` +` +end Modified: stable/10/lib/libarchive/test/Makefile ============================================================================== --- stable/10/lib/libarchive/test/Makefile Thu Jul 30 17:02:23 2015 (r286081) +++ stable/10/lib/libarchive/test/Makefile Thu Jul 30 17:04:15 2015 (r286082) @@ -121,6 +121,7 @@ TESTS= \ test_read_format_gtar_gz.c \ test_read_format_gtar_lzma.c \ test_read_format_gtar_sparse.c \ + test_read_format_gtar_sparse_skip_entry.c \ test_read_format_iso_Z.c \ test_read_format_iso_multi_extent.c \ test_read_format_iso_xorriso.c \ From owner-svn-src-all@freebsd.org Thu Jul 30 17:06:29 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 268629AF3FC; Thu, 30 Jul 2015 17:06:29 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 174A081B; Thu, 30 Jul 2015 17:06:29 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UH6SQW032545; Thu, 30 Jul 2015 17:06:28 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UH6Sn4032544; Thu, 30 Jul 2015 17:06:28 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507301706.t6UH6Sn4032544@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 30 Jul 2015 17:06:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r286083 - releng/10.2/sys/netpfil/pf X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 17:06:29 -0000 Author: gjb Date: Thu Jul 30 17:06:28 2015 New Revision: 286083 URL: https://svnweb.freebsd.org/changeset/base/286083 Log: MFS 286079: MFC r285999 (kp): pf: Always initialise pf_fragment.fr_flags When we allocate the struct pf_fragment in pf_fillup_fragment() we forgot to initialise the fr_flags field. As a result we sometimes mistakenly thought the fragment to not be a buffered fragment. This resulted in panics because we'd end up freeing the pf_fragment but not removing it from V_pf_fragqueue (believing it to be part of V_pf_cachequeue). The next time we iterated V_pf_fragqueue we'd use a freed object and panic. While here also fix a pf_fragment use after free in pf_normalize_ip(). pf_reassemble() frees the pf_fragment, so we can't use it any more. Approved by: re (glebius) Sponsored by: The FreeBSD Foundation Modified: releng/10.2/sys/netpfil/pf/pf_norm.c Directory Properties: releng/10.2/ (props changed) Modified: releng/10.2/sys/netpfil/pf/pf_norm.c ============================================================================== --- releng/10.2/sys/netpfil/pf/pf_norm.c Thu Jul 30 17:04:15 2015 (r286082) +++ releng/10.2/sys/netpfil/pf/pf_norm.c Thu Jul 30 17:06:28 2015 (r286083) @@ -433,6 +433,7 @@ pf_fillup_fragment(struct pf_fragment_cm } *(struct pf_fragment_cmp *)frag = *key; + frag->fr_flags = 0; frag->fr_timeout = time_second; frag->fr_maxlen = frent->fe_len; TAILQ_INIT(&frag->fr_queue); @@ -1298,9 +1299,6 @@ pf_normalize_ip(struct mbuf **m0, int di } } #endif - if (frag != NULL && (frag->fr_flags & PFFRAG_DROP)) - goto drop; - h = mtod(m, struct ip *); } else { /* non-buffering fragment cache (drops or masks overlaps) */ From owner-svn-src-all@freebsd.org Thu Jul 30 18:00:39 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7BCD29AFBEF; Thu, 30 Jul 2015 18:00:39 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A3481FB2; Thu, 30 Jul 2015 18:00:39 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UI0dIU056530; Thu, 30 Jul 2015 18:00:39 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UI0cB2056318; Thu, 30 Jul 2015 18:00:38 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201507301800.t6UI0cB2056318@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Thu, 30 Jul 2015 18:00:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r286084 - in releng/10.2: contrib/libarchive/libarchive contrib/libarchive/libarchive/test lib/libarchive/test X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 18:00:39 -0000 Author: bdrewery Date: Thu Jul 30 18:00:37 2015 New Revision: 286084 URL: https://svnweb.freebsd.org/changeset/base/286084 Log: MFS r286082: MFC r285972: MFV r285970: Apply upstream changeset bf4f6ec64e: Fix issue 356: properly skip a sparse file entry in a tar file. PR: 201506 Relnotes: yes Approved by: re (gjb) Added: releng/10.2/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.c - copied unchanged from r286082, stable/10/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.c releng/10.2/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu - copied unchanged from r286082, stable/10/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu Modified: releng/10.2/contrib/libarchive/libarchive/archive_read_support_format_tar.c releng/10.2/lib/libarchive/test/Makefile Directory Properties: releng/10.2/ (props changed) Modified: releng/10.2/contrib/libarchive/libarchive/archive_read_support_format_tar.c ============================================================================== --- releng/10.2/contrib/libarchive/libarchive/archive_read_support_format_tar.c Thu Jul 30 17:06:28 2015 (r286083) +++ releng/10.2/contrib/libarchive/libarchive/archive_read_support_format_tar.c Thu Jul 30 18:00:37 2015 (r286084) @@ -585,13 +585,23 @@ static int archive_read_format_tar_skip(struct archive_read *a) { int64_t bytes_skipped; + int64_t request; + struct sparse_block *p; struct tar* tar; tar = (struct tar *)(a->format->data); - bytes_skipped = __archive_read_consume(a, - tar->entry_bytes_remaining + tar->entry_padding + - tar->entry_bytes_unconsumed); + /* Do not consume the hole of a sparse file. */ + request = 0; + for (p = tar->sparse_list; p != NULL; p = p->next) { + if (!p->hole) + request += p->remaining; + } + if (request > tar->entry_bytes_remaining) + request = tar->entry_bytes_remaining; + request += tar->entry_padding + tar->entry_bytes_unconsumed; + + bytes_skipped = __archive_read_consume(a, request); if (bytes_skipped < 0) return (ARCHIVE_FATAL); Copied: releng/10.2/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.c (from r286082, stable/10/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ releng/10.2/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.c Thu Jul 30 18:00:37 2015 (r286084, copy of r286082, stable/10/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.c) @@ -0,0 +1,135 @@ +/*- + * Copyright (c) 2014 Michihiro NAKAJIMA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD"); + +/* + * To test skip a sparse file entry, this test does not read file data. + */ +DEFINE_TEST(test_read_format_gtar_sparse_skip_entry) +{ +#ifndef __FreeBSD__ /* Backport test. */ + const char *refname = "test_read_format_gtar_sparse_skip_entry.tar.Z.uu"; +#else + const char *refname = "test_read_format_gtar_sparse_skip_entry.tar.Z"; +#endif + struct archive *a; + struct archive_entry *ae; + const void *p; + size_t s; + int64_t o; + +#ifndef __FreeBSD__ /* Backport test. */ + copy_reference_file(refname); +#else + extract_reference_file(refname); +#endif + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_filename(a, refname, 10240)); + + /* Verify regular first file. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("a", archive_entry_pathname(ae)); + assertEqualInt(10737418244, archive_entry_size(ae)); +#ifndef __FreeBSD__ /* Backport test. */ + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), + ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); +#endif + + /* Verify regular second file. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("b", archive_entry_pathname(ae)); + assertEqualInt(4, archive_entry_size(ae)); +#ifndef __FreeBSD__ /* Backport test. */ + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), + ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); +#endif + + + /* End of archive. */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + /* Verify archive format. */ + assertEqualIntA(a, ARCHIVE_FILTER_COMPRESS, archive_filter_code(a, 0)); + assertEqualIntA(a, ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE, + archive_format(a)); + + /* Close the archive. */ + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + + + /* + * Read just one block of a sparse file and skip it. + */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_filename(a, refname, 10240)); + + /* Verify regular first file. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("a", archive_entry_pathname(ae)); + assertEqualInt(10737418244, archive_entry_size(ae)); +#ifndef __FreeBSD__ /* Backport test. */ + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), + ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); +#endif + assertEqualInt(0, archive_read_data_block(a, &p, &s, &o)); + assertEqualInt(4096, s); + assertEqualInt(0, o); + + + /* Verify regular second file. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("b", archive_entry_pathname(ae)); + assertEqualInt(4, archive_entry_size(ae)); +#ifndef __FreeBSD__ /* Backport test. */ + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), + ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); +#endif + + + /* End of archive. */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + /* Verify archive format. */ + assertEqualIntA(a, ARCHIVE_FILTER_COMPRESS, archive_filter_code(a, 0)); + assertEqualIntA(a, ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE, + archive_format(a)); + + /* Close the archive. */ + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} + Copied: releng/10.2/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu (from r286082, stable/10/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ releng/10.2/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu Thu Jul 30 18:00:37 2015 (r286084, copy of r286082, stable/10/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu) @@ -0,0 +1,15 @@ +begin 644 - +M'YV04,+@05(F#)DRBD:;,V!@T8-6)NE&'#10T<-#;>R(%CAEV28_3R9?LW\(P8-F[`<#%C +M)@T<->#6>`PBC.2^E07;J#'#Q>J-F5DJ<`GBB),J+N;`<3JGC(LV8=2\D<-V +M]DO;N'7S]MTFC9OA/6#,CE'[=N[=$V +M9]RY=212"9YD1EOO*&`DE!&*>645%9IY9589JGE +MEEQVZ>678(8IYIADEFGFF6BFJ>::;+;IYIMPQBGGG'36:>>=>.:IYYY\]NGG +MGX`&*NB@A!9JJ)YB](D@1PZ>U&B#*468484RT11###7<8!8(&-)4PX=^DN@4 +B5%*E6.J*746JTHN'2LFDDZW&*NNLM-9JZZVXYJKKKKR&!0`` +` +end Modified: releng/10.2/lib/libarchive/test/Makefile ============================================================================== --- releng/10.2/lib/libarchive/test/Makefile Thu Jul 30 17:06:28 2015 (r286083) +++ releng/10.2/lib/libarchive/test/Makefile Thu Jul 30 18:00:37 2015 (r286084) @@ -121,6 +121,7 @@ TESTS= \ test_read_format_gtar_gz.c \ test_read_format_gtar_lzma.c \ test_read_format_gtar_sparse.c \ + test_read_format_gtar_sparse_skip_entry.c \ test_read_format_iso_Z.c \ test_read_format_iso_multi_extent.c \ test_read_format_iso_xorriso.c \ From owner-svn-src-all@freebsd.org Thu Jul 30 18:08:09 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 215219AFDF2; Thu, 30 Jul 2015 18:08:09 +0000 (UTC) (envelope-from rodrigc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1205B8C0; Thu, 30 Jul 2015 18:08:09 +0000 (UTC) (envelope-from rodrigc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UI88sl057404; Thu, 30 Jul 2015 18:08:08 GMT (envelope-from rodrigc@FreeBSD.org) Received: (from rodrigc@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UI8841057403; Thu, 30 Jul 2015 18:08:08 GMT (envelope-from rodrigc@FreeBSD.org) Message-Id: <201507301808.t6UI8841057403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rodrigc set sender to rodrigc@FreeBSD.org using -f From: Craig Rodrigues Date: Thu, 30 Jul 2015 18:08:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286085 - head/usr.bin/ipcrm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 18:08:09 -0000 Author: rodrigc Date: Thu Jul 30 18:08:08 2015 New Revision: 286085 URL: https://svnweb.freebsd.org/changeset/base/286085 Log: Make some variables and functions static. Modified: head/usr.bin/ipcrm/ipcrm.c Modified: head/usr.bin/ipcrm/ipcrm.c ============================================================================== --- head/usr.bin/ipcrm/ipcrm.c Thu Jul 30 18:00:37 2015 (r286084) +++ head/usr.bin/ipcrm/ipcrm.c Thu Jul 30 18:08:08 2015 (r286085) @@ -50,18 +50,11 @@ __FBSDID("$FreeBSD$"); #include "ipc.h" -int signaled; -int errflg; -int rmverbose = 0; - -void usage(void); - -int msgrm(key_t, int); -int shmrm(key_t, int); -int semrm(key_t, int); -void not_configured(int); +static int signaled; +static int errflg; +static int rmverbose = 0; -void +static void usage(void) { @@ -72,7 +65,7 @@ usage(void) exit(1); } -int +static int msgrm(key_t key, int id) { @@ -113,7 +106,7 @@ msgrm(key_t key, int id) return msgctl(id, IPC_RMID, NULL); } -int +static int shmrm(key_t key, int id) { @@ -154,7 +147,7 @@ shmrm(key_t key, int id) return shmctl(id, IPC_RMID, NULL); } -int +static int semrm(key_t key, int id) { union semun arg; @@ -196,7 +189,7 @@ semrm(key_t key, int id) return semctl(id, 0, IPC_RMID, arg); } -void +static void not_configured(int signo __unused) { From owner-svn-src-all@freebsd.org Thu Jul 30 18:28:36 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 741CD9AB236; Thu, 30 Jul 2015 18:28:36 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57E56140F; Thu, 30 Jul 2015 18:28:36 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UISaYR065545; Thu, 30 Jul 2015 18:28:36 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UISZxv065540; Thu, 30 Jul 2015 18:28:35 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201507301828.t6UISZxv065540@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 30 Jul 2015 18:28:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286086 - head/sys/vm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 18:28:36 -0000 Author: kib Date: Thu Jul 30 18:28:34 2015 New Revision: 286086 URL: https://svnweb.freebsd.org/changeset/base/286086 Log: Do not pretend that vm_fault(9) supports unwiring the address. Rename the VM_FAULT_CHANGE_WIRING flag to VM_FAULT_WIRE. Assert that the flag is only passed when faulting on the wired map entry. Remove the vm_page_unwire() call, which should be never reachable. Since VM_FAULT_WIRE flag implies wired map entry, the TRYPAGER() macro is reduced to the testing of the fs.object having a default pager. Inline the check. Suggested and reviewed by: alc Tested by: pho (previous version) MFC after: 1 week Modified: head/sys/vm/vm_fault.c head/sys/vm/vm_map.c head/sys/vm/vm_map.h Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Thu Jul 30 18:08:08 2015 (r286085) +++ head/sys/vm/vm_fault.c Thu Jul 30 18:28:34 2015 (r286086) @@ -193,7 +193,7 @@ vm_fault_dirty(vm_map_entry_t entry, vm_ VM_OBJECT_ASSERT_LOCKED(m->object); need_dirty = ((fault_type & VM_PROT_WRITE) != 0 && - (fault_flags & VM_FAULT_CHANGE_WIRING) == 0) || + (fault_flags & VM_FAULT_WIRE) == 0) || (fault_flags & VM_FAULT_DIRTY) != 0; if (set_wd) @@ -244,15 +244,6 @@ vm_fault_dirty(vm_map_entry_t entry, vm_ } /* - * TRYPAGER - used by vm_fault to calculate whether the pager for the - * current object *might* contain the page. - * - * default objects are zero-fill, there is no real pager. - */ -#define TRYPAGER (fs.object->type != OBJT_DEFAULT && \ - ((fault_flags & VM_FAULT_CHANGE_WIRING) == 0 || wired)) - -/* * vm_fault: * * Handle a page fault occurring at the given address, @@ -361,9 +352,12 @@ RetryFault:; if (wired) fault_type = prot | (fault_type & VM_PROT_COPY); + else + KASSERT((fault_flags & VM_FAULT_WIRE) == 0, + ("!wired && VM_FAULT_WIRE")); if (fs.vp == NULL /* avoid locked vnode leak */ && - (fault_flags & (VM_FAULT_CHANGE_WIRING | VM_FAULT_DIRTY)) == 0 && + (fault_flags & (VM_FAULT_WIRE | VM_FAULT_DIRTY)) == 0 && /* avoid calling vm_object_set_writeable_dirty() */ ((prot & VM_PROT_WRITE) == 0 || (fs.first_object->type != OBJT_VNODE && @@ -509,10 +503,12 @@ fast_failed: } /* - * Page is not resident, If this is the search termination + * Page is not resident. If this is the search termination * or the pager might contain the page, allocate a new page. + * Default objects are zero-fill, there is no real pager. */ - if (TRYPAGER || fs.object == fs.first_object) { + if (fs.object->type != OBJT_DEFAULT || + fs.object == fs.first_object) { if (fs.pindex >= fs.object->size) { unlock_and_deallocate(&fs); return (KERN_PROTECTION_FAILURE); @@ -556,9 +552,10 @@ readrest: * * Attempt to fault-in the page if there is a chance that the * pager has it, and potentially fault in additional pages - * at the same time. + * at the same time. For default objects simply provide + * zero-filled pages. */ - if (TRYPAGER) { + if (fs.object->type != OBJT_DEFAULT) { int rv; u_char behavior = vm_map_entry_behavior(fs.entry); @@ -873,7 +870,7 @@ vnode_locked: pmap_copy_page(fs.m, fs.first_m); fs.first_m->valid = VM_PAGE_BITS_ALL; if (wired && (fault_flags & - VM_FAULT_CHANGE_WIRING) == 0) { + VM_FAULT_WIRE) == 0) { vm_page_lock(fs.first_m); vm_page_wire(fs.first_m); vm_page_unlock(fs.first_m); @@ -994,7 +991,7 @@ vnode_locked: */ pmap_enter(fs.map->pmap, vaddr, fs.m, prot, fault_type | (wired ? PMAP_ENTER_WIRED : 0), 0); - if (faultcount != 1 && (fault_flags & VM_FAULT_CHANGE_WIRING) == 0 && + if (faultcount != 1 && (fault_flags & VM_FAULT_WIRE) == 0 && wired == 0) vm_fault_prefault(&fs, vaddr, faultcount, reqpage); VM_OBJECT_WLOCK(fs.object); @@ -1004,11 +1001,9 @@ vnode_locked: * If the page is not wired down, then put it where the pageout daemon * can find it. */ - if (fault_flags & VM_FAULT_CHANGE_WIRING) { - if (wired) - vm_page_wire(fs.m); - else - vm_page_unwire(fs.m, PQ_ACTIVE); + if ((fault_flags & VM_FAULT_WIRE) != 0) { + KASSERT(wired, ("VM_FAULT_WIRE && !wired")); + vm_page_wire(fs.m); } else vm_page_activate(fs.m); if (m_hold != NULL) { Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Thu Jul 30 18:08:08 2015 (r286085) +++ head/sys/vm/vm_map.c Thu Jul 30 18:28:34 2015 (r286086) @@ -2591,7 +2591,7 @@ vm_map_wire(vm_map_t map, vm_offset_t st * it into the physical map. */ if ((rv = vm_fault(map, faddr, VM_PROT_NONE, - VM_FAULT_CHANGE_WIRING)) != KERN_SUCCESS) + VM_FAULT_WIRE)) != KERN_SUCCESS) break; } while ((faddr += PAGE_SIZE) < saved_end); vm_map_lock(map); Modified: head/sys/vm/vm_map.h ============================================================================== --- head/sys/vm/vm_map.h Thu Jul 30 18:08:08 2015 (r286085) +++ head/sys/vm/vm_map.h Thu Jul 30 18:28:34 2015 (r286086) @@ -326,9 +326,9 @@ long vmspace_resident_count(struct vmspa /* * vm_fault option flags */ -#define VM_FAULT_NORMAL 0 /* Nothing special */ -#define VM_FAULT_CHANGE_WIRING 1 /* Change the wiring as appropriate */ -#define VM_FAULT_DIRTY 2 /* Dirty the page; use w/VM_PROT_COPY */ +#define VM_FAULT_NORMAL 0 /* Nothing special */ +#define VM_FAULT_WIRE 1 /* Wire the mapped page */ +#define VM_FAULT_DIRTY 2 /* Dirty the page; use w/VM_PROT_COPY */ /* * Initially, mappings are slightly sequential. The maximum window size must From owner-svn-src-all@freebsd.org Thu Jul 30 18:28:38 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F58B9AB240; Thu, 30 Jul 2015 18:28:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 302A81410; Thu, 30 Jul 2015 18:28:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UIScnV065586; Thu, 30 Jul 2015 18:28:38 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UIScHg065585; Thu, 30 Jul 2015 18:28:38 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201507301828.t6UIScHg065585@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 30 Jul 2015 18:28:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286087 - head/sys/ofed/drivers/infiniband/core X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 18:28:38 -0000 Author: markj Date: Thu Jul 30 18:28:37 2015 New Revision: 286087 URL: https://svnweb.freebsd.org/changeset/base/286087 Log: ib mad: fix an incorrect use of list_for_each_entry In tf_dequeue(), if we reach the end of the list without finding a non-cancelled element, "tmp" will be a pointer into the list head, so the tmp->canceled check is bogus. Use a flag instead. Submitted by: Tao Liu Reviewed by: hselasky MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D3244 Modified: head/sys/ofed/drivers/infiniband/core/mad.c Modified: head/sys/ofed/drivers/infiniband/core/mad.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/mad.c Thu Jul 30 18:28:34 2015 (r286086) +++ head/sys/ofed/drivers/infiniband/core/mad.c Thu Jul 30 18:28:37 2015 (r286087) @@ -292,6 +292,7 @@ static struct tf_entry *tf_dequeue(struc unsigned long flags; unsigned long time_left; struct tf_entry *tmp, *tmp1; + bool found = false; spin_lock_irqsave(&tf->lists_lock, flags); if (list_empty(&tf->fifo_head)) { @@ -300,11 +301,13 @@ static struct tf_entry *tf_dequeue(struc } list_for_each_entry(tmp, &tf->fifo_head, fifo_list) { - if (!tmp->canceled) + if (!tmp->canceled) { + found = true; break; + } } - if (tmp->canceled) { + if (!found) { spin_unlock_irqrestore(&tf->lists_lock, flags); return NULL; } From owner-svn-src-all@freebsd.org Thu Jul 30 18:48:43 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6832F9AB720 for ; Thu, 30 Jul 2015 18:48:43 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm3-vm0.bullet.mail.bf1.yahoo.com (nm3-vm0.bullet.mail.bf1.yahoo.com [98.139.212.154]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1A05A38F for ; Thu, 30 Jul 2015 18:48:43 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1438282115; bh=W46wo3HiMnJseqkQQyoXcA8HIE7CYUMiEbL00hR1oPw=; h=Date:From:To:Subject:References:In-Reply-To:From:Subject; b=pDthaqPD/W3hU5A2M76kGgvNnNi2UQjwoLtVzfrmQ2JXJmAcKKScZEnkE2oYGtSlUjitIMYdJJzFm7I2dCmfzGNBTLj7ewme1G7L1JB4CaV0lgrfFqeUvz0Midh5B02roChEdFVh3/tTCKj4EbBfPBEf24M/DfMXabpEsVvdMF987yN9hP0L1oWUa4fVeBrslLR4Y/4PzQBQSnzTaIv4y9T8GMaFeq1lkl+kjZy6d9NHQWCLi1nlEjO+J9P3qIOCeX+tp/xYq7m6dgPehdbYVxglXQH2mah5jh9bqbAD5qskP22i9rMVBXCB0TLFHHtVAlTSmiZ8YdQwXg5sEgP4Dg== Received: from [98.139.170.179] by nm3.bullet.mail.bf1.yahoo.com with NNFMP; 30 Jul 2015 18:48:35 -0000 Received: from [68.142.230.71] by tm22.bullet.mail.bf1.yahoo.com with NNFMP; 30 Jul 2015 18:48:35 -0000 Received: from [127.0.0.1] by smtp228.mail.bf1.yahoo.com with NNFMP; 30 Jul 2015 18:48:35 -0000 X-Yahoo-Newman-Id: 307563.2584.bm@smtp228.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 0RiOj2cVM1m2XfcW2biv223iiOyo2BBrbORKK38AQihjbOo t_xokfC2mIOfv_tn7mxBIyRhznfbCgOZAotiVXx95CXwxpVJwX.MktvI4Alt E6w7t7pWKGq6Zy.70ffQ4S3g1FJM8BbHkm7NwA5m3Ym21qFWC.5PHkPCQzj8 W2EcVqXdfRarxw_yD5YvYMWCUVa.A1rU6eXjxrOe3_vOvrUCrFgd7HRU_skA pNwnWHLZXYF2FYNRcLe6I6RGoXlvYD_iOzwSATmOnBNX9ga7uLmHcuh2PyiX cMQePl_h3NRClrFEUnfsppV3n5IQHesKH1HWUvsGMbX3k66knHpovRV.5AX3 XgBFYfUcLSXchWNWZofFEipF.8Hh80_wyKPkvbkaXxKak1C8CV5JCHeR.3F7 27TwlSSHrn3onHqbwMvsGdv44o0oofyRSmZ252eB7M_KAZen1XtywrRVTkPD .95bv8ZuoGcLLiUQQQBiU2IZMNO3w83kuJB_E2lvw1N4EcNUbV5hmY1qYLKa AEuHnMCLzHFGCHhocnfSG5gWFT3aZupFZ X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Message-ID: <55BA7189.5090004@FreeBSD.org> Date: Thu, 30 Jul 2015 13:48:41 -0500 From: Pedro Giffuni User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Ed Maste , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r286070 - in head/contrib/elftoolchain: ar elfdump References: <201507301241.t6UCftU3024427@repo.freebsd.org> In-Reply-To: <201507301241.t6UCftU3024427@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 18:48:43 -0000 Thank you! On 07/30/15 07:41, Ed Maste wrote: > Author: emaste > Date: Thu Jul 30 12:41:54 2015 > New Revision: 286070 > URL: https://svnweb.freebsd.org/changeset/base/286070 > > Log: > Add ELF Tool Chain's ar(1) and elfdump(1) to contrib > > ELF Tool Chain built on FreeBSD's ar and elfdump, but has a number of > improvements and enhancements. Bring them into contrib in order to start > integrating into our build. BTW, should we do something about brandelf(1) ? Pedro. ps. There is PR 143699. From owner-svn-src-all@freebsd.org Thu Jul 30 18:59:03 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C0E939AB996; Thu, 30 Jul 2015 18:59:03 +0000 (UTC) (envelope-from rodrigc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A4C1BD13; Thu, 30 Jul 2015 18:59:03 +0000 (UTC) (envelope-from rodrigc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UIx34M078497; Thu, 30 Jul 2015 18:59:03 GMT (envelope-from rodrigc@FreeBSD.org) Received: (from rodrigc@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UIx2LO078493; Thu, 30 Jul 2015 18:59:02 GMT (envelope-from rodrigc@FreeBSD.org) Message-Id: <201507301859.t6UIx2LO078493@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rodrigc set sender to rodrigc@FreeBSD.org using -f From: Craig Rodrigues Date: Thu, 30 Jul 2015 18:59:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286088 - in head: sys/sys usr.bin/ipcrm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 18:59:04 -0000 Author: rodrigc Date: Thu Jul 30 18:59:01 2015 New Revision: 286088 URL: https://svnweb.freebsd.org/changeset/base/286088 Log: Get function prototypes for msg, shm, sem functions from header files. Differential Revision: D2669 Modified: head/sys/sys/msg.h head/sys/sys/sem.h head/sys/sys/shm.h head/usr.bin/ipcrm/ipcrm.c Modified: head/sys/sys/msg.h ============================================================================== --- head/sys/sys/msg.h Thu Jul 30 18:28:37 2015 (r286087) +++ head/sys/sys/msg.h Thu Jul 30 18:59:01 2015 (r286088) @@ -163,8 +163,9 @@ struct msqid_kernel { struct ucred *cred; /* creator's credentials */ }; -#else /* !_KERNEL */ +#endif /* _KERNEL */ +#if !defined(_KERNEL) || defined(_WANT_MSG_PROTOTYPES) __BEGIN_DECLS int msgctl(int, int, struct msqid_ds *); int msgget(key_t, int); @@ -176,6 +177,6 @@ int msgsys(int, ...); #endif __END_DECLS -#endif /* _KERNEL */ +#endif /* !_KERNEL || _WANT_MSG_PROTOTYPES */ #endif /* !_SYS_MSG_H_ */ Modified: head/sys/sys/sem.h ============================================================================== --- head/sys/sys/sem.h Thu Jul 30 18:28:37 2015 (r286087) +++ head/sys/sys/sem.h Thu Jul 30 18:59:01 2015 (r286088) @@ -137,8 +137,9 @@ struct semid_kernel { */ void semexit(struct proc *p); -#else /* ! _KERNEL */ +#endif /* _KERNEL */ +#if !defined(_KERNEL) || defined(_WANT_SEM_PROTOTYPES) __BEGIN_DECLS #if __BSD_VISIBLE int semsys(int, ...); @@ -148,6 +149,6 @@ int semget(key_t, int, int); int semop(int, struct sembuf *, size_t); __END_DECLS -#endif /* !_KERNEL */ +#endif /* !_KERNEL || _WANT_SEM_PROTOTYPES */ #endif /* !_SYS_SEM_H_ */ Modified: head/sys/sys/shm.h ============================================================================== --- head/sys/sys/shm.h Thu Jul 30 18:28:37 2015 (r286087) +++ head/sys/sys/shm.h Thu Jul 30 18:59:01 2015 (r286088) @@ -144,8 +144,9 @@ struct vmspace; void shmexit(struct vmspace *); void shmfork(struct proc *, struct proc *); -#else /* !_KERNEL */ +#endif /* _KERNEL */ +#if !defined(_KERNEL) || defined(_WANT_SHM_PROTOTYPES) #include #ifndef _SIZE_T_DECLARED @@ -163,6 +164,6 @@ int shmctl(int, int, struct shmid_ds *); int shmdt(const void *); __END_DECLS -#endif /* !_KERNEL */ +#endif /* _KERNEL || _WANT_SHM_PROTOTYPES */ #endif /* !_SYS_SHM_H_ */ Modified: head/usr.bin/ipcrm/ipcrm.c ============================================================================== --- head/usr.bin/ipcrm/ipcrm.c Thu Jul 30 18:28:37 2015 (r286087) +++ head/usr.bin/ipcrm/ipcrm.c Thu Jul 30 18:59:01 2015 (r286088) @@ -34,6 +34,9 @@ __FBSDID("$FreeBSD$"); #include +#define _WANT_MSG_PROTOTYPES +#define _WANT_SEM_PROTOTYPES +#define _WANT_SHM_PROTOTYPES #define _KERNEL #include #include From owner-svn-src-all@freebsd.org Thu Jul 30 19:04:16 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B6999ABB0E; Thu, 30 Jul 2015 19:04:16 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3B73210E8; Thu, 30 Jul 2015 19:04:16 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UJ4Gj5082328; Thu, 30 Jul 2015 19:04:16 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UJ4FwY082326; Thu, 30 Jul 2015 19:04:15 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201507301904.t6UJ4FwY082326@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Thu, 30 Jul 2015 19:04:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286089 - in head/sys: conf dev/gpio X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 19:04:16 -0000 Author: gonzo Date: Thu Jul 30 19:04:14 2015 New Revision: 286089 URL: https://svnweb.freebsd.org/changeset/base/286089 Log: Add GPIO backlight driver compatible with Linux FDT bindings. Brightness is controlled through sysctl dev.gpiobacklight.X.brightness: - any value greater than 0: backlight is on - any value less than or equal to 0: backlight is off FDT bindings docs in Linux tree: Documentation/devicetree/bindings/video/backlight/gpio-backlight.txt Added: head/sys/dev/gpio/gpiobacklight.c (contents, props changed) Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Jul 30 18:59:01 2015 (r286088) +++ head/sys/conf/files Thu Jul 30 19:04:14 2015 (r286089) @@ -1436,6 +1436,7 @@ dev/fxp/inphy.c optional fxp dev/gem/if_gem.c optional gem dev/gem/if_gem_pci.c optional gem pci dev/gem/if_gem_sbus.c optional gem sbus +dev/gpio/gpiobacklight.c optional gpiobacklight fdt dev/gpio/gpiobus.c optional gpio \ dependency "gpiobus_if.h" dev/gpio/gpioc.c optional gpio \ Added: head/sys/dev/gpio/gpiobacklight.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/gpio/gpiobacklight.c Thu Jul 30 19:04:14 2015 (r286089) @@ -0,0 +1,211 @@ +/*- + * Copyright (c) 2015 Oleksandr Tymoshenko + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_platform.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include "gpiobus_if.h" + +/* + * Only one pin for led + */ +#define GPIOBL_PIN 0 + +#define GPIOBL_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) +#define GPIOBL_UNLOCK(_sc) mtx_unlock(&(_sc)->sc_mtx) +#define GPIOBL_LOCK_INIT(_sc) \ + mtx_init(&_sc->sc_mtx, device_get_nameunit(_sc->sc_dev), \ + "gpiobacklight", MTX_DEF) +#define GPIOBL_LOCK_DESTROY(_sc) mtx_destroy(&_sc->sc_mtx); + +struct gpiobacklight_softc +{ + device_t sc_dev; + device_t sc_busdev; + struct mtx sc_mtx; + + struct sysctl_oid *sc_oid; + int sc_brightness; +}; + +static int gpiobacklight_sysctl(SYSCTL_HANDLER_ARGS); +static void gpiobacklight_update_brightness(struct gpiobacklight_softc *); +static int gpiobacklight_probe(device_t); +static int gpiobacklight_attach(device_t); +static int gpiobacklight_detach(device_t); + +static void +gpiobacklight_update_brightness(struct gpiobacklight_softc *sc) +{ + int error; + + GPIOBL_LOCK(sc); + error = GPIOBUS_ACQUIRE_BUS(sc->sc_busdev, sc->sc_dev, + GPIOBUS_DONTWAIT); + if (error != 0) { + GPIOBL_UNLOCK(sc); + return; + } + error = GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, + GPIOBL_PIN, GPIO_PIN_OUTPUT); + if (error == 0) + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, GPIOBL_PIN, + sc->sc_brightness ? GPIO_PIN_HIGH : GPIO_PIN_LOW); + GPIOBUS_RELEASE_BUS(sc->sc_busdev, sc->sc_dev); + GPIOBL_UNLOCK(sc); +} + +static int +gpiobacklight_sysctl(SYSCTL_HANDLER_ARGS) +{ + struct gpiobacklight_softc *sc; + int error; + int brightness; + + sc = (struct gpiobacklight_softc*)arg1; + brightness = sc->sc_brightness; + error = sysctl_handle_int(oidp, &brightness, 0, req); + + if (error != 0 || req->newptr == NULL) + return (error); + + if (brightness <= 0) + sc->sc_brightness = 0; + else + sc->sc_brightness = 1; + + gpiobacklight_update_brightness(sc); + + return (error); +} + +static void +gpiobacklight_identify(driver_t *driver, device_t bus) +{ + phandle_t node, root; + + root = OF_finddevice("/"); + if (root == 0) + return; + for (node = OF_child(root); node != 0; node = OF_peer(node)) { + if (!fdt_is_compatible_strict(node, "gpio-backlight")) + continue; + ofw_gpiobus_add_fdt_child(bus, driver->name, node); + } +} + +static int +gpiobacklight_probe(device_t dev) +{ + + if (!ofw_bus_is_compatible(dev, "gpio-backlight")) + return (ENXIO); + + device_set_desc(dev, "GPIO backlight"); + + return (0); +} + +static int +gpiobacklight_attach(device_t dev) +{ + struct gpiobacklight_softc *sc; + struct sysctl_ctx_list *ctx; + struct sysctl_oid *tree; + phandle_t node; + + sc = device_get_softc(dev); + sc->sc_dev = dev; + sc->sc_busdev = device_get_parent(dev); + + if ((node = ofw_bus_get_node(dev)) == -1) + return (ENXIO); + + GPIOBL_LOCK_INIT(sc); + if (OF_hasprop(node, "default-on")) + sc->sc_brightness = 1; + else + sc->sc_brightness = 0; + + /* Init backlight interface */ + ctx = device_get_sysctl_ctx(sc->sc_dev); + tree = device_get_sysctl_tree(sc->sc_dev); + sc->sc_oid = SYSCTL_ADD_PROC(ctx, SYSCTL_CHILDREN(tree), OID_AUTO, + "brightness", CTLTYPE_INT | CTLFLAG_RW, sc, 0, + gpiobacklight_sysctl, "I", "backlight brightness"); + + gpiobacklight_update_brightness(sc); + + return (0); +} + +static int +gpiobacklight_detach(device_t dev) +{ + struct gpiobacklight_softc *sc; + + sc = device_get_softc(dev); + GPIOBL_LOCK_DESTROY(sc); + return (0); +} + +static devclass_t gpiobacklight_devclass; + +static device_method_t gpiobacklight_methods[] = { + /* Device interface */ + DEVMETHOD(device_identify, gpiobacklight_identify), + DEVMETHOD(device_probe, gpiobacklight_probe), + DEVMETHOD(device_attach, gpiobacklight_attach), + DEVMETHOD(device_detach, gpiobacklight_detach), + + DEVMETHOD_END +}; + +static driver_t gpiobacklight_driver = { + "gpiobacklight", + gpiobacklight_methods, + sizeof(struct gpiobacklight_softc), +}; + +DRIVER_MODULE(gpiobacklight, gpiobus, gpiobacklight_driver, gpiobacklight_devclass, 0, 0); From owner-svn-src-all@freebsd.org Thu Jul 30 19:08:25 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23AEF9ABB83; Thu, 30 Jul 2015 19:08:25 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 141F21465; Thu, 30 Jul 2015 19:08:25 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UJ8OGk082534; Thu, 30 Jul 2015 19:08:24 GMT (envelope-from brueffer@FreeBSD.org) Received: (from brueffer@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UJ8On1082532; Thu, 30 Jul 2015 19:08:24 GMT (envelope-from brueffer@FreeBSD.org) Message-Id: <201507301908.t6UJ8On1082532@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brueffer set sender to brueffer@FreeBSD.org using -f From: Christian Brueffer Date: Thu, 30 Jul 2015 19:08:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286090 - head/share/man/man4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 19:08:25 -0000 Author: brueffer Date: Thu Jul 30 19:08:23 2015 New Revision: 286090 URL: https://svnweb.freebsd.org/changeset/base/286090 Log: The kernel option and module are actually called pmspcv. MFC after: 3 days Modified: head/share/man/man4/Makefile head/share/man/man4/pms.4 Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Thu Jul 30 19:04:14 2015 (r286089) +++ head/share/man/man4/Makefile Thu Jul 30 19:08:23 2015 (r286090) @@ -666,6 +666,7 @@ MLINKS+=pccbb.4 cbb.4 MLINKS+=pcm.4 snd.4 \ pcm.4 sound.4 MLINKS+=pcn.4 if_pcn.4 +MLINKS+=pms.4 pmspcv.4 MLINKS+=ral.4 if_ral.4 MLINKS+=re.4 if_re.4 MLINKS+=rl.4 if_rl.4 Modified: head/share/man/man4/pms.4 ============================================================================== --- head/share/man/man4/pms.4 Thu Jul 30 19:04:14 2015 (r286089) +++ head/share/man/man4/pms.4 Thu Jul 30 19:08:23 2015 (r286090) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 29, 2015 +.Dd July 30, 2015 .Dt PMS 4 .Os .Sh NAME @@ -35,14 +35,14 @@ To compile the driver into the kernel, place the following line in the kernel configuration file: .Bd -ragged -offset indent -.Cd "device pms" +.Cd "device pmspcv" .Ed .Pp Alternatively, to load the driver as a module at boot time, place the following line in .Xr loader.conf 5 : .Bd -literal -offset indent -pms_load="YES" +pmspcv_load="YES" .Ed .Sh DESCRIPTION The From owner-svn-src-all@freebsd.org Thu Jul 30 19:11:56 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D35EA9ABDBA for ; Thu, 30 Jul 2015 19:11:56 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8C22F1C4C for ; Thu, 30 Jul 2015 19:11:56 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by wibud3 with SMTP id ud3so32587664wib.1 for ; Thu, 30 Jul 2015 12:11:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=a91Wdvc7+DWxjfqleHVqMqPk3YfVOw5gfix9LM2usdo=; b=BJEtUW0wGVF5F8qXrhjnTXd+b1ipHJImOTCwZGrXrgvY5IjdnwznIi79RnvYATFmdj MWv/byjVVxWUd5Qn2zGEk1fPCGEDnVTVkAmaf1Vb9+FgEY3oC6OtrrYzH9vo3FEisiX5 K0sh/cqb/C6Q0EBU4dDf4JEcZnuah2jk0KKb+vt3q2fI+OxZJcNZJXbtN4k7uvu/bEIW Ej58Hm4/Nzv1EiuPihh74X0TAlaXwgQ2TGoOt0G4mCXhOUJHy+DATRAKntFLJK2dGSzI IG1JxxEwOfEi5gGWMPssh49xIdQNrc25vrfFdzXoARm/j2KfQ+qSuQNlWdEErUKk2fyX U5OQ== X-Gm-Message-State: ALoCoQmykit1RDwzgX9UVHB0t62bdqNsyC2T9eQp7O6y/OD5FWvG6HNpC1uFnE4QVfdfLyfRyzSL MIME-Version: 1.0 X-Received: by 10.194.143.6 with SMTP id sa6mr2684442wjb.67.1438283514842; Thu, 30 Jul 2015 12:11:54 -0700 (PDT) Received: by 10.194.73.6 with HTTP; Thu, 30 Jul 2015 12:11:54 -0700 (PDT) In-Reply-To: <201506041941.t54JfGAA075455@svn.freebsd.org> References: <201506041941.t54JfGAA075455@svn.freebsd.org> Date: Thu, 30 Jul 2015 21:11:54 +0200 Message-ID: Subject: Re: svn commit: r283998 - in head/sys: dev/drm dev/drm2 fs/devfs kern sys vm From: Oliver Pinter To: John Baldwin Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 19:11:57 -0000 Hi John! On Thu, Jun 4, 2015 at 9:41 PM, John Baldwin wrote: > Author: jhb > Date: Thu Jun 4 19:41:15 2015 > New Revision: 283998 > URL: https://svnweb.freebsd.org/changeset/base/283998 > > Log: > Add a new file operations hook for mmap operations. File type-specific > logic is now placed in the mmap hook implementation rather than requiring > it to be placed in sys/vm/vm_mmap.c. This hook allows new file types to > support mmap() as well as potentially allowing mmap() for existing file > types that do not currently support any mapping. > > The vm_mmap() function is now split up into two functions. A new > vm_mmap_object() function handles the "back half" of vm_mmap() and accepts > a referenced VM object to map rather than a (handle, handle_type) tuple. > vm_mmap() is now reduced to converting a (handle, handle_type) tuple to a > a VM object and then calling vm_mmap_object() to handle the actual mapping. > The vm_mmap() function remains for use by other parts of the kernel > (e.g. device drivers and exec) but now only supports mapping vnodes, > character devices, and anonymous memory. > > The mmap() system call invokes vm_mmap_object() directly with a NULL object > for anonymous mappings. For mappings using a file descriptor, the > descriptors fo_mmap() hook is invoked instead. The fo_mmap() hook is > responsible for performing type-specific checks and adjustments to > arguments as well as possibly modifying mapping parameters such as flags > or the object offset. The fo_mmap() hook routines then call > vm_mmap_object() to handle the actual mapping. > > The fo_mmap() hook is optional. If it is not set, then fo_mmap() will > fail with ENODEV. A fo_mmap() hook is implemented for regular files, > character devices, and shared memory objects (created via shm_open()). > > While here, consistently use the VM_PROT_* constants for the vm_prot_t > type for the 'prot' variable passed to vm_mmap() and vm_mmap_object() > as well as the vm_mmap_vnode() and vm_mmap_cdev() helper routines. > Previously some places were using the mmap()-specific PROT_* constants > instead. While this happens to work because PROT_xx == VM_PROT_xx, > using VM_PROT_* is more correct. > > Differential Revision: https://reviews.freebsd.org/D2658 > Reviewed by: alc (glanced over), kib > MFC after: 1 month > Sponsored by: Chelsio > > Modified: > head/sys/dev/drm/drm_bufs.c > head/sys/dev/drm2/drm_bufs.c > head/sys/fs/devfs/devfs_vnops.c > head/sys/kern/subr_uio.c > head/sys/kern/uipc_shm.c > head/sys/kern/vfs_vnops.c > head/sys/sys/file.h > head/sys/sys/mman.h > head/sys/vm/vm_extern.h > head/sys/vm/vm_mmap.c > > ... patch trimmed... When plan you to MFC this change to 10-STABLE? Thank, Oliver > _______________________________________________ > svn-src-head@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" From owner-svn-src-all@freebsd.org Thu Jul 30 19:24:50 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 922359AC1E8; Thu, 30 Jul 2015 19:24:50 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 82B6B6B9; Thu, 30 Jul 2015 19:24:50 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UJOoVI090541; Thu, 30 Jul 2015 19:24:50 GMT (envelope-from hiren@FreeBSD.org) Received: (from hiren@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UJOo56090540; Thu, 30 Jul 2015 19:24:50 GMT (envelope-from hiren@FreeBSD.org) Message-Id: <201507301924.t6UJOo56090540@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hiren set sender to hiren@FreeBSD.org using -f From: Hiren Panchasara Date: Thu, 30 Jul 2015 19:24:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286091 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 19:24:50 -0000 Author: hiren Date: Thu Jul 30 19:24:49 2015 New Revision: 286091 URL: https://svnweb.freebsd.org/changeset/base/286091 Log: Update snd_una description to make it more readable. Differential Revision: https://reviews.freebsd.org/D3179 Reviewed by: gnn Sponsored by: Limelight Networks Modified: head/sys/netinet/tcp_var.h Modified: head/sys/netinet/tcp_var.h ============================================================================== --- head/sys/netinet/tcp_var.h Thu Jul 30 19:08:23 2015 (r286090) +++ head/sys/netinet/tcp_var.h Thu Jul 30 19:24:49 2015 (r286091) @@ -113,7 +113,7 @@ struct tcpcb { struct vnet *t_vnet; /* back pointer to parent vnet */ - tcp_seq snd_una; /* send unacknowledged */ + tcp_seq snd_una; /* sent but unacknowledged */ tcp_seq snd_max; /* highest sequence number sent; * used to recognize retransmits */ From owner-svn-src-all@freebsd.org Thu Jul 30 19:34:25 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CC9139AC40E; Thu, 30 Jul 2015 19:34:25 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B69A1C40; Thu, 30 Jul 2015 19:34:25 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UJYPd3094724; Thu, 30 Jul 2015 19:34:25 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UJYPoL094723; Thu, 30 Jul 2015 19:34:25 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507301934.t6UJYPoL094723@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 30 Jul 2015 19:34:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286092 - head/cddl/contrib/opensolaris/cmd/zfs X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 19:34:25 -0000 Author: gjb Date: Thu Jul 30 19:34:24 2015 New Revision: 286092 URL: https://svnweb.freebsd.org/changeset/base/286092 Log: Fix a rendering issue in the zfs(8) manual. MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jul 30 19:24:49 2015 (r286091) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Jul 30 19:34:24 2015 (r286092) @@ -27,11 +27,11 @@ .\" Copyright (c) 2013, Steven Hartland .\" Copyright (c) 2014 Nexenta Systems, Inc. All Rights Reserved. .\" Copyright (c) 2014, Xin LI -.\" Copyright (c) 2014, The FreeBSD Foundation, All Rights Reserved. +.\" Copyright (c) 2014-2015, The FreeBSD Foundation, All Rights Reserved. .\" .\" $FreeBSD$ .\" -.Dd December 12, 2014 +.Dd July 30, 2015 .Dt ZFS 8 .Os .Sh NAME @@ -938,7 +938,7 @@ not be used by any other dataset. Disabling checksums is .Em NOT a recommended practice. -.It Sy compression Ns = Ns Cm on | off | lzjb | gzip | gzip- Ns Ar N | zle | Cm lz4 +.It Sy compression Ns = Ns Cm on | off | lzjb | gzip | gzip- Ns Ar N | Cm zle | Cm lz4 Controls the compression algorithm used for this dataset. The .Cm lzjb compression algorithm is optimized for performance while providing decent data From owner-svn-src-all@freebsd.org Thu Jul 30 19:44:47 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6BDA79AC681; Thu, 30 Jul 2015 19:44:47 +0000 (UTC) (envelope-from rodrigc@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 55ED01478; Thu, 30 Jul 2015 19:44:47 +0000 (UTC) (envelope-from rodrigc@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UJilC8098926; Thu, 30 Jul 2015 19:44:47 GMT (envelope-from rodrigc@FreeBSD.org) Received: (from rodrigc@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UJilqi098925; Thu, 30 Jul 2015 19:44:47 GMT (envelope-from rodrigc@FreeBSD.org) Message-Id: <201507301944.t6UJilqi098925@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rodrigc set sender to rodrigc@FreeBSD.org using -f From: Craig Rodrigues Date: Thu, 30 Jul 2015 19:44:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286093 - head/usr.bin/ipcrm X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 19:44:47 -0000 Author: rodrigc Date: Thu Jul 30 19:44:46 2015 New Revision: 286093 URL: https://svnweb.freebsd.org/changeset/base/286093 Log: Use correct number of arguments to semctl() for IPC_RMID. PR: 118292 Submitted by: araujo Differential Revision: D2669 Modified: head/usr.bin/ipcrm/ipcrm.c Modified: head/usr.bin/ipcrm/ipcrm.c ============================================================================== --- head/usr.bin/ipcrm/ipcrm.c Thu Jul 30 19:34:24 2015 (r286092) +++ head/usr.bin/ipcrm/ipcrm.c Thu Jul 30 19:44:46 2015 (r286093) @@ -169,7 +169,7 @@ semrm(key_t key, int id) if ((kxsema[num].u.sem_perm.mode & SEM_ALLOC) != 0) { id = IXSEQ_TO_IPCID(num, kxsema[num].u.sem_perm); - if (semctl(id, IPC_RMID, NULL) < 0) { + if (semctl(id, 0, IPC_RMID, NULL) < 0) { if (rmverbose > 1) warn("semid(%d): ", id); errflg++; From owner-svn-src-all@freebsd.org Thu Jul 30 19:52:45 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7FEAA9AC886; Thu, 30 Jul 2015 19:52:45 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B64F1B44; Thu, 30 Jul 2015 19:52:45 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UJqjlW003038; Thu, 30 Jul 2015 19:52:45 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UJqiPK003032; Thu, 30 Jul 2015 19:52:44 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201507301952.t6UJqiPK003032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 30 Jul 2015 19:52:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286094 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 19:52:45 -0000 Author: mjg Date: Thu Jul 30 19:52:43 2015 New Revision: 286094 URL: https://svnweb.freebsd.org/changeset/base/286094 Log: Revert r285125 until rmlocks get fixed. Right now there is a chance that sysctl unregister will cause reader to block on the sx lock associated with sysctl rmlock, in which case kernels with debug enabled will panic. Modified: head/sys/kern/kern_linker.c head/sys/kern/kern_sysctl.c head/sys/kern/vfs_init.c head/sys/sys/sysctl.h Modified: head/sys/kern/kern_linker.c ============================================================================== --- head/sys/kern/kern_linker.c Thu Jul 30 19:44:46 2015 (r286093) +++ head/sys/kern/kern_linker.c Thu Jul 30 19:52:43 2015 (r286094) @@ -292,10 +292,10 @@ linker_file_register_sysctls(linker_file return; sx_xunlock(&kld_sx); - sysctl_wlock(); + sysctl_xlock(); for (oidp = start; oidp < stop; oidp++) sysctl_register_oid(*oidp); - sysctl_wunlock(); + sysctl_xunlock(); sx_xlock(&kld_sx); } @@ -313,10 +313,10 @@ linker_file_unregister_sysctls(linker_fi return; sx_xunlock(&kld_sx); - sysctl_wlock(); + sysctl_xlock(); for (oidp = start; oidp < stop; oidp++) sysctl_unregister_oid(*oidp); - sysctl_wunlock(); + sysctl_xunlock(); sx_xlock(&kld_sx); } Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Thu Jul 30 19:44:46 2015 (r286093) +++ head/sys/kern/kern_sysctl.c Thu Jul 30 19:52:43 2015 (r286094) @@ -54,7 +54,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -78,7 +77,7 @@ static MALLOC_DEFINE(M_SYSCTLTMP, "sysct * The sysctllock protects the MIB tree. It also protects sysctl * contexts used with dynamic sysctls. The sysctl_register_oid() and * sysctl_unregister_oid() routines require the sysctllock to already - * be held, so the sysctl_wlock() and sysctl_wunlock() routines are + * be held, so the sysctl_xlock() and sysctl_xunlock() routines are * provided for the few places in the kernel which need to use that * API rather than using the dynamic API. Use of the dynamic API is * strongly encouraged for most code. @@ -87,21 +86,20 @@ static MALLOC_DEFINE(M_SYSCTLTMP, "sysct * sysctl requests. This is implemented by serializing any userland * sysctl requests larger than a single page via an exclusive lock. */ -static struct rmlock sysctllock; +static struct sx sysctllock; static struct sx sysctlmemlock; -#define SYSCTL_WLOCK() rm_wlock(&sysctllock) -#define SYSCTL_WUNLOCK() rm_wunlock(&sysctllock) -#define SYSCTL_RLOCK(tracker) rm_rlock(&sysctllock, (tracker)) -#define SYSCTL_RUNLOCK(tracker) rm_runlock(&sysctllock, (tracker)) -#define SYSCTL_WLOCKED() rm_wowned(&sysctllock) -#define SYSCTL_ASSERT_LOCKED() rm_assert(&sysctllock, RA_LOCKED) -#define SYSCTL_ASSERT_WLOCKED() rm_assert(&sysctllock, RA_WLOCKED) -#define SYSCTL_ASSERT_RLOCKED() rm_assert(&sysctllock, RA_RLOCKED) -#define SYSCTL_INIT() rm_init_flags(&sysctllock, "sysctl lock", \ - RM_SLEEPABLE) +#define SYSCTL_XLOCK() sx_xlock(&sysctllock) +#define SYSCTL_XUNLOCK() sx_xunlock(&sysctllock) +#define SYSCTL_SLOCK() sx_slock(&sysctllock) +#define SYSCTL_SUNLOCK() sx_sunlock(&sysctllock) +#define SYSCTL_XLOCKED() sx_xlocked(&sysctllock) +#define SYSCTL_ASSERT_LOCKED() sx_assert(&sysctllock, SA_LOCKED) +#define SYSCTL_ASSERT_XLOCKED() sx_assert(&sysctllock, SA_XLOCKED) +#define SYSCTL_ASSERT_SLOCKED() sx_assert(&sysctllock, SA_SLOCKED) +#define SYSCTL_INIT() sx_init(&sysctllock, "sysctl lock") #define SYSCTL_SLEEP(ch, wmesg, timo) \ - rm_sleep(ch, &sysctllock, 0, wmesg, timo) + sx_sleep(ch, &sysctllock, 0, wmesg, timo) static int sysctl_root(SYSCTL_HANDLER_ARGS); @@ -113,6 +111,29 @@ static int sysctl_remove_oid_locked(stru static int sysctl_old_kernel(struct sysctl_req *, const void *, size_t); static int sysctl_new_kernel(struct sysctl_req *, void *, size_t); +static void +sysctl_lock(bool xlock) +{ + + if (xlock) + SYSCTL_XLOCK(); + else + SYSCTL_SLOCK(); +} + +static bool +sysctl_unlock(void) +{ + bool xlocked; + + xlocked = SYSCTL_XLOCKED(); + if (xlocked) + SYSCTL_XUNLOCK(); + else + SYSCTL_SUNLOCK(); + return (xlocked); +} + static struct sysctl_oid * sysctl_find_oidname(const char *name, struct sysctl_oid_list *list) { @@ -133,32 +154,29 @@ sysctl_find_oidname(const char *name, st * Order by number in each list. */ void -sysctl_wlock(void) +sysctl_xlock(void) { - SYSCTL_WLOCK(); + SYSCTL_XLOCK(); } void -sysctl_wunlock(void) +sysctl_xunlock(void) { - SYSCTL_WUNLOCK(); + SYSCTL_XUNLOCK(); } static int sysctl_root_handler_locked(struct sysctl_oid *oid, void *arg1, intptr_t arg2, - struct sysctl_req *req, struct rm_priotracker *tracker) + struct sysctl_req *req) { int error; + bool xlocked; if (oid->oid_kind & CTLFLAG_DYN) atomic_add_int(&oid->oid_running, 1); - - if (tracker != NULL) - SYSCTL_RUNLOCK(tracker); - else - SYSCTL_WUNLOCK(); + xlocked = sysctl_unlock(); if (!(oid->oid_kind & CTLFLAG_MPSAFE)) mtx_lock(&Giant); @@ -166,11 +184,7 @@ sysctl_root_handler_locked(struct sysctl if (!(oid->oid_kind & CTLFLAG_MPSAFE)) mtx_unlock(&Giant); - if (tracker != NULL) - SYSCTL_RLOCK(tracker); - else - SYSCTL_WLOCK(); - + sysctl_lock(xlocked); if (oid->oid_kind & CTLFLAG_DYN) { if (atomic_fetchadd_int(&oid->oid_running, -1) == 1 && (oid->oid_kind & CTLFLAG_DYING) != 0) @@ -269,7 +283,7 @@ sysctl_load_tunable_by_oid_locked(struct return; } error = sysctl_root_handler_locked(oidp, oidp->oid_arg1, - oidp->oid_arg2, &req, NULL); + oidp->oid_arg2, &req); if (error != 0) printf("Setting sysctl %s failed: %d\n", path + rem, error); if (penv != NULL) @@ -289,7 +303,7 @@ sysctl_register_oid(struct sysctl_oid *o * First check if another oid with the same name already * exists in the parent's list. */ - SYSCTL_ASSERT_WLOCKED(); + SYSCTL_ASSERT_XLOCKED(); p = sysctl_find_oidname(oidp->oid_name, parent); if (p != NULL) { if ((p->oid_kind & CTLTYPE) == CTLTYPE_NODE) { @@ -383,7 +397,7 @@ sysctl_unregister_oid(struct sysctl_oid struct sysctl_oid *p; int error; - SYSCTL_ASSERT_WLOCKED(); + SYSCTL_ASSERT_XLOCKED(); error = ENOENT; if (oidp->oid_number == OID_AUTO) { error = EINVAL; @@ -439,7 +453,7 @@ sysctl_ctx_free(struct sysctl_ctx_list * * XXX This algorithm is a hack. But I don't know any * XXX better solution for now... */ - SYSCTL_WLOCK(); + SYSCTL_XLOCK(); TAILQ_FOREACH(e, clist, link) { error = sysctl_remove_oid_locked(e->entry, 0, 0); if (error) @@ -459,7 +473,7 @@ sysctl_ctx_free(struct sysctl_ctx_list * e1 = TAILQ_PREV(e1, sysctl_ctx_list, link); } if (error) { - SYSCTL_WUNLOCK(); + SYSCTL_XUNLOCK(); return(EBUSY); } /* Now really delete the entries */ @@ -473,7 +487,7 @@ sysctl_ctx_free(struct sysctl_ctx_list * free(e, M_SYSCTLOID); e = e1; } - SYSCTL_WUNLOCK(); + SYSCTL_XUNLOCK(); return (error); } @@ -483,7 +497,7 @@ sysctl_ctx_entry_add(struct sysctl_ctx_l { struct sysctl_ctx_entry *e; - SYSCTL_ASSERT_WLOCKED(); + SYSCTL_ASSERT_XLOCKED(); if (clist == NULL || oidp == NULL) return(NULL); e = malloc(sizeof(struct sysctl_ctx_entry), M_SYSCTLOID, M_WAITOK); @@ -498,7 +512,7 @@ sysctl_ctx_entry_find(struct sysctl_ctx_ { struct sysctl_ctx_entry *e; - SYSCTL_ASSERT_WLOCKED(); + SYSCTL_ASSERT_XLOCKED(); if (clist == NULL || oidp == NULL) return(NULL); TAILQ_FOREACH(e, clist, link) { @@ -520,15 +534,15 @@ sysctl_ctx_entry_del(struct sysctl_ctx_l if (clist == NULL || oidp == NULL) return (EINVAL); - SYSCTL_WLOCK(); + SYSCTL_XLOCK(); e = sysctl_ctx_entry_find(clist, oidp); if (e != NULL) { TAILQ_REMOVE(clist, e, link); - SYSCTL_WUNLOCK(); + SYSCTL_XUNLOCK(); free(e, M_SYSCTLOID); return (0); } else { - SYSCTL_WUNLOCK(); + SYSCTL_XUNLOCK(); return (ENOENT); } } @@ -544,9 +558,9 @@ sysctl_remove_oid(struct sysctl_oid *oid { int error; - SYSCTL_WLOCK(); + SYSCTL_XLOCK(); error = sysctl_remove_oid_locked(oidp, del, recurse); - SYSCTL_WUNLOCK(); + SYSCTL_XUNLOCK(); return (error); } @@ -558,14 +572,14 @@ sysctl_remove_name(struct sysctl_oid *pa int error; error = ENOENT; - SYSCTL_WLOCK(); + SYSCTL_XLOCK(); SLIST_FOREACH_SAFE(p, SYSCTL_CHILDREN(parent), oid_link, tmp) { if (strcmp(p->oid_name, name) == 0) { error = sysctl_remove_oid_locked(p, del, recurse); break; } } - SYSCTL_WUNLOCK(); + SYSCTL_XUNLOCK(); return (error); } @@ -577,7 +591,7 @@ sysctl_remove_oid_locked(struct sysctl_o struct sysctl_oid *p, *tmp; int error; - SYSCTL_ASSERT_WLOCKED(); + SYSCTL_ASSERT_XLOCKED(); if (oidp == NULL) return(EINVAL); if ((oidp->oid_kind & CTLFLAG_DYN) == 0) { @@ -652,7 +666,7 @@ sysctl_add_oid(struct sysctl_ctx_list *c if (parent == NULL) return(NULL); /* Check if the node already exists, otherwise create it */ - SYSCTL_WLOCK(); + SYSCTL_XLOCK(); oidp = sysctl_find_oidname(name, parent); if (oidp != NULL) { if ((oidp->oid_kind & CTLTYPE) == CTLTYPE_NODE) { @@ -660,10 +674,10 @@ sysctl_add_oid(struct sysctl_ctx_list *c /* Update the context */ if (clist != NULL) sysctl_ctx_entry_add(clist, oidp); - SYSCTL_WUNLOCK(); + SYSCTL_XUNLOCK(); return (oidp); } else { - SYSCTL_WUNLOCK(); + SYSCTL_XUNLOCK(); printf("can't re-use a leaf (%s)!\n", name); return (NULL); } @@ -686,7 +700,7 @@ sysctl_add_oid(struct sysctl_ctx_list *c sysctl_ctx_entry_add(clist, oidp); /* Register this oid */ sysctl_register_oid(oidp); - SYSCTL_WUNLOCK(); + SYSCTL_XUNLOCK(); return (oidp); } @@ -700,10 +714,10 @@ sysctl_rename_oid(struct sysctl_oid *oid char *oldname; newname = strdup(name, M_SYSCTLOID); - SYSCTL_WLOCK(); + SYSCTL_XLOCK(); oldname = __DECONST(char *, oidp->oid_name); oidp->oid_name = newname; - SYSCTL_WUNLOCK(); + SYSCTL_XUNLOCK(); free(oldname, M_SYSCTLOID); } @@ -715,21 +729,21 @@ sysctl_move_oid(struct sysctl_oid *oid, { struct sysctl_oid *oidp; - SYSCTL_WLOCK(); + SYSCTL_XLOCK(); if (oid->oid_parent == parent) { - SYSCTL_WUNLOCK(); + SYSCTL_XUNLOCK(); return (0); } oidp = sysctl_find_oidname(oid->oid_name, parent); if (oidp != NULL) { - SYSCTL_WUNLOCK(); + SYSCTL_XUNLOCK(); return (EEXIST); } sysctl_unregister_oid(oid); oid->oid_parent = parent; oid->oid_number = OID_AUTO; sysctl_register_oid(oid); - SYSCTL_WUNLOCK(); + SYSCTL_XUNLOCK(); return (0); } @@ -745,10 +759,10 @@ sysctl_register_all(void *arg) sx_init(&sysctlmemlock, "sysctl mem"); SYSCTL_INIT(); - SYSCTL_WLOCK(); + SYSCTL_XLOCK(); SET_FOREACH(oidp, sysctl_set) sysctl_register_oid(*oidp); - SYSCTL_WUNLOCK(); + SYSCTL_XUNLOCK(); } SYSINIT(sysctl, SI_SUB_KMEM, SI_ORDER_FIRST, sysctl_register_all, 0); @@ -818,15 +832,14 @@ sysctl_sysctl_debug_dump_node(struct sys static int sysctl_sysctl_debug(SYSCTL_HANDLER_ARGS) { - struct rm_priotracker tracker; int error; error = priv_check(req->td, PRIV_SYSCTL_DEBUG); if (error) return (error); - SYSCTL_RLOCK(&tracker); + SYSCTL_SLOCK(); sysctl_sysctl_debug_dump_node(&sysctl__children, 0); - SYSCTL_RUNLOCK(&tracker); + SYSCTL_SUNLOCK(); return (ENOENT); } @@ -842,10 +855,9 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS) int error = 0; struct sysctl_oid *oid; struct sysctl_oid_list *lsp = &sysctl__children, *lsp2; - struct rm_priotracker tracker; char buf[10]; - SYSCTL_RLOCK(&tracker); + SYSCTL_SLOCK(); while (namelen) { if (!lsp) { snprintf(buf,sizeof(buf),"%d",*name); @@ -888,7 +900,7 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS) } error = SYSCTL_OUT(req, "", 1); out: - SYSCTL_RUNLOCK(&tracker); + SYSCTL_SUNLOCK(); return (error); } @@ -967,12 +979,11 @@ sysctl_sysctl_next(SYSCTL_HANDLER_ARGS) int i, j, error; struct sysctl_oid *oid; struct sysctl_oid_list *lsp = &sysctl__children; - struct rm_priotracker tracker; int newoid[CTL_MAXNAME]; - SYSCTL_RLOCK(&tracker); + SYSCTL_SLOCK(); i = sysctl_sysctl_next_ls(lsp, name, namelen, newoid, &j, 1, &oid); - SYSCTL_RUNLOCK(&tracker); + SYSCTL_SUNLOCK(); if (i) return (ENOENT); error = SYSCTL_OUT(req, newoid, j * sizeof (int)); @@ -1031,7 +1042,6 @@ sysctl_sysctl_name2oid(SYSCTL_HANDLER_AR char *p; int error, oid[CTL_MAXNAME], len = 0; struct sysctl_oid *op = 0; - struct rm_priotracker tracker; if (!req->newlen) return (ENOENT); @@ -1048,9 +1058,9 @@ sysctl_sysctl_name2oid(SYSCTL_HANDLER_AR p [req->newlen] = '\0'; - SYSCTL_RLOCK(&tracker); + SYSCTL_SLOCK(); error = name2oid(p, oid, &len, &op); - SYSCTL_RUNLOCK(&tracker); + SYSCTL_SUNLOCK(); free(p, M_SYSCTL); @@ -1073,10 +1083,9 @@ static int sysctl_sysctl_oidfmt(SYSCTL_HANDLER_ARGS) { struct sysctl_oid *oid; - struct rm_priotracker tracker; int error; - SYSCTL_RLOCK(&tracker); + SYSCTL_SLOCK(); error = sysctl_find_oid(arg1, arg2, &oid, NULL, req); if (error) goto out; @@ -1090,7 +1099,7 @@ sysctl_sysctl_oidfmt(SYSCTL_HANDLER_ARGS goto out; error = SYSCTL_OUT(req, oid->oid_fmt, strlen(oid->oid_fmt) + 1); out: - SYSCTL_RUNLOCK(&tracker); + SYSCTL_SUNLOCK(); return (error); } @@ -1102,10 +1111,9 @@ static int sysctl_sysctl_oiddescr(SYSCTL_HANDLER_ARGS) { struct sysctl_oid *oid; - struct rm_priotracker tracker; int error; - SYSCTL_RLOCK(&tracker); + SYSCTL_SLOCK(); error = sysctl_find_oid(arg1, arg2, &oid, NULL, req); if (error) goto out; @@ -1116,7 +1124,7 @@ sysctl_sysctl_oiddescr(SYSCTL_HANDLER_AR } error = SYSCTL_OUT(req, oid->oid_descr, strlen(oid->oid_descr) + 1); out: - SYSCTL_RUNLOCK(&tracker); + SYSCTL_SUNLOCK(); return (error); } @@ -1421,7 +1429,9 @@ kernel_sysctl(struct thread *td, int *na req.newfunc = sysctl_new_kernel; req.lock = REQ_UNWIRED; + SYSCTL_SLOCK(); error = sysctl_root(0, name, namelen, &req); + SYSCTL_SUNLOCK(); if (req.lock == REQ_WIRED && req.validlen > 0) vsunlock(req.oldptr, req.validlen); @@ -1598,14 +1608,13 @@ static int sysctl_root(SYSCTL_HANDLER_ARGS) { struct sysctl_oid *oid; - struct rm_priotracker tracker; int error, indx, lvl; - SYSCTL_RLOCK(&tracker); + SYSCTL_ASSERT_SLOCKED(); error = sysctl_find_oid(arg1, arg2, &oid, &indx, req); if (error) - goto out; + return (error); if ((oid->oid_kind & CTLTYPE) == CTLTYPE_NODE) { /* @@ -1613,17 +1622,13 @@ sysctl_root(SYSCTL_HANDLER_ARGS) * no handler. Inform the user that it's a node. * The indx may or may not be the same as namelen. */ - if (oid->oid_handler == NULL) { - error = EISDIR; - goto out; - } + if (oid->oid_handler == NULL) + return (EISDIR); } /* Is this sysctl writable? */ - if (req->newptr && !(oid->oid_kind & CTLFLAG_WR)) { - error = EPERM; - goto out; - } + if (req->newptr && !(oid->oid_kind & CTLFLAG_WR)) + return (EPERM); KASSERT(req->td != NULL, ("sysctl_root(): req->td == NULL")); @@ -1633,11 +1638,10 @@ sysctl_root(SYSCTL_HANDLER_ARGS) * writing unless specifically granted for the node. */ if (IN_CAPABILITY_MODE(req->td)) { - if ((req->oldptr && !(oid->oid_kind & CTLFLAG_CAPRD)) || - (req->newptr && !(oid->oid_kind & CTLFLAG_CAPWR))) { - error = EPERM; - goto out; - } + if (req->oldptr && !(oid->oid_kind & CTLFLAG_CAPRD)) + return (EPERM); + if (req->newptr && !(oid->oid_kind & CTLFLAG_CAPWR)) + return (EPERM); } #endif @@ -1646,7 +1650,7 @@ sysctl_root(SYSCTL_HANDLER_ARGS) lvl = (oid->oid_kind & CTLMASK_SECURE) >> CTLSHIFT_SECURE; error = securelevel_gt(req->td->td_ucred, lvl); if (error) - goto out; + return (error); } /* Is this sysctl writable by only privileged users? */ @@ -1664,13 +1668,11 @@ sysctl_root(SYSCTL_HANDLER_ARGS) priv = PRIV_SYSCTL_WRITE; error = priv_check(req->td, priv); if (error) - goto out; + return (error); } - if (!oid->oid_handler) { - error = EINVAL; - goto out; - } + if (!oid->oid_handler) + return (EINVAL); if ((oid->oid_kind & CTLTYPE) == CTLTYPE_NODE) { arg1 = (int *)arg1 + indx; @@ -1683,18 +1685,16 @@ sysctl_root(SYSCTL_HANDLER_ARGS) error = mac_system_check_sysctl(req->td->td_ucred, oid, arg1, arg2, req); if (error != 0) - goto out; + return (error); #endif #ifdef VIMAGE if ((oid->oid_kind & CTLFLAG_VNET) && arg1 != NULL) arg1 = (void *)(curvnet->vnet_data_base + (uintptr_t)arg1); #endif - error = sysctl_root_handler_locked(oid, arg1, arg2, req, &tracker); + error = sysctl_root_handler_locked(oid, arg1, arg2, req); KFAIL_POINT_ERROR(_debug_fail_point, sysctl_running, error); -out: - SYSCTL_RUNLOCK(&tracker); return (error); } @@ -1794,7 +1794,9 @@ userland_sysctl(struct thread *td, int * for (;;) { req.oldidx = 0; req.newidx = 0; + SYSCTL_SLOCK(); error = sysctl_root(0, name, namelen, &req); + SYSCTL_SUNLOCK(); if (error != EAGAIN) break; kern_yield(PRI_USER); Modified: head/sys/kern/vfs_init.c ============================================================================== --- head/sys/kern/vfs_init.c Thu Jul 30 19:44:46 2015 (r286093) +++ head/sys/kern/vfs_init.c Thu Jul 30 19:52:43 2015 (r286094) @@ -291,7 +291,7 @@ vfs_register(struct vfsconf *vfc) * preserved by re-registering the oid after modifying its * number. */ - sysctl_wlock(); + sysctl_xlock(); SLIST_FOREACH(oidp, SYSCTL_CHILDREN(&sysctl___vfs), oid_link) { if (strcmp(oidp->oid_name, vfc->vfc_name) == 0) { sysctl_unregister_oid(oidp); @@ -300,7 +300,7 @@ vfs_register(struct vfsconf *vfc) break; } } - sysctl_wunlock(); + sysctl_xunlock(); return (0); } Modified: head/sys/sys/sysctl.h ============================================================================== --- head/sys/sys/sysctl.h Thu Jul 30 19:44:46 2015 (r286093) +++ head/sys/sys/sysctl.h Thu Jul 30 19:52:43 2015 (r286094) @@ -807,8 +807,8 @@ int userland_sysctl(struct thread *td, i size_t *retval, int flags); int sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid, int *nindx, struct sysctl_req *req); -void sysctl_wlock(void); -void sysctl_wunlock(void); +void sysctl_xlock(void); +void sysctl_xunlock(void); int sysctl_wire_old_buffer(struct sysctl_req *req, size_t len); struct sbuf; From owner-svn-src-all@freebsd.org Thu Jul 30 20:56:28 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D9B59AE4AA; Thu, 30 Jul 2015 20:56:28 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 558A21DEF; Thu, 30 Jul 2015 20:56:28 +0000 (UTC) (envelope-from eri@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UKuSQ9027612; Thu, 30 Jul 2015 20:56:28 GMT (envelope-from eri@FreeBSD.org) Received: (from eri@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UKuS4Z027611; Thu, 30 Jul 2015 20:56:28 GMT (envelope-from eri@FreeBSD.org) Message-Id: <201507302056.t6UKuS4Z027611@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eri set sender to eri@FreeBSD.org using -f From: Ermal Luçi Date: Thu, 30 Jul 2015 20:56:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286095 - head/sys/netipsec X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 20:56:28 -0000 Author: eri Date: Thu Jul 30 20:56:27 2015 New Revision: 286095 URL: https://svnweb.freebsd.org/changeset/base/286095 Log: Correct IPSec SA statistic keeping The IPsec SA statistic keeping is used even for decision making on expiry/rekeying SAs. When there are multiple transformations being done the statistic keeping might be wrong. This mostly impacts multiple encapsulations on IPsec since the usual scenario it is not noticed due to the code path not taken. Differential Revision: https://reviews.freebsd.org/D3239 Reviewed by: ae, gnn Approved by: gnn(mentor) Modified: head/sys/netipsec/ipsec_output.c Modified: head/sys/netipsec/ipsec_output.c ============================================================================== --- head/sys/netipsec/ipsec_output.c Thu Jul 30 19:52:43 2015 (r286094) +++ head/sys/netipsec/ipsec_output.c Thu Jul 30 20:56:27 2015 (r286095) @@ -158,6 +158,8 @@ ipsec_process_done(struct mbuf *m, struc tdbi->spi = sav->spi; m_tag_prepend(m, mtag); + key_sa_recordxfer(sav, m); /* record data transfer */ + /* * If there's another (bundled) SA to apply, do so. * Note that this puts a burden on the kernel stack size. @@ -202,7 +204,6 @@ ipsec_process_done(struct mbuf *m, struc goto bad; } } - key_sa_recordxfer(sav, m); /* record data transfer */ /* * We're done with IPsec processing, transmit the packet using the From owner-svn-src-all@freebsd.org Thu Jul 30 22:14:33 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 685BF9AF637; Thu, 30 Jul 2015 22:14:33 +0000 (UTC) (envelope-from alfred@freebsd.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 58831168C; Thu, 30 Jul 2015 22:14:33 +0000 (UTC) (envelope-from alfred@freebsd.org) Received: from AlfredMacbookAir.local (static-108-44-39-3.albyny.fios.verizon.net [108.44.39.3]) by elvis.mu.org (Postfix) with ESMTPSA id 99A78341F947; Thu, 30 Jul 2015 15:14:32 -0700 (PDT) Subject: Re: svn commit: r285950 - stable/10/usr.sbin/mfiutil To: Ed Maste , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org References: <201507281240.t6SCegFp098520@repo.freebsd.org> From: Alfred Perlstein Organization: FreeBSD Message-ID: <55BAA1C8.7070004@freebsd.org> Date: Thu, 30 Jul 2015 18:14:32 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <201507281240.t6SCegFp098520@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 22:14:33 -0000 Can't this use asprintf? There's a catchall free() at the end and no early returns in this function. Otherwise snprintf? On 7/28/15 8:40 AM, Ed Maste wrote: > Author: emaste > Date: Tue Jul 28 12:40:41 2015 > New Revision: 285950 > URL: https://svnweb.freebsd.org/changeset/base/285950 > > Log: > MFC r201289: mfiutil: increase buffer size to accommodate sprintf string > > PR: 201289 > > Modified: > stable/10/usr.sbin/mfiutil/mfi_foreign.c > Directory Properties: > stable/10/ (props changed) > > Modified: stable/10/usr.sbin/mfiutil/mfi_foreign.c > ============================================================================== > --- stable/10/usr.sbin/mfiutil/mfi_foreign.c Tue Jul 28 12:40:09 2015 (r285949) > +++ stable/10/usr.sbin/mfiutil/mfi_foreign.c Tue Jul 28 12:40:41 2015 (r285950) > @@ -110,7 +110,7 @@ static int > foreign_show_cfg(int fd, uint32_t opcode, uint8_t cfgidx, int diagnostic) > { > struct mfi_config_data *config; > - char prefix[26]; > + char prefix[64]; > int error; > uint8_t mbox[4]; > > From owner-svn-src-all@freebsd.org Thu Jul 30 23:58:54 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69D7D9AF626; Thu, 30 Jul 2015 23:58:54 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5A300AC0; Thu, 30 Jul 2015 23:58:54 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UNws16001660; Thu, 30 Jul 2015 23:58:54 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UNwsDe001659; Thu, 30 Jul 2015 23:58:54 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507302358.t6UNwsDe001659@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 30 Jul 2015 23:58:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r286096 - releng/10.2/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 23:58:54 -0000 Author: gjb Date: Thu Jul 30 23:58:53 2015 New Revision: 286096 URL: https://svnweb.freebsd.org/changeset/base/286096 Log: Document r285830, specifically that the default pkg(8) repository was switched from 'latest' to 'quarterly' for 10.2-RELEASE. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml Thu Jul 30 20:56:27 2015 (r286095) +++ releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml Thu Jul 30 23:58:53 2015 (r286096) @@ -887,6 +887,16 @@ &os;/&arch.i386; memory stick installation images are now created using the &man.mkimg.1; utility, matching the way the &os;/&arch.amd64; images are created. + + The + default &man.pkg.8; repository set in + /etc/pkg/FreeBSD.conf now defaults to + the quarterly package set. To use the + latest branch (as was the previous + default), the comment at the top of + /etc/pkg/FreeBSD.conf explains how to + disable the default repository and specify an alternative + repository. From owner-svn-src-all@freebsd.org Thu Jul 30 23:58:57 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 049609AF630; Thu, 30 Jul 2015 23:58:57 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E97BBACA; Thu, 30 Jul 2015 23:58:56 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6UNwuXR001701; Thu, 30 Jul 2015 23:58:56 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6UNwuxr001700; Thu, 30 Jul 2015 23:58:56 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507302358.t6UNwuxr001700@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 30 Jul 2015 23:58:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r286097 - releng/10.2/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Jul 2015 23:58:57 -0000 Author: gjb Date: Thu Jul 30 23:58:55 2015 New Revision: 286097 URL: https://svnweb.freebsd.org/changeset/base/286097 Log: Document r286084, tar(1) sparse file fix. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml Thu Jul 30 23:58:53 2015 (r286096) +++ releng/10.2/release/doc/en_US.ISO8859-1/relnotes/article.xml Thu Jul 30 23:58:55 2015 (r286097) @@ -274,6 +274,10 @@ &man.ssh.1; utility has been updated to re-implement hostname canonicalization before locating the host in known_hosts. + + The &man.tar.1; utility has been updated + to fix an issue that would prevent compressing sparse + files. From owner-svn-src-all@freebsd.org Fri Jul 31 00:01:00 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2318F9AF6C8; Fri, 31 Jul 2015 00:01:00 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1382FE2E; Fri, 31 Jul 2015 00:01:00 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6V00xtr002914; Fri, 31 Jul 2015 00:00:59 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6V00xXT002913; Fri, 31 Jul 2015 00:00:59 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507310000.t6V00xXT002913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 31 Jul 2015 00:00:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r286098 - releng/10.2/sys/conf X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 00:01:00 -0000 Author: gjb Date: Fri Jul 31 00:00:59 2015 New Revision: 286098 URL: https://svnweb.freebsd.org/changeset/base/286098 Log: Update releng/10.2 to RC2 in preparation for the next set of builds. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: releng/10.2/sys/conf/newvers.sh Modified: releng/10.2/sys/conf/newvers.sh ============================================================================== --- releng/10.2/sys/conf/newvers.sh Thu Jul 30 23:58:55 2015 (r286097) +++ releng/10.2/sys/conf/newvers.sh Fri Jul 31 00:00:59 2015 (r286098) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="10.2" -BRANCH="RC1" +BRANCH="RC2" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-all@freebsd.org Fri Jul 31 00:21:41 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 804DF9AFA4B; Fri, 31 Jul 2015 00:21:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 70B6E1A04; Fri, 31 Jul 2015 00:21:41 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6V0Lf9U013636; Fri, 31 Jul 2015 00:21:41 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6V0LfZZ013635; Fri, 31 Jul 2015 00:21:41 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201507310021.t6V0LfZZ013635@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 31 Jul 2015 00:21:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286099 - stable/10/usr.bin/netstat X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 00:21:41 -0000 Author: markj Date: Fri Jul 31 00:21:40 2015 New Revision: 286099 URL: https://svnweb.freebsd.org/changeset/base/286099 Log: MFC r285782: Fix counter reads on platforms where sizeof(uint64_t) != sizeof(uint64_t *). PR: 201700 Modified: stable/10/usr.bin/netstat/main.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/netstat/main.c ============================================================================== --- stable/10/usr.bin/netstat/main.c Fri Jul 31 00:00:59 2015 (r286098) +++ stable/10/usr.bin/netstat/main.c Fri Jul 31 00:21:40 2015 (r286099) @@ -785,19 +785,31 @@ kread_counter(u_long addr) int kread_counters(u_long addr, void *buf, size_t size) { - uint64_t *c = buf; + uint64_t *c; + u_long *counters; + size_t i, n; if (kvmd_init() < 0) return (-1); - if (kread(addr, buf, size) < 0) + if (size % sizeof(uint64_t) != 0) { + warnx("kread_counters: invalid counter set size"); return (-1); + } - while (size != 0) { - *c = kvm_counter_u64_fetch(kvmd, *c); - size -= sizeof(*c); - c++; + n = size / sizeof(uint64_t); + if ((counters = malloc(n * sizeof(u_long))) == NULL) + err(-1, "malloc"); + if (kread(addr, counters, n * sizeof(u_long)) < 0) { + free(counters); + return (-1); } + + c = buf; + for (i = 0; i < n; i++) + c[i] = kvm_counter_u64_fetch(kvmd, counters[i]); + + free(counters); return (0); } From owner-svn-src-all@freebsd.org Fri Jul 31 00:23:22 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 93B129AFA95; Fri, 31 Jul 2015 00:23:22 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 77E2B1BBB; Fri, 31 Jul 2015 00:23:22 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6V0NMaG013791; Fri, 31 Jul 2015 00:23:22 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6V0NLVT013789; Fri, 31 Jul 2015 00:23:21 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <201507310023.t6V0NLVT013789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Fri, 31 Jul 2015 00:23:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286100 - in head/sys: net netipsec X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 00:23:22 -0000 Author: jmg Date: Fri Jul 31 00:23:21 2015 New Revision: 286100 URL: https://svnweb.freebsd.org/changeset/base/286100 Log: Clean up this header file... use CTASSERTs now that we have them... Replace a draft w/ RFC that's over 10 years old. Note that _AALG and _EALG do not need to match what the IKE daemons think they should be.. This is part of the KABI... I decided to renumber AESCTR, but since we've never had working AESCTR mode, I'm not really breaking anything.. and it shortens a loop by quite a bit.. remove SKIPJACK IPsec support... SKIPJACK never made it out of draft (in 1999), only has 80bit key, NIST recommended it stop being used after 2010, and setkey nor any of the IKE daemons I checked supported it... jmgurney/ipsecgcm: a357a33, c75808b, e008669, b27b6d6 Reviewed by: gnn (earlier version) Modified: head/sys/net/pfkeyv2.h head/sys/netipsec/xform_esp.c Modified: head/sys/net/pfkeyv2.h ============================================================================== --- head/sys/net/pfkeyv2.h Fri Jul 31 00:21:40 2015 (r286099) +++ head/sys/net/pfkeyv2.h Fri Jul 31 00:23:21 2015 (r286100) @@ -218,7 +218,6 @@ struct sadb_x_sa2 { }; /* XXX Policy Extension */ -/* sizeof(struct sadb_x_policy) == 16 */ struct sadb_x_policy { u_int16_t sadb_x_policy_len; u_int16_t sadb_x_policy_exttype; @@ -228,6 +227,8 @@ struct sadb_x_policy { u_int32_t sadb_x_policy_id; u_int32_t sadb_x_policy_reserved2; }; +CTASSERT(sizeof(struct sadb_x_policy) == 16); + /* * When policy_type == IPSEC, it is followed by some of * the ipsec policy request. @@ -256,31 +257,31 @@ struct sadb_x_ipsecrequest { }; /* NAT-Traversal type, see RFC 3948 (and drafts). */ -/* sizeof(struct sadb_x_nat_t_type) == 8 */ struct sadb_x_nat_t_type { u_int16_t sadb_x_nat_t_type_len; u_int16_t sadb_x_nat_t_type_exttype; u_int8_t sadb_x_nat_t_type_type; u_int8_t sadb_x_nat_t_type_reserved[3]; }; +CTASSERT(sizeof(struct sadb_x_nat_t_type) == 8); /* NAT-Traversal source or destination port. */ -/* sizeof(struct sadb_x_nat_t_port) == 8 */ struct sadb_x_nat_t_port { u_int16_t sadb_x_nat_t_port_len; u_int16_t sadb_x_nat_t_port_exttype; u_int16_t sadb_x_nat_t_port_port; u_int16_t sadb_x_nat_t_port_reserved; }; +CTASSERT(sizeof(struct sadb_x_nat_t_port) == 8); /* ESP fragmentation size. */ -/* sizeof(struct sadb_x_nat_t_frag) == 8 */ struct sadb_x_nat_t_frag { u_int16_t sadb_x_nat_t_frag_len; u_int16_t sadb_x_nat_t_frag_exttype; u_int16_t sadb_x_nat_t_frag_fraglen; u_int16_t sadb_x_nat_t_frag_reserved; }; +CTASSERT(sizeof(struct sadb_x_nat_t_frag) == 8); #define SADB_EXT_RESERVED 0 @@ -332,46 +333,47 @@ struct sadb_x_nat_t_frag { #define SADB_SAFLAGS_PFS 1 -/* RFC2367 numbers - meets RFC2407 */ +/* + * Though some of these numbers (both _AALG and _EALG) appear to be + * IKEv2 numbers and others original IKE numbers, they have no meaning. + * These are constants that the various IKE daemons use to tell the kernel + * what cipher to use. + * + * Do not use these constants directly to decide which Transformation ID + * to send. You are responsible for mapping them yourself. + */ #define SADB_AALG_NONE 0 #define SADB_AALG_MD5HMAC 2 #define SADB_AALG_SHA1HMAC 3 #define SADB_AALG_MAX 252 -/* private allocations - based on RFC2407/IANA assignment */ #define SADB_X_AALG_SHA2_256 5 #define SADB_X_AALG_SHA2_384 6 #define SADB_X_AALG_SHA2_512 7 #define SADB_X_AALG_RIPEMD160HMAC 8 -#define SADB_X_AALG_AES_XCBC_MAC 9 /* draft-ietf-ipsec-ciph-aes-xcbc-mac-04 */ +#define SADB_X_AALG_AES_XCBC_MAC 9 /* RFC3566 */ #define SADB_X_AALG_AES128GMAC 11 /* RFC4543 + Errata1821 */ #define SADB_X_AALG_AES192GMAC 12 #define SADB_X_AALG_AES256GMAC 13 -/* private allocations should use 249-255 (RFC2407) */ #define SADB_X_AALG_MD5 249 /* Keyed MD5 */ #define SADB_X_AALG_SHA 250 /* Keyed SHA */ #define SADB_X_AALG_NULL 251 /* null authentication */ #define SADB_X_AALG_TCP_MD5 252 /* Keyed TCP-MD5 (RFC2385) */ -/* RFC2367 numbers - meets RFC2407 */ #define SADB_EALG_NONE 0 #define SADB_EALG_DESCBC 2 #define SADB_EALG_3DESCBC 3 -#define SADB_EALG_NULL 11 -#define SADB_EALG_MAX 250 -/* private allocations - based on RFC2407/IANA assignment */ #define SADB_X_EALG_CAST128CBC 6 #define SADB_X_EALG_BLOWFISHCBC 7 +#define SADB_EALG_NULL 11 #define SADB_X_EALG_RIJNDAELCBC 12 #define SADB_X_EALG_AES 12 +#define SADB_X_EALG_AESCTR 13 #define SADB_X_EALG_AESGCM8 18 /* RFC4106 */ #define SADB_X_EALG_AESGCM12 19 #define SADB_X_EALG_AESGCM16 20 -/* private allocations - based on RFC4312/IANA assignment */ -#define SADB_X_EALG_CAMELLIACBC 22 -#define SADB_X_EALG_AESGMAC 23 /* RFC4543 + Errata1821 */ -/* private allocations should use 249-255 (RFC2407) */ -#define SADB_X_EALG_SKIPJACK 249 /*250*/ /* for IPSEC */ -#define SADB_X_EALG_AESCTR 250 /*249*/ /* draft-ietf-ipsec-ciph-aes-ctr-03 */ +#define SADB_X_EALG_CAMELLIACBC 22 +#define SADB_X_EALG_AESGMAC 23 /* RFC4543 + Errata1821 */ +#define SADB_EALG_MAX 23 /* !!! keep updated !!! */ /* private allocations - based on RFC2407/IANA assignment */ #define SADB_X_CALG_NONE 0 Modified: head/sys/netipsec/xform_esp.c ============================================================================== --- head/sys/netipsec/xform_esp.c Fri Jul 31 00:21:40 2015 (r286099) +++ head/sys/netipsec/xform_esp.c Fri Jul 31 00:23:21 2015 (r286100) @@ -115,8 +115,6 @@ esp_algorithm_lookup(int alg) return &enc_xform_blf; case SADB_X_EALG_CAST128CBC: return &enc_xform_cast5; - case SADB_X_EALG_SKIPJACK: - return &enc_xform_skipjack; case SADB_EALG_NULL: return &enc_xform_null; case SADB_X_EALG_CAMELLIACBC: From owner-svn-src-all@freebsd.org Fri Jul 31 00:31:53 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DDD629AFC25; Fri, 31 Jul 2015 00:31:53 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CA20014D; Fri, 31 Jul 2015 00:31:53 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6V0VriC015965; Fri, 31 Jul 2015 00:31:53 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6V0VrrE015963; Fri, 31 Jul 2015 00:31:53 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <201507310031.t6V0VrrE015963@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Fri, 31 Jul 2015 00:31:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286101 - head/sys/netipsec X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 00:31:54 -0000 Author: jmg Date: Fri Jul 31 00:31:52 2015 New Revision: 286101 URL: https://svnweb.freebsd.org/changeset/base/286101 Log: these are comparing authenticators and need to be constant time... This could be a side channel attack... Now that we have a function for this, use it... jmgurney/ipsecgcm: 24d704cc and 7f37a14 Modified: head/sys/netipsec/xform_ah.c head/sys/netipsec/xform_esp.c Modified: head/sys/netipsec/xform_ah.c ============================================================================== --- head/sys/netipsec/xform_ah.c Fri Jul 31 00:23:21 2015 (r286100) +++ head/sys/netipsec/xform_ah.c Fri Jul 31 00:31:52 2015 (r286101) @@ -777,7 +777,7 @@ ah_input_cb(struct cryptop *crp) /* Verify authenticator. */ ptr = (caddr_t) (tc + 1); - if (bcmp(ptr + skip + rplen, calc, authsize)) { + if (timingsafe_bcmp(ptr + skip + rplen, calc, authsize)) { DPRINTF(("%s: authentication hash mismatch for packet " "in SA %s/%08lx\n", __func__, ipsec_address(&saidx->dst, buf, sizeof(buf)), Modified: head/sys/netipsec/xform_esp.c ============================================================================== --- head/sys/netipsec/xform_esp.c Fri Jul 31 00:23:21 2015 (r286100) +++ head/sys/netipsec/xform_esp.c Fri Jul 31 00:31:52 2015 (r286101) @@ -534,7 +534,7 @@ esp_input_cb(struct cryptop *crp) ptr = (caddr_t) (tc + 1); /* Verify authenticator */ - if (bcmp(ptr, aalg, alen) != 0) { + if (timingsafe_bcmp(ptr, aalg, alen) != 0) { DPRINTF(("%s: authentication hash mismatch for " "packet in SA %s/%08lx\n", __func__, ipsec_address(&saidx->dst, buf, sizeof(buf)), From owner-svn-src-all@freebsd.org Fri Jul 31 00:41:21 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0B2BF9AFC9C; Fri, 31 Jul 2015 00:41:21 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qg0-x232.google.com (mail-qg0-x232.google.com [IPv6:2607:f8b0:400d:c04::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B4CF5809; Fri, 31 Jul 2015 00:41:20 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by qgii95 with SMTP id i95so36223818qgi.2; Thu, 30 Jul 2015 17:41:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=n9k+UmKrNsU0w37jvEJckpkye+dKtzxSDnBNB8Fwnh4=; b=UrnMLGcgu9YQ/N5EOJ9FicYDF7X+t+TsPuyCqPgyQ6cN58HES++OHPeXwtH2mpztdA S4zgVLBexsuT31YVyE68LmhfKjJUcPEoUxI5DMLF8rhaPXBKUBE6EdbAOlAtb3OBG+Q6 fY3k4ZV400KyQpBIaD2NZGlFFGWfY7cNiNCGfYGOAxb5i6PftuEtquKIkcX94yDqLN+D ZV+2n4dl/o6G8QftM4z6cet7oWJvM8WVa28JrU+tApu41gvfi9/BEudegKUNsPXUFN4D qQ4uPwl0Bz5Thh1750FB23DzpTc67JLcMX3hPk+aTqO18GoWkJ98oEogITs0lvSn6Zp8 TEmQ== MIME-Version: 1.0 X-Received: by 10.140.29.55 with SMTP id a52mr96881qga.25.1438303279739; Thu, 30 Jul 2015 17:41:19 -0700 (PDT) Received: by 10.140.98.73 with HTTP; Thu, 30 Jul 2015 17:41:19 -0700 (PDT) In-Reply-To: <201507310023.t6V0NLVT013789@repo.freebsd.org> References: <201507310023.t6V0NLVT013789@repo.freebsd.org> Date: Thu, 30 Jul 2015 17:41:19 -0700 Message-ID: Subject: Re: svn commit: r286100 - in head/sys: net netipsec From: NGie Cooper To: John-Mark Gurney Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 00:41:21 -0000 On Thu, Jul 30, 2015 at 5:23 PM, John-Mark Gurney wrote: > Author: jmg > Date: Fri Jul 31 00:23:21 2015 > New Revision: 286100 > URL: https://svnweb.freebsd.org/changeset/base/286100 > > Log: > Clean up this header file... > > use CTASSERTs now that we have them... > > Replace a draft w/ RFC that's over 10 years old. > > Note that _AALG and _EALG do not need to match what the IKE daemons > think they should be.. This is part of the KABI... I decided to > renumber AESCTR, but since we've never had working AESCTR mode, I'm > not really breaking anything.. and it shortens a loop by quite > a bit.. > > remove SKIPJACK IPsec support... SKIPJACK never made it out of draft > (in 1999), only has 80bit key, NIST recommended it stop being used > after 2010, and setkey nor any of the IKE daemons I checked supported > it... > > jmgurney/ipsecgcm: a357a33, c75808b, e008669, b27b6d6 > > Reviewed by: gnn (earlier version) Relnotes: yes (removing SKIPJACK IPsec support + ?) From owner-svn-src-all@freebsd.org Fri Jul 31 01:12:33 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A3469AE235; Fri, 31 Jul 2015 01:12:33 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5AFF6160F; Fri, 31 Jul 2015 01:12:33 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6V1CWS5034233; Fri, 31 Jul 2015 01:12:32 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6V1CWh8034232; Fri, 31 Jul 2015 01:12:32 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201507310112.t6V1CWh8034232@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Fri, 31 Jul 2015 01:12:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286102 - head/usr.bin/wall X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 01:12:33 -0000 Author: pfg Date: Fri Jul 31 01:12:31 2015 New Revision: 286102 URL: https://svnweb.freebsd.org/changeset/base/286102 Log: Buffer overflow in wall(1). This affected syslogd, wall and talkd. Detected by FORTIFY_SOURCE GSoC (with clang). Submitted by: Oliver Pinter Differential Revision: https://reviews.freebsd.org/D3254 Reviewed by: delphij, jmg MFC after: 3 days Modified: head/usr.bin/wall/ttymsg.c Modified: head/usr.bin/wall/ttymsg.c ============================================================================== --- head/usr.bin/wall/ttymsg.c Fri Jul 31 00:31:52 2015 (r286101) +++ head/usr.bin/wall/ttymsg.c Fri Jul 31 01:12:31 2015 (r286102) @@ -62,7 +62,7 @@ ttymsg(struct iovec *iov, int iovcnt, co struct iovec localiov[7]; ssize_t left, wret; int cnt, fd; - static char device[MAXNAMLEN] = _PATH_DEV; + char device[MAXNAMLEN] = _PATH_DEV; static char errbuf[1024]; char *p; int forked; @@ -71,8 +71,8 @@ ttymsg(struct iovec *iov, int iovcnt, co if (iovcnt > (int)(sizeof(localiov) / sizeof(localiov[0]))) return ("too many iov's (change code in wall/ttymsg.c)"); + strlcat(device, line, sizeof(device)); p = device + sizeof(_PATH_DEV) - 1; - strlcpy(p, line, sizeof(device)); if (strncmp(p, "pts/", 4) == 0) p += 4; if (strchr(p, '/') != NULL) { From owner-svn-src-all@freebsd.org Fri Jul 31 01:37:39 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13D529AE4ED; Fri, 31 Jul 2015 01:37:39 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: from mail-ob0-x235.google.com (mail-ob0-x235.google.com [IPv6:2607:f8b0:4003:c01::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C4B841EEA; Fri, 31 Jul 2015 01:37:38 +0000 (UTC) (envelope-from araujobsdport@gmail.com) Received: by obbop1 with SMTP id op1so43926598obb.2; Thu, 30 Jul 2015 18:37:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=czFryQkBjykApb9lf9+kt0qHnRJ9umB59ykputGguh0=; b=Iu8/XTMkxo0oXwcwauZigI+CfrDsR8d2xfU30e7odAG5p30XKO9jsJvGL5vxByCJum RZaS/oxkRCswMpnH96fzefT03P0xdljGHdi7Vbn5rlHjay2S1Xy0pwBIKYoBjCWCRvXf 588xnuPnFDHH9KfhyAEl/r6B0JVlJ5JblyovvJ3DesCfD+ZE7NoqVkh7mFNzIoYCNbPJ 4q+XrkjljyFhKPjPjj/VSj+Tk4a8EgI4Z7Wg8rfwM223xS90RcunShP+QlrGzcaPMgml yb4ZKpXr+6lpPqQyOpLO7vbqIo9NCK0kgR4UOk2mjoE5XfPriNvmX6Se7VECEOrBqosG xrXg== MIME-Version: 1.0 X-Received: by 10.60.69.200 with SMTP id g8mr268514oeu.40.1438306658021; Thu, 30 Jul 2015 18:37:38 -0700 (PDT) Received: by 10.202.11.193 with HTTP; Thu, 30 Jul 2015 18:37:37 -0700 (PDT) Reply-To: araujo@FreeBSD.org In-Reply-To: <201507301944.t6UJilqi098925@repo.freebsd.org> References: <201507301944.t6UJilqi098925@repo.freebsd.org> Date: Fri, 31 Jul 2015 09:37:37 +0800 Message-ID: Subject: Re: svn commit: r286093 - head/usr.bin/ipcrm From: Marcelo Araujo To: Craig Rodrigues Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 01:37:39 -0000 2015-07-31 3:44 GMT+08:00 Craig Rodrigues : > Author: rodrigc > Date: Thu Jul 30 19:44:46 2015 > New Revision: 286093 > URL: https://svnweb.freebsd.org/changeset/base/286093 > > Log: > Use correct number of arguments to semctl() for IPC_RMID. > > PR: 118292 > Submitted by: araujo > Differential Revision: D2669 > > Modified: > head/usr.bin/ipcrm/ipcrm.c > > Modified: head/usr.bin/ipcrm/ipcrm.c > > ============================================================================== > --- head/usr.bin/ipcrm/ipcrm.c Thu Jul 30 19:34:24 2015 (r286092) > +++ head/usr.bin/ipcrm/ipcrm.c Thu Jul 30 19:44:46 2015 (r286093) > @@ -169,7 +169,7 @@ semrm(key_t key, int id) > if ((kxsema[num].u.sem_perm.mode & SEM_ALLOC) != > 0) { > id = IXSEQ_TO_IPCID(num, > kxsema[num].u.sem_perm); > - if (semctl(id, IPC_RMID, NULL) < 0) { > + if (semctl(id, 0, IPC_RMID, NULL) < 0) { > if (rmverbose > 1) > warn("semid(%d): ", id); > errflg++; > _______________________________________________ > svn-src-head@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > Nice, thank you very much! All the best. -- -- Marcelo Araujo (__)araujo@FreeBSD.org \\\'',)http://www.FreeBSD.org \/ \ ^ Power To Server. .\. /_) From owner-svn-src-all@freebsd.org Fri Jul 31 03:28:04 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2FAEF9AE6EE; Fri, 31 Jul 2015 03:28:04 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 08F5A10CE; Fri, 31 Jul 2015 03:28:04 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6V3S3Zx087651; Fri, 31 Jul 2015 03:28:03 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6V3S3LC087650; Fri, 31 Jul 2015 03:28:03 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <201507310328.t6V3S3LC087650@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Fri, 31 Jul 2015 03:28:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286103 - head/share/man/man9 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 03:28:04 -0000 Author: jmg Date: Fri Jul 31 03:28:02 2015 New Revision: 286103 URL: https://svnweb.freebsd.org/changeset/base/286103 Log: The implementation note isn't true anymore.. Not that anyone reads it, but those that do, remind them that this isn't usable in userland... I can't wait till this doc is wrong.. Modified: head/share/man/man9/CTASSERT.9 Modified: head/share/man/man9/CTASSERT.9 ============================================================================== --- head/share/man/man9/CTASSERT.9 Fri Jul 31 01:12:31 2015 (r286102) +++ head/share/man/man9/CTASSERT.9 Fri Jul 31 03:28:02 2015 (r286103) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 5, 2008 +.Dd July 30, 2015 .Dt CTASSERT 9 .Os .Sh NAME @@ -48,14 +48,10 @@ The macro is useful for asserting the size or alignment of important data structures and variables during compilation, which would otherwise cause the code to fail at run time. -.Sh IMPLEMENTATION NOTES +.Pp The .Fn CTASSERT -macro should not be used in a header file. -It is implemented using a dummy typedef, with a name (based on line number) -that may conflict with a -.Fn CTASSERT -in a source file including that header. +macro is not usable in userland. .Sh EXAMPLES Assert that the size of the .Vt uuid From owner-svn-src-all@freebsd.org Fri Jul 31 03:35:29 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58C5A9AE83C; Fri, 31 Jul 2015 03:35:29 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 352FD1626; Fri, 31 Jul 2015 03:35:29 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6V3ZSpm091566; Fri, 31 Jul 2015 03:35:28 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6V3ZSl3091565; Fri, 31 Jul 2015 03:35:28 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201507310335.t6V3ZSl3091565@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Fri, 31 Jul 2015 03:35:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286104 - stable/10/sys/dev/e1000 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 03:35:29 -0000 Author: kevlo Date: Fri Jul 31 03:35:27 2015 New Revision: 286104 URL: https://svnweb.freebsd.org/changeset/base/286104 Log: MFC r285623: Fix typo in register definition. Submitted by: James Hung Reviewed by: sbruno Modified: stable/10/sys/dev/e1000/e1000_regs.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/e1000/e1000_regs.h ============================================================================== --- stable/10/sys/dev/e1000/e1000_regs.h Fri Jul 31 03:28:02 2015 (r286103) +++ stable/10/sys/dev/e1000/e1000_regs.h Fri Jul 31 03:35:27 2015 (r286104) @@ -552,7 +552,7 @@ #define E1000_WVBR 0x03554 /* VM Wrong Behavior - RWS */ #define E1000_RPLOLR 0x05AF0 /* Replication Offload - RW */ #define E1000_UTA 0x0A000 /* Unicast Table Array - RW */ -#define E1000_IOVTCL 0x05BBC /* IOV Control Register */ +#define E1000_IOVCTL 0x05BBC /* IOV Control Register */ #define E1000_VMRCTL 0X05D80 /* Virtual Mirror Rule Control */ #define E1000_VMRVLAN 0x05D90 /* Virtual Mirror Rule VLAN */ #define E1000_VMRVM 0x05DA0 /* Virtual Mirror Rule VM */ From owner-svn-src-all@freebsd.org Fri Jul 31 03:40:11 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 461119AE8B0; Fri, 31 Jul 2015 03:40:11 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 098701910; Fri, 31 Jul 2015 03:40:11 +0000 (UTC) (envelope-from kevlo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6V3eACF091830; Fri, 31 Jul 2015 03:40:10 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6V3eA2G091828; Fri, 31 Jul 2015 03:40:10 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201507310340.t6V3eA2G091828@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Fri, 31 Jul 2015 03:40:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286105 - stable/10/sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 03:40:11 -0000 Author: kevlo Date: Fri Jul 31 03:40:09 2015 New Revision: 286105 URL: https://svnweb.freebsd.org/changeset/base/286105 Log: MFC r285669: Since the IETF has redefined the meaning of the tos field to accommodate a set of differentiated services, set IPTOS_PREC_* macros using IPTOS_DSCP_* macro definitions. While here, add IPTOS_DSCP_VA macro according to RFC 5865. Differential Revision: https://reviews.freebsd.org/D3119 Reviewed by: gnn Modified: stable/10/sys/netinet/ip.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet/ip.h ============================================================================== --- stable/10/sys/netinet/ip.h Fri Jul 31 03:35:27 2015 (r286104) +++ stable/10/sys/netinet/ip.h Fri Jul 31 03:40:09 2015 (r286105) @@ -80,19 +80,19 @@ struct ip { #define IPTOS_MINCOST 0x02 /* - * Definitions for IP precedence (also in ip_tos) (hopefully unused). + * Definitions for IP precedence (also in ip_tos) (deprecated). */ -#define IPTOS_PREC_NETCONTROL 0xe0 -#define IPTOS_PREC_INTERNETCONTROL 0xc0 -#define IPTOS_PREC_CRITIC_ECP 0xa0 -#define IPTOS_PREC_FLASHOVERRIDE 0x80 -#define IPTOS_PREC_FLASH 0x60 -#define IPTOS_PREC_IMMEDIATE 0x40 -#define IPTOS_PREC_PRIORITY 0x20 -#define IPTOS_PREC_ROUTINE 0x00 +#define IPTOS_PREC_NETCONTROL IPTOS_DSCP_CS7 +#define IPTOS_PREC_INTERNETCONTROL IPTOS_DSCP_CS6 +#define IPTOS_PREC_CRITIC_ECP IPTOS_DSCP_CS5 +#define IPTOS_PREC_FLASHOVERRIDE IPTOS_DSCP_CS4 +#define IPTOS_PREC_FLASH IPTOS_DSCP_CS3 +#define IPTOS_PREC_IMMEDIATE IPTOS_DSCP_CS2 +#define IPTOS_PREC_PRIORITY IPTOS_DSCP_CS1 +#define IPTOS_PREC_ROUTINE IPTOS_DSCP_CS0 /* - * Definitions for DiffServ Codepoints as per RFC2474 + * Definitions for DiffServ Codepoints as per RFC2474 and RFC5865. */ #define IPTOS_DSCP_CS0 0x00 #define IPTOS_DSCP_CS1 0x20 @@ -112,6 +112,7 @@ struct ip { #define IPTOS_DSCP_AF42 0x90 #define IPTOS_DSCP_AF43 0x98 #define IPTOS_DSCP_CS5 0xa0 +#define IPTOS_DSCP_VA 0xb0 #define IPTOS_DSCP_EF 0xb8 #define IPTOS_DSCP_CS6 0xc0 #define IPTOS_DSCP_CS7 0xe0 From owner-svn-src-all@freebsd.org Fri Jul 31 04:12:53 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E7BCC9AEDD7; Fri, 31 Jul 2015 04:12:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D3D2F6A4; Fri, 31 Jul 2015 04:12:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6V4CqVq007541; Fri, 31 Jul 2015 04:12:52 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6V4CqZv007540; Fri, 31 Jul 2015 04:12:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201507310412.t6V4CqZv007540@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 31 Jul 2015 04:12:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286106 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 04:12:53 -0000 Author: kib Date: Fri Jul 31 04:12:51 2015 New Revision: 286106 URL: https://svnweb.freebsd.org/changeset/base/286106 Log: vn_io_fault() handling of the LOR for i/o into the file-backed buffers has observable overhead when the buffer pages are not resident or not mapped. The overhead comes at least from two factors, one is the additional work needed to detect the situation, prepare and execute the rollbacks. Another is the consequence of the i/o splitting into the batches of the held pages, causing filesystems see series of the smaller i/o requests instead of the single large request. Note that expected case of the resident i/o buffer does not expose these issues. Provide a prefaulting for the userspace i/o buffers, disabled by default. I am careful of not enabling prefaulting by default for now, since it would be detrimental for the applications which speculatively pass extra-large buffers of anonymous memory to not deal with buffer sizing (if such apps exist). Found and tested by: bde, emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/kern/vfs_vnops.c Modified: head/sys/kern/vfs_vnops.c ============================================================================== --- head/sys/kern/vfs_vnops.c Fri Jul 31 03:40:09 2015 (r286105) +++ head/sys/kern/vfs_vnops.c Fri Jul 31 04:12:51 2015 (r286106) @@ -116,6 +116,9 @@ static const int io_hold_cnt = 16; static int vn_io_fault_enable = 1; SYSCTL_INT(_debug, OID_AUTO, vn_io_fault_enable, CTLFLAG_RW, &vn_io_fault_enable, 0, "Enable vn_io_fault lock avoidance"); +static int vn_io_fault_prefault = 0; +SYSCTL_INT(_debug, OID_AUTO, vn_io_fault_prefault, CTLFLAG_RW, + &vn_io_fault_prefault, 0, "Enable vn_io_fault prefaulting"); static u_long vn_io_faults_cnt; SYSCTL_ULONG(_debug, OID_AUTO, vn_io_faults, CTLFLAG_RD, &vn_io_faults_cnt, 0, "Count of vn_io_fault lock avoidance triggers"); @@ -1020,6 +1023,59 @@ vn_io_fault_doio(struct vn_io_fault_args uio->uio_rw); } +static int +vn_io_fault_touch(char *base, const struct uio *uio) +{ + int r; + + r = fubyte(base); + if (r == -1 || (uio->uio_rw == UIO_READ && subyte(base, r) == -1)) + return (EFAULT); + return (0); +} + +static int +vn_io_fault_prefault_user(const struct uio *uio) +{ + char *base; + const struct iovec *iov; + size_t len; + ssize_t resid; + int error, i; + + KASSERT(uio->uio_segflg == UIO_USERSPACE, + ("vn_io_fault_prefault userspace")); + + error = i = 0; + iov = uio->uio_iov; + resid = uio->uio_resid; + base = iov->iov_base; + len = iov->iov_len; + while (resid > 0) { + error = vn_io_fault_touch(base, uio); + if (error != 0) + break; + if (len < PAGE_SIZE) { + if (len != 0) { + error = vn_io_fault_touch(base + len - 1, uio); + if (error != 0) + break; + resid -= len; + } + if (++i >= uio->uio_iovcnt) + break; + iov = uio->uio_iov + i; + base = iov->iov_base; + len = iov->iov_len; + } else { + len -= PAGE_SIZE; + base += PAGE_SIZE; + resid -= PAGE_SIZE; + } + } + return (error); +} + /* * Common code for vn_io_fault(), agnostic to the kind of i/o request. * Uses vn_io_fault_doio() to make the call to an actual i/o function. @@ -1041,6 +1097,12 @@ vn_io_fault1(struct vnode *vp, struct ui ssize_t adv; int error, cnt, save, saveheld, prev_td_ma_cnt; + if (vn_io_fault_prefault) { + error = vn_io_fault_prefault_user(uio); + if (error != 0) + return (error); /* Or ignore ? */ + } + prot = uio->uio_rw == UIO_READ ? VM_PROT_WRITE : VM_PROT_READ; /* From owner-svn-src-all@freebsd.org Fri Jul 31 04:50:48 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F27FD9AD3D8; Fri, 31 Jul 2015 04:50:48 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E08B31655; Fri, 31 Jul 2015 04:50:48 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6V4ompN020295; Fri, 31 Jul 2015 04:50:48 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6V4omTo020293; Fri, 31 Jul 2015 04:50:48 GMT (envelope-from np@FreeBSD.org) Message-Id: <201507310450.t6V4omTo020293@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 31 Jul 2015 04:50:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286107 - head/sys/dev/cxgbe X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 04:50:49 -0000 Author: np Date: Fri Jul 31 04:50:47 2015 New Revision: 286107 URL: https://svnweb.freebsd.org/changeset/base/286107 Log: cxgbe(4): initialize debug_flags from the kernel environment. MFC after: 3 days Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Fri Jul 31 04:12:51 2015 (r286106) +++ head/sys/dev/cxgbe/t4_main.c Fri Jul 31 04:50:47 2015 (r286107) @@ -585,9 +585,7 @@ t4_attach(device_t dev) sc = device_get_softc(dev); sc->dev = dev; -#ifdef INVARIANTS - sc->debug_flags = DF_DUMP_MBOX; -#endif + TUNABLE_INT_FETCH("hw.cxgbe.debug_flags", &sc->debug_flags); pci_enable_busmaster(dev); if (pci_find_cap(dev, PCIY_EXPRESS, &i) == 0) { From owner-svn-src-all@freebsd.org Fri Jul 31 05:03:55 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DFB89AD646; Fri, 31 Jul 2015 05:03:55 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-io0-x22e.google.com (mail-io0-x22e.google.com [IPv6:2607:f8b0:4001:c06::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 091D21EAE; Fri, 31 Jul 2015 05:03:55 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: by ioeg141 with SMTP id g141so74989893ioe.3; Thu, 30 Jul 2015 22:03:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=c3tgilxRuJfr7HYXSsX7lVuJHnbvg7d6Zw0gjo13Pio=; b=m8FjwjUD0k3y4Ftr9KcwXa5Skq1CT1MC16D/ugvdNKibCvDbRFVS6idsuqnqHW5VoP wWyPYcBZzy9VNAPVWAY0aCuSAP0/xWevDH5VDoRjlQBL6E2U8BxgVIMJnShmYPJ1v2ve zLd4Ek2rUqnfIuTfg5xQoKJZAMnaP3C2KofTM4G50u+YABEX3Vcvc1E7/ml93/yC/lDs bQAuSbNZw2LeI57aLBByTXCoz+6KM0s3C/0QPYrdGE/I1PDgy7Oi83GF0N15oSVajkDn LgFaaU97XvJc1GOTvwSigwqSJDljgXXrNae+HLGwg6LvjK3cOH3c/8l9ebtod3fKOCCZ rCZQ== MIME-Version: 1.0 X-Received: by 10.107.36.134 with SMTP id k128mr1328987iok.113.1438319034472; Thu, 30 Jul 2015 22:03:54 -0700 (PDT) Received: by 10.107.131.97 with HTTP; Thu, 30 Jul 2015 22:03:54 -0700 (PDT) Received: by 10.107.131.97 with HTTP; Thu, 30 Jul 2015 22:03:54 -0700 (PDT) In-Reply-To: <201507310023.t6V0NLVT013789@repo.freebsd.org> References: <201507310023.t6V0NLVT013789@repo.freebsd.org> Date: Fri, 31 Jul 2015 01:03:54 -0400 Message-ID: Subject: Re: svn commit: r286100 - in head/sys: net netipsec From: Ryan Stone To: John-Mark Gurney Cc: src-committers@freebsd.org, svn-src-head@freebsd.org, svn-src-all@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 05:03:55 -0000 You can't use CTASSERT in a header. You'll get a compile error if two different headers included in the same translation unit have a CTASSERT on the same line number. On Jul 30, 2015 5:23 PM, "John-Mark Gurney" wrote: > Author: jmg > Date: Fri Jul 31 00:23:21 2015 > New Revision: 286100 > URL: https://svnweb.freebsd.org/changeset/base/286100 > > Log: > Clean up this header file... > > use CTASSERTs now that we have them... > > Replace a draft w/ RFC that's over 10 years old. > > Note that _AALG and _EALG do not need to match what the IKE daemons > think they should be.. This is part of the KABI... I decided to > renumber AESCTR, but since we've never had working AESCTR mode, I'm > not really breaking anything.. and it shortens a loop by quite > a bit.. > > remove SKIPJACK IPsec support... SKIPJACK never made it out of draft > (in 1999), only has 80bit key, NIST recommended it stop being used > after 2010, and setkey nor any of the IKE daemons I checked supported > it... > > jmgurney/ipsecgcm: a357a33, c75808b, e008669, b27b6d6 > > Reviewed by: gnn (earlier version) > > Modified: > head/sys/net/pfkeyv2.h > head/sys/netipsec/xform_esp.c > > Modified: head/sys/net/pfkeyv2.h > > ============================================================================== > --- head/sys/net/pfkeyv2.h Fri Jul 31 00:21:40 2015 (r286099) > +++ head/sys/net/pfkeyv2.h Fri Jul 31 00:23:21 2015 (r286100) > @@ -218,7 +218,6 @@ struct sadb_x_sa2 { > }; > > /* XXX Policy Extension */ > -/* sizeof(struct sadb_x_policy) == 16 */ > struct sadb_x_policy { > u_int16_t sadb_x_policy_len; > u_int16_t sadb_x_policy_exttype; > @@ -228,6 +227,8 @@ struct sadb_x_policy { > u_int32_t sadb_x_policy_id; > u_int32_t sadb_x_policy_reserved2; > }; > +CTASSERT(sizeof(struct sadb_x_policy) == 16); > + > /* > * When policy_type == IPSEC, it is followed by some of > * the ipsec policy request. > @@ -256,31 +257,31 @@ struct sadb_x_ipsecrequest { > }; > > /* NAT-Traversal type, see RFC 3948 (and drafts). */ > -/* sizeof(struct sadb_x_nat_t_type) == 8 */ > struct sadb_x_nat_t_type { > u_int16_t sadb_x_nat_t_type_len; > u_int16_t sadb_x_nat_t_type_exttype; > u_int8_t sadb_x_nat_t_type_type; > u_int8_t sadb_x_nat_t_type_reserved[3]; > }; > +CTASSERT(sizeof(struct sadb_x_nat_t_type) == 8); > > /* NAT-Traversal source or destination port. */ > -/* sizeof(struct sadb_x_nat_t_port) == 8 */ > struct sadb_x_nat_t_port { > u_int16_t sadb_x_nat_t_port_len; > u_int16_t sadb_x_nat_t_port_exttype; > u_int16_t sadb_x_nat_t_port_port; > u_int16_t sadb_x_nat_t_port_reserved; > }; > +CTASSERT(sizeof(struct sadb_x_nat_t_port) == 8); > > /* ESP fragmentation size. */ > -/* sizeof(struct sadb_x_nat_t_frag) == 8 */ > struct sadb_x_nat_t_frag { > u_int16_t sadb_x_nat_t_frag_len; > u_int16_t sadb_x_nat_t_frag_exttype; > u_int16_t sadb_x_nat_t_frag_fraglen; > u_int16_t sadb_x_nat_t_frag_reserved; > }; > +CTASSERT(sizeof(struct sadb_x_nat_t_frag) == 8); > > > #define SADB_EXT_RESERVED 0 > @@ -332,46 +333,47 @@ struct sadb_x_nat_t_frag { > > #define SADB_SAFLAGS_PFS 1 > > -/* RFC2367 numbers - meets RFC2407 */ > +/* > + * Though some of these numbers (both _AALG and _EALG) appear to be > + * IKEv2 numbers and others original IKE numbers, they have no meaning. > + * These are constants that the various IKE daemons use to tell the kernel > + * what cipher to use. > + * > + * Do not use these constants directly to decide which Transformation ID > + * to send. You are responsible for mapping them yourself. > + */ > #define SADB_AALG_NONE 0 > #define SADB_AALG_MD5HMAC 2 > #define SADB_AALG_SHA1HMAC 3 > #define SADB_AALG_MAX 252 > -/* private allocations - based on RFC2407/IANA assignment */ > #define SADB_X_AALG_SHA2_256 5 > #define SADB_X_AALG_SHA2_384 6 > #define SADB_X_AALG_SHA2_512 7 > #define SADB_X_AALG_RIPEMD160HMAC 8 > -#define SADB_X_AALG_AES_XCBC_MAC 9 /* > draft-ietf-ipsec-ciph-aes-xcbc-mac-04 */ > +#define SADB_X_AALG_AES_XCBC_MAC 9 /* RFC3566 */ > #define SADB_X_AALG_AES128GMAC 11 /* RFC4543 + Errata1821 */ > #define SADB_X_AALG_AES192GMAC 12 > #define SADB_X_AALG_AES256GMAC 13 > -/* private allocations should use 249-255 (RFC2407) */ > #define SADB_X_AALG_MD5 249 /* Keyed MD5 */ > #define SADB_X_AALG_SHA 250 /* Keyed SHA */ > #define SADB_X_AALG_NULL 251 /* null authentication */ > #define SADB_X_AALG_TCP_MD5 252 /* Keyed TCP-MD5 (RFC2385) */ > > -/* RFC2367 numbers - meets RFC2407 */ > #define SADB_EALG_NONE 0 > #define SADB_EALG_DESCBC 2 > #define SADB_EALG_3DESCBC 3 > -#define SADB_EALG_NULL 11 > -#define SADB_EALG_MAX 250 > -/* private allocations - based on RFC2407/IANA assignment */ > #define SADB_X_EALG_CAST128CBC 6 > #define SADB_X_EALG_BLOWFISHCBC 7 > +#define SADB_EALG_NULL 11 > #define SADB_X_EALG_RIJNDAELCBC 12 > #define SADB_X_EALG_AES 12 > +#define SADB_X_EALG_AESCTR 13 > #define SADB_X_EALG_AESGCM8 18 /* RFC4106 */ > #define SADB_X_EALG_AESGCM12 19 > #define SADB_X_EALG_AESGCM16 20 > -/* private allocations - based on RFC4312/IANA assignment */ > -#define SADB_X_EALG_CAMELLIACBC 22 > -#define SADB_X_EALG_AESGMAC 23 /* RFC4543 + Errata1821 > */ > -/* private allocations should use 249-255 (RFC2407) */ > -#define SADB_X_EALG_SKIPJACK 249 /*250*/ /* for IPSEC */ > -#define SADB_X_EALG_AESCTR 250 /*249*/ /* > draft-ietf-ipsec-ciph-aes-ctr-03 */ > +#define SADB_X_EALG_CAMELLIACBC 22 > +#define SADB_X_EALG_AESGMAC 23 /* RFC4543 + Errata1821 */ > +#define SADB_EALG_MAX 23 /* !!! keep updated !!! */ > > /* private allocations - based on RFC2407/IANA assignment */ > #define SADB_X_CALG_NONE 0 > > Modified: head/sys/netipsec/xform_esp.c > > ============================================================================== > --- head/sys/netipsec/xform_esp.c Fri Jul 31 00:21:40 2015 > (r286099) > +++ head/sys/netipsec/xform_esp.c Fri Jul 31 00:23:21 2015 > (r286100) > @@ -115,8 +115,6 @@ esp_algorithm_lookup(int alg) > return &enc_xform_blf; > case SADB_X_EALG_CAST128CBC: > return &enc_xform_cast5; > - case SADB_X_EALG_SKIPJACK: > - return &enc_xform_skipjack; > case SADB_EALG_NULL: > return &enc_xform_null; > case SADB_X_EALG_CAMELLIACBC: > > From owner-svn-src-all@freebsd.org Fri Jul 31 05:32:03 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89ECF9ADA54; Fri, 31 Jul 2015 05:32:03 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "gold.funkthat.com", Issuer "gold.funkthat.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 522E7A37; Fri, 31 Jul 2015 05:32:02 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (localhost [127.0.0.1]) by gold.funkthat.com (8.14.5/8.14.5) with ESMTP id t6V5W1q1040606 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 30 Jul 2015 22:32:01 -0700 (PDT) (envelope-from jmg@gold.funkthat.com) Received: (from jmg@localhost) by gold.funkthat.com (8.14.5/8.14.5/Submit) id t6V5W1nd040605; Thu, 30 Jul 2015 22:32:01 -0700 (PDT) (envelope-from jmg) Date: Thu, 30 Jul 2015 22:32:01 -0700 From: John-Mark Gurney To: Ryan Stone Cc: src-committers@freebsd.org, svn-src-head@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r286100 - in head/sys: net netipsec Message-ID: <20150731053201.GX78154@funkthat.com> References: <201507310023.t6V0NLVT013789@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 9.1-PRERELEASE amd64 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? User-Agent: Mutt/1.5.21 (2010-09-15) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (gold.funkthat.com [127.0.0.1]); Thu, 30 Jul 2015 22:32:02 -0700 (PDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 05:32:03 -0000 Ryan Stone wrote this message on Fri, Jul 31, 2015 at 01:03 -0400: > You can't use CTASSERT in a header. You'll get a compile error if two Testing a fix now... > different headers included in the same translation unit have a CTASSERT on > the same line number. Not w/ clang anymore... _Static_assert is now a built-in.. And we have a few CTASSERTs in header files already... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-all@freebsd.org Fri Jul 31 06:22:01 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9AA959AE359; Fri, 31 Jul 2015 06:22:01 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id 19C0215D; Fri, 31 Jul 2015 06:22:00 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 1B53F780E0F; Fri, 31 Jul 2015 16:21:56 +1000 (AEST) Date: Fri, 31 Jul 2015 16:21:55 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: John-Mark Gurney cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r286103 - head/share/man/man9 In-Reply-To: <201507310328.t6V3S3LC087650@repo.freebsd.org> Message-ID: <20150731152253.Y1843@besplex.bde.org> References: <201507310328.t6V3S3LC087650@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=XMDNMlVE c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=kj9zAlcOel0A:10 a=v-9ZHCdgJD6Ir3PCf3AA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 06:22:01 -0000 On Fri, 31 Jul 2015, John-Mark Gurney wrote: > Log: > The implementation note isn't true anymore.. > > Not that anyone reads it, but those that do, remind them that this > isn't usable in userland... I can't wait till this doc is wrong.. It goes without saying that an API documented in a section 9 man page isn't usable in userland In this case, it is obviously even more unusable in userland, because the documentation specifies including . That header is undocumented, but everyone should know that it it is kernel-only. Only the following places in userland include it: contrib/ipfilter (17 files) # Seems to be unused compatibility mistakes. Never actually included. contrib/ntp/libparse/Makefile.am contrib/ntp/libparse/Makefile.in contrib/ntp/CommitLog-4.1.0 contrib/ntp/CommitLog contrib/top/Changes (log of when it was used for Pyramid in 1987) # Closely related to this commit. vis.c is ifdefed to use CTASSERT(). # The ifdef is very convoluted, ugly and of course broken. All systems # except NetBSD are assumed to have CTASSERT(). Probably no system # except FreeBSD has it (that is the broken part). But the ifdef is # especially ugly for FreeBSD. It documents the detail that you just # removed -- that the CTASSERT() in only works in the # kernel. So vis.c doesn't use the kernel version. It provides its # own version. This begins badly with '#ifdef CTASSERT'. CTASSERT # can only be defined if some system provides it as namespace pollution. # Then the definition of CTASSERT seems to be the old FreeBSD one -- # the one that doesn't really work. But it doesn't really work just # as well everywhere. Only it being in prevents it being # used in userland. # # This mess of ifdefs takes 24 lines. 22 for the ifdef, 1 line for # formatting, and 1 line to actually use CTASSERT(). contrib/libc-vis/vis.c Your change may be incorrect due to a similar mess of ifdefs for defining CTASSERT in the kernel. It is defined in terms of _Static_assert, and _Static_assert is defined in a mess if ifdefs in . I think these ifdefs are just broken in all cases for old compilers instead of only in rare cases. For gcc before 4.6, the ifdef reduces to using __COUNTER__ as the second variable if __COUNTER__ is supported, else nothing. So for the undocumented subset of compilers that support __COUNTER__ all cases work, and for the complementary subset no cases work (the macro is null). This is incompatible with old versions of the macro, where there were no ifdefs and most cases worked. The implementation still has the bug of not parenthesizing the args except in 1 place. # Probably OK since for the kernel: cddl/contrib/opensolaris/common/ctf/ctf_impl.h cddl/contrib/dtracetoolkit/Bin/swapinfo.d cddl/contrib/dtracetoolkit/Mem/swapinfo.d cddl/contrib/dtracetoolkit/Man/man1m/swapinfo.d.1m # OK since for the kernel (shared file with _KERNEL ifdefs): lib/libc/gmon/mcount.c # Probably OK since for the kernel (shared file with _KERNEL ifdefs): lib/libmd/md5c.c # Looks like kernel support: usr.sbin/ndiscvt/windrv_stub.c # Just a rotted comment (pointer to where something no longer is in the kernel): usr.sbin/pciconf/cap.c sbin/hastd/activemap.c # Generate include of : usr.sbin/config/mkmakefile.c # Undef _KERNEL ifdef: usr.sbin/makefs/ffs/ffs_bswap.c # Not checked: tools/regression/kthread/kld/kthrdlk.c tools/regression/net80211/ccmp/test_ccmp.c tools/regression/net80211/tkip/test_tkip.c tools/regression/net80211/wep/test_wep.c tools/regression/redzone9/redzone.c tools/tools/kttcp/sys/kttcp.c tools/tools/vhba/vhba.h share/man/man9 (34 files) # Kernelish: share/examples/kld/dyn_sysctl/dyn_sysctl.c share/examples/kld/syscall/module/syscall.c share/examples/kld/random_adaptor/random_adaptor_example.c share/examples/kld/firmware/fwconsumer/fw_consumer.c share/examples/kld/cdev/module/cdev.c share/examples/kld/cdev/module/cdevmod.c share/examples/drivers/make_device_driver.sh share/examples/drivers/make_pseudo_driver.sh Summary: userland has very little abuse of . It has related errors in 3 files: - ugliness in in contrib/libc-vis/vis.c - rotted comments in usr.sbin/pciconf/cap.c and sbin/hastd/activemap.c. Bruce From owner-svn-src-all@freebsd.org Fri Jul 31 06:33:15 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3EDA9AE506 for ; Fri, 31 Jul 2015 06:33:15 +0000 (UTC) (envelope-from computerpricewatch.com@web36c45.carrierzone.com) Received: from mailrelay2c45.carrierzone.com (mailrelay2c45.carrierzone.com [216.55.147.151]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 669A3868 for ; Fri, 31 Jul 2015 06:33:14 +0000 (UTC) (envelope-from computerpricewatch.com@web36c45.carrierzone.com) Received: from web36c45.carrierzone.com (web36c45.carrierzone.com [216.55.146.36]) by mailrelay2c45.carrierzone.com (8.13.6/8.13.1) with ESMTP id t6V5vkmX000777 for ; Fri, 31 Jul 2015 01:57:46 -0400 Received: from web36c45.carrierzone.com (localhost [127.0.0.1]) by web36c45.carrierzone.com (8.14.4/8.14.4) with ESMTP id t6V5vkTb021541 for ; Fri, 31 Jul 2015 01:57:46 -0400 Received: (from computerpricewatch.com@localhost) by web36c45.carrierzone.com (8.14.4/8.14.4/Submit) id t6V5vimb021540; Fri, 31 Jul 2015 01:57:44 -0400 To: svn-src-all@freebsd.org Subject: Notice of appearance in Court #0000490706 Date: Fri, 31 Jul 2015 01:57:44 -0400 From: "State Court" Reply-To: "State Court" Message-ID: <3eeb5da523b2f5977f80a1d7b7c88240@computerpricewatch.com> X-Priority: 3 MIME-Version: 1.0 X-CTCH-Spam: Suspect X-CTCH-RefID: str=0001.0A020204.55BB0E5A.0201:SCFSTAT31557435, ss=1, re=-4.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, sb=2 Content-Type: text/plain; charset=us-ascii X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 06:33:16 -0000 Notice to Appear, You have to appear in the Court on the August 06. Please, do not forget to bring all the documents related to the case. Note: If you do not come, the case will be heard in your absence. The copy of Court Notice is attached to this email. Regards, Mitchell Ashley, Court Secretary. From owner-svn-src-all@freebsd.org Fri Jul 31 07:03:16 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 484F69AEBFE; Fri, 31 Jul 2015 07:03:16 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "gold.funkthat.com", Issuer "gold.funkthat.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 14C1F1892; Fri, 31 Jul 2015 07:03:15 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (localhost [127.0.0.1]) by gold.funkthat.com (8.14.5/8.14.5) with ESMTP id t6V73EhE041732 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 31 Jul 2015 00:03:14 -0700 (PDT) (envelope-from jmg@gold.funkthat.com) Received: (from jmg@localhost) by gold.funkthat.com (8.14.5/8.14.5/Submit) id t6V73ECm041731; Fri, 31 Jul 2015 00:03:14 -0700 (PDT) (envelope-from jmg) Date: Fri, 31 Jul 2015 00:03:14 -0700 From: John-Mark Gurney To: Bruce Evans Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r286103 - head/share/man/man9 Message-ID: <20150731070314.GY78154@funkthat.com> References: <201507310328.t6V3S3LC087650@repo.freebsd.org> <20150731152253.Y1843@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150731152253.Y1843@besplex.bde.org> X-Operating-System: FreeBSD 9.1-PRERELEASE amd64 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? User-Agent: Mutt/1.5.21 (2010-09-15) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (gold.funkthat.com [127.0.0.1]); Fri, 31 Jul 2015 00:03:14 -0700 (PDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 07:03:16 -0000 Bruce Evans wrote this message on Fri, Jul 31, 2015 at 16:21 +1000: > On Fri, 31 Jul 2015, John-Mark Gurney wrote: > > > Log: > > The implementation note isn't true anymore.. > > > > Not that anyone reads it, but those that do, remind them that this > > isn't usable in userland... I can't wait till this doc is wrong.. > > It goes without saying that an API documented in a section 9 man page > isn't usable in userland I think you mean that some API's are well documented in section 9 and undocumented in section 3. For example, atomic(9) is used in userland in such places as libthr, jemalloc, and more. > In this case, it is obviously even more unusable in userland, because > the documentation specifies including . That header is > undocumented, but everyone should know that it it is kernel-only. Well, now I know.. it'd be nice to document it w/ an ifndef _KERNEL/error line.. or at least a comment... or even in the documentation... [...] -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-all@freebsd.org Fri Jul 31 07:03:17 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 753B39AEC06; Fri, 31 Jul 2015 07:03:17 +0000 (UTC) (envelope-from erwin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 56D151893; Fri, 31 Jul 2015 07:03:17 +0000 (UTC) (envelope-from erwin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6V73GUR075214; Fri, 31 Jul 2015 07:03:16 GMT (envelope-from erwin@FreeBSD.org) Received: (from erwin@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6V737aT075186; Fri, 31 Jul 2015 07:03:07 GMT (envelope-from erwin@FreeBSD.org) Message-Id: <201507310703.t6V737aT075186@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erwin set sender to erwin@FreeBSD.org using -f From: Erwin Lansing Date: Fri, 31 Jul 2015 07:03:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r286108 - in vendor/bind9/dist: . doc/arm lib/dns lib/lwres/man X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 07:03:17 -0000 Author: erwin Date: Fri Jul 31 07:03:06 2015 New Revision: 286108 URL: https://svnweb.freebsd.org/changeset/base/286108 Log: Vendor import of BIND 9.9.7-P2 Sponsored by: DK Hostmaster A/S Modified: vendor/bind9/dist/CHANGES vendor/bind9/dist/README vendor/bind9/dist/doc/arm/Bv9ARM.ch01.html vendor/bind9/dist/doc/arm/Bv9ARM.ch02.html vendor/bind9/dist/doc/arm/Bv9ARM.ch03.html vendor/bind9/dist/doc/arm/Bv9ARM.ch04.html vendor/bind9/dist/doc/arm/Bv9ARM.ch05.html vendor/bind9/dist/doc/arm/Bv9ARM.ch06.html vendor/bind9/dist/doc/arm/Bv9ARM.ch07.html vendor/bind9/dist/doc/arm/Bv9ARM.ch08.html vendor/bind9/dist/doc/arm/Bv9ARM.ch09.html vendor/bind9/dist/doc/arm/Bv9ARM.ch10.html vendor/bind9/dist/doc/arm/Bv9ARM.ch11.html vendor/bind9/dist/doc/arm/Bv9ARM.ch12.html vendor/bind9/dist/doc/arm/Bv9ARM.ch13.html vendor/bind9/dist/doc/arm/Bv9ARM.html vendor/bind9/dist/doc/arm/Bv9ARM.pdf vendor/bind9/dist/doc/arm/man.arpaname.html vendor/bind9/dist/doc/arm/man.ddns-confgen.html vendor/bind9/dist/doc/arm/man.dig.html vendor/bind9/dist/doc/arm/man.dnssec-checkds.html vendor/bind9/dist/doc/arm/man.dnssec-coverage.html vendor/bind9/dist/doc/arm/man.dnssec-dsfromkey.html vendor/bind9/dist/doc/arm/man.dnssec-keyfromlabel.html vendor/bind9/dist/doc/arm/man.dnssec-keygen.html vendor/bind9/dist/doc/arm/man.dnssec-revoke.html vendor/bind9/dist/doc/arm/man.dnssec-settime.html vendor/bind9/dist/doc/arm/man.dnssec-signzone.html vendor/bind9/dist/doc/arm/man.dnssec-verify.html vendor/bind9/dist/doc/arm/man.genrandom.html vendor/bind9/dist/doc/arm/man.host.html vendor/bind9/dist/doc/arm/man.isc-hmac-fixup.html vendor/bind9/dist/doc/arm/man.named-checkconf.html vendor/bind9/dist/doc/arm/man.named-checkzone.html vendor/bind9/dist/doc/arm/man.named-journalprint.html vendor/bind9/dist/doc/arm/man.named.html vendor/bind9/dist/doc/arm/man.nsec3hash.html vendor/bind9/dist/doc/arm/man.nsupdate.html vendor/bind9/dist/doc/arm/man.rndc-confgen.html vendor/bind9/dist/doc/arm/man.rndc.conf.html vendor/bind9/dist/doc/arm/man.rndc.html vendor/bind9/dist/doc/arm/notes.html vendor/bind9/dist/doc/arm/notes.pdf vendor/bind9/dist/doc/arm/notes.xml vendor/bind9/dist/lib/dns/api vendor/bind9/dist/lib/dns/tkey.c vendor/bind9/dist/lib/dns/validator.c vendor/bind9/dist/lib/lwres/man/lwres.html vendor/bind9/dist/lib/lwres/man/lwres_buffer.html vendor/bind9/dist/lib/lwres/man/lwres_config.html vendor/bind9/dist/lib/lwres/man/lwres_context.html vendor/bind9/dist/lib/lwres/man/lwres_gabn.html vendor/bind9/dist/lib/lwres/man/lwres_gai_strerror.html vendor/bind9/dist/lib/lwres/man/lwres_getaddrinfo.html vendor/bind9/dist/lib/lwres/man/lwres_gethostent.html vendor/bind9/dist/lib/lwres/man/lwres_getipnode.html vendor/bind9/dist/lib/lwres/man/lwres_getnameinfo.html vendor/bind9/dist/lib/lwres/man/lwres_getrrsetbyname.html vendor/bind9/dist/lib/lwres/man/lwres_gnba.html vendor/bind9/dist/lib/lwres/man/lwres_hstrerror.html vendor/bind9/dist/lib/lwres/man/lwres_inetntop.html vendor/bind9/dist/lib/lwres/man/lwres_noop.html vendor/bind9/dist/lib/lwres/man/lwres_packet.html vendor/bind9/dist/lib/lwres/man/lwres_resutil.html vendor/bind9/dist/version Modified: vendor/bind9/dist/CHANGES ============================================================================== --- vendor/bind9/dist/CHANGES Fri Jul 31 04:50:47 2015 (r286107) +++ vendor/bind9/dist/CHANGES Fri Jul 31 07:03:06 2015 (r286108) @@ -1,3 +1,14 @@ + --- 9.9.7-P2 released --- + +4165. [security] A failure to reset a value to NULL in tkey.c could + result in an assertion failure. (CVE-2015-5477) + [RT #40046] + + --- 9.9.7-P1 released --- + +4138. [bug] An uninitialized value in validator.c could result + in an assertion failure. (CVE-2015-4620) [RT #39795] + --- 9.9.7 released --- --- 9.9.7rc2 released --- @@ -8380,7 +8391,7 @@ on the responses. [RT #2454] 1208. [bug] dns_master_load*() failed to log a error message if - an error was detected when parsing the ownername of + an error was detected when parsing the owner name of a record. [RT #2448] 1207. [bug] libbind: getaddrinfo() could call freeaddrinfo() with Modified: vendor/bind9/dist/README ============================================================================== --- vendor/bind9/dist/README Fri Jul 31 04:50:47 2015 (r286107) +++ vendor/bind9/dist/README Fri Jul 31 07:03:06 2015 (r286108) @@ -51,6 +51,15 @@ BIND 9 For up-to-date release notes and errata, see http://www.isc.org/software/bind9/releasenotes +BIND 9.9.7-P2 + + BIND 9.9.7-P1 is a security release addressing the flaw + described in CVE-2015-5477. + +BIND 9.9.7-P1 + + BIND 9.9.7-P1 is a security release addressing the flaw + described in CVE-2015-4620. BIND 9.9.7 Modified: vendor/bind9/dist/doc/arm/Bv9ARM.ch01.html ============================================================================== --- vendor/bind9/dist/doc/arm/Bv9ARM.ch01.html Fri Jul 31 04:50:47 2015 (r286107) +++ vendor/bind9/dist/doc/arm/Bv9ARM.ch01.html Fri Jul 31 07:03:06 2015 (r286108) @@ -556,6 +556,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: vendor/bind9/dist/doc/arm/Bv9ARM.ch02.html ============================================================================== --- vendor/bind9/dist/doc/arm/Bv9ARM.ch02.html Fri Jul 31 04:50:47 2015 (r286107) +++ vendor/bind9/dist/doc/arm/Bv9ARM.ch02.html Fri Jul 31 07:03:06 2015 (r286108) @@ -154,6 +154,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: vendor/bind9/dist/doc/arm/Bv9ARM.ch03.html ============================================================================== --- vendor/bind9/dist/doc/arm/Bv9ARM.ch03.html Fri Jul 31 04:50:47 2015 (r286107) +++ vendor/bind9/dist/doc/arm/Bv9ARM.ch03.html Fri Jul 31 07:03:06 2015 (r286108) @@ -665,6 +665,6 @@ controls { -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: vendor/bind9/dist/doc/arm/Bv9ARM.ch04.html ============================================================================== --- vendor/bind9/dist/doc/arm/Bv9ARM.ch04.html Fri Jul 31 04:50:47 2015 (r286107) +++ vendor/bind9/dist/doc/arm/Bv9ARM.ch04.html Fri Jul 31 07:03:06 2015 (r286108) @@ -1935,6 +1935,6 @@ $ORIGIN 0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2. -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: vendor/bind9/dist/doc/arm/Bv9ARM.ch05.html ============================================================================== --- vendor/bind9/dist/doc/arm/Bv9ARM.ch05.html Fri Jul 31 04:50:47 2015 (r286107) +++ vendor/bind9/dist/doc/arm/Bv9ARM.ch05.html Fri Jul 31 07:03:06 2015 (r286108) @@ -139,6 +139,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: vendor/bind9/dist/doc/arm/Bv9ARM.ch06.html ============================================================================== --- vendor/bind9/dist/doc/arm/Bv9ARM.ch06.html Fri Jul 31 04:50:47 2015 (r286107) +++ vendor/bind9/dist/doc/arm/Bv9ARM.ch06.html Fri Jul 31 07:03:06 2015 (r286108) @@ -11642,6 +11642,6 @@ HOST-127.EXAMPLE. MX 0 . -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: vendor/bind9/dist/doc/arm/Bv9ARM.ch07.html ============================================================================== --- vendor/bind9/dist/doc/arm/Bv9ARM.ch07.html Fri Jul 31 04:50:47 2015 (r286107) +++ vendor/bind9/dist/doc/arm/Bv9ARM.ch07.html Fri Jul 31 07:03:06 2015 (r286108) @@ -247,6 +247,6 @@ zone "example.com" { -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: vendor/bind9/dist/doc/arm/Bv9ARM.ch08.html ============================================================================== --- vendor/bind9/dist/doc/arm/Bv9ARM.ch08.html Fri Jul 31 04:50:47 2015 (r286107) +++ vendor/bind9/dist/doc/arm/Bv9ARM.ch08.html Fri Jul 31 07:03:06 2015 (r286108) @@ -135,6 +135,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: vendor/bind9/dist/doc/arm/Bv9ARM.ch09.html ============================================================================== --- vendor/bind9/dist/doc/arm/Bv9ARM.ch09.html Fri Jul 31 04:50:47 2015 (r286107) +++ vendor/bind9/dist/doc/arm/Bv9ARM.ch09.html Fri Jul 31 07:03:06 2015 (r286108) @@ -45,7 +45,7 @@

-Release Notes for BIND Version 9.9.7

+Release Notes for BIND Version 9.9.7-P2

Introduction

- This document summarizes changes since the last production release - of BIND on the corresponding major release branch. + This document summarizes changes since BIND 9.9.7. +

+

+ BIND 9.9.7-P2 addresses a security issue described in CVE-2015-5477. +

+

+ BIND 9.9.7-P1 addresses a security issue described in CVE-2015-4620.

@@ -86,42 +91,23 @@
  • - On servers configured to perform DNSSEC validation using - managed trust anchors (i.e., keys configured explicitly - via managed-keys, or implicitly - via dnssec-validation auto; or - dnssec-lookaside auto;), revoking - a trust anchor and sending a new untrusted replacement - could cause named to crash with an - assertion failure. This could occur in the event of a - botched key rollover, or potentially as a result of a - deliberate attack if the attacker was in position to - monitor the victim's DNS traffic. + A specially crafted query could trigger an assertion failure + in message.c.

    - This flaw was discovered by Jan-Piet Mens, and is - disclosed in CVE-2015-1349. [RT #38344] + This flaw was discovered by Jonathan Foote, and is disclosed + in CVE-2015-5477. [RT #39795]

  • - A flaw in delegation handling could be exploited to put - named into an infinite loop, in which - each lookup of a name server triggered additional lookups - of more name servers. This has been addressed by placing - limits on the number of levels of recursion - named will allow (default 7), and - on the number of queries that it will send before - terminating a recursive query (default 50). -

    -

    - The recursion depth limit is configured via the - max-recursion-depth option, and the query limit - via the max-recursion-queries option. + On servers configured to perform DNSSEC validation, an + assertion failure could be triggered on answers from + a specially configured server.

    - The flaw was discovered by Florian Maury of ANSSI, and is - disclosed in CVE-2014-8500. [RT #37580] + This flaw was discovered by Breno Silveira Soares, and is + disclosed in CVE-2015-4620. [RT #39795]

@@ -134,143 +120,12 @@

Feature Changes

-
    -
  • - NXDOMAIN responses to queries of type DS are now cached separately - from those for other types. This helps when using "grafted" zones - of type forward, for which the parent zone does not contain a - delegation, such as local top-level domains. Previously a query - of type DS for such a zone could cause the zone apex to be cached - as NXDOMAIN, blocking all subsequent queries. (Note: This - change is only helpful when DNSSEC validation is not enabled. - "Grafted" zones without a delegation in the parent are not a - recommended configuration.) -

  • -
  • - NOTIFY messages that are sent because a zone has been updated - are now given priority above NOTIFY messages that were scheduled - when the server started up. This should mitigate delays in zone - propagation when servers are restarted frequently. -

  • -
  • - Errors reported when running rndc addzone - (e.g., when a zone file cannot be loaded) have been clarified - to make it easier to diagnose problems. -

  • -
  • - Added support for OPENPGPKEY type. -

  • -
  • - When encountering an authoritative name server whose name is - an alias pointing to another name, the resolver treats - this as an error and skips to the next server. Previously - this happened silently; now the error will be logged to - the newly-created "cname" log category. -

  • -
  • - If named is not configured to validate the answer then - allow fallback to plain DNS on timeout even when we know - the server supports EDNS. This will allow the server to - potentially resolve signed queries when TCP is being - blocked. -

  • -
+
  • None

Bug Fixes

-
    -
  • - dig, host and - nslookup aborted when encountering - a name which, after appending search list elements, - exceeded 255 bytes. Such names are now skipped, but - processing of other names will continue. [RT #36892] -

  • -
  • - The error message generated when - named-checkzone or - named-checkconf -z encounters a - $TTL directive without a value has - been clarified. [RT #37138] -

  • -
  • - Semicolon characters (;) included in TXT records were - incorrectly escaped with a backslash when the record was - displayed as text. This is actually only necessary when there - are no quotation marks. [RT #37159] -

  • -
  • - When files opened for writing by named, - such as zone journal files, were referenced more than once - in named.conf, it could lead to file - corruption as multiple threads wrote to the same file. This - is now detected when loading named.conf - and reported as an error. [RT #37172] -

  • -
  • - dnssec-keygen -S failed to generate successor - keys for some algorithm types (including ECDSA and GOST) due to - a difference in the content of private key files. This has been - corrected. [RT #37183] -

  • -
  • - UPDATE messages that arrived too soon after - an rndc thaw could be lost. [RT #37233] -

  • -
  • - Forwarding of UPDATE messages did not work when they were - signed with SIG(0); they resulted in a BADSIG response code. - [RT #37216] -

  • -
  • - When checking for updates to trust anchors listed in - managed-keys, named - now revalidates keys based on the current set of - active trust anchors, without relying on any cached - record of previous validation. [RT #37506] -

  • -
  • - When NXDOMAIN redirection is in use, queries for a name - that is present in the redirection zone but a type that - is not present will now return NOERROR instead of NXDOMAIN. -

  • -
  • - When a zone contained a delegation to an IPv6 name server - but not an IPv4 name server, it was possible for a memory - reference to be left un-freed. This caused an assertion - failure on server shutdown, but was otherwise harmless. - [RT #37796] -

  • -
  • - Due to an inadvertent removal of code in the previous - release, when named encountered an - authoritative name server which dropped all EDNS queries, - it did not always try plain DNS. This has been corrected. - [RT #37965] -

  • -
  • - A regression caused nsupdate to use the default recursive servers - rather than the SOA MNAME server when sending the UPDATE. -

  • -
  • - Adjusted max-recursion-queries to better accommodate empty - caches. -

  • -
  • - Built-in "empty" zones did not correctly inherit the - "allow-transfer" ACL from the options or view. [RT #38310] -

  • -
  • - A mutex leak was fixed that could cause named - processes to grow to very large sizes. [RT #38454] -

  • -
  • - Fixed some bugs in RFC 5011 trust anchor management, - including a memory leak and a possible loss of state - information.[RT #38458] -

  • -
+
  • None

@@ -310,6 +165,6 @@

-

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: vendor/bind9/dist/doc/arm/Bv9ARM.ch10.html ============================================================================== --- vendor/bind9/dist/doc/arm/Bv9ARM.ch10.html Fri Jul 31 04:50:47 2015 (r286107) +++ vendor/bind9/dist/doc/arm/Bv9ARM.ch10.html Fri Jul 31 07:03:06 2015 (r286108) @@ -163,6 +163,6 @@
-

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: vendor/bind9/dist/doc/arm/Bv9ARM.ch11.html ============================================================================== --- vendor/bind9/dist/doc/arm/Bv9ARM.ch11.html Fri Jul 31 04:50:47 2015 (r286107) +++ vendor/bind9/dist/doc/arm/Bv9ARM.ch11.html Fri Jul 31 07:03:06 2015 (r286108) @@ -514,6 +514,6 @@
-

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: vendor/bind9/dist/doc/arm/Bv9ARM.ch12.html ============================================================================== --- vendor/bind9/dist/doc/arm/Bv9ARM.ch12.html Fri Jul 31 04:50:47 2015 (r286107) +++ vendor/bind9/dist/doc/arm/Bv9ARM.ch12.html Fri Jul 31 07:03:06 2015 (r286108) @@ -47,13 +47,13 @@
BIND 9 DNS Library Support
-
Prerequisite
-
Compilation
-
Installation
-
Known Defects/Restrictions
-
The dns.conf File
-
Sample Applications
-
Library References
+
Prerequisite
+
Compilation
+
Installation
+
Known Defects/Restrictions
+
The dns.conf File
+
Sample Applications
+
Library References
@@ -89,7 +89,7 @@

-Prerequisite

+Prerequisite

GNU make is required to build the export libraries (other part of BIND 9 can still be built with other types of make). In the reminder of this document, "make" means GNU make. Note that @@ -98,7 +98,7 @@

-Compilation

+Compilation
 $ ./configure --enable-exportlib [other flags]
 $ make
@@ -113,7 +113,7 @@ $ make
 

-Installation

+Installation
 $ cd lib/export
 $ make install
@@ -135,7 +135,7 @@ $ make i
 
 

-Known Defects/Restrictions

+Known Defects/Restrictions
  • Currently, win32 is not supported for the export library. (Normal BIND 9 application can be built as @@ -175,7 +175,7 @@ $ make

    -The dns.conf File

    +The dns.conf File

The IRS library supports an "advanced" configuration file related to the DNS library for configuration parameters that would be beyond the capability of the @@ -193,14 +193,14 @@ $ make

-Sample Applications

+Sample Applications

Some sample application programs using this API are provided for reference. The following is a brief description of these applications.

-sample: a simple stub resolver utility

+sample: a simple stub resolver utility

It sends a query of a given name (of a given optional RR type) to a specified recursive server, and prints the result as a list of @@ -264,7 +264,7 @@ $ make

-sample-async: a simple stub resolver, working asynchronously

+sample-async: a simple stub resolver, working asynchronously

Similar to "sample", but accepts a list of (query) domain names as a separate file and resolves the names @@ -305,7 +305,7 @@ $ make

-sample-request: a simple DNS transaction client

+sample-request: a simple DNS transaction client

It sends a query to a specified server, and prints the response with minimal processing. It doesn't act as a @@ -346,7 +346,7 @@ $ make

-sample-gai: getaddrinfo() and getnameinfo() test code

+sample-gai: getaddrinfo() and getnameinfo() test code

This is a test program to check getaddrinfo() and getnameinfo() behavior. It takes a @@ -363,7 +363,7 @@ $ make

-sample-update: a simple dynamic update client program

+sample-update: a simple dynamic update client program

It accepts a single update command as a command-line argument, sends an update request message to the @@ -458,7 +458,7 @@ $ sample

-nsprobe: domain/name server checker in terms of RFC 4074

+nsprobe: domain/name server checker in terms of RFC 4074

It checks a set of domains to see the name servers of the domains behave @@ -515,7 +515,7 @@ $ sample

-Library References

+Library References

As of this writing, there is no formal "manual" of the libraries, except this document, header files (some of them provide pretty detailed explanations), and sample application @@ -540,6 +540,6 @@ $ sample -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: vendor/bind9/dist/doc/arm/Bv9ARM.ch13.html ============================================================================== --- vendor/bind9/dist/doc/arm/Bv9ARM.ch13.html Fri Jul 31 04:50:47 2015 (r286107) +++ vendor/bind9/dist/doc/arm/Bv9ARM.ch13.html Fri Jul 31 07:03:06 2015 (r286108) @@ -140,6 +140,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: vendor/bind9/dist/doc/arm/Bv9ARM.html ============================================================================== --- vendor/bind9/dist/doc/arm/Bv9ARM.html Fri Jul 31 04:50:47 2015 (r286107) +++ vendor/bind9/dist/doc/arm/Bv9ARM.html Fri Jul 31 07:03:06 2015 (r286108) @@ -41,7 +41,7 @@

BIND 9 Administrator Reference Manual

-

BIND Version 9.9.7

+

BIND Version 9.9.7-P2

@@ -234,7 +234,7 @@
A. Release Notes
-
Release Notes for BIND Version 9.9.7
+
Release Notes for BIND Version 9.9.7-P2
Introduction
Download
@@ -262,13 +262,13 @@
BIND 9 DNS Library Support
-
Prerequisite
-
Compilation
-
Installation
-
Known Defects/Restrictions
-
The dns.conf File
-
Sample Applications
-
Library References
+
Prerequisite
+
Compilation
+
Installation
+
Known Defects/Restrictions
+
The dns.conf File
+
Sample Applications
+
Library References
I. Manual pages
@@ -365,6 +365,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: vendor/bind9/dist/doc/arm/Bv9ARM.pdf ============================================================================== Binary file (source and/or target). No diff available. Modified: vendor/bind9/dist/doc/arm/man.arpaname.html ============================================================================== --- vendor/bind9/dist/doc/arm/man.arpaname.html Fri Jul 31 04:50:47 2015 (r286107) +++ vendor/bind9/dist/doc/arm/man.arpaname.html Fri Jul 31 07:03:06 2015 (r286108) @@ -50,20 +50,20 @@

arpaname {ipaddress ...}

-

DESCRIPTION

+

DESCRIPTION

arpaname translates IP addresses (IPv4 and IPv6) to the corresponding IN-ADDR.ARPA or IP6.ARPA names.

-

SEE ALSO

+

SEE ALSO

BIND 9 Administrator Reference Manual.

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

@@ -87,6 +87,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: vendor/bind9/dist/doc/arm/man.ddns-confgen.html ============================================================================== --- vendor/bind9/dist/doc/arm/man.ddns-confgen.html Fri Jul 31 04:50:47 2015 (r286107) +++ vendor/bind9/dist/doc/arm/man.ddns-confgen.html Fri Jul 31 07:03:06 2015 (r286108) @@ -50,7 +50,7 @@

ddns-confgen [-a algorithm] [-h] [-k keyname] [-r randomfile] [ -s name | -z zone ] [-q] [name]

-

DESCRIPTION

+

DESCRIPTION

ddns-confgen generates a key for use by nsupdate and named. It simplifies configuration @@ -77,7 +77,7 @@

-

OPTIONS

+

OPTIONS

-a algorithm

@@ -144,7 +144,7 @@

-

SEE ALSO

+

SEE ALSO

nsupdate(1), named.conf(5), named(8), @@ -152,7 +152,7 @@

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

@@ -176,6 +176,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: vendor/bind9/dist/doc/arm/man.dig.html ============================================================================== --- vendor/bind9/dist/doc/arm/man.dig.html Fri Jul 31 04:50:47 2015 (r286107) +++ vendor/bind9/dist/doc/arm/man.dig.html Fri Jul 31 07:03:06 2015 (r286108) @@ -52,7 +52,7 @@

dig [global-queryopt...] [query...]

-

DESCRIPTION

+

DESCRIPTION

dig (domain information groper) is a flexible tool for interrogating DNS name servers. It performs DNS lookups and @@ -99,7 +99,7 @@

-

SIMPLE USAGE

+

SIMPLE USAGE

A typical invocation of dig looks like:

@@ -152,7 +152,7 @@

-

OPTIONS

+

OPTIONS

The -b option sets the source IP address of the query to address. This must be a valid @@ -260,7 +260,7 @@

-

QUERY OPTIONS

+

QUERY OPTIONS

dig provides a number of query options which affect the way in which lookups are made and the results displayed. Some of @@ -618,7 +618,7 @@

-

MULTIPLE QUERIES

+

MULTIPLE QUERIES

The BIND 9 implementation of dig supports @@ -664,7 +664,7 @@ dig +qr www.isc.org any -x 127.0.0.1 isc

-

IDN SUPPORT

+

IDN SUPPORT

If dig has been built with IDN (internationalized domain name) support, it can accept and display non-ASCII domain names. @@ -678,14 +678,14 @@ dig +qr www.isc.org any -x 127.0.0.1 isc

-

FILES

+

FILES

/etc/resolv.conf

${HOME}/.digrc

-

SEE ALSO

+

SEE ALSO

host(1), named(8), dnssec-keygen(8), @@ -693,7 +693,7 @@ dig +qr www.isc.org any -x 127.0.0.1 isc

-

BUGS

+

BUGS

There are probably too many query options.

@@ -716,6 +716,6 @@ dig +qr www.isc.org any -x 127.0.0.1 isc
-

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: vendor/bind9/dist/doc/arm/man.dnssec-checkds.html ============================================================================== --- vendor/bind9/dist/doc/arm/man.dnssec-checkds.html Fri Jul 31 04:50:47 2015 (r286107) +++ vendor/bind9/dist/doc/arm/man.dnssec-checkds.html Fri Jul 31 07:03:06 2015 (r286108) @@ -51,7 +51,7 @@

dnssec-dsfromkey [-l domain] [-f file] [-d dig path] [-D dsfromkey path] {zone}

-

DESCRIPTION

+

DESCRIPTION

dnssec-checkds verifies the correctness of Delegation Signer (DS) or DNSSEC Lookaside Validation (DLV) resource records for keys in a specified @@ -59,7 +59,7 @@

-

OPTIONS

+

OPTIONS

-f file

@@ -88,14 +88,14 @@

-

SEE ALSO

+

SEE ALSO

dnssec-dsfromkey(8), dnssec-keygen(8), dnssec-signzone(8),

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

@@ -118,6 +118,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: vendor/bind9/dist/doc/arm/man.dnssec-coverage.html ============================================================================== --- vendor/bind9/dist/doc/arm/man.dnssec-coverage.html Fri Jul 31 04:50:47 2015 (r286107) +++ vendor/bind9/dist/doc/arm/man.dnssec-coverage.html Fri Jul 31 07:03:06 2015 (r286108) @@ -50,7 +50,7 @@

dnssec-coverage [-K directory] [-f file] [-d DNSKEY TTL] [-m max TTL] [-r interval] [-c compilezone path] [zone]

-

DESCRIPTION

+

DESCRIPTION

dnssec-coverage verifies that the DNSSEC keys for a given zone or a set of zones have timing metadata set properly to ensure no future lapses in DNSSEC @@ -78,7 +78,7 @@

-

OPTIONS

+

OPTIONS

-f file

@@ -168,7 +168,7 @@

-

SEE ALSO

+

SEE ALSO

dnssec-checkds(8), dnssec-dsfromkey(8), @@ -177,7 +177,7 @@

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

@@ -201,6 +201,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: vendor/bind9/dist/doc/arm/man.dnssec-dsfromkey.html ============================================================================== --- vendor/bind9/dist/doc/arm/man.dnssec-dsfromkey.html Fri Jul 31 04:50:47 2015 (r286107) +++ vendor/bind9/dist/doc/arm/man.dnssec-dsfromkey.html Fri Jul 31 07:03:06 2015 (r286108) @@ -52,14 +52,14 @@

dnssec-dsfromkey [-h] [-V]

-

DESCRIPTION

+

DESCRIPTION

dnssec-dsfromkey outputs the Delegation Signer (DS) resource record (RR), as defined in RFC 3658 and RFC 4509, for the given key(s).

-

OPTIONS

+

OPTIONS

-1

@@ -144,7 +144,7 @@

-

EXAMPLE

+

EXAMPLE

To build the SHA-256 DS RR from the Kexample.com.+003+26160 @@ -159,7 +159,7 @@

-

FILES

+

FILES

The keyfile can be designed by the key identification Knnnn.+aaa+iiiii or the full file name @@ -173,13 +173,13 @@

-

CAVEAT

+

CAVEAT

A keyfile error can give a "file not found" even if the file exists.

-

SEE ALSO

+

SEE ALSO

dnssec-keygen(8), dnssec-signzone(8), BIND 9 Administrator Reference Manual, @@ -189,7 +189,7 @@

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

@@ -213,6 +213,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: vendor/bind9/dist/doc/arm/man.dnssec-keyfromlabel.html ============================================================================== --- vendor/bind9/dist/doc/arm/man.dnssec-keyfromlabel.html Fri Jul 31 04:50:47 2015 (r286107) +++ vendor/bind9/dist/doc/arm/man.dnssec-keyfromlabel.html Fri Jul 31 07:03:06 2015 (r286108) @@ -50,7 +50,7 @@

dnssec-keyfromlabel {-l label} [-3] [-a algorithm] [-A date/offset] [-c class] [-D date/offset] [-E engine] [-f flag] [-G] [-I date/offset] [-i interval] [-k] [-K directory] [-L ttl] [-n nametype] [-P date/offset] [-p protocol] [-R date/offset] [-S key] [-t type] [-v level] [-V] [-y] {name}

-

DESCRIPTION

+

DESCRIPTION

dnssec-keyfromlabel generates a key pair of files that referencing a key object stored in a cryptographic hardware service module (HSM). The private key @@ -66,7 +66,7 @@

-

OPTIONS

+

OPTIONS

-a algorithm
@@ -209,7 +209,7 @@
-

TIMING OPTIONS

+

TIMING OPTIONS

Dates can be expressed in the format YYYYMMDD or YYYYMMDDHHMMSS. If the argument begins with a '+' or '-', it is interpreted as @@ -281,7 +281,7 @@

-

GENERATED KEY FILES

+

GENERATED KEY FILES

When dnssec-keyfromlabel completes successfully, @@ -320,7 +320,7 @@

-

SEE ALSO

+

SEE ALSO

dnssec-keygen(8), dnssec-signzone(8), BIND 9 Administrator Reference Manual, @@ -328,7 +328,7 @@

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

@@ -352,6 +352,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: vendor/bind9/dist/doc/arm/man.dnssec-keygen.html ============================================================================== --- vendor/bind9/dist/doc/arm/man.dnssec-keygen.html Fri Jul 31 04:50:47 2015 (r286107) +++ vendor/bind9/dist/doc/arm/man.dnssec-keygen.html Fri Jul 31 07:03:06 2015 (r286108) @@ -50,7 +50,7 @@

dnssec-keygen [-a algorithm] [-b keysize] [-n nametype] [-3] [-A date/offset] [-C] [-c class] [-D date/offset] [-E engine] [-f flag] [-G] [-g generator] [-h] [-I date/offset] [-i interval] [-K directory] [-L ttl] [-k] [-P date/offset] [-p protocol] [-q] [-R date/offset] [-r randomdev] [-S key] [-s strength] [-t type] [-v level] [-V] [-z] {name}

-

DESCRIPTION

+

DESCRIPTION

dnssec-keygen generates keys for DNSSEC (Secure DNS), as defined in RFC 2535 and RFC 4034. It can also generate keys for use with @@ -64,7 +64,7 @@

-

OPTIONS

*** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Jul 31 07:04:35 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 524109AEC6E; Fri, 31 Jul 2015 07:04:35 +0000 (UTC) (envelope-from erwin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0E2461B28; Fri, 31 Jul 2015 07:04:35 +0000 (UTC) (envelope-from erwin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6V74YLv075301; Fri, 31 Jul 2015 07:04:34 GMT (envelope-from erwin@FreeBSD.org) Received: (from erwin@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6V74YP8075300; Fri, 31 Jul 2015 07:04:34 GMT (envelope-from erwin@FreeBSD.org) Message-Id: <201507310704.t6V74YP8075300@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erwin set sender to erwin@FreeBSD.org using -f From: Erwin Lansing Date: Fri, 31 Jul 2015 07:04:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r286109 - vendor/bind9/9.9.7-P2 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 07:04:35 -0000 Author: erwin Date: Fri Jul 31 07:04:33 2015 New Revision: 286109 URL: https://svnweb.freebsd.org/changeset/base/286109 Log: Tag the 9.9.7-P2 release Sponsored by: DK Hostmaster A/S Added: - copied from r286108, vendor/bind9/dist/ Directory Properties: vendor/bind9/9.9.7-P2/ (props changed) From owner-svn-src-all@freebsd.org Fri Jul 31 07:12:53 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CDD309AEDAF; Fri, 31 Jul 2015 07:12:53 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 56D6D1EBC; Fri, 31 Jul 2015 07:12:52 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 9A2FA1045E2C; Fri, 31 Jul 2015 17:12:45 +1000 (AEST) Date: Fri, 31 Jul 2015 17:12:45 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: "Pedro F. Giffuni" cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r286102 - head/usr.bin/wall In-Reply-To: <201507310112.t6V1CWh8034232@repo.freebsd.org> Message-ID: <20150731162408.M1843@besplex.bde.org> References: <201507310112.t6V1CWh8034232@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=XMDNMlVE c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=kj9zAlcOel0A:10 a=SUc6wPsNIVPK5wlxp2EA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 07:12:54 -0000 On Fri, 31 Jul 2015, Pedro F. Giffuni wrote: > Log: > Buffer overflow in wall(1). > > This affected syslogd, wall and talkd. > Detected by FORTIFY_SOURCE GSoC (with clang). Old versions got this wrong by using strcpy() instead of strlcpy(). The fix using strlcpy() got this wrong by using a wrong buffer size. This change gets this wrong by churning to a different and slightly worse method. > Modified: head/usr.bin/wall/ttymsg.c > ============================================================================== > --- head/usr.bin/wall/ttymsg.c Fri Jul 31 00:31:52 2015 (r286101) > +++ head/usr.bin/wall/ttymsg.c Fri Jul 31 01:12:31 2015 (r286102) > @@ -62,7 +62,7 @@ ttymsg(struct iovec *iov, int iovcnt, co > struct iovec localiov[7]; > ssize_t left, wret; > int cnt, fd; > - static char device[MAXNAMLEN] = _PATH_DEV; > + char device[MAXNAMLEN] = _PATH_DEV; This removes the rather silly micro-optimization of using a static buffer with just the few characters in _PATH_DEV in it held constant. The buffer is now allocated locally and initialized by copying _PATH_DEV to it on every call. If you want this pessimization, don't keep the obfuscation of initializing it in its declaration. Use strcpy() or snprintf() to initialize. > static char errbuf[1024]; Another static buffer. The function is obviously not reentrant. This large static buffer mainly wastes space all the time instead of only when the function is called. > char *p; > int forked; > @@ -71,8 +71,8 @@ ttymsg(struct iovec *iov, int iovcnt, co > if (iovcnt > (int)(sizeof(localiov) / sizeof(localiov[0]))) > return ("too many iov's (change code in wall/ttymsg.c)"); > > + strlcat(device, line, sizeof(device)); This depends on the slow reinitialization on every entry. The combined initialization (initializer + strlcat) is an obfuscated way of concatenating 2 strings. The clearest way is snprintf with %s%s format. style(9) actually specifies using snprintf() indirectly. It never dreamt of snprintf(), but it says to use printf() and not build up output and bugs using fputs(), puts(), putchar(), whatever. > p = device + sizeof(_PATH_DEV) - 1; > - strlcpy(p, line, sizeof(device)); The correct fix was just to use the right buffer size here. The pointer was adjusted to skip _PATH_BUF at the beginning of the buffer, but the buffer size was not adjusted to match. Similar complications occur when strings are built up using snprintf(). It is not as easy to use as printf(), so style(9)'s indirect requirement might not apply. You have to keep track of the remaining part of the buffer at every step, while printf() keeps track of the file pointer automatically. The error checking is still null. The code is still broken if buffer overflow actually occurred, since then open() was attempted on a garbage device name. But most device names are short, and none can be decided by untrusted users. printf() is again easier to use. It has a sticky error state, so that if an error occurs it can at least be detected after several steps. I once saw some code that actually checked for printf() errors. > if (strncmp(p, "pts/", 4) == 0) > p += 4; > if (strchr(p, '/') != NULL) { Bruce From owner-svn-src-all@freebsd.org Fri Jul 31 07:28:17 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3C789AF050; Fri, 31 Jul 2015 07:28:17 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id A12807F0; Fri, 31 Jul 2015 07:28:16 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 3882C1047463; Fri, 31 Jul 2015 17:28:12 +1000 (AEST) Date: Fri, 31 Jul 2015 17:28:12 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: John-Mark Gurney cc: Bruce Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r286103 - head/share/man/man9 In-Reply-To: <20150731070314.GY78154@funkthat.com> Message-ID: <20150731171611.O2162@besplex.bde.org> References: <201507310328.t6V3S3LC087650@repo.freebsd.org> <20150731152253.Y1843@besplex.bde.org> <20150731070314.GY78154@funkthat.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=XMDNMlVE c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=kj9zAlcOel0A:10 a=AJbpanktw9WC98yC8TwA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 07:28:18 -0000 On Fri, 31 Jul 2015, John-Mark Gurney wrote: > Bruce Evans wrote this message on Fri, Jul 31, 2015 at 16:21 +1000: >> On Fri, 31 Jul 2015, John-Mark Gurney wrote: >> >>> Log: >>> The implementation note isn't true anymore.. >>> >>> Not that anyone reads it, but those that do, remind them that this >>> isn't usable in userland... I can't wait till this doc is wrong.. >> >> It goes without saying that an API documented in a section 9 man page >> isn't usable in userland > > I think you mean that some API's are well documented in section 9 > and undocumented in section 3. For example, atomic(9) is used in > userland in such places as libthr, jemalloc, and more. Bug in these places. It is now clear that they should use C11 atomics. Both are very hard to understand even with documentation. The C11 ones are more complicate and the FreeBSD ones are more subject to change. >> In this case, it is obviously even more unusable in userland, because >> the documentation specifies including . That header is >> undocumented, but everyone should know that it it is kernel-only. > > Well, now I know.. it'd be nice to document it w/ an > ifndef _KERNEL/error line.. or at least a comment... or even in > the documentation... It should have had #error if !_KERNEL but it is apparently unusable without _KERNEL anyway. Applications can now use _Static_assert(condition, message) instead of rthe FreeBSDism CTASSERT(). _Static_assert() is in so it is available everywhere. Of course, it is undocumented like most things there, and it goes without saying that using it is a misuse since it is in the implementation namespace :-). It seems to be standard only in C++, with the spelling static_assert(). Bruce From owner-svn-src-all@freebsd.org Fri Jul 31 07:48:09 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A69D89AF30A; Fri, 31 Jul 2015 07:48:09 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 97418102B; Fri, 31 Jul 2015 07:48:09 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6V7m9T4091594; Fri, 31 Jul 2015 07:48:09 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6V7m9pa091593; Fri, 31 Jul 2015 07:48:09 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <201507310748.t6V7m9pa091593@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Fri, 31 Jul 2015 07:48:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286110 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 07:48:09 -0000 Author: jmg Date: Fri Jul 31 07:48:08 2015 New Revision: 286110 URL: https://svnweb.freebsd.org/changeset/base/286110 Log: temporarily fix build.. This isn't the final fix, and testing is still on going, but it has passed world for mips and powerpc... I know this has an extra semicolon, but this is the patch that is tested... Looks like better fix is to use _Static_assert... Modified: head/sys/net/pfkeyv2.h Modified: head/sys/net/pfkeyv2.h ============================================================================== --- head/sys/net/pfkeyv2.h Fri Jul 31 07:04:33 2015 (r286109) +++ head/sys/net/pfkeyv2.h Fri Jul 31 07:48:08 2015 (r286110) @@ -39,6 +39,10 @@ #ifndef _NET_PFKEYV2_H_ #define _NET_PFKEYV2_H_ +#ifndef _KERNEL +#define CTASSERT(x) struct __thisisjustnothing; +#endif + /* This file defines structures and symbols for the PF_KEY Version 2 key management interface. It was written at the U.S. Naval Research From owner-svn-src-all@freebsd.org Fri Jul 31 08:45:36 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E8BCB9AFF2F; Fri, 31 Jul 2015 08:45:36 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C532E9EC; Fri, 31 Jul 2015 08:45:36 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6V8ja2S015466; Fri, 31 Jul 2015 08:45:36 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6V8jaR4015465; Fri, 31 Jul 2015 08:45:36 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201507310845.t6V8jaR4015465@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Fri, 31 Jul 2015 08:45:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286111 - head/sys/boot/forth X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 08:45:37 -0000 Author: ed Date: Fri Jul 31 08:45:35 2015 New Revision: 286111 URL: https://svnweb.freebsd.org/changeset/base/286111 Log: Document the existence of cloudabi_load and cloudabi64_load. Modified: head/sys/boot/forth/loader.conf Modified: head/sys/boot/forth/loader.conf ============================================================================== --- head/sys/boot/forth/loader.conf Fri Jul 31 07:48:08 2015 (r286110) +++ head/sys/boot/forth/loader.conf Fri Jul 31 08:45:35 2015 (r286111) @@ -268,6 +268,8 @@ screensave_name="green_saver" # Set to t ### Emulation modules ###################################### ############################################################## +cloudabi_load="NO" # Platform independent CloudABI support +cloudabi64_load="NO" # 64-bit CloudABI executables support ibcs2_load="NO" # IBCS2 (SCO) emulation ibcs2_coff_load="NO" linux_load="NO" # Linux emulation From owner-svn-src-all@freebsd.org Fri Jul 31 09:02:30 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 195279AE4C6; Fri, 31 Jul 2015 09:02:30 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 04629108B; Fri, 31 Jul 2015 09:02:30 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6V92T7m023327; Fri, 31 Jul 2015 09:02:29 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6V92TI4023326; Fri, 31 Jul 2015 09:02:29 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201507310902.t6V92TI4023326@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 31 Jul 2015 09:02:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286112 - head/sys/netinet X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 09:02:30 -0000 Author: ae Date: Fri Jul 31 09:02:28 2015 New Revision: 286112 URL: https://svnweb.freebsd.org/changeset/base/286112 Log: Remove unneded #include "opt_inet.h". Modified: head/sys/netinet/ip_ecn.h Modified: head/sys/netinet/ip_ecn.h ============================================================================== --- head/sys/netinet/ip_ecn.h Fri Jul 31 08:45:35 2015 (r286111) +++ head/sys/netinet/ip_ecn.h Fri Jul 31 09:02:28 2015 (r286112) @@ -38,10 +38,6 @@ #ifndef _NETINET_IP_ECN_H_ #define _NETINET_IP_ECN_H_ -#if defined(_KERNEL) && !defined(_LKM) -#include "opt_inet.h" -#endif - #define ECN_ALLOWED 1 /* ECN allowed */ #define ECN_FORBIDDEN 0 /* ECN forbidden */ #define ECN_NOCARE (-1) /* no consideration to ECN */ From owner-svn-src-all@freebsd.org Fri Jul 31 09:04:24 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0070E9AE539; Fri, 31 Jul 2015 09:04:24 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CB72B163D; Fri, 31 Jul 2015 09:04:23 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6V94N3e023490; Fri, 31 Jul 2015 09:04:23 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6V94NGd023489; Fri, 31 Jul 2015 09:04:23 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201507310904.t6V94NGd023489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 31 Jul 2015 09:04:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286114 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 09:04:24 -0000 Author: ae Date: Fri Jul 31 09:04:22 2015 New Revision: 286114 URL: https://svnweb.freebsd.org/changeset/base/286114 Log: Ansify if_stf.c Modified: head/sys/net/if_stf.c Modified: head/sys/net/if_stf.c ============================================================================== --- head/sys/net/if_stf.c Fri Jul 31 09:03:56 2015 (r286113) +++ head/sys/net/if_stf.c Fri Jul 31 09:04:22 2015 (r286114) @@ -272,10 +272,7 @@ stf_clone_destroy(struct if_clone *ifc, } static int -stfmodevent(mod, type, data) - module_t mod; - int type; - void *data; +stfmodevent(module_t mod, int type, void *data) { switch (type) { @@ -302,11 +299,7 @@ static moduledata_t stf_mod = { DECLARE_MODULE(if_stf, stf_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); static int -stf_encapcheck(m, off, proto, arg) - const struct mbuf *m; - int off; - int proto; - void *arg; +stf_encapcheck(const struct mbuf *m, int off, int proto, void *arg) { struct ip ip; struct stf_softc *sc; @@ -401,7 +394,7 @@ stf_getsrcifa6(struct ifnet *ifp, struct static int stf_output(struct ifnet *ifp, struct mbuf *m, const struct sockaddr *dst, - struct route *ro) + struct route *ro) { struct stf_softc *sc; const struct sockaddr_in6 *dst6; @@ -507,8 +500,7 @@ stf_output(struct ifnet *ifp, struct mbu } static int -isrfc1918addr(in) - struct in_addr *in; +isrfc1918addr(struct in_addr *in) { /* * returns 1 if private address range: @@ -524,10 +516,7 @@ isrfc1918addr(in) } static int -stf_checkaddr4(sc, in, inifp) - struct stf_softc *sc; - struct in_addr *in; - struct ifnet *inifp; /* incoming interface */ +stf_checkaddr4(struct stf_softc *sc, struct in_addr *in, struct ifnet *inifp) { struct rm_priotracker in_ifa_tracker; struct in_ifaddr *ia4; @@ -594,10 +583,7 @@ stf_checkaddr4(sc, in, inifp) } static int -stf_checkaddr6(sc, in6, inifp) - struct stf_softc *sc; - struct in6_addr *in6; - struct ifnet *inifp; /* incoming interface */ +stf_checkaddr6(struct stf_softc *sc, struct in6_addr *in6, struct ifnet *inifp) { /* * check 6to4 addresses @@ -720,10 +706,7 @@ in_stf_input(struct mbuf **mp, int *offp } static int -stf_ioctl(ifp, cmd, data) - struct ifnet *ifp; - u_long cmd; - caddr_t data; +stf_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { struct ifaddr *ifa; struct ifreq *ifr; From owner-svn-src-all@freebsd.org Fri Jul 31 09:12:32 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B89939AE80A; Fri, 31 Jul 2015 09:12:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A7F17109; Fri, 31 Jul 2015 09:12:32 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6V9CW32027714; Fri, 31 Jul 2015 09:12:32 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6V9CW6D027713; Fri, 31 Jul 2015 09:12:32 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201507310912.t6V9CW6D027713@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 31 Jul 2015 09:12:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286118 - head/sys/dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 09:12:32 -0000 Author: hselasky Date: Fri Jul 31 09:12:31 2015 New Revision: 286118 URL: https://svnweb.freebsd.org/changeset/base/286118 Log: Limit the number of times we loop inside the DWC OTG poll handler to avoid starving other fast interrupts. Fix a comment while at it. MFC after: 1 week Suggested by: Svatopluk Kraus Modified: head/sys/dev/usb/controller/dwc_otg.c Modified: head/sys/dev/usb/controller/dwc_otg.c ============================================================================== --- head/sys/dev/usb/controller/dwc_otg.c Fri Jul 31 09:10:56 2015 (r286117) +++ head/sys/dev/usb/controller/dwc_otg.c Fri Jul 31 09:12:31 2015 (r286118) @@ -2551,12 +2551,18 @@ static void dwc_otg_interrupt_poll_locked(struct dwc_otg_softc *sc) { struct usb_xfer *xfer; + uint32_t count = 0; uint32_t temp; uint8_t got_rx_status; uint8_t x; repeat: - /* get all channel interrupts */ + if (++count == 16) { + /* give other interrupts a chance */ + DPRINTF("Yield\n"); + return; + } + /* get all host channel interrupts */ for (x = 0; x != sc->sc_host_ch_max; x++) { temp = DWC_OTG_READ_4(sc, DOTG_HCINT(x)); if (temp != 0) { From owner-svn-src-all@freebsd.org Fri Jul 31 09:24:35 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 046529AEBE4 for ; Fri, 31 Jul 2015 09:24:35 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-ob0-f169.google.com (mail-ob0-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CAE93C38 for ; Fri, 31 Jul 2015 09:24:34 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by obnw1 with SMTP id w1so49664610obn.3 for ; Fri, 31 Jul 2015 02:24:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=gOVUsX2p50jjV6SpW29lfTzX8pWMmWy+iX2Hz8n6mdY=; b=DG5K0/Ng8wsdYyS1/5tWuqWcA7PVVh2Trnqe20ML4chVnr/tElu89flNGuyOY8pijn yAoKZk00Hv4xtiOmifAEIzzv419QHlegjw1xqMuP+ot5DPOrHBVZ3YYzUfY1cZz0PMoT UXIcQs/bztvlGNQ+pRRLK0LC2RrDmTEG1ymKe3D4YMZDLoM+vy1S9ScgnbkEDc+a0sXm 2pfM7b0UK8AA5mEV0blSwp56IvH1q4k1jYE03c8o+JWdefwLVO5Hx1Dqpb1UUZx9FWL5 AWU+p0cFHC14r4eP6XFhBAYM3V7mhBC+lasbIhPy/x+BZzvNKHUPVi2xn5GzNL6kqb+i s5uw== X-Gm-Message-State: ALoCoQkSpwXS+oz7bbknM0kyREWgOxsNR9XXVcf9dLsieGmFb2JiNfw61now/0LywMWjub27mnpT MIME-Version: 1.0 X-Received: by 10.182.20.141 with SMTP id n13mr1957623obe.26.1438334668516; Fri, 31 Jul 2015 02:24:28 -0700 (PDT) Received: by 10.76.0.46 with HTTP; Fri, 31 Jul 2015 02:24:28 -0700 (PDT) X-Originating-IP: [84.27.222.46] In-Reply-To: <201507310328.t6V3S3LC087650@repo.freebsd.org> References: <201507310328.t6V3S3LC087650@repo.freebsd.org> Date: Fri, 31 Jul 2015 11:24:28 +0200 Message-ID: Subject: Re: svn commit: r286103 - head/share/man/man9 From: Ed Schouten To: John-Mark Gurney Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 09:24:35 -0000 Hi John-Mark, Maybe it would make more sense to just remove this manual page? It looks like there are already some pieces of code in our source tree that use _Static_assert(), which is good. Maybe it would be better to to leave CTASSERT() undocumented, so that it becomes less likely that new code uses this interface. -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK/VAT number: 62051717 From owner-svn-src-all@freebsd.org Fri Jul 31 09:43:09 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21F389AEFEF; Fri, 31 Jul 2015 09:43:09 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EC2EA158D; Fri, 31 Jul 2015 09:43:08 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6V9h8j9039900; Fri, 31 Jul 2015 09:43:08 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6V9h878039897; Fri, 31 Jul 2015 09:43:08 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201507310943.t6V9h878039897@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Fri, 31 Jul 2015 09:43:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286120 - in stable/10: . sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 09:43:09 -0000 Author: smh Date: Fri Jul 31 09:43:07 2015 New Revision: 286120 URL: https://svnweb.freebsd.org/changeset/base/286120 Log: MFC: r285946 and r285947 Add warning about low KSTACK_PAGES for ZFS use. Sponsored by: Multiplay Modified: stable/10/UPDATING stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/UPDATING ============================================================================== --- stable/10/UPDATING Fri Jul 31 09:28:49 2015 (r286119) +++ stable/10/UPDATING Fri Jul 31 09:43:07 2015 (r286120) @@ -16,6 +16,14 @@ from older versions of FreeBSD, try WITH stable/10, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. +20150731: + As ZFS requires more kernel stack pages than is the default on some + architectures e.g. i386, it now warns if KSTACK_PAGES is less than + ZFS_MIN_KSTACK_PAGES (which is 4 at the time of writing). + + Please consider using 'options KSTACK_PAGES=X' where X is greater + than or equal to ZFS_MIN_KSTACK_PAGES i.e. 4 in such configurations. + 20150703: The default Unbound configuration now enables remote control using a local socket. Users who have already enabled the Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Jul 31 09:28:49 2015 (r286119) +++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Jul 31 09:43:07 2015 (r286120) @@ -6493,10 +6493,18 @@ static void zfs_shutdown(void *, int); static eventhandler_tag zfs_shutdown_event_tag; +#define ZFS_MIN_KSTACK_PAGES 4 + int zfs__init(void) { +#if KSTACK_PAGES < ZFS_MIN_KSTACK_PAGES + printf("ZFS NOTICE: KSTACK_PAGES is %d which could result in stack " + "overflow panic!\nPlease consider adding " + "'options KSTACK_PAGES=%d' to your kernel config\n", KSTACK_PAGES, + ZFS_MIN_KSTACK_PAGES); +#endif zfs_root_token = root_mount_hold("ZFS"); mutex_init(&zfs_share_lock, NULL, MUTEX_DEFAULT, NULL); From owner-svn-src-all@freebsd.org Fri Jul 31 10:00:47 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 301DC9AF351; Fri, 31 Jul 2015 10:00:47 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 209F81E3C; Fri, 31 Jul 2015 10:00:47 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VA0kBq046449; Fri, 31 Jul 2015 10:00:46 GMT (envelope-from zbb@FreeBSD.org) Received: (from zbb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VA0jfN046445; Fri, 31 Jul 2015 10:00:45 GMT (envelope-from zbb@FreeBSD.org) Message-Id: <201507311000.t6VA0jfN046445@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zbb set sender to zbb@FreeBSD.org using -f From: Zbigniew Bodek Date: Fri, 31 Jul 2015 10:00:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286121 - in head/sys: arm64/arm64 arm64/conf arm64/include conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 10:00:47 -0000 Author: zbb Date: Fri Jul 31 10:00:45 2015 New Revision: 286121 URL: https://svnweb.freebsd.org/changeset/base/286121 Log: Apply erratum for mrs ICC_IAR1_EL1 speculative execution on ThunderX ERRATUM: 22978, 23154 PASS (rev.): 1.0/1.1 Reviewed by: imp Obtained from: Semihalf Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3184 Modified: head/sys/arm64/arm64/gic_v3.c head/sys/arm64/conf/GENERIC head/sys/arm64/include/cpu.h head/sys/conf/options.arm64 Modified: head/sys/arm64/arm64/gic_v3.c ============================================================================== --- head/sys/arm64/arm64/gic_v3.c Fri Jul 31 09:43:07 2015 (r286120) +++ head/sys/arm64/arm64/gic_v3.c Fri Jul 31 10:00:45 2015 (r286121) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include "pic_if.h" @@ -230,7 +231,22 @@ gic_v3_dispatch(device_t dev, struct tra uint64_t active_irq; while (1) { - active_irq = gic_icc_read(IAR1); + if (CPU_MATCH_ERRATA_CAVIUM_THUNDER_1_1) { + /* + * Hardware: Cavium ThunderX + * Chip revision: Pass 1.0 (early version) + * Pass 1.1 (production) + * ERRATUM: 22978, 23154 + */ + __asm __volatile( + "nop;nop;nop;nop;nop;nop;nop;nop; \n" + "mrs %0, ICC_IAR1_EL1 \n" + "nop;nop;nop;nop; \n" + "dsb sy \n" + : "=&r" (active_irq)); + } else { + active_irq = gic_icc_read(IAR1); + } if (__predict_false(active_irq == ICC_IAR1_EL1_SPUR)) break; Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Fri Jul 31 09:43:07 2015 (r286120) +++ head/sys/arm64/conf/GENERIC Fri Jul 31 10:00:45 2015 (r286121) @@ -109,6 +109,9 @@ device psci # Support for ARM PSCI # Note that 'bpf' is required for DHCP. device bpf # Berkeley packet filter +# Chip-specific errata +options THUNDERX_PASS_1_1_ERRATA + options FDT device acpi Modified: head/sys/arm64/include/cpu.h ============================================================================== --- head/sys/arm64/include/cpu.h Fri Jul 31 09:43:07 2015 (r286120) +++ head/sys/arm64/include/cpu.h Fri Jul 31 10:00:45 2015 (r286121) @@ -78,6 +78,9 @@ #define CPU_PART_CORTEX_A53 0xD03 #define CPU_PART_CORTEX_A57 0xD07 +#define CPU_REV_THUNDER_1_0 0x00 +#define CPU_REV_THUNDER_1_1 0x01 + #define CPU_IMPL(midr) (((midr) >> 24) & 0xff) #define CPU_PART(midr) (((midr) >> 4) & 0xfff) #define CPU_VAR(midr) (((midr) >> 20) & 0xf) @@ -105,6 +108,29 @@ #define CPU_MATCH_RAW(mask, devid) \ (((mask) & PCPU_GET(midr)) == ((mask) & (devid))) +/* + * Chip-specific errata. This defines are intended to be + * booleans used within if statements. When an appropriate + * kernel option is disabled, these defines must be defined + * as 0 to allow the compiler to remove a dead code thus + * produce better optimized kernel image. + */ +/* + * Vendor: Cavium + * Chip: ThunderX + * Revision(s): Pass 1.0, Pass 1.1 + */ +#ifdef THUNDERX_PASS_1_1_ERRATA +#define CPU_MATCH_ERRATA_CAVIUM_THUNDER_1_1 \ + (CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK | CPU_REV_MASK, \ + CPU_IMPL_CAVIUM, CPU_PART_THUNDER, 0, CPU_REV_THUNDER_1_0) || \ + CPU_MATCH(CPU_IMPL_MASK | CPU_PART_MASK | CPU_REV_MASK, \ + CPU_IMPL_CAVIUM, CPU_PART_THUNDER, 0, CPU_REV_THUNDER_1_1)) +#else +#define CPU_MATCH_ERRATA_CAVIUM_THUNDER_1_1 0 +#endif + + extern char btext[]; extern char etext[]; Modified: head/sys/conf/options.arm64 ============================================================================== --- head/sys/conf/options.arm64 Fri Jul 31 09:43:07 2015 (r286120) +++ head/sys/conf/options.arm64 Fri Jul 31 10:00:45 2015 (r286121) @@ -1,6 +1,7 @@ # $FreeBSD$ -ARM64 opt_global.h -SOCDEV_PA opt_global.h -SOCDEV_VA opt_global.h -VFP opt_global.h +ARM64 opt_global.h +SOCDEV_PA opt_global.h +SOCDEV_VA opt_global.h +THUNDERX_PASS_1_1_ERRATA opt_global.h +VFP opt_global.h From owner-svn-src-all@freebsd.org Fri Jul 31 10:22:01 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C746A9AF759; Fri, 31 Jul 2015 10:22:01 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B7A801AD7; Fri, 31 Jul 2015 10:22:01 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VAM1wk056185; Fri, 31 Jul 2015 10:22:01 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VALx1J056150; Fri, 31 Jul 2015 10:21:59 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201507311021.t6VALx1J056150@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Fri, 31 Jul 2015 10:21:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286122 - in head/sys: compat/cloudabi compat/linux kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 10:22:01 -0000 Author: ed Date: Fri Jul 31 10:21:58 2015 New Revision: 286122 URL: https://svnweb.freebsd.org/changeset/base/286122 Log: Limit rights on process descriptors. On CloudABI, the rights bits returned by cap_rights_get() match up with the operations that you can actually perform on the file descriptor. Limiting the rights is good, because it makes it easier to get uniform behaviour across different operating systems. If process descriptors on FreeBSD would suddenly gain support for any new file operation, this wouldn't become exposed to CloudABI processes without first extending the rights. Extend fork1() to gain a 'struct filecaps' argument that allows you to construct process descriptors with custom rights. Use this in cloudabi_sys_proc_fork() to limit the rights to just fstat() and pdwait(). Obtained from: https://github.com/NuxiNL/freebsd Modified: head/sys/compat/cloudabi/cloudabi_proc.c head/sys/compat/linux/linux_fork.c head/sys/kern/init_main.c head/sys/kern/kern_fork.c head/sys/kern/kern_kthread.c head/sys/sys/proc.h Modified: head/sys/compat/cloudabi/cloudabi_proc.c ============================================================================== --- head/sys/compat/cloudabi/cloudabi_proc.c Fri Jul 31 10:00:45 2015 (r286121) +++ head/sys/compat/cloudabi/cloudabi_proc.c Fri Jul 31 10:21:58 2015 (r286122) @@ -27,6 +27,8 @@ __FBSDID("$FreeBSD$"); #include +#include +#include #include #include #include @@ -67,10 +69,12 @@ int cloudabi_sys_proc_fork(struct thread *td, struct cloudabi_sys_proc_fork_args *uap) { + struct filecaps fcaps = {}; struct proc *p2; int error, fd; - error = fork1(td, RFFDG | RFPROC | RFPROCDESC, 0, &p2, &fd, 0); + cap_rights_init(&fcaps.fc_rights, CAP_FSTAT, CAP_PDWAIT); + error = fork1(td, RFFDG | RFPROC | RFPROCDESC, 0, &p2, &fd, 0, &fcaps); if (error != 0) return (error); /* Return the file descriptor to the parent process. */ Modified: head/sys/compat/linux/linux_fork.c ============================================================================== --- head/sys/compat/linux/linux_fork.c Fri Jul 31 10:00:45 2015 (r286121) +++ head/sys/compat/linux/linux_fork.c Fri Jul 31 10:21:58 2015 (r286122) @@ -73,8 +73,8 @@ linux_fork(struct thread *td, struct lin printf(ARGS(fork, "")); #endif - if ((error = fork1(td, RFFDG | RFPROC | RFSTOPPED, 0, &p2, NULL, 0)) - != 0) + if ((error = fork1(td, RFFDG | RFPROC | RFSTOPPED, 0, &p2, NULL, 0, + NULL)) != 0) return (error); td2 = FIRST_THREAD_IN_PROC(p2); @@ -108,7 +108,7 @@ linux_vfork(struct thread *td, struct li /* Exclude RFPPWAIT */ if ((error = fork1(td, RFFDG | RFPROC | RFMEM | RFSTOPPED, 0, &p2, - NULL, 0)) != 0) + NULL, 0, NULL)) != 0) return (error); @@ -179,7 +179,7 @@ linux_clone_proc(struct thread *td, stru if (args->parent_tidptr == NULL) return (EINVAL); - error = fork1(td, ff, 0, &p2, NULL, 0); + error = fork1(td, ff, 0, &p2, NULL, 0, NULL); if (error) return (error); Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Fri Jul 31 10:00:45 2015 (r286121) +++ head/sys/kern/init_main.c Fri Jul 31 10:21:58 2015 (r286122) @@ -831,7 +831,7 @@ create_init(const void *udata __unused) int error; error = fork1(&thread0, RFFDG | RFPROC | RFSTOPPED, 0, &initproc, - NULL, 0); + NULL, 0, NULL); if (error) panic("cannot fork init: %d\n", error); KASSERT(initproc->p_pid == 1, ("create_init: initproc->p_pid != 1")); Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Fri Jul 31 10:00:45 2015 (r286121) +++ head/sys/kern/kern_fork.c Fri Jul 31 10:21:58 2015 (r286122) @@ -104,7 +104,7 @@ sys_fork(struct thread *td, struct fork_ int error; struct proc *p2; - error = fork1(td, RFFDG | RFPROC, 0, &p2, NULL, 0); + error = fork1(td, RFFDG | RFPROC, 0, &p2, NULL, 0, NULL); if (error == 0) { td->td_retval[0] = p2->p_pid; td->td_retval[1] = 0; @@ -127,7 +127,7 @@ sys_pdfork(td, uap) * itself from the parent using the return value. */ error = fork1(td, RFFDG | RFPROC | RFPROCDESC, 0, &p2, - &fd, uap->flags); + &fd, uap->flags, NULL); if (error == 0) { td->td_retval[0] = p2->p_pid; td->td_retval[1] = 0; @@ -144,7 +144,7 @@ sys_vfork(struct thread *td, struct vfor struct proc *p2; flags = RFFDG | RFPROC | RFPPWAIT | RFMEM; - error = fork1(td, flags, 0, &p2, NULL, 0); + error = fork1(td, flags, 0, &p2, NULL, 0, NULL); if (error == 0) { td->td_retval[0] = p2->p_pid; td->td_retval[1] = 0; @@ -163,7 +163,7 @@ sys_rfork(struct thread *td, struct rfor return (EINVAL); AUDIT_ARG_FFLAGS(uap->flags); - error = fork1(td, uap->flags, 0, &p2, NULL, 0); + error = fork1(td, uap->flags, 0, &p2, NULL, 0, NULL); if (error == 0) { td->td_retval[0] = p2 ? p2->p_pid : 0; td->td_retval[1] = 0; @@ -768,7 +768,7 @@ do_fork(struct thread *td, int flags, st int fork1(struct thread *td, int flags, int pages, struct proc **procp, - int *procdescp, int pdflags) + int *procdescp, int pdflags, struct filecaps *fcaps) { struct proc *p1; struct proc *newproc; @@ -824,7 +824,8 @@ fork1(struct thread *td, int flags, int * later. */ if (flags & RFPROCDESC) { - error = falloc(td, &fp_procdesc, procdescp, 0); + error = falloc_caps(td, &fp_procdesc, procdescp, 0, + fcaps); if (error != 0) return (error); } Modified: head/sys/kern/kern_kthread.c ============================================================================== --- head/sys/kern/kern_kthread.c Fri Jul 31 10:00:45 2015 (r286121) +++ head/sys/kern/kern_kthread.c Fri Jul 31 10:21:58 2015 (r286122) @@ -89,7 +89,7 @@ kproc_create(void (*func)(void *), void panic("kproc_create called too soon"); error = fork1(&thread0, RFMEM | RFFDG | RFPROC | RFSTOPPED | flags, - pages, &p2, NULL, 0); + pages, &p2, NULL, 0, NULL); if (error) return error; Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Fri Jul 31 10:00:45 2015 (r286121) +++ head/sys/sys/proc.h Fri Jul 31 10:21:58 2015 (r286122) @@ -161,6 +161,7 @@ struct pargs { * for write access. */ struct cpuset; +struct filecaps; struct kaioinfo; struct kaudit_record; struct kdtrace_proc; @@ -916,7 +917,8 @@ int enterpgrp(struct proc *p, pid_t pgid int enterthispgrp(struct proc *p, struct pgrp *pgrp); void faultin(struct proc *p); void fixjobc(struct proc *p, struct pgrp *pgrp, int entering); -int fork1(struct thread *, int, int, struct proc **, int *, int); +int fork1(struct thread *, int, int, struct proc **, int *, int, + struct filecaps *); void fork_exit(void (*)(void *, struct trapframe *), void *, struct trapframe *); void fork_return(struct thread *, struct trapframe *); From owner-svn-src-all@freebsd.org Fri Jul 31 10:46:46 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65E5F9AFD09; Fri, 31 Jul 2015 10:46:46 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 574CF1D4C; Fri, 31 Jul 2015 10:46:46 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VAkkCJ064839; Fri, 31 Jul 2015 10:46:46 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VAkkSo064838; Fri, 31 Jul 2015 10:46:46 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201507311046.t6VAkkSo064838@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Fri, 31 Jul 2015 10:46:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286123 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 10:46:46 -0000 Author: ed Date: Fri Jul 31 10:46:45 2015 New Revision: 286123 URL: https://svnweb.freebsd.org/changeset/base/286123 Log: Fix accidental line wrapping introduced in r286122. Modified: head/sys/kern/kern_fork.c Modified: head/sys/kern/kern_fork.c ============================================================================== --- head/sys/kern/kern_fork.c Fri Jul 31 10:21:58 2015 (r286122) +++ head/sys/kern/kern_fork.c Fri Jul 31 10:46:45 2015 (r286123) @@ -824,8 +824,7 @@ fork1(struct thread *td, int flags, int * later. */ if (flags & RFPROCDESC) { - error = falloc_caps(td, &fp_procdesc, procdescp, 0, - fcaps); + error = falloc_caps(td, &fp_procdesc, procdescp, 0, fcaps); if (error != 0) return (error); } From owner-svn-src-all@freebsd.org Fri Jul 31 11:10:53 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 963949AF0FA; Fri, 31 Jul 2015 11:10:53 +0000 (UTC) (envelope-from erwin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 83A60275E; Fri, 31 Jul 2015 11:10:53 +0000 (UTC) (envelope-from erwin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VBArWj075710; Fri, 31 Jul 2015 11:10:53 GMT (envelope-from erwin@FreeBSD.org) Received: (from erwin@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VBAiRp075679; Fri, 31 Jul 2015 11:10:44 GMT (envelope-from erwin@FreeBSD.org) Message-Id: <201507311110.t6VBAiRp075679@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erwin set sender to erwin@FreeBSD.org using -f From: Erwin Lansing Date: Fri, 31 Jul 2015 11:10:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r286124 - in stable/9/contrib/bind9: . doc/arm lib/dns lib/lwres/man X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 11:10:53 -0000 Author: erwin Date: Fri Jul 31 11:10:43 2015 New Revision: 286124 URL: https://svnweb.freebsd.org/changeset/base/286124 Log: Update BIND to 9.9.7-P2 This is a direct commit to stable/9 as BIND is no longer in head. Sponsored by: DK Hostmaster A/S Modified: stable/9/contrib/bind9/CHANGES stable/9/contrib/bind9/README stable/9/contrib/bind9/doc/arm/Bv9ARM.ch01.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch02.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch03.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch04.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch05.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch06.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch07.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch08.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch09.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch10.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch11.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch12.html stable/9/contrib/bind9/doc/arm/Bv9ARM.ch13.html stable/9/contrib/bind9/doc/arm/Bv9ARM.html stable/9/contrib/bind9/doc/arm/Bv9ARM.pdf stable/9/contrib/bind9/doc/arm/man.arpaname.html stable/9/contrib/bind9/doc/arm/man.ddns-confgen.html stable/9/contrib/bind9/doc/arm/man.dig.html stable/9/contrib/bind9/doc/arm/man.dnssec-checkds.html stable/9/contrib/bind9/doc/arm/man.dnssec-coverage.html stable/9/contrib/bind9/doc/arm/man.dnssec-dsfromkey.html stable/9/contrib/bind9/doc/arm/man.dnssec-keyfromlabel.html stable/9/contrib/bind9/doc/arm/man.dnssec-keygen.html stable/9/contrib/bind9/doc/arm/man.dnssec-revoke.html stable/9/contrib/bind9/doc/arm/man.dnssec-settime.html stable/9/contrib/bind9/doc/arm/man.dnssec-signzone.html stable/9/contrib/bind9/doc/arm/man.dnssec-verify.html stable/9/contrib/bind9/doc/arm/man.genrandom.html stable/9/contrib/bind9/doc/arm/man.host.html stable/9/contrib/bind9/doc/arm/man.isc-hmac-fixup.html stable/9/contrib/bind9/doc/arm/man.named-checkconf.html stable/9/contrib/bind9/doc/arm/man.named-checkzone.html stable/9/contrib/bind9/doc/arm/man.named-journalprint.html stable/9/contrib/bind9/doc/arm/man.named.html stable/9/contrib/bind9/doc/arm/man.nsec3hash.html stable/9/contrib/bind9/doc/arm/man.nsupdate.html stable/9/contrib/bind9/doc/arm/man.rndc-confgen.html stable/9/contrib/bind9/doc/arm/man.rndc.conf.html stable/9/contrib/bind9/doc/arm/man.rndc.html stable/9/contrib/bind9/doc/arm/notes.html stable/9/contrib/bind9/doc/arm/notes.pdf stable/9/contrib/bind9/doc/arm/notes.xml stable/9/contrib/bind9/lib/dns/api stable/9/contrib/bind9/lib/lwres/man/lwres.html stable/9/contrib/bind9/lib/lwres/man/lwres_buffer.html stable/9/contrib/bind9/lib/lwres/man/lwres_config.html stable/9/contrib/bind9/lib/lwres/man/lwres_context.html stable/9/contrib/bind9/lib/lwres/man/lwres_gabn.html stable/9/contrib/bind9/lib/lwres/man/lwres_gai_strerror.html stable/9/contrib/bind9/lib/lwres/man/lwres_getaddrinfo.html stable/9/contrib/bind9/lib/lwres/man/lwres_gethostent.html stable/9/contrib/bind9/lib/lwres/man/lwres_getipnode.html stable/9/contrib/bind9/lib/lwres/man/lwres_getnameinfo.html stable/9/contrib/bind9/lib/lwres/man/lwres_getrrsetbyname.html stable/9/contrib/bind9/lib/lwres/man/lwres_gnba.html stable/9/contrib/bind9/lib/lwres/man/lwres_hstrerror.html stable/9/contrib/bind9/lib/lwres/man/lwres_inetntop.html stable/9/contrib/bind9/lib/lwres/man/lwres_noop.html stable/9/contrib/bind9/lib/lwres/man/lwres_packet.html stable/9/contrib/bind9/lib/lwres/man/lwres_resutil.html stable/9/contrib/bind9/version Directory Properties: stable/9/contrib/bind9/ (props changed) Modified: stable/9/contrib/bind9/CHANGES ============================================================================== --- stable/9/contrib/bind9/CHANGES Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/CHANGES Fri Jul 31 11:10:43 2015 (r286124) @@ -1,3 +1,14 @@ + --- 9.9.7-P2 released --- + +4165. [security] A failure to reset a value to NULL in tkey.c could + result in an assertion failure. (CVE-2015-5477) + [RT #40046] + + --- 9.9.7-P1 released --- + +4138. [bug] An uninitialized value in validator.c could result + in an assertion failure. (CVE-2015-4620) [RT #39795] + --- 9.9.7 released --- --- 9.9.7rc2 released --- @@ -8380,7 +8391,7 @@ on the responses. [RT #2454] 1208. [bug] dns_master_load*() failed to log a error message if - an error was detected when parsing the ownername of + an error was detected when parsing the owner name of a record. [RT #2448] 1207. [bug] libbind: getaddrinfo() could call freeaddrinfo() with Modified: stable/9/contrib/bind9/README ============================================================================== --- stable/9/contrib/bind9/README Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/README Fri Jul 31 11:10:43 2015 (r286124) @@ -51,6 +51,15 @@ BIND 9 For up-to-date release notes and errata, see http://www.isc.org/software/bind9/releasenotes +BIND 9.9.7-P2 + + BIND 9.9.7-P1 is a security release addressing the flaw + described in CVE-2015-5477. + +BIND 9.9.7-P1 + + BIND 9.9.7-P1 is a security release addressing the flaw + described in CVE-2015-4620. BIND 9.9.7 Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch01.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch01.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch01.html Fri Jul 31 11:10:43 2015 (r286124) @@ -556,6 +556,6 @@
-

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch02.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch02.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch02.html Fri Jul 31 11:10:43 2015 (r286124) @@ -154,6 +154,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch03.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch03.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch03.html Fri Jul 31 11:10:43 2015 (r286124) @@ -665,6 +665,6 @@ controls { -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch04.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch04.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch04.html Fri Jul 31 11:10:43 2015 (r286124) @@ -1935,6 +1935,6 @@ $ORIGIN 0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2. -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch05.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch05.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch05.html Fri Jul 31 11:10:43 2015 (r286124) @@ -139,6 +139,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch06.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch06.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch06.html Fri Jul 31 11:10:43 2015 (r286124) @@ -11642,6 +11642,6 @@ HOST-127.EXAMPLE. MX 0 . -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch07.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch07.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch07.html Fri Jul 31 11:10:43 2015 (r286124) @@ -247,6 +247,6 @@ zone "example.com" { -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch08.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch08.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch08.html Fri Jul 31 11:10:43 2015 (r286124) @@ -135,6 +135,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch09.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch09.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch09.html Fri Jul 31 11:10:43 2015 (r286124) @@ -45,7 +45,7 @@

-Release Notes for BIND Version 9.9.7

+Release Notes for BIND Version 9.9.7-P2

Introduction

- This document summarizes changes since the last production release - of BIND on the corresponding major release branch. + This document summarizes changes since BIND 9.9.7. +

+

+ BIND 9.9.7-P2 addresses a security issue described in CVE-2015-5477. +

+

+ BIND 9.9.7-P1 addresses a security issue described in CVE-2015-4620.

@@ -86,42 +91,23 @@
  • - On servers configured to perform DNSSEC validation using - managed trust anchors (i.e., keys configured explicitly - via managed-keys, or implicitly - via dnssec-validation auto; or - dnssec-lookaside auto;), revoking - a trust anchor and sending a new untrusted replacement - could cause named to crash with an - assertion failure. This could occur in the event of a - botched key rollover, or potentially as a result of a - deliberate attack if the attacker was in position to - monitor the victim's DNS traffic. + A specially crafted query could trigger an assertion failure + in message.c.

    - This flaw was discovered by Jan-Piet Mens, and is - disclosed in CVE-2015-1349. [RT #38344] + This flaw was discovered by Jonathan Foote, and is disclosed + in CVE-2015-5477. [RT #39795]

  • - A flaw in delegation handling could be exploited to put - named into an infinite loop, in which - each lookup of a name server triggered additional lookups - of more name servers. This has been addressed by placing - limits on the number of levels of recursion - named will allow (default 7), and - on the number of queries that it will send before - terminating a recursive query (default 50). -

    -

    - The recursion depth limit is configured via the - max-recursion-depth option, and the query limit - via the max-recursion-queries option. + On servers configured to perform DNSSEC validation, an + assertion failure could be triggered on answers from + a specially configured server.

    - The flaw was discovered by Florian Maury of ANSSI, and is - disclosed in CVE-2014-8500. [RT #37580] + This flaw was discovered by Breno Silveira Soares, and is + disclosed in CVE-2015-4620. [RT #39795]

@@ -134,143 +120,12 @@

Feature Changes

-
    -
  • - NXDOMAIN responses to queries of type DS are now cached separately - from those for other types. This helps when using "grafted" zones - of type forward, for which the parent zone does not contain a - delegation, such as local top-level domains. Previously a query - of type DS for such a zone could cause the zone apex to be cached - as NXDOMAIN, blocking all subsequent queries. (Note: This - change is only helpful when DNSSEC validation is not enabled. - "Grafted" zones without a delegation in the parent are not a - recommended configuration.) -

  • -
  • - NOTIFY messages that are sent because a zone has been updated - are now given priority above NOTIFY messages that were scheduled - when the server started up. This should mitigate delays in zone - propagation when servers are restarted frequently. -

  • -
  • - Errors reported when running rndc addzone - (e.g., when a zone file cannot be loaded) have been clarified - to make it easier to diagnose problems. -

  • -
  • - Added support for OPENPGPKEY type. -

  • -
  • - When encountering an authoritative name server whose name is - an alias pointing to another name, the resolver treats - this as an error and skips to the next server. Previously - this happened silently; now the error will be logged to - the newly-created "cname" log category. -

  • -
  • - If named is not configured to validate the answer then - allow fallback to plain DNS on timeout even when we know - the server supports EDNS. This will allow the server to - potentially resolve signed queries when TCP is being - blocked. -

  • -
+
  • None

Bug Fixes

-
    -
  • - dig, host and - nslookup aborted when encountering - a name which, after appending search list elements, - exceeded 255 bytes. Such names are now skipped, but - processing of other names will continue. [RT #36892] -

  • -
  • - The error message generated when - named-checkzone or - named-checkconf -z encounters a - $TTL directive without a value has - been clarified. [RT #37138] -

  • -
  • - Semicolon characters (;) included in TXT records were - incorrectly escaped with a backslash when the record was - displayed as text. This is actually only necessary when there - are no quotation marks. [RT #37159] -

  • -
  • - When files opened for writing by named, - such as zone journal files, were referenced more than once - in named.conf, it could lead to file - corruption as multiple threads wrote to the same file. This - is now detected when loading named.conf - and reported as an error. [RT #37172] -

  • -
  • - dnssec-keygen -S failed to generate successor - keys for some algorithm types (including ECDSA and GOST) due to - a difference in the content of private key files. This has been - corrected. [RT #37183] -

  • -
  • - UPDATE messages that arrived too soon after - an rndc thaw could be lost. [RT #37233] -

  • -
  • - Forwarding of UPDATE messages did not work when they were - signed with SIG(0); they resulted in a BADSIG response code. - [RT #37216] -

  • -
  • - When checking for updates to trust anchors listed in - managed-keys, named - now revalidates keys based on the current set of - active trust anchors, without relying on any cached - record of previous validation. [RT #37506] -

  • -
  • - When NXDOMAIN redirection is in use, queries for a name - that is present in the redirection zone but a type that - is not present will now return NOERROR instead of NXDOMAIN. -

  • -
  • - When a zone contained a delegation to an IPv6 name server - but not an IPv4 name server, it was possible for a memory - reference to be left un-freed. This caused an assertion - failure on server shutdown, but was otherwise harmless. - [RT #37796] -

  • -
  • - Due to an inadvertent removal of code in the previous - release, when named encountered an - authoritative name server which dropped all EDNS queries, - it did not always try plain DNS. This has been corrected. - [RT #37965] -

  • -
  • - A regression caused nsupdate to use the default recursive servers - rather than the SOA MNAME server when sending the UPDATE. -

  • -
  • - Adjusted max-recursion-queries to better accommodate empty - caches. -

  • -
  • - Built-in "empty" zones did not correctly inherit the - "allow-transfer" ACL from the options or view. [RT #38310] -

  • -
  • - A mutex leak was fixed that could cause named - processes to grow to very large sizes. [RT #38454] -

  • -
  • - Fixed some bugs in RFC 5011 trust anchor management, - including a memory leak and a possible loss of state - information.[RT #38458] -

  • -
+
  • None

@@ -310,6 +165,6 @@

-

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch10.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch10.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch10.html Fri Jul 31 11:10:43 2015 (r286124) @@ -163,6 +163,6 @@
-

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch11.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch11.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch11.html Fri Jul 31 11:10:43 2015 (r286124) @@ -514,6 +514,6 @@
-

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch12.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch12.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch12.html Fri Jul 31 11:10:43 2015 (r286124) @@ -47,13 +47,13 @@
BIND 9 DNS Library Support
-
Prerequisite
-
Compilation
-
Installation
-
Known Defects/Restrictions
-
The dns.conf File
-
Sample Applications
-
Library References
+
Prerequisite
+
Compilation
+
Installation
+
Known Defects/Restrictions
+
The dns.conf File
+
Sample Applications
+
Library References
@@ -89,7 +89,7 @@

-Prerequisite

+Prerequisite

GNU make is required to build the export libraries (other part of BIND 9 can still be built with other types of make). In the reminder of this document, "make" means GNU make. Note that @@ -98,7 +98,7 @@

-Compilation

+Compilation
 $ ./configure --enable-exportlib [other flags]
 $ make
@@ -113,7 +113,7 @@ $ make
 

-Installation

+Installation
 $ cd lib/export
 $ make install
@@ -135,7 +135,7 @@ $ make i
 
 

-Known Defects/Restrictions

+Known Defects/Restrictions
  • Currently, win32 is not supported for the export library. (Normal BIND 9 application can be built as @@ -175,7 +175,7 @@ $ make

    -The dns.conf File

    +The dns.conf File

The IRS library supports an "advanced" configuration file related to the DNS library for configuration parameters that would be beyond the capability of the @@ -193,14 +193,14 @@ $ make

-Sample Applications

+Sample Applications

Some sample application programs using this API are provided for reference. The following is a brief description of these applications.

-sample: a simple stub resolver utility

+sample: a simple stub resolver utility

It sends a query of a given name (of a given optional RR type) to a specified recursive server, and prints the result as a list of @@ -264,7 +264,7 @@ $ make

-sample-async: a simple stub resolver, working asynchronously

+sample-async: a simple stub resolver, working asynchronously

Similar to "sample", but accepts a list of (query) domain names as a separate file and resolves the names @@ -305,7 +305,7 @@ $ make

-sample-request: a simple DNS transaction client

+sample-request: a simple DNS transaction client

It sends a query to a specified server, and prints the response with minimal processing. It doesn't act as a @@ -346,7 +346,7 @@ $ make

-sample-gai: getaddrinfo() and getnameinfo() test code

+sample-gai: getaddrinfo() and getnameinfo() test code

This is a test program to check getaddrinfo() and getnameinfo() behavior. It takes a @@ -363,7 +363,7 @@ $ make

-sample-update: a simple dynamic update client program

+sample-update: a simple dynamic update client program

It accepts a single update command as a command-line argument, sends an update request message to the @@ -458,7 +458,7 @@ $ sample

-nsprobe: domain/name server checker in terms of RFC 4074

+nsprobe: domain/name server checker in terms of RFC 4074

It checks a set of domains to see the name servers of the domains behave @@ -515,7 +515,7 @@ $ sample

-Library References

+Library References

As of this writing, there is no formal "manual" of the libraries, except this document, header files (some of them provide pretty detailed explanations), and sample application @@ -540,6 +540,6 @@ $ sample -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.ch13.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.ch13.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.ch13.html Fri Jul 31 11:10:43 2015 (r286124) @@ -140,6 +140,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/Bv9ARM.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/Bv9ARM.html Fri Jul 31 11:10:43 2015 (r286124) @@ -41,7 +41,7 @@

BIND 9 Administrator Reference Manual

-

BIND Version 9.9.7

+

BIND Version 9.9.7-P2

@@ -234,7 +234,7 @@
A. Release Notes
-
Release Notes for BIND Version 9.9.7
+
Release Notes for BIND Version 9.9.7-P2
Introduction
Download
@@ -262,13 +262,13 @@
BIND 9 DNS Library Support
-
Prerequisite
-
Compilation
-
Installation
-
Known Defects/Restrictions
-
The dns.conf File
-
Sample Applications
-
Library References
+
Prerequisite
+
Compilation
+
Installation
+
Known Defects/Restrictions
+
The dns.conf File
+
Sample Applications
+
Library References
I. Manual pages
@@ -365,6 +365,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/Bv9ARM.pdf ============================================================================== Binary file (source and/or target). No diff available. Modified: stable/9/contrib/bind9/doc/arm/man.arpaname.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/man.arpaname.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/man.arpaname.html Fri Jul 31 11:10:43 2015 (r286124) @@ -50,20 +50,20 @@

arpaname {ipaddress ...}

-

DESCRIPTION

+

DESCRIPTION

arpaname translates IP addresses (IPv4 and IPv6) to the corresponding IN-ADDR.ARPA or IP6.ARPA names.

-

SEE ALSO

+

SEE ALSO

BIND 9 Administrator Reference Manual.

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

@@ -87,6 +87,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/man.ddns-confgen.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/man.ddns-confgen.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/man.ddns-confgen.html Fri Jul 31 11:10:43 2015 (r286124) @@ -50,7 +50,7 @@

ddns-confgen [-a algorithm] [-h] [-k keyname] [-r randomfile] [ -s name | -z zone ] [-q] [name]

-

DESCRIPTION

+

DESCRIPTION

ddns-confgen generates a key for use by nsupdate and named. It simplifies configuration @@ -77,7 +77,7 @@

-

OPTIONS

+

OPTIONS

-a algorithm

@@ -144,7 +144,7 @@

-

SEE ALSO

+

SEE ALSO

nsupdate(1), named.conf(5), named(8), @@ -152,7 +152,7 @@

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

@@ -176,6 +176,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/man.dig.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/man.dig.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/man.dig.html Fri Jul 31 11:10:43 2015 (r286124) @@ -52,7 +52,7 @@

dig [global-queryopt...] [query...]

-

DESCRIPTION

+

DESCRIPTION

dig (domain information groper) is a flexible tool for interrogating DNS name servers. It performs DNS lookups and @@ -99,7 +99,7 @@

-

SIMPLE USAGE

+

SIMPLE USAGE

A typical invocation of dig looks like:

@@ -152,7 +152,7 @@

-

OPTIONS

+

OPTIONS

The -b option sets the source IP address of the query to address. This must be a valid @@ -260,7 +260,7 @@

-

QUERY OPTIONS

+

QUERY OPTIONS

dig provides a number of query options which affect the way in which lookups are made and the results displayed. Some of @@ -618,7 +618,7 @@

-

MULTIPLE QUERIES

+

MULTIPLE QUERIES

The BIND 9 implementation of dig supports @@ -664,7 +664,7 @@ dig +qr www.isc.org any -x 127.0.0.1 isc

-

IDN SUPPORT

+

IDN SUPPORT

If dig has been built with IDN (internationalized domain name) support, it can accept and display non-ASCII domain names. @@ -678,14 +678,14 @@ dig +qr www.isc.org any -x 127.0.0.1 isc

-

FILES

+

FILES

/etc/resolv.conf

${HOME}/.digrc

-

SEE ALSO

+

SEE ALSO

host(1), named(8), dnssec-keygen(8), @@ -693,7 +693,7 @@ dig +qr www.isc.org any -x 127.0.0.1 isc

-

BUGS

+

BUGS

There are probably too many query options.

@@ -716,6 +716,6 @@ dig +qr www.isc.org any -x 127.0.0.1 isc
-

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/man.dnssec-checkds.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/man.dnssec-checkds.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/man.dnssec-checkds.html Fri Jul 31 11:10:43 2015 (r286124) @@ -51,7 +51,7 @@

dnssec-dsfromkey [-l domain] [-f file] [-d dig path] [-D dsfromkey path] {zone}

-

DESCRIPTION

+

DESCRIPTION

dnssec-checkds verifies the correctness of Delegation Signer (DS) or DNSSEC Lookaside Validation (DLV) resource records for keys in a specified @@ -59,7 +59,7 @@

-

OPTIONS

+

OPTIONS

-f file

@@ -88,14 +88,14 @@

-

SEE ALSO

+

SEE ALSO

dnssec-dsfromkey(8), dnssec-keygen(8), dnssec-signzone(8),

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

@@ -118,6 +118,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/man.dnssec-coverage.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/man.dnssec-coverage.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/man.dnssec-coverage.html Fri Jul 31 11:10:43 2015 (r286124) @@ -50,7 +50,7 @@

dnssec-coverage [-K directory] [-f file] [-d DNSKEY TTL] [-m max TTL] [-r interval] [-c compilezone path] [zone]

-

DESCRIPTION

+

DESCRIPTION

dnssec-coverage verifies that the DNSSEC keys for a given zone or a set of zones have timing metadata set properly to ensure no future lapses in DNSSEC @@ -78,7 +78,7 @@

-

OPTIONS

+

OPTIONS

-f file

@@ -168,7 +168,7 @@

-

SEE ALSO

+

SEE ALSO

dnssec-checkds(8), dnssec-dsfromkey(8), @@ -177,7 +177,7 @@

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

@@ -201,6 +201,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/man.dnssec-dsfromkey.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/man.dnssec-dsfromkey.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/man.dnssec-dsfromkey.html Fri Jul 31 11:10:43 2015 (r286124) @@ -52,14 +52,14 @@

dnssec-dsfromkey [-h] [-V]

-

DESCRIPTION

+

DESCRIPTION

dnssec-dsfromkey outputs the Delegation Signer (DS) resource record (RR), as defined in RFC 3658 and RFC 4509, for the given key(s).

-

OPTIONS

+

OPTIONS

-1

@@ -144,7 +144,7 @@

-

EXAMPLE

+

EXAMPLE

To build the SHA-256 DS RR from the Kexample.com.+003+26160 @@ -159,7 +159,7 @@

-

FILES

+

FILES

The keyfile can be designed by the key identification Knnnn.+aaa+iiiii or the full file name @@ -173,13 +173,13 @@

-

CAVEAT

+

CAVEAT

A keyfile error can give a "file not found" even if the file exists.

-

SEE ALSO

+

SEE ALSO

dnssec-keygen(8), dnssec-signzone(8), BIND 9 Administrator Reference Manual, @@ -189,7 +189,7 @@

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

@@ -213,6 +213,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/man.dnssec-keyfromlabel.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/man.dnssec-keyfromlabel.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/man.dnssec-keyfromlabel.html Fri Jul 31 11:10:43 2015 (r286124) @@ -50,7 +50,7 @@

dnssec-keyfromlabel {-l label} [-3] [-a algorithm] [-A date/offset] [-c class] [-D date/offset] [-E engine] [-f flag] [-G] [-I date/offset] [-i interval] [-k] [-K directory] [-L ttl] [-n nametype] [-P date/offset] [-p protocol] [-R date/offset] [-S key] [-t type] [-v level] [-V] [-y] {name}

-

DESCRIPTION

+

DESCRIPTION

dnssec-keyfromlabel generates a key pair of files that referencing a key object stored in a cryptographic hardware service module (HSM). The private key @@ -66,7 +66,7 @@

-

OPTIONS

+

OPTIONS

-a algorithm
@@ -209,7 +209,7 @@
-

TIMING OPTIONS

+

TIMING OPTIONS

Dates can be expressed in the format YYYYMMDD or YYYYMMDDHHMMSS. If the argument begins with a '+' or '-', it is interpreted as @@ -281,7 +281,7 @@

-

GENERATED KEY FILES

+

GENERATED KEY FILES

When dnssec-keyfromlabel completes successfully, @@ -320,7 +320,7 @@

-

SEE ALSO

+

SEE ALSO

dnssec-keygen(8), dnssec-signzone(8), BIND 9 Administrator Reference Manual, @@ -328,7 +328,7 @@

-

AUTHOR

+

AUTHOR

Internet Systems Consortium

@@ -352,6 +352,6 @@ -

BIND 9.9.7 (Extended Support Version)

+

BIND 9.9.7-P2 (Extended Support Version)

Modified: stable/9/contrib/bind9/doc/arm/man.dnssec-keygen.html ============================================================================== --- stable/9/contrib/bind9/doc/arm/man.dnssec-keygen.html Fri Jul 31 10:46:45 2015 (r286123) +++ stable/9/contrib/bind9/doc/arm/man.dnssec-keygen.html Fri Jul 31 11:10:43 2015 (r286124) @@ -50,7 +50,7 @@

dnssec-keygen [-a algorithm] [-b keysize] [-n nametype] [-3] [-A date/offset] [-C] [-c class] [-D date/offset] [-E engine] [-f flag] [-G] [-g generator] [-h] [-I date/offset] [-i interval] [-K directory] [-L ttl] [-k] [-P date/offset] [-p protocol] [-q] [-R date/offset] [-r randomdev] [-S key] [-s strength] [-t type] [-v level] [-V] [-z] {name}

-

DESCRIPTION

+

DESCRIPTION

dnssec-keygen generates keys for DNSSEC (Secure DNS), as defined in RFC 2535 and RFC 4034. It can also generate keys for use with @@ -64,7 +64,7 @@

-

OPTIONS

*** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Jul 31 12:02:45 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C06799AFE8F; Fri, 31 Jul 2015 12:02:45 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0BA11C28; Fri, 31 Jul 2015 12:02:45 +0000 (UTC) (envelope-from garga@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VC2jrm097147; Fri, 31 Jul 2015 12:02:45 GMT (envelope-from garga@FreeBSD.org) Received: (from garga@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VC2jqF097146; Fri, 31 Jul 2015 12:02:45 GMT (envelope-from garga@FreeBSD.org) Message-Id: <201507311202.t6VC2jqF097146@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: garga set sender to garga@FreeBSD.org using -f From: Renato Botelho Date: Fri, 31 Jul 2015 12:02:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286125 - stable/10/sys/netpfil/pf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 12:02:45 -0000 Author: garga (ports committer) Date: Fri Jul 31 12:02:44 2015 New Revision: 286125 URL: https://svnweb.freebsd.org/changeset/base/286125 Log: MFC r285945, r285960: Respect pf rule log option before log dropped packets with IP options or dangerous v6 headers Reviewed by: gnn, eri Approved by: gnn, glebius Obtained from: pfSense Sponsored by: Netgate Differential Revision: https://reviews.freebsd.org/D3222 Modified: stable/10/sys/netpfil/pf/pf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netpfil/pf/pf.c ============================================================================== --- stable/10/sys/netpfil/pf/pf.c Fri Jul 31 11:10:43 2015 (r286124) +++ stable/10/sys/netpfil/pf/pf.c Fri Jul 31 12:02:44 2015 (r286125) @@ -5894,7 +5894,7 @@ done: !((s && s->state_flags & PFSTATE_ALLOWOPTS) || r->allow_opts)) { action = PF_DROP; REASON_SET(&reason, PFRES_IPOPTIONS); - log = 1; + log = r->log; DPFPRINTF(PF_DEBUG_MISC, ("pf: dropping packet with ip options\n")); } @@ -6326,7 +6326,7 @@ done: !((s && s->state_flags & PFSTATE_ALLOWOPTS) || r->allow_opts)) { action = PF_DROP; REASON_SET(&reason, PFRES_IPOPTIONS); - log = 1; + log = r->log; DPFPRINTF(PF_DEBUG_MISC, ("pf: dropping packet with dangerous v6 headers\n")); } From owner-svn-src-all@freebsd.org Fri Jul 31 12:37:40 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E75229AF597; Fri, 31 Jul 2015 12:37:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B572110AF; Fri, 31 Jul 2015 12:37:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VCbeO1010324; Fri, 31 Jul 2015 12:37:40 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VCbemD010323; Fri, 31 Jul 2015 12:37:40 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201507311237.t6VCbemD010323@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 31 Jul 2015 12:37:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286126 - head/contrib/elftoolchain/brandelf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 12:37:41 -0000 Author: emaste Date: Fri Jul 31 12:37:40 2015 New Revision: 286126 URL: https://svnweb.freebsd.org/changeset/base/286126 Log: Add ELF Tool Chain's brandelf(1) to contrib Noticed by pfg after r286070 (ar and elfdump) Added: - copied from r286125, vendor/elftoolchain/dist/brandelf/ Directory Properties: head/contrib/elftoolchain/brandelf/ (props changed) From owner-svn-src-all@freebsd.org Fri Jul 31 13:03:53 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B14049AFA9B; Fri, 31 Jul 2015 13:03:53 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io0-x235.google.com (mail-io0-x235.google.com [IPv6:2607:f8b0:4001:c06::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7E1B5203B; Fri, 31 Jul 2015 13:03:53 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by ioii16 with SMTP id i16so84488651ioi.0; Fri, 31 Jul 2015 06:03:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=DAKmYYkyJDKtVtYPNA2v+YX2OeOzdEt61VdGkYMJgT0=; b=K+IfbO4PkLiNO6o0ZbeQz+GAjAS6NFKm3TGWmyz6kHjDK+dMSh1XzEQJF81fg6KGD9 BmegdshEHPXk5LIvWFLPnL3OM10BJLieHkJpzZfg17hZ9eIbYYyEIxFsUDSVvZeVLkTW gX+2k9XsdsCDXIwcXoGCuRmayZbQ3cU8AtxxYO8DQY0zHefkhv0kh+kgYtFTvD6Dta/T 9OS5RIFItXQte/zneNcDCDReCUKgVCsa/WtunO8zbsCI8sbWRRahimbsu7/2RmgdTpZd o6bECYzdfd+u5DWepvOYf/Opb8DvFBIOPPHjUfUYbQmWF1nuQaXeHvQc1OIUV8pTqftg lEGw== X-Received: by 10.107.150.141 with SMTP id y135mr4492770iod.38.1438347832778; Fri, 31 Jul 2015 06:03:52 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.136.200 with HTTP; Fri, 31 Jul 2015 06:03:33 -0700 (PDT) In-Reply-To: <55BA7189.5090004@FreeBSD.org> References: <201507301241.t6UCftU3024427@repo.freebsd.org> <55BA7189.5090004@FreeBSD.org> From: Ed Maste Date: Fri, 31 Jul 2015 09:03:33 -0400 X-Google-Sender-Auth: 25yWIj30VuGnSIyK44dabaYjtx0 Message-ID: Subject: Re: svn commit: r286070 - in head/contrib/elftoolchain: ar elfdump To: Pedro Giffuni Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 13:03:53 -0000 >> Author: emaste >> Date: Thu Jul 30 12:41:54 2015 >> New Revision: 286070 >> URL: https://svnweb.freebsd.org/changeset/base/286070 >> >> Log: >> Add ELF Tool Chain's ar(1) and elfdump(1) to contrib > > Thank you! Np. Thanks for noting brandelf, I just copied it over as well. There's a little more work to be done still before these are fully equivalent to the ones in FreeBSD, and I won't switch them until they're ready. FreeBSD svn revisions that need to be brought over to ELF Tool Chain: * ar r228823 man page markup r241827 __dead2 annotation r284928 workaround for performance issue on UFS file systems r286010/r286024 support deterministic mode by default * elfdump r226434 ELFOSABI_STANDALONE and ELFOSABI_AIX r202386 man page markup r265613/r267649 handle ELF files with 65280 or more sections r269092/r269143 improve section type reporting r269338 use existing ELF constants where available r274960 capsicum: limit descriptors and enter capability mode * brandelf r263759/r254931 jmg@ email address and license block From owner-svn-src-all@freebsd.org Fri Jul 31 13:32:26 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4F069AE265; Fri, 31 Jul 2015 13:32:26 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B547B2EDE; Fri, 31 Jul 2015 13:32:26 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VDWQEF034592; Fri, 31 Jul 2015 13:32:26 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VDWQK1034591; Fri, 31 Jul 2015 13:32:26 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201507311332.t6VDWQK1034591@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 31 Jul 2015 13:32:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286127 - head/sys/arm64/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 13:32:26 -0000 Author: andrew Date: Fri Jul 31 13:32:25 2015 New Revision: 286127 URL: https://svnweb.freebsd.org/changeset/base/286127 Log: Add VIRT_IN_DMAP to check if a virtual address is from the DMAP range. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/include/vmparam.h Modified: head/sys/arm64/include/vmparam.h ============================================================================== --- head/sys/arm64/include/vmparam.h Fri Jul 31 12:37:40 2015 (r286126) +++ head/sys/arm64/include/vmparam.h Fri Jul 31 13:32:25 2015 (r286127) @@ -165,6 +165,9 @@ /* True if pa is in the dmap range */ #define PHYS_IN_DMAP(pa) ((pa) <= DMAP_MAX_PHYSADDR) +/* True if va is in the dmap range */ +#define VIRT_IN_DMAP(va) ((va) >= DMAP_MIN_ADDRESS && \ + (va) <= DMAP_MAX_ADDRESS) #define PHYS_TO_DMAP(pa) \ ({ \ @@ -176,7 +179,7 @@ #define DMAP_TO_PHYS(va) \ ({ \ - KASSERT(((va) <= DMAP_MAX_ADDRESS || (va) >= DMAP_MIN_ADDRESS), \ + KASSERT(VIRT_IN_DMAP(va), \ ("%s: VA out of range, VA: 0x%lx", __func__, \ (vm_offset_t)(va))); \ (va) & ~DMAP_MIN_ADDRESS; \ From owner-svn-src-all@freebsd.org Fri Jul 31 13:34:45 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0BDB19AE3F5; Fri, 31 Jul 2015 13:34:45 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D6AED10B0; Fri, 31 Jul 2015 13:34:44 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VDYilk034746; Fri, 31 Jul 2015 13:34:44 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VDYira034745; Fri, 31 Jul 2015 13:34:44 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201507311334.t6VDYira034745@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 31 Jul 2015 13:34:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286128 - head/sys/arm64/include X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 13:34:45 -0000 Author: andrew Date: Fri Jul 31 13:34:43 2015 New Revision: 286128 URL: https://svnweb.freebsd.org/changeset/base/286128 Log: Add more atomic_swap_* functions. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/include/atomic.h Modified: head/sys/arm64/include/atomic.h ============================================================================== --- head/sys/arm64/include/atomic.h Fri Jul 31 13:32:25 2015 (r286127) +++ head/sys/arm64/include/atomic.h Fri Jul 31 13:34:43 2015 (r286128) @@ -153,6 +153,22 @@ atomic_set_32(volatile uint32_t *p, uint ); } +static __inline uint32_t +atomic_swap_32(volatile uint32_t *p, uint32_t val) +{ + uint32_t tmp; + int res; + + __asm __volatile( + "1: ldxr %w0, [%2] \n" + " stxr %w1, %w3, [%2] \n" + " cbnz %w1, 1b \n" + : "=&r"(tmp), "=&r"(res), "+r" (p), "+r" (val) : : "cc", "memory" + ); + + return (tmp); +} + static __inline void atomic_subtract_32(volatile uint32_t *p, uint32_t val) { @@ -174,6 +190,7 @@ atomic_subtract_32(volatile uint32_t *p, #define atomic_fetchadd_int atomic_fetchadd_32 #define atomic_readandclear_int atomic_readandclear_32 #define atomic_set_int atomic_set_32 +#define atomic_swap_int atomic_swap_32 #define atomic_subtract_int atomic_subtract_32 static __inline void @@ -515,6 +532,7 @@ atomic_swap_64(volatile uint64_t *p, uin #define atomic_fetchadd_long atomic_fetchadd_64 #define atomic_readandclear_long atomic_readandclear_64 #define atomic_set_long atomic_set_64 +#define atomic_swap_long atomic_swap_64 #define atomic_subtract_long atomic_subtract_64 #define atomic_add_ptr atomic_add_64 @@ -523,6 +541,7 @@ atomic_swap_64(volatile uint64_t *p, uin #define atomic_fetchadd_ptr atomic_fetchadd_64 #define atomic_readandclear_ptr atomic_readandclear_64 #define atomic_set_ptr atomic_set_64 +#define atomic_swap_ptr atomic_swap_64 #define atomic_subtract_ptr atomic_subtract_64 static __inline void From owner-svn-src-all@freebsd.org Fri Jul 31 13:39:52 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E9639AE492; Fri, 31 Jul 2015 13:39:52 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3CB3413AA; Fri, 31 Jul 2015 13:39:52 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VDdqv6035005; Fri, 31 Jul 2015 13:39:52 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VDdq8G035004; Fri, 31 Jul 2015 13:39:52 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201507311339.t6VDdq8G035004@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 31 Jul 2015 13:39:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286129 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 13:39:52 -0000 Author: andrew Date: Fri Jul 31 13:39:51 2015 New Revision: 286129 URL: https://svnweb.freebsd.org/changeset/base/286129 Log: Add memrw. This has had minimal testing, and will likely panic the kernel when trying to read data from outside the DMAP region. I expect this panic to be from within uiomove_fromphys, which needs to grow support to support such addresses. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/mem.c Modified: head/sys/arm64/arm64/mem.c ============================================================================== --- head/sys/arm64/arm64/mem.c Fri Jul 31 13:34:43 2015 (r286128) +++ head/sys/arm64/arm64/mem.c Fri Jul 31 13:39:51 2015 (r286129) @@ -33,15 +33,84 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include +#include + +#include +#include +#include +#include struct mem_range_softc mem_range_softc; int memrw(struct cdev *dev, struct uio *uio, int flags) { + struct iovec *iov; + struct vm_page m; + vm_page_t marr; + vm_offset_t off, v; + u_int cnt; + int error; + + error = 0; + + while (uio->uio_resid > 0 && error == 0) { + iov = uio->uio_iov; + if (iov->iov_len == 0) { + uio->uio_iov++; + uio->uio_iovcnt--; + if (uio->uio_iovcnt < 0) + panic("memrw"); + continue; + } + + v = uio->uio_offset; + off = v & PAGE_MASK; + cnt = ulmin(iov->iov_len, PAGE_SIZE - (u_int)off); + if (cnt == 0) + continue; + + switch(dev2unit(dev)) { + case CDEV_MINOR_KMEM: + /* If the address is in the DMAP just copy it */ + if (VIRT_IN_DMAP(v)) { + error = uiomove((void *)v, cnt, uio); + break; + } + + if (!kernacc((void *)v, cnt, uio->uio_rw == UIO_READ ? + VM_PROT_READ : VM_PROT_WRITE)) { + error = EFAULT; + break; + } + + /* Get the physical address to read */ + v = pmap_extract(kernel_pmap, v); + if (v == 0) { + error = EFAULT; + break; + } + + /* FALLTHROUGH */ + case CDEV_MINOR_MEM: + /* If within the DMAP use this to copy from */ + if (PHYS_IN_DMAP(v)) { + v = PHYS_TO_DMAP(v); + error = uiomove((void *)v, cnt, uio); + break; + } + + /* Have uiomove_fromphys handle the data */ + m.phys_addr = trunc_page(v); + marr = &m; + uiomove_fromphys(&marr, off, cnt, uio); + break; + } + } - panic("ARM64TODO: memrw"); + return (error); } From owner-svn-src-all@freebsd.org Fri Jul 31 14:17:29 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B2079AECA3; Fri, 31 Jul 2015 14:17:29 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F41F71871; Fri, 31 Jul 2015 14:17:28 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VEHSeD051352; Fri, 31 Jul 2015 14:17:28 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VEHQpc051348; Fri, 31 Jul 2015 14:17:26 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201507311417.t6VEHQpc051348@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 31 Jul 2015 14:17:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286130 - in head/sys: arm64/arm64 arm64/include conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 14:17:29 -0000 Author: andrew Date: Fri Jul 31 14:17:26 2015 New Revision: 286130 URL: https://svnweb.freebsd.org/changeset/base/286130 Log: Add support for uma_small_alloc and uma_small_free, and make use of these. This is copied from the amd64 version with minor changes. These should be merged into a single file as from a quick look there are other copies of the same file in other parts of the tree. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Added: head/sys/arm64/arm64/uma_machdep.c - copied, changed from r286078, head/sys/amd64/amd64/uma_machdep.c Modified: head/sys/arm64/arm64/vm_machdep.c head/sys/arm64/include/vmparam.h head/sys/conf/files.arm64 Copied and modified: head/sys/arm64/arm64/uma_machdep.c (from r286078, head/sys/amd64/amd64/uma_machdep.c) ============================================================================== --- head/sys/amd64/amd64/uma_machdep.c Thu Jul 30 15:47:53 2015 (r286078, copy source) +++ head/sys/arm64/arm64/uma_machdep.c Fri Jul 31 14:17:26 2015 (r286130) @@ -61,11 +61,9 @@ uma_small_alloc(uma_zone_t zone, vm_size break; } pa = m->phys_addr; - if ((wait & M_NODUMP) == 0) - dump_add_page(pa); va = (void *)PHYS_TO_DMAP(pa); if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) - pagezero(va); + bzero(va, PAGE_SIZE); return (va); } @@ -76,7 +74,6 @@ uma_small_free(void *mem, vm_size_t size vm_paddr_t pa; pa = DMAP_TO_PHYS((vm_offset_t)mem); - dump_drop_page(pa); m = PHYS_TO_VM_PAGE(pa); m->wire_count--; vm_page_free(m); Modified: head/sys/arm64/arm64/vm_machdep.c ============================================================================== --- head/sys/arm64/arm64/vm_machdep.c Fri Jul 31 13:39:51 2015 (r286129) +++ head/sys/arm64/arm64/vm_machdep.c Fri Jul 31 14:17:26 2015 (r286130) @@ -258,18 +258,3 @@ swi_vm(void *v) /* Nothing to do here - busdma bounce buffers are not implemented. */ } - -void * -uma_small_alloc(uma_zone_t zone, vm_size_t bytes, u_int8_t *flags, int wait) -{ - - panic("ARM64TODO: uma_small_alloc"); -} - -void -uma_small_free(void *mem, vm_size_t size, u_int8_t flags) -{ - - panic("ARM64TODO: uma_small_free"); -} - Modified: head/sys/arm64/include/vmparam.h ============================================================================== --- head/sys/arm64/include/vmparam.h Fri Jul 31 13:39:51 2015 (r286129) +++ head/sys/arm64/include/vmparam.h Fri Jul 31 14:17:26 2015 (r286130) @@ -224,6 +224,8 @@ #define VM_INITIAL_PAGEIN 16 #endif +#define UMA_MD_SMALL_ALLOC + extern u_int tsb_kernel_ldd_phys; extern vm_offset_t vm_max_kernel_address; extern vm_offset_t init_pt_va; Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Fri Jul 31 13:39:51 2015 (r286129) +++ head/sys/conf/files.arm64 Fri Jul 31 14:17:26 2015 (r286130) @@ -46,6 +46,7 @@ arm64/arm64/swtch.S standard arm64/arm64/sys_machdep.c standard arm64/arm64/trap.c standard arm64/arm64/uio_machdep.c standard +arm64/arm64/uma_machdep.c standard arm64/arm64/unwind.c optional ddb | kdtrace_hooks arm64/arm64/vfp.c standard arm64/arm64/vm_machdep.c standard From owner-svn-src-all@freebsd.org Fri Jul 31 14:31:50 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5269B9AF02F for ; Fri, 31 Jul 2015 14:31:50 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mail-ig0-f175.google.com (mail-ig0-f175.google.com [209.85.213.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 172BC1151 for ; Fri, 31 Jul 2015 14:31:49 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: by igr7 with SMTP id 7so17517974igr.0 for ; Fri, 31 Jul 2015 07:31:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:message-id:references:to; bh=3ufbViEVJJzWi5mWskP5NbO9YjbqlyzgnMy9eHKC1x0=; b=S4ENau6yCuXkKnDq43xaRRXbqNhSflA/mkT6vv8o1rbev/8BbKs19EvFItl6U5jxf9 pWePlruHP1vVrp3vAVZu/Lr0Vto9i34lGAkSVj5C6CmFM9yLGyldUfJmFj6af5Hg2QzZ TNiKlSObtzE5D+O9Qi5r6YOY1GyCiJ0dKj4147fD0ZHPpN97jyD09vNu/outcqI1SMuS SeJ0kSkwEQLFvy3qOO+tFiV6Wl8Ws4BfxC9egOa+AhgpkndZAJM4RF0nfsU4KIUPpYd3 nUVynm9LxtVp2OqStIe5vEydZEgcjTBvzA9LK8Q74wnamEeTmqgr1NcH5ahHU+ofiplU cO6A== X-Gm-Message-State: ALoCoQnZaCLZn77DaiIqR4isue7GHnt+9Z3iBGJYY8klXtrgKXh+9yoFs1XOgKkxlTKne1xC3G9f X-Received: by 10.50.39.80 with SMTP id n16mr6133673igk.76.1438353103639; Fri, 31 Jul 2015 07:31:43 -0700 (PDT) Received: from netflix-mac-wired.bsdimp.com ([50.253.99.174]) by smtp.gmail.com with ESMTPSA id fv2sm2305619igb.22.2015.07.31.07.31.40 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Jul 2015 07:31:41 -0700 (PDT) Sender: Warner Losh Subject: Re: svn commit: r286110 - head/sys/net Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2102\)) Content-Type: multipart/signed; boundary="Apple-Mail=_4B0C56FD-CD48-4923-83F9-1DBC253E83D5"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail 2.5 From: Warner Losh In-Reply-To: <201507310748.t6V7m9pa091593@repo.freebsd.org> Date: Fri, 31 Jul 2015 08:31:38 -0600 Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: References: <201507310748.t6V7m9pa091593@repo.freebsd.org> To: John-Mark Gurney X-Mailer: Apple Mail (2.2102) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 14:31:50 -0000 --Apple-Mail=_4B0C56FD-CD48-4923-83F9-1DBC253E83D5 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jul 31, 2015, at 1:48 AM, John-Mark Gurney wrote: >=20 > Author: jmg > Date: Fri Jul 31 07:48:08 2015 > New Revision: 286110 > URL: https://svnweb.freebsd.org/changeset/base/286110 >=20 > Log: > temporarily fix build.. This isn't the final fix, and testing is > still on going, but it has passed world for mips and powerpc... >=20 > I know this has an extra semicolon, but this is the patch that is > tested... >=20 > Looks like better fix is to use _Static_assert... Is _Static_assert supported by gcc? No, it isn=E2=80=99t, but = sys/cdefs.h provides a definition. The real problem here is that sys/cdefs.h isn=E2=80=99t included to pick = that up, so we got issues. Warner --Apple-Mail=_4B0C56FD-CD48-4923-83F9-1DBC253E83D5 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJVu4bKAAoJEGwc0Sh9sBEA2J8P/RXQRBnUGBj7P5as+o72mq7H xWCnioCRJX10H60g79NO0W07URJTaBFvB59Q2Ypk1jFjcam39hFWcN1gTFkBYV1F WOhO0EhTqgXilQoe2zXGYh/89z4+1NNFkUa5rce88XV3GRy3aQ645tTB+egQckxB A3aD89HP3AvrAqa5V3p34LMJ7zhajYStMkSBr5a2XVgOFzS7s7ktJr1w/MBkaDY7 VcDx/A35Gya1yAEf4C0DovpOzB9EpK6+ggor4a4cG7yjTtJAaQTJhGbYjeeBhwJd EhHtBKrHIQy4soTfwwf8zOFtFyAAXra1Jd4MPqnJjotIKNzopCRY0CCjAG9OcOkc p2exTn6tI5M1b6sMnJw5rm7P6cd80s+flsTZPPdFG2pkwtkaP3mhyUy3lQNbhtV1 Mlvd3n7sktKMCJghnMXJYNLe4Vk73d52+FARLcq4WlR53pJ14XCLXKFUr9+7QC+e saXdohPB1SZBYHf4wjaAKvC72gNHvZ+Zr6trf2Q8u1nP5w8HeYnvUPdqegtQcazv LL5ntwI1pLfqTjQ+rkleGFYToepJ1tzxL2ylVkPfnK06rePjHP95mdKHkPCByEfR dLWtxEvONSTJro+Pjjx9qIVR5Ltg+fiN+Piec66Rcj+j2z4NJZUCXDaeuXVs3uDk ciSoSwy5qBka41cRQ5eC =SrCi -----END PGP SIGNATURE----- --Apple-Mail=_4B0C56FD-CD48-4923-83F9-1DBC253E83D5-- From owner-svn-src-all@freebsd.org Fri Jul 31 14:34:51 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70BA29AF07F for ; Fri, 31 Jul 2015 14:34:51 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mail-ig0-f174.google.com (mail-ig0-f174.google.com [209.85.213.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3DBB8145A for ; Fri, 31 Jul 2015 14:34:50 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: by igbpg9 with SMTP id pg9so33188742igb.0 for ; Fri, 31 Jul 2015 07:34:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:message-id:references:to; bh=89w4W7e1vbfA0FdF9BAoLBbWN86ofAI0olfYy2EC4Ls=; b=l0Yl1jM9eUCMLgtBOyNk7RAfrzc08dHThw/k6oyEvWb9wD3OC+azZFZ+Z1fxrwKIt9 op3WqCaZIOzXo3Va+ZQH189QuMP1GVpzvPsY7ix6BwIX4Hh78/mivfzJbq2zvQ/ykO0T vWWdpvNfFQ8rQeRQCDYJfYzKlAt/YC2+P3a6GUthm4M7wLPgqPs3Ewbybrm/YgA80cxC XORqrwQmoAfOqTvwB0QNlXMFKAz/aCqc86DMS/B9/riLOBHG8L5LnQaGn8t2SLOVcE+f oAAJyN71BW2BOd/4EIxyqciDl4JGhhaaxlJGzQWUa+ANmrBh1TxR08p8UdRMUx0AFP2k 7NjA== X-Gm-Message-State: ALoCoQmYnrHOoXpVcYYvdeA6oDqJIuRu7kwrYqNTIbZnfxHJcHFTUbJO4NgYyKeHvOoQFBKHbddF X-Received: by 10.50.64.179 with SMTP id p19mr6572302igs.55.1438353290029; Fri, 31 Jul 2015 07:34:50 -0700 (PDT) Received: from netflix-mac-wired.bsdimp.com ([50.253.99.174]) by smtp.gmail.com with ESMTPSA id j3sm2352775ige.0.2015.07.31.07.34.49 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Jul 2015 07:34:49 -0700 (PDT) Sender: Warner Losh Subject: Re: svn commit: r286103 - head/share/man/man9 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2102\)) Content-Type: multipart/signed; boundary="Apple-Mail=_52065108-EBDB-4353-BFA0-CFE4FA66285D"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail 2.5 From: Warner Losh In-Reply-To: Date: Fri, 31 Jul 2015 08:34:47 -0600 Cc: John-Mark Gurney , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <9F2F5DC0-660B-4831-BEE5-9E3A65A82122@bsdimp.com> References: <201507310328.t6V3S3LC087650@repo.freebsd.org> To: Ed Schouten X-Mailer: Apple Mail (2.2102) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 14:34:51 -0000 --Apple-Mail=_52065108-EBDB-4353-BFA0-CFE4FA66285D Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jul 31, 2015, at 3:24 AM, Ed Schouten wrote: >=20 > Hi John-Mark, >=20 > Maybe it would make more sense to just remove this manual page? >=20 > It looks like there are already some pieces of code in our source tree > that use _Static_assert(), which is good. Maybe it would be better to > to leave CTASSERT() undocumented, so that it becomes less likely that > new code uses this interface. sys/deffs.h defines it, if needed, so maybe that=E2=80=99s wise. Generally, foo(9) is relegated to the kernel. Only in cases where it can = be used in user land should it be mentioned, rather than the converse. = There=E2=80=99s maybe a dozen out of a hundred man pages that should get the note. We shouldn=E2=80=99t remove the man page. If the project decides to stop = using it, we should note it as deprecated instead of leaving it undocumented. Warner --Apple-Mail=_52065108-EBDB-4353-BFA0-CFE4FA66285D Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJVu4eHAAoJEGwc0Sh9sBEAWiEQALC2S04EEfzd6E2myNrpo8f6 /FSnZR3kujjsAI5zBzAvZdCJEwh3krnaotDGOpTqezeRtkbLg5E48bI1DD7x2Qw0 Aln/QH3qLLmLMlvuW7bwHD0MjOtJgteMDy2yXZdOImU4MKxkgZokaCdCkVzFYVTe lJ2+PjAlMiKQX/AC19DiaMlFjbbN6CSaRGESVtTzRJk8XOKI1Wc/RFWw3iKl6JCj OyqNn991s2s2e25/T2yzh1OTr1baepPhCT4mm1rFzXEpd3O11Nwll+se6dBV3RW4 vnfsejO3ytphg5/Q+1uC7aOlN00474XuP/tv2qehJhPmoGXQBQCGrqRVcqlsmiR/ SGR2PVgiGq8fRFeVOHscquHgogELItK/rC9todnYxRjQBbAY1LAtiWtCNKgth/DN WJspZj3yFvMcommv05HUQTGiIj/jCxdxbosrrJjhDRUhBAo8Dr0EoVUbHrIoj4qk iLFMvV9exgXp+GQ82S7BLq1g3D6BPWBLXC3B+pyELvO3hovCA58uGdwcIFLEn9WE Fr4WKsZh8FbVsxvrjAgjQW5VkBVuc+cM/One7Ab9LpNEr6bvyv8/9JTyVCgRzA9a sQY7IfDSaPeK2AWhpB7PKstud84Q7U1KqVEvjAL8PlB6Ohlp0Wep5hcXL6XojLmK Zdjs48Je1uOG5YtKnQw2 =oCNb -----END PGP SIGNATURE----- --Apple-Mail=_52065108-EBDB-4353-BFA0-CFE4FA66285D-- From owner-svn-src-all@freebsd.org Fri Jul 31 15:23:49 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A211C9AFF38; Fri, 31 Jul 2015 15:23:49 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9323F1385; Fri, 31 Jul 2015 15:23:49 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VFNnHX081452; Fri, 31 Jul 2015 15:23:49 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VFNnSF081449; Fri, 31 Jul 2015 15:23:49 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507311523.t6VFNnSF081449@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 31 Jul 2015 15:23:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286131 - in head/sys: amd64/conf i386/conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 15:23:49 -0000 Author: gjb Date: Fri Jul 31 15:23:48 2015 New Revision: 286131 URL: https://svnweb.freebsd.org/changeset/base/286131 Log: Pull pmspcv (pms(4)) from GENERIC. It has PCI ID conflicts with ahd(4), mvs(4), and likely other drivers. MFC after: immediately With hat: re Sponsored by: The FreeBSD Foundation Modified: head/sys/amd64/conf/GENERIC head/sys/i386/conf/GENERIC Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Fri Jul 31 14:17:26 2015 (r286130) +++ head/sys/amd64/conf/GENERIC Fri Jul 31 15:23:48 2015 (r286131) @@ -170,7 +170,8 @@ device ida # Compaq Smart RAID device mfi # LSI MegaRAID SAS device mlx # Mylex DAC960 family device mrsas # LSI/Avago MegaRAID SAS/SATA, 6Gb/s and 12Gb/s -device pmspcv # PMC-Sierra SAS/SATA Controller driver +#XXX PCI ID conflicts with ahd(4) and mvs(4) +#device pmspcv # PMC-Sierra SAS/SATA Controller driver #XXX pointer/int warnings #device pst # Promise Supertrak SX6000 device twe # 3ware ATA RAID Modified: head/sys/i386/conf/GENERIC ============================================================================== --- head/sys/i386/conf/GENERIC Fri Jul 31 14:17:26 2015 (r286130) +++ head/sys/i386/conf/GENERIC Fri Jul 31 15:23:48 2015 (r286131) @@ -175,7 +175,8 @@ device ida # Compaq Smart RAID device mfi # LSI MegaRAID SAS device mlx # Mylex DAC960 family device mrsas # LSI/Avago MegaRAID SAS/SATA, 6Gb/s and 12Gb/s -device pmspcv # PMC-Sierra SAS/SATA Controller driver +#XXX PCI ID conflicts with ahd(4) and mvs(4) +#device pmspcv # PMC-Sierra SAS/SATA Controller driver device pst # Promise Supertrak SX6000 device twe # 3ware ATA RAID From owner-svn-src-all@freebsd.org Fri Jul 31 15:25:08 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE7989AFF9A; Fri, 31 Jul 2015 15:25:08 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AF2241575; Fri, 31 Jul 2015 15:25:08 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VFP8Ef081585; Fri, 31 Jul 2015 15:25:08 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VFP8eO081581; Fri, 31 Jul 2015 15:25:08 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507311525.t6VFP8eO081581@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 31 Jul 2015 15:25:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286132 - in stable/10/sys: amd64/conf i386/conf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 15:25:08 -0000 Author: gjb Date: Fri Jul 31 15:25:07 2015 New Revision: 286132 URL: https://svnweb.freebsd.org/changeset/base/286132 Log: MFC r286131: Pull pmspcv (pms(4)) from GENERIC. It has PCI ID conflicts with ahd(4), mvs(4), and likely other drivers. With hat: re Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/amd64/conf/GENERIC stable/10/sys/i386/conf/GENERIC Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/conf/GENERIC ============================================================================== --- stable/10/sys/amd64/conf/GENERIC Fri Jul 31 15:23:48 2015 (r286131) +++ stable/10/sys/amd64/conf/GENERIC Fri Jul 31 15:25:07 2015 (r286132) @@ -160,7 +160,8 @@ device ida # Compaq Smart RAID device mfi # LSI MegaRAID SAS device mlx # Mylex DAC960 family device mrsas # LSI/Avago MegaRAID SAS/SATA, 6Gb/s and 12Gb/s -device pmspcv # PMC-Sierra SAS/SATA Controller driver +#XXX PCI ID conflicts with ahd(4) and mvs(4) +#device pmspcv # PMC-Sierra SAS/SATA Controller driver #XXX pointer/int warnings #device pst # Promise Supertrak SX6000 device twe # 3ware ATA RAID Modified: stable/10/sys/i386/conf/GENERIC ============================================================================== --- stable/10/sys/i386/conf/GENERIC Fri Jul 31 15:23:48 2015 (r286131) +++ stable/10/sys/i386/conf/GENERIC Fri Jul 31 15:25:07 2015 (r286132) @@ -166,7 +166,8 @@ device ida # Compaq Smart RAID device mfi # LSI MegaRAID SAS device mlx # Mylex DAC960 family device mrsas # LSI/Avago MegaRAID SAS/SATA, 6Gb/s and 12Gb/s -device pmspcv # PMC-Sierra SAS/SATA Controller driver +#XXX PCI ID conflicts with ahd(4) and mvs(4) +#device pmspcv # PMC-Sierra SAS/SATA Controller driver device pst # Promise Supertrak SX6000 device twe # 3ware ATA RAID From owner-svn-src-all@freebsd.org Fri Jul 31 15:32:33 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A00C69AF288; Fri, 31 Jul 2015 15:32:33 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 76F851FF5; Fri, 31 Jul 2015 15:32:33 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VFWXDm086099; Fri, 31 Jul 2015 15:32:33 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VFWWFt086097; Fri, 31 Jul 2015 15:32:32 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201507311532.t6VFWWFt086097@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 31 Jul 2015 15:32:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286133 - in head/sys: arm64/arm64 conf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 15:32:33 -0000 Author: andrew Date: Fri Jul 31 15:32:32 2015 New Revision: 286133 URL: https://svnweb.freebsd.org/changeset/base/286133 Log: Load the stack in stack_save and stack_save_td. This uses the generalised unwind_frame function to read each stack frame until either the pc or stack are no longer withing the kernel's address space. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/stack_machdep.c head/sys/conf/files.arm64 Modified: head/sys/arm64/arm64/stack_machdep.c ============================================================================== --- head/sys/arm64/arm64/stack_machdep.c Fri Jul 31 15:25:07 2015 (r286132) +++ head/sys/arm64/arm64/stack_machdep.c Fri Jul 31 15:32:32 2015 (r286133) @@ -40,21 +40,49 @@ __FBSDID("$FreeBSD$"); #include #include +static void +stack_capture(struct stack *st, struct unwind_state *frame) +{ + + stack_zero(st); + while (1) { + unwind_frame(frame); + if (!INKERNEL((vm_offset_t)frame->fp) || + !INKERNEL((vm_offset_t)frame->pc)) + break; + if (stack_put(st, frame->pc) == -1) + break; + } +} + void stack_save_td(struct stack *st, struct thread *td) { + struct unwind_state frame; if (TD_IS_SWAPPED(td)) panic("stack_save_td: swapped"); if (TD_IS_RUNNING(td)) panic("stack_save_td: running"); - stack_zero(st); /* ARM64TODO */ + frame.sp = td->td_pcb->pcb_sp; + frame.fp = td->td_pcb->pcb_x[29]; + frame.pc = td->td_pcb->pcb_x[30]; + + stack_capture(st, &frame); } void stack_save(struct stack *st) { + struct unwind_state frame; + uint64_t sp; + + __asm __volatile("mov %0, sp" : "=&r" (sp)); + + frame.sp = sp; + frame.fp = (uint64_t)__builtin_frame_address(0); + frame.pc = (uint64_t)stack_save; - stack_zero(st); /* ARM64TODO */ + stack_capture(st, &frame); } Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Fri Jul 31 15:25:07 2015 (r286132) +++ head/sys/conf/files.arm64 Fri Jul 31 15:32:32 2015 (r286133) @@ -40,14 +40,14 @@ arm64/arm64/mp_machdep.c optional smp arm64/arm64/nexus.c standard arm64/arm64/pic_if.m standard arm64/arm64/pmap.c standard -arm64/arm64/stack_machdep.c standard +arm64/arm64/stack_machdep.c optional ddb | stack arm64/arm64/support.S standard arm64/arm64/swtch.S standard arm64/arm64/sys_machdep.c standard arm64/arm64/trap.c standard arm64/arm64/uio_machdep.c standard arm64/arm64/uma_machdep.c standard -arm64/arm64/unwind.c optional ddb | kdtrace_hooks +arm64/arm64/unwind.c optional ddb | kdtrace_hooks | stack arm64/arm64/vfp.c standard arm64/arm64/vm_machdep.c standard crypto/blowfish/bf_enc.c optional crypto | ipsec From owner-svn-src-all@freebsd.org Fri Jul 31 15:33:51 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A01C9AF2C5 for ; Fri, 31 Jul 2015 15:33:51 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm45-vm8.bullet.mail.bf1.yahoo.com (nm45-vm8.bullet.mail.bf1.yahoo.com [216.109.115.79]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1965F1159 for ; Fri, 31 Jul 2015 15:33:51 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1438356829; bh=uHK1mYtbUgESNg9oiqaI6UGe3zfFaCIEmqh1nbAibVU=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=EE1t25icXtX9LdAjhX3gqzm7bcoLWU1uIJg0z+c+nBfKJyu1Wdzgqqvvb/xhmwla7pzTciw8OlVuoM46RDFY5QcHKgEddhfNwAontxDkMfOkn+XmgOfZbcRL1AK3jQzdKceeUPmCdS76xcENapXfI5XKdDDuT+JwDK1oRfGhbE0x+P/zKfnv+eZuxLCGD/Togfpy9aRPVlSu+7eqLOAcya74XRhBSR2PqqsKBBhsHihotunC6euC+hsO7D8ZKJnalSdlk1pDyea5egsPmpHw/Kn9Kb7WzYANHvOM7g7kyRgfnBpUcfLWNrWA3V220HzuK+/Q5Y6oDztt5zJJuQzh+w== Received: from [98.139.170.181] by nm45.bullet.mail.bf1.yahoo.com with NNFMP; 31 Jul 2015 15:33:49 -0000 Received: from [98.139.211.161] by tm24.bullet.mail.bf1.yahoo.com with NNFMP; 31 Jul 2015 15:33:49 -0000 Received: from [127.0.0.1] by smtp218.mail.bf1.yahoo.com with NNFMP; 31 Jul 2015 15:33:49 -0000 X-Yahoo-Newman-Id: 219648.65184.bm@smtp218.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: tHuFW8IVM1n_aF0aVXQKOs6rv9LKsF3IxIWz8RLMtRlKU8g STLVzVqmSuLBkoA2YGvtdoNSfVvFL_JtQrnFyW_GIizPtQ0R89ghjr52WO0h vizYuUbU6Jy5VQQr_20yUQ.db.n18m2adKE_G2dtPqrW0jTL_BL20BWxlvyK Z6NkuRspRaRTAxKgDOVy.YGNrrBFnucnNgMdDbfWaGPINi6rv2KkEmuxwUCB b8.7n1.7GwKjkcqI.Qovr6sLPEwnVuPnb40D2i.lb0_CWAoojNn4xdJ0.LL4 u4g79xRI6dHqubGhriXksEEdvRbwHmTcE1dW0E0m6eAK2E03jvotOTeyDb.Q G0u6EjtYzi8lehlV.IPmVojpZu0US1SRDi3EKJf4S9qrwp1ATu_ylleUIGNU LtrhKjgX6KoOtpuGBo1eBwTTrMFN_pnTJsHnPWvEW4mR6O4rINDa91a56Ex7 7DnjB8tZSHpTT0QpHDn5v6ulXiRGvVUua7JTmagnRx0bBdnSk7.QI693WN5K gKGI3f_LiP2X1pPabZjTsdnXv2YRVXGR8 X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r286070 - in head/contrib/elftoolchain: ar elfdump To: Ed Maste References: <201507301241.t6UCftU3024427@repo.freebsd.org> <55BA7189.5090004@FreeBSD.org> Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" From: Pedro Giffuni X-Enigmail-Draft-Status: N1110 Message-ID: <55BB9566.4060707@FreeBSD.org> Date: Fri, 31 Jul 2015 10:33:58 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 15:33:51 -0000 On 07/31/15 08:03, Ed Maste wrote: >>> Author: emaste >>> Date: Thu Jul 30 12:41:54 2015 >>> New Revision: 286070 >>> URL: https://svnweb.freebsd.org/changeset/base/286070 >>> >>> Log: >>> Add ELF Tool Chain's ar(1) and elfdump(1) to contrib >> >> Thank you! > > Np. Thanks for noting brandelf, I just copied it over as well. > > There's a little more work to be done still before these are fully > equivalent to the ones in FreeBSD, and I won't switch them until > they're ready. > Hmm ... FWIW, elftoolchain's brandelf was based on our brandelf, but modified to use libelf. I think brandelf may not be needed anymore though; it's main use was to add ELF branding notes to linux binaries for our linuxulator. There was a mess with the linux maintainers not wanting to use ELF branding notes but long story short, our linuxulator understands the now GNU branding scheme and linux is also using the standard ELF branding notes. Regards, Pedro. From owner-svn-src-all@freebsd.org Fri Jul 31 15:44:19 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 39CE59AF5D2; Fri, 31 Jul 2015 15:44:19 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io0-x22d.google.com (mail-io0-x22d.google.com [IPv6:2607:f8b0:4001:c06::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 061D11C25; Fri, 31 Jul 2015 15:44:19 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by iodd187 with SMTP id d187so89095273iod.2; Fri, 31 Jul 2015 08:44:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=a4rWm/A2ZFL8zgnXQcBBd7qJLeGyqER/XqxK3v6Xwg0=; b=KegL8Ho57AzREu6CkN6ePqMaA8SVcRmal5w8i00KaLtT7RDhuWYJ6Qo2V0mCbbiQKM rU1gGNpoQyZxMgw05kSPrZT6Ri0Z1/gm3Ir0NFVDbX09zJ1yEzW/YE7uINL1QSsq0Ok/ PqlYKowv6UxXR0JasG1NLOhWyIMGyFXwdLqei4MFlQnok/rsEypC0dnEzQ254BZ+NeWL AShQcNFbuRRtIJ1dD+Aoh5y+xSe0V71Kuycp2hZnrLXalcAEkdBzCmW+BrcvzO6pC/9s jj9NBU2ZO0K+tOgtUR3zlJKu0d5RDT4xHlRI27JDake94OcWIyEXjznW4Pi1lOQkTkzv OmeQ== X-Received: by 10.107.47.152 with SMTP id v24mr6139122iov.180.1438357458032; Fri, 31 Jul 2015 08:44:18 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.136.200 with HTTP; Fri, 31 Jul 2015 08:43:58 -0700 (PDT) In-Reply-To: <55BB9566.4060707@FreeBSD.org> References: <201507301241.t6UCftU3024427@repo.freebsd.org> <55BA7189.5090004@FreeBSD.org> <55BB9566.4060707@FreeBSD.org> From: Ed Maste Date: Fri, 31 Jul 2015 11:43:58 -0400 X-Google-Sender-Auth: egmABwzq23pjoszev7nII_ho7k4 Message-ID: Subject: Re: svn commit: r286070 - in head/contrib/elftoolchain: ar elfdump To: Pedro Giffuni Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 15:44:19 -0000 On 31 July 2015 at 11:33, Pedro Giffuni wrote: > > > FWIW, elftoolchain's brandelf was based on our brandelf, but modified > to use libelf. I think brandelf may not be needed anymore though; it's > main use was to add ELF branding notes to linux binaries for our > linuxulator. > > There was a mess with the linux maintainers not wanting to use ELF > branding notes but long story short, our linuxulator understands the now > GNU branding scheme and linux is also using the standard ELF branding notes. Yes, these three ELF Tool Chain tools (ar, elfdump, brandelf) all originated in FreeBSD, and I left them to the end of the ELF Tool Chain integration project as the in-tree versions work and have a few features not yet in ELF Tool Chain. In any case, I think it's probably because of the Linuxolator updates that brandelf slipped my mind. I prefer not having to modify binaries for normal Linuxolator use, and perhaps we can just deprecate brandelf. From owner-svn-src-all@freebsd.org Fri Jul 31 15:54:35 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 64AA09AF90B; Fri, 31 Jul 2015 15:54:35 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5618A11E2; Fri, 31 Jul 2015 15:54:35 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VFsZH0094816; Fri, 31 Jul 2015 15:54:35 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VFsZgi094815; Fri, 31 Jul 2015 15:54:35 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201507311554.t6VFsZgi094815@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 31 Jul 2015 15:54:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286134 - head/sys/arm64/arm64 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 15:54:35 -0000 Author: andrew Date: Fri Jul 31 15:54:34 2015 New Revision: 286134 URL: https://svnweb.freebsd.org/changeset/base/286134 Log: Try to put the CPU into a low power state if we failed to otherwise halt the system. Obtained from: ABT Systems Ltd Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/machdep.c Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Fri Jul 31 15:32:32 2015 (r286133) +++ head/sys/arm64/arm64/machdep.c Fri Jul 31 15:54:34 2015 (r286134) @@ -376,7 +376,11 @@ void cpu_halt(void) { - panic("ARM64TODO: cpu_halt"); + /* We should have shutdown by now, if not enter a low power sleep */ + intr_disable(); + while (1) { + __asm __volatile("wfi"); + } } /* From owner-svn-src-all@freebsd.org Fri Jul 31 16:13:11 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6BF459AFD20 for ; Fri, 31 Jul 2015 16:13:11 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm22-vm1.bullet.mail.bf1.yahoo.com (nm22-vm1.bullet.mail.bf1.yahoo.com [98.139.212.127]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F6321E11 for ; Fri, 31 Jul 2015 16:13:10 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1438359188; bh=4xGs2ie1W/GywnpFC0sWg5kGKcSqfhWd0A7LkCOBSoQ=; h=Subject:To:References:Cc:From:Date:In-Reply-To:From:Subject; b=IdWCN/t8A9pq054SitcvPkAGGspRyMBgDE/D9Dlm6+HYShOCivvMl7ShatqDcnK7DCygunf66lPHPl6/qhzFg1zp6WulHLBapKVt4aKiDbhpJ3F29bAjGvaxX03m9BQ6nnhtm1TDEg7iLbD/2fJH2kLYv1uhzS/b4gN0jJfOKti11m75pM+3k9IJMP0ABwK3wyu9hqt3AGMQ7zumpU+gQD8ruF6DtN+FKleNb+0xeodhByueLxxWlDzVDauRcJryHRMey9eKk/j2KM6J+n6u7gUiTbX9s4Bn81oy3XJ/iAu2nVHU94PN90wWn4KAA8moGMYWQk5b22gclC/BzdmhLw== Received: from [98.139.215.141] by nm22.bullet.mail.bf1.yahoo.com with NNFMP; 31 Jul 2015 16:13:08 -0000 Received: from [68.142.230.78] by tm12.bullet.mail.bf1.yahoo.com with NNFMP; 31 Jul 2015 16:13:08 -0000 Received: from [127.0.0.1] by smtp235.mail.bf1.yahoo.com with NNFMP; 31 Jul 2015 16:13:08 -0000 X-Yahoo-Newman-Id: 923326.9687.bm@smtp235.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: VsMciOAVM1lBUS.4lQ_1oiKYSg2QMQZ7vk7NIEj8iNCmdaW OBF446Ui.YFo0efOX0FSS.GYI1.P6ji2396P_vMiTqVJRxPMgkg1bnDWSHWo jY5CRNQ08t7EYURpmgt_NXHvE_rNrVWDaKSLbgVsMkX13JkIDqAQ8uQKI_Lo B2Py_lmPZpf40BdYf_GuRrnvto2oBcxnBz9MqvmGRXbGiWrXTGO58rbxrreC uyLtsCuFbB855FK86j_v1YtFT508me1KxW0X0l17Fu8IqX_Imr2Lcig1W4NZ 4E1ODlRUCex7BkK2P3AgrHN7UJRORx0I2WzP.BXO9xRvOtc2YUllkYv1t60S Kqoi4D7sLfvWrVhVXxFDnGVsvWtjWgL02ph3f18KtGNZ4KuPsxLgB9JO4EPY 5vTtvewF9Pb4DqSyDYWCSwyQtrzJqgkyQ9PSAA.wNaBOLxPhCPOdDSbhytW_ 0NcCZA9h1cMSRr3tRRrv3ge5Sa38UmgQx8gUQU3QOAspbuGIaJ34aMUjasRy CBRtYoalj40L0QGYxXh9OxUtyVmn3WK9. X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r286102 - head/usr.bin/wall To: Bruce Evans References: <201507310112.t6V1CWh8034232@repo.freebsd.org> <20150731162408.M1843@besplex.bde.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org From: Pedro Giffuni Message-ID: <55BB9E9C.9030608@FreeBSD.org> Date: Fri, 31 Jul 2015 11:13:16 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <20150731162408.M1843@besplex.bde.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 16:13:11 -0000 On 07/31/15 02:12, Bruce Evans wrote: > On Fri, 31 Jul 2015, Pedro F. Giffuni wrote: > ... > >> static char errbuf[1024]; > > Another static buffer. The function is obviously not reentrant. This > large static buffer mainly wastes space all the time instead of only > when the function is called. > But if I drop that static I get a bunch of errors: /usr/src/usr.bin/wall/ttymsg.c:82:11: error: address of stack memory associated with local variable 'errbuf' returned [-Werror,-Wreturn-stack-address] return (errbuf); ^~~~~~ /usr/src/usr.bin/wall/ttymsg.c:94:11: error: address of stack memory associated with local variable 'errbuf' returned [-Werror,-Wreturn-stack-address] return (errbuf); ^~~~~~ /usr/src/usr.bin/wall/ttymsg.c:134:13: error: address of stack memory associated with local variable 'errbuf' returned [-Werror,-Wreturn-stack-address] return (errbuf); ^~~~~~ /usr/src/usr.bin/wall/ttymsg.c:160:11: error: address of stack memory associated with local variable 'errbuf' returned [-Werror,-Wreturn-stack-address] return (errbuf); ^~~~~~ ... >> char *p; >> int forked; >> @@ -71,8 +71,8 @@ ttymsg(struct iovec *iov, int iovcnt, co >> if (iovcnt > (int)(sizeof(localiov) / sizeof(localiov[0]))) >> return ("too many iov's (change code in wall/ttymsg.c)"); >> >> + strlcat(device, line, sizeof(device)); > > This depends on the slow reinitialization on every entry. The combined > initialization (initializer + strlcat) is an obfuscated way of > concatenating 2 strings. The clearest way is snprintf with %s%s format. > I will do that, thanks. Pedro. From owner-svn-src-all@freebsd.org Fri Jul 31 16:31:11 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91C339AF5FF; Fri, 31 Jul 2015 16:31:11 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "gold.funkthat.com", Issuer "gold.funkthat.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 713B22FB4; Fri, 31 Jul 2015 16:31:11 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (localhost [127.0.0.1]) by gold.funkthat.com (8.14.5/8.14.5) with ESMTP id t6VGVAKW048924 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 31 Jul 2015 09:31:10 -0700 (PDT) (envelope-from jmg@gold.funkthat.com) Received: (from jmg@localhost) by gold.funkthat.com (8.14.5/8.14.5/Submit) id t6VGVAjv048923; Fri, 31 Jul 2015 09:31:10 -0700 (PDT) (envelope-from jmg) Date: Fri, 31 Jul 2015 09:31:10 -0700 From: John-Mark Gurney To: Ed Schouten Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r286103 - head/share/man/man9 Message-ID: <20150731163110.GZ78154@funkthat.com> References: <201507310328.t6V3S3LC087650@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 9.1-PRERELEASE amd64 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? User-Agent: Mutt/1.5.21 (2010-09-15) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (gold.funkthat.com [127.0.0.1]); Fri, 31 Jul 2015 09:31:10 -0700 (PDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 16:31:11 -0000 Ed Schouten wrote this message on Fri, Jul 31, 2015 at 11:24 +0200: > Maybe it would make more sense to just remove this manual page? > > It looks like there are already some pieces of code in our source tree > that use _Static_assert(), which is good. Maybe it would be better to > to leave CTASSERT() undocumented, so that it becomes less likely that > new code uses this interface. I plan on documenting _Static_assert, and once that is documented for both userland and kernel, then we can mark this deprecated... Do we support linking man pages between man3/man9? or should it just be in a comment? and in one section? -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-all@freebsd.org Fri Jul 31 16:35:29 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DDBBF9AF7F3; Fri, 31 Jul 2015 16:35:29 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "gold.funkthat.com", Issuer "gold.funkthat.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id A28E3136F; Fri, 31 Jul 2015 16:35:28 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (localhost [127.0.0.1]) by gold.funkthat.com (8.14.5/8.14.5) with ESMTP id t6VGZSFK049006 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 31 Jul 2015 09:35:28 -0700 (PDT) (envelope-from jmg@gold.funkthat.com) Received: (from jmg@localhost) by gold.funkthat.com (8.14.5/8.14.5/Submit) id t6VGZRZa049005; Fri, 31 Jul 2015 09:35:27 -0700 (PDT) (envelope-from jmg) Date: Fri, 31 Jul 2015 09:35:27 -0700 From: John-Mark Gurney To: NGie Cooper Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r286100 - in head/sys: net netipsec Message-ID: <20150731163526.GB78154@funkthat.com> References: <201507310023.t6V0NLVT013789@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: FreeBSD 9.1-PRERELEASE amd64 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? User-Agent: Mutt/1.5.21 (2010-09-15) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (gold.funkthat.com [127.0.0.1]); Fri, 31 Jul 2015 09:35:28 -0700 (PDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 16:35:30 -0000 NGie Cooper wrote this message on Thu, Jul 30, 2015 at 17:41 -0700: > On Thu, Jul 30, 2015 at 5:23 PM, John-Mark Gurney wrote: > > Author: jmg > > Date: Fri Jul 31 00:23:21 2015 > > New Revision: 286100 > > URL: https://svnweb.freebsd.org/changeset/base/286100 > > > > Log: > > Clean up this header file... > > > > use CTASSERTs now that we have them... > > > > Replace a draft w/ RFC that's over 10 years old. > > > > Note that _AALG and _EALG do not need to match what the IKE daemons > > think they should be.. This is part of the KABI... I decided to > > renumber AESCTR, but since we've never had working AESCTR mode, I'm > > not really breaking anything.. and it shortens a loop by quite > > a bit.. > > > > remove SKIPJACK IPsec support... SKIPJACK never made it out of draft > > (in 1999), only has 80bit key, NIST recommended it stop being used > > after 2010, and setkey nor any of the IKE daemons I checked supported > > it... > > > > jmgurney/ipsecgcm: a357a33, c75808b, e008669, b27b6d6 > > > > Reviewed by: gnn (earlier version) > > Relnotes: yes (removing SKIPJACK IPsec support + ?) Yeh, I forgot and have already forwarded it to re@... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-all@freebsd.org Fri Jul 31 16:37:08 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F5C39AF89A for ; Fri, 31 Jul 2015 16:37:08 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mail-ig0-f171.google.com (mail-ig0-f171.google.com [209.85.213.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2D053165A for ; Fri, 31 Jul 2015 16:37:07 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: by igbij6 with SMTP id ij6so19837337igb.1 for ; Fri, 31 Jul 2015 09:37:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:message-id:references:to; bh=tPROH9YUjf9Z6/48m+Y9hoQX4Cusk3XogY9U1N6onBo=; b=fm3d3dJyJC96gOd6mpsY05CUt/tQoOn3HpzvbztrKig0Tb15LfnmEnroie6pnprci2 7eGyRyq4S9Z7uwlzxasvBn5kXQh9t0DuSmDkTg+YAO85LaayedwUMv+b5sGuSBxXpxXw JlNZmCzXUhjP1jTbHz14H0nenlZyVBHscUm1oGtj5302NuwlXDf+0ADGkgAtJEbRFh7T kHPW5GsjvHbtdABgpq9L1a9GQ7sTojxaPm/JGtHge25ttJWcCAn1KqLaFwehHSu59ERv uYMh25+9AHndBOuF8tgsldpNRalcLtHvoT5VKmqmSxOxlMdlxg+zx4PhzyruYfGuNwcF jZbg== X-Gm-Message-State: ALoCoQkDAzPT2jOUPFe5FZjxK7dP8YBka/hu/+GSyaNGgGbNFjBOEuFuE1p5O4jxDJC8GUwlRkfe X-Received: by 10.50.1.43 with SMTP id 11mr7727391igj.76.1438360627052; Fri, 31 Jul 2015 09:37:07 -0700 (PDT) Received: from netflix-mac-wired.bsdimp.com ([50.253.99.174]) by smtp.gmail.com with ESMTPSA id y6sm2590806igl.17.2015.07.31.09.37.06 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 31 Jul 2015 09:37:06 -0700 (PDT) Sender: Warner Losh Subject: Re: svn commit: r286103 - head/share/man/man9 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2102\)) Content-Type: multipart/signed; boundary="Apple-Mail=_38637613-EC09-4AC1-B5E6-AA4C269199B7"; protocol="application/pgp-signature"; micalg=pgp-sha512 X-Pgp-Agent: GPGMail 2.5 From: Warner Losh In-Reply-To: <20150731163110.GZ78154@funkthat.com> Date: Fri, 31 Jul 2015 10:37:03 -0600 Cc: Ed Schouten , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-Id: <9E180F45-B3B1-46C0-B02A-FFC3EB667A82@bsdimp.com> References: <201507310328.t6V3S3LC087650@repo.freebsd.org> <20150731163110.GZ78154@funkthat.com> To: John-Mark Gurney X-Mailer: Apple Mail (2.2102) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 16:37:08 -0000 --Apple-Mail=_38637613-EC09-4AC1-B5E6-AA4C269199B7 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jul 31, 2015, at 10:31 AM, John-Mark Gurney = wrote: >=20 > Ed Schouten wrote this message on Fri, Jul 31, 2015 at 11:24 +0200: >> Maybe it would make more sense to just remove this manual page? >>=20 >> It looks like there are already some pieces of code in our source = tree >> that use _Static_assert(), which is good. Maybe it would be better to >> to leave CTASSERT() undocumented, so that it becomes less likely that >> new code uses this interface. >=20 > I plan on documenting _Static_assert, and once that is documented > for both userland and kernel, then we can mark this deprecated=E2=80=A6 We generally don=E2=80=99t document built-in language features. Just add = a note to the CTASSERT man page that says use it instead. > Do we support linking man pages between man3/man9? or should it just > be in a comment? and in one section? Put them in section 9 with a note saying they work for user land. = There=E2=80=99s maybe a dozen that apply to both. We=E2=80=99ve historically not tried to = share them. Warner --Apple-Mail=_38637613-EC09-4AC1-B5E6-AA4C269199B7 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP using GPGMail -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJVu6QwAAoJEGwc0Sh9sBEAupQP/2i1zIFNkHxkO4ALlJoja0wA 41C6XsQaFKUWhipknStMCvxYE18cjd/BsJAPtnnfCA7FUpqzHIHycyBnc5eIRF92 vfnstgXLBeaox2pZROeVHlj1OlpjeO8UumtGWV4HUB3IT466J5raoUJ5qvqxFCVq kYA8ZUaweypx6bz+wc+X04PEbU1sTfklKwxtOhWADVoA+VuH20aKA9Y4Arhs+VMw s6U05ceFHqMsVnbkYIxHQziY3/h39udQIR+bLd7tTWCi9/BxKB+uEpxjbXUqsqPs 465SDD7lQMCT7ylHBOSTkBYd6N8SRTVogqIVUBIdqG2M4giHjm0w2mThM1nXhfUb R9M/JVXLotCPCKimehqcNv/UzukbkyMpwbeigTVFpr3g7P6/CilJX/i8JmLRDA4I LVIxvw3/lNd6Zgvb2bs6C6VYBTu/RqKUSsF9wH50lErksgSpx79/T4+QCNPPx8qL zj6mGbOvF7D4yFtGy/Ju3w17BP7h5rNwSN0ZhyVC3IEqWsF53IuWNuvEyIQANJ40 KlKgyVJKuvdsbIgk/2yycNjQsxkQvRy0p2Ul7CwgwtMx+avtQD47uNsMqzdU0lP4 goXtqL3ZDUboabw8zhrLj/G3T2p8qRvqP043Dl8YE9gLjE5Bpq46FNMD8QFv5pYR eZb1bfZntrVqradCVoKE =9O7V -----END PGP SIGNATURE----- --Apple-Mail=_38637613-EC09-4AC1-B5E6-AA4C269199B7-- From owner-svn-src-all@freebsd.org Fri Jul 31 16:44:59 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0BB469AFC60; Fri, 31 Jul 2015 16:44:59 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F11BF1D4E; Fri, 31 Jul 2015 16:44:58 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VGiw6a018492; Fri, 31 Jul 2015 16:44:58 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VGiwau018490; Fri, 31 Jul 2015 16:44:58 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507311644.t6VGiwau018490@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 31 Jul 2015 16:44:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r286135 - in releng/10.2/sys: amd64/conf i386/conf X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 16:44:59 -0000 Author: gjb Date: Fri Jul 31 16:44:57 2015 New Revision: 286135 URL: https://svnweb.freebsd.org/changeset/base/286135 Log: MFS r286132: MFC r286131: Pull pmspcv (pms(4)) from GENERIC. It has PCI ID conflicts with ahd(4), mvs(4), and likely other drivers. Approved by: re (implicit, release blocker) Sponsored by: The FreeBSD Foundation Modified: releng/10.2/sys/amd64/conf/GENERIC releng/10.2/sys/i386/conf/GENERIC Directory Properties: releng/10.2/ (props changed) Modified: releng/10.2/sys/amd64/conf/GENERIC ============================================================================== --- releng/10.2/sys/amd64/conf/GENERIC Fri Jul 31 15:54:34 2015 (r286134) +++ releng/10.2/sys/amd64/conf/GENERIC Fri Jul 31 16:44:57 2015 (r286135) @@ -160,7 +160,8 @@ device ida # Compaq Smart RAID device mfi # LSI MegaRAID SAS device mlx # Mylex DAC960 family device mrsas # LSI/Avago MegaRAID SAS/SATA, 6Gb/s and 12Gb/s -device pmspcv # PMC-Sierra SAS/SATA Controller driver +#XXX PCI ID conflicts with ahd(4) and mvs(4) +#device pmspcv # PMC-Sierra SAS/SATA Controller driver #XXX pointer/int warnings #device pst # Promise Supertrak SX6000 device twe # 3ware ATA RAID Modified: releng/10.2/sys/i386/conf/GENERIC ============================================================================== --- releng/10.2/sys/i386/conf/GENERIC Fri Jul 31 15:54:34 2015 (r286134) +++ releng/10.2/sys/i386/conf/GENERIC Fri Jul 31 16:44:57 2015 (r286135) @@ -166,7 +166,8 @@ device ida # Compaq Smart RAID device mfi # LSI MegaRAID SAS device mlx # Mylex DAC960 family device mrsas # LSI/Avago MegaRAID SAS/SATA, 6Gb/s and 12Gb/s -device pmspcv # PMC-Sierra SAS/SATA Controller driver +#XXX PCI ID conflicts with ahd(4) and mvs(4) +#device pmspcv # PMC-Sierra SAS/SATA Controller driver device pst # Promise Supertrak SX6000 device twe # 3ware ATA RAID From owner-svn-src-all@freebsd.org Fri Jul 31 16:45:43 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2EF299AFCCE; Fri, 31 Jul 2015 16:45:43 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2052B1E99; Fri, 31 Jul 2015 16:45:43 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VGjgoP018582; Fri, 31 Jul 2015 16:45:42 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VGjgHM018581; Fri, 31 Jul 2015 16:45:42 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201507311645.t6VGjgHM018581@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 31 Jul 2015 16:45:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286136 - head/usr.bin/brandelf X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 16:45:43 -0000 Author: emaste Date: Fri Jul 31 16:45:42 2015 New Revision: 286136 URL: https://svnweb.freebsd.org/changeset/base/286136 Log: Use standard 'THE AUTHOR' license text Approved by: jmg Modified: head/usr.bin/brandelf/brandelf.1 Modified: head/usr.bin/brandelf/brandelf.1 ============================================================================== --- head/usr.bin/brandelf/brandelf.1 Fri Jul 31 16:44:57 2015 (r286135) +++ head/usr.bin/brandelf/brandelf.1 Fri Jul 31 16:45:42 2015 (r286136) @@ -9,7 +9,7 @@ .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" -.\" THIS SOFTWARE IS PROVIDED BY John-Mark Gurney AND CONTRIBUTORS ``AS IS'' +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' .\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE From owner-svn-src-all@freebsd.org Fri Jul 31 16:46:31 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4C899AFD16; Fri, 31 Jul 2015 16:46:31 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8CC24100C; Fri, 31 Jul 2015 16:46:31 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VGkVVJ018727; Fri, 31 Jul 2015 16:46:31 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VGkVvF018726; Fri, 31 Jul 2015 16:46:31 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201507311646.t6VGkVvF018726@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 31 Jul 2015 16:46:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r286137 - releng/10.2/sys/conf X-SVN-Group: releng MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 16:46:31 -0000 Author: gjb Date: Fri Jul 31 16:46:30 2015 New Revision: 286137 URL: https://svnweb.freebsd.org/changeset/base/286137 Log: Forced commit to mark the real 10.2-RC2 point. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: releng/10.2/sys/conf/newvers.sh Modified: releng/10.2/sys/conf/newvers.sh ============================================================================== From owner-svn-src-all@freebsd.org Fri Jul 31 17:41:54 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A76019B0592; Fri, 31 Jul 2015 17:41:54 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 98E511D0D; Fri, 31 Jul 2015 17:41:54 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VHfspf043699; Fri, 31 Jul 2015 17:41:54 GMT (envelope-from gnn@FreeBSD.org) Received: (from gnn@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VHfsfk043698; Fri, 31 Jul 2015 17:41:54 GMT (envelope-from gnn@FreeBSD.org) Message-Id: <201507311741.t6VHfsfk043698@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gnn set sender to gnn@FreeBSD.org using -f From: "George V. Neville-Neil" Date: Fri, 31 Jul 2015 17:41:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286138 - head/sbin/setkey X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 17:41:54 -0000 Author: gnn Date: Fri Jul 31 17:41:53 2015 New Revision: 286138 URL: https://svnweb.freebsd.org/changeset/base/286138 Log: Summary: Remove unsupported 3des-deriv encryption algorithm from documentation. Modified: head/sbin/setkey/setkey.8 Modified: head/sbin/setkey/setkey.8 ============================================================================== --- head/sbin/setkey/setkey.8 Fri Jul 31 16:46:30 2015 (r286137) +++ head/sbin/setkey/setkey.8 Fri Jul 31 17:41:53 2015 (r286138) @@ -624,7 +624,6 @@ null 0 to 2048 rfc2410 blowfish-cbc 40 to 448 rfc2451 cast128-cbc 40 to 128 rfc2451 des-deriv 64 ipsec-ciph-des-derived-01 -3des-deriv 192 no document rijndael-cbc 128/192/256 rfc3602 aes-ctr 160/224/288 draft-ietf-ipsec-ciph-aes-ctr-03 aes-gcm-16 160/224/288 rfc4106 From owner-svn-src-all@freebsd.org Fri Jul 31 18:22:16 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99FB69B0C60; Fri, 31 Jul 2015 18:22:16 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "gold.funkthat.com", Issuer "gold.funkthat.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 6302A15B4; Fri, 31 Jul 2015 18:22:16 +0000 (UTC) (envelope-from jmg@gold.funkthat.com) Received: from gold.funkthat.com (localhost [127.0.0.1]) by gold.funkthat.com (8.14.5/8.14.5) with ESMTP id t6VIME9a050251 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 31 Jul 2015 11:22:14 -0700 (PDT) (envelope-from jmg@gold.funkthat.com) Received: (from jmg@localhost) by gold.funkthat.com (8.14.5/8.14.5/Submit) id t6VIMEmU050250; Fri, 31 Jul 2015 11:22:14 -0700 (PDT) (envelope-from jmg) Date: Fri, 31 Jul 2015 11:22:14 -0700 From: John-Mark Gurney To: Warner Losh Cc: Ed Schouten , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r286103 - head/share/man/man9 Message-ID: <20150731182214.GD78154@funkthat.com> References: <201507310328.t6V3S3LC087650@repo.freebsd.org> <20150731163110.GZ78154@funkthat.com> <9E180F45-B3B1-46C0-B02A-FFC3EB667A82@bsdimp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9E180F45-B3B1-46C0-B02A-FFC3EB667A82@bsdimp.com> X-Operating-System: FreeBSD 9.1-PRERELEASE amd64 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-TipJar: bitcoin:13Qmb6AeTgQecazTWph4XasEsP7nGRbAPE X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? User-Agent: Mutt/1.5.21 (2010-09-15) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (gold.funkthat.com [127.0.0.1]); Fri, 31 Jul 2015 11:22:14 -0700 (PDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 18:22:16 -0000 Warner Losh wrote this message on Fri, Jul 31, 2015 at 10:37 -0600: > > > On Jul 31, 2015, at 10:31 AM, John-Mark Gurney wrote: > > > > Ed Schouten wrote this message on Fri, Jul 31, 2015 at 11:24 +0200: > >> Maybe it would make more sense to just remove this manual page? > >> > >> It looks like there are already some pieces of code in our source tree > >> that use _Static_assert(), which is good. Maybe it would be better to > >> to leave CTASSERT() undocumented, so that it becomes less likely that > >> new code uses this interface. > > > > I plan on documenting _Static_assert, and once that is documented > > for both userland and kernel, then we can mark this deprecated??? > > We generally don???t document built-in language features. Just add a note > to the CTASSERT man page that says use it instead. Ok, will do... This adds another question, since _Static_assert is a C11 feature, we should probably document that we provide compatibility for non-C11 compilers for this via sys/cdefs.h, correct? Though then for gcc and other pre-C11, _Static_assert isn't a built-in language feature.. Should we simplify the cdefs.h ifdef crazyness by assuming that anyone w/ __STDC_VERSION__ == 201112 has it? > > Do we support linking man pages between man3/man9? or should it just > > be in a comment? and in one section? > > Put them in section 9 with a note saying they work for user land. There???s maybe > a dozen that apply to both. We???ve historically not tried to share them. Thanks. -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not." From owner-svn-src-all@freebsd.org Fri Jul 31 19:33:22 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40FA59AF837; Fri, 31 Jul 2015 19:33:22 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: from mail-wi0-x22b.google.com (mail-wi0-x22b.google.com [IPv6:2a00:1450:400c:c05::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CCF4F11A9; Fri, 31 Jul 2015 19:33:21 +0000 (UTC) (envelope-from bjkfbsd@gmail.com) Received: by wibud3 with SMTP id ud3so44111316wib.0; Fri, 31 Jul 2015 12:33:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=h1lO8wfUZ28urEAPgavBdZ8jZczFg15rDz4HX17ZnbM=; b=u6HBYWaE5iVikLM8o/Kmhh9+7f2g9WlHzdJGtxEK8mQOIjcxVDO1cKWPW7wVlX3kqs TZ6b1JeVmVPwKaW+GV31J+VPgChSDORRww33QOt+n5iojHILIGeO2yH0OVQwMtiD0v+g x3ycgOzBaZ5teMIHCrtVAcMe1CvWsLPafOPy2icJNpLGoPWrpO0mBAK+j8vIJi3ZKGLd u+jjci7DAztShsqom/KKr78a40H0SeBzgBN+42HMf2nM638H+3I7A7HzOqYik7vT6Bng JCHam+rL3SRtEXLelax3aovLXmTJhmEYgymNjrwvlioaxV2psY2E34A3BcG+S5540jYq g1ZQ== MIME-Version: 1.0 X-Received: by 10.180.84.194 with SMTP id b2mr9751791wiz.24.1438371200250; Fri, 31 Jul 2015 12:33:20 -0700 (PDT) Received: by 10.27.96.132 with HTTP; Fri, 31 Jul 2015 12:33:20 -0700 (PDT) In-Reply-To: <9E180F45-B3B1-46C0-B02A-FFC3EB667A82@bsdimp.com> References: <201507310328.t6V3S3LC087650@repo.freebsd.org> <20150731163110.GZ78154@funkthat.com> <9E180F45-B3B1-46C0-B02A-FFC3EB667A82@bsdimp.com> Date: Fri, 31 Jul 2015 15:33:20 -0400 Message-ID: Subject: Re: svn commit: r286103 - head/share/man/man9 From: Benjamin Kaduk To: Warner Losh Cc: John-Mark Gurney , "svn-src-head@freebsd.org" , "svn-src-all@freebsd.org" , src-committers , Ed Schouten Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 19:33:22 -0000 On Fri, Jul 31, 2015 at 12:37 PM, Warner Losh wrote: > > > On Jul 31, 2015, at 10:31 AM, John-Mark Gurney wrote= : > > > > Do we support linking man pages between man3/man9? or should it just > > be in a comment? and in one section? > > Put them in section 9 with a note saying they work for user land. There= =E2=80=99s > maybe > a dozen that apply to both. We=E2=80=99ve historically not tried to share= them. > I want to say that I've seen a section 3 man page that just says "these APIs act like their kernel counterparts; see foo(9)" .... or maybe the other way around. But I can't look right now. -Ben From owner-svn-src-all@freebsd.org Fri Jul 31 20:02:14 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E2B19AFF90; Fri, 31 Jul 2015 20:02:14 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F10601B0D; Fri, 31 Jul 2015 20:02:13 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VK2Du1002635; Fri, 31 Jul 2015 20:02:13 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VK2Dc3002634; Fri, 31 Jul 2015 20:02:13 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201507312002.t6VK2Dc3002634@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Fri, 31 Jul 2015 20:02:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286139 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 20:02:14 -0000 Author: loos Date: Fri Jul 31 20:02:12 2015 New Revision: 286139 URL: https://svnweb.freebsd.org/changeset/base/286139 Log: Do not allocate the buffers at opening of the descriptor, because once the buffer is allocated we are committed to a particular buffer method (BPF_BUFMODE_BUFFER in this case). If we are using zero-copy buffers, the userland program must register its buffers before set the interface. If we are using kernel memory buffers, we can allocate the buffer at the time that the interface is being set. This fix allows the usage of BIOCSETBUFMODE after r235746. Update the comments to reflect the recent changes. MFC after: 2 weeks Sponsored by: Rubicon Communications (Netgate) Modified: head/sys/net/bpf.c Modified: head/sys/net/bpf.c ============================================================================== --- head/sys/net/bpf.c Fri Jul 31 17:41:53 2015 (r286138) +++ head/sys/net/bpf.c Fri Jul 31 20:02:12 2015 (r286139) @@ -862,7 +862,7 @@ static int bpfopen(struct cdev *dev, int flags, int fmt, struct thread *td) { struct bpf_d *d; - int error, size; + int error; d = malloc(sizeof(*d), M_BPF, M_WAITOK | M_ZERO); error = devfs_set_cdevpriv(d, bpf_dtor); @@ -892,10 +892,6 @@ bpfopen(struct cdev *dev, int flags, int callout_init_mtx(&d->bd_callout, &d->bd_lock, 0); knlist_init_mtx(&d->bd_sel.si_note, &d->bd_lock); - /* Allocate default buffers */ - size = d->bd_bufsize; - bpf_buffer_ioctl_sblen(d, &size); - return (0); } @@ -1472,10 +1468,33 @@ bpfioctl(struct cdev *dev, u_long cmd, c * Set interface. */ case BIOCSETIF: - BPF_LOCK(); - error = bpf_setif(d, (struct ifreq *)addr); - BPF_UNLOCK(); - break; + { + int alloc_buf, size; + + /* + * Behavior here depends on the buffering model. If + * we're using kernel memory buffers, then we can + * allocate them here. If we're using zero-copy, + * then the user process must have registered buffers + * by the time we get here. + */ + alloc_buf = 0; + BPFD_LOCK(d); + if (d->bd_bufmode == BPF_BUFMODE_BUFFER && + d->bd_sbuf == NULL) + alloc_buf = 1; + BPFD_UNLOCK(d); + if (alloc_buf) { + size = d->bd_bufsize; + error = bpf_buffer_ioctl_sblen(d, &size); + if (error != 0) + break; + } + BPF_LOCK(); + error = bpf_setif(d, (struct ifreq *)addr); + BPF_UNLOCK(); + break; + } /* * Set read timeout. @@ -1912,10 +1931,8 @@ bpf_setif(struct bpf_d *d, struct ifreq BPFIF_RUNLOCK(bp); /* - * Behavior here depends on the buffering model. If we're using - * kernel memory buffers, then we can allocate them here. If we're - * using zero-copy, then the user process must have registered - * buffers by the time we get here. If not, return an error. + * At this point, we expect the buffer is already allocated. If not, + * return an error. */ switch (d->bd_bufmode) { case BPF_BUFMODE_BUFFER: From owner-svn-src-all@freebsd.org Fri Jul 31 20:25:56 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0CB269B0254; Fri, 31 Jul 2015 20:25:56 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F1114145A; Fri, 31 Jul 2015 20:25:55 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VKPtJf010903; Fri, 31 Jul 2015 20:25:55 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VKPt8w010902; Fri, 31 Jul 2015 20:25:55 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201507312025.t6VKPt8w010902@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Fri, 31 Jul 2015 20:25:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286140 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 20:25:56 -0000 Author: loos Date: Fri Jul 31 20:25:54 2015 New Revision: 286140 URL: https://svnweb.freebsd.org/changeset/base/286140 Log: Remove the sleep from the buffer allocation routine. The buffer must be allocated (or even changed) before the interface is set and thus, there is no need to verify if the buffer is in use. MFC after: 2 weeks Sponsored by: Rubicon Communications (Netgate) Modified: head/sys/net/bpf_buffer.c Modified: head/sys/net/bpf_buffer.c ============================================================================== --- head/sys/net/bpf_buffer.c Fri Jul 31 20:02:12 2015 (r286139) +++ head/sys/net/bpf_buffer.c Fri Jul 31 20:25:54 2015 (r286140) @@ -79,8 +79,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define PRINET 26 /* interruptible */ - /* * Implement historical kernel memory buffering model for BPF: two malloc(9) * kernel buffers are hung off of the descriptor. The size is fixed prior to @@ -191,9 +189,6 @@ bpf_buffer_ioctl_sblen(struct bpf_d *d, return (EINVAL); } - while (d->bd_hbuf_in_use) - mtx_sleep(&d->bd_hbuf_in_use, &d->bd_lock, - PRINET, "bd_hbuf", 0); /* Free old buffers if set */ if (d->bd_fbuf != NULL) free(d->bd_fbuf, M_BPF); From owner-svn-src-all@freebsd.org Fri Jul 31 21:31:59 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1CF29B0DD8; Fri, 31 Jul 2015 21:31:59 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0E4D153; Fri, 31 Jul 2015 21:31:59 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VLVxXm042359; Fri, 31 Jul 2015 21:31:59 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VLVxeD042358; Fri, 31 Jul 2015 21:31:59 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201507312131.t6VLVxeD042358@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 31 Jul 2015 21:31:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286141 - stable/10/sys/fs/nfsclient X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 21:31:59 -0000 Author: rmacklem Date: Fri Jul 31 21:31:58 2015 New Revision: 286141 URL: https://svnweb.freebsd.org/changeset/base/286141 Log: MFC: r285113 If a "principal" argument isn't provided for a Kerberized NFS mount, the kernel would generate a bogus one with a ":/" suffix. This would only occur for the case where there was no explicit "principal" argument and the getaddrinfo() call in mount_nfs.c failed to a return a cannonical name for the server. This patch fixes this unusual case. Modified: stable/10/sys/fs/nfsclient/nfs_clvfsops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clvfsops.c Fri Jul 31 20:25:54 2015 (r286140) +++ stable/10/sys/fs/nfsclient/nfs_clvfsops.c Fri Jul 31 21:31:58 2015 (r286141) @@ -774,7 +774,7 @@ nfs_mount(struct mount *mp) struct thread *td; char hst[MNAMELEN]; u_char nfh[NFSX_FHMAX], krbname[100], dirpath[100], srvkrbname[100]; - char *opt, *name, *secname; + char *cp, *opt, *name, *secname; int nametimeo = NFS_DEFAULT_NAMETIMEO; int negnametimeo = NFS_DEFAULT_NEGNAMETIMEO; int minvers = 0; @@ -1153,8 +1153,12 @@ nfs_mount(struct mount *mp) if (vfs_getopt(mp->mnt_optnew, "principal", (void **)&name, NULL) == 0) strlcpy(srvkrbname, name, sizeof (srvkrbname)); - else + else { snprintf(srvkrbname, sizeof (srvkrbname), "nfs@%s", hst); + cp = strchr(srvkrbname, ':'); + if (cp != NULL) + *cp = '\0'; + } srvkrbnamelen = strlen(srvkrbname); if (vfs_getopt(mp->mnt_optnew, "gssname", (void **)&name, NULL) == 0) From owner-svn-src-all@freebsd.org Fri Jul 31 21:43:29 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0DFB89B0FB1; Fri, 31 Jul 2015 21:43:29 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E38B79F4; Fri, 31 Jul 2015 21:43:28 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VLhSSG046799; Fri, 31 Jul 2015 21:43:28 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VLhSBm046797; Fri, 31 Jul 2015 21:43:28 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201507312143.t6VLhSBm046797@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Fri, 31 Jul 2015 21:43:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286142 - head/sys/net X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 21:43:29 -0000 Author: loos Date: Fri Jul 31 21:43:27 2015 New Revision: 286142 URL: https://svnweb.freebsd.org/changeset/base/286142 Log: Remove two unnecessary sleeps from the hot path in bpf(4). The first one never triggers because bpf_canfreebuf() can only be true for zero-copy buffers and zero-copy buffers are not read with read(2). The second also never triggers, because we check the free buffer before calling ROTATE_BUFFERS(). If the hold buffer is in use the free buffer will be NULL and there is nothing else to do besides drop the packet. If the free buffer isn't NULL the hold buffer _is_ free and it is safe to rotate the buffers. Update the comment in ROTATE_BUFFERS macro to match the logic described here. While here fix a few typos in comments. MFC after: 2 weeks Sponsored by: Rubicon Communications (Netgate) Modified: head/sys/net/bpf.c head/sys/net/bpf.h Modified: head/sys/net/bpf.c ============================================================================== --- head/sys/net/bpf.c Fri Jul 31 21:31:58 2015 (r286141) +++ head/sys/net/bpf.c Fri Jul 31 21:43:27 2015 (r286142) @@ -620,7 +620,7 @@ bpf_attachd(struct bpf_d *d, struct bpf_ bpf_detachd_locked(d); /* * Point d at bp, and add d to the interface's list. - * Since there are many applicaiotns using BPF for + * Since there are many applications using BPF for * sending raw packets only (dhcpd, cdpd are good examples) * we can delay adding d to the list of active listeners until * some filter is configured. @@ -718,7 +718,7 @@ bpf_check_upgrade(u_long cmd, struct bpf /* * Add d to the list of active bp filters. - * Reuqires bpf_attachd() to be called before + * Requires bpf_attachd() to be called before. */ static void bpf_upgraded(struct bpf_d *d) @@ -2370,9 +2370,6 @@ catchpacket(struct bpf_d *d, u_char *pkt * spot to do it. */ if (d->bd_fbuf == NULL && bpf_canfreebuf(d)) { - while (d->bd_hbuf_in_use) - mtx_sleep(&d->bd_hbuf_in_use, &d->bd_lock, - PRINET, "bd_hbuf", 0); d->bd_fbuf = d->bd_hbuf; d->bd_hbuf = NULL; d->bd_hlen = 0; @@ -2415,9 +2412,6 @@ catchpacket(struct bpf_d *d, u_char *pkt ++d->bd_dcount; return; } - while (d->bd_hbuf_in_use) - mtx_sleep(&d->bd_hbuf_in_use, &d->bd_lock, - PRINET, "bd_hbuf", 0); ROTATE_BUFFERS(d); do_wakeup = 1; curlen = 0; Modified: head/sys/net/bpf.h ============================================================================== --- head/sys/net/bpf.h Fri Jul 31 21:31:58 2015 (r286141) +++ head/sys/net/bpf.h Fri Jul 31 21:43:27 2015 (r286142) @@ -1436,9 +1436,9 @@ SYSCTL_DECL(_net_bpf); /* * Rotate the packet buffers in descriptor d. Move the store buffer into the - * hold slot, and the free buffer ino the store slot. Zero the length of the - * new store buffer. Descriptor lock should be held. Hold buffer must - * not be marked "in use". + * hold slot, and the free buffer into the store slot. Zero the length of the + * new store buffer. Descriptor lock should be held. One must be careful to + * not rotate the buffers twice, i.e. if fbuf != NULL. */ #define ROTATE_BUFFERS(d) do { \ (d)->bd_hbuf = (d)->bd_sbuf; \ From owner-svn-src-all@freebsd.org Fri Jul 31 23:40:20 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 091A69B03D7; Fri, 31 Jul 2015 23:40:20 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DD36D1CC1; Fri, 31 Jul 2015 23:40:19 +0000 (UTC) (envelope-from gnn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6VNeJJp092275; Fri, 31 Jul 2015 23:40:19 GMT (envelope-from gnn@FreeBSD.org) Received: (from gnn@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6VNeJ1e092273; Fri, 31 Jul 2015 23:40:19 GMT (envelope-from gnn@FreeBSD.org) Message-Id: <201507312340.t6VNeJ1e092273@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gnn set sender to gnn@FreeBSD.org using -f From: "George V. Neville-Neil" Date: Fri, 31 Jul 2015 23:40:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286143 - head/sbin/setkey X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Jul 2015 23:40:20 -0000 Author: gnn Date: Fri Jul 31 23:40:18 2015 New Revision: 286143 URL: https://svnweb.freebsd.org/changeset/base/286143 Log: Add support for keys that include 4 byte SALT values, including GCM and ICM/CTR modes for AES. Reviewed by: jmg MFC after: 1 week Sponsored by: Rubicon Communications (Netgate) Modified: head/sbin/setkey/parse.y head/sbin/setkey/token.l Modified: head/sbin/setkey/parse.y ============================================================================== --- head/sbin/setkey/parse.y Fri Jul 31 21:43:27 2015 (r286142) +++ head/sbin/setkey/parse.y Fri Jul 31 23:40:18 2015 (r286143) @@ -100,6 +100,7 @@ extern void yyerror(const char *); %token F_EXT EXTENSION NOCYCLICSEQ %token ALG_AUTH ALG_AUTH_NOKEY %token ALG_ENC ALG_ENC_NOKEY ALG_ENC_DESDERIV ALG_ENC_DES32IV ALG_ENC_OLD +%token ALG_ENC_SALT %token ALG_COMP %token F_LIFETIME_HARD F_LIFETIME_SOFT %token DECSTRING QUOTEDSTRING HEXSTRING STRING ANY @@ -111,6 +112,7 @@ extern void yyerror(const char *); %type prefix protocol_spec upper_spec %type ALG_ENC ALG_ENC_DESDERIV ALG_ENC_DES32IV ALG_ENC_OLD ALG_ENC_NOKEY +%type ALG_ENC_SALT %type ALG_AUTH ALG_AUTH_NOKEY %type ALG_COMP %type PR_ESP PR_AH PR_IPCOMP PR_TCP @@ -402,6 +404,27 @@ enc_alg return -1; } } + | ALG_ENC_SALT key_string + { + if ($1 < 0) { + yyerror("unsupported algorithm"); + return -1; + } + p_alg_enc = $1; + + p_key_enc_len = $2.len; + + p_key_enc = $2.buf; + /* + * Salted keys include a 4 byte value that is + * not part of the key. + */ + if (ipsec_check_keylen(SADB_EXT_SUPPORTED_ENCRYPT, + p_alg_enc, PFKEY_UNUNIT64(p_key_enc_len - 4)) < 0) { + yyerror(ipsec_strerror()); + return -1; + } + } ; auth_alg Modified: head/sbin/setkey/token.l ============================================================================== --- head/sbin/setkey/token.l Fri Jul 31 21:43:27 2015 (r286142) +++ head/sbin/setkey/token.l Fri Jul 31 23:40:18 2015 (r286143) @@ -166,9 +166,9 @@ tcp { yylval.num = 0; return(PR_TCP); } des-deriv { yylval.num = SADB_EALG_DESCBC; BEGIN INITIAL; return(ALG_ENC_DESDERIV); } des-32iv { yylval.num = SADB_EALG_DESCBC; BEGIN INITIAL; return(ALG_ENC_DES32IV); } rijndael-cbc { yylval.num = SADB_X_EALG_RIJNDAELCBC; BEGIN INITIAL; return(ALG_ENC); } -aes-ctr { yylval.num = SADB_X_EALG_AESCTR; BEGIN INITIAL; return(ALG_ENC); } +aes-ctr { yylval.num = SADB_X_EALG_AESCTR; BEGIN INITIAL; return(ALG_ENC_SALT); } camellia-cbc { yylval.num = SADB_X_EALG_CAMELLIACBC; BEGIN INITIAL; return(ALG_ENC); } -aes-gcm-16 { yylval.num = SADB_X_EALG_AESGCM16; BEGIN INITIAL; return(ALG_ENC); } +aes-gcm-16 { yylval.num = SADB_X_EALG_AESGCM16; BEGIN INITIAL; return(ALG_ENC_SALT); } /* compression algorithms */ {hyphen}C { return(F_COMP); } From owner-svn-src-all@freebsd.org Sat Aug 1 01:29:56 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35DBC9AE632; Sat, 1 Aug 2015 01:29:56 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 26C781C20; Sat, 1 Aug 2015 01:29:56 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t711TucW036882; Sat, 1 Aug 2015 01:29:56 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t711TuAv036881; Sat, 1 Aug 2015 01:29:56 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201508010129.t711TuAv036881@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Sat, 1 Aug 2015 01:29:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286144 - head/usr.bin/wall X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 01:29:56 -0000 Author: pfg Date: Sat Aug 1 01:29:55 2015 New Revision: 286144 URL: https://svnweb.freebsd.org/changeset/base/286144 Log: Buffer overflow in wall(1). Revert r286102 and apply a cleaner fix. Tested for overflows by FORTIFY_SOURCE GSoC (with clang). Suggested by: bde Reviewed by: Oliver Pinter Tested by: Oliver Pinter MFC after: 3 days Modified: head/usr.bin/wall/ttymsg.c Modified: head/usr.bin/wall/ttymsg.c ============================================================================== --- head/usr.bin/wall/ttymsg.c Fri Jul 31 23:40:18 2015 (r286143) +++ head/usr.bin/wall/ttymsg.c Sat Aug 1 01:29:55 2015 (r286144) @@ -62,7 +62,7 @@ ttymsg(struct iovec *iov, int iovcnt, co struct iovec localiov[7]; ssize_t left, wret; int cnt, fd; - char device[MAXNAMLEN] = _PATH_DEV; + char device[MAXNAMLEN]; static char errbuf[1024]; char *p; int forked; @@ -71,8 +71,9 @@ ttymsg(struct iovec *iov, int iovcnt, co if (iovcnt > (int)(sizeof(localiov) / sizeof(localiov[0]))) return ("too many iov's (change code in wall/ttymsg.c)"); - strlcat(device, line, sizeof(device)); + strlcpy(device, _PATH_DEV, sizeof(device)); p = device + sizeof(_PATH_DEV) - 1; + strlcpy(p, line, sizeof(device) - sizeof(_PATH_DEV)); if (strncmp(p, "pts/", 4) == 0) p += 4; if (strchr(p, '/') != NULL) { From owner-svn-src-all@freebsd.org Sat Aug 1 03:37:02 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 232B49AFB3E; Sat, 1 Aug 2015 03:37:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 06D8D29F1; Sat, 1 Aug 2015 03:37:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t713b1uq097331; Sat, 1 Aug 2015 03:37:01 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t713b1gm097328; Sat, 1 Aug 2015 03:37:01 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201508010337.t713b1gm097328@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 1 Aug 2015 03:37:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286145 - stable/10/sys/vm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 03:37:02 -0000 Author: kib Date: Sat Aug 1 03:37:00 2015 New Revision: 286145 URL: https://svnweb.freebsd.org/changeset/base/286145 Log: MFC r285878: Revert r173708's modifications to vm_object_page_remove(). This fixes inconsistencies encountered by vm_object_unwire() or by the buffer cache when the file is truncated. Modified: stable/10/sys/vm/vm_object.c stable/10/sys/vm/vm_object.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_object.c ============================================================================== --- stable/10/sys/vm/vm_object.c Sat Aug 1 01:29:55 2015 (r286144) +++ stable/10/sys/vm/vm_object.c Sat Aug 1 03:37:00 2015 (r286145) @@ -1063,9 +1063,9 @@ vm_object_sync(vm_object_t object, vm_oo */ flags = OBJPR_NOTMAPPED; else if (old_msync) - flags = OBJPR_NOTWIRED; + flags = 0; else - flags = OBJPR_CLEANONLY | OBJPR_NOTWIRED; + flags = OBJPR_CLEANONLY; vm_object_page_remove(object, OFF_TO_IDX(offset), OFF_TO_IDX(offset + size + PAGE_MASK), flags); } @@ -1894,7 +1894,6 @@ vm_object_page_remove(vm_object_t object int options) { vm_page_t p, next; - int wirings; VM_OBJECT_ASSERT_WLOCKED(object); KASSERT((object->flags & OBJ_UNMANAGED) == 0 || @@ -1928,15 +1927,9 @@ again: VM_OBJECT_WLOCK(object); goto again; } - if ((wirings = p->wire_count) != 0 && - (wirings = pmap_page_wired_mappings(p)) != p->wire_count) { - if ((options & (OBJPR_NOTWIRED | OBJPR_NOTMAPPED)) == - 0) { + if (p->wire_count != 0) { + if ((options & OBJPR_NOTMAPPED) == 0) pmap_remove_all(p); - /* Account for removal of wired mappings. */ - if (wirings != 0) - p->wire_count -= wirings; - } if ((options & OBJPR_CLEANONLY) == 0) { p->valid = 0; vm_page_undirty(p); @@ -1957,19 +1950,8 @@ again: if (p->dirty) goto next; } - if ((options & OBJPR_NOTMAPPED) == 0) { - if ((options & OBJPR_NOTWIRED) != 0 && wirings != 0) - goto next; + if ((options & OBJPR_NOTMAPPED) == 0) pmap_remove_all(p); - /* Account for removal of wired mappings. */ - if (wirings != 0) { - KASSERT(p->wire_count == wirings, - ("inconsistent wire count %d %d %p", - p->wire_count, wirings, p)); - p->wire_count = 0; - atomic_subtract_int(&cnt.v_wire_count, 1); - } - } vm_page_free(p); next: vm_page_unlock(p); Modified: stable/10/sys/vm/vm_object.h ============================================================================== --- stable/10/sys/vm/vm_object.h Sat Aug 1 01:29:55 2015 (r286144) +++ stable/10/sys/vm/vm_object.h Sat Aug 1 03:37:00 2015 (r286145) @@ -207,7 +207,6 @@ struct vm_object { */ #define OBJPR_CLEANONLY 0x1 /* Don't remove dirty pages. */ #define OBJPR_NOTMAPPED 0x2 /* Don't unmap pages. */ -#define OBJPR_NOTWIRED 0x4 /* Don't remove wired pages. */ TAILQ_HEAD(object_q, vm_object); From owner-svn-src-all@freebsd.org Sat Aug 1 05:32:31 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 13C139B16BD; Sat, 1 Aug 2015 05:32:31 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E524116C7; Sat, 1 Aug 2015 05:32:30 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (75-48-78-19.lightspeed.cncrca.sbcglobal.net [75.48.78.19]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id F29B5B97B; Sat, 1 Aug 2015 01:32:29 -0400 (EDT) From: John Baldwin To: "Andrey V. Elsukov" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r285888 - head/sys/kern Date: Fri, 31 Jul 2015 10:54:15 -0700 Message-ID: <1825472.MtINFO9Kkx@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-PRERELEASE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201507261053.t6QArX3q081202@repo.freebsd.org> References: <201507261053.t6QArX3q081202@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Sat, 01 Aug 2015 01:32:30 -0400 (EDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 05:32:31 -0000 On Sunday, July 26, 2015 10:53:33 AM Andrey V. Elsukov wrote: > Author: ae > Date: Sun Jul 26 10:53:32 2015 > New Revision: 285888 > URL: https://svnweb.freebsd.org/changeset/base/285888 > > Log: > Build debug version of rmlock's methods only when LOCK_DEBUG > 0. > > Currently LOCK_DEBUG is always defined in sys/lock.h (0 or 1). > This means that debugging code always built. In addition the kernel > modules have always defined LOCK_DEBUG as 1. So, debugging rmlock code > is always used by kernel modules. Debugging versions of locking primitives are always used by all locking primitives (mutexes, rw, sx, etc.) so that if the kernel has INVARIANTS enabled then those checks are always performed regardless of how the module is compiled. -- John Baldwin From owner-svn-src-all@freebsd.org Sat Aug 1 05:32:34 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E6FC39B16D1; Sat, 1 Aug 2015 05:32:33 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A840018C9; Sat, 1 Aug 2015 05:32:33 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (75-48-78-19.lightspeed.cncrca.sbcglobal.net [75.48.78.19]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id BAC15B981; Sat, 1 Aug 2015 01:32:32 -0400 (EDT) From: John Baldwin To: Oliver Pinter Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Subject: Re: svn commit: r283998 - in head/sys: dev/drm dev/drm2 fs/devfs kern sys vm Date: Fri, 31 Jul 2015 10:28:19 -0700 Message-ID: <2301099.YseXhuPoWd@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-PRERELEASE; KDE/4.14.3; amd64; ; ) In-Reply-To: References: <201506041941.t54JfGAA075455@svn.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Sat, 01 Aug 2015 01:32:32 -0400 (EDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 05:32:34 -0000 On Thursday, July 30, 2015 09:11:54 PM Oliver Pinter wrote: > Hi John! > > On Thu, Jun 4, 2015 at 9:41 PM, John Baldwin wrote: > > Author: jhb > > Date: Thu Jun 4 19:41:15 2015 > > New Revision: 283998 > > URL: https://svnweb.freebsd.org/changeset/base/283998 > > > > Log: > > Add a new file operations hook for mmap operations. File type-specific > > logic is now placed in the mmap hook implementation rather than requiring > > it to be placed in sys/vm/vm_mmap.c. This hook allows new file types to > > support mmap() as well as potentially allowing mmap() for existing file > > types that do not currently support any mapping. > > > > The vm_mmap() function is now split up into two functions. A new > > vm_mmap_object() function handles the "back half" of vm_mmap() and accepts > > a referenced VM object to map rather than a (handle, handle_type) tuple. > > vm_mmap() is now reduced to converting a (handle, handle_type) tuple to a > > a VM object and then calling vm_mmap_object() to handle the actual mapping. > > The vm_mmap() function remains for use by other parts of the kernel > > (e.g. device drivers and exec) but now only supports mapping vnodes, > > character devices, and anonymous memory. > > > > The mmap() system call invokes vm_mmap_object() directly with a NULL object > > for anonymous mappings. For mappings using a file descriptor, the > > descriptors fo_mmap() hook is invoked instead. The fo_mmap() hook is > > responsible for performing type-specific checks and adjustments to > > arguments as well as possibly modifying mapping parameters such as flags > > or the object offset. The fo_mmap() hook routines then call > > vm_mmap_object() to handle the actual mapping. > > > > The fo_mmap() hook is optional. If it is not set, then fo_mmap() will > > fail with ENODEV. A fo_mmap() hook is implemented for regular files, > > character devices, and shared memory objects (created via shm_open()). > > > > While here, consistently use the VM_PROT_* constants for the vm_prot_t > > type for the 'prot' variable passed to vm_mmap() and vm_mmap_object() > > as well as the vm_mmap_vnode() and vm_mmap_cdev() helper routines. > > Previously some places were using the mmap()-specific PROT_* constants > > instead. While this happens to work because PROT_xx == VM_PROT_xx, > > using VM_PROT_* is more correct. > > > > Differential Revision: https://reviews.freebsd.org/D2658 > > Reviewed by: alc (glanced over), kib > > MFC after: 1 month > > Sponsored by: Chelsio > > > > Modified: > > head/sys/dev/drm/drm_bufs.c > > head/sys/dev/drm2/drm_bufs.c > > head/sys/fs/devfs/devfs_vnops.c > > head/sys/kern/subr_uio.c > > head/sys/kern/uipc_shm.c > > head/sys/kern/vfs_vnops.c > > head/sys/sys/file.h > > head/sys/sys/mman.h > > head/sys/vm/vm_extern.h > > head/sys/vm/vm_mmap.c > > > > > ... patch trimmed... > > When plan you to MFC this change to 10-STABLE? There's a regression reported by sbruno@ that needs to be resolved before it can be merged. I might also need to employ an extra hack to preserve the ABI (e.g. adding a new flag that has to be set in the fileops to say that the fo_mmap field is present like was done for fo_truncate). -- John Baldwin From owner-svn-src-all@freebsd.org Sat Aug 1 05:32:30 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 427D69B16B1; Sat, 1 Aug 2015 05:32:30 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1FE6416C6; Sat, 1 Aug 2015 05:32:30 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (75-48-78-19.lightspeed.cncrca.sbcglobal.net [75.48.78.19]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 91CD9B918; Sat, 1 Aug 2015 01:32:28 -0400 (EDT) From: John Baldwin To: David C Somayajulu Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r285973 - head/sys/dev/bxe Date: Fri, 31 Jul 2015 11:04:08 -0700 Message-ID: <13449730.WpJqEYONzp@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-PRERELEASE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201507281915.t6SJFjSj084767@repo.freebsd.org> References: <201507281915.t6SJFjSj084767@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Sat, 01 Aug 2015 01:32:28 -0400 (EDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 05:32:30 -0000 On Tuesday, July 28, 2015 07:15:45 PM David C Somayajulu wrote: > Author: davidcs > Date: Tue Jul 28 19:15:44 2015 > New Revision: 285973 > URL: https://svnweb.freebsd.org/changeset/base/285973 > > Log: > - Avoid lock contention in the if_transmit callback by using trylock and > enqueueing the frames when it fails. This way there is some latency > removed from the transmitting path. Most drivers that used to do this have stopped doing it do to the race that if you have bursty traffic you can end up with packets delayed until another packet is transmitted. If you are always blasting traffic non-stop, that's fine. If you have bursty traffic, it's not so great. A real-life scenario I had with igb(4) resulted in packets delayed by a full second. -- John Baldwin From owner-svn-src-all@freebsd.org Sat Aug 1 06:40:43 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C1BF9AD5B5; Sat, 1 Aug 2015 06:40:43 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id 1637A164D; Sat, 1 Aug 2015 06:40:42 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 12F2378106F; Sat, 1 Aug 2015 16:40:33 +1000 (AEST) Date: Sat, 1 Aug 2015 16:40:32 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Pedro Giffuni cc: Bruce Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r286102 - head/usr.bin/wall In-Reply-To: <55BB9E9C.9030608@FreeBSD.org> Message-ID: <20150801163923.J1074@besplex.bde.org> References: <201507310112.t6V1CWh8034232@repo.freebsd.org> <20150731162408.M1843@besplex.bde.org> <55BB9E9C.9030608@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=eZjABOwH c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=kj9zAlcOel0A:10 a=v7ozDdhdh8OD8oOQhIIA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 06:40:43 -0000 On Fri, 31 Jul 2015, Pedro Giffuni wrote: > On 07/31/15 02:12, Bruce Evans wrote: >> On Fri, 31 Jul 2015, Pedro F. Giffuni wrote: >> > ... > >>> static char errbuf[1024]; >> >> Another static buffer. The function is obviously not reentrant. This >> large static buffer mainly wastes space all the time instead of only >> when the function is called. > > But if I drop that static I get a bunch of errors: Yes. I forgot that it is is returned. Older not so good APIs often return a pointer to static data. Bruce From owner-svn-src-all@freebsd.org Sat Aug 1 07:21:16 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70B2A9B0393; Sat, 1 Aug 2015 07:21:16 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 56341C42; Sat, 1 Aug 2015 07:21:16 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t717LG4w006252; Sat, 1 Aug 2015 07:21:16 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t717LFFm006247; Sat, 1 Aug 2015 07:21:15 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201508010721.t717LFFm006247@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Sat, 1 Aug 2015 07:21:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286146 - in head/sys: kern sys X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 07:21:16 -0000 Author: ed Date: Sat Aug 1 07:21:14 2015 New Revision: 286146 URL: https://svnweb.freebsd.org/changeset/base/286146 Log: Add kern_shm_open(). This allows you to specify the capabilities that the new file descriptor should have. This allows us to create shared memory objects that only have the rights we're interested in. The idea behind restricting the rights is that it makes it a lot easier for CloudABI to get consistent behaviour across different operating systems. We only need to make sure that a shared memory implementation consistently implements the operations that are whitelisted. Approved by: kib Obtained from: https://github.com/NuxiNL/freebsd Modified: head/sys/kern/uipc_shm.c head/sys/sys/syscallsubr.h Modified: head/sys/kern/uipc_shm.c ============================================================================== --- head/sys/kern/uipc_shm.c Sat Aug 1 03:37:00 2015 (r286145) +++ head/sys/kern/uipc_shm.c Sat Aug 1 07:21:14 2015 (r286146) @@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -683,9 +684,9 @@ shm_remove(char *path, Fnv32_t fnv, stru return (ENOENT); } -/* System calls. */ int -sys_shm_open(struct thread *td, struct shm_open_args *uap) +kern_shm_open(struct thread *td, const char *userpath, int flags, mode_t mode, + struct filecaps *fcaps) { struct filedesc *fdp; struct shmfd *shmfd; @@ -699,28 +700,27 @@ sys_shm_open(struct thread *td, struct s /* * shm_open(2) is only allowed for anonymous objects. */ - if (IN_CAPABILITY_MODE(td) && (uap->path != SHM_ANON)) + if (IN_CAPABILITY_MODE(td) && (userpath != SHM_ANON)) return (ECAPMODE); #endif - if ((uap->flags & O_ACCMODE) != O_RDONLY && - (uap->flags & O_ACCMODE) != O_RDWR) + if ((flags & O_ACCMODE) != O_RDONLY && (flags & O_ACCMODE) != O_RDWR) return (EINVAL); - if ((uap->flags & ~(O_ACCMODE | O_CREAT | O_EXCL | O_TRUNC | O_CLOEXEC)) != 0) + if ((flags & ~(O_ACCMODE | O_CREAT | O_EXCL | O_TRUNC | O_CLOEXEC)) != 0) return (EINVAL); fdp = td->td_proc->p_fd; - cmode = (uap->mode & ~fdp->fd_cmask) & ACCESSPERMS; + cmode = (mode & ~fdp->fd_cmask) & ACCESSPERMS; - error = falloc(td, &fp, &fd, O_CLOEXEC); + error = falloc_caps(td, &fp, &fd, O_CLOEXEC, fcaps); if (error) return (error); /* A SHM_ANON path pointer creates an anonymous object. */ - if (uap->path == SHM_ANON) { + if (userpath == SHM_ANON) { /* A read-only anonymous object is pointless. */ - if ((uap->flags & O_ACCMODE) == O_RDONLY) { + if ((flags & O_ACCMODE) == O_RDONLY) { fdclose(td, fp, fd); fdrop(fp, td); return (EINVAL); @@ -728,7 +728,7 @@ sys_shm_open(struct thread *td, struct s shmfd = shm_alloc(td->td_ucred, cmode); } else { path = malloc(MAXPATHLEN, M_SHMFD, M_WAITOK); - error = copyinstr(uap->path, path, MAXPATHLEN, NULL); + error = copyinstr(userpath, path, MAXPATHLEN, NULL); #ifdef KTRACE if (error == 0 && KTRPOINT(curthread, KTR_NAMEI)) ktrnamei(path); @@ -748,7 +748,7 @@ sys_shm_open(struct thread *td, struct s shmfd = shm_lookup(path, fnv); if (shmfd == NULL) { /* Object does not yet exist, create it if requested. */ - if (uap->flags & O_CREAT) { + if (flags & O_CREAT) { #ifdef MAC error = mac_posixshm_check_create(td->td_ucred, path); @@ -769,17 +769,16 @@ sys_shm_open(struct thread *td, struct s * reference if requested and permitted. */ free(path, M_SHMFD); - if ((uap->flags & (O_CREAT | O_EXCL)) == - (O_CREAT | O_EXCL)) + if ((flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) error = EEXIST; else { #ifdef MAC error = mac_posixshm_check_open(td->td_ucred, - shmfd, FFLAGS(uap->flags & O_ACCMODE)); + shmfd, FFLAGS(flags & O_ACCMODE)); if (error == 0) #endif error = shm_access(shmfd, td->td_ucred, - FFLAGS(uap->flags & O_ACCMODE)); + FFLAGS(flags & O_ACCMODE)); } /* @@ -788,7 +787,7 @@ sys_shm_open(struct thread *td, struct s * opened with read/write. */ if (error == 0 && - (uap->flags & (O_ACCMODE | O_TRUNC)) == + (flags & (O_ACCMODE | O_TRUNC)) == (O_RDWR | O_TRUNC)) { #ifdef MAC error = mac_posixshm_check_truncate( @@ -809,7 +808,7 @@ sys_shm_open(struct thread *td, struct s } } - finit(fp, FFLAGS(uap->flags & O_ACCMODE), DTYPE_SHM, shmfd, &shm_ops); + finit(fp, FFLAGS(flags & O_ACCMODE), DTYPE_SHM, shmfd, &shm_ops); td->td_retval[0] = fd; fdrop(fp, td); @@ -817,6 +816,14 @@ sys_shm_open(struct thread *td, struct s return (0); } +/* System calls. */ +int +sys_shm_open(struct thread *td, struct shm_open_args *uap) +{ + + return (kern_shm_open(td, uap->path, uap->flags, uap->mode, NULL)); +} + int sys_shm_unlink(struct thread *td, struct shm_unlink_args *uap) { Modified: head/sys/sys/syscallsubr.h ============================================================================== --- head/sys/sys/syscallsubr.h Sat Aug 1 03:37:00 2015 (r286145) +++ head/sys/sys/syscallsubr.h Sat Aug 1 07:21:14 2015 (r286146) @@ -204,6 +204,8 @@ int kern_setsockopt(struct thread *td, i void *optval, enum uio_seg valseg, socklen_t valsize); int kern_settimeofday(struct thread *td, struct timeval *tv, struct timezone *tzp); +int kern_shm_open(struct thread *td, const char *userpath, int flags, + mode_t mode, struct filecaps *fcaps); int kern_shmat(struct thread *td, int shmid, const void *shmaddr, int shmflg); int kern_shmctl(struct thread *td, int shmid, int cmd, void *buf, From owner-svn-src-all@freebsd.org Sat Aug 1 07:51:49 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35DAC9B028A; Sat, 1 Aug 2015 07:51:49 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 23375198A; Sat, 1 Aug 2015 07:51:49 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t717pnhA019786; Sat, 1 Aug 2015 07:51:49 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t717pmVi019785; Sat, 1 Aug 2015 07:51:48 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201508010751.t717pmVi019785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Sat, 1 Aug 2015 07:51:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286147 - head/sys/compat/cloudabi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 07:51:49 -0000 Author: ed Date: Sat Aug 1 07:51:48 2015 New Revision: 286147 URL: https://svnweb.freebsd.org/changeset/base/286147 Log: Allow CloudABI processes to create shared memory objects. Summary: Use the newly created `kern_shm_open()` function to create objects with just the rights that are actually needed. Reviewers: jhb, kib Subscribers: imp Differential Revision: https://reviews.freebsd.org/D3260 Modified: head/sys/compat/cloudabi/cloudabi_fd.c Modified: head/sys/compat/cloudabi/cloudabi_fd.c ============================================================================== --- head/sys/compat/cloudabi/cloudabi_fd.c Sat Aug 1 07:21:14 2015 (r286146) +++ head/sys/compat/cloudabi/cloudabi_fd.c Sat Aug 1 07:51:48 2015 (r286147) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -97,11 +98,16 @@ int cloudabi_sys_fd_create1(struct thread *td, struct cloudabi_sys_fd_create1_args *uap) { + struct filecaps fcaps = {}; struct socket_args socket_args = { .domain = AF_UNIX, }; switch (uap->type) { + case CLOUDABI_FILETYPE_SHARED_MEMORY: + cap_rights_init(&fcaps.fc_rights, CAP_FSTAT, CAP_FTRUNCATE, + CAP_MMAP_RWX); + return (kern_shm_open(td, SHM_ANON, O_RDWR, 0, &fcaps)); case CLOUDABI_FILETYPE_SOCKET_DGRAM: socket_args.type = SOCK_DGRAM; return (sys_socket(td, &socket_args)); From owner-svn-src-all@freebsd.org Sat Aug 1 08:35:21 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6EA019B0DD8; Sat, 1 Aug 2015 08:35:21 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 50CC9C16; Sat, 1 Aug 2015 08:35:21 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t718ZK67035945; Sat, 1 Aug 2015 08:35:20 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t718ZKiH035944; Sat, 1 Aug 2015 08:35:20 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201508010835.t718ZKiH035944@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 1 Aug 2015 08:35:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286148 - head/usr.sbin/chkgrp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 08:35:21 -0000 Author: bapt Date: Sat Aug 1 08:35:20 2015 New Revision: 286148 URL: https://svnweb.freebsd.org/changeset/base/286148 Log: Use strtoumax instead of strtoul Modified: head/usr.sbin/chkgrp/chkgrp.c Modified: head/usr.sbin/chkgrp/chkgrp.c ============================================================================== --- head/usr.sbin/chkgrp/chkgrp.c Sat Aug 1 07:51:48 2015 (r286147) +++ head/usr.sbin/chkgrp/chkgrp.c Sat Aug 1 08:35:20 2015 (r286148) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -169,9 +170,9 @@ main(int argc, char *argv[]) /* check the range of the group id */ errno = 0; - gid = strtoul(f[2], NULL, 10); + gid = strtoumax(f[2], NULL, 10); if (errno != 0) { - warnx("%s: line %d: strtoul failed", gfn, n); + warnx("%s: line %d: strtoumax failed", gfn, n); } else if (gid > GID_MAX) { warnx("%s: line %d: group id is too large (%ju > %ju)", gfn, n, (uintmax_t)gid, (uintmax_t)GID_MAX); From owner-svn-src-all@freebsd.org Sat Aug 1 08:39:57 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1993E9B0E42; Sat, 1 Aug 2015 08:39:57 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EE280DA4; Sat, 1 Aug 2015 08:39:56 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t718du20036156; Sat, 1 Aug 2015 08:39:56 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t718dute036155; Sat, 1 Aug 2015 08:39:56 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201508010839.t718dute036155@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 1 Aug 2015 08:39:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286149 - head/usr.sbin/chkgrp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 08:39:57 -0000 Author: bapt Date: Sat Aug 1 08:39:55 2015 New Revision: 286149 URL: https://svnweb.freebsd.org/changeset/base/286149 Log: Handle +:*:: the same way we handle +::: when checking group file The first is what the documentation recommands for NIS client Modified: head/usr.sbin/chkgrp/chkgrp.c Modified: head/usr.sbin/chkgrp/chkgrp.c ============================================================================== --- head/usr.sbin/chkgrp/chkgrp.c Sat Aug 1 08:35:20 2015 (r286148) +++ head/usr.sbin/chkgrp/chkgrp.c Sat Aug 1 08:39:55 2015 (r286149) @@ -106,7 +106,8 @@ main(int argc, char *argv[]) /* * Hack: special case for + line */ - if (strncmp(line, "+:::", len) == 0) + if (strncmp(line, "+:::", len) == 0 || + strncmp(line, "+:*::", len) == 0) continue; /* From owner-svn-src-all@freebsd.org Sat Aug 1 09:50:19 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F9019AFE00 for ; Sat, 1 Aug 2015 09:50:19 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-oi0-f49.google.com (mail-oi0-f49.google.com [209.85.218.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6133DA24 for ; Sat, 1 Aug 2015 09:50:18 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by oihq81 with SMTP id q81so50039693oih.2 for ; Sat, 01 Aug 2015 02:50:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=oxyo3dCky1c/+qGNVNB/Zw9CpGWrOG+Mk4UMbQCsHx8=; b=e2FPPhry3sIbUzWoXwXeGvSdrK7oWMDOwTH4A2KxWDmGtaadGutafTxvPKUyQJjpGQ DzeJvV/ioU7qKj7gg0tl6kH62eBlZqYFIzRt8ZJ/b7ULI6FK1Bg3/ZY7PAaNALKPZ815 HxUv5+HRDhos3ThYmdyJWT6F7COszgPsUq0OXtzwwUuU7qKh98KJDIcevCoF6mj2I8pT Q9jFrtJS84x5rNskBy+5Mtr0sw+5lKhPmIcLEZjmZoQyAyRL6gIYYaE0iLz9mfcK5P7d 2Di1X03bvICCOmZWCFWwo83nQse+5GfZ3xjp7d75qnTqlKcKCdU5rqz31wgsXDgT47+k saeg== X-Gm-Message-State: ALoCoQlvFCYSpAwYC5PJckRSSoIkBJFZfGMrnmm5AbseLBbK7ksFcg5xDB0aZs7aijc28UOsX7eK MIME-Version: 1.0 X-Received: by 10.202.171.21 with SMTP id u21mr7501366oie.113.1438422611802; Sat, 01 Aug 2015 02:50:11 -0700 (PDT) Received: by 10.76.50.84 with HTTP; Sat, 1 Aug 2015 02:50:11 -0700 (PDT) X-Originating-IP: [84.27.222.46] In-Reply-To: <201507312143.t6VLhSBm046797@repo.freebsd.org> References: <201507312143.t6VLhSBm046797@repo.freebsd.org> Date: Sat, 1 Aug 2015 11:50:11 +0200 Message-ID: Subject: Re: svn commit: r286142 - head/sys/net From: Ed Schouten To: Luiz Otavio O Souza Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 09:50:19 -0000 Hi Luiz, 2015-07-31 23:43 GMT+02:00 Luiz Otavio O Souza : > - while (d->bd_hbuf_in_use) > - mtx_sleep(&d->bd_hbuf_in_use, &d->bd_lock, > - PRINET, "bd_hbuf", 0); Would it make sense to replace them by an assertion, instead of omitting them entirely? KASSERT(!d->bd_hbuf_in_use, ("...")); Thanks, -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK/VAT number: 62051717 From owner-svn-src-all@freebsd.org Sat Aug 1 09:55:50 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB6EC9AFF3A; Sat, 1 Aug 2015 09:55:49 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C2185CE7; Sat, 1 Aug 2015 09:55:49 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t719tnlR068486; Sat, 1 Aug 2015 09:55:49 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t719tms9068482; Sat, 1 Aug 2015 09:55:48 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201508010955.t719tms9068482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 1 Aug 2015 09:55:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286150 - head/usr.sbin/pw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 09:55:50 -0000 Author: bapt Date: Sat Aug 1 09:55:47 2015 New Revision: 286150 URL: https://svnweb.freebsd.org/changeset/base/286150 Log: Cast uid/git to uintmax_t when using printf-like functions so the size of uid/gid size remains a implementation detail Modified: head/usr.sbin/pw/pw_conf.c head/usr.sbin/pw/pw_group.c head/usr.sbin/pw/pw_user.c Modified: head/usr.sbin/pw/pw_conf.c ============================================================================== --- head/usr.sbin/pw/pw_conf.c Sat Aug 1 08:39:55 2015 (r286149) +++ head/usr.sbin/pw/pw_conf.c Sat Aug 1 09:55:47 2015 (r286150) @@ -31,6 +31,7 @@ static const char rcsid[] = #include #include +#include #include #include #include @@ -446,19 +447,19 @@ write_userconfig(char const * file) config.default_class : ""); break; case _UC_MINUID: - sbuf_printf(buf, "%u", config.min_uid); + sbuf_printf(buf, "%ju", (uintmax_t)config.min_uid); quote = 0; break; case _UC_MAXUID: - sbuf_printf(buf, "%u", config.max_uid); + sbuf_printf(buf, "%ju", (uintmax_t)config.max_uid); quote = 0; break; case _UC_MINGID: - sbuf_printf(buf, "%u", config.min_gid); + sbuf_printf(buf, "%ju", (uintmax_t)config.min_gid); quote = 0; break; case _UC_MAXGID: - sbuf_printf(buf, "%u", config.max_gid); + sbuf_printf(buf, "%ju", (uintmax_t)config.max_gid); quote = 0; break; case _UC_EXPIRE: Modified: head/usr.sbin/pw/pw_group.c ============================================================================== --- head/usr.sbin/pw/pw_group.c Sat Aug 1 08:39:55 2015 (r286149) +++ head/usr.sbin/pw/pw_group.c Sat Aug 1 09:55:47 2015 (r286150) @@ -31,6 +31,7 @@ static const char rcsid[] = #include #include +#include #include #include #include @@ -97,7 +98,7 @@ pw_groupnext(struct userconf *cnf, bool if (quiet) return (next); - printf("%u\n", next); + printf("%ju\n", (uintmax_t)next); return (EXIT_SUCCESS); } @@ -283,7 +284,7 @@ pw_group(int mode, char *name, long id, if ((grp = GETGRNAM(name)) == NULL) errx(EX_SOFTWARE, "group disappeared during update"); - pw_log(cnf, mode, W_GROUP, "%s(%u)", grp->gr_name, grp->gr_gid); + pw_log(cnf, mode, W_GROUP, "%s(%ju)", grp->gr_name, (uintmax_t)grp->gr_gid); return EXIT_SUCCESS; } @@ -345,7 +346,7 @@ gr_gidpolicy(struct userconf * cnf, long gid = (gid_t) id; if ((grp = GETGRGID(gid)) != NULL && conf.checkduplicate) - errx(EX_DATAERR, "gid `%u' has already been allocated", grp->gr_gid); + errx(EX_DATAERR, "gid `%ju' has already been allocated", (uintmax_t)grp->gr_gid); } else { struct bitmap bm; Modified: head/usr.sbin/pw/pw_user.c ============================================================================== --- head/usr.sbin/pw/pw_user.c Sat Aug 1 08:39:55 2015 (r286149) +++ head/usr.sbin/pw/pw_user.c Sat Aug 1 09:55:47 2015 (r286150) @@ -33,6 +33,7 @@ static const char rcsid[] = #include #include #include +#include #include #include #include @@ -81,8 +82,8 @@ create_and_populate_homedir(struct passw copymkdir(conf.rootfd, pwd->pw_dir, skelfd, cnf->homemode, pwd->pw_uid, pwd->pw_gid, 0); - pw_log(cnf, M_ADD, W_USER, "%s(%u) home %s made", pwd->pw_name, - pwd->pw_uid, pwd->pw_dir); + pw_log(cnf, M_ADD, W_USER, "%s(%ju) home %s made", pwd->pw_name, + (uintmax_t)pwd->pw_uid, pwd->pw_dir); } static int @@ -155,7 +156,7 @@ pw_usernext(struct userconf *cnf, bool q if (quiet) return (next); - printf("%u:", next); + printf("%ju:", (uintmax_t)next); pw_groupnext(cnf, quiet); return (EXIT_SUCCESS); @@ -749,9 +750,9 @@ pw_user(int mode, char *name, long id, s errx(EX_NOUSER, "user '%s' disappeared during update", name); grp = GETGRGID(pwd->pw_gid); - pw_log(cnf, mode, W_USER, "%s(%u):%s(%u):%s:%s:%s", - pwd->pw_name, pwd->pw_uid, - grp ? grp->gr_name : "unknown", (grp ? grp->gr_gid : (uid_t)-1), + pw_log(cnf, mode, W_USER, "%s(%ju):%s(%ju):%s:%s:%s", + pwd->pw_name, (uintmax_t)pwd->pw_uid, + grp ? grp->gr_name : "unknown", (uintmax_t)(grp ? grp->gr_gid : (uid_t)-1), pwd->pw_gecos, pwd->pw_dir, pwd->pw_shell); /* @@ -794,8 +795,8 @@ pw_user(int mode, char *name, long id, s fputs(line, pfp); } pclose(pfp); - pw_log(cnf, mode, W_USER, "%s(%u) new user mail sent", - pwd->pw_name, pwd->pw_uid); + pw_log(cnf, mode, W_USER, "%s(%ju) new user mail sent", + pwd->pw_name, (uintmax_t)pwd->pw_uid); } fclose(fp); } @@ -817,7 +818,8 @@ pw_uidpolicy(struct userconf * cnf, long uid = (uid_t) id; if ((pwd = GETPWUID(uid)) != NULL && conf.checkduplicate) - errx(EX_DATAERR, "uid `%u' has already been allocated", pwd->pw_uid); + errx(EX_DATAERR, "uid `%ju' has already been allocated", + (uintmax_t)pwd->pw_uid); } else { struct bitmap bm; @@ -1177,8 +1179,8 @@ pw_userdel(char *name, long id) } ENDGRENT(); - pw_log(conf.userconf, M_DELETE, W_USER, "%s(%u) account removed", name, - uid); + pw_log(conf.userconf, M_DELETE, W_USER, "%s(%ju) account removed", name, + (uintmax_t)uid); /* Remove mail file */ if (PWALTDIR() != PWF_ALT) @@ -1193,8 +1195,8 @@ pw_userdel(char *name, long id) getpwuid(uid) == NULL && fstatat(conf.rootfd, home + 1, &st, 0) != -1) { rm_r(conf.rootfd, home, uid); - pw_log(conf.userconf, M_DELETE, W_USER, "%s(%u) home '%s' %s" - "removed", name, uid, home, + pw_log(conf.userconf, M_DELETE, W_USER, "%s(%ju) home '%s' %s" + "removed", name, (uintmax_t)uid, home, fstatat(conf.rootfd, home + 1, &st, 0) == -1 ? "" : "not " "completely "); } @@ -1248,14 +1250,14 @@ print_user(struct passwd * pwd) strftime(acexpire, sizeof acexpire, "%c", tptr); if (pwd->pw_change > (time_t)0 && (tptr = localtime(&pwd->pw_change)) != NULL) strftime(pwexpire, sizeof pwexpire, "%c", tptr); - printf("Login Name: %-15s #%-12u Group: %-15s #%u\n" + printf("Login Name: %-15s #%-12ju Group: %-15s #%ju\n" " Full Name: %s\n" " Home: %-26.26s Class: %s\n" " Shell: %-26.26s Office: %s\n" "Work Phone: %-26.26s Home Phone: %s\n" "Acc Expire: %-26.26s Pwd Expire: %s\n", - pwd->pw_name, pwd->pw_uid, - grp ? grp->gr_name : "(invalid)", pwd->pw_gid, + pwd->pw_name, (uintmax_t)pwd->pw_uid, + grp ? grp->gr_name : "(invalid)", (uintmax_t)pwd->pw_gid, uname, pwd->pw_dir, pwd->pw_class, pwd->pw_shell, office, wphone, hphone, acexpire, pwexpire); From owner-svn-src-all@freebsd.org Sat Aug 1 10:10:14 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C16A29B01EC; Sat, 1 Aug 2015 10:10:14 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 987871551; Sat, 1 Aug 2015 10:10:14 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t71AAERh074826; Sat, 1 Aug 2015 10:10:14 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t71AAEM5074809; Sat, 1 Aug 2015 10:10:14 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201508011010.t71AAEM5074809@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 1 Aug 2015 10:10:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286151 - head/usr.sbin/pw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 10:10:14 -0000 Author: bapt Date: Sat Aug 1 10:10:13 2015 New Revision: 286151 URL: https://svnweb.freebsd.org/changeset/base/286151 Log: Validate the max_uid/max_gid boundaries and entry type in pw.conf Modified: head/usr.sbin/pw/pw_conf.c Modified: head/usr.sbin/pw/pw_conf.c ============================================================================== --- head/usr.sbin/pw/pw_conf.c Sat Aug 1 09:55:47 2015 (r286150) +++ head/usr.sbin/pw/pw_conf.c Sat Aug 1 10:10:13 2015 (r286151) @@ -230,6 +230,7 @@ read_userconfig(char const * file) char *buf, *p; size_t linecap; ssize_t linelen; + const char *errstr; buf = NULL; linecap = 0; @@ -323,20 +324,35 @@ read_userconfig(char const * file) ? NULL : newstr(q); break; case _UC_MINUID: - if ((q = unquote(q)) != NULL && isdigit(*q)) - config.min_uid = (uid_t) atol(q); + if ((q = unquote(q)) != NULL) { + errstr = NULL; + config.min_uid = strtounum(q, 0, UID_MAX, &errstr); + if (errstr) + warnx("Invalid min_uid: '%s', ignoring", q); + } break; case _UC_MAXUID: - if ((q = unquote(q)) != NULL && isdigit(*q)) - config.max_uid = (uid_t) atol(q); + if ((q = unquote(q)) != NULL) { + errstr = NULL; + config.max_uid = strtounum(q, 0, UID_MAX, &errstr); + if (errstr) + warnx("Invalid max_uid: '%s', ignoring", q); + } break; case _UC_MINGID: if ((q = unquote(q)) != NULL && isdigit(*q)) - config.min_gid = (gid_t) atol(q); + errstr = NULL; + config.min_gid = strtounum(q, 0, GID_MAX, &errstr); + if (errstr) + warnx("Invalid min_gid: '%s', ignoring", q); break; case _UC_MAXGID: - if ((q = unquote(q)) != NULL && isdigit(*q)) - config.max_gid = (gid_t) atol(q); + if ((q = unquote(q)) != NULL) { + errstr = NULL; + config.max_gid = strtounum(q, 0, GID_MAX, &errstr); + if (errstr) + warnx("Invalid max_gid: '%s', ignoring", q); + } break; case _UC_EXPIRE: if ((q = unquote(q)) != NULL && isdigit(*q)) From owner-svn-src-all@freebsd.org Sat Aug 1 10:25:57 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6A9D79B05AE; Sat, 1 Aug 2015 10:25:57 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 523AF1F94; Sat, 1 Aug 2015 10:25:57 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t71APvTX081373; Sat, 1 Aug 2015 10:25:57 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t71APunU081369; Sat, 1 Aug 2015 10:25:56 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201508011025.t71APunU081369@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 1 Aug 2015 10:25:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286152 - head/usr.sbin/pw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 10:25:57 -0000 Author: bapt Date: Sat Aug 1 10:25:55 2015 New Revision: 286152 URL: https://svnweb.freebsd.org/changeset/base/286152 Log: Validate expiration days and password days from commmand line and pw.conf Modified: head/usr.sbin/pw/pw.c head/usr.sbin/pw/pw_conf.c head/usr.sbin/pw/pw_user.c head/usr.sbin/pw/pwupd.h Modified: head/usr.sbin/pw/pw.c ============================================================================== --- head/usr.sbin/pw/pw.c Sat Aug 1 10:10:13 2015 (r286151) +++ head/usr.sbin/pw/pw.c Sat Aug 1 10:25:55 2015 (r286152) @@ -262,6 +262,11 @@ main(int argc, char *argv[]) case 'c': conf.gecos = pw_checkname(optarg, 1); break; + case 'e': + conf.expire_days = strtonum(optarg, 0, INT_MAX, &errstr); + if (errstr) + errx(EX_USAGE, "Invalid expired days: %s", optarg); + break; case 'g': if (which == 0) { /* for user* */ addarg(&arglist, 'g', optarg); @@ -321,6 +326,11 @@ main(int argc, char *argv[]) case 'o': conf.checkduplicate = false; break; + case 'p': + conf.password_days = strtonum(optarg, 0, INT_MAX, &errstr); + if (errstr) + errx(EX_USAGE, "Invalid password days: %s", optarg); + break; case 'q': conf.quiet = true; break; Modified: head/usr.sbin/pw/pw_conf.c ============================================================================== --- head/usr.sbin/pw/pw_conf.c Sat Aug 1 10:10:13 2015 (r286151) +++ head/usr.sbin/pw/pw_conf.c Sat Aug 1 10:25:55 2015 (r286152) @@ -355,12 +355,20 @@ read_userconfig(char const * file) } break; case _UC_EXPIRE: - if ((q = unquote(q)) != NULL && isdigit(*q)) - config.expire_days = atoi(q); + if ((q = unquote(q)) != NULL) { + errstr = NULL; + config.expire_days = strtonum(q, 0, INT_MAX, &errstr); + if (errstr) + warnx("Invalid expire days: '%s', ignoring", q); + } break; case _UC_PASSWORD: - if ((q = unquote(q)) != NULL && isdigit(*q)) - config.password_days = atoi(q); + if ((q = unquote(q)) != NULL) { + errstr = NULL; + config.password_days = strtonum(q, 0, INT_MAX, &errstr); + if (errstr) + warnx("Invalid password days: '%s', ignoring", q); + } break; case _UC_FIELDS: case _UC_NONE: Modified: head/usr.sbin/pw/pw_user.c ============================================================================== --- head/usr.sbin/pw/pw_user.c Sat Aug 1 10:10:13 2015 (r286151) +++ head/usr.sbin/pw/pw_user.c Sat Aug 1 10:25:55 2015 (r286152) @@ -418,14 +418,14 @@ pw_user(int mode, char *name, long id, s errx(EX_OSFILE, "root home `%s' is not a directory", cnf->home); } - if ((arg = getarg(args, 'e')) != NULL) - cnf->expire_days = atoi(arg->val); + if (conf.expire_days > 0) + cnf->expire_days = conf.expire_days; if ((arg = getarg(args, 'y')) != NULL) cnf->nispasswd = arg->val; - if ((arg = getarg(args, 'p')) != NULL && arg->val) - cnf->password_days = atoi(arg->val); + if (conf.password_days > 0) + cnf->password_days = conf.password_days; if ((arg = getarg(args, 'g')) != NULL) { if (!*(p = arg->val)) /* Handle empty group list specially */ Modified: head/usr.sbin/pw/pwupd.h ============================================================================== --- head/usr.sbin/pw/pwupd.h Sat Aug 1 10:10:13 2015 (r286151) +++ head/usr.sbin/pw/pwupd.h Sat Aug 1 10:25:55 2015 (r286152) @@ -86,6 +86,8 @@ struct pwconf { char *newname; char *config; char *gecos; + int expire_days; + int password_days; int fd; int rootfd; int which; From owner-svn-src-all@freebsd.org Sat Aug 1 10:36:00 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10C789B0915; Sat, 1 Aug 2015 10:36:00 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id 4305B15C3; Sat, 1 Aug 2015 10:35:59 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 9FA6A781F9A; Sat, 1 Aug 2015 20:35:57 +1000 (AEST) Date: Sat, 1 Aug 2015 20:35:56 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Baptiste Daroussin cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r286148 - head/usr.sbin/chkgrp In-Reply-To: <201508010835.t718ZKiH035944@repo.freebsd.org> Message-ID: <20150801200929.F2212@besplex.bde.org> References: <201508010835.t718ZKiH035944@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=XMDNMlVE c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=kj9zAlcOel0A:10 a=dXZubP7t6yK9USa-kFYA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 10:36:00 -0000 On Sat, 1 Aug 2015, Baptiste Daroussin wrote: > Log: > Use strtoumax instead of strtoul This does nothing good, and breaks 32-bit arches. > Modified: head/usr.sbin/chkgrp/chkgrp.c > ============================================================================== > --- head/usr.sbin/chkgrp/chkgrp.c Sat Aug 1 07:51:48 2015 (r286147) > +++ head/usr.sbin/chkgrp/chkgrp.c Sat Aug 1 08:35:20 2015 (r286148) > @@ -169,9 +170,9 @@ main(int argc, char *argv[]) > > /* check the range of the group id */ > errno = 0; > - gid = strtoul(f[2], NULL, 10); > + gid = strtoumax(f[2], NULL, 10); gid still has type u_long (spelled verbosely as unsigned long.) This used to work on arches where gid_t is no larger than u_long, which is the case on all supported arches. Now the value returned by strtoumax() is corrupted by blindly assigning it to u_long. E.g., 0x100000001 becomes 1. > if (errno != 0) { > - warnx("%s: line %d: strtoul failed", gfn, n); > + warnx("%s: line %d: strtoumax failed", gfn, n); This has a less usual subset of common bugs in using the strtoul() family. The most common bug is to not check ERANGE. This does check ERANGE, but doesn't check for garbage following the integer (it doesn't even pass endptr). It uses a POSIX extension to check that the integer has some digits. > } else if (gid > GID_MAX) { This used to work. Now it checks the corrupted value. > warnx("%s: line %d: group id is too large (%ju > %ju)", > gfn, n, (uintmax_t)gid, (uintmax_t)GID_MAX); This format is bogus for printing `gid'. gid should have type gid_t, but actually has type u_long. u_long should be printed using %lu and no cast. GID_MAX is undocumented, so no one knows its type. Its type should be gid_t, but is actually u_int. gid_t is logically different again -- it is __uint32_t. GID_MAX is defined in sys/limits.h, so there are namespace problems in matching its type with that of gid_t. The current implementation is best until gid_t is expanded. So casting GID_MAX to uintmax_t is good for safety and portability. However, chckgrp.c already assumed that gid_t is no larger than u_long. Otherwise it would have been broken in the reverse way to this commit -- values would have been clamped by strtoul(). The bounds checking would have worked, but large values would have been unsupported. The old value might as well have cast to u_long. strtoumax() can support any size for gid_t. After fixing all the other type errors, the types in the warnx() become correct. Bruce From owner-svn-src-all@freebsd.org Sat Aug 1 10:40:18 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 938A39B0990; Sat, 1 Aug 2015 10:40:18 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 842931890; Sat, 1 Aug 2015 10:40:18 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t71AeIvq085605; Sat, 1 Aug 2015 10:40:18 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t71AeIUm085604; Sat, 1 Aug 2015 10:40:18 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201508011040.t71AeIUm085604@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 1 Aug 2015 10:40:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286153 - head/usr.sbin/chkgrp X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 10:40:18 -0000 Author: bapt Date: Sat Aug 1 10:40:17 2015 New Revision: 286153 URL: https://svnweb.freebsd.org/changeset/base/286153 Log: Revert r286148 Modified: head/usr.sbin/chkgrp/chkgrp.c Modified: head/usr.sbin/chkgrp/chkgrp.c ============================================================================== --- head/usr.sbin/chkgrp/chkgrp.c Sat Aug 1 10:25:55 2015 (r286152) +++ head/usr.sbin/chkgrp/chkgrp.c Sat Aug 1 10:40:17 2015 (r286153) @@ -171,9 +171,9 @@ main(int argc, char *argv[]) /* check the range of the group id */ errno = 0; - gid = strtoumax(f[2], NULL, 10); + gid = strtoul(f[2], NULL, 10); if (errno != 0) { - warnx("%s: line %d: strtoumax failed", gfn, n); + warnx("%s: line %d: strtoul failed", gfn, n); } else if (gid > GID_MAX) { warnx("%s: line %d: group id is too large (%ju > %ju)", gfn, n, (uintmax_t)gid, (uintmax_t)GID_MAX); From owner-svn-src-all@freebsd.org Sat Aug 1 11:32:00 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4DC539B064E; Sat, 1 Aug 2015 11:32:00 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 331831D21; Sat, 1 Aug 2015 11:32:00 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t71BW0NT009334; Sat, 1 Aug 2015 11:32:00 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t71BW0Wx009333; Sat, 1 Aug 2015 11:32:00 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201508011132.t71BW0Wx009333@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 1 Aug 2015 11:32:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286154 - head/usr.sbin/pw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 11:32:00 -0000 Author: bapt Date: Sat Aug 1 11:31:59 2015 New Revision: 286154 URL: https://svnweb.freebsd.org/changeset/base/286154 Log: Fix formatting of new code Fix sorting or errstr Remove useless initialisation or errstr Reported by: bde Modified: head/usr.sbin/pw/pw_conf.c Modified: head/usr.sbin/pw/pw_conf.c ============================================================================== --- head/usr.sbin/pw/pw_conf.c Sat Aug 1 10:40:17 2015 (r286153) +++ head/usr.sbin/pw/pw_conf.c Sat Aug 1 11:31:59 2015 (r286154) @@ -228,9 +228,9 @@ read_userconfig(char const * file) { FILE *fp; char *buf, *p; + const char *errstr; size_t linecap; ssize_t linelen; - const char *errstr; buf = NULL; linecap = 0; @@ -325,49 +325,55 @@ read_userconfig(char const * file) break; case _UC_MINUID: if ((q = unquote(q)) != NULL) { - errstr = NULL; - config.min_uid = strtounum(q, 0, UID_MAX, &errstr); + config.min_uid = strtounum(q, 0, + UID_MAX, &errstr); if (errstr) - warnx("Invalid min_uid: '%s', ignoring", q); + warnx("Invalid min_uid: '%s';" + " ignoring", q); } break; case _UC_MAXUID: if ((q = unquote(q)) != NULL) { - errstr = NULL; - config.max_uid = strtounum(q, 0, UID_MAX, &errstr); + config.max_uid = strtounum(q, 0, + UID_MAX, &errstr); if (errstr) - warnx("Invalid max_uid: '%s', ignoring", q); + warnx("Invalid max_uid: '%s';" + " ignoring", q); } break; case _UC_MINGID: - if ((q = unquote(q)) != NULL && isdigit(*q)) - errstr = NULL; - config.min_gid = strtounum(q, 0, GID_MAX, &errstr); + if ((q = unquote(q)) != NULL) { + config.min_gid = strtounum(q, 0, + GID_MAX, &errstr); if (errstr) - warnx("Invalid min_gid: '%s', ignoring", q); + warnx("Invalid min_gid: '%s';" + " ignoring", q); break; case _UC_MAXGID: if ((q = unquote(q)) != NULL) { - errstr = NULL; - config.max_gid = strtounum(q, 0, GID_MAX, &errstr); + config.max_gid = strtounum(q, 0, + GID_MAX, &errstr); if (errstr) - warnx("Invalid max_gid: '%s', ignoring", q); + warnx("Invalid max_gid: '%s';" + " ignoring", q); } break; case _UC_EXPIRE: if ((q = unquote(q)) != NULL) { - errstr = NULL; - config.expire_days = strtonum(q, 0, INT_MAX, &errstr); + config.expire_days = strtonum(q, 0, + INT_MAX, &errstr); if (errstr) - warnx("Invalid expire days: '%s', ignoring", q); + warnx("Invalid expire days:" + " '%s'; ignoring", q); } break; case _UC_PASSWORD: if ((q = unquote(q)) != NULL) { - errstr = NULL; - config.password_days = strtonum(q, 0, INT_MAX, &errstr); + config.password_days = strtonum(q, 0, + INT_MAX, &errstr); if (errstr) - warnx("Invalid password days: '%s', ignoring", q); + warnx("Invalid password days:" + " '%s'; ignoring", q); } break; case _UC_FIELDS: From owner-svn-src-all@freebsd.org Sat Aug 1 11:52:49 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DFCE29B0A31; Sat, 1 Aug 2015 11:52:49 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D0698771; Sat, 1 Aug 2015 11:52:49 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t71Bqnv8017346; Sat, 1 Aug 2015 11:52:49 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t71BqnJK017345; Sat, 1 Aug 2015 11:52:49 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201508011152.t71BqnJK017345@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 1 Aug 2015 11:52:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286155 - head/usr.sbin/pw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 11:52:50 -0000 Author: bapt Date: Sat Aug 1 11:52:48 2015 New Revision: 286155 URL: https://svnweb.freebsd.org/changeset/base/286155 Log: Fix build Modified: head/usr.sbin/pw/pw_conf.c Modified: head/usr.sbin/pw/pw_conf.c ============================================================================== --- head/usr.sbin/pw/pw_conf.c Sat Aug 1 11:31:59 2015 (r286154) +++ head/usr.sbin/pw/pw_conf.c Sat Aug 1 11:52:48 2015 (r286155) @@ -348,6 +348,7 @@ read_userconfig(char const * file) if (errstr) warnx("Invalid min_gid: '%s';" " ignoring", q); + } break; case _UC_MAXGID: if ((q = unquote(q)) != NULL) { From owner-svn-src-all@freebsd.org Sat Aug 1 12:18:50 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9010A9AE57C; Sat, 1 Aug 2015 12:18:50 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 73F38138B; Sat, 1 Aug 2015 12:18:50 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t71CIoFj025626; Sat, 1 Aug 2015 12:18:50 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t71CInhD025620; Sat, 1 Aug 2015 12:18:49 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201508011218.t71CInhD025620@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 1 Aug 2015 12:18:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286156 - head/usr.sbin/pw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 12:18:50 -0000 Author: bapt Date: Sat Aug 1 12:18:48 2015 New Revision: 286156 URL: https://svnweb.freebsd.org/changeset/base/286156 Log: Partial revert of r286152 More work needed on the cli validation Modified: head/usr.sbin/pw/pw.c head/usr.sbin/pw/pw_conf.c head/usr.sbin/pw/pw_user.c head/usr.sbin/pw/pwupd.h Modified: head/usr.sbin/pw/pw.c ============================================================================== --- head/usr.sbin/pw/pw.c Sat Aug 1 11:52:48 2015 (r286155) +++ head/usr.sbin/pw/pw.c Sat Aug 1 12:18:48 2015 (r286156) @@ -262,11 +262,6 @@ main(int argc, char *argv[]) case 'c': conf.gecos = pw_checkname(optarg, 1); break; - case 'e': - conf.expire_days = strtonum(optarg, 0, INT_MAX, &errstr); - if (errstr) - errx(EX_USAGE, "Invalid expired days: %s", optarg); - break; case 'g': if (which == 0) { /* for user* */ addarg(&arglist, 'g', optarg); @@ -326,11 +321,6 @@ main(int argc, char *argv[]) case 'o': conf.checkduplicate = false; break; - case 'p': - conf.password_days = strtonum(optarg, 0, INT_MAX, &errstr); - if (errstr) - errx(EX_USAGE, "Invalid password days: %s", optarg); - break; case 'q': conf.quiet = true; break; Modified: head/usr.sbin/pw/pw_conf.c ============================================================================== --- head/usr.sbin/pw/pw_conf.c Sat Aug 1 11:52:48 2015 (r286155) +++ head/usr.sbin/pw/pw_conf.c Sat Aug 1 12:18:48 2015 (r286156) @@ -367,6 +367,8 @@ read_userconfig(char const * file) warnx("Invalid expire days:" " '%s'; ignoring", q); } + if ((q = unquote(q)) != NULL && isdigit(*q)) + config.expire_days = atoi(q); break; case _UC_PASSWORD: if ((q = unquote(q)) != NULL) { Modified: head/usr.sbin/pw/pw_user.c ============================================================================== --- head/usr.sbin/pw/pw_user.c Sat Aug 1 11:52:48 2015 (r286155) +++ head/usr.sbin/pw/pw_user.c Sat Aug 1 12:18:48 2015 (r286156) @@ -418,14 +418,14 @@ pw_user(int mode, char *name, long id, s errx(EX_OSFILE, "root home `%s' is not a directory", cnf->home); } - if (conf.expire_days > 0) - cnf->expire_days = conf.expire_days; + if ((arg = getarg(args, 'e')) != NULL) + cnf->expire_days = atoi(arg->val); if ((arg = getarg(args, 'y')) != NULL) cnf->nispasswd = arg->val; - if (conf.password_days > 0) - cnf->password_days = conf.password_days; + if ((arg = getarg(args, 'p')) != NULL && arg->val) + cnf->password_days = atoi(arg->val); if ((arg = getarg(args, 'g')) != NULL) { if (!*(p = arg->val)) /* Handle empty group list specially */ Modified: head/usr.sbin/pw/pwupd.h ============================================================================== --- head/usr.sbin/pw/pwupd.h Sat Aug 1 11:52:48 2015 (r286155) +++ head/usr.sbin/pw/pwupd.h Sat Aug 1 12:18:48 2015 (r286156) @@ -86,8 +86,6 @@ struct pwconf { char *newname; char *config; char *gecos; - int expire_days; - int password_days; int fd; int rootfd; int which; From owner-svn-src-all@freebsd.org Sat Aug 1 12:20:56 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3DC79AE6F9; Sat, 1 Aug 2015 12:20:56 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9498915F4; Sat, 1 Aug 2015 12:20:56 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t71CKuwE027411; Sat, 1 Aug 2015 12:20:56 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t71CKusR027410; Sat, 1 Aug 2015 12:20:56 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201508011220.t71CKusR027410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sat, 1 Aug 2015 12:20:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286157 - head/usr.sbin/pw X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 12:20:56 -0000 Author: bapt Date: Sat Aug 1 12:20:55 2015 New Revision: 286157 URL: https://svnweb.freebsd.org/changeset/base/286157 Log: Remove things that crept in after badly checked revert Modified: head/usr.sbin/pw/pw_conf.c Modified: head/usr.sbin/pw/pw_conf.c ============================================================================== --- head/usr.sbin/pw/pw_conf.c Sat Aug 1 12:18:48 2015 (r286156) +++ head/usr.sbin/pw/pw_conf.c Sat Aug 1 12:20:55 2015 (r286157) @@ -367,8 +367,6 @@ read_userconfig(char const * file) warnx("Invalid expire days:" " '%s'; ignoring", q); } - if ((q = unquote(q)) != NULL && isdigit(*q)) - config.expire_days = atoi(q); break; case _UC_PASSWORD: if ((q = unquote(q)) != NULL) { From owner-svn-src-all@freebsd.org Sat Aug 1 13:36:33 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B73439B0434; Sat, 1 Aug 2015 13:36:33 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mailhost.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B114117E; Sat, 1 Aug 2015 13:36:33 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id BFC86358C66; Sat, 1 Aug 2015 15:36:29 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 94A8928494; Sat, 1 Aug 2015 15:36:29 +0200 (CEST) Date: Sat, 1 Aug 2015 15:36:29 +0200 From: Jilles Tjoelker To: Bruce Evans Cc: Baptiste Daroussin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r285985 - in head/usr.sbin/pw: . tests Message-ID: <20150801133629.GA94932@stack.nl> References: <201507282110.t6SLAx0k035167@repo.freebsd.org> <20150729080932.S5059@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150729080932.S5059@besplex.bde.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 13:36:33 -0000 On Wed, Jul 29, 2015 at 08:52:52AM +1000, Bruce Evans wrote: > On Tue, 28 Jul 2015, Baptiste Daroussin wrote: > > Added: head/usr.sbin/pw/tests/pw_groupadd.sh > > ============================================================================== > > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > > +++ head/usr.sbin/pw/tests/pw_groupadd.sh Tue Jul 28 21:10:58 2015 (r285985) > > @@ -0,0 +1,15 @@ > > +# $FreeBSD$ > > + > > +# Import helper functions > > +. $(atf_get_srcdir)/helper_functions.shin > > + > > +atf_test_case group_add_gid_too_large > > +group_add_gid_too_large_body() { > > + populate_etc_skel > > + atf_check -s exit:64 -e inline:"pw: Bad id '9999999999999': too large\n" \ > > + ${PW} groupadd -n test1 -g 9999999999999 > > +} > Check for large valid ids on i386 (should succeed, but currently fail), > negative ids (require failure), magic ids like (uid_t)-1 and (uid_t)-2 > (should fail, but currently succeed on amd64), and the hex ids (should > succeed, but currently fail). (uid_t)-1 is special for some syscalls, > so shouldn't be permitted for users. (uid_t)-2 special for nfs (see > exports(5)). The magic ids are hard to spell without using hex, but > pw is too broken to accept that. For 32-bit ids, the above number > should be replaced by 0x100000000 when pw supports hex. Also check > that 0xffffffff and 0xfffffffe are not too large, but reserved, and > that 0xfffffffd is not too large and not reserved. These values are easily written using arithmetic expansion, for example largeid=$((0x100000000)). When using strtol() or similar functions, accepting hex typically implies accepting octal as well, which causes confusing and POSIX-violating results like 010 interpreted as eight. -- Jilles Tjoelker From owner-svn-src-all@freebsd.org Sat Aug 1 14:34:27 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1389B9B0C0F; Sat, 1 Aug 2015 14:34:27 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [199.48.133.146]) by mx1.freebsd.org (Postfix) with ESMTP id E2B89967; Sat, 1 Aug 2015 14:34:25 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from coconut.local (173-19-243-56.client.mchsi.com [173.19.243.56]) by smtp.vangyzen.net (Postfix) with ESMTPSA id DB3F556487; Sat, 1 Aug 2015 09:34:18 -0500 (CDT) Subject: Re: svn commit: r286144 - head/usr.bin/wall To: "Pedro F. Giffuni" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201508010129.t711TuAv036881@repo.freebsd.org> From: Eric van Gyzen Message-ID: <55BCD8E3.3070607@FreeBSD.org> Date: Sat, 1 Aug 2015 09:34:11 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <201508010129.t711TuAv036881@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 14:34:27 -0000 On 7/31/15 8:29 PM, Pedro F. Giffuni wrote: > Author: pfg > Date: Sat Aug 1 01:29:55 2015 > New Revision: 286144 > URL: https://svnweb.freebsd.org/changeset/base/286144 > > Log: > Buffer overflow in wall(1). > > Revert r286102 and apply a cleaner fix. > Tested for overflows by FORTIFY_SOURCE GSoC (with clang). > > Suggested by: bde > Reviewed by: Oliver Pinter > Tested by: Oliver Pinter > MFC after: 3 days > > Modified: > head/usr.bin/wall/ttymsg.c > > Modified: head/usr.bin/wall/ttymsg.c > ============================================================================== > --- head/usr.bin/wall/ttymsg.c Fri Jul 31 23:40:18 2015 (r286143) > +++ head/usr.bin/wall/ttymsg.c Sat Aug 1 01:29:55 2015 (r286144) > @@ -62,7 +62,7 @@ ttymsg(struct iovec *iov, int iovcnt, co > struct iovec localiov[7]; > ssize_t left, wret; > int cnt, fd; > - char device[MAXNAMLEN] = _PATH_DEV; > + char device[MAXNAMLEN]; > static char errbuf[1024]; > char *p; > int forked; > @@ -71,8 +71,9 @@ ttymsg(struct iovec *iov, int iovcnt, co > if (iovcnt > (int)(sizeof(localiov) / sizeof(localiov[0]))) > return ("too many iov's (change code in wall/ttymsg.c)"); > > - strlcat(device, line, sizeof(device)); > + strlcpy(device, _PATH_DEV, sizeof(device)); > p = device + sizeof(_PATH_DEV) - 1; > + strlcpy(p, line, sizeof(device) - sizeof(_PATH_DEV)); You're probably already sick of this change, but I would encourage this instead: strlcat(device, line, sizeof(device)); Your current code works, and it's even more efficient than strlcat. However, doing arithmetic on either the first or third argument to strlcpy/strlcat is precisely what caused the overflow that you're fixing. In fact, the size passed by the current code is one byte too small. This is obviously not a real concern in this code, but it demonstrates how easy it is to get these calculations wrong. > if (strncmp(p, "pts/", 4) == 0) > p += 4; > if (strchr(p, '/') != NULL) { > From owner-svn-src-all@freebsd.org Sat Aug 1 15:00:54 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 627089AF155 for ; Sat, 1 Aug 2015 15:00:54 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm29-vm1.bullet.mail.bf1.yahoo.com (nm29-vm1.bullet.mail.bf1.yahoo.com [98.139.213.144]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 20178106A for ; Sat, 1 Aug 2015 15:00:54 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1438441251; bh=OIjdZa74z9/XY5CcJQLoYfSchv+YN4LLsJdfSox228o=; h=Subject:To:References:From:Date:In-Reply-To:From:Subject; b=WL6ANTJzjrrLnazRbbrTqCHKR41+5bY8r0eUR3pcWA0OW/jW8tbEaJzt3bEY1FglWQk9f8UcTdSg1GW0fvVJl0hjOVwwzZsXFQgAqtAiG0w+gHHERZCmiy+sDRLDDAXc+OoqxVNOedIDP1gqNa4aOUlysh9u/0PjLUmHUIs+ZXaCj3lZnXsoF1UGUrVxnkrqAiUFaDQXwHx9lHpZos911gFIlOcahHgotGLGz4iaogS9SMqWKGtJVzq4h1xlPt85ypbEIr2L8EKoEDlbAgyHI0Q42Qj3+5/cjXySwJo+ZqMIvdGpHPdbZM7cjm+8M8Qr7Clvdahqow6FjImIlhOXdw== Received: from [66.196.81.172] by nm29.bullet.mail.bf1.yahoo.com with NNFMP; 01 Aug 2015 15:00:51 -0000 Received: from [98.139.211.161] by tm18.bullet.mail.bf1.yahoo.com with NNFMP; 01 Aug 2015 15:00:51 -0000 Received: from [127.0.0.1] by smtp218.mail.bf1.yahoo.com with NNFMP; 01 Aug 2015 15:00:51 -0000 X-Yahoo-Newman-Id: 603477.82493.bm@smtp218.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: FppnWUgVM1lErMSpuPMpx9PjLc0M7Y03pHG9b_roiSUVmEE QpDs5_tJCYcndMgLY2LTo5t1B0qddgUG9gbhYbgSHYdBb9zmyAPS6U7VYcP6 c3fIxjy1JGv1i91EWk0KZUbx9laPsVqTvqb3ucCWI_VlXzMc.bJw.Zf2bKru ggMKU3eBUlBeU4q_03OxG1dLpCL.VGIRgdxWaq7e1Ntih.SsB3DZEhZZAPfA 38pu1a9sVVnNK.cx8KWTSJ0SwTO0r6MzHqmLQ8wHDPw9PGTzIfZQEupHT4Ae fZzvoKq_qSBl99.pYMRfFcpzoQlR13boJLvqfjIpMC8M.JpDm1jISisVIfG5 C3pJEYm.sI_sMl7ERTMK0joCQGm_dSDjFvB5DaRwFxG3Gj6X.rpH.CvITGz2 BCSyxxe8ArQyf5qkvz3f7PeF86oRVffIm_6j8Eo.qfnXKPHK.cRu48QVtoD7 ZaFW5qK2kDjk55Icazm_vzvOrdPZlfDBiW217MMXIGvl38ODMR6pz78ExCmt 1m2LYd.KFpEnpV4oVpIwkGoNb._aUjJNB X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r286144 - head/usr.bin/wall To: Eric van Gyzen , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201508010129.t711TuAv036881@repo.freebsd.org> <55BCD8E3.3070607@FreeBSD.org> From: Pedro Giffuni Message-ID: <55BCDF2D.8000700@FreeBSD.org> Date: Sat, 1 Aug 2015 10:01:01 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <55BCD8E3.3070607@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 15:00:54 -0000 On 08/01/15 09:34, Eric van Gyzen wrote: > On 7/31/15 8:29 PM, Pedro F. Giffuni wrote: >> Author: pfg >> Date: Sat Aug 1 01:29:55 2015 >> New Revision: 286144 >> URL: https://svnweb.freebsd.org/changeset/base/286144 >> >> Log: >> Buffer overflow in wall(1). >> >> Revert r286102 and apply a cleaner fix. >> Tested for overflows by FORTIFY_SOURCE GSoC (with clang). >> >> Suggested by: bde >> Reviewed by: Oliver Pinter >> Tested by: Oliver Pinter >> MFC after: 3 days >> >> Modified: >> head/usr.bin/wall/ttymsg.c >> >> Modified: head/usr.bin/wall/ttymsg.c >> ============================================================================== >> >> --- head/usr.bin/wall/ttymsg.c Fri Jul 31 23:40:18 2015 (r286143) >> +++ head/usr.bin/wall/ttymsg.c Sat Aug 1 01:29:55 2015 (r286144) >> @@ -62,7 +62,7 @@ ttymsg(struct iovec *iov, int iovcnt, co >> struct iovec localiov[7]; >> ssize_t left, wret; >> int cnt, fd; >> - char device[MAXNAMLEN] = _PATH_DEV; >> + char device[MAXNAMLEN]; >> static char errbuf[1024]; >> char *p; >> int forked; >> @@ -71,8 +71,9 @@ ttymsg(struct iovec *iov, int iovcnt, co >> if (iovcnt > (int)(sizeof(localiov) / sizeof(localiov[0]))) >> return ("too many iov's (change code in wall/ttymsg.c)"); >> >> - strlcat(device, line, sizeof(device)); >> + strlcpy(device, _PATH_DEV, sizeof(device)); >> p = device + sizeof(_PATH_DEV) - 1; >> + strlcpy(p, line, sizeof(device) - sizeof(_PATH_DEV)); > > You're probably already sick of this change, but I would encourage this > instead: > > strlcat(device, line, sizeof(device)); > It looks exactly like the code I just replaced ;). > Your current code works, and it's even more efficient than strlcat. Indeed, efficient is good and was the reason for the changes suggested by bde. We evaluated snprintf but costs even more. > However, doing arithmetic on either the first or third argument to > strlcpy/strlcat is precisely what caused the overflow that you're > fixing. In fact, the size passed by the current code is one byte too > small. This is obviously not a real concern in this code, but it > demonstrates how easy it is to get these calculations wrong. > Yeah, it's a benign off-by-one :(. I will fix it by using the return value of the original strlcpy so we it will be less confusing at the cost of adding a new variable. This said, the original bug is the first detected by FORTIFY_SOURCE that is not detected by Coverity, so it will be very exciting to bring FORTIFY_SOURCE to the tree. Pedro. From owner-svn-src-all@freebsd.org Sat Aug 1 16:27:55 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EFD2D9AFFB5; Sat, 1 Aug 2015 16:27:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C6DF1E08; Sat, 1 Aug 2015 16:27:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t71GRsXn025784; Sat, 1 Aug 2015 16:27:54 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t71GRr9D025781; Sat, 1 Aug 2015 16:27:53 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201508011627.t71GRr9D025781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Sat, 1 Aug 2015 16:27:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286158 - in head: sys/kern tests/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 16:27:55 -0000 Author: jhb Date: Sat Aug 1 16:27:52 2015 New Revision: 286158 URL: https://svnweb.freebsd.org/changeset/base/286158 Log: Clear P_TRACED before reparenting a detached process back to its original parent. Otherwise the debugee will be set as an orphan of the debugger. Add tests for tracing forks via PT_FOLLOW_FORK. Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D2809 Modified: head/sys/kern/sys_process.c head/tests/sys/kern/ptrace_test.c Modified: head/sys/kern/sys_process.c ============================================================================== --- head/sys/kern/sys_process.c Sat Aug 1 12:20:55 2015 (r286157) +++ head/sys/kern/sys_process.c Sat Aug 1 16:27:52 2015 (r286158) @@ -947,7 +947,15 @@ kern_ptrace(struct thread *td, int req, } break; case PT_DETACH: - /* reset process parent */ + /* + * Reset the process parent. + * + * NB: This clears P_TRACED before reparenting + * a detached process back to its original + * parent. Otherwise the debugee will be set + * as an orphan of the debugger. + */ + p->p_flag &= ~(P_TRACED | P_WAITED | P_FOLLOWFORK); if (p->p_oppid != p->p_pptr->p_pid) { PROC_LOCK(p->p_pptr); sigqueue_take(p->p_ksi); @@ -963,7 +971,6 @@ kern_ptrace(struct thread *td, int req, } else CTR1(KTR_PTRACE, "PT_DETACH: pid %d", p->p_pid); p->p_oppid = 0; - p->p_flag &= ~(P_TRACED | P_WAITED | P_FOLLOWFORK); p->p_stops = 0; /* should we send SIGCHLD? */ Modified: head/tests/sys/kern/ptrace_test.c ============================================================================== --- head/tests/sys/kern/ptrace_test.c Sat Aug 1 12:20:55 2015 (r286157) +++ head/tests/sys/kern/ptrace_test.c Sat Aug 1 16:27:52 2015 (r286158) @@ -50,7 +50,7 @@ __FBSDID("$FreeBSD$"); #exp " not met"); \ } while (0) -static void __dead2 +static __dead2 void child_fail_require(const char *file, int line, const char *str) { char buf[128]; @@ -60,6 +60,58 @@ child_fail_require(const char *file, int _exit(32); } +static void +trace_me(void) +{ + + /* Attach the parent process as a tracer of this process. */ + CHILD_REQUIRE(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); + + /* Trigger a stop. */ + raise(SIGSTOP); +} + +static void +attach_child(pid_t pid) +{ + pid_t wpid; + int status; + + ATF_REQUIRE(ptrace(PT_ATTACH, pid, NULL, 0) == 0); + + wpid = waitpid(pid, &status, 0); + ATF_REQUIRE(wpid == pid); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); +} + +static void +wait_for_zombie(pid_t pid) +{ + + /* + * Wait for a process to exit. This is kind of gross, but + * there is not a better way. + */ + for (;;) { + struct kinfo_proc kp; + size_t len; + int mib[4]; + + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_PID; + mib[3] = pid; + len = sizeof(kp); + if (sysctl(mib, nitems(mib), &kp, &len, NULL, 0) == -1) { + /* The KERN_PROC_PID sysctl fails for zombies. */ + ATF_REQUIRE(errno == ESRCH); + break; + } + usleep(5000); + } +} + /* * Verify that a parent debugger process "sees" the exit of a debugged * process exactly once when attached via PT_TRACE_ME. @@ -73,10 +125,7 @@ ATF_TC_BODY(ptrace__parent_wait_after_tr ATF_REQUIRE((child = fork()) != -1); if (child == 0) { /* Child process. */ - CHILD_REQUIRE(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1); - - /* Trigger a stop. */ - raise(SIGSTOP); + trace_me(); exit(1); } @@ -131,13 +180,7 @@ ATF_TC_BODY(ptrace__parent_wait_after_at /* Parent process. */ /* Attach to the child process. */ - ATF_REQUIRE(ptrace(PT_ATTACH, child, NULL, 0) == 0); - - /* The first wait() should report the SIGSTOP from PT_ATTACH. */ - wpid = waitpid(child, &status, 0); - ATF_REQUIRE(wpid == child); - ATF_REQUIRE(WIFSTOPPED(status)); - ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + attach_child(child); /* Continue the child ignoring the SIGSTOP. */ ATF_REQUIRE(ptrace(PT_CONTINUE, child, (caddr_t)1, 0) != -1); @@ -223,27 +266,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_aft ATF_REQUIRE(read(cpipe[0], &c, sizeof(c)) == 0); close(cpipe[0]); - /* - * Wait for the child to exit. This is kind of gross, but - * there is not a better way. - */ - for (;;) { - struct kinfo_proc kp; - size_t len; - int mib[4]; - - mib[0] = CTL_KERN; - mib[1] = KERN_PROC; - mib[2] = KERN_PROC_PID; - mib[3] = child; - len = sizeof(kp); - if (sysctl(mib, nitems(mib), &kp, &len, NULL, 0) == -1) { - /* The KERN_PROC_PID sysctl fails for zombies. */ - ATF_REQUIRE(errno == ESRCH); - break; - } - usleep(5000); - } + wait_for_zombie(child); /* * This wait should return a pid of 0 to indicate no status to @@ -357,27 +380,7 @@ ATF_TC_BODY(ptrace__parent_sees_exit_aft ATF_REQUIRE(read(cpipe[0], &c, sizeof(c)) == 0); close(cpipe[0]); - /* - * Wait for the child to exit. This is kind of gross, but - * there is not a better way. - */ - for (;;) { - struct kinfo_proc kp; - size_t len; - int mib[4]; - - mib[0] = CTL_KERN; - mib[1] = KERN_PROC; - mib[2] = KERN_PROC_PID; - mib[3] = child; - len = sizeof(kp); - if (sysctl(mib, nitems(mib), &kp, &len, NULL, 0) == -1) { - /* The KERN_PROC_PID sysctl fails for zombies. */ - ATF_REQUIRE(errno == ESRCH); - break; - } - usleep(5000); - } + wait_for_zombie(child); /* * This wait should return a pid of 0 to indicate no status to @@ -401,6 +404,468 @@ ATF_TC_BODY(ptrace__parent_sees_exit_aft ATF_REQUIRE(WEXITSTATUS(status) == 1); } +/* + * The parent process should always act the same regardless of how the + * debugger is attached to it. + */ +static __dead2 void +follow_fork_parent(void) +{ + pid_t fpid, wpid; + int status; + + CHILD_REQUIRE((fpid = fork()) != -1); + + if (fpid == 0) + /* Child */ + exit(2); + + wpid = waitpid(fpid, &status, 0); + CHILD_REQUIRE(wpid == fpid); + CHILD_REQUIRE(WIFEXITED(status)); + CHILD_REQUIRE(WEXITSTATUS(status) == 2); + + exit(1); +} + +/* + * Helper routine for follow fork tests. This waits for two stops + * that report both "sides" of a fork. It returns the pid of the new + * child process. + */ +static pid_t +handle_fork_events(pid_t parent) +{ + struct ptrace_lwpinfo pl; + bool fork_reported[2]; + pid_t child, wpid; + int i, status; + + fork_reported[0] = false; + fork_reported[1] = false; + child = -1; + + /* + * Each process should report a fork event. The parent should + * report a PL_FLAG_FORKED event, and the child should report + * a PL_FLAG_CHILD event. + */ + for (i = 0; i < 2; i++) { + wpid = wait(&status); + ATF_REQUIRE(wpid > 0); + ATF_REQUIRE(WIFSTOPPED(status)); + + ATF_REQUIRE(ptrace(PT_LWPINFO, wpid, (caddr_t)&pl, + sizeof(pl)) != -1); + ATF_REQUIRE((pl.pl_flags & (PL_FLAG_FORKED | PL_FLAG_CHILD)) != + 0); + ATF_REQUIRE((pl.pl_flags & (PL_FLAG_FORKED | PL_FLAG_CHILD)) != + (PL_FLAG_FORKED | PL_FLAG_CHILD)); + if (pl.pl_flags & PL_FLAG_CHILD) { + ATF_REQUIRE(wpid != parent); + ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + ATF_REQUIRE(!fork_reported[1]); + if (child == -1) + child = wpid; + else + ATF_REQUIRE(child == wpid); + fork_reported[1] = true; + } else { + ATF_REQUIRE(wpid == parent); + ATF_REQUIRE(WSTOPSIG(status) == SIGTRAP); + ATF_REQUIRE(!fork_reported[0]); + if (child == -1) + child = pl.pl_child_pid; + else + ATF_REQUIRE(child == pl.pl_child_pid); + fork_reported[0] = true; + } + } + + return (child); +} + +/* + * Verify that a new child process is stopped after a followed fork and + * that the traced parent sees the exit of the child after the debugger + * when both processes remain attached to the debugger. + */ +ATF_TC_WITHOUT_HEAD(ptrace__follow_fork_both_attached); +ATF_TC_BODY(ptrace__follow_fork_both_attached, tc) +{ + pid_t children[0], fpid, wpid; + int status; + + ATF_REQUIRE((fpid = fork()) != -1); + if (fpid == 0) { + trace_me(); + follow_fork_parent(); + } + + /* Parent process. */ + children[0] = fpid; + + /* The first wait() should report the stop from SIGSTOP. */ + wpid = waitpid(children[0], &status, 0); + ATF_REQUIRE(wpid == children[0]); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + + ATF_REQUIRE(ptrace(PT_FOLLOW_FORK, children[0], NULL, 1) != -1); + + /* Continue the child ignoring the SIGSTOP. */ + ATF_REQUIRE(ptrace(PT_CONTINUE, children[0], (caddr_t)1, 0) != -1); + + children[1] = handle_fork_events(children[0]); + ATF_REQUIRE(children[1] > 0); + + ATF_REQUIRE(ptrace(PT_CONTINUE, children[0], (caddr_t)1, 0) != -1); + ATF_REQUIRE(ptrace(PT_CONTINUE, children[1], (caddr_t)1, 0) != -1); + + /* + * The child can't exit until the grandchild reports status, so the + * grandchild should report its exit first to the debugger. + */ + wpid = wait(&status); + ATF_REQUIRE(wpid == children[1]); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 2); + + wpid = wait(&status); + ATF_REQUIRE(wpid == children[0]); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 1); + + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); +} + +/* + * Verify that a new child process is stopped after a followed fork + * and that the traced parent sees the exit of the child when the new + * child process is detached after it reports its fork. + */ +ATF_TC_WITHOUT_HEAD(ptrace__follow_fork_child_detached); +ATF_TC_BODY(ptrace__follow_fork_child_detached, tc) +{ + pid_t children[0], fpid, wpid; + int status; + + ATF_REQUIRE((fpid = fork()) != -1); + if (fpid == 0) { + trace_me(); + follow_fork_parent(); + } + + /* Parent process. */ + children[0] = fpid; + + /* The first wait() should report the stop from SIGSTOP. */ + wpid = waitpid(children[0], &status, 0); + ATF_REQUIRE(wpid == children[0]); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + + ATF_REQUIRE(ptrace(PT_FOLLOW_FORK, children[0], NULL, 1) != -1); + + /* Continue the child ignoring the SIGSTOP. */ + ATF_REQUIRE(ptrace(PT_CONTINUE, children[0], (caddr_t)1, 0) != -1); + + children[1] = handle_fork_events(children[0]); + ATF_REQUIRE(children[1] > 0); + + ATF_REQUIRE(ptrace(PT_CONTINUE, children[0], (caddr_t)1, 0) != -1); + ATF_REQUIRE(ptrace(PT_DETACH, children[1], (caddr_t)1, 0) != -1); + + /* + * Should not see any status from the grandchild now, only the + * child. + */ + wpid = wait(&status); + ATF_REQUIRE(wpid == children[0]); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 1); + + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); +} + +/* + * Verify that a new child process is stopped after a followed fork + * and that the traced parent sees the exit of the child when the + * traced parent is detached after the fork. + */ +ATF_TC_WITHOUT_HEAD(ptrace__follow_fork_parent_detached); +ATF_TC_BODY(ptrace__follow_fork_parent_detached, tc) +{ + pid_t children[0], fpid, wpid; + int status; + + ATF_REQUIRE((fpid = fork()) != -1); + if (fpid == 0) { + trace_me(); + follow_fork_parent(); + } + + /* Parent process. */ + children[0] = fpid; + + /* The first wait() should report the stop from SIGSTOP. */ + wpid = waitpid(children[0], &status, 0); + ATF_REQUIRE(wpid == children[0]); + ATF_REQUIRE(WIFSTOPPED(status)); + ATF_REQUIRE(WSTOPSIG(status) == SIGSTOP); + + ATF_REQUIRE(ptrace(PT_FOLLOW_FORK, children[0], NULL, 1) != -1); + + /* Continue the child ignoring the SIGSTOP. */ + ATF_REQUIRE(ptrace(PT_CONTINUE, children[0], (caddr_t)1, 0) != -1); + + children[1] = handle_fork_events(children[0]); + ATF_REQUIRE(children[1] > 0); + + ATF_REQUIRE(ptrace(PT_DETACH, children[0], (caddr_t)1, 0) != -1); + ATF_REQUIRE(ptrace(PT_CONTINUE, children[1], (caddr_t)1, 0) != -1); + + /* + * The child can't exit until the grandchild reports status, so the + * grandchild should report its exit first to the debugger. + * + * Even though the child process is detached, it is still a + * child of the debugger, so it will still report it's exit + * after the grandchild. + */ + wpid = wait(&status); + ATF_REQUIRE(wpid == children[1]); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 2); + + wpid = wait(&status); + ATF_REQUIRE(wpid == children[0]); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 1); + + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); +} + +static void +attach_fork_parent(int cpipe[2]) +{ + pid_t fpid; + + close(cpipe[0]); + + /* Double-fork to disassociate from the debugger. */ + CHILD_REQUIRE((fpid = fork()) != -1); + if (fpid != 0) + exit(3); + + /* Send the pid of the disassociated child to the debugger. */ + fpid = getpid(); + CHILD_REQUIRE(write(cpipe[1], &fpid, sizeof(fpid)) == sizeof(fpid)); + + /* Wait for the debugger to attach. */ + CHILD_REQUIRE(read(cpipe[1], &fpid, sizeof(fpid)) == 0); +} + +/* + * Verify that a new child process is stopped after a followed fork and + * that the traced parent sees the exit of the child after the debugger + * when both processes remain attached to the debugger. In this test + * the parent that forks is not a direct child of the debugger. + */ +ATF_TC_WITHOUT_HEAD(ptrace__follow_fork_both_attached_unrelated_debugger); +ATF_TC_BODY(ptrace__follow_fork_both_attached_unrelated_debugger, tc) +{ + pid_t children[0], fpid, wpid; + int cpipe[2], status; + + ATF_REQUIRE(pipe(cpipe) == 0); + ATF_REQUIRE((fpid = fork()) != -1); + if (fpid == 0) { + attach_fork_parent(cpipe); + follow_fork_parent(); + } + + /* Parent process. */ + close(cpipe[1]); + + /* Wait for the direct child to exit. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 3); + + /* Read the pid of the fork parent. */ + ATF_REQUIRE(read(cpipe[0], &children[0], sizeof(children[0])) == + sizeof(children[0])); + + /* Attach to the fork parent. */ + attach_child(children[0]); + + ATF_REQUIRE(ptrace(PT_FOLLOW_FORK, children[0], NULL, 1) != -1); + + /* Continue the fork parent ignoring the SIGSTOP. */ + ATF_REQUIRE(ptrace(PT_CONTINUE, children[0], (caddr_t)1, 0) != -1); + + /* Signal the fork parent to continue. */ + close(cpipe[0]); + + children[1] = handle_fork_events(children[0]); + ATF_REQUIRE(children[1] > 0); + + ATF_REQUIRE(ptrace(PT_CONTINUE, children[0], (caddr_t)1, 0) != -1); + ATF_REQUIRE(ptrace(PT_CONTINUE, children[1], (caddr_t)1, 0) != -1); + + /* + * The fork parent can't exit until the child reports status, + * so the child should report its exit first to the debugger. + */ + wpid = wait(&status); + ATF_REQUIRE(wpid == children[1]); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 2); + + wpid = wait(&status); + ATF_REQUIRE(wpid == children[0]); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 1); + + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); +} + +/* + * Verify that a new child process is stopped after a followed fork + * and that the traced parent sees the exit of the child when the new + * child process is detached after it reports its fork. In this test + * the parent that forks is not a direct child of the debugger. + */ +ATF_TC_WITHOUT_HEAD(ptrace__follow_fork_child_detached_unrelated_debugger); +ATF_TC_BODY(ptrace__follow_fork_child_detached_unrelated_debugger, tc) +{ + pid_t children[0], fpid, wpid; + int cpipe[2], status; + + ATF_REQUIRE(pipe(cpipe) == 0); + ATF_REQUIRE((fpid = fork()) != -1); + if (fpid == 0) { + attach_fork_parent(cpipe); + follow_fork_parent(); + } + + /* Parent process. */ + close(cpipe[1]); + + /* Wait for the direct child to exit. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 3); + + /* Read the pid of the fork parent. */ + ATF_REQUIRE(read(cpipe[0], &children[0], sizeof(children[0])) == + sizeof(children[0])); + + /* Attach to the fork parent. */ + attach_child(children[0]); + + ATF_REQUIRE(ptrace(PT_FOLLOW_FORK, children[0], NULL, 1) != -1); + + /* Continue the fork parent ignoring the SIGSTOP. */ + ATF_REQUIRE(ptrace(PT_CONTINUE, children[0], (caddr_t)1, 0) != -1); + + /* Signal the fork parent to continue. */ + close(cpipe[0]); + + children[1] = handle_fork_events(children[0]); + ATF_REQUIRE(children[1] > 0); + + ATF_REQUIRE(ptrace(PT_CONTINUE, children[0], (caddr_t)1, 0) != -1); + ATF_REQUIRE(ptrace(PT_DETACH, children[1], (caddr_t)1, 0) != -1); + + /* + * Should not see any status from the child now, only the fork + * parent. + */ + wpid = wait(&status); + ATF_REQUIRE(wpid == children[0]); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 1); + + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); +} + +/* + * Verify that a new child process is stopped after a followed fork + * and that the traced parent sees the exit of the child when the + * traced parent is detached after the fork. In this test the parent + * that forks is not a direct child of the debugger. + */ +ATF_TC_WITHOUT_HEAD(ptrace__follow_fork_parent_detached_unrelated_debugger); +ATF_TC_BODY(ptrace__follow_fork_parent_detached_unrelated_debugger, tc) +{ + pid_t children[0], fpid, wpid; + int cpipe[2], status; + + ATF_REQUIRE(pipe(cpipe) == 0); + ATF_REQUIRE((fpid = fork()) != -1); + if (fpid == 0) { + attach_fork_parent(cpipe); + follow_fork_parent(); + } + + /* Parent process. */ + close(cpipe[1]); + + /* Wait for the direct child to exit. */ + wpid = waitpid(fpid, &status, 0); + ATF_REQUIRE(wpid == fpid); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 3); + + /* Read the pid of the fork parent. */ + ATF_REQUIRE(read(cpipe[0], &children[0], sizeof(children[0])) == + sizeof(children[0])); + + /* Attach to the fork parent. */ + attach_child(children[0]); + + ATF_REQUIRE(ptrace(PT_FOLLOW_FORK, children[0], NULL, 1) != -1); + + /* Continue the fork parent ignoring the SIGSTOP. */ + ATF_REQUIRE(ptrace(PT_CONTINUE, children[0], (caddr_t)1, 0) != -1); + + /* Signal the fork parent to continue. */ + close(cpipe[0]); + + children[1] = handle_fork_events(children[0]); + ATF_REQUIRE(children[1] > 0); + + ATF_REQUIRE(ptrace(PT_DETACH, children[0], (caddr_t)1, 0) != -1); + ATF_REQUIRE(ptrace(PT_CONTINUE, children[1], (caddr_t)1, 0) != -1); + + /* + * Should not see any status from the fork parent now, only + * the child. + */ + wpid = wait(&status); + ATF_REQUIRE(wpid == children[1]); + ATF_REQUIRE(WIFEXITED(status)); + ATF_REQUIRE(WEXITSTATUS(status) == 2); + + wpid = wait(&status); + ATF_REQUIRE(wpid == -1); + ATF_REQUIRE(errno == ECHILD); +} + ATF_TP_ADD_TCS(tp) { @@ -408,6 +873,14 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, ptrace__parent_wait_after_attach); ATF_TP_ADD_TC(tp, ptrace__parent_sees_exit_after_child_debugger); ATF_TP_ADD_TC(tp, ptrace__parent_sees_exit_after_unrelated_debugger); + ATF_TP_ADD_TC(tp, ptrace__follow_fork_both_attached); + ATF_TP_ADD_TC(tp, ptrace__follow_fork_child_detached); + ATF_TP_ADD_TC(tp, ptrace__follow_fork_parent_detached); + ATF_TP_ADD_TC(tp, ptrace__follow_fork_both_attached_unrelated_debugger); + ATF_TP_ADD_TC(tp, + ptrace__follow_fork_child_detached_unrelated_debugger); + ATF_TP_ADD_TC(tp, + ptrace__follow_fork_parent_detached_unrelated_debugger); return (atf_no_error()); } From owner-svn-src-all@freebsd.org Sat Aug 1 16:59:10 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74B1D9B054F; Sat, 1 Aug 2015 16:59:10 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id BB9111A43; Sat, 1 Aug 2015 16:59:09 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from c211-30-166-197.carlnfd1.nsw.optusnet.com.au (c211-30-166-197.carlnfd1.nsw.optusnet.com.au [211.30.166.197]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 1A68578299F; Sun, 2 Aug 2015 02:59:07 +1000 (AEST) Date: Sun, 2 Aug 2015 02:59:00 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Jilles Tjoelker cc: Bruce Evans , Baptiste Daroussin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r285985 - in head/usr.sbin/pw: . tests In-Reply-To: <20150801133629.GA94932@stack.nl> Message-ID: <20150802022204.O3247@besplex.bde.org> References: <201507282110.t6SLAx0k035167@repo.freebsd.org> <20150729080932.S5059@besplex.bde.org> <20150801133629.GA94932@stack.nl> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.1 cv=eZjABOwH c=1 sm=1 tr=0 a=KA6XNC2GZCFrdESI5ZmdjQ==:117 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=kj9zAlcOel0A:10 a=NG6BQcbVkOJyrkRegQsA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 16:59:10 -0000 On Sat, 1 Aug 2015, Jilles Tjoelker wrote: > On Wed, Jul 29, 2015 at 08:52:52AM +1000, Bruce Evans wrote: >> On Tue, 28 Jul 2015, Baptiste Daroussin wrote: >>> Added: head/usr.sbin/pw/tests/pw_groupadd.sh >>> ============================================================================== >>> --- /dev/null 00:00:00 1970 (empty, because file is newly added) >>> +++ head/usr.sbin/pw/tests/pw_groupadd.sh Tue Jul 28 21:10:58 2015 (r285985) >>> @@ -0,0 +1,15 @@ >>> +# $FreeBSD$ >>> + >>> +# Import helper functions >>> +. $(atf_get_srcdir)/helper_functions.shin >>> + >>> +atf_test_case group_add_gid_too_large >>> +group_add_gid_too_large_body() { >>> + populate_etc_skel >>> + atf_check -s exit:64 -e inline:"pw: Bad id '9999999999999': too large\n" \ >>> + ${PW} groupadd -n test1 -g 9999999999999 >>> +} > >> Check for large valid ids on i386 (should succeed, but currently fail), >> negative ids (require failure), magic ids like (uid_t)-1 and (uid_t)-2 >> (should fail, but currently succeed on amd64), and the hex ids (should >> succeed, but currently fail). (uid_t)-1 is special for some syscalls, >> so shouldn't be permitted for users. (uid_t)-2 special for nfs (see >> exports(5)). The magic ids are hard to spell without using hex, but >> pw is too broken to accept that. For 32-bit ids, the above number >> should be replaced by 0x100000000 when pw supports hex. Also check >> that 0xffffffff and 0xfffffffe are not too large, but reserved, and >> that 0xfffffffd is not too large and not reserved. > > These values are easily written using arithmetic expansion, for example > largeid=$((0x100000000)). Not really. Shells are also very buggy or limited in this area. I often use old versions of sh and bash that only support up to INT32_MAX and have broken overflow handling. /bin/sh in -current only supports up to INT64_MAX (or maybe INTMAX_MAX) and has broken overflow handling (it clamps to INT64_MAX). Not so old versions of bash only support up to INT64_MAX and have differently broken overflow handling (4.3.99 blindly assigns to int64_t, so $((0x8000000000000000)) becomes -0x8000000000000000. expr is also limited to INT64_MAX, but attempts to have non-broken overflow handling. > When using strtol() or similar functions, accepting hex typically > implies accepting octal as well, which causes confusing and > POSIX-violating results like 010 interpreted as eight. This is a problem. strtonum could accept hex but not octal by calling strtoimax() twice for bases 10 and 16. Also dehumanized formats like 1k and 1K. It should also actually accept numbers as input. 1.1e1 if not I * Pi. Bruce From owner-svn-src-all@freebsd.org Sat Aug 1 17:27:48 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1ED99B0970; Sat, 1 Aug 2015 17:27:48 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 91A387C3; Sat, 1 Aug 2015 17:27:48 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t71HRmsZ049932; Sat, 1 Aug 2015 17:27:48 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t71HRms2049931; Sat, 1 Aug 2015 17:27:48 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <201508011727.t71HRms2049931@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Sat, 1 Aug 2015 17:27:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286159 - head/usr.bin/getopt X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 17:27:48 -0000 Author: jmg Date: Sat Aug 1 17:27:47 2015 New Revision: 286159 URL: https://svnweb.freebsd.org/changeset/base/286159 Log: use : instead of true... Change file file to file1 file2, partly for igor, and partly because it's odd to pass the same file to a command twice.. Modified: head/usr.bin/getopt/getopt.1 Modified: head/usr.bin/getopt/getopt.1 ============================================================================== --- head/usr.bin/getopt/getopt.1 Sat Aug 1 16:27:52 2015 (r286158) +++ head/usr.bin/getopt/getopt.1 Sat Aug 1 17:27:47 2015 (r286159) @@ -1,6 +1,6 @@ .\" $FreeBSD$ .\" -.Dd January 26, 2011 +.Dd August 1, 2015 .Dt GETOPT 1 .Os .Sh NAME @@ -62,7 +62,7 @@ set \-\- $args # You cannot use the set command with a backquoted getopt directly, # since the exit code from getopt would be shadowed by those of set, # which is zero by definition. -while true; do +while :; do case "$1" in \-a|\-b) echo "flag $1 set"; sflags="${1#-}$sflags" @@ -83,10 +83,10 @@ echo "oarg is '$oarg'" .Pp This code will accept any of the following as equivalent: .Bd -literal -offset indent -cmd \-aoarg file file -cmd \-a \-o arg file file -cmd \-oarg -a file file -cmd \-a \-oarg \-\- file file +cmd \-aoarg file1 file2 +cmd \-a \-o arg file1 file2 +cmd \-oarg -a file1 file2 +cmd \-a \-oarg \-\- file1 file2 .Ed .Sh SEE ALSO .Xr getopts 1 , From owner-svn-src-all@freebsd.org Sat Aug 1 17:29:54 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 422A69B09B0; Sat, 1 Aug 2015 17:29:54 +0000 (UTC) (envelope-from junovitch@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 16F1992F; Sat, 1 Aug 2015 17:29:54 +0000 (UTC) (envelope-from junovitch@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t71HTr8Y050066; Sat, 1 Aug 2015 17:29:53 GMT (envelope-from junovitch@FreeBSD.org) Received: (from junovitch@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t71HTru4050064; Sat, 1 Aug 2015 17:29:53 GMT (envelope-from junovitch@FreeBSD.org) Message-Id: <201508011729.t71HTru4050064@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: junovitch set sender to junovitch@FreeBSD.org using -f From: Jason Unovitch Date: Sat, 1 Aug 2015 17:29:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286160 - in head: share/misc usr.bin/calendar/calendars X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 17:29:54 -0000 Author: junovitch (ports committer) Date: Sat Aug 1 17:29:52 2015 New Revision: 286160 URL: https://svnweb.freebsd.org/changeset/base/286160 Log: - Add myself to the committers-ports.dot and add my mentor relationship. - Add myself to the calendar.freebsd. Approved by: delphij (mentor) Differential Revision: https://reviews.FreeBSD.org/D3265 Modified: head/share/misc/committers-ports.dot head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/share/misc/committers-ports.dot ============================================================================== --- head/share/misc/committers-ports.dot Sat Aug 1 17:27:47 2015 (r286159) +++ head/share/misc/committers-ports.dot Sat Aug 1 17:29:52 2015 (r286160) @@ -128,6 +128,7 @@ johans [label="Johan Selst\njohans@FreeB josef [label="Josef El-Rayes\njosef@FreeBSD.org\n2004/12/20"] jpaetzel [label="Josh Paetzel\njpaetzel@FreeBSD.org\n2008/09/05"] jsa [label="Joseph S. Atkinson\njsa@FreeBSD.org\n2010/07/15"] +junovitch [label="Jason Unovitch\njunovitch@FreeBSD.org\n2015/07/27"] jylefort [label="Jean-Yves Lefort\njylefort@FreeBSD.org\n2005/04/12"] kami [label="Dominic Fandrey\nkami@FreeBSD.org\n2014/09/09"] kevlo [label="Kevin Lo\nkevlo@FreeBSD.org\n2003/02/21"] @@ -315,6 +316,7 @@ db -> tj decke -> sperber +delphij -> junovitch delphij -> nemoliu delphij -> rafan @@ -347,6 +349,8 @@ erwin -> lbr erwin -> lth erwin -> simon +feld -> junovitch + fjoe -> danfe fjoe -> flo fjoe -> krion @@ -508,6 +512,7 @@ pawel -> nemysis pgj -> ashish pgj -> jacula +pgollucci -> junovitch pgollucci -> sunpoet pgollucci -> swills Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Sat Aug 1 17:27:47 2015 (r286159) +++ head/usr.bin/calendar/calendars/calendar.freebsd Sat Aug 1 17:29:52 2015 (r286160) @@ -122,6 +122,7 @@ 04/03 Hellmuth Michaelis born in Kiel, Schleswig-Holstein, Germany, 1958 04/03 Tong Liu born in Beijing, People's Republic of China, 1981 04/03 Gabor Pali born in Kunhegyes, Hungary, 1982 +04/04 Jason Unovitch born in Scranton, Pennsylvania, United States, 1986 04/05 Stacey Son born in Burley, Idaho, United States, 1967 04/06 Peter Jeremy born in Sydney, New South Wales, Australia, 1961 04/07 Edward Tomasz Napierala born in Wolsztyn, Poland, 1981 From owner-svn-src-all@freebsd.org Sat Aug 1 17:33:45 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E2B029B0B41; Sat, 1 Aug 2015 17:33:45 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BF8E8E94; Sat, 1 Aug 2015 17:33:45 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (75-48-78-19.lightspeed.cncrca.sbcglobal.net [75.48.78.19]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 28DF3B915; Sat, 1 Aug 2015 13:33:44 -0400 (EDT) From: John Baldwin To: Ed Schouten Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r286147 - head/sys/compat/cloudabi Date: Sat, 01 Aug 2015 08:34:23 -0700 Message-ID: <1488462.OiUCHEHk8E@ralph.baldwin.cx> User-Agent: KMail/4.14.3 (FreeBSD/10.2-PRERELEASE; KDE/4.14.3; amd64; ; ) In-Reply-To: <201508010751.t717pmVi019785@repo.freebsd.org> References: <201508010751.t717pmVi019785@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Sat, 01 Aug 2015 13:33:44 -0400 (EDT) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 17:33:46 -0000 On Saturday, August 01, 2015 07:51:48 AM Ed Schouten wrote: > Author: ed > Date: Sat Aug 1 07:51:48 2015 > New Revision: 286147 > URL: https://svnweb.freebsd.org/changeset/base/286147 > > Log: > Allow CloudABI processes to create shared memory objects. > > Summary: > Use the newly created `kern_shm_open()` function to create objects with > just the rights that are actually needed. > > Reviewers: jhb, kib > > Subscribers: imp > > Differential Revision: https://reviews.freebsd.org/D3260 Can you please not use 'arc commit'? For one, it doesn't follow the standard FreeBSD commit template (and apparently it's hard to fix or we would have done it by now), but it also isn't clear who actually reviews things. What I do is keep the URL to the review open in another window and just copy and paste the commit message and URL over to the stock template in my editor. You can then set a proper 'Reviewed by' line that reflects who actually reviewed the change as well. -- John Baldwin From owner-svn-src-all@freebsd.org Sat Aug 1 17:48:36 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB1E49B0DA2; Sat, 1 Aug 2015 17:48:36 +0000 (UTC) (envelope-from junovitch@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9B40A1451; Sat, 1 Aug 2015 17:48:36 +0000 (UTC) (envelope-from junovitch@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t71Hma4s058074; Sat, 1 Aug 2015 17:48:36 GMT (envelope-from junovitch@FreeBSD.org) Received: (from junovitch@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t71HmaH1058073; Sat, 1 Aug 2015 17:48:36 GMT (envelope-from junovitch@FreeBSD.org) Message-Id: <201508011748.t71HmaH1058073@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: junovitch set sender to junovitch@FreeBSD.org using -f From: Jason Unovitch Date: Sat, 1 Aug 2015 17:48:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286161 - head/usr.bin/calendar/calendars X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 17:48:36 -0000 Author: junovitch (ports committer) Date: Sat Aug 1 17:48:35 2015 New Revision: 286161 URL: https://svnweb.freebsd.org/changeset/base/286161 Log: - Add myself to the calendar.freebsd. (fix typo in r286160) Approved by: delphij (mentor) Differential Revision: https://reviews.FreeBSD.org/D3265 Modified: head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Sat Aug 1 17:29:52 2015 (r286160) +++ head/usr.bin/calendar/calendars/calendar.freebsd Sat Aug 1 17:48:35 2015 (r286161) @@ -122,7 +122,7 @@ 04/03 Hellmuth Michaelis born in Kiel, Schleswig-Holstein, Germany, 1958 04/03 Tong Liu born in Beijing, People's Republic of China, 1981 04/03 Gabor Pali born in Kunhegyes, Hungary, 1982 -04/04 Jason Unovitch born in Scranton, Pennsylvania, United States, 1986 +04/04 Jason Unovitch born in Scranton, Pennsylvania, United States, 1986 04/05 Stacey Son born in Burley, Idaho, United States, 1967 04/06 Peter Jeremy born in Sydney, New South Wales, Australia, 1961 04/07 Edward Tomasz Napierala born in Wolsztyn, Poland, 1981 From owner-svn-src-all@freebsd.org Sat Aug 1 19:24:23 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2477C9B0EAB; Sat, 1 Aug 2015 19:24:23 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client CN "mailhost.stack.nl", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id DE28D1E44; Sat, 1 Aug 2015 19:24:22 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from snail.stack.nl (snail.stack.nl [IPv6:2001:610:1108:5010::131]) by mx1.stack.nl (Postfix) with ESMTP id 2DABB358C59; Sat, 1 Aug 2015 21:24:20 +0200 (CEST) Received: by snail.stack.nl (Postfix, from userid 1677) id 1215B28494; Sat, 1 Aug 2015 21:24:20 +0200 (CEST) Date: Sat, 1 Aug 2015 21:24:20 +0200 From: Jilles Tjoelker To: Bruce Evans Cc: Baptiste Daroussin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r285985 - in head/usr.sbin/pw: . tests Message-ID: <20150801192419.GB94932@stack.nl> References: <201507282110.t6SLAx0k035167@repo.freebsd.org> <20150729080932.S5059@besplex.bde.org> <20150801133629.GA94932@stack.nl> <20150802022204.O3247@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150802022204.O3247@besplex.bde.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 19:24:23 -0000 On Sun, Aug 02, 2015 at 02:59:00AM +1000, Bruce Evans wrote: > On Sat, 1 Aug 2015, Jilles Tjoelker wrote: > > These values are easily written using arithmetic expansion, for example > > largeid=$((0x100000000)). > Not really. Shells are also very buggy or limited in this area. I > often use old versions of sh and bash that only support up to INT32_MAX > and have broken overflow handling. /bin/sh in -current only supports > up to INT64_MAX (or maybe INTMAX_MAX) and has broken overflow handling > (it clamps to INT64_MAX). Not so old versions of bash only support > up to INT64_MAX and have differently broken overflow handling (4.3.99 > blindly assigns to int64_t, so $((0x8000000000000000)) becomes > -0x8000000000000000. > expr is also limited to INT64_MAX, but attempts to have non-broken > overflow handling. The tests need not work with old versions of sh and bash (they already rely on many more recent features and bugfixes). The broken overflow handling in parsing literals does not affect the given example. > > When using strtol() or similar functions, accepting hex typically > > implies accepting octal as well, which causes confusing and > > POSIX-violating results like 010 interpreted as eight. > This is a problem. strtonum could accept hex but not octal by calling > strtoimax() twice for bases 10 and 16. Also dehumanized formats like > 1k and 1K. It should also actually accept numbers as input. 1.1e1 if > not I * Pi. Silently expanding what strtonum() accepts might cause breakage or even security vulnerabilities. -- Jilles Tjoelker From owner-svn-src-all@freebsd.org Sat Aug 1 20:40:38 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BAD7F9B180C; Sat, 1 Aug 2015 20:40:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A36181D75; Sat, 1 Aug 2015 20:40:38 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t71KecYn028673; Sat, 1 Aug 2015 20:40:38 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t71Kec8n028671; Sat, 1 Aug 2015 20:40:38 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201508012040.t71Kec8n028671@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sat, 1 Aug 2015 20:40:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286162 - head/sys/dev/e1000 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 20:40:38 -0000 Author: hselasky Date: Sat Aug 1 20:40:37 2015 New Revision: 286162 URL: https://svnweb.freebsd.org/changeset/base/286162 Log: Free mbufs when busdma loading fails. Reviewed by: erj, sbruno MFC after: 1 month Modified: head/sys/dev/e1000/if_em.c head/sys/dev/e1000/if_igb.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Sat Aug 1 17:48:35 2015 (r286161) +++ head/sys/dev/e1000/if_em.c Sat Aug 1 20:40:37 2015 (r286162) @@ -2029,9 +2029,6 @@ retry: /* Try it again, but only once */ remap = 0; goto retry; - } else if (error == ENOMEM) { - adapter->no_tx_dma_setup++; - return (error); } else if (error != 0) { adapter->no_tx_dma_setup++; m_freem(*m_headp); Modified: head/sys/dev/e1000/if_igb.c ============================================================================== --- head/sys/dev/e1000/if_igb.c Sat Aug 1 17:48:35 2015 (r286161) +++ head/sys/dev/e1000/if_igb.c Sat Aug 1 20:40:37 2015 (r286162) @@ -1908,9 +1908,6 @@ retry: goto retry; } else return (error); - case ENOMEM: - txr->no_tx_dma_setup++; - return (error); default: txr->no_tx_dma_setup++; m_freem(*m_headp); From owner-svn-src-all@freebsd.org Sat Aug 1 20:53:42 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8494E9B1A68 for ; Sat, 1 Aug 2015 20:53:42 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: from mail-oi0-f47.google.com (mail-oi0-f47.google.com [209.85.218.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 508F33A0 for ; Sat, 1 Aug 2015 20:53:41 +0000 (UTC) (envelope-from ed@nuxi.nl) Received: by oigu133 with SMTP id u133so11009130oig.1 for ; Sat, 01 Aug 2015 13:53:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=z8f5LE00bnRrzGTnsWtUdg0N4IAH0NSkgnbsNDP/CYI=; b=DP5x3lMxUCoxkbQ+500mQMxXLIMfGsQwCA9yjgcPila+k1qeAXjW3iIEBQ7xGoffFO 23MtfqDMY7c/XUguwxXAiP3GjT6JqqXO8tGgQ16dg61MJn/cGNq1A0+XXaP4W8/OD0ZK 9nrouy8bXnGW9PSinS4lzlv5+FjIDUxUUwEsnYlx22jnHiS0WUi1rOYufcIumdAou+lL aFPQ3bLCvQbggiriQKmg9ZbXssqgDmlkFDNpRBiRIb4mhF6GfUk9hzxnpdMIFNE9GLVa 08lYNOjkRa2JrKdf+ABtIR78WsfbWkzTOuIvEo7MTc62OK95LCzqolsrWxx4/Q/T6LCv pwKg== X-Gm-Message-State: ALoCoQn7O8dOmpAxVvMUGhqaZqWum0mtxR/e0uaW/74r0uAA9BauqYpI69Rl/uDMpgy7DAf8TfBL MIME-Version: 1.0 X-Received: by 10.202.48.22 with SMTP id w22mr9337334oiw.95.1438462414882; Sat, 01 Aug 2015 13:53:34 -0700 (PDT) Received: by 10.76.50.84 with HTTP; Sat, 1 Aug 2015 13:53:34 -0700 (PDT) X-Originating-IP: [84.27.222.46] In-Reply-To: <1488462.OiUCHEHk8E@ralph.baldwin.cx> References: <201508010751.t717pmVi019785@repo.freebsd.org> <1488462.OiUCHEHk8E@ralph.baldwin.cx> Date: Sat, 1 Aug 2015 22:53:34 +0200 Message-ID: Subject: Re: svn commit: r286147 - head/sys/compat/cloudabi From: Ed Schouten To: John Baldwin Cc: Ed Schouten , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org, phabric-admin@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 20:53:42 -0000 2015-08-01 17:34 GMT+02:00 John Baldwin : > Can you please not use 'arc commit'? Sure! That said, maybe there is something we can do to make it integrate with our workflow so that it does work the way we want. Or maybe we could somehow administratively disable 'arc commit', so that others don't do it either. Added phabric-admin@ to the CC. Maybe they have some good ideas? -- Ed Schouten Nuxi, 's-Hertogenbosch, the Netherlands KvK/VAT number: 62051717 From owner-svn-src-all@freebsd.org Sat Aug 1 21:02:08 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22A9E9B1B5F; Sat, 1 Aug 2015 21:02:08 +0000 (UTC) (envelope-from guy.helmer@gmail.com) Received: from mail-io0-x233.google.com (mail-io0-x233.google.com [IPv6:2607:f8b0:4001:c06::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E0FBFA01; Sat, 1 Aug 2015 21:02:07 +0000 (UTC) (envelope-from guy.helmer@gmail.com) Received: by ioeg141 with SMTP id g141so114912175ioe.3; Sat, 01 Aug 2015 14:02:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=xW0sl/cK85ek9mPHmPXRBFJrdIOs4dbWWJgBuGqFdxE=; b=nRAQhIF+aglT/tOcYlQuwJUeu6cSf/lSNh7ZrdcdjuGDH0bfK2vjNSd0qGq6e3uUdl 41oVnavcyTI5ve3/I5KqBHSMwtj1rQTVZMcfdg2kCf3vcZhahhZRwG2WxBqhXGwcYQN4 JkXBM552rLoQAzhMkTD/EqnFxt/zz8AWap0M0X/bjRDMRsDjV0yREEQkAJuDoIYXKtR4 RUYGyI5TTRBFfnVTQOZsZYSObvqnKhW13f/AG3d+M7gje8mYns0CJ+dG/0p2Jp3nGumy 0U5GuQ/8IzjnL4h5J9MLh4x0YJe1R9RymsabmJSSchCirW0NyeAKng4WQGc11DbmyZS6 F7PQ== X-Received: by 10.107.10.167 with SMTP id 39mr15035297iok.0.1438462927350; Sat, 01 Aug 2015 14:02:07 -0700 (PDT) Received: from [192.168.1.107] (173-29-96-237.client.mchsi.com. [173.29.96.237]) by smtp.gmail.com with ESMTPSA id lr1sm2024978igb.10.2015.08.01.14.02.04 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 01 Aug 2015 14:02:05 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2102\)) Subject: Re: svn commit: r286142 - head/sys/net From: Guy Helmer In-Reply-To: Date: Sat, 1 Aug 2015 16:02:03 -0500 Cc: Luiz Otavio O Souza , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: References: <201507312143.t6VLhSBm046797@repo.freebsd.org> To: Ed Schouten X-Mailer: Apple Mail (2.2102) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 21:02:08 -0000 > On Aug 1, 2015, at 4:50 AM, Ed Schouten wrote: > > Hi Luiz, > > 2015-07-31 23:43 GMT+02:00 Luiz Otavio O Souza : >> - while (d->bd_hbuf_in_use) >> - mtx_sleep(&d->bd_hbuf_in_use, &d->bd_lock, >> - PRINET, "bd_hbuf", 0); > > Would it make sense to replace them by an assertion, instead of > omitting them entirely? > > KASSERT(!d->bd_hbuf_in_use, ("...")); I would appreciate the confidence that would provide. Guy From owner-svn-src-all@freebsd.org Sat Aug 1 22:00:26 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B92FB9B02BB; Sat, 1 Aug 2015 22:00:26 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AA4FE1AD3; Sat, 1 Aug 2015 22:00:26 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t71M0Q1N062333; Sat, 1 Aug 2015 22:00:26 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t71M0QIL062332; Sat, 1 Aug 2015 22:00:26 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201508012200.t71M0QIL062332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sat, 1 Aug 2015 22:00:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286163 - head/etc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 22:00:26 -0000 Author: jilles Date: Sat Aug 1 22:00:25 2015 New Revision: 286163 URL: https://svnweb.freebsd.org/changeset/base/286163 Log: rc.subr: Allow rc.conf.d with multi-directory local_startup. I also changed ${...%*/rc.d} to ${...%/rc.d} since the shortest match always has an empty string for the asterisk. PR: 201641 Submitted by: Jamie Landeg-Jones (original version) MFC after: 1 week Modified: head/etc/rc.subr Modified: head/etc/rc.subr ============================================================================== --- head/etc/rc.subr Sat Aug 1 20:40:37 2015 (r286162) +++ head/etc/rc.subr Sat Aug 1 22:00:25 2015 (r286163) @@ -1333,7 +1333,8 @@ load_rc_config() # If a service name was specified, attempt to load # service-specific configuration if [ -n "$_name" ] ; then - for _d in /etc ${local_startup%*/rc.d}; do + for _d in /etc ${local_startup}; do + _d=${_d%/rc.d} if [ -f ${_d}/rc.conf.d/"$_name" ]; then debug "Sourcing ${_d}/rc.conf.d/$_name" . ${_d}/rc.conf.d/"$_name" From owner-svn-src-all@freebsd.org Sat Aug 1 22:56:43 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33AF09B09BC; Sat, 1 Aug 2015 22:56:43 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2043FDB7; Sat, 1 Aug 2015 22:56:43 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t71Mugcj083984; Sat, 1 Aug 2015 22:56:42 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t71MugPi083983; Sat, 1 Aug 2015 22:56:42 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201508012256.t71MugPi083983@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 1 Aug 2015 22:56:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r286164 - stable/10/sys/fs/nfsserver X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 22:56:43 -0000 Author: rmacklem Date: Sat Aug 1 22:56:42 2015 New Revision: 286164 URL: https://svnweb.freebsd.org/changeset/base/286164 Log: MFC: r286046 This patch fixes a problem where, if the NFSv4 server has a previous unconfirmed clientid structure for the same client on the last hash list, this old entry would not be removed/deleted. I do not think this bug would have caused serious problems, since the new entry would have been before the old one on the list. This old entry would have eventually been scavenged/removed. Modified: stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Sat Aug 1 22:00:25 2015 (r286163) +++ stable/10/sys/fs/nfsserver/nfs_nfsdstate.c Sat Aug 1 22:56:42 2015 (r286164) @@ -225,7 +225,8 @@ nfsrv_setclient(struct nfsrv_descript *n break; } } - i++; + if (gotit == 0) + i++; } if (!gotit || (clp->lc_flags & (LCL_NEEDSCONFIRM | LCL_ADMINREVOKED))) { From owner-svn-src-all@freebsd.org Sat Aug 1 23:10:38 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 184419B0BC8; Sat, 1 Aug 2015 23:10:38 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F34FE13B4; Sat, 1 Aug 2015 23:10:37 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t71NAbuM089236; Sat, 1 Aug 2015 23:10:37 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t71NAbFx089235; Sat, 1 Aug 2015 23:10:37 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201508012310.t71NAbFx089235@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sat, 1 Aug 2015 23:10:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r286165 - head/sys/arm/ti X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 23:10:38 -0000 Author: gonzo Date: Sat Aug 1 23:10:36 2015 New Revision: 286165 URL: https://svnweb.freebsd.org/changeset/base/286165 Log: Set output pin initial value based on pin's pinmux pullup/pulldown setup Some of FDT blobs for AM335x-based devices use pinmux pullup/pulldown flag to setup initial GPIO ouputp value, e.g. 4DCAPE-43 sets LCD DATAEN signal this way. It works for Linux because Linux driver does not enforce pin direction until after it's requested by consumer. So input with pullup flag set acts as output with GPIO_HIGH value Reviewed by: loos Modified: head/sys/arm/ti/ti_gpio.c Modified: head/sys/arm/ti/ti_gpio.c ============================================================================== --- head/sys/arm/ti/ti_gpio.c Sat Aug 1 22:56:42 2015 (r286164) +++ head/sys/arm/ti/ti_gpio.c Sat Aug 1 23:10:36 2015 (r286165) @@ -573,7 +573,7 @@ ti_gpio_bank_init(device_t dev) { int pin; struct ti_gpio_softc *sc; - uint32_t flags, reg_oe, rev; + uint32_t flags, reg_oe, reg_set, rev; clk_ident_t clk; sc = device_get_softc(dev); @@ -607,12 +607,18 @@ ti_gpio_bank_init(device_t dev) /* Init OE register based on pads configuration. */ reg_oe = 0xffffffff; + reg_set = 0; for (pin = 0; pin < PINS_PER_BANK; pin++) { TI_GPIO_GET_FLAGS(dev, pin, &flags); - if (flags & GPIO_PIN_OUTPUT) + if (flags & GPIO_PIN_OUTPUT) { reg_oe &= ~(1UL << pin); + if (flags & GPIO_PIN_PULLUP) + reg_set |= (1UL << pin); + } } ti_gpio_write_4(sc, TI_GPIO_OE, reg_oe); + if (reg_set) + ti_gpio_write_4(sc, TI_GPIO_SETDATAOUT, reg_set); return (0); } From owner-svn-src-all@freebsd.org Sat Aug 1 23:51:58 2015 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8018C9B1294 for ; Sat, 1 Aug 2015 23:51:58 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm10-vm0.bullet.mail.bf1.yahoo.com (nm10-vm0.bullet.mail.bf1.yahoo.com [98.139.213.147]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 26D89141E for ; Sat, 1 Aug 2015 23:51:58 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1438473110; bh=5VOraS6nx1J7EvjedJF1xoO2Ni8nec9XbExFM64BkRM=; h=Date:From:To:Subject:References:In-Reply-To:From:Subject; b=rhJrUIJ7FjJPpbMocp5sadPpWTr3SLxXjAAAkdwjigPEE2UvA725RvtbKZ4/loCpboNnsI2J6FLFroVYxhxjZK2EfaUAls5gCsrjuBRxjUsstgcIRDKK+W/8iFojjU3jtlIQ89vQueQnnGMkQqzrE9dh/kmTeNRefLQjjncjXXWYGwPbYoCI1XC5IcLbEVHv5bUBlFeBSpL8afVsgbEzy12c9QspCsE/ZOmO62g9HWyQY16XBWMwccrtXvkuBWgi5jcLzl69VFTV4+9KDF2JtKfXjhRSpHwlh4GDwzFx91gDaysE1PxxldsUNcuLV4bQrrFUoNBh4KsezrWHZfkZMQ== Received: from [98.139.215.142] by nm10.bullet.mail.bf1.yahoo.com with NNFMP; 01 Aug 2015 23:51:50 -0000 Received: from [98.139.211.206] by tm13.bullet.mail.bf1.yahoo.com with NNFMP; 01 Aug 2015 23:51:50 -0000 Received: from [127.0.0.1] by smtp215.mail.bf1.yahoo.com with NNFMP; 01 Aug 2015 23:51:50 -0000 X-Yahoo-Newman-Id: 474349.33464.bm@smtp215.mail.bf1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 4tOhtmMVM1k7tnuPIwJVe0n02D4c0MSnKPpli2n6CxlgRwK Da56zqwv_C21zfLGbYjqD0FEif2lg3A1MLxd1IZ0BJW_ZVGZgS0.WlK0fSPk gmSIxEkRrwUiGffX7usnyDa9BjqMCAdtBzxCKAwCRwScsgRlIMdmGDjYbo4R IQ1CEFV207fBsuAqLVMFd0qBD9W.EOcamR4ojpRtyyMqobjWdvA29jnJTK3T DV8YcyLu5vgqfXd8bmV0GjT0DVGQ2tZrAR8BzDYLcNR1tUp5Vu1M5fJtnEIc r3_CSiE5DHiLyn58oZwG_msnn90fpUY9cLsjbhcyDhyJXMB6W8uM57BVJG4n 3g0nTa017Q9XY6BpJvFHJlOA6Vwhb9mavcGLfsq5kgoEFUYqp6KXdRUL0hAq ktMn8KYAm42SsngQPGXh72iAYJRfZ0wVq4JfLZIT6ynSmRS2gjE7S8WrV8N_ AFDAmp5Jd6zy6V89lQCy8h9DuJ5Cw.m3_yi60pU44e6UJicCMxGx5OeKg2lt ZmtDfx28_t.hP5AuKhP8pOmzXoekjgnNw X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Message-ID: <55BD5B9F.2030906@FreeBSD.org> Date: Sat, 01 Aug 2015 18:51:59 -0500 From: Pedro Giffuni Organization: FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Eric van Gyzen , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r286144 - head/usr.bin/wall References: <201508010129.t711TuAv036881@repo.freebsd.org> <55BCD8E3.3070607@FreeBSD.org> <55BCDF2D.8000700@FreeBSD.org> In-Reply-To: <55BCDF2D.8000700@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 Aug 2015 23:51:58 -0000 On 01/08/2015 10:01 a.m., Pedro Giffuni wrote: > > > On 08/01/15 09:34, Eric van Gyzen wrote: >> On 7/31/15 8:29 PM, Pedro F. Giffuni wrote: >>> Author: pfg >>> Date: Sat Aug 1 01:29:55 2015 >>> New Revision: 286144 >>> URL: https://svnweb.freebsd.org/changeset/base/286144 >>> >>> Log: >>> Buffer overflow in wall(1). >>> >>> Revert r286102 and apply a cleaner fix. >>> Tested for overflows by FORTIFY_SOURCE GSoC (with clang). >>> >>> Suggested by: bde >>> Reviewed by: Oliver Pinter >>> Tested by: Oliver Pinter >>> MFC after: 3 days >>> >>> Modified: >>> head/usr.bin/wall/ttymsg.c >>> >>> Modified: head/usr.bin/wall/ttymsg.c >>> ============================================================================== >>> >>> >>> --- head/usr.bin/wall/ttymsg.c Fri Jul 31 23:40:18 2015 (r286143) >>> +++ head/usr.bin/wall/ttymsg.c Sat Aug 1 01:29:55 2015 (r286144) >>> @@ -62,7 +62,7 @@ ttymsg(struct iovec *iov, int iovcnt, co >>> struct iovec localiov[7]; >>> ssize_t left, wret; >>> int cnt, fd; >>> - char device[MAXNAMLEN] = _PATH_DEV; >>> + char device[MAXNAMLEN]; >>> static char errbuf[1024]; >>> char *p; >>> int forked; >>> @@ -71,8 +71,9 @@ ttymsg(struct iovec *iov, int iovcnt, co >>> if (iovcnt > (int)(sizeof(localiov) / sizeof(localiov[0]))) >>> return ("too many iov's (change code in wall/ttymsg.c)"); >>> >>> - strlcat(device, line, sizeof(device)); >>> + strlcpy(device, _PATH_DEV, sizeof(device)); >>> p = device + sizeof(_PATH_DEV) - 1; >>> + strlcpy(p, line, sizeof(device) - sizeof(_PATH_DEV)); >> >> You're probably already sick of this change, but I would encourage this >> instead: >> >> strlcat(device, line, sizeof(device)); >> > > It looks exactly like the code I just replaced ;). > >> Your current code works, and it's even more efficient than strlcat. > Actually it looks like there may be some consensus towards reverting this as the previous version was more readable. Since the code still works better than when there was an overflow, let's leave it for a couple of days, maybe interested developers will come with a better change. Pedro.