From owner-svn-src-stable@freebsd.org Sun Sep 13 01:31:18 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B43A9CC41B; Sun, 13 Sep 2015 01:31:18 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5B89A1803; Sun, 13 Sep 2015 01:31:18 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8D1VImh056281; Sun, 13 Sep 2015 01:31:18 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8D1VIE2056280; Sun, 13 Sep 2015 01:31:18 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201509130131.t8D1VIE2056280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sun, 13 Sep 2015 01:31:18 +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: r287729 - stable/10/lib/libc/net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2015 01:31:18 -0000 Author: hrs Date: Sun Sep 13 01:31:17 2015 New Revision: 287729 URL: https://svnweb.freebsd.org/changeset/base/287729 Log: MFC 287595: - Fix SIGSEGV when sa == NULL. NULL check in getnameinfo_inet() did not work as expected. - Simplify afdl table lookup. Modified: stable/10/lib/libc/net/getnameinfo.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/net/getnameinfo.c ============================================================================== --- stable/10/lib/libc/net/getnameinfo.c Sun Sep 13 00:08:04 2015 (r287728) +++ stable/10/lib/libc/net/getnameinfo.c Sun Sep 13 01:31:17 2015 (r287729) @@ -78,6 +78,8 @@ getnameinfo(const struct sockaddr *sa, s char *host, size_t hostlen, char *serv, size_t servlen, int flags) { + if (sa == NULL) + return (EAI_FAIL); switch (sa->sa_family) { case AF_INET: @@ -124,25 +126,19 @@ getnameinfo_inet(const struct sockaddr * struct servent *sp; struct hostent *hp; u_short port; - int family, i; const char *addr; u_int32_t v4a; int h_error; char numserv[512]; char numaddr[512]; - if (sa == NULL) - return EAI_FAIL; - - family = sa->sa_family; - for (i = 0; afdl[i].a_af; i++) - if (afdl[i].a_af == family) { - afd = &afdl[i]; - goto found; - } - return EAI_FAMILY; + for (afd = &afdl[0]; afd->a_af > 0; afd++) { + if (afd->a_af == sa->sa_family) + break; + } + if (afd->a_af == 0) + return (EAI_FAMILY); - found: if (salen != afd->a_socklen) return EAI_FAIL; From owner-svn-src-stable@freebsd.org Sun Sep 13 01:35:42 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2D6D9CC644; Sun, 13 Sep 2015 01:35:42 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 928B41A1C; Sun, 13 Sep 2015 01:35:42 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8D1ZgcD058447; Sun, 13 Sep 2015 01:35:42 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8D1Zfd3058443; Sun, 13 Sep 2015 01:35:41 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201509130135.t8D1Zfd3058443@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sun, 13 Sep 2015 01:35: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: r287730 - in stable/10: sbin/ifconfig share/man/man4 sys/net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2015 01:35:42 -0000 Author: hrs Date: Sun Sep 13 01:35:40 2015 New Revision: 287730 URL: https://svnweb.freebsd.org/changeset/base/287730 Log: MFC 287607: - Remove GIF_{SEND,ACCEPT}_REVETHIP. - Simplify EADDRNOTAVAIL and EAFNOSUPPORT conditions. Modified: stable/10/sbin/ifconfig/ifgif.c stable/10/share/man/man4/gif.4 stable/10/sys/net/if_gif.c stable/10/sys/net/if_gif.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/ifconfig/ifgif.c ============================================================================== --- stable/10/sbin/ifconfig/ifgif.c Sun Sep 13 01:31:17 2015 (r287729) +++ stable/10/sbin/ifconfig/ifgif.c Sun Sep 13 01:35:40 2015 (r287730) @@ -51,7 +51,7 @@ static const char rcsid[] = #include "ifconfig.h" -#define GIFBITS "\020\1ACCEPT_REV_ETHIP_VER\2IGNORE_SOURCE\5SEND_REV_ETHIP_VER" +#define GIFBITS "\020\2IGNORE_SOURCE" static void gif_status(int); @@ -70,8 +70,7 @@ gif_status(int s) } static void -setgifopts(const char *val, - int d, int s, const struct afswtch *afp) +setgifopts(const char *val, int d, int s, const struct afswtch *afp) { int opts; @@ -93,12 +92,8 @@ setgifopts(const char *val, } static struct cmd gif_cmds[] = { - DEF_CMD("accept_rev_ethip_ver", GIF_ACCEPT_REVETHIP, setgifopts), - DEF_CMD("-accept_rev_ethip_ver",-GIF_ACCEPT_REVETHIP, setgifopts), DEF_CMD("ignore_source", GIF_IGNORE_SOURCE, setgifopts), DEF_CMD("-ignore_source", -GIF_IGNORE_SOURCE, setgifopts), - DEF_CMD("send_rev_ethip_ver", GIF_SEND_REVETHIP, setgifopts), - DEF_CMD("-send_rev_ethip_ver", -GIF_SEND_REVETHIP, setgifopts), }; static struct afswtch af_gif = { @@ -110,11 +105,9 @@ static struct afswtch af_gif = { static __constructor void gif_ctor(void) { -#define N(a) (sizeof(a) / sizeof(a[0])) size_t i; - for (i = 0; i < N(gif_cmds); i++) + for (i = 0; i < nitems(gif_cmds); i++) cmd_register(&gif_cmds[i]); af_register(&af_gif); -#undef N } Modified: stable/10/share/man/man4/gif.4 ============================================================================== --- stable/10/share/man/man4/gif.4 Sun Sep 13 01:31:17 2015 (r287729) +++ stable/10/share/man/man4/gif.4 Sun Sep 13 01:35:40 2015 (r287730) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 14, 2014 +.Dd September 10, 2015 .Dt GIF 4 .Os .Sh NAME @@ -246,32 +246,3 @@ had a multi-destination behavior, config .Dv IFF_LINK0 flag. The behavior is obsolete and is no longer supported. -.Pp -On -.Fx -6.1, 6.2, 6.3, 7.0, 7.1, and 7.2 -the -.Nm -sends and receives incorrect EtherIP packets with reversed version -field when -.Xr if_bridge 4 -is used together. As a workaround on this interoperability issue, the -following two -.Xr ifconfig 8 -flags can be used: -.Bl -tag -width "accept_rev_ethip_ver" -offset indent -.It accept_rev_ethip_ver -accepts both correct EtherIP packets and ones with reversed version -field, if enabled. If disabled, the -.Nm -accepts the correct packets only. This flag is enabled by default. -.It send_rev_ethip_ver -sends EtherIP packets with reversed version field intentionally, if -enabled. If disabled, the -.Nm -sends the correct packets only. This flag is disabled by default. -.El -.Pp -If interoperability with the older -.Fx -machines is needed, both of these two flags must be enabled. Modified: stable/10/sys/net/if_gif.c ============================================================================== --- stable/10/sys/net/if_gif.c Sun Sep 13 01:31:17 2015 (r287729) +++ stable/10/sys/net/if_gif.c Sun Sep 13 01:35:40 2015 (r287730) @@ -419,13 +419,8 @@ gif_transmit(struct ifnet *ifp, struct m } eth = mtod(m, struct etherip_header *); eth->eip_resvh = 0; - if ((sc->gif_options & GIF_SEND_REVETHIP) != 0) { - eth->eip_ver = 0; - eth->eip_resvl = ETHERIP_VERSION; - } else { - eth->eip_ver = ETHERIP_VERSION; - eth->eip_resvl = 0; - } + eth->eip_ver = ETHERIP_VERSION; + eth->eip_resvl = 0; break; default: error = EAFNOSUPPORT; @@ -633,19 +628,10 @@ gif_input(struct mbuf *m, struct ifnet * if (m == NULL) goto drop; eip = mtod(m, struct etherip_header *); - /* - * GIF_ACCEPT_REVETHIP (enabled by default) intentionally - * accepts an EtherIP packet with revered version field in - * the header. This is a knob for backward compatibility - * with FreeBSD 7.2R or prior. - */ if (eip->eip_ver != ETHERIP_VERSION) { - if ((gif_options & GIF_ACCEPT_REVETHIP) == 0 || - eip->eip_resvl != ETHERIP_VERSION) { - /* discard unknown versions */ - m_freem(m); - goto drop; - } + /* discard unknown versions */ + m_freem(m); + goto drop; } m_adj(m, sizeof(struct etherip_header)); @@ -766,50 +752,32 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, goto bad; /* validate sa_len */ + /* check sa_family looks sane for the cmd */ switch (src->sa_family) { #ifdef INET case AF_INET: if (src->sa_len != sizeof(struct sockaddr_in)) goto bad; - break; -#endif -#ifdef INET6 - case AF_INET6: - if (src->sa_len != sizeof(struct sockaddr_in6)) + if (cmd != SIOCSIFPHYADDR) { + error = EAFNOSUPPORT; goto bad; - break; -#endif - default: - error = EAFNOSUPPORT; - goto bad; - } - /* check sa_family looks sane for the cmd */ - error = EAFNOSUPPORT; - switch (cmd) { -#ifdef INET - case SIOCSIFPHYADDR: - if (src->sa_family == AF_INET) - break; - goto bad; -#endif -#ifdef INET6 - case SIOCSIFPHYADDR_IN6: - if (src->sa_family == AF_INET6) - break; - goto bad; -#endif - } - error = EADDRNOTAVAIL; - switch (src->sa_family) { -#ifdef INET - case AF_INET: + } if (satosin(src)->sin_addr.s_addr == INADDR_ANY || - satosin(dst)->sin_addr.s_addr == INADDR_ANY) + satosin(dst)->sin_addr.s_addr == INADDR_ANY) { + error = EADDRNOTAVAIL; goto bad; + } break; #endif #ifdef INET6 case AF_INET6: + if (src->sa_len != sizeof(struct sockaddr_in6)) + goto bad; + if (cmd != SIOCSIFPHYADDR_IN6) { + error = EAFNOSUPPORT; + goto bad; + } + error = EADDRNOTAVAIL; if (IN6_IS_ADDR_UNSPECIFIED(&satosin6(src)->sin6_addr) || IN6_IS_ADDR_UNSPECIFIED(&satosin6(dst)->sin6_addr)) @@ -825,8 +793,12 @@ gif_ioctl(struct ifnet *ifp, u_long cmd, error = sa6_embedscope(satosin6(dst), 0); if (error != 0) goto bad; + break; #endif - }; + default: + error = EAFNOSUPPORT; + goto bad; + } error = gif_set_tunnel(ifp, src, dst); break; case SIOCDIFPHYADDR: Modified: stable/10/sys/net/if_gif.h ============================================================================== --- stable/10/sys/net/if_gif.h Sun Sep 13 01:31:17 2015 (r287729) +++ stable/10/sys/net/if_gif.h Sun Sep 13 01:35:40 2015 (r287730) @@ -126,10 +126,7 @@ int in6_gif_attach(struct gif_softc *); #define GIFGOPTS _IOWR('i', 150, struct ifreq) #define GIFSOPTS _IOW('i', 151, struct ifreq) -#define GIF_ACCEPT_REVETHIP 0x0001 #define GIF_IGNORE_SOURCE 0x0002 -#define GIF_SEND_REVETHIP 0x0010 -#define GIF_OPTMASK (GIF_ACCEPT_REVETHIP|GIF_SEND_REVETHIP| \ - GIF_IGNORE_SOURCE) +#define GIF_OPTMASK (GIF_IGNORE_SOURCE) #endif /* _NET_IF_GIF_H_ */ From owner-svn-src-stable@freebsd.org Sun Sep 13 01:39:39 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FA919CC81B; Sun, 13 Sep 2015 01:39:39 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0000E1CC9; Sun, 13 Sep 2015 01:39:38 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8D1dcQD058776; Sun, 13 Sep 2015 01:39:38 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8D1dc83058774; Sun, 13 Sep 2015 01:39:38 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201509130139.t8D1dc83058774@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sun, 13 Sep 2015 01:39: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: r287731 - stable/10/sys/netinet6 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2015 01:39:39 -0000 Author: hrs Date: Sun Sep 13 01:39:37 2015 New Revision: 287731 URL: https://svnweb.freebsd.org/changeset/base/287731 Log: MFC 287608: Remove IN6_IFF_NOPFX. This flag was no longer used. Modified: stable/10/sys/netinet6/in6_ifattach.c stable/10/sys/netinet6/in6_var.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet6/in6_ifattach.c ============================================================================== --- stable/10/sys/netinet6/in6_ifattach.c Sun Sep 13 01:35:40 2015 (r287730) +++ stable/10/sys/netinet6/in6_ifattach.c Sun Sep 13 01:39:37 2015 (r287731) @@ -598,9 +598,6 @@ in6_ifattach_loopback(struct ifnet *ifp) /* we don't need to perform DAD on loopback interfaces. */ ifra.ifra_flags |= IN6_IFF_NODAD; - /* skip registration to the prefix list. XXX should be temporary. */ - ifra.ifra_flags |= IN6_IFF_NOPFX; - /* * We are sure that this is a newly assigned address, so we can set * NULL to the 3rd arg. Modified: stable/10/sys/netinet6/in6_var.h ============================================================================== --- stable/10/sys/netinet6/in6_var.h Sun Sep 13 01:35:40 2015 (r287730) +++ stable/10/sys/netinet6/in6_var.h Sun Sep 13 01:39:37 2015 (r287731) @@ -504,9 +504,6 @@ struct in6_rrenumreq { #define IN6_IFF_AUTOCONF 0x40 /* autoconfigurable address. */ #define IN6_IFF_TEMPORARY 0x80 /* temporary (anonymous) address. */ #define IN6_IFF_PREFER_SOURCE 0x0100 /* preferred address for SAS */ -#define IN6_IFF_NOPFX 0x8000 /* skip kernel prefix management. - * XXX: this should be temporary. - */ /* do not input/output */ #define IN6_IFF_NOTREADY (IN6_IFF_TENTATIVE|IN6_IFF_DUPLICATED) From owner-svn-src-stable@freebsd.org Sun Sep 13 01:44:31 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 538879CCB47; Sun, 13 Sep 2015 01:44:31 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4429A105B; Sun, 13 Sep 2015 01:44:31 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8D1iVWf062643; Sun, 13 Sep 2015 01:44:31 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8D1iV1S062642; Sun, 13 Sep 2015 01:44:31 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201509130144.t8D1iV1S062642@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sun, 13 Sep 2015 01:44: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: r287732 - stable/10/sys/netinet6 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2015 01:44:31 -0000 Author: hrs Date: Sun Sep 13 01:44:30 2015 New Revision: 287732 URL: https://svnweb.freebsd.org/changeset/base/287732 Log: MFC 287609: Do not add IN6_IFF_TENTATIVE when ND6_IFF_NO_DAD. Modified: stable/10/sys/netinet6/in6.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet6/in6.c ============================================================================== --- stable/10/sys/netinet6/in6.c Sun Sep 13 01:39:37 2015 (r287731) +++ stable/10/sys/netinet6/in6.c Sun Sep 13 01:44:30 2015 (r287732) @@ -1254,11 +1254,13 @@ in6_update_ifa(struct ifnet *ifp, struct * source address. */ ia->ia6_flags &= ~IN6_IFF_DUPLICATED; /* safety */ - if (hostIsNew && in6if_do_dad(ifp)) - ia->ia6_flags |= IN6_IFF_TENTATIVE; - /* DAD should be performed after ND6_IFF_IFDISABLED is cleared. */ - if (ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) + /* + * DAD should be performed for an new address or addresses on + * an interface with ND6_IFF_IFDISABLED. + */ + if (in6if_do_dad(ifp) && + (hostIsNew || (ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED))) ia->ia6_flags |= IN6_IFF_TENTATIVE; /* From owner-svn-src-stable@freebsd.org Sun Sep 13 01:59:52 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0A4EA0323E; Sun, 13 Sep 2015 01:59:52 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B4A8F14E8; Sun, 13 Sep 2015 01:59:52 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8D1xqNb066967; Sun, 13 Sep 2015 01:59:52 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8D1xp3D066963; Sun, 13 Sep 2015 01:59:51 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201509130159.t8D1xp3D066963@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sun, 13 Sep 2015 01:59: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: r287733 - in stable/10: sys/netinet6 usr.sbin/ndp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2015 01:59:52 -0000 Author: hrs Date: Sun Sep 13 01:59:50 2015 New Revision: 287733 URL: https://svnweb.freebsd.org/changeset/base/287733 Log: MFC 287095, 287610, 287611, 287617: Remove obsolete API (SIOCGDRLST_IN6 and SIOCGPRLST_IN6) support. Modified: stable/10/sys/netinet6/in6.c stable/10/sys/netinet6/in6_var.h stable/10/sys/netinet6/nd6.c stable/10/usr.sbin/ndp/ndp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet6/in6.c ============================================================================== --- stable/10/sys/netinet6/in6.c Sun Sep 13 01:44:30 2015 (r287732) +++ stable/10/sys/netinet6/in6.c Sun Sep 13 01:59:50 2015 (r287733) @@ -323,8 +323,6 @@ in6_control(struct socket *so, u_long cm /* FALLTHROUGH */ case OSIOCGIFINFO_IN6: case SIOCGIFINFO_IN6: - case SIOCGDRLST_IN6: - case SIOCGPRLST_IN6: case SIOCGNBRINFO_IN6: case SIOCGDEFIFACE_IN6: return (nd6_ioctl(cmd, data, ifp)); Modified: stable/10/sys/netinet6/in6_var.h ============================================================================== --- stable/10/sys/netinet6/in6_var.h Sun Sep 13 01:44:30 2015 (r287732) +++ stable/10/sys/netinet6/in6_var.h Sun Sep 13 01:59:50 2015 (r287733) @@ -447,11 +447,6 @@ struct in6_rrenumreq { #define SIOCGIFAFLAG_IN6 _IOWR('i', 73, struct in6_ifreq) -#define SIOCGDRLST_IN6 _IOWR('i', 74, struct in6_drlist) -#ifdef _KERNEL -/* XXX: SIOCGPRLST_IN6 is exposed in KAME but in6_oprlist is not. */ -#define SIOCGPRLST_IN6 _IOWR('i', 75, struct in6_oprlist) -#endif #ifdef _KERNEL #define OSIOCGIFINFO_IN6 _IOWR('i', 76, struct in6_ondireq) #endif Modified: stable/10/sys/netinet6/nd6.c ============================================================================== --- stable/10/sys/netinet6/nd6.c Sun Sep 13 01:44:30 2015 (r287732) +++ stable/10/sys/netinet6/nd6.c Sun Sep 13 01:59:50 2015 (r287733) @@ -1246,99 +1246,14 @@ nd6_rtrequest(int req, struct rtentry *r int nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) { - struct in6_drlist *drl = (struct in6_drlist *)data; - struct in6_oprlist *oprl = (struct in6_oprlist *)data; struct in6_ndireq *ndi = (struct in6_ndireq *)data; struct in6_nbrinfo *nbi = (struct in6_nbrinfo *)data; struct in6_ndifreq *ndif = (struct in6_ndifreq *)data; - struct nd_defrouter *dr; - struct nd_prefix *pr; - int i = 0, error = 0; + int error = 0; if (ifp->if_afdata[AF_INET6] == NULL) return (EPFNOSUPPORT); switch (cmd) { - case SIOCGDRLST_IN6: - /* - * obsolete API, use sysctl under net.inet6.icmp6 - */ - bzero(drl, sizeof(*drl)); - TAILQ_FOREACH(dr, &V_nd_defrouter, dr_entry) { - if (i >= DRLSTSIZ) - break; - drl->defrouter[i].rtaddr = dr->rtaddr; - in6_clearscope(&drl->defrouter[i].rtaddr); - - drl->defrouter[i].flags = dr->flags; - drl->defrouter[i].rtlifetime = dr->rtlifetime; - drl->defrouter[i].expire = dr->expire + - (time_second - time_uptime); - drl->defrouter[i].if_index = dr->ifp->if_index; - i++; - } - break; - case SIOCGPRLST_IN6: - /* - * obsolete API, use sysctl under net.inet6.icmp6 - * - * XXX the structure in6_prlist was changed in backward- - * incompatible manner. in6_oprlist is used for SIOCGPRLST_IN6, - * in6_prlist is used for nd6_sysctl() - fill_prlist(). - */ - /* - * XXX meaning of fields, especialy "raflags", is very - * differnet between RA prefix list and RR/static prefix list. - * how about separating ioctls into two? - */ - bzero(oprl, sizeof(*oprl)); - LIST_FOREACH(pr, &V_nd_prefix, ndpr_entry) { - struct nd_pfxrouter *pfr; - int j; - - if (i >= PRLSTSIZ) - break; - oprl->prefix[i].prefix = pr->ndpr_prefix.sin6_addr; - oprl->prefix[i].raflags = pr->ndpr_raf; - oprl->prefix[i].prefixlen = pr->ndpr_plen; - oprl->prefix[i].vltime = pr->ndpr_vltime; - oprl->prefix[i].pltime = pr->ndpr_pltime; - oprl->prefix[i].if_index = pr->ndpr_ifp->if_index; - if (pr->ndpr_vltime == ND6_INFINITE_LIFETIME) - oprl->prefix[i].expire = 0; - else { - time_t maxexpire; - - /* XXX: we assume time_t is signed. */ - maxexpire = (-1) & - ~((time_t)1 << - ((sizeof(maxexpire) * 8) - 1)); - if (pr->ndpr_vltime < - maxexpire - pr->ndpr_lastupdate) { - oprl->prefix[i].expire = - pr->ndpr_lastupdate + - pr->ndpr_vltime + - (time_second - time_uptime); - } else - oprl->prefix[i].expire = maxexpire; - } - - j = 0; - LIST_FOREACH(pfr, &pr->ndpr_advrtrs, pfr_entry) { - if (j < DRLSTSIZ) { -#define RTRADDR oprl->prefix[i].advrtr[j] - RTRADDR = pfr->router->rtaddr; - in6_clearscope(&RTRADDR); -#undef RTRADDR - } - j++; - } - oprl->prefix[i].advrtrs = j; - oprl->prefix[i].origin = PR_ORIG_RA; - - i++; - } - - break; case OSIOCGIFINFO_IN6: #define ND ndi->ndi /* XXX: old ndp(8) assumes a positive value for linkmtu. */ @@ -1398,22 +1313,19 @@ nd6_ioctl(u_long cmd, caddr_t data, stru * do not clear ND6_IFF_IFDISABLED. * See RFC 4862, Section 5.4.5. */ - int duplicated_linklocal = 0; - IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET6) continue; ia = (struct in6_ifaddr *)ifa; if ((ia->ia6_flags & IN6_IFF_DUPLICATED) && - IN6_IS_ADDR_LINKLOCAL(IA6_IN6(ia))) { - duplicated_linklocal = 1; + IN6_IS_ADDR_LINKLOCAL(IA6_IN6(ia))) break; - } } IF_ADDR_RUNLOCK(ifp); - if (duplicated_linklocal) { + if (ifa != NULL) { + /* LLA is duplicated. */ ND.flags |= ND6_IFF_IFDISABLED; log(LOG_ERR, "Cannot enable an interface" " with a link-local address marked" @@ -1429,14 +1341,18 @@ nd6_ioctl(u_long cmd, caddr_t data, stru /* Mark all IPv6 address as tentative. */ ND_IFINFO(ifp)->flags |= ND6_IFF_IFDISABLED; - IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { - if (ifa->ifa_addr->sa_family != AF_INET6) - continue; - ia = (struct in6_ifaddr *)ifa; - ia->ia6_flags |= IN6_IFF_TENTATIVE; + if ((ND_IFINFO(ifp)->flags & ND6_IFF_NO_DAD) == 0) { + IF_ADDR_RLOCK(ifp); + TAILQ_FOREACH(ifa, &ifp->if_addrhead, + ifa_link) { + if (ifa->ifa_addr->sa_family != + AF_INET6) + continue; + ia = (struct in6_ifaddr *)ifa; + ia->ia6_flags |= IN6_IFF_TENTATIVE; + } + IF_ADDR_RUNLOCK(ifp); } - IF_ADDR_RUNLOCK(ifp); } if (ND.flags & ND6_IFF_AUTO_LINKLOCAL) { @@ -1454,20 +1370,19 @@ nd6_ioctl(u_long cmd, caddr_t data, stru * address is assigned, and IFF_UP, try to * assign one. */ - int haslinklocal = 0; - IF_ADDR_RLOCK(ifp); - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { - if (ifa->ifa_addr->sa_family != AF_INET6) + TAILQ_FOREACH(ifa, &ifp->if_addrhead, + ifa_link) { + if (ifa->ifa_addr->sa_family != + AF_INET6) continue; ia = (struct in6_ifaddr *)ifa; - if (IN6_IS_ADDR_LINKLOCAL(IA6_IN6(ia))) { - haslinklocal = 1; + if (IN6_IS_ADDR_LINKLOCAL(IA6_IN6(ia))) break; - } } IF_ADDR_RUNLOCK(ifp); - if (!haslinklocal) + if (ifa != NULL) + /* No LLA is configured. */ in6_ifattach(ifp, NULL); } } Modified: stable/10/usr.sbin/ndp/ndp.c ============================================================================== --- stable/10/usr.sbin/ndp/ndp.c Sun Sep 13 01:44:30 2015 (r287732) +++ stable/10/usr.sbin/ndp/ndp.c Sun Sep 13 01:59:50 2015 (r287733) @@ -156,14 +156,12 @@ static void setdefif(char *); static char *sec2str(time_t); static void ts_print(const struct timeval *); -#ifdef ICMPV6CTL_ND6_DRLIST static char *rtpref_str[] = { "medium", /* 00 */ "high", /* 01 */ "rsv", /* 10 */ "low" /* 11 */ }; -#endif int mode = 0; char *arg = NULL; @@ -1076,7 +1074,6 @@ ifinfo(ifname, argc, argv) void rtrlist() { -#ifdef ICMPV6CTL_ND6_DRLIST int mib[] = { CTL_NET, PF_INET6, IPPROTO_ICMPV6, ICMPV6CTL_ND6_DRLIST }; char *buf; struct in6_defrouter *p, *ep; @@ -1124,54 +1121,11 @@ rtrlist() sec2str(p->expire - now.tv_sec)); } free(buf); -#else - struct in6_drlist dr; - int s, i; - struct timeval now; - - if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { - err(1, "socket"); - /* NOTREACHED */ - } - bzero(&dr, sizeof(dr)); - strlcpy(dr.ifname, "lo0", sizeof(dr.ifname)); /* dummy */ - if (ioctl(s, SIOCGDRLST_IN6, (caddr_t)&dr) < 0) { - err(1, "ioctl(SIOCGDRLST_IN6)"); - /* NOTREACHED */ - } -#define DR dr.defrouter[i] - for (i = 0 ; DR.if_index && i < DRLSTSIZ ; i++) { - struct sockaddr_in6 sin6; - - bzero(&sin6, sizeof(sin6)); - sin6.sin6_family = AF_INET6; - sin6.sin6_len = sizeof(sin6); - sin6.sin6_addr = DR.rtaddr; - getnameinfo((struct sockaddr *)&sin6, sin6.sin6_len, host_buf, - sizeof(host_buf), NULL, 0, - (nflag ? NI_NUMERICHOST : 0)); - - printf("%s if=%s", host_buf, - if_indextoname(DR.if_index, ifix_buf)); - printf(", flags=%s%s", - DR.flags & ND_RA_FLAG_MANAGED ? "M" : "", - DR.flags & ND_RA_FLAG_OTHER ? "O" : ""); - gettimeofday(&now, 0); - if (DR.expire == 0) - printf(", expire=Never\n"); - else - printf(", expire=%s\n", - sec2str(DR.expire - now.tv_sec)); - } -#undef DR - close(s); -#endif } void plist() { -#ifdef ICMPV6CTL_ND6_PRLIST int mib[] = { CTL_NET, PF_INET6, IPPROTO_ICMPV6, ICMPV6CTL_ND6_PRLIST }; char *buf; struct in6_prefix *p, *ep, *n; @@ -1281,161 +1235,6 @@ plist() printf(" No advertising router\n"); } free(buf); -#else - struct in6_prlist pr; - int s, i; - struct timeval now; - - gettimeofday(&now, 0); - - if ((s = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) { - err(1, "socket"); - /* NOTREACHED */ - } - bzero(&pr, sizeof(pr)); - strlcpy(pr.ifname, "lo0", sizeof(pr.ifname)); /* dummy */ - if (ioctl(s, SIOCGPRLST_IN6, (caddr_t)&pr) < 0) { - err(1, "ioctl(SIOCGPRLST_IN6)"); - /* NOTREACHED */ - } -#define PR pr.prefix[i] - for (i = 0; PR.if_index && i < PRLSTSIZ ; i++) { - struct sockaddr_in6 p6; - char namebuf[NI_MAXHOST]; - int niflags; - -#ifdef NDPRF_ONLINK - p6 = PR.prefix; -#else - memset(&p6, 0, sizeof(p6)); - p6.sin6_family = AF_INET6; - p6.sin6_len = sizeof(p6); - p6.sin6_addr = PR.prefix; -#endif - niflags = NI_NUMERICHOST; - if (getnameinfo((struct sockaddr *)&p6, - sizeof(p6), namebuf, sizeof(namebuf), - NULL, 0, niflags)) { - warnx("getnameinfo failed"); - continue; - } - printf("%s/%d if=%s\n", namebuf, PR.prefixlen, - if_indextoname(PR.if_index, ifix_buf)); - - gettimeofday(&now, 0); - /* - * meaning of fields, especially flags, is very different - * by origin. notify the difference to the users. - */ -#if 0 - printf(" %s", - PR.origin == PR_ORIG_RA ? "" : "advertise: "); -#endif -#ifdef NDPRF_ONLINK - printf("flags=%s%s%s%s%s", - PR.raflags.onlink ? "L" : "", - PR.raflags.autonomous ? "A" : "", - (PR.flags & NDPRF_ONLINK) != 0 ? "O" : "", - (PR.flags & NDPRF_DETACHED) != 0 ? "D" : "", -#ifdef NDPRF_HOME - (PR.flags & NDPRF_HOME) != 0 ? "H" : "" -#else - "" -#endif - ); -#else - printf("flags=%s%s", - PR.raflags.onlink ? "L" : "", - PR.raflags.autonomous ? "A" : ""); -#endif - if (PR.vltime == ND6_INFINITE_LIFETIME) - printf(" vltime=infinity"); - else - printf(" vltime=%lu", PR.vltime); - if (PR.pltime == ND6_INFINITE_LIFETIME) - printf(", pltime=infinity"); - else - printf(", pltime=%lu", PR.pltime); - if (PR.expire == 0) - printf(", expire=Never"); - else if (PR.expire >= now.tv_sec) - printf(", expire=%s", - sec2str(PR.expire - now.tv_sec)); - else - printf(", expired"); -#ifdef NDPRF_ONLINK - printf(", ref=%d", PR.refcnt); -#endif -#if 0 - switch (PR.origin) { - case PR_ORIG_RA: - printf(", origin=RA"); - break; - case PR_ORIG_RR: - printf(", origin=RR"); - break; - case PR_ORIG_STATIC: - printf(", origin=static"); - break; - case PR_ORIG_KERNEL: - printf(", origin=kernel"); - break; - default: - printf(", origin=?"); - break; - } -#endif - printf("\n"); - /* - * "advertising router" list is meaningful only if the prefix - * information is from RA. - */ - if (0 && /* prefix origin is almost obsolted */ - PR.origin != PR_ORIG_RA) - ; - else if (PR.advrtrs) { - int j; - printf(" advertised by\n"); - for (j = 0; j < PR.advrtrs; j++) { - struct sockaddr_in6 sin6; - struct in6_nbrinfo *nbi; - - bzero(&sin6, sizeof(sin6)); - sin6.sin6_family = AF_INET6; - sin6.sin6_len = sizeof(sin6); - sin6.sin6_addr = PR.advrtr[j]; - sin6.sin6_scope_id = PR.if_index; /* XXX */ - getnameinfo((struct sockaddr *)&sin6, - sin6.sin6_len, host_buf, - sizeof(host_buf), NULL, 0, - (nflag ? NI_NUMERICHOST : 0)); - printf(" %s", host_buf); - - nbi = getnbrinfo(&sin6.sin6_addr, - PR.if_index, 0); - if (nbi) { - switch (nbi->state) { - case ND6_LLINFO_REACHABLE: - case ND6_LLINFO_STALE: - case ND6_LLINFO_DELAY: - case ND6_LLINFO_PROBE: - printf(" (reachable)\n"); - break; - default: - printf(" (unreachable)\n"); - } - } else - printf(" (no neighbor state)\n"); - } - if (PR.advrtrs > DRLSTSIZ) - printf(" and %d routers\n", - PR.advrtrs - DRLSTSIZ); - } else - printf(" No advertising router\n"); - } -#undef PR - close(s); -#endif } void From owner-svn-src-stable@freebsd.org Sun Sep 13 02:09:08 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 142CFA0362F; Sun, 13 Sep 2015 02:09:08 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EC3481A2B; Sun, 13 Sep 2015 02:09:07 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8D297SK071040; Sun, 13 Sep 2015 02:09:07 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8D296ow071033; Sun, 13 Sep 2015 02:09:06 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201509130209.t8D296ow071033@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sun, 13 Sep 2015 02:09:06 +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: r287734 - stable/10/sys/netinet6 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2015 02:09:08 -0000 Author: hrs Date: Sun Sep 13 02:09:06 2015 New Revision: 287734 URL: https://svnweb.freebsd.org/changeset/base/287734 Log: MFC 287094: - Deprecate IN6_IFF_NODAD. It was used to prevent DAD on a loopback interface but in6if_do_dad() already had a check for IFF_LOOPBACK. - Remove in6if_do_dad() check in in6_broadcast_ifa(). An address which needs DAD always has IN6_IFF_TENTATIVE there. - in6if_do_dad() now returns EAGAIN when the interface is not ready since DAD callout handler ignores such an interface. - In DAD callout handler, mark an address as IN6_IFF_TENTATIVE when the interface has ND6_IFF_IFDISABLED. And Do IFF_UP and IFF_DRV_RUNNING check consistently when DAD is required. - draft-ietf-6man-enhanced-dad is now published as RFC 7527. - Fix some typos. Modified: stable/10/sys/netinet6/in6.c stable/10/sys/netinet6/in6_ifattach.c stable/10/sys/netinet6/in6_var.h stable/10/sys/netinet6/nd6_nbr.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet6/in6.c ============================================================================== --- stable/10/sys/netinet6/in6.c Sun Sep 13 01:59:50 2015 (r287733) +++ stable/10/sys/netinet6/in6.c Sun Sep 13 02:09:06 2015 (r287734) @@ -1280,13 +1280,8 @@ in6_update_ifa(struct ifnet *ifp, struct goto cleanup; } - /* - * Perform DAD, if needed. - * XXX It may be of use, if we can administratively disable DAD. - */ - if (in6if_do_dad(ifp) && ((ifra->ifra_flags & IN6_IFF_NODAD) == 0) && - (ia->ia6_flags & IN6_IFF_TENTATIVE)) - { + /* Perform DAD, if the address is TENTATIVE. */ + if ((ia->ia6_flags & IN6_IFF_TENTATIVE)) { int mindelay, maxdelay; delay = 0; @@ -1619,6 +1614,10 @@ in6_purgeif(struct ifnet *ifp) * in the future. * RFC2373 defines interface id to be 64bit, but it allows non-RFC2374 * address encoding scheme. (see figure on page 8) + * Notifies other subsystems about address change/arrival: + * 1) Notifies device handler on the first IPv6 address assignment + * 2) Handle routing table changes for P2P links and route + * 3) Handle routing table changes for address host route */ static int in6_lifaddr_ioctl(struct socket *so, u_long cmd, caddr_t data, @@ -2389,13 +2388,13 @@ in6if_do_dad(struct ifnet *ifp) * However, some interfaces can be up before the RUNNING * status. Additionaly, users may try to assign addresses * before the interface becomes up (or running). - * We simply skip DAD in such a case as a work around. - * XXX: we should rather mark "tentative" on such addresses, - * and do DAD after the interface becomes ready. + * This function returns EAGAIN in that case. + * The caller should mark "tentative" on the address instead of + * performing DAD immediately. */ if (!((ifp->if_flags & IFF_UP) && (ifp->if_drv_flags & IFF_DRV_RUNNING))) - return (0); + return (EAGAIN); return (1); } Modified: stable/10/sys/netinet6/in6_ifattach.c ============================================================================== --- stable/10/sys/netinet6/in6_ifattach.c Sun Sep 13 01:59:50 2015 (r287733) +++ stable/10/sys/netinet6/in6_ifattach.c Sun Sep 13 02:09:06 2015 (r287734) @@ -595,9 +595,6 @@ in6_ifattach_loopback(struct ifnet *ifp) ifra.ifra_lifetime.ia6t_vltime = ND6_INFINITE_LIFETIME; ifra.ifra_lifetime.ia6t_pltime = ND6_INFINITE_LIFETIME; - /* we don't need to perform DAD on loopback interfaces. */ - ifra.ifra_flags |= IN6_IFF_NODAD; - /* * We are sure that this is a newly assigned address, so we can set * NULL to the 3rd arg. Modified: stable/10/sys/netinet6/in6_var.h ============================================================================== --- stable/10/sys/netinet6/in6_var.h Sun Sep 13 01:59:50 2015 (r287733) +++ stable/10/sys/netinet6/in6_var.h Sun Sep 13 02:09:06 2015 (r287734) @@ -494,7 +494,7 @@ struct in6_rrenumreq { #define IN6_IFF_DETACHED 0x08 /* may be detached from the link */ #define IN6_IFF_DEPRECATED 0x10 /* deprecated address */ #define IN6_IFF_NODAD 0x20 /* don't perform DAD on this address - * (used only at first SIOC* call) + * (obsolete) */ #define IN6_IFF_AUTOCONF 0x40 /* autoconfigurable address. */ #define IN6_IFF_TEMPORARY 0x80 /* temporary (anonymous) address. */ Modified: stable/10/sys/netinet6/nd6_nbr.c ============================================================================== --- stable/10/sys/netinet6/nd6_nbr.c Sun Sep 13 01:59:50 2015 (r287733) +++ stable/10/sys/netinet6/nd6_nbr.c Sun Sep 13 02:09:06 2015 (r287734) @@ -576,7 +576,7 @@ nd6_ns_output_fib(struct ifnet *ifp, con /* * Add a Nonce option (RFC 3971) to detect looped back NS messages. * This behavior is documented as Enhanced Duplicate Address - * Detection in draft-ietf-6man-enhanced-dad-13. + * Detection in RFC 7527. * net.inet6.ip6.dad_enhanced=0 disables this. */ if (V_dad_enhanced != 0 && nonce != NULL) { @@ -1308,11 +1308,16 @@ nd6_dad_start(struct ifaddr *ifa, int de } if (ifa->ifa_ifp == NULL) panic("nd6_dad_start: ifa->ifa_ifp == NULL"); - if (!(ifa->ifa_ifp->if_flags & IFF_UP)) { + if (ND_IFINFO(ifa->ifa_ifp)->flags & ND6_IFF_NO_DAD) { + ia->ia6_flags &= ~IN6_IFF_TENTATIVE; return; } - if (ND_IFINFO(ifa->ifa_ifp)->flags & ND6_IFF_IFDISABLED) + if (!(ifa->ifa_ifp->if_flags & IFF_UP) || + !(ifa->ifa_ifp->if_drv_flags & IFF_DRV_RUNNING) || + (ND_IFINFO(ifa->ifa_ifp)->flags & ND6_IFF_IFDISABLED)) { + ia->ia6_flags |= IN6_IFF_TENTATIVE; return; + } if ((dp = nd6_dad_find(ifa, NULL)) != NULL) { /* DAD already in progress */ nd6_dad_rele(dp); From owner-svn-src-stable@freebsd.org Sun Sep 13 03:09:22 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38332A02756; Sun, 13 Sep 2015 03:09:22 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1C05F1380; Sun, 13 Sep 2015 03:09:22 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8D39L1P096422; Sun, 13 Sep 2015 03:09:21 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8D39LY9096421; Sun, 13 Sep 2015 03:09:21 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201509130309.t8D39LY9096421@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sun, 13 Sep 2015 03:09:21 +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: r287735 - stable/10/usr.sbin/ndp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2015 03:09:22 -0000 Author: hrs Date: Sun Sep 13 03:09:21 2015 New Revision: 287735 URL: https://svnweb.freebsd.org/changeset/base/287735 Log: MFC 259169, 259176, 287097: - Ansify function definitions. - Change the type of addr argument in dump() function to be able disambiguate link-local addresses from different zones. - Add static and remove unused variables. Modified: stable/10/usr.sbin/ndp/ndp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ndp/ndp.c ============================================================================== --- stable/10/usr.sbin/ndp/ndp.c Sun Sep 13 02:09:06 2015 (r287734) +++ stable/10/usr.sbin/ndp/ndp.c Sun Sep 13 03:09:21 2015 (r287735) @@ -127,28 +127,26 @@ static int32_t thiszone; /* time differe static int s = -1; static int repeat = 0; -char ntop_buf[INET6_ADDRSTRLEN]; /* inet_ntop() */ -char host_buf[NI_MAXHOST]; /* getnameinfo() */ -char ifix_buf[IFNAMSIZ]; /* if_indextoname() */ +static char host_buf[NI_MAXHOST]; /* getnameinfo() */ +static char ifix_buf[IFNAMSIZ]; /* if_indextoname() */ -int main(int, char **); static int file(char *); -void getsocket(void); -int set(int, char **); -void get(char *); -int delete(char *); -void dump(struct in6_addr *, int); +static void getsocket(void); +static int set(int, char **); +static void get(char *); +static int delete(char *); +static void dump(struct sockaddr_in6 *, int); static struct in6_nbrinfo *getnbrinfo(struct in6_addr *, int, int); static char *ether_str(struct sockaddr_dl *); -int ndp_ether_aton(char *, u_char *); -void usage(void); -int rtmsg(int); -void ifinfo(char *, int, char **); -void rtrlist(void); -void plist(void); -void pfx_flush(void); -void rtr_flush(void); -void harmonize_rtr(void); +static int ndp_ether_aton(char *, u_char *); +static void usage(void); +static int rtmsg(int); +static void ifinfo(char *, int, char **); +static void rtrlist(void); +static void plist(void); +static void pfx_flush(void); +static void rtr_flush(void); +static void harmonize_rtr(void); #ifdef SIOCSDEFIFACE_IN6 /* XXX: check SIOCGDEFIFACE_IN6 as well? */ static void getdefif(void); static void setdefif(char *); @@ -163,15 +161,11 @@ static char *rtpref_str[] = { "low" /* 11 */ }; -int mode = 0; -char *arg = NULL; - int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { - int ch; + int ch, mode = 0; + char *arg = NULL; pid = getpid(); thiszone = gmt2local(0); @@ -320,8 +314,7 @@ main(argc, argv) * Process a file to set standard ndp entries */ static int -file(name) - char *name; +file(char *name) { FILE *fp; int i, retval; @@ -355,7 +348,7 @@ file(name) return (retval); } -void +static void getsocket() { if (s < 0) { @@ -367,23 +360,32 @@ getsocket() } } -struct sockaddr_in6 so_mask = {sizeof(so_mask), AF_INET6 }; -struct sockaddr_in6 blank_sin = {sizeof(blank_sin), AF_INET6 }, sin_m; -struct sockaddr_dl blank_sdl = {sizeof(blank_sdl), AF_LINK }, sdl_m; -time_t expire_time; -int flags, found_entry; -struct { +static struct sockaddr_in6 so_mask = { + .sin6_len = sizeof(so_mask), + .sin6_family = AF_INET6 +}; +static struct sockaddr_in6 blank_sin = { + .sin6_len = sizeof(blank_sin), + .sin6_family = AF_INET6 +}; +static struct sockaddr_in6 sin_m; +static struct sockaddr_dl blank_sdl = { + .sdl_len = sizeof(blank_sdl), + .sdl_family = AF_LINK +}; +static struct sockaddr_dl sdl_m; +static time_t expire_time; +static int flags, found_entry; +static struct { struct rt_msghdr m_rtm; char m_space[512]; -} m_rtmsg; +} m_rtmsg; /* * Set an individual neighbor cache entry */ -int -set(argc, argv) - int argc; - char **argv; +static int +set(int argc, char **argv) { register struct sockaddr_in6 *sin = &sin_m; register struct sockaddr_dl *sdl; @@ -457,9 +459,8 @@ overwrite: /* * Display an individual neighbor cache entry */ -void -get(host) - char *host; +static void +get(char *host) { struct sockaddr_in6 *sin = &sin_m; struct addrinfo hints, *res; @@ -475,7 +476,9 @@ get(host) return; } sin->sin6_addr = ((struct sockaddr_in6 *)res->ai_addr)->sin6_addr; - dump(&sin->sin6_addr, 0); + sin->sin6_scope_id = + ((struct sockaddr_in6 *)res->ai_addr)->sin6_scope_id; + dump(sin, 0); if (found_entry == 0) { getnameinfo((struct sockaddr *)sin, sin->sin6_len, host_buf, sizeof(host_buf), NULL ,0, @@ -488,9 +491,8 @@ get(host) /* * Delete a neighbor cache entry */ -int -delete(host) - char *host; +static int +delete(char *host) { struct sockaddr_in6 *sin = &sin_m; register struct rt_msghdr *rtm = &m_rtmsg.m_rtm; @@ -557,10 +559,8 @@ delete: /* * Dump the entire neighbor cache */ -void -dump(addr, cflag) - struct in6_addr *addr; - int cflag; +static void +dump(struct sockaddr_in6 *addr, int cflag) { int mib[6]; size_t needed; @@ -632,7 +632,9 @@ again:; continue; if (addr) { - if (!IN6_ARE_ADDR_EQUAL(addr, &sin->sin6_addr)) + if (IN6_ARE_ADDR_EQUAL(&addr->sin6_addr, + &sin->sin6_addr) == 0 || + addr->sin6_scope_id != sin->sin6_scope_id) continue; found_entry = 1; } else if (IN6_IS_ADDR_MULTICAST(&sin->sin6_addr)) @@ -765,10 +767,7 @@ again:; } static struct in6_nbrinfo * -getnbrinfo(addr, ifindex, warning) - struct in6_addr *addr; - int ifindex; - int warning; +getnbrinfo(struct in6_addr *addr, int ifindex, int warning) { static struct in6_nbrinfo nbi; int s; @@ -794,7 +793,6 @@ static char * ether_str(struct sockaddr_dl *sdl) { static char hbuf[NI_MAXHOST]; - char *cp; if (sdl->sdl_alen == ETHER_ADDR_LEN) { strlcpy(hbuf, ether_ntoa((struct ether_addr *)LLADDR(sdl)), @@ -808,10 +806,8 @@ ether_str(struct sockaddr_dl *sdl) return(hbuf); } -int -ndp_ether_aton(a, n) - char *a; - u_char *n; +static int +ndp_ether_aton(char *a, u_char *n) { int i, o[6]; @@ -826,7 +822,7 @@ ndp_ether_aton(a, n) return (0); } -void +static void usage() { printf("usage: ndp [-nt] hostname\n"); @@ -842,9 +838,8 @@ usage() exit(1); } -int -rtmsg(cmd) - int cmd; +static int +rtmsg(int cmd) { static int seq; int rlen; @@ -908,11 +903,8 @@ doit: return (0); } -void -ifinfo(ifname, argc, argv) - char *ifname; - int argc; - char **argv; +static void +ifinfo(char *ifname, int argc, char **argv) { struct in6_ndireq nd; int i, s; @@ -1071,7 +1063,7 @@ ifinfo(ifname, argc, argv) #define ND_RA_FLAG_RTPREF_MASK 0x18 /* 00011000 */ #endif -void +static void rtrlist() { int mib[] = { CTL_NET, PF_INET6, IPPROTO_ICMPV6, ICMPV6CTL_ND6_DRLIST }; @@ -1123,7 +1115,7 @@ rtrlist() free(buf); } -void +static void plist() { int mib[] = { CTL_NET, PF_INET6, IPPROTO_ICMPV6, ICMPV6CTL_ND6_PRLIST }; @@ -1237,7 +1229,7 @@ plist() free(buf); } -void +static void pfx_flush() { char dummyif[IFNAMSIZ+8]; @@ -1250,7 +1242,7 @@ pfx_flush() err(1, "ioctl(SIOCSPFXFLUSH_IN6)"); } -void +static void rtr_flush() { char dummyif[IFNAMSIZ+8]; @@ -1265,7 +1257,7 @@ rtr_flush() close(s); } -void +static void harmonize_rtr() { char dummyif[IFNAMSIZ+8]; @@ -1282,8 +1274,7 @@ harmonize_rtr() #ifdef SIOCSDEFIFACE_IN6 /* XXX: check SIOCGDEFIFACE_IN6 as well? */ static void -setdefif(ifname) - char *ifname; +setdefif(char *ifname) { struct in6_ndifreq ndifreq; unsigned int ifindex; @@ -1336,8 +1327,7 @@ getdefif() #endif static char * -sec2str(total) - time_t total; +sec2str(time_t total) { static char result[256]; int days, hours, mins, secs; @@ -1382,8 +1372,7 @@ sec2str(total) * from tcpdump/util.c */ static void -ts_print(tvp) - const struct timeval *tvp; +ts_print(const struct timeval *tvp) { int s; From owner-svn-src-stable@freebsd.org Sun Sep 13 03:15:38 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA417A02B1D; Sun, 13 Sep 2015 03:15:38 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BA9B218F1; Sun, 13 Sep 2015 03:15:38 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8D3FcaS000473; Sun, 13 Sep 2015 03:15:38 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8D3Fcn8000472; Sun, 13 Sep 2015 03:15:38 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201509130315.t8D3Fcn8000472@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sun, 13 Sep 2015 03:15: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: r287736 - stable/10/lib/libc/net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2015 03:15:38 -0000 Author: hrs Date: Sun Sep 13 03:15:37 2015 New Revision: 287736 URL: https://svnweb.freebsd.org/changeset/base/287736 Log: MFC 287349,287404: - Print sdl->sdl_data when sdl->sdl_nlen > 0 && sdl->sdl_alen == 0 as link_ntoa(3) does. - snprintf() returns at most size-1 of the chars printed into the buffer. (n == hostlen) also means the buffer length was too short. Modified: stable/10/lib/libc/net/getnameinfo.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/net/getnameinfo.c ============================================================================== --- stable/10/lib/libc/net/getnameinfo.c Sun Sep 13 03:09:21 2015 (r287735) +++ stable/10/lib/libc/net/getnameinfo.c Sun Sep 13 03:15:37 2015 (r287736) @@ -390,11 +390,22 @@ getnameinfo_link(const struct sockaddr * if (sdl->sdl_nlen == 0 && sdl->sdl_alen == 0 && sdl->sdl_slen == 0) { n = snprintf(host, hostlen, "link#%d", sdl->sdl_index); - if (n > hostlen) { + if (n >= hostlen) { *host = '\0'; - return EAI_MEMORY; + return (EAI_MEMORY); + } + return (0); + } + + if (sdl->sdl_nlen > 0 && sdl->sdl_alen == 0) { + n = sdl->sdl_nlen; + if (n >= hostlen) { + *host = '\0'; + return (EAI_MEMORY); } - return 0; + memcpy(host, sdl->sdl_data, sdl->sdl_nlen); + host[n] = '\0'; + return (0); } switch (sdl->sdl_type) { @@ -437,10 +448,7 @@ getnameinfo_link(const struct sockaddr * } static int -hexname(cp, len, host, hostlen) - const u_int8_t *cp; - char *host; - size_t len, hostlen; +hexname(const u_int8_t *cp, size_t len, char *host, size_t hostlen) { int i, n; char *outp = host; From owner-svn-src-stable@freebsd.org Sun Sep 13 03:59:30 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A2989CDF07; Sun, 13 Sep 2015 03:59:30 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A8751D06; Sun, 13 Sep 2015 03:59:30 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8D3xUtr017151; Sun, 13 Sep 2015 03:59:30 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8D3xUlF017150; Sun, 13 Sep 2015 03:59:30 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201509130359.t8D3xUlF017150@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sun, 13 Sep 2015 03:59: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: r287737 - stable/10/etc/rc.d X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2015 03:59:30 -0000 Author: hrs Date: Sun Sep 13 03:59:29 2015 New Revision: 287737 URL: https://svnweb.freebsd.org/changeset/base/287737 Log: MFC 287613: Update only static routes when an interface is specified. This fixed a bad side-effect reported in PR 202144. PR: 202144 Modified: stable/10/etc/rc.d/netif Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/rc.d/netif ============================================================================== --- stable/10/etc/rc.d/netif Sun Sep 13 03:15:37 2015 (r287736) +++ stable/10/etc/rc.d/netif Sun Sep 13 03:59:29 2015 (r287737) @@ -85,7 +85,7 @@ network_start() fi if [ -f /etc/rc.d/routing -a -n "$cmdifn" ] ; then for _if in $cmdifn; do - /etc/rc.d/routing start any $_if + /etc/rc.d/routing static any $_if done fi } From owner-svn-src-stable@freebsd.org Sun Sep 13 04:02:53 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A73AA010F1; Sun, 13 Sep 2015 04:02:53 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8AE6D1070; Sun, 13 Sep 2015 04:02:53 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8D42rY6021011; Sun, 13 Sep 2015 04:02:53 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8D42rPP021010; Sun, 13 Sep 2015 04:02:53 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201509130402.t8D42rPP021010@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sun, 13 Sep 2015 04:02: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: r287738 - stable/10/etc/rc.d X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2015 04:02:53 -0000 Author: hrs Date: Sun Sep 13 04:02:52 2015 New Revision: 287738 URL: https://svnweb.freebsd.org/changeset/base/287738 Log: MFC 287614: - Add uid check. - Report delay<0 as a warning. Modified: stable/10/etc/rc.d/bgfsck Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/rc.d/bgfsck ============================================================================== --- stable/10/etc/rc.d/bgfsck Sun Sep 13 03:59:29 2015 (r287737) +++ stable/10/etc/rc.d/bgfsck Sun Sep 13 04:02:52 2015 (r287738) @@ -12,17 +12,24 @@ name="background-fsck" rcvar="background_fsck" start_cmd="bgfsck_start" +start_precmd="bgfsck_start_precmd" stop_cmd=":" +bgfsck_start_precmd() +{ + if [ $($ID -u) != 0 ]; then + err 1 "Must be root." + fi +} + bgfsck_start() { - if [ -z "${rc_force}" ]; then - background_fsck_delay=${background_fsck_delay:-0} - else + : ${background_fsck_delay=0} + if [ -n "${rc_force}" ]; then background_fsck_delay=0 fi if [ ${background_fsck_delay} -lt 0 ]; then - echo "Background file system checks delayed indefinitely" + warn "Background file system checks delayed indefinitely" return 0 fi From owner-svn-src-stable@freebsd.org Sun Sep 13 04:05:28 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9A4ECA0123F; Sun, 13 Sep 2015 04:05:28 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8AAC011D4; Sun, 13 Sep 2015 04:05:28 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8D45Sai021176; Sun, 13 Sep 2015 04:05:28 GMT (envelope-from hrs@FreeBSD.org) Received: (from hrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8D45SeG021175; Sun, 13 Sep 2015 04:05:28 GMT (envelope-from hrs@FreeBSD.org) Message-Id: <201509130405.t8D45SeG021175@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hrs set sender to hrs@FreeBSD.org using -f From: Hiroki Sato Date: Sun, 13 Sep 2015 04:05: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: r287739 - stable/10/etc/rc.d X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2015 04:05:28 -0000 Author: hrs Date: Sun Sep 13 04:05:27 2015 New Revision: 287739 URL: https://svnweb.freebsd.org/changeset/base/287739 Log: MFC 287615: Use read to parse a line instead of set. Modified: stable/10/etc/rc.d/jail Directory Properties: stable/10/ (props changed) Modified: stable/10/etc/rc.d/jail ============================================================================== --- stable/10/etc/rc.d/jail Sun Sep 13 04:02:52 2015 (r287738) +++ stable/10/etc/rc.d/jail Sun Sep 13 04:05:27 2015 (r287739) @@ -419,7 +419,7 @@ jail_status() jail_start() { - local _j _jid _jl + local _j _jid _jl _id _name if [ $# = 0 ]; then return @@ -432,10 +432,9 @@ jail_start() command_args="-f $jail_conf -c" _tmp=`mktemp -t jail` || exit 3 if $command $rc_flags $command_args >> $_tmp 2>&1; then - $jail_jls jid name | while read IN; do - set -- $IN - echo -n " $2" - echo $1 > /var/run/jail_$2.id + $jail_jls jid name | while read _id _name; do + echo -n " $_name" + echo $_id > /var/run/jail_${_name}.id done else tail -1 $_tmp From owner-svn-src-stable@freebsd.org Sun Sep 13 07:15:46 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6B01A0115C; Sun, 13 Sep 2015 07:15:46 +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 7D7801F48; Sun, 13 Sep 2015 07:15:46 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8D7FkT4098898; Sun, 13 Sep 2015 07:15:46 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8D7Fjgw098894; Sun, 13 Sep 2015 07:15:45 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201509130715.t8D7Fjgw098894@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 13 Sep 2015 07:15: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: r287746 - stable/10/usr.sbin/pciconf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2015 07:15:46 -0000 Author: bapt Date: Sun Sep 13 07:15:45 2015 New Revision: 287746 URL: https://svnweb.freebsd.org/changeset/base/287746 Log: MFC: r287522 Prefer pciids database from ports if present Given the pciids database on ports is updated more often than the one in base prefer this version if present, otherwise read the one from base. Relnotes: yes Differential Revision: https://reviews.freebsd.org/D3391 Modified: stable/10/usr.sbin/pciconf/pathnames.h stable/10/usr.sbin/pciconf/pciconf.8 stable/10/usr.sbin/pciconf/pciconf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/pciconf/pathnames.h ============================================================================== --- stable/10/usr.sbin/pciconf/pathnames.h Sun Sep 13 07:15:14 2015 (r287745) +++ stable/10/usr.sbin/pciconf/pathnames.h Sun Sep 13 07:15:45 2015 (r287746) @@ -1,3 +1,4 @@ /* $FreeBSD$ */ #define _PATH_DEVPCI "/dev/pci" #define _PATH_PCIVDB "/usr/share/misc/pci_vendors" +#define _PATH_LPCIVDB "/usr/local/share/pciids/pci.ids" Modified: stable/10/usr.sbin/pciconf/pciconf.8 ============================================================================== --- stable/10/usr.sbin/pciconf/pciconf.8 Sun Sep 13 07:15:14 2015 (r287745) +++ stable/10/usr.sbin/pciconf/pciconf.8 Sun Sep 13 07:15:45 2015 (r287746) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 20, 2014 +.Dd September 06, 2015 .Dt PCICONF 8 .Os .Sh NAME @@ -281,7 +281,9 @@ indicates a halfword (two-byte) operatio The default is to read or write a longword (four bytes). .Sh ENVIRONMENT -The PCI vendor/device information database is normally read from +PCI vendor and device information is read from +.Pa /usr/local/share/pciids/pci.ids . +If that file is not present, it is read from .Pa /usr/share/misc/pci_vendors . This path can be overridden by setting the environment variable .Ev PCICONF_VENDOR_DATABASE . Modified: stable/10/usr.sbin/pciconf/pciconf.c ============================================================================== --- stable/10/usr.sbin/pciconf/pciconf.c Sun Sep 13 07:15:14 2015 (r287745) +++ stable/10/usr.sbin/pciconf/pciconf.c Sun Sep 13 07:15:45 2015 (r287746) @@ -542,9 +542,12 @@ load_vendors(void) */ TAILQ_INIT(&pci_vendors); if ((dbf = getenv("PCICONF_VENDOR_DATABASE")) == NULL) + dbf = _PATH_LPCIVDB; + if ((db = fopen(dbf, "r")) == NULL) { dbf = _PATH_PCIVDB; - if ((db = fopen(dbf, "r")) == NULL) - return(1); + if ((db = fopen(dbf, "r")) == NULL) + return(1); + } cv = NULL; cd = NULL; error = 0; From owner-svn-src-stable@freebsd.org Sun Sep 13 13:31:53 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 47255A039F7; Sun, 13 Sep 2015 13:31:53 +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 368FB1DBE; Sun, 13 Sep 2015 13:31:53 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8DDVrJK069040; Sun, 13 Sep 2015 13:31:53 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8DDVqcs069034; Sun, 13 Sep 2015 13:31:52 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201509131331.t8DDVqcs069034@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 13 Sep 2015 13:31: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: r287749 - in stable/10/bin/sh: . tests/errors X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2015 13:31:53 -0000 Author: jilles Date: Sun Sep 13 13:31:51 2015 New Revision: 287749 URL: https://svnweb.freebsd.org/changeset/base/287749 Log: MFC r287081: sh: Don't create bad parse result when postponing a bad substitution error. An invalid substitution like ${var@} does not cause a parse error but is stored in the intermediate representation, to be written as part of the error message. If there is a CTL* byte in the stored part, this confuses some code such as the code to skip an unused alternative such as in ${var-alternative}. To keep things simple, do not store CTL* bytes. Found with afl-fuzz. Added: stable/10/bin/sh/tests/errors/bad-parm-exp7.0 - copied unchanged from r287081, head/bin/sh/tests/errors/bad-parm-exp7.0 stable/10/bin/sh/tests/errors/bad-parm-exp8.0 - copied unchanged from r287081, head/bin/sh/tests/errors/bad-parm-exp8.0 Modified: stable/10/bin/sh/parser.c stable/10/bin/sh/tests/errors/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/sh/parser.c ============================================================================== --- stable/10/bin/sh/parser.c Sun Sep 13 13:00:20 2015 (r287748) +++ stable/10/bin/sh/parser.c Sun Sep 13 13:31:51 2015 (r287749) @@ -1671,7 +1671,7 @@ varname: pungetc(); else if (c == '\n' || c == PEOF) synerror("Unexpected end of line in substitution"); - else + else if (BASESYNTAX[c] != CCTL) USTPUTC(c, out); } if (subtype == 0) { @@ -1687,7 +1687,8 @@ varname: synerror("Unexpected end of line in substitution"); if (flags == VSNUL) STPUTC(':', out); - STPUTC(c, out); + if (BASESYNTAX[c] != CCTL) + STPUTC(c, out); subtype = VSERROR; } else subtype = p - types + VSNORMAL; Modified: stable/10/bin/sh/tests/errors/Makefile ============================================================================== --- stable/10/bin/sh/tests/errors/Makefile Sun Sep 13 13:00:20 2015 (r287748) +++ stable/10/bin/sh/tests/errors/Makefile Sun Sep 13 13:31:51 2015 (r287749) @@ -17,6 +17,8 @@ FILES+= bad-parm-exp3.2 bad-parm-exp3.2 FILES+= bad-parm-exp4.2 bad-parm-exp4.2.stderr FILES+= bad-parm-exp5.2 bad-parm-exp5.2.stderr FILES+= bad-parm-exp6.2 bad-parm-exp6.2.stderr +FILES+= bad-parm-exp7.0 +FILES+= bad-parm-exp8.0 FILES+= option-error.0 FILES+= redirection-error.0 FILES+= redirection-error2.2 Copied: stable/10/bin/sh/tests/errors/bad-parm-exp7.0 (from r287081, head/bin/sh/tests/errors/bad-parm-exp7.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/bin/sh/tests/errors/bad-parm-exp7.0 Sun Sep 13 13:31:51 2015 (r287749, copy of r287081, head/bin/sh/tests/errors/bad-parm-exp7.0) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +v=1 +eval ": $(printf '${v-${\372}}')" Copied: stable/10/bin/sh/tests/errors/bad-parm-exp8.0 (from r287081, head/bin/sh/tests/errors/bad-parm-exp8.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/bin/sh/tests/errors/bad-parm-exp8.0 Sun Sep 13 13:31:51 2015 (r287749, copy of r287081, head/bin/sh/tests/errors/bad-parm-exp8.0) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +v=1 +eval ": $(printf '${v-${w\372}}')" From owner-svn-src-stable@freebsd.org Sun Sep 13 13:43:10 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D1655A0209D; Sun, 13 Sep 2015 13:43:10 +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 C149F14C0; Sun, 13 Sep 2015 13:43:10 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8DDhA2A073943; Sun, 13 Sep 2015 13:43:10 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8DDh9ol073937; Sun, 13 Sep 2015 13:43:09 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201509131343.t8DDh9ol073937@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 13 Sep 2015 13:43:09 +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: r287750 - stable/10/bin/sh X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2015 13:43:11 -0000 Author: jilles Date: Sun Sep 13 13:43:08 2015 New Revision: 287750 URL: https://svnweb.freebsd.org/changeset/base/287750 Log: MFC r272575: sh: Eliminate some gotos. This MFC is to avoid conflicts in the MFC of r287148. Modified: stable/10/bin/sh/eval.c stable/10/bin/sh/expand.c stable/10/bin/sh/jobs.c stable/10/bin/sh/redir.c stable/10/bin/sh/trap.c Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/sh/eval.c ============================================================================== --- stable/10/bin/sh/eval.c Sun Sep 13 13:31:51 2015 (r287749) +++ stable/10/bin/sh/eval.c Sun Sep 13 13:43:08 2015 (r287750) @@ -316,9 +316,10 @@ evalloop(union node *n, int flags) loopnest++; status = 0; for (;;) { - evaltree(n->nbinary.ch1, EV_TESTED); + if (!evalskip) + evaltree(n->nbinary.ch1, EV_TESTED); if (evalskip) { -skipping: if (evalskip == SKIPCONT && --skipcount <= 0) { + if (evalskip == SKIPCONT && --skipcount <= 0) { evalskip = 0; continue; } @@ -337,8 +338,6 @@ skipping: if (evalskip == SKIPCONT && } evaltree(n->nbinary.ch2, flags); status = exitstatus; - if (evalskip) - goto skipping; } loopnest--; exitstatus = status; @@ -648,15 +647,15 @@ evalbackcmd(union node *n, struct backcm struct jmploc *savehandler; struct localvar *savelocalvars; - setstackmark(&smark); result->fd = -1; result->buf = NULL; result->nleft = 0; result->jp = NULL; if (n == NULL) { exitstatus = 0; - goto out; + return; } + setstackmark(&smark); exitstatus = oexitstatus; if (is_valid_fast_cmdsubst(n)) { savelocalvars = localvars; @@ -698,7 +697,6 @@ evalbackcmd(union node *n, struct backcm result->fd = pip[0]; result->jp = jp; } -out: popstackmark(&smark); TRACE(("evalbackcmd done: fd=%d buf=%p nleft=%d jp=%p\n", result->fd, result->buf, result->nleft, result->jp)); Modified: stable/10/bin/sh/expand.c ============================================================================== --- stable/10/bin/sh/expand.c Sun Sep 13 13:31:51 2015 (r287749) +++ stable/10/bin/sh/expand.c Sun Sep 13 13:43:08 2015 (r287750) @@ -323,24 +323,19 @@ exptilde(char *p, int flag) done: *p = '\0'; if (*(startp+1) == '\0') { - if ((home = lookupvar("HOME")) == NULL) - goto lose; + home = lookupvar("HOME"); } else { - if ((pw = getpwnam(startp+1)) == NULL) - goto lose; - home = pw->pw_dir; + pw = getpwnam(startp+1); + home = pw != NULL ? pw->pw_dir : NULL; } - if (*home == '\0') - goto lose; *p = c; + if (home == NULL || *home == '\0') + return (startp); if (quotes) STPUTS_QUOTES(home, DQSYNTAX, expdest); else STPUTS(home, expdest); return (p); -lose: - *p = c; - return (startp); } Modified: stable/10/bin/sh/jobs.c ============================================================================== --- stable/10/bin/sh/jobs.c Sun Sep 13 13:31:51 2015 (r287749) +++ stable/10/bin/sh/jobs.c Sun Sep 13 13:43:08 2015 (r287750) @@ -347,13 +347,13 @@ showjob(struct job *jp, int mode) strcat(statestr, " (core dumped)"); } - for (ps = jp->ps ; ; ps++) { /* for each process */ + for (ps = jp->ps ; procno > 0 ; ps++, procno--) { /* for each process */ if (mode == SHOWJOBS_PIDS || mode == SHOWJOBS_PGIDS) { out1fmt("%d\n", (int)ps->pid); - goto skip; + continue; } if (mode != SHOWJOBS_VERBOSE && ps != jp->ps) - goto skip; + continue; if (jobno == curr && ps == jp->ps) c = '+'; else if (jobno == prev && ps == jp->ps) @@ -384,8 +384,6 @@ showjob(struct job *jp, int mode) out1c('\n'); } else printjobcmd(jp); -skip: if (--procno <= 0) - break; } } Modified: stable/10/bin/sh/redir.c ============================================================================== --- stable/10/bin/sh/redir.c Sun Sep 13 13:31:51 2015 (r287749) +++ stable/10/bin/sh/redir.c Sun Sep 13 13:43:08 2015 (r287750) @@ -173,21 +173,12 @@ openredirect(union node *redir, char mem fname = redir->nfile.expfname; if ((f = open(fname, O_RDONLY)) < 0) error("cannot open %s: %s", fname, strerror(errno)); -movefd: - if (f != fd) { - if (dup2(f, fd) == -1) { - e = errno; - close(f); - error("%d: %s", fd, strerror(e)); - } - close(f); - } break; case NFROMTO: fname = redir->nfile.expfname; if ((f = open(fname, O_RDWR|O_CREAT, 0666)) < 0) error("cannot create %s: %s", fname, strerror(errno)); - goto movefd; + break; case NTO: if (Cflag) { fname = redir->nfile.expfname; @@ -205,19 +196,19 @@ movefd: } else error("cannot create %s: %s", fname, strerror(EEXIST)); - goto movefd; + break; } /* FALLTHROUGH */ case NCLOBBER: fname = redir->nfile.expfname; if ((f = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) error("cannot create %s: %s", fname, strerror(errno)); - goto movefd; + break; case NAPPEND: fname = redir->nfile.expfname; if ((f = open(fname, O_WRONLY|O_CREAT|O_APPEND, 0666)) < 0) error("cannot create %s: %s", fname, strerror(errno)); - goto movefd; + break; case NTOFD: case NFROMFD: if (redir->ndup.dupfd >= 0) { /* if not ">&-" */ @@ -231,14 +222,22 @@ movefd: } else { close(fd); } - break; + return; case NHERE: case NXHERE: f = openhere(redir); - goto movefd; + break; default: abort(); } + if (f != fd) { + if (dup2(f, fd) == -1) { + e = errno; + close(f); + error("%d: %s", fd, strerror(e)); + } + close(f); + } } Modified: stable/10/bin/sh/trap.c ============================================================================== --- stable/10/bin/sh/trap.c Sun Sep 13 13:31:51 2015 (r287749) +++ stable/10/bin/sh/trap.c Sun Sep 13 13:43:08 2015 (r287750) @@ -510,28 +510,25 @@ exitshell_savedstatus(void) exiting_exitstatus = oexitstatus; } exitstatus = oexitstatus = exiting_exitstatus; - if (setjmp(loc1.loc)) { - goto l1; + if (!setjmp(loc1.loc)) { + handler = &loc1; + if ((p = trap[0]) != NULL && *p != '\0') { + /* + * Reset evalskip, or the trap on EXIT could be + * interrupted if the last command was a "return". + */ + evalskip = 0; + trap[0] = NULL; + evalstring(p, 0); + } } - if (setjmp(loc2.loc)) { - goto l2; - } - handler = &loc1; - if ((p = trap[0]) != NULL && *p != '\0') { - /* - * Reset evalskip, or the trap on EXIT could be - * interrupted if the last command was a "return". - */ - evalskip = 0; - trap[0] = NULL; - evalstring(p, 0); - } -l1: handler = &loc2; /* probably unnecessary */ - flushall(); + if (!setjmp(loc2.loc)) { + handler = &loc2; /* probably unnecessary */ + flushall(); #if JOBS - setjobctl(0); + setjobctl(0); #endif -l2: + } if (sig != 0 && sig != SIGSTOP && sig != SIGTSTP && sig != SIGTTIN && sig != SIGTTOU) { signal(sig, SIG_DFL); From owner-svn-src-stable@freebsd.org Sun Sep 13 13:52:55 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0753CA027EA; Sun, 13 Sep 2015 13:52:55 +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 EB7F31C43; Sun, 13 Sep 2015 13:52:54 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8DDqsbr078596; Sun, 13 Sep 2015 13:52:54 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8DDqsEX078595; Sun, 13 Sep 2015 13:52:54 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201509131352.t8DDqsEX078595@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 13 Sep 2015 13:52: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: r287751 - stable/10/bin/sh X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2015 13:52:55 -0000 Author: jilles Date: Sun Sep 13 13:52:54 2015 New Revision: 287751 URL: https://svnweb.freebsd.org/changeset/base/287751 Log: MFC r278826,279330: sh: Various cleanups to expand.c: * Remove some gotos. * Remove unused parameter. * Remove duplicate code. This MFC is to avoid conflicts in the MFC of r287148. Modified: stable/10/bin/sh/expand.c Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/sh/expand.c ============================================================================== --- stable/10/bin/sh/expand.c Sun Sep 13 13:43:08 2015 (r287750) +++ stable/10/bin/sh/expand.c Sun Sep 13 13:52:54 2015 (r287751) @@ -105,11 +105,12 @@ static void expbackq(union node *, int, static int subevalvar(char *, char *, int, int, int, int, int); static char *evalvar(char *, int); static int varisset(const char *, int); +static void strtodest(const char *, int, int, int); static void varvalue(const char *, int, int, int); static void recordregion(int, int, int); static void removerecordregions(int); static void ifsbreakup(char *, struct arglist *); -static void expandmeta(struct strlist *, int); +static void expandmeta(struct strlist *); static void expmeta(char *, char *); static void addfname(char *); static struct strlist *expsort(struct strlist *); @@ -175,7 +176,7 @@ expandarg(union node *arg, struct arglis ifsbreakup(p, &exparg); *exparg.lastp = NULL; exparg.lastp = &exparg.list; - expandmeta(exparg.list, flag); + expandmeta(exparg.list); } else { sp = (struct strlist *)stalloc(sizeof (struct strlist)); sp->text = p; @@ -298,9 +299,9 @@ exptilde(char *p, int flag) char c, *startp = p; struct passwd *pw; char *home; - int quotes = flag & (EXP_FULL | EXP_CASE); - while ((c = *p) != '\0') { + for (;;) { + c = *p; switch(c) { case CTLESC: /* This means CTL* are always considered quoted. */ case CTLVAR: @@ -311,31 +312,27 @@ exptilde(char *p, int flag) case CTLQUOTEMARK: return (startp); case ':': - if (flag & EXP_VARTILDE) - goto done; - break; + if ((flag & EXP_VARTILDE) == 0) + break; + /* FALLTHROUGH */ + case '\0': case '/': case CTLENDVAR: - goto done; + *p = '\0'; + if (*(startp+1) == '\0') { + home = lookupvar("HOME"); + } else { + pw = getpwnam(startp+1); + home = pw != NULL ? pw->pw_dir : NULL; + } + *p = c; + if (home == NULL || *home == '\0') + return (startp); + strtodest(home, flag, VSNORMAL, 1); + return (p); } p++; } -done: - *p = '\0'; - if (*(startp+1) == '\0') { - home = lookupvar("HOME"); - } else { - pw = getpwnam(startp+1); - home = pw != NULL ? pw->pw_dir : NULL; - } - *p = c; - if (home == NULL || *home == '\0') - return (startp); - if (quotes) - STPUTS_QUOTES(home, DQSYNTAX, expdest); - else - STPUTS(home, expdest); - return (p); } @@ -496,6 +493,17 @@ expbackq(union node *cmd, int quoted, in +static void +recordleft(const char *str, const char *loc, char *startp) +{ + int amount; + + amount = ((str - 1) - (loc - startp)) - expdest; + STADJUST(amount, expdest); + while (loc != str - 1) + *startp++ = *loc++; +} + static int subevalvar(char *p, char *str, int strloc, int subtype, int startloc, int varflags, int quotes) @@ -540,7 +548,8 @@ subevalvar(char *p, char *str, int strlo *loc = '\0'; if (patmatch(str, startp, quotes)) { *loc = c; - goto recordleft; + recordleft(str, loc, startp); + return 1; } *loc = c; if (quotes && *loc == CTLESC) @@ -554,7 +563,8 @@ subevalvar(char *p, char *str, int strlo *loc = '\0'; if (patmatch(str, startp, quotes)) { *loc = c; - goto recordleft; + recordleft(str, loc, startp); + return 1; } *loc = c; loc--; @@ -602,13 +612,6 @@ subevalvar(char *p, char *str, int strlo default: abort(); } - -recordleft: - amount = ((str - 1) - (loc - startp)) - expdest; - STADJUST(amount, expdest); - while (loc != str - 1) - *startp++ = *loc++; - return 1; } @@ -633,6 +636,7 @@ evalvar(char *p, int flag) int varlenb; int easy; int quotes = flag & (EXP_FULL | EXP_CASE); + int record = 0; varflags = (unsigned char)*p++; subtype = varflags & VSTYPE; @@ -690,22 +694,15 @@ again: /* jump here after setting a vari STADJUST(-varlenb, expdest); } } else { - char const *syntax = (varflags & VSQUOTE) ? DQSYNTAX - : BASESYNTAX; - if (subtype == VSLENGTH) { for (;*val; val++) if (!localeisutf8 || (*val & 0xC0) != 0x80) varlen++; } - else { - if (quotes) - STPUTS_QUOTES(val, syntax, expdest); - else - STPUTS(val, expdest); - - } + else + strtodest(val, flag, subtype, + varflags & VSQUOTE); } } @@ -719,15 +716,11 @@ again: /* jump here after setting a vari switch (subtype) { case VSLENGTH: expdest = cvtnum(varlen, expdest); - goto record; + record = 1; + break; case VSNORMAL: - if (!easy) - break; -record: - recordregion(startloc, expdest - stackblock(), - varflags & VSQUOTE || (ifsset() && ifsval()[0] == '\0' && - (*var == '@' || *var == '*'))); + record = easy; break; case VSPLUS: @@ -737,8 +730,7 @@ record: (varflags & VSQUOTE ? EXP_LIT_QUOTED : 0)); break; } - if (easy) - goto record; + record = easy; break; case VSTRIMLEFT: @@ -760,7 +752,8 @@ record: } /* Remove any recorded regions beyond start of variable */ removerecordregions(startloc); - goto record; + record = 1; + break; case VSASSIGN: case VSQUESTION: @@ -777,8 +770,7 @@ record: } break; } - if (easy) - goto record; + record = easy; break; case VSERROR: @@ -790,6 +782,11 @@ record: abort(); } + if (record) + recordregion(startloc, expdest - stackblock(), + varflags & VSQUOTE || (ifsset() && ifsval()[0] == '\0' && + (*var == '@' || *var == '*'))); + if (subtype != VSNORMAL) { /* skip to end of alternative */ int nesting = 1; for (;;) { @@ -1092,7 +1089,7 @@ static char expdir[PATH_MAX]; * The results are stored in the list exparg. */ static void -expandmeta(struct strlist *str, int flag __unused) +expandmeta(struct strlist *str) { char *p; struct strlist **savelastp; @@ -1478,16 +1475,14 @@ patmatch(const char *pattern, const char endp = p; if (*endp == '!' || *endp == '^') endp++; - for (;;) { + do { while (*endp == CTLQUOTEMARK) endp++; if (*endp == 0) goto dft; /* no matching ] */ if (*endp == CTLESC) endp++; - if (*++endp == ']') - break; - } + } while (*++endp != ']'); invert = 0; if (*p == '!' || *p == '^') { invert++; From owner-svn-src-stable@freebsd.org Sun Sep 13 13:58:47 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82DC7A02ADF; Sun, 13 Sep 2015 13:58:47 +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 672FA1FC4; Sun, 13 Sep 2015 13:58:47 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8DDwlW0079413; Sun, 13 Sep 2015 13:58:47 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8DDwklq079410; Sun, 13 Sep 2015 13:58:46 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201509131358.t8DDwklq079410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 13 Sep 2015 13:58:46 +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: r287752 - in stable/10/bin/sh: . tests/builtins X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2015 13:58:47 -0000 Author: jilles Date: Sun Sep 13 13:58:46 2015 New Revision: 287752 URL: https://svnweb.freebsd.org/changeset/base/287752 Log: MFC r287148: sh: Fix out of bounds read when there is no ] after a [:class:]. The initial check for a matching ] was incorrect if a ] may be consumed by a [:class:]. The subsequent loop assumed that there must be a ]. Remove the initial check and make the loop cope with a missing ]. Found with afl-fuzz. Added: stable/10/bin/sh/tests/builtins/case20.0 - copied unchanged from r287148, head/bin/sh/tests/builtins/case20.0 Modified: stable/10/bin/sh/expand.c stable/10/bin/sh/tests/builtins/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/sh/expand.c ============================================================================== --- stable/10/bin/sh/expand.c Sun Sep 13 13:52:54 2015 (r287751) +++ stable/10/bin/sh/expand.c Sun Sep 13 13:58:46 2015 (r287752) @@ -1468,21 +1468,11 @@ patmatch(const char *pattern, const char bt_q = q; break; case '[': { - const char *endp; + const char *savep, *saveq; int invert, found; wchar_t chr; - endp = p; - if (*endp == '!' || *endp == '^') - endp++; - do { - while (*endp == CTLQUOTEMARK) - endp++; - if (*endp == 0) - goto dft; /* no matching ] */ - if (*endp == CTLESC) - endp++; - } while (*++endp != ']'); + savep = p, saveq = q; invert = 0; if (*p == '!' || *p == '^') { invert++; @@ -1501,6 +1491,11 @@ patmatch(const char *pattern, const char chr = (unsigned char)*q++; c = *p++; do { + if (c == '\0') { + p = savep, q = saveq; + c = '['; + goto dft; + } if (c == CTLQUOTEMARK) continue; if (c == '[' && *p == ':') { Modified: stable/10/bin/sh/tests/builtins/Makefile ============================================================================== --- stable/10/bin/sh/tests/builtins/Makefile Sun Sep 13 13:52:54 2015 (r287751) +++ stable/10/bin/sh/tests/builtins/Makefile Sun Sep 13 13:58:46 2015 (r287752) @@ -34,6 +34,7 @@ FILES+= case16.0 FILES+= case17.0 FILES+= case18.0 FILES+= case19.0 +FILES+= case20.0 FILES+= cd1.0 FILES+= cd2.0 FILES+= cd3.0 Copied: stable/10/bin/sh/tests/builtins/case20.0 (from r287148, head/bin/sh/tests/builtins/case20.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/bin/sh/tests/builtins/case20.0 Sun Sep 13 13:58:46 2015 (r287752, copy of r287148, head/bin/sh/tests/builtins/case20.0) @@ -0,0 +1,9 @@ +# $FreeBSD$ + +# Shells do not agree about what this pattern should match, but it is +# certain that it must not crash and the missing close bracket must not +# be simply ignored. + +case B in +[[:alpha:]) echo bad ;; +esac From owner-svn-src-stable@freebsd.org Sun Sep 13 14:24:16 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A5DC3A037A7; Sun, 13 Sep 2015 14:24:16 +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 8702F1074; Sun, 13 Sep 2015 14:24:16 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8DEOGnM093084; Sun, 13 Sep 2015 14:24:16 GMT (envelope-from jilles@FreeBSD.org) Received: (from jilles@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8DEODMh093070; Sun, 13 Sep 2015 14:24:13 GMT (envelope-from jilles@FreeBSD.org) Message-Id: <201509131424.t8DEODMh093070@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jilles set sender to jilles@FreeBSD.org using -f From: Jilles Tjoelker Date: Sun, 13 Sep 2015 14:24:13 +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: r287755 - in stable/10/bin/sh/tests: expansion parameters parser X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2015 14:24:16 -0000 Author: jilles Date: Sun Sep 13 14:24:12 2015 New Revision: 287755 URL: https://svnweb.freebsd.org/changeset/base/287755 Log: MFC r268436,273243,278806,280920,286971: sh: Add various tests. These new tests from head pass with unmodified stable/10 sh. Added: stable/10/bin/sh/tests/expansion/ifs5.0 - copied unchanged from r278806, head/bin/sh/tests/expansion/ifs5.0 stable/10/bin/sh/tests/expansion/ifs6.0 - copied unchanged from r280920, head/bin/sh/tests/expansion/ifs6.0 stable/10/bin/sh/tests/expansion/ifs7.0 - copied unchanged from r280920, head/bin/sh/tests/expansion/ifs7.0 stable/10/bin/sh/tests/expansion/pathname5.0 - copied unchanged from r278806, head/bin/sh/tests/expansion/pathname5.0 stable/10/bin/sh/tests/parameters/positional3.0 - copied unchanged from r268436, head/bin/sh/tests/parameters/positional3.0 stable/10/bin/sh/tests/parser/dollar-quote12.0 - copied unchanged from r286971, head/bin/sh/tests/parser/dollar-quote12.0 stable/10/bin/sh/tests/parser/line-cont1.0 - copied unchanged from r273243, head/bin/sh/tests/parser/line-cont1.0 stable/10/bin/sh/tests/parser/line-cont2.0 - copied unchanged from r273243, head/bin/sh/tests/parser/line-cont2.0 stable/10/bin/sh/tests/parser/line-cont3.0 - copied unchanged from r273243, head/bin/sh/tests/parser/line-cont3.0 Modified: stable/10/bin/sh/tests/expansion/Makefile stable/10/bin/sh/tests/parameters/Makefile stable/10/bin/sh/tests/parser/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/sh/tests/expansion/Makefile ============================================================================== --- stable/10/bin/sh/tests/expansion/Makefile Sun Sep 13 14:04:42 2015 (r287754) +++ stable/10/bin/sh/tests/expansion/Makefile Sun Sep 13 14:24:12 2015 (r287755) @@ -45,6 +45,9 @@ FILES+= ifs1.0 FILES+= ifs2.0 FILES+= ifs3.0 FILES+= ifs4.0 +FILES+= ifs5.0 +FILES+= ifs6.0 +FILES+= ifs7.0 FILES+= length1.0 FILES+= length2.0 FILES+= length3.0 @@ -59,6 +62,7 @@ FILES+= pathname1.0 FILES+= pathname2.0 FILES+= pathname3.0 FILES+= pathname4.0 +FILES+= pathname5.0 FILES+= plus-minus1.0 FILES+= plus-minus2.0 FILES+= plus-minus3.0 Copied: stable/10/bin/sh/tests/expansion/ifs5.0 (from r278806, head/bin/sh/tests/expansion/ifs5.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/bin/sh/tests/expansion/ifs5.0 Sun Sep 13 14:24:12 2015 (r287755, copy of r278806, head/bin/sh/tests/expansion/ifs5.0) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +set -- $(echo a b c d) +[ "$#" = 4 ] Copied: stable/10/bin/sh/tests/expansion/ifs6.0 (from r280920, head/bin/sh/tests/expansion/ifs6.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/bin/sh/tests/expansion/ifs6.0 Sun Sep 13 14:24:12 2015 (r287755, copy of r280920, head/bin/sh/tests/expansion/ifs6.0) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +IFS=': ' +x=': :' +set -- $x +[ "$#|$1|$2|$3" = "2|||" ] Copied: stable/10/bin/sh/tests/expansion/ifs7.0 (from r280920, head/bin/sh/tests/expansion/ifs7.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/bin/sh/tests/expansion/ifs7.0 Sun Sep 13 14:24:12 2015 (r287755, copy of r280920, head/bin/sh/tests/expansion/ifs7.0) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +IFS=2 +set -- $((123)) +[ "$#|$1|$2|$3" = "2|1|3|" ] Copied: stable/10/bin/sh/tests/expansion/pathname5.0 (from r278806, head/bin/sh/tests/expansion/pathname5.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/bin/sh/tests/expansion/pathname5.0 Sun Sep 13 14:24:12 2015 (r287755, copy of r278806, head/bin/sh/tests/expansion/pathname5.0) @@ -0,0 +1,3 @@ +# $FreeBSD$ + +[ `echo '/[e]tc'` = /etc ] Modified: stable/10/bin/sh/tests/parameters/Makefile ============================================================================== --- stable/10/bin/sh/tests/parameters/Makefile Sun Sep 13 14:04:42 2015 (r287754) +++ stable/10/bin/sh/tests/parameters/Makefile Sun Sep 13 14:24:12 2015 (r287755) @@ -13,6 +13,7 @@ FILES+= optind1.0 FILES+= optind2.0 FILES+= positional1.0 FILES+= positional2.0 +FILES+= positional3.0 FILES+= positional5.0 FILES+= pwd1.0 FILES+= pwd2.0 Copied: stable/10/bin/sh/tests/parameters/positional3.0 (from r268436, head/bin/sh/tests/parameters/positional3.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/bin/sh/tests/parameters/positional3.0 Sun Sep 13 14:24:12 2015 (r287755, copy of r268436, head/bin/sh/tests/parameters/positional3.0) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +r=$(${SH} -c 'echo ${01:+yes}${010:+yes}' '' a '' '' '' '' '' '' '' '' b) +[ "$r" = yesyes ] Modified: stable/10/bin/sh/tests/parser/Makefile ============================================================================== --- stable/10/bin/sh/tests/parser/Makefile Sun Sep 13 14:04:42 2015 (r287754) +++ stable/10/bin/sh/tests/parser/Makefile Sun Sep 13 14:24:12 2015 (r287755) @@ -34,6 +34,7 @@ FILES+= dollar-quote8.0 FILES+= dollar-quote9.0 FILES+= dollar-quote10.0 FILES+= dollar-quote11.0 +FILES+= dollar-quote12.0 FILES+= empty-braces1.0 FILES+= empty-cmd1.0 FILES+= for1.0 @@ -52,6 +53,9 @@ FILES+= heredoc8.0 FILES+= heredoc9.0 FILES+= heredoc10.0 FILES+= heredoc11.0 +FILES+= line-cont1.0 +FILES+= line-cont2.0 +FILES+= line-cont3.0 FILES+= no-space1.0 FILES+= no-space2.0 FILES+= only-redir1.0 Copied: stable/10/bin/sh/tests/parser/dollar-quote12.0 (from r286971, head/bin/sh/tests/parser/dollar-quote12.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/bin/sh/tests/parser/dollar-quote12.0 Sun Sep 13 14:24:12 2015 (r287755, copy of r286971, head/bin/sh/tests/parser/dollar-quote12.0) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +# \u without any digits at all remains invalid. +# Our choice is a parse error. + +v=$( (eval ": \$'\u'") 2>&1 >/dev/null) +[ $? -ne 0 ] && [ -n "$v" ] Copied: stable/10/bin/sh/tests/parser/line-cont1.0 (from r273243, head/bin/sh/tests/parser/line-cont1.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/bin/sh/tests/parser/line-cont1.0 Sun Sep 13 14:24:12 2015 (r287755, copy of r273243, head/bin/sh/tests/parser/line-cont1.0) @@ -0,0 +1,16 @@ +# $FreeBSD$ + +i\ +f +t\ +r\ +u\ +e +t\ +h\ +e\ +n +: +\ +f\ +i Copied: stable/10/bin/sh/tests/parser/line-cont2.0 (from r273243, head/bin/sh/tests/parser/line-cont2.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/bin/sh/tests/parser/line-cont2.0 Sun Sep 13 14:24:12 2015 (r287755, copy of r273243, head/bin/sh/tests/parser/line-cont2.0) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +[ "a\ +b" = ab ] Copied: stable/10/bin/sh/tests/parser/line-cont3.0 (from r273243, head/bin/sh/tests/parser/line-cont3.0) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/bin/sh/tests/parser/line-cont3.0 Sun Sep 13 14:24:12 2015 (r287755, copy of r273243, head/bin/sh/tests/parser/line-cont3.0) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +v=`printf %s 'a\ +b'` +w="`printf %s 'c\ +d'`" +[ "$v$w" = abcd ] From owner-svn-src-stable@freebsd.org Mon Sep 14 05:37:33 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8FD17A041E0; Mon, 14 Sep 2015 05:37:33 +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 806CE1561; Mon, 14 Sep 2015 05:37:33 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8E5bXtV077870; Mon, 14 Sep 2015 05:37:33 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8E5bXav077869; Mon, 14 Sep 2015 05:37:33 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201509140537.t8E5bXav077869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Mon, 14 Sep 2015 05:37: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: r287769 - stable/10/usr.sbin/pw X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2015 05:37:33 -0000 Author: bapt Date: Mon Sep 14 05:37:32 2015 New Revision: 287769 URL: https://svnweb.freebsd.org/changeset/base/287769 Log: MFC: r287701 Regression: fix pw usermod -d Mark the user has having been edited if -d option is passed to usermod and so the request change of home directory actually happen PR: 203052 Reported by: lenzi.sergio@gmail.com Modified: stable/10/usr.sbin/pw/pw_user.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/pw/pw_user.c ============================================================================== --- stable/10/usr.sbin/pw/pw_user.c Sun Sep 13 22:22:30 2015 (r287768) +++ stable/10/usr.sbin/pw/pw_user.c Mon Sep 14 05:37:32 2015 (r287769) @@ -1694,6 +1694,7 @@ pw_user_mod(int argc, char **argv, char if (homedir && strcmp(pwd->pw_dir, homedir) != 0) { pwd->pw_dir = homedir; + edited = true; if (fstatat(conf.rootfd, pwd->pw_dir, &st, 0) == -1) { if (!createhome) warnx("WARNING: home `%s' does not exist", From owner-svn-src-stable@freebsd.org Mon Sep 14 09:12:30 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 002F8A0314D; Mon, 14 Sep 2015 09:12:29 +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 D85901F49; Mon, 14 Sep 2015 09:12:29 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8E9CTwS067377; Mon, 14 Sep 2015 09:12:29 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8E9CTIV067375; Mon, 14 Sep 2015 09:12:29 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201509140912.t8E9CTIV067375@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Mon, 14 Sep 2015 09:12: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: r287776 - stable/10/sys/teken X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2015 09:12:30 -0000 Author: ed Date: Mon Sep 14 09:12:28 2015 New Revision: 287776 URL: https://svnweb.freebsd.org/changeset/base/287776 Log: MFC r286798 and r286827: Stop parsing digits if the value already exceeds UINT_MAX / 100. There is no need for us to support parsing values that are larger than the maximum terminal window size. In this case that would be the maximum of unsigned short. The problem with parsing larger values is that they can cause integer overflows when adjusting the cursor position, leading to all sorts of failing assertions. MFC r286981 and r287098: Don't truncate cursor arithmetic to 16 bits. When updating the row number when the cursor position escape sequence is issued, we should make sure to store the intermediate result in a 32-bit integer. If we fail to do this, the cursor may be set above the origin region, which is bad. This could cause libteken to crash when INVARIANTS is enabled, due to the strict set of assertions that libteken has. PR: 202326, 202540, 202612 Submitted by: kwcu csie org Modified: stable/10/sys/teken/teken.c stable/10/sys/teken/teken_subr.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/teken/teken.c ============================================================================== --- stable/10/sys/teken/teken.c Mon Sep 14 08:36:22 2015 (r287775) +++ stable/10/sys/teken/teken.c Mon Sep 14 09:12:28 2015 (r287776) @@ -29,12 +29,14 @@ #include #if defined(__FreeBSD__) && defined(_KERNEL) #include +#include #include #include #define teken_assert(x) MPASS(x) #else /* !(__FreeBSD__ && _KERNEL) */ #include #include +#include #include #include #include @@ -405,18 +407,24 @@ teken_state_numbers(teken_t *t, teken_ch teken_assert(t->t_curnum < T_NUMSIZE); if (c >= '0' && c <= '9') { - /* - * Don't do math with the default value of 1 when a - * custom number is inserted. - */ if (t->t_stateflags & TS_FIRSTDIGIT) { + /* First digit. */ t->t_stateflags &= ~TS_FIRSTDIGIT; - t->t_nums[t->t_curnum] = 0; - } else { - t->t_nums[t->t_curnum] *= 10; + t->t_nums[t->t_curnum] = c - '0'; + } else if (t->t_nums[t->t_curnum] < UINT_MAX / 100) { + /* + * There is no need to continue parsing input + * once the value exceeds the size of the + * terminal. It would only allow for integer + * overflows when performing arithmetic on the + * cursor position. + * + * Ignore any further digits if the value is + * already UINT_MAX / 100. + */ + t->t_nums[t->t_curnum] = + t->t_nums[t->t_curnum] * 10 + c - '0'; } - - t->t_nums[t->t_curnum] += c - '0'; return (1); } else if (c == ';') { if (t->t_stateflags & TS_FIRSTDIGIT) Modified: stable/10/sys/teken/teken_subr.h ============================================================================== --- stable/10/sys/teken/teken_subr.h Mon Sep 14 08:36:22 2015 (r287775) +++ stable/10/sys/teken/teken_subr.h Mon Sep 14 09:12:28 2015 (r287776) @@ -324,13 +324,13 @@ static void teken_subr_cursor_position(teken_t *t, unsigned int row, unsigned int col) { - t->t_cursor.tp_row = t->t_originreg.ts_begin + row - 1; - if (t->t_cursor.tp_row >= t->t_originreg.ts_end) - t->t_cursor.tp_row = t->t_originreg.ts_end - 1; - - t->t_cursor.tp_col = col - 1; - if (t->t_cursor.tp_col >= t->t_winsize.tp_col) - t->t_cursor.tp_col = t->t_winsize.tp_col - 1; + row = row - 1 + t->t_originreg.ts_begin; + t->t_cursor.tp_row = row < t->t_originreg.ts_end ? + row : t->t_originreg.ts_end - 1; + + col--; + t->t_cursor.tp_col = col < t->t_winsize.tp_col ? + col : t->t_winsize.tp_col - 1; t->t_stateflags &= ~TS_WRAPPED; teken_funcs_cursor(t); @@ -583,9 +583,9 @@ static void teken_subr_horizontal_position_absolute(teken_t *t, unsigned int col) { - t->t_cursor.tp_col = col - 1; - if (t->t_cursor.tp_col >= t->t_winsize.tp_col) - t->t_cursor.tp_col = t->t_winsize.tp_col - 1; + col--; + t->t_cursor.tp_col = col < t->t_winsize.tp_col ? + col : t->t_winsize.tp_col - 1; t->t_stateflags &= ~TS_WRAPPED; teken_funcs_cursor(t); @@ -1297,9 +1297,9 @@ static void teken_subr_vertical_position_absolute(teken_t *t, unsigned int row) { - t->t_cursor.tp_row = t->t_originreg.ts_begin + row - 1; - if (t->t_cursor.tp_row >= t->t_originreg.ts_end) - t->t_cursor.tp_row = t->t_originreg.ts_end - 1; + row = row - 1 + t->t_originreg.ts_begin; + t->t_cursor.tp_row = row < t->t_originreg.ts_end ? + row : t->t_originreg.ts_end - 1; t->t_stateflags &= ~TS_WRAPPED; teken_funcs_cursor(t); From owner-svn-src-stable@freebsd.org Mon Sep 14 09:31:01 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E9A1EA03D7F; Mon, 14 Sep 2015 09:31: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 CEF9B1B9A; Mon, 14 Sep 2015 09:31:01 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8E9V1ik073447; Mon, 14 Sep 2015 09:31:01 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8E9V1gY073098; Mon, 14 Sep 2015 09:31:01 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201509140931.t8E9V1gY073098@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Mon, 14 Sep 2015 09:31:01 +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: r287777 - stable/9/sys/teken X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2015 09:31:02 -0000 Author: ed Date: Mon Sep 14 09:31:00 2015 New Revision: 287777 URL: https://svnweb.freebsd.org/changeset/base/287777 Log: MFC r286798 and r286827: Stop parsing digits if the value already exceeds UINT_MAX / 100. There is no need for us to support parsing values that are larger than the maximum terminal window size. In this case that would be the maximum of unsigned short. The problem with parsing larger values is that they can cause integer overflows when adjusting the cursor position, leading to all sorts of failing assertions. MFC r286981 and r287098: Don't truncate cursor arithmetic to 16 bits. When updating the row number when the cursor position escape sequence is issued, we should make sure to store the intermediate result in a 32-bit integer. If we fail to do this, the cursor may be set above the origin region, which is bad. This could cause libteken to crash when INVARIANTS is enabled, due to the strict set of assertions that libteken has. PR: 202326, 202540, 202612 Submitted by: kwcu csie org Modified: stable/9/sys/teken/teken.c stable/9/sys/teken/teken_subr.h Directory Properties: stable/9/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/sys/teken/teken.c ============================================================================== --- stable/9/sys/teken/teken.c Mon Sep 14 09:12:28 2015 (r287776) +++ stable/9/sys/teken/teken.c Mon Sep 14 09:31:00 2015 (r287777) @@ -29,12 +29,14 @@ #include #if defined(__FreeBSD__) && defined(_KERNEL) #include +#include #include #include #define teken_assert(x) MPASS(x) #else /* !(__FreeBSD__ && _KERNEL) */ #include #include +#include #include #include #include @@ -405,18 +407,24 @@ teken_state_numbers(teken_t *t, teken_ch teken_assert(t->t_curnum < T_NUMSIZE); if (c >= '0' && c <= '9') { - /* - * Don't do math with the default value of 1 when a - * custom number is inserted. - */ if (t->t_stateflags & TS_FIRSTDIGIT) { + /* First digit. */ t->t_stateflags &= ~TS_FIRSTDIGIT; - t->t_nums[t->t_curnum] = 0; - } else { - t->t_nums[t->t_curnum] *= 10; + t->t_nums[t->t_curnum] = c - '0'; + } else if (t->t_nums[t->t_curnum] < UINT_MAX / 100) { + /* + * There is no need to continue parsing input + * once the value exceeds the size of the + * terminal. It would only allow for integer + * overflows when performing arithmetic on the + * cursor position. + * + * Ignore any further digits if the value is + * already UINT_MAX / 100. + */ + t->t_nums[t->t_curnum] = + t->t_nums[t->t_curnum] * 10 + c - '0'; } - - t->t_nums[t->t_curnum] += c - '0'; return (1); } else if (c == ';') { if (t->t_stateflags & TS_FIRSTDIGIT) Modified: stable/9/sys/teken/teken_subr.h ============================================================================== --- stable/9/sys/teken/teken_subr.h Mon Sep 14 09:12:28 2015 (r287776) +++ stable/9/sys/teken/teken_subr.h Mon Sep 14 09:31:00 2015 (r287777) @@ -324,13 +324,13 @@ static void teken_subr_cursor_position(teken_t *t, unsigned int row, unsigned int col) { - t->t_cursor.tp_row = t->t_originreg.ts_begin + row - 1; - if (t->t_cursor.tp_row >= t->t_originreg.ts_end) - t->t_cursor.tp_row = t->t_originreg.ts_end - 1; - - t->t_cursor.tp_col = col - 1; - if (t->t_cursor.tp_col >= t->t_winsize.tp_col) - t->t_cursor.tp_col = t->t_winsize.tp_col - 1; + row = row - 1 + t->t_originreg.ts_begin; + t->t_cursor.tp_row = row < t->t_originreg.ts_end ? + row : t->t_originreg.ts_end - 1; + + col--; + t->t_cursor.tp_col = col < t->t_winsize.tp_col ? + col : t->t_winsize.tp_col - 1; t->t_stateflags &= ~TS_WRAPPED; teken_funcs_cursor(t); @@ -583,9 +583,9 @@ static void teken_subr_horizontal_position_absolute(teken_t *t, unsigned int col) { - t->t_cursor.tp_col = col - 1; - if (t->t_cursor.tp_col >= t->t_winsize.tp_col) - t->t_cursor.tp_col = t->t_winsize.tp_col - 1; + col--; + t->t_cursor.tp_col = col < t->t_winsize.tp_col ? + col : t->t_winsize.tp_col - 1; t->t_stateflags &= ~TS_WRAPPED; teken_funcs_cursor(t); @@ -1297,9 +1297,9 @@ static void teken_subr_vertical_position_absolute(teken_t *t, unsigned int row) { - t->t_cursor.tp_row = t->t_originreg.ts_begin + row - 1; - if (t->t_cursor.tp_row >= t->t_originreg.ts_end) - t->t_cursor.tp_row = t->t_originreg.ts_end - 1; + row = row - 1 + t->t_originreg.ts_begin; + t->t_cursor.tp_row = row < t->t_originreg.ts_end ? + row : t->t_originreg.ts_end - 1; t->t_stateflags &= ~TS_WRAPPED; teken_funcs_cursor(t); From owner-svn-src-stable@freebsd.org Mon Sep 14 14:42:07 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A1368A0467F; Mon, 14 Sep 2015 14:42:07 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 91AE8132F; Mon, 14 Sep 2015 14:42:07 +0000 (UTC) (envelope-from ray@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8EEg7cq012597; Mon, 14 Sep 2015 14:42:07 GMT (envelope-from ray@FreeBSD.org) Received: (from ray@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8EEg7ao012596; Mon, 14 Sep 2015 14:42:07 GMT (envelope-from ray@FreeBSD.org) Message-Id: <201509141442.t8EEg7ao012596@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ray set sender to ray@FreeBSD.org using -f From: Aleksandr Rybalko Date: Mon, 14 Sep 2015 14:42: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: r287782 - stable/10/sys/dev/vt X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2015 14:42:07 -0000 Author: ray Date: Mon Sep 14 14:42:06 2015 New Revision: 287782 URL: https://svnweb.freebsd.org/changeset/base/287782 Log: MFC: r272715 Allow vt(4) to disable terminal bell with `sysctl kern.vt.bell_enable=0`, similar as syscons(4) do. Submitted by: Tiwei Bie Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/dev/vt/vt_core.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/vt/vt_core.c ============================================================================== --- stable/10/sys/dev/vt/vt_core.c Mon Sep 14 12:25:45 2015 (r287781) +++ stable/10/sys/dev/vt/vt_core.c Mon Sep 14 14:42:06 2015 (r287782) @@ -121,6 +121,7 @@ const struct terminal_class vt_termclass static SYSCTL_NODE(_kern, OID_AUTO, vt, CTLFLAG_RD, 0, "vt(9) parameters"); VT_SYSCTL_INT(enable_altgr, 1, "Enable AltGr key (Do not assume R.Alt as Alt)"); +VT_SYSCTL_INT(enable_bell, 1, "Enable bell"); VT_SYSCTL_INT(debug, 0, "vt(9) debug level"); VT_SYSCTL_INT(deadtimer, 15, "Time to wait busy process in VT_PROCESS mode"); VT_SYSCTL_INT(suspendswitch, 1, "Switch to VT0 before suspend"); @@ -935,6 +936,9 @@ vtterm_bell(struct terminal *tm) struct vt_window *vw = tm->tm_softc; struct vt_device *vd = vw->vw_device; + if (!vt_enable_bell) + return; + if (vd->vd_flags & VDF_QUIET_BELL) return; @@ -946,6 +950,9 @@ vtterm_beep(struct terminal *tm, u_int p { u_int freq, period; + if (!vt_enable_bell) + return; + if ((param == 0) || ((param & 0xffff) == 0)) { vtterm_bell(tm); return; From owner-svn-src-stable@freebsd.org Mon Sep 14 15:44:04 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD1EEA0451C; Mon, 14 Sep 2015 15:44:04 +0000 (UTC) (envelope-from avatar@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CD49218ED; Mon, 14 Sep 2015 15:44:04 +0000 (UTC) (envelope-from avatar@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8EFi4Lb037462; Mon, 14 Sep 2015 15:44:04 GMT (envelope-from avatar@FreeBSD.org) Received: (from avatar@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8EFi4hP037461; Mon, 14 Sep 2015 15:44:04 GMT (envelope-from avatar@FreeBSD.org) Message-Id: <201509141544.t8EFi4hP037461@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avatar set sender to avatar@FreeBSD.org using -f From: Tai-hwa Liang Date: Mon, 14 Sep 2015 15:44:04 +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: r287786 - stable/8/sys/dev/sound/midi X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2015 15:44:05 -0000 Author: avatar Date: Mon Sep 14 15:44:03 2015 New Revision: 287786 URL: https://svnweb.freebsd.org/changeset/base/287786 Log: MFC r286887: Using the error return code documented in the comment. Though there is no direct midi_uninit() caller amongst existing drivers at this moment, a quick experiment indicates that EBUSY gives users more precise error message once drivers start to honour this result. For example, emu_midi_detach() should check the result of mpu401_uninit() and block module unloading if there is any MIDI I/O in progress. Modified: stable/8/sys/dev/sound/midi/midi.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/sound/ (props changed) stable/8/sys/dev/sound/midi/ (props changed) Modified: stable/8/sys/dev/sound/midi/midi.c ============================================================================== --- stable/8/sys/dev/sound/midi/midi.c Mon Sep 14 15:37:19 2015 (r287785) +++ stable/8/sys/dev/sound/midi/midi.c Mon Sep 14 15:44:03 2015 (r287786) @@ -403,7 +403,7 @@ midi_uninit(struct snd_midi *m) { int err; - err = ENXIO; + err = EBUSY; mtx_lock(&midistat_lock); mtx_lock(&m->lock); if (m->busy) { From owner-svn-src-stable@freebsd.org Mon Sep 14 15:47:21 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E746A046DA; Mon, 14 Sep 2015 15:47:21 +0000 (UTC) (envelope-from avatar@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6EA281BCE; Mon, 14 Sep 2015 15:47:21 +0000 (UTC) (envelope-from avatar@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8EFlL6r037777; Mon, 14 Sep 2015 15:47:21 GMT (envelope-from avatar@FreeBSD.org) Received: (from avatar@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8EFlLjb037776; Mon, 14 Sep 2015 15:47:21 GMT (envelope-from avatar@FreeBSD.org) Message-Id: <201509141547.t8EFlLjb037776@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avatar set sender to avatar@FreeBSD.org using -f From: Tai-hwa Liang Date: Mon, 14 Sep 2015 15:47:21 +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: r287787 - stable/9/sys/dev/sound/midi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2015 15:47:21 -0000 Author: avatar Date: Mon Sep 14 15:47:20 2015 New Revision: 287787 URL: https://svnweb.freebsd.org/changeset/base/287787 Log: MFC r286887: Using the error return code documented in the comment. Though there is no direct midi_uninit() caller amongst existing drivers at this moment, a quick experiment indicates that EBUSY gives users more precise error message once drivers start to honour this result. For example, emu_midi_detach() should check the result of mpu401_uninit() and block module unloading if there is any MIDI I/O in progress. Modified: stable/9/sys/dev/sound/midi/midi.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/sound/midi/midi.c ============================================================================== --- stable/9/sys/dev/sound/midi/midi.c Mon Sep 14 15:44:03 2015 (r287786) +++ stable/9/sys/dev/sound/midi/midi.c Mon Sep 14 15:47:20 2015 (r287787) @@ -403,7 +403,7 @@ midi_uninit(struct snd_midi *m) { int err; - err = ENXIO; + err = EBUSY; mtx_lock(&midistat_lock); mtx_lock(&m->lock); if (m->busy) { From owner-svn-src-stable@freebsd.org Mon Sep 14 15:47:26 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 704CEA0470F; Mon, 14 Sep 2015 15:47:26 +0000 (UTC) (envelope-from avatar@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4E5E71C38; Mon, 14 Sep 2015 15:47:26 +0000 (UTC) (envelope-from avatar@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8EFlP7R037829; Mon, 14 Sep 2015 15:47:25 GMT (envelope-from avatar@FreeBSD.org) Received: (from avatar@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8EFlPVW037828; Mon, 14 Sep 2015 15:47:25 GMT (envelope-from avatar@FreeBSD.org) Message-Id: <201509141547.t8EFlPVW037828@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avatar set sender to avatar@FreeBSD.org using -f From: Tai-hwa Liang Date: Mon, 14 Sep 2015 15:47:25 +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: r287788 - stable/8/sys/gnu/fs/reiserfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2015 15:47:26 -0000 Author: avatar Date: Mon Sep 14 15:47:25 2015 New Revision: 287788 URL: https://svnweb.freebsd.org/changeset/base/287788 Log: MFC r286888: Using consistent coding style to deal with error inside the loop. Modified: stable/8/sys/gnu/fs/reiserfs/reiserfs_vfsops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/gnu/ (props changed) Modified: stable/8/sys/gnu/fs/reiserfs/reiserfs_vfsops.c ============================================================================== --- stable/8/sys/gnu/fs/reiserfs/reiserfs_vfsops.c Mon Sep 14 15:47:20 2015 (r287787) +++ stable/8/sys/gnu/fs/reiserfs/reiserfs_vfsops.c Mon Sep 14 15:47:25 2015 (r287788) @@ -988,8 +988,8 @@ uint32_t find_hash_out(struct reiserfs_m key.on_disk_key.k_objectid, key.on_disk_key.k_dir_id); retval = search_by_entry_key(sbi, &key, &path, &de); if (retval == IO_ERROR) { - pathrelse(&path); - return (UNSET_HASH); + hash = UNSET_HASH; + break; } if (retval == NAME_NOT_FOUND) de.de_entry_num--; From owner-svn-src-stable@freebsd.org Mon Sep 14 17:40:58 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3BD2EA042F8; Mon, 14 Sep 2015 17:40:58 +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 12695105F; Mon, 14 Sep 2015 17:40:58 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8EHev3P085950; Mon, 14 Sep 2015 17:40:57 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8EHevA8085949; Mon, 14 Sep 2015 17:40:57 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509141740.t8EHevA8085949@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 14 Sep 2015 17:40: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: r287790 - stable/10/bin/df X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2015 17:40:58 -0000 Author: delphij Date: Mon Sep 14 17:40:57 2015 New Revision: 287790 URL: https://svnweb.freebsd.org/changeset/base/287790 Log: MFC r287236: Use exit() instead of return in main(). The difference in practice is subtle: C standard requires the language runtime to make return of int from main() behave like calling exit(), and in FreeBSD we do: exit(main(argc, argv, env)) In lib/csu/${ARCH}/crt1.c, so the real difference is using exit() explicitly would use an additional stack frame. Note however, if there is a on stack pointer is the last reference of an allocated memory block, returning from the function would, technically, result in a memory leak because we lost the last reference to the memory block, and calling exit() from C runtime could potentionally overwrite that stack frame that used to belong to the main() function. In practice, this is normally Okay because eventually the kernel would tear down the whole address space that belongs to the process in the _exit(2) system call, but the difference could confuse compilers (which may want to do stack overflow checks) and static analyzers. Replacing return with exit() in main() allows compilers/static analyzers to correctly omit or generate the right warnings when they do not treat main() specifically. With the current version of clang on FreeBSD/amd64, use of exit() would result in slightly smaller code being generated and eliminated a false positive warning of memory leak. Modified: stable/10/bin/df/df.c Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/df/df.c ============================================================================== --- stable/10/bin/df/df.c Mon Sep 14 16:48:19 2015 (r287789) +++ stable/10/bin/df/df.c Mon Sep 14 17:40:57 2015 (r287790) @@ -296,7 +296,7 @@ main(int argc, char *argv[]) prtstat(&mntbuf[i], &maxwidths); if (cflag) prtstat(&totalbuf, &maxwidths); - return (rv); + exit(rv); } static char * From owner-svn-src-stable@freebsd.org Mon Sep 14 17:57:02 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04ED1A04A9D; Mon, 14 Sep 2015 17:57:02 +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 E98ED1D1A; Mon, 14 Sep 2015 17:57:01 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8EHv1NW092121; Mon, 14 Sep 2015 17:57:01 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8EHv1uM092120; Mon, 14 Sep 2015 17:57:01 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509141757.t8EHv1uM092120@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 14 Sep 2015 17:57: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: r287791 - stable/10/bin/rm X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2015 17:57:02 -0000 Author: delphij Date: Mon Sep 14 17:57:01 2015 New Revision: 287791 URL: https://svnweb.freebsd.org/changeset/base/287791 Log: MFC r287237: Respect locale settings. Modified: stable/10/bin/rm/rm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/rm/rm.c ============================================================================== --- stable/10/bin/rm/rm.c Mon Sep 14 17:40:57 2015 (r287790) +++ stable/10/bin/rm/rm.c Mon Sep 14 17:57:01 2015 (r287791) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -86,6 +87,8 @@ main(int argc, char *argv[]) int ch; char *p; + (void)setlocale(LC_ALL, ""); + /* * Test for the special case where the utility is called as * "unlink", for which the functionality provided is greatly From owner-svn-src-stable@freebsd.org Mon Sep 14 18:05:28 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9372AA04E61; Mon, 14 Sep 2015 18:05:28 +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 83DCB1219; Mon, 14 Sep 2015 18:05:28 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8EI5Sa9096160; Mon, 14 Sep 2015 18:05:28 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8EI5S6F096159; Mon, 14 Sep 2015 18:05:28 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509141805.t8EI5S6F096159@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 14 Sep 2015 18:05: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: r287792 - stable/10/lib/libgeom X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2015 18:05:28 -0000 Author: delphij Date: Mon Sep 14 18:05:27 2015 New Revision: 287792 URL: https://svnweb.freebsd.org/changeset/base/287792 Log: MFC r287247: Plug memory leaks when running out of memory. Reported by: clang scan-build Modified: stable/10/lib/libgeom/geom_xml2tree.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libgeom/geom_xml2tree.c ============================================================================== --- stable/10/lib/libgeom/geom_xml2tree.c Mon Sep 14 17:57:01 2015 (r287791) +++ stable/10/lib/libgeom/geom_xml2tree.c Mon Sep 14 18:05:27 2015 (r287792) @@ -275,15 +275,17 @@ EndElement(void *userData, const char *n XML_StopParser(mt->parser, 0); warn("Cannot allocate memory during processing of '%s' " "element", name); + free(p); return; } gc->lg_name = strdup(name); if (gc->lg_name == NULL) { - free(gc); mt->error = errno; XML_StopParser(mt->parser, 0); warn("Cannot allocate memory during processing of '%s' " "element", name); + free(gc); + free(p); return; } gc->lg_val = p; From owner-svn-src-stable@freebsd.org Mon Sep 14 18:52:42 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C7CB3A046F6; Mon, 14 Sep 2015 18:52:42 +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 B84BF1623; Mon, 14 Sep 2015 18:52:42 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8EIqgiB017364; Mon, 14 Sep 2015 18:52:42 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8EIqg8b017363; Mon, 14 Sep 2015 18:52:42 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509141852.t8EIqg8b017363@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 14 Sep 2015 18:52: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: r287794 - stable/10/usr.bin/iconv X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2015 18:52:42 -0000 Author: delphij Date: Mon Sep 14 18:52:41 2015 New Revision: 287794 URL: https://svnweb.freebsd.org/changeset/base/287794 Log: MFC r287319: Constify opt_f and opt_t and eliminate unneeded copying. This fixes memory leaks. Reported by: clang static analyzer Modified: stable/10/usr.bin/iconv/iconv.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/iconv/iconv.c ============================================================================== --- stable/10/usr.bin/iconv/iconv.c Mon Sep 14 18:44:13 2015 (r287793) +++ stable/10/usr.bin/iconv/iconv.c Mon Sep 14 18:52:41 2015 (r287794) @@ -156,11 +156,11 @@ int main(int argc, char **argv) { FILE *fp; - char *opt_f, *opt_t; + const char *opt_f, *opt_t; int ch, i, res; bool opt_c = false, opt_s = false; - opt_f = opt_t = strdup(""); + opt_f = opt_t = ""; setlocale(LC_ALL, ""); setprogname(argv[0]); @@ -186,12 +186,12 @@ main(int argc, char **argv) case 'f': /* from */ if (optarg != NULL) - opt_f = strdup(optarg); + opt_f = optarg; break; case 't': /* to */ if (optarg != NULL) - opt_t = strdup(optarg); + opt_t = optarg; break; default: usage(); From owner-svn-src-stable@freebsd.org Mon Sep 14 18:57:51 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7AF7DA04945; Mon, 14 Sep 2015 18:57:51 +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 6B53219A3; Mon, 14 Sep 2015 18:57:51 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8EIvpMV017629; Mon, 14 Sep 2015 18:57:51 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8EIvpC3017628; Mon, 14 Sep 2015 18:57:51 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509141857.t8EIvpC3017628@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 14 Sep 2015 18:57: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: r287795 - stable/10/usr.bin/tftp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2015 18:57:51 -0000 Author: delphij Date: Mon Sep 14 18:57:50 2015 New Revision: 287795 URL: https://svnweb.freebsd.org/changeset/base/287795 Log: MFC r287320: - uri is expected to be nul-terminated (strchr used later), so use strlcpy instead of strncpy. - replace the other two cases of strncpy+\0 with strlcpy. Modified: stable/10/usr.bin/tftp/main.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/tftp/main.c ============================================================================== --- stable/10/usr.bin/tftp/main.c Mon Sep 14 18:52:41 2015 (r287794) +++ stable/10/usr.bin/tftp/main.c Mon Sep 14 18:57:50 2015 (r287795) @@ -223,7 +223,7 @@ urihandling(char *URI) char line[MAXLINE]; int i; - strncpy(uri, URI, ARG_MAX); + strlcpy(uri, URI, ARG_MAX); host = uri + 7; if ((s = strchr(host, '/')) == NULL) { @@ -320,11 +320,10 @@ setpeer0(char *host, const char *lport) /* res->ai_addr <= sizeof(peeraddr) is guaranteed */ memcpy(&peer_sock, res->ai_addr, res->ai_addrlen); if (res->ai_canonname) { - (void) strncpy(hostname, res->ai_canonname, + (void) strlcpy(hostname, res->ai_canonname, sizeof(hostname)); } else - (void) strncpy(hostname, host, sizeof(hostname)); - hostname[sizeof(hostname)-1] = 0; + (void) strlcpy(hostname, host, sizeof(hostname)); connected = 1; } From owner-svn-src-stable@freebsd.org Mon Sep 14 18:58:31 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9E577A049BB; Mon, 14 Sep 2015 18:58:31 +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 8ECE31AEA; Mon, 14 Sep 2015 18:58:31 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8EIwVVC017711; Mon, 14 Sep 2015 18:58:31 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8EIwVpR017710; Mon, 14 Sep 2015 18:58:31 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201509141858.t8EIwVpR017710@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 14 Sep 2015 18:58:31 +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: r287796 - stable/9/usr.bin/tftp X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2015 18:58:31 -0000 Author: delphij Date: Mon Sep 14 18:58:30 2015 New Revision: 287796 URL: https://svnweb.freebsd.org/changeset/base/287796 Log: MFC r287320: - uri is expected to be nul-terminated (strchr used later), so use strlcpy instead of strncpy. - replace the other two cases of strncpy+\0 with strlcpy. Modified: stable/9/usr.bin/tftp/main.c Directory Properties: stable/9/usr.bin/tftp/ (props changed) Modified: stable/9/usr.bin/tftp/main.c ============================================================================== --- stable/9/usr.bin/tftp/main.c Mon Sep 14 18:57:50 2015 (r287795) +++ stable/9/usr.bin/tftp/main.c Mon Sep 14 18:58:30 2015 (r287796) @@ -223,7 +223,7 @@ urihandling(char *URI) char line[MAXLINE]; int i; - strncpy(uri, URI, ARG_MAX); + strlcpy(uri, URI, ARG_MAX); host = uri + 7; if ((s = strchr(host, '/')) == NULL) { @@ -320,11 +320,10 @@ setpeer0(char *host, const char *lport) /* res->ai_addr <= sizeof(peeraddr) is guaranteed */ memcpy(&peer_sock, res->ai_addr, res->ai_addrlen); if (res->ai_canonname) { - (void) strncpy(hostname, res->ai_canonname, + (void) strlcpy(hostname, res->ai_canonname, sizeof(hostname)); } else - (void) strncpy(hostname, host, sizeof(hostname)); - hostname[sizeof(hostname)-1] = 0; + (void) strlcpy(hostname, host, sizeof(hostname)); connected = 1; } From owner-svn-src-stable@freebsd.org Mon Sep 14 19:32:05 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A448A03C93; Mon, 14 Sep 2015 19:32:05 +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 1187A13BE; Mon, 14 Sep 2015 19:32:05 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8EJW4Wa034129; Mon, 14 Sep 2015 19:32:04 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8EJW4pA034128; Mon, 14 Sep 2015 19:32:04 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201509141932.t8EJW4pA034128@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Mon, 14 Sep 2015 19:32:04 +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: r287800 - stable/10/sys/dev/xen/blkfront X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2015 19:32:05 -0000 Author: cperciva Date: Mon Sep 14 19:32:04 2015 New Revision: 287800 URL: https://svnweb.freebsd.org/changeset/base/287800 Log: MFC r284615, r284662 Code cleanup; fix an error code; add a KASSERT. Modified: stable/10/sys/dev/xen/blkfront/blkfront.c Modified: stable/10/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- stable/10/sys/dev/xen/blkfront/blkfront.c Mon Sep 14 19:23:00 2015 (r287799) +++ stable/10/sys/dev/xen/blkfront/blkfront.c Mon Sep 14 19:32:04 2015 (r287800) @@ -168,7 +168,6 @@ xbd_queue_cb(void *arg, bus_dma_segment_ uint64_t fsect, lsect; int ref; int op; - int block_segs; cm = arg; sc = cm->cm_sc; @@ -180,6 +179,9 @@ xbd_queue_cb(void *arg, bus_dma_segment_ return; } + KASSERT(nsegs <= BLKIF_MAX_SEGMENTS_PER_REQUEST, + ("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++; @@ -190,9 +192,8 @@ xbd_queue_cb(void *arg, bus_dma_segment_ ring_req->nr_segments = nsegs; cm->cm_nseg = nsegs; - block_segs = MIN(nsegs, BLKIF_MAX_SEGMENTS_PER_REQUEST); sg = ring_req->seg; - last_block_sg = sg + block_segs; + last_block_sg = sg + nsegs; sg_ref = cm->cm_sg_refs; while (sg < last_block_sg) { @@ -227,7 +228,6 @@ xbd_queue_cb(void *arg, bus_dma_segment_ sg++; sg_ref++; segs++; - nsegs--; } if (cm->cm_operation == BLKIF_OP_READ) @@ -1130,7 +1130,7 @@ xbd_initialize(struct xbd_softc *sc) M_XENBLOCKFRONT, M_NOWAIT|M_ZERO); if (sc->xbd_shadow == NULL) { bus_dma_tag_destroy(sc->xbd_io_dmat); - xenbus_dev_fatal(sc->xbd_dev, error, + xenbus_dev_fatal(sc->xbd_dev, ENOMEM, "Cannot allocate request structures\n"); return; } From owner-svn-src-stable@freebsd.org Mon Sep 14 19:35:34 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9736DA03E7B; Mon, 14 Sep 2015 19:35:34 +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 7CBD31722; Mon, 14 Sep 2015 19:35:34 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8EJZYrv034372; Mon, 14 Sep 2015 19:35:34 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8EJZXSS034369; Mon, 14 Sep 2015 19:35:33 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201509141935.t8EJZXSS034369@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Mon, 14 Sep 2015 19:35: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: r287801 - in stable/10/sys: dev/xen/blkfront xen/interface/io X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2015 19:35:34 -0000 Author: cperciva Date: Mon Sep 14 19:35:33 2015 New Revision: 287801 URL: https://svnweb.freebsd.org/changeset/base/287801 Log: MFC r284618, r284663, r284664, r284670, r284723 Reorganization of blkfront code and updates to comments. No functional changes. Modified: stable/10/sys/dev/xen/blkfront/blkfront.c stable/10/sys/dev/xen/blkfront/block.h stable/10/sys/xen/interface/io/blkif.h Modified: stable/10/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- stable/10/sys/dev/xen/blkfront/blkfront.c Mon Sep 14 19:32:04 2015 (r287800) +++ stable/10/sys/dev/xen/blkfront/blkfront.c Mon Sep 14 19:35:33 2015 (r287801) @@ -156,45 +156,14 @@ xbd_free_command(struct xbd_command *cm) } static void -xbd_queue_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) +xbd_mksegarray(bus_dma_segment_t *segs, int nsegs, + grant_ref_t * gref_head, int otherend_id, int readonly, + grant_ref_t * sg_ref, blkif_request_segment_t * sg) { - struct xbd_softc *sc; - struct xbd_command *cm; - blkif_request_t *ring_req; - struct blkif_request_segment *sg; - struct blkif_request_segment *last_block_sg; - grant_ref_t *sg_ref; + struct blkif_request_segment *last_block_sg = sg + nsegs; vm_paddr_t buffer_ma; uint64_t fsect, lsect; int ref; - int op; - - cm = arg; - sc = cm->cm_sc; - - if (error) { - cm->cm_bp->bio_error = EIO; - biodone(cm->cm_bp); - xbd_free_command(cm); - return; - } - - KASSERT(nsegs <= BLKIF_MAX_SEGMENTS_PER_REQUEST, - ("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; - - sg = ring_req->seg; - last_block_sg = sg + nsegs; - sg_ref = cm->cm_sg_refs; while (sg < last_block_sg) { buffer_ma = segs->ds_addr; @@ -205,7 +174,7 @@ xbd_queue_cb(void *arg, bus_dma_segment_ "cross a page boundary")); /* install a grant reference. */ - ref = gnttab_claim_grant_reference(&cm->cm_gref_head); + ref = gnttab_claim_grant_reference(gref_head); /* * GNTTAB_LIST_END == 0xffffffff, but it is private @@ -215,9 +184,9 @@ xbd_queue_cb(void *arg, bus_dma_segment_ gnttab_grant_foreign_access_ref( ref, - xenbus_get_otherend_id(sc->xbd_dev), + otherend_id, buffer_ma >> PAGE_SHIFT, - ring_req->operation == BLKIF_OP_WRITE); + readonly); *sg_ref = ref; *sg = (struct blkif_request_segment) { @@ -229,6 +198,42 @@ xbd_queue_cb(void *arg, bus_dma_segment_ sg_ref++; segs++; } +} + +static void +xbd_queue_cb(void *arg, bus_dma_segment_t *segs, int nsegs, int error) +{ + struct xbd_softc *sc; + struct xbd_command *cm; + blkif_request_t *ring_req; + int op; + + cm = arg; + sc = cm->cm_sc; + + if (error) { + cm->cm_bp->bio_error = EIO; + biodone(cm->cm_bp); + xbd_free_command(cm); + return; + } + + KASSERT(nsegs <= BLKIF_MAX_SEGMENTS_PER_REQUEST, + ("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 (cm->cm_operation == BLKIF_OP_READ) op = BUS_DMASYNC_PREREAD; @@ -1034,7 +1039,6 @@ xbd_initialize(struct xbd_softc *sc) const char *node_path; uint32_t max_ring_page_order; int error; - int i; if (xenbus_get_state(sc->xbd_dev) != XenbusStateInitialising) { /* Initialization has already been performed. */ @@ -1105,53 +1109,6 @@ xbd_initialize(struct xbd_softc *sc) sc->xbd_max_requests = XBD_MAX_REQUESTS; } - /* Allocate datastructures based on negotiated values. */ - error = bus_dma_tag_create( - bus_get_dma_tag(sc->xbd_dev), /* parent */ - 512, PAGE_SIZE, /* algnmnt, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - sc->xbd_max_request_size, - sc->xbd_max_request_segments, - PAGE_SIZE, /* maxsegsize */ - BUS_DMA_ALLOCNOW, /* flags */ - busdma_lock_mutex, /* lockfunc */ - &sc->xbd_io_lock, /* lockarg */ - &sc->xbd_io_dmat); - if (error != 0) { - xenbus_dev_fatal(sc->xbd_dev, error, - "Cannot allocate parent DMA tag\n"); - return; - } - - /* Per-transaction data allocation. */ - sc->xbd_shadow = malloc(sizeof(*sc->xbd_shadow) * sc->xbd_max_requests, - M_XENBLOCKFRONT, M_NOWAIT|M_ZERO); - if (sc->xbd_shadow == NULL) { - bus_dma_tag_destroy(sc->xbd_io_dmat); - xenbus_dev_fatal(sc->xbd_dev, ENOMEM, - "Cannot allocate request structures\n"); - return; - } - - for (i = 0; i < sc->xbd_max_requests; i++) { - struct xbd_command *cm; - - cm = &sc->xbd_shadow[i]; - cm->cm_sg_refs = malloc( - sizeof(grant_ref_t) * sc->xbd_max_request_segments, - M_XENBLOCKFRONT, M_NOWAIT); - if (cm->cm_sg_refs == NULL) - break; - cm->cm_id = i; - cm->cm_flags = XBDCF_INITIALIZER; - cm->cm_sc = sc; - if (bus_dmamap_create(sc->xbd_io_dmat, 0, &cm->cm_map) != 0) - break; - xbd_free_command(cm); - } - if (xbd_alloc_ring(sc) != 0) return; @@ -1210,6 +1167,7 @@ xbd_connect(struct xbd_softc *sc) unsigned long sectors, sector_size; unsigned int binfo; int err, feature_barrier, feature_flush; + int i; if (sc->xbd_state == XBD_STATE_CONNECTED || sc->xbd_state == XBD_STATE_SUSPENDED) @@ -1240,6 +1198,53 @@ xbd_connect(struct xbd_softc *sc) if (err == 0 && feature_flush != 0) sc->xbd_flags |= XBDF_FLUSH; + /* Allocate datastructures based on negotiated values. */ + err = bus_dma_tag_create( + bus_get_dma_tag(sc->xbd_dev), /* parent */ + 512, PAGE_SIZE, /* algnmnt, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + sc->xbd_max_request_size, + sc->xbd_max_request_segments, + PAGE_SIZE, /* maxsegsize */ + BUS_DMA_ALLOCNOW, /* flags */ + busdma_lock_mutex, /* lockfunc */ + &sc->xbd_io_lock, /* lockarg */ + &sc->xbd_io_dmat); + if (err != 0) { + xenbus_dev_fatal(sc->xbd_dev, err, + "Cannot allocate parent DMA tag\n"); + return; + } + + /* Per-transaction data allocation. */ + sc->xbd_shadow = malloc(sizeof(*sc->xbd_shadow) * sc->xbd_max_requests, + M_XENBLOCKFRONT, M_NOWAIT|M_ZERO); + if (sc->xbd_shadow == NULL) { + bus_dma_tag_destroy(sc->xbd_io_dmat); + xenbus_dev_fatal(sc->xbd_dev, ENOMEM, + "Cannot allocate request structures\n"); + return; + } + + for (i = 0; i < sc->xbd_max_requests; i++) { + struct xbd_command *cm; + + cm = &sc->xbd_shadow[i]; + cm->cm_sg_refs = malloc( + sizeof(grant_ref_t) * sc->xbd_max_request_segments, + M_XENBLOCKFRONT, M_NOWAIT); + if (cm->cm_sg_refs == NULL) + break; + cm->cm_id = i; + cm->cm_flags = XBDCF_INITIALIZER; + cm->cm_sc = sc; + if (bus_dmamap_create(sc->xbd_io_dmat, 0, &cm->cm_map) != 0) + break; + xbd_free_command(cm); + } + if (sc->xbd_disk == NULL) { device_printf(dev, "%juMB <%s> at %s", (uintmax_t) sectors / (1048576 / sector_size), Modified: stable/10/sys/dev/xen/blkfront/block.h ============================================================================== --- stable/10/sys/dev/xen/blkfront/block.h Mon Sep 14 19:32:04 2015 (r287800) +++ stable/10/sys/dev/xen/blkfront/block.h Mon Sep 14 19:35:33 2015 (r287801) @@ -68,9 +68,8 @@ #define XBD_MAX_RING_PAGES 32 /** - * The maximum number of outstanding requests blocks (request headers plus - * additional segment blocks) we will allow in a negotiated block-front/back - * communication channel. + * The maximum number of outstanding requests we will allow in a negotiated + * block-front/back communication channel. */ #define XBD_MAX_REQUESTS \ __CONST_RING_SIZE(blkif, PAGE_SIZE * XBD_MAX_RING_PAGES) @@ -82,15 +81,6 @@ #define XBD_MAX_REQUEST_SIZE \ MIN(MAXPHYS, XBD_SEGS_TO_SIZE(BLKIF_MAX_SEGMENTS_PER_REQUEST)) -/** - * The maximum number of segments (within a request header and accompanying - * segment blocks) per request we will allow in a negotiated block-front/back - * communication channel. - */ -#define XBD_MAX_SEGMENTS_PER_REQUEST \ - (MIN(BLKIF_MAX_SEGMENTS_PER_REQUEST, \ - XBD_SIZE_TO_SEGS(XBD_MAX_REQUEST_SIZE))) - typedef enum { XBDCF_Q_MASK = 0xFF, /* This command has contributed to xbd_qfrozen_cnt. */ Modified: stable/10/sys/xen/interface/io/blkif.h ============================================================================== --- stable/10/sys/xen/interface/io/blkif.h Mon Sep 14 19:32:04 2015 (r287800) +++ stable/10/sys/xen/interface/io/blkif.h Mon Sep 14 19:35:33 2015 (r287801) @@ -145,32 +145,6 @@ * The maximum supported size of the request ring buffer in units of * machine pages. The value must be a power of 2. * - * max-requests - * Default Value: BLKIF_MAX_RING_REQUESTS(PAGE_SIZE) - * Maximum Value: BLKIF_MAX_RING_REQUESTS(PAGE_SIZE * max-ring-pages) - * - * The maximum number of concurrent, logical requests supported by - * the backend. - * - * Note: A logical request may span multiple ring entries. - * - * max-request-segments - * Values: - * Default Value: BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK - * Maximum Value: BLKIF_MAX_SEGMENTS_PER_REQUEST - * - * The maximum value of blkif_request.nr_segments supported by - * the backend. - * - * max-request-size - * Values: - * Default Value: BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK * PAGE_SIZE - * Maximum Value: BLKIF_MAX_SEGMENTS_PER_REQUEST * PAGE_SIZE - * - * The maximum amount of data, in bytes, that can be referenced by a - * request type that accesses frontend memory (currently BLKIF_OP_READ, - * BLKIF_OP_WRITE, or BLKIF_OP_WRITE_BARRIER). - * *------------------------- Backend Device Properties ------------------------- * * discard-alignment @@ -269,33 +243,6 @@ * The size of the frontend allocated request ring buffer in units of * machine pages. The value must be a power of 2. * - * max-requests - * Values: - * Default Value: BLKIF_MAX_RING_REQUESTS(PAGE_SIZE) - * Maximum Value: BLKIF_MAX_RING_REQUESTS(PAGE_SIZE * max-ring-pages) - * - * The maximum number of concurrent, logical requests that will be - * issued by the frontend. - * - * Note: A logical request may span multiple ring entries. - * - * max-request-segments - * Values: - * Default Value: BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK - * Maximum Value: MIN(255, backend/max-request-segments) - * - * The maximum value the frontend will set in the - * blkif_request.nr_segments field. - * - * max-request-size - * Values: - * Default Value: BLKIF_MAX_SEGMENTS_PER_HEADER_BLOCK * PAGE_SIZE - * Maximum Value: max-request-segments * PAGE_SIZE - * - * The maximum amount of data, in bytes, that can be referenced by - * a request type that accesses frontend memory (currently BLKIF_OP_READ, - * BLKIF_OP_WRITE, or BLKIF_OP_WRITE_BARRIER). - * *------------------------- Virtual Device Properties ------------------------- * * device-type @@ -457,7 +404,9 @@ #define BLKIF_OP_DISCARD 5 /* - * Maximum scatter/gather segments per request (header + segment blocks). + * 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. */ #define BLKIF_MAX_SEGMENTS_PER_REQUEST 11 @@ -478,21 +427,6 @@ typedef struct blkif_request_segment blk /* * Starting ring element for any I/O request. - * - * One or more segment blocks can be inserted into the request ring - * just after a blkif_request_t, allowing requests to operate on - * up to BLKIF_MAX_SEGMENTS_PER_REQUEST. - * - * BLKIF_SEGS_TO_BLOCKS() can be used on blkif_requst.nr_segments - * to determine the number of contiguous ring entries associated - * with this request. - * - * Note: Due to the way Xen request rings operate, the producer and - * consumer indices of the ring must be incremented by the - * BLKIF_SEGS_TO_BLOCKS() value of the associated request. - * (e.g. a response to a 3 ring entry request must also consume - * 3 entries in the ring, even though only the first ring entry - * in the response has any data.) */ struct blkif_request { uint8_t operation; /* BLKIF_OP_??? */ From owner-svn-src-stable@freebsd.org Mon Sep 14 19:37:53 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4FF06A03F9F; Mon, 14 Sep 2015 19:37:53 +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 3EE7E1955; Mon, 14 Sep 2015 19:37:53 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8EJbrpg034534; Mon, 14 Sep 2015 19:37:53 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8EJbq5V034530; Mon, 14 Sep 2015 19:37:52 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201509141937.t8EJbq5V034530@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Mon, 14 Sep 2015 19:37: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: r287802 - in stable/10: release/tools sys/dev/xen/blkfront sys/xen/interface/io X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2015 19:37:53 -0000 Author: cperciva Date: Mon Sep 14 19:37:51 2015 New Revision: 287802 URL: https://svnweb.freebsd.org/changeset/base/287802 Log: MFC r286062, r286063 Add support to blkfront for blkif indirect segment I/Os. Turn this support off by default in EC2 builds due to performance issues on some EC2 instance types. Modified: stable/10/release/tools/ec2.conf stable/10/sys/dev/xen/blkfront/blkfront.c stable/10/sys/dev/xen/blkfront/block.h stable/10/sys/xen/interface/io/blkif.h Modified: stable/10/release/tools/ec2.conf ============================================================================== --- stable/10/release/tools/ec2.conf Mon Sep 14 19:35:33 2015 (r287801) +++ stable/10/release/tools/ec2.conf Mon Sep 14 19:37:51 2015 (r287802) @@ -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) Modified: stable/10/sys/dev/xen/blkfront/blkfront.c ============================================================================== --- stable/10/sys/dev/xen/blkfront/blkfront.c Mon Sep 14 19:35:33 2015 (r287801) +++ stable/10/sys/dev/xen/blkfront/blkfront.c Mon Sep 14 19:37:51 2015 (r287802) @@ -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: stable/10/sys/dev/xen/blkfront/block.h ============================================================================== --- stable/10/sys/dev/xen/blkfront/block.h Mon Sep 14 19:35:33 2015 (r287801) +++ stable/10/sys/dev/xen/blkfront/block.h Mon Sep 14 19:37:51 2015 (r287802) @@ -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: stable/10/sys/xen/interface/io/blkif.h ============================================================================== --- stable/10/sys/xen/interface/io/blkif.h Mon Sep 14 19:35:33 2015 (r287801) +++ stable/10/sys/xen/interface/io/blkif.h Mon Sep 14 19:37:51 2015 (r287802) @@ -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-stable@freebsd.org Tue Sep 15 01:34:21 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8672CA04B21; Tue, 15 Sep 2015 01:34:21 +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 73F0F106B; Tue, 15 Sep 2015 01:34:21 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 728CD1945; Tue, 15 Sep 2015 01:34:21 +0000 (UTC) Date: Tue, 15 Sep 2015 01:34:21 +0000 From: Alexey Dokuchaev To: Aleksandr Rybalko Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r287782 - stable/10/sys/dev/vt Message-ID: <20150915013421.GA59565@FreeBSD.org> References: <201509141442.t8EEg7ao012596@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201509141442.t8EEg7ao012596@repo.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2015 01:34:21 -0000 On Mon, Sep 14, 2015 at 02:42:07PM +0000, Aleksandr Rybalko wrote: > New Revision: 287782 > URL: https://svnweb.freebsd.org/changeset/base/287782 > > Log: > MFC: r272715 > Allow vt(4) to disable terminal bell with > `sysctl kern.vt.bell_enable=0`, similar as syscons(4) do. > [...] > +VT_SYSCTL_INT(enable_bell, 1, "Enable bell"); I think you've meant `sysctl kern.vt.enable_bell=0' in the commit log. > + if (!vt_enable_bell) > + return; > + > if (vd->vd_flags & VDF_QUIET_BELL) > return; Hm, I'm wondering why having another sysctl is required when there's already a way to shut the bell up with VDF_QUIET_BELL flag? Also, there's certain naming inconsistency between syscons(4) and vt(4). On my stable/8 laptop, I see this: $ sysctl -d hw.syscons.bell hw.syscons.bell: enable bell On my -CURRENT desktop, this: $ sysctl -d kern.vt.enable_bell kern.vt.enable_bell: Enable bell ./danfe From owner-svn-src-stable@freebsd.org Tue Sep 15 05:19:13 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3EAA0A03ECB; Tue, 15 Sep 2015 05:19:13 +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 22E381624; Tue, 15 Sep 2015 05:19:13 +0000 (UTC) (envelope-from hiren@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8F5JDYi073773; Tue, 15 Sep 2015 05:19:13 GMT (envelope-from hiren@FreeBSD.org) Received: (from hiren@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8F5JBnI073764; Tue, 15 Sep 2015 05:19:11 GMT (envelope-from hiren@FreeBSD.org) Message-Id: <201509150519.t8F5JBnI073764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hiren set sender to hiren@FreeBSD.org using -f From: Hiren Panchasara Date: Tue, 15 Sep 2015 05:19:11 +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: r287808 - in stable/10: sbin/ifconfig sys/net X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2015 05:19:13 -0000 Author: hiren Date: Tue Sep 15 05:19:10 2015 New Revision: 287808 URL: https://svnweb.freebsd.org/changeset/base/287808 Log: MFC r286700 Make LAG LACP fast timeout tunable through IOCTL. Modified: stable/10/sbin/ifconfig/ifconfig.8 stable/10/sbin/ifconfig/iflagg.c stable/10/sys/net/ieee8023ad_lacp.c stable/10/sys/net/ieee8023ad_lacp.h stable/10/sys/net/if_lagg.c stable/10/sys/net/if_lagg.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/ifconfig/ifconfig.8 ============================================================================== --- stable/10/sbin/ifconfig/ifconfig.8 Tue Sep 15 05:16:26 2015 (r287807) +++ stable/10/sbin/ifconfig/ifconfig.8 Tue Sep 15 05:19:10 2015 (r287808) @@ -2445,6 +2445,10 @@ Disable local hash computation for RSS h Set a shift parameter for RSS local hash computation. Hash is calculated by using flowid bits in a packet header mbuf which are shifted by the number of this parameter. +.It Cm lacp_fast_timeout +Enable lacp fast-timeout on the interface. +.It Cm -lacp_fast_timeout +Disable lacp fast-timeout on the interface. .El .Pp The following parameters are specific to IP tunnel interfaces, Modified: stable/10/sbin/ifconfig/iflagg.c ============================================================================== --- stable/10/sbin/ifconfig/iflagg.c Tue Sep 15 05:16:26 2015 (r287807) +++ stable/10/sbin/ifconfig/iflagg.c Tue Sep 15 05:19:10 2015 (r287808) @@ -115,6 +115,8 @@ setlaggsetopt(const char *val, int d, in case -LAGG_OPT_LACP_TXTEST: case LAGG_OPT_LACP_RXTEST: case -LAGG_OPT_LACP_RXTEST: + case LAGG_OPT_LACP_TIMEOUT: + case -LAGG_OPT_LACP_TIMEOUT: break; default: err(1, "Invalid lagg option"); @@ -293,6 +295,8 @@ static struct cmd lagg_cmds[] = { DEF_CMD("-lacp_txtest", -LAGG_OPT_LACP_TXTEST, setlaggsetopt), DEF_CMD("lacp_rxtest", LAGG_OPT_LACP_RXTEST, setlaggsetopt), DEF_CMD("-lacp_rxtest", -LAGG_OPT_LACP_RXTEST, setlaggsetopt), + DEF_CMD("lacp_fast_timeout", LAGG_OPT_LACP_TIMEOUT, setlaggsetopt), + DEF_CMD("-lacp_fast_timeout", -LAGG_OPT_LACP_TIMEOUT, setlaggsetopt), DEF_CMD_ARG("flowid_shift", setlaggflowidshift), }; static struct afswtch af_lagg = { Modified: stable/10/sys/net/ieee8023ad_lacp.c ============================================================================== --- stable/10/sys/net/ieee8023ad_lacp.c Tue Sep 15 05:16:26 2015 (r287807) +++ stable/10/sys/net/ieee8023ad_lacp.c Tue Sep 15 05:19:10 2015 (r287808) @@ -519,7 +519,7 @@ lacp_port_create(struct lagg_port *lgp) int error; boolean_t active = TRUE; /* XXX should be configurable */ - boolean_t fast = FALSE; /* XXX should be configurable */ + boolean_t fast = FALSE; /* Configurable via ioctl */ bzero((char *)&sdl, sizeof(sdl)); sdl.sdl_len = sizeof(sdl); Modified: stable/10/sys/net/ieee8023ad_lacp.h ============================================================================== --- stable/10/sys/net/ieee8023ad_lacp.h Tue Sep 15 05:16:26 2015 (r287807) +++ stable/10/sys/net/ieee8023ad_lacp.h Tue Sep 15 05:19:10 2015 (r287808) @@ -251,6 +251,7 @@ struct lacp_softc { u_int32_t lsc_tx_test; } lsc_debug; u_int32_t lsc_strict_mode; + boolean_t lsc_fast_timeout; /* if set, fast timeout */ }; #define LACP_TYPE_ACTORINFO 1 Modified: stable/10/sys/net/if_lagg.c ============================================================================== --- stable/10/sys/net/if_lagg.c Tue Sep 15 05:16:26 2015 (r287807) +++ stable/10/sys/net/if_lagg.c Tue Sep 15 05:19:10 2015 (r287808) @@ -1081,6 +1081,8 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd ro->ro_opts |= LAGG_OPT_LACP_RXTEST; if (lsc->lsc_strict_mode != 0) ro->ro_opts |= LAGG_OPT_LACP_STRICT; + if (lsc->lsc_fast_timeout != 0) + ro->ro_opts |= LAGG_OPT_LACP_TIMEOUT; ro->ro_active = sc->sc_active; } else { @@ -1116,6 +1118,8 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd case -LAGG_OPT_LACP_RXTEST: case LAGG_OPT_LACP_STRICT: case -LAGG_OPT_LACP_STRICT: + case LAGG_OPT_LACP_TIMEOUT: + case -LAGG_OPT_LACP_TIMEOUT: valid = lacp = 1; break; default: @@ -1144,6 +1148,7 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd sc->sc_opts &= ~ro->ro_opts; } else { struct lacp_softc *lsc; + struct lacp_port *lp; lsc = (struct lacp_softc *)sc->sc_psc; @@ -1166,6 +1171,20 @@ lagg_ioctl(struct ifnet *ifp, u_long cmd case -LAGG_OPT_LACP_STRICT: lsc->lsc_strict_mode = 0; break; + case LAGG_OPT_LACP_TIMEOUT: + LACP_LOCK(lsc); + LIST_FOREACH(lp, &lsc->lsc_ports, lp_next) + lp->lp_state |= LACP_STATE_TIMEOUT; + LACP_UNLOCK(lsc); + lsc->lsc_fast_timeout = 1; + break; + case -LAGG_OPT_LACP_TIMEOUT: + LACP_LOCK(lsc); + LIST_FOREACH(lp, &lsc->lsc_ports, lp_next) + lp->lp_state &= ~LACP_STATE_TIMEOUT; + LACP_UNLOCK(lsc); + lsc->lsc_fast_timeout = 0; + break; } } proto->ti_attach(sc); Modified: stable/10/sys/net/if_lagg.h ============================================================================== --- stable/10/sys/net/if_lagg.h Tue Sep 15 05:16:26 2015 (r287807) +++ stable/10/sys/net/if_lagg.h Tue Sep 15 05:19:10 2015 (r287808) @@ -148,6 +148,7 @@ struct lagg_reqopts { #define LAGG_OPT_LACP_STRICT 0x10 /* LACP strict mode */ #define LAGG_OPT_LACP_TXTEST 0x20 /* LACP debug: txtest */ #define LAGG_OPT_LACP_RXTEST 0x40 /* LACP debug: rxtest */ +#define LAGG_OPT_LACP_TIMEOUT 0x80 /* LACP timeout */ u_int ro_count; /* number of ports */ u_int ro_active; /* active port count */ u_int ro_flapping; /* number of flapping */ From owner-svn-src-stable@freebsd.org Tue Sep 15 05:46:56 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F300A04C61; Tue, 15 Sep 2015 05:46: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 7E9A810FF; Tue, 15 Sep 2015 05:46:56 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8F5kuwA086654; Tue, 15 Sep 2015 05:46:56 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8F5ktgR086650; Tue, 15 Sep 2015 05:46:55 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201509150546.t8F5ktgR086650@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 15 Sep 2015 05:46: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: r287809 - stable/10/usr.sbin/pkg X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2015 05:46:56 -0000 Author: bapt Date: Tue Sep 15 05:46:55 2015 New Revision: 287809 URL: https://svnweb.freebsd.org/changeset/base/287809 Log: MFC: r287579 Implement pubkey support for the bootstrap Note that to not interfer with finger print it expects a signature on pkg itself which is named pkg.txz.pubkeysign To genrate it: echo -n "$(sha256 -q pkg.txz)" | openssl dgst -sha256 -sign /thekey \ -binary -out ./pkg.txz.pubkeysig Note the "echo -n" which prevent signing the '\n' one would get otherwise PR: 202622 Modified: stable/10/usr.sbin/pkg/config.c stable/10/usr.sbin/pkg/config.h stable/10/usr.sbin/pkg/pkg.c Modified: stable/10/usr.sbin/pkg/config.c ============================================================================== --- stable/10/usr.sbin/pkg/config.c Tue Sep 15 05:19:10 2015 (r287808) +++ stable/10/usr.sbin/pkg/config.c Tue Sep 15 05:46:55 2015 (r287809) @@ -131,6 +131,15 @@ static struct config_entry c[] = { false, true, }, + [PUBKEY] = { + PKG_CONFIG_STRING, + "PUBKEY", + NULL, + NULL, + NULL, + false, + false + } }; static int @@ -231,6 +240,8 @@ config_parse(const ucl_object_t *obj, pk sbuf_cpy(buf, "SIGNATURE_TYPE"); else if (strcasecmp(key, "fingerprints") == 0) sbuf_cpy(buf, "FINGERPRINTS"); + else if (strcasecmp(key, "pubkey") == 0) + sbuf_cpy(buf, "PUBKEY"); else if (strcasecmp(key, "enabled") == 0) { if ((cur->type != UCL_BOOLEAN) || !ucl_object_toboolean(cur)) Modified: stable/10/usr.sbin/pkg/config.h ============================================================================== --- stable/10/usr.sbin/pkg/config.h Tue Sep 15 05:19:10 2015 (r287808) +++ stable/10/usr.sbin/pkg/config.h Tue Sep 15 05:46:55 2015 (r287809) @@ -40,6 +40,7 @@ typedef enum { SIGNATURE_TYPE, FINGERPRINTS, REPOS_DIR, + PUBKEY, CONFIG_SIZE } pkg_config_key; Modified: stable/10/usr.sbin/pkg/pkg.c ============================================================================== --- stable/10/usr.sbin/pkg/pkg.c Tue Sep 15 05:19:10 2015 (r287808) +++ stable/10/usr.sbin/pkg/pkg.c Tue Sep 15 05:46:55 2015 (r287809) @@ -65,6 +65,11 @@ struct sig_cert { bool trusted; }; +struct pubkey { + unsigned char *sig; + int siglen; +}; + typedef enum { HASH_UNKNOWN, HASH_SHA256, @@ -470,6 +475,25 @@ cleanup: } static EVP_PKEY * +load_public_key_file(const char *file) +{ + EVP_PKEY *pkey; + BIO *bp; + char errbuf[1024]; + + bp = BIO_new_file(file, "r"); + if (!bp) + errx(EXIT_FAILURE, "Unable to read %s", file); + + if ((pkey = PEM_read_bio_PUBKEY(bp, NULL, NULL, NULL)) == NULL) + warnx("ici: %s", ERR_error_string(ERR_get_error(), errbuf)); + + BIO_free(bp); + + return (pkey); +} + +static EVP_PKEY * load_public_key_buf(const unsigned char *cert, int certlen) { EVP_PKEY *pkey; @@ -487,8 +511,8 @@ load_public_key_buf(const unsigned char } static bool -rsa_verify_cert(int fd, const unsigned char *key, int keylen, - unsigned char *sig, int siglen) +rsa_verify_cert(int fd, const char *sigfile, const unsigned char *key, + int keylen, unsigned char *sig, int siglen) { EVP_MD_CTX *mdctx; EVP_PKEY *pkey; @@ -500,6 +524,8 @@ rsa_verify_cert(int fd, const unsigned c mdctx = NULL; ret = false; + SSL_load_error_strings(); + /* Compute SHA256 of the package. */ if (lseek(fd, 0, 0) == -1) { warn("lseek"); @@ -510,9 +536,16 @@ rsa_verify_cert(int fd, const unsigned c goto cleanup; } - if ((pkey = load_public_key_buf(key, keylen)) == NULL) { - warnx("Error reading public key"); - goto cleanup; + if (sigfile != NULL) { + if ((pkey = load_public_key_file(sigfile)) == NULL) { + warnx("Error reading public key"); + goto cleanup; + } + } else { + if ((pkey = load_public_key_buf(key, keylen)) == NULL) { + warnx("Error reading public key"); + goto cleanup; + } } /* Verify signature of the SHA256(pkg) is valid. */ @@ -522,16 +555,16 @@ rsa_verify_cert(int fd, const unsigned c } if (EVP_DigestVerifyInit(mdctx, NULL, EVP_sha256(), NULL, pkey) != 1) { - warnx("%s", ERR_error_string(ERR_get_error(), errbuf)); + warnx("la %s", ERR_error_string(ERR_get_error(), errbuf)); goto error; } if (EVP_DigestVerifyUpdate(mdctx, sha256, strlen(sha256)) != 1) { - warnx("%s", ERR_error_string(ERR_get_error(), errbuf)); + warnx("ici: %s", ERR_error_string(ERR_get_error(), errbuf)); goto error; } if (EVP_DigestVerifyFinal(mdctx, sig, siglen) != 1) { - warnx("%s", ERR_error_string(ERR_get_error(), errbuf)); + warnx("merde %s", ERR_error_string(ERR_get_error(), errbuf)); goto error; } @@ -552,6 +585,35 @@ cleanup: return (ret); } +static struct pubkey * +read_pubkey(int fd) +{ + struct pubkey *pk; + struct sbuf *sig; + char buf[4096]; + int r; + + if (lseek(fd, 0, 0) == -1) { + warn("lseek"); + return (NULL); + } + + sig = sbuf_new_auto(); + + while ((r = read(fd, buf, sizeof(buf))) >0) { + sbuf_bcat(sig, buf, r); + } + + sbuf_finish(sig); + pk = calloc(1, sizeof(struct pubkey)); + pk->siglen = sbuf_len(sig); + pk->sig = calloc(1, pk->siglen); + memcpy(pk->sig, sbuf_data(sig), pk->siglen); + sbuf_delete(sig); + + return (pk); +} + static struct sig_cert * parse_cert(int fd) { int my_fd; @@ -625,6 +687,45 @@ parse_cert(int fd) { } static bool +verify_pubsignature(int fd_pkg, int fd_sig) +{ + struct pubkey *pk; + const char *pubkey; + bool ret; + + pk = NULL; + pubkey = NULL; + ret = false; + if (config_string(PUBKEY, &pubkey) != 0) { + warnx("No CONFIG_PUBKEY defined"); + goto cleanup; + } + + if ((pk = read_pubkey(fd_sig)) == NULL) { + warnx("Error reading signature"); + goto cleanup; + } + + /* Verify the signature. */ + printf("Verifying signature with public key %s... ", pubkey); + if (rsa_verify_cert(fd_pkg, pubkey, NULL, 0, pk->sig, + pk->siglen) == false) { + fprintf(stderr, "Signature is not valid\n"); + goto cleanup; + } + + ret = true; + +cleanup: + if (pk) { + free(pk->sig); + free(pk); + } + + return (ret); +} + +static bool verify_signature(int fd_pkg, int fd_sig) { struct fingerprint_list *trusted, *revoked; @@ -702,7 +803,7 @@ verify_signature(int fd_pkg, int fd_sig) /* Verify the signature. */ printf("Verifying signature with trusted certificate %s... ", sc->name); - if (rsa_verify_cert(fd_pkg, sc->cert, sc->certlen, sc->sig, + if (rsa_verify_cert(fd_pkg, NULL, sc->cert, sc->certlen, sc->sig, sc->siglen) == false) { fprintf(stderr, "Signature is not valid\n"); goto cleanup; @@ -768,24 +869,42 @@ bootstrap_pkg(bool force) if (signature_type != NULL && strcasecmp(signature_type, "NONE") != 0) { - if (strcasecmp(signature_type, "FINGERPRINTS") != 0) { - warnx("Signature type %s is not supported for " - "bootstrapping.", signature_type); - goto cleanup; - } + if (strcasecmp(signature_type, "FINGERPRINTS") == 0) { + + snprintf(tmpsig, MAXPATHLEN, "%s/pkg.txz.sig.XXXXXX", + getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); + snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz.sig", + packagesite); + + if ((fd_sig = fetch_to_fd(url, tmpsig)) == -1) { + fprintf(stderr, "Signature for pkg not " + "available.\n"); + goto fetchfail; + } - snprintf(tmpsig, MAXPATHLEN, "%s/pkg.txz.sig.XXXXXX", - getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); - snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz.sig", - packagesite); + if (verify_signature(fd_pkg, fd_sig) == false) + goto cleanup; + } else if (strcasecmp(signature_type, "PUBKEY") == 0) { - if ((fd_sig = fetch_to_fd(url, tmpsig)) == -1) { - fprintf(stderr, "Signature for pkg not available.\n"); - goto fetchfail; - } + snprintf(tmpsig, MAXPATHLEN, + "%s/pkg.txz.pubkeysig.XXXXXX", + getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); + snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz.pubkeysig", + packagesite); + + if ((fd_sig = fetch_to_fd(url, tmpsig)) == -1) { + fprintf(stderr, "Signature for pkg not " + "available.\n"); + goto fetchfail; + } - if (verify_signature(fd_pkg, fd_sig) == false) + if (verify_pubsignature(fd_pkg, fd_sig) == false) + goto cleanup; + } else { + warnx("Signature type %s is not supported for " + "bootstrapping.", signature_type); goto cleanup; + } } if ((ret = extract_pkg_static(fd_pkg, pkgstatic, MAXPATHLEN)) == 0) @@ -862,21 +981,37 @@ bootstrap_pkg_local(const char *pkgpath, } if (signature_type != NULL && strcasecmp(signature_type, "NONE") != 0) { - if (strcasecmp(signature_type, "FINGERPRINTS") != 0) { - warnx("Signature type %s is not supported for " - "bootstrapping.", signature_type); - goto cleanup; - } + if (strcasecmp(signature_type, "FINGERPRINTS") == 0) { - snprintf(path, sizeof(path), "%s.sig", pkgpath); + snprintf(path, sizeof(path), "%s.sig", pkgpath); - if ((fd_sig = open(path, O_RDONLY)) == -1) { - fprintf(stderr, "Signature for pkg not available.\n"); - goto cleanup; - } + if ((fd_sig = open(path, O_RDONLY)) == -1) { + fprintf(stderr, "Signature for pkg not " + "available.\n"); + goto cleanup; + } - if (verify_signature(fd_pkg, fd_sig) == false) + if (verify_signature(fd_pkg, fd_sig) == false) + goto cleanup; + + } else if (strcasecmp(signature_type, "PUBKEY") == 0) { + + snprintf(path, sizeof(path), "%s.pubkeysig", pkgpath); + + if ((fd_sig = open(path, O_RDONLY)) == -1) { + fprintf(stderr, "Signature for pkg not " + "available.\n"); + goto cleanup; + } + + if (verify_pubsignature(fd_pkg, fd_sig) == false) + goto cleanup; + + } else { + warnx("Signature type %s is not supported for " + "bootstrapping.", signature_type); goto cleanup; + } } if ((ret = extract_pkg_static(fd_pkg, pkgstatic, MAXPATHLEN)) == 0) From owner-svn-src-stable@freebsd.org Tue Sep 15 05:56:17 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C4C2A02158; Tue, 15 Sep 2015 05:56:17 +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 0CD54175C; Tue, 15 Sep 2015 05:56:17 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8F5uGAv091159; Tue, 15 Sep 2015 05:56:16 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8F5uGxQ091158; Tue, 15 Sep 2015 05:56:16 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201509150556.t8F5uGxQ091158@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 15 Sep 2015 05:56: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: r287810 - stable/10/usr.sbin/pkg X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2015 05:56:17 -0000 Author: bapt Date: Tue Sep 15 05:56:16 2015 New Revision: 287810 URL: https://svnweb.freebsd.org/changeset/base/287810 Log: MFC: r287580 Remove extra debug that crept in Modified: stable/10/usr.sbin/pkg/pkg.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/pkg/pkg.c ============================================================================== --- stable/10/usr.sbin/pkg/pkg.c Tue Sep 15 05:46:55 2015 (r287809) +++ stable/10/usr.sbin/pkg/pkg.c Tue Sep 15 05:56:16 2015 (r287810) @@ -555,16 +555,16 @@ rsa_verify_cert(int fd, const char *sigf } if (EVP_DigestVerifyInit(mdctx, NULL, EVP_sha256(), NULL, pkey) != 1) { - warnx("la %s", ERR_error_string(ERR_get_error(), errbuf)); + warnx("%s", ERR_error_string(ERR_get_error(), errbuf)); goto error; } if (EVP_DigestVerifyUpdate(mdctx, sha256, strlen(sha256)) != 1) { - warnx("ici: %s", ERR_error_string(ERR_get_error(), errbuf)); + warnx("%s", ERR_error_string(ERR_get_error(), errbuf)); goto error; } if (EVP_DigestVerifyFinal(mdctx, sig, siglen) != 1) { - warnx("merde %s", ERR_error_string(ERR_get_error(), errbuf)); + warnx("%s", ERR_error_string(ERR_get_error(), errbuf)); goto error; } From owner-svn-src-stable@freebsd.org Tue Sep 15 06:21:35 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58DFCA03184; Tue, 15 Sep 2015 06:21:35 +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 486EE1094; Tue, 15 Sep 2015 06:21:35 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8F6LZRr002163; Tue, 15 Sep 2015 06:21:35 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8F6LY0t002159; Tue, 15 Sep 2015 06:21:34 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201509150621.t8F6LY0t002159@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 15 Sep 2015 06:21:34 +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: r287811 - stable/9/usr.sbin/pkg X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2015 06:21:35 -0000 Author: bapt Date: Tue Sep 15 06:21:33 2015 New Revision: 287811 URL: https://svnweb.freebsd.org/changeset/base/287811 Log: MFC: r287579, r287810 (adapted to old openssl APIs) Implement pubkey support for the bootstrap Note that to not interfer with finger print it expects a signature on pkg itself which is named pkg.txz.pubkeysign To generate it: echo -n "$(sha256 -q pkg.txz)" | openssl dgst -sha256 -sign /thekey \ -binary -out ./pkg.txz.pubkeysig Note the "echo -n" which prevent signing the '\n' one would get otherwise PR: 202622 Modified: stable/9/usr.sbin/pkg/config.c stable/9/usr.sbin/pkg/config.h stable/9/usr.sbin/pkg/pkg.c Directory Properties: stable/9/usr.sbin/pkg/ (props changed) Modified: stable/9/usr.sbin/pkg/config.c ============================================================================== --- stable/9/usr.sbin/pkg/config.c Tue Sep 15 05:56:16 2015 (r287810) +++ stable/9/usr.sbin/pkg/config.c Tue Sep 15 06:21:33 2015 (r287811) @@ -131,6 +131,15 @@ static struct config_entry c[] = { false, true, }, + [PUBKEY] = { + PKG_CONFIG_STRING, + "PUBKEY", + NULL, + NULL, + NULL, + false, + false + } }; static const char * @@ -347,6 +356,8 @@ config_parse(const ucl_object_t *obj, pk sbuf_cpy(buf, "SIGNATURE_TYPE"); else if (strcasecmp(key, "fingerprints") == 0) sbuf_cpy(buf, "FINGERPRINTS"); + else if (strcasecmp(key, "pubkey") == 0) + sbuf_cpy(buf, "PUBKEY"); else if (strcasecmp(key, "enabled") == 0) { if ((cur->type != UCL_BOOLEAN) || !ucl_object_toboolean(cur)) Modified: stable/9/usr.sbin/pkg/config.h ============================================================================== --- stable/9/usr.sbin/pkg/config.h Tue Sep 15 05:56:16 2015 (r287810) +++ stable/9/usr.sbin/pkg/config.h Tue Sep 15 06:21:33 2015 (r287811) @@ -40,6 +40,7 @@ typedef enum { SIGNATURE_TYPE, FINGERPRINTS, REPOS_DIR, + PUBKEY, CONFIG_SIZE } pkg_config_key; Modified: stable/9/usr.sbin/pkg/pkg.c ============================================================================== --- stable/9/usr.sbin/pkg/pkg.c Tue Sep 15 05:56:16 2015 (r287810) +++ stable/9/usr.sbin/pkg/pkg.c Tue Sep 15 06:21:33 2015 (r287811) @@ -66,6 +66,11 @@ struct sig_cert { bool trusted; }; +struct pubkey { + unsigned char *sig; + int siglen; +}; + typedef enum { HASH_UNKNOWN, HASH_SHA256, @@ -481,7 +486,30 @@ cleanup: } static RSA * -load_rsa_public_key_buf(unsigned char *cert, int certlen) +load_rsa_public_key_file(const char *file) +{ + RSA *rsa = NULL; + BIO *bp; + char errbuf[1024]; + + bp = BIO_new_file(file, "r"); + if (!bp) + errx(EXIT_FAILURE, "Unable to read %s", file); + + if (!PEM_read_bio_RSA_PUBKEY(bp, &rsa, NULL, NULL)) { + warn("error reading public key: %s", + ERR_error_string(ERR_get_error(), errbuf)); + BIO_free(bp); + return (NULL); + } + + BIO_free(bp); + + return (rsa); +} + +static RSA * +load_rsa_public_key_buf(const unsigned char *cert, int certlen) { RSA *rsa = NULL; BIO *bp; @@ -500,8 +528,8 @@ load_rsa_public_key_buf(unsigned char *c static bool -rsa_verify_cert(int fd, unsigned char *key, int keylen, - unsigned char *sig, int siglen) +rsa_verify_cert(int fd, const char *sigfile, const unsigned char *key, + int keylen, unsigned char *sig, int siglen) { char sha256[SHA256_DIGEST_LENGTH *2 +1]; char hash[SHA256_DIGEST_LENGTH]; @@ -518,7 +546,11 @@ rsa_verify_cert(int fd, unsigned char *k sha256_buf_bin(sha256, strlen(sha256), hash); - rsa = load_rsa_public_key_buf(key, keylen); + if (sigfile != NULL) { + rsa = load_rsa_public_key_file(sigfile); + } else { + rsa = load_rsa_public_key_buf(key, keylen); + } if (rsa == NULL) return (false); ret = RSA_verify(NID_sha256, hash, sizeof(hash), sig, siglen, rsa); @@ -533,6 +565,35 @@ rsa_verify_cert(int fd, unsigned char *k return (true); } +static struct pubkey * +read_pubkey(int fd) +{ + struct pubkey *pk; + struct sbuf *sig; + char buf[4096]; + int r; + + if (lseek(fd, 0, 0) == -1) { + warn("lseek"); + return (NULL); + } + + sig = sbuf_new_auto(); + + while ((r = read(fd, buf, sizeof(buf))) >0) { + sbuf_bcat(sig, buf, r); + } + + sbuf_finish(sig); + pk = calloc(1, sizeof(struct pubkey)); + pk->siglen = sbuf_len(sig); + pk->sig = calloc(1, pk->siglen); + memcpy(pk->sig, sbuf_data(sig), pk->siglen); + sbuf_delete(sig); + + return (pk); +} + static struct sig_cert * parse_cert(int fd) { int my_fd; @@ -606,6 +667,45 @@ parse_cert(int fd) { } static bool +verify_pubsignature(int fd_pkg, int fd_sig) +{ + struct pubkey *pk; + const char *pubkey; + bool ret; + + pk = NULL; + pubkey = NULL; + ret = false; + if (config_string(PUBKEY, &pubkey) != 0) { + warnx("No CONFIG_PUBKEY defined"); + goto cleanup; + } + + if ((pk = read_pubkey(fd_sig)) == NULL) { + warnx("Error reading signature"); + goto cleanup; + } + + /* Verify the signature. */ + printf("Verifying signature with public key %s... ", pubkey); + if (rsa_verify_cert(fd_pkg, pubkey, NULL, 0, pk->sig, + pk->siglen) == false) { + fprintf(stderr, "Signature is not valid\n"); + goto cleanup; + } + + ret = true; + +cleanup: + if (pk) { + free(pk->sig); + free(pk); + } + + return (ret); +} + +static bool verify_signature(int fd_pkg, int fd_sig) { struct fingerprint_list *trusted, *revoked; @@ -683,7 +783,7 @@ verify_signature(int fd_pkg, int fd_sig) /* Verify the signature. */ printf("Verifying signature with trusted certificate %s... ", sc->name); - if (rsa_verify_cert(fd_pkg, sc->cert, sc->certlen, sc->sig, + if (rsa_verify_cert(fd_pkg, NULL, sc->cert, sc->certlen, sc->sig, sc->siglen) == false) { printf("failed\n"); fprintf(stderr, "Signature is not valid\n"); @@ -751,24 +851,42 @@ bootstrap_pkg(bool force) if (signature_type != NULL && strcasecmp(signature_type, "NONE") != 0) { - if (strcasecmp(signature_type, "FINGERPRINTS") != 0) { - warnx("Signature type %s is not supported for " - "bootstrapping.", signature_type); - goto cleanup; - } + if (strcasecmp(signature_type, "FINGERPRINTS") == 0) { + + snprintf(tmpsig, MAXPATHLEN, "%s/pkg.txz.sig.XXXXXX", + getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); + snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz.sig", + packagesite); + + if ((fd_sig = fetch_to_fd(url, tmpsig)) == -1) { + fprintf(stderr, "Signature for pkg not " + "available.\n"); + goto fetchfail; + } - snprintf(tmpsig, MAXPATHLEN, "%s/pkg.txz.sig.XXXXXX", - getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); - snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz.sig", - packagesite); + if (verify_signature(fd_pkg, fd_sig) == false) + goto cleanup; + } else if (strcasecmp(signature_type, "PUBKEY") == 0) { - if ((fd_sig = fetch_to_fd(url, tmpsig)) == -1) { - fprintf(stderr, "Signature for pkg not available.\n"); - goto fetchfail; - } + snprintf(tmpsig, MAXPATHLEN, + "%s/pkg.txz.pubkeysig.XXXXXX", + getenv("TMPDIR") ? getenv("TMPDIR") : _PATH_TMP); + snprintf(url, MAXPATHLEN, "%s/Latest/pkg.txz.pubkeysig", + packagesite); + + if ((fd_sig = fetch_to_fd(url, tmpsig)) == -1) { + fprintf(stderr, "Signature for pkg not " + "available.\n"); + goto fetchfail; + } - if (verify_signature(fd_pkg, fd_sig) == false) + if (verify_pubsignature(fd_pkg, fd_sig) == false) + goto cleanup; + } else { + warnx("Signature type %s is not supported for " + "bootstrapping.", signature_type); goto cleanup; + } } if ((ret = extract_pkg_static(fd_pkg, pkgstatic, MAXPATHLEN)) == 0) @@ -842,21 +960,37 @@ bootstrap_pkg_local(const char *pkgpath, } if (signature_type != NULL && strcasecmp(signature_type, "NONE") != 0) { - if (strcasecmp(signature_type, "FINGERPRINTS") != 0) { - warnx("Signature type %s is not supported for " - "bootstrapping.", signature_type); - goto cleanup; - } + if (strcasecmp(signature_type, "FINGERPRINTS") == 0) { - snprintf(path, sizeof(path), "%s.sig", pkgpath); + snprintf(path, sizeof(path), "%s.sig", pkgpath); - if ((fd_sig = open(path, O_RDONLY)) == -1) { - fprintf(stderr, "Signature for pkg not available.\n"); - goto cleanup; - } + if ((fd_sig = open(path, O_RDONLY)) == -1) { + fprintf(stderr, "Signature for pkg not " + "available.\n"); + goto cleanup; + } - if (verify_signature(fd_pkg, fd_sig) == false) + if (verify_signature(fd_pkg, fd_sig) == false) + goto cleanup; + + } else if (strcasecmp(signature_type, "PUBKEY") == 0) { + + snprintf(path, sizeof(path), "%s.pubkeysig", pkgpath); + + if ((fd_sig = open(path, O_RDONLY)) == -1) { + fprintf(stderr, "Signature for pkg not " + "available.\n"); + goto cleanup; + } + + if (verify_pubsignature(fd_pkg, fd_sig) == false) + goto cleanup; + + } else { + warnx("Signature type %s is not supported for " + "bootstrapping.", signature_type); goto cleanup; + } } if ((ret = extract_pkg_static(fd_pkg, pkgstatic, MAXPATHLEN)) == 0) From owner-svn-src-stable@freebsd.org Tue Sep 15 06:22:51 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B84D6A03367; Tue, 15 Sep 2015 06:22:51 +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 A8B521307; Tue, 15 Sep 2015 06:22:51 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8F6Mpsk004258; Tue, 15 Sep 2015 06:22:51 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8F6MpRO004257; Tue, 15 Sep 2015 06:22:51 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201509150622.t8F6MpRO004257@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 15 Sep 2015 06:22:51 +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: r287812 - stable/9/usr.sbin/pkg X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2015 06:22:51 -0000 Author: bapt Date: Tue Sep 15 06:22:50 2015 New Revision: 287812 URL: https://svnweb.freebsd.org/changeset/base/287812 Log: MFC: r281039 Allow fetching pkg(8) even if servers/proxies are not passing Content-length Modified: stable/9/usr.sbin/pkg/pkg.c Directory Properties: stable/9/usr.sbin/pkg/ (props changed) Modified: stable/9/usr.sbin/pkg/pkg.c ============================================================================== --- stable/9/usr.sbin/pkg/pkg.c Tue Sep 15 06:21:33 2015 (r287811) +++ stable/9/usr.sbin/pkg/pkg.c Tue Sep 15 06:22:50 2015 (r287812) @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -182,14 +181,11 @@ fetch_to_fd(const char *url, char *path) /* To store _https._tcp. + hostname + \0 */ int fd; int retry, max_retry; - off_t done, r; - time_t now, last; + ssize_t r; char buf[10240]; char zone[MAXHOSTNAMELEN + 13]; static const char *mirror_type = NULL; - done = 0; - last = 0; max_retry = 3; current = mirrors = NULL; remote = NULL; @@ -239,19 +235,16 @@ fetch_to_fd(const char *url, char *path) } } - while (done < st.size) { - if ((r = fread(buf, 1, sizeof(buf), remote)) < 1) - break; - + while ((r = fread(buf, 1, sizeof(buf), remote)) > 0) { if (write(fd, buf, r) != r) { warn("write()"); goto fetchfail; } + } - done += r; - now = time(NULL); - if (now > last || done == st.size) - last = now; + if (r != 0) { + warn("An error occurred while fetching pkg(8)"); + goto fetchfail; } if (ferror(remote)) From owner-svn-src-stable@freebsd.org Tue Sep 15 08:34:33 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C2B2EA0356B; Tue, 15 Sep 2015 08:34:33 +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 B370C1CCC; Tue, 15 Sep 2015 08:34:33 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8F8YX45062573; Tue, 15 Sep 2015 08:34:33 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8F8YXPu062572; Tue, 15 Sep 2015 08:34:33 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201509150834.t8F8YXPu062572@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Tue, 15 Sep 2015 08:34: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: r287814 - stable/9/usr.sbin/pkg X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2015 08:34:33 -0000 Author: bapt Date: Tue Sep 15 08:34:32 2015 New Revision: 287814 URL: https://svnweb.freebsd.org/changeset/base/287814 Log: Fix build with gcc Modified: stable/9/usr.sbin/pkg/pkg.c Modified: stable/9/usr.sbin/pkg/pkg.c ============================================================================== --- stable/9/usr.sbin/pkg/pkg.c Tue Sep 15 06:48:19 2015 (r287813) +++ stable/9/usr.sbin/pkg/pkg.c Tue Sep 15 08:34:32 2015 (r287814) @@ -502,7 +502,7 @@ load_rsa_public_key_file(const char *fil } static RSA * -load_rsa_public_key_buf(const unsigned char *cert, int certlen) +load_rsa_public_key_buf(unsigned char *cert, int certlen) { RSA *rsa = NULL; BIO *bp; @@ -521,7 +521,7 @@ load_rsa_public_key_buf(const unsigned c static bool -rsa_verify_cert(int fd, const char *sigfile, const unsigned char *key, +rsa_verify_cert(int fd, const char *sigfile, unsigned char *key, int keylen, unsigned char *sig, int siglen) { char sha256[SHA256_DIGEST_LENGTH *2 +1]; From owner-svn-src-stable@freebsd.org Wed Sep 16 00:25:41 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55D579C226A; Wed, 16 Sep 2015 00:25:41 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 467B61515; Wed, 16 Sep 2015 00:25:41 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8G0Pfdt077574; Wed, 16 Sep 2015 00:25:41 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8G0PfTH077573; Wed, 16 Sep 2015 00:25:41 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201509160025.t8G0PfTH077573@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Wed, 16 Sep 2015 00:25: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: r287839 - stable/10/sys/dev/msk X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Sep 2015 00:25:41 -0000 Author: yongari Date: Wed Sep 16 00:25:40 2015 New Revision: 287839 URL: https://svnweb.freebsd.org/changeset/base/287839 Log: MFC r287238: Set DMA alignment constraint of status, TX and RX LEs(List Elements in Marvell terms) to 32768. 32768 looks overkill but it will ensure correct DMAed update. This change addresses occasional watchdog timeouts reported on 10.2-RELEASE. Modified: stable/10/sys/dev/msk/if_mskreg.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/msk/if_mskreg.h ============================================================================== --- stable/10/sys/dev/msk/if_mskreg.h Tue Sep 15 23:58:16 2015 (r287838) +++ stable/10/sys/dev/msk/if_mskreg.h Wed Sep 16 00:25:40 2015 (r287839) @@ -2175,13 +2175,8 @@ #define MSK_ADDR_LO(x) ((uint64_t) (x) & 0xffffffffUL) #define MSK_ADDR_HI(x) ((uint64_t) (x) >> 32) -/* - * At first I guessed 8 bytes, the size of a single descriptor, would be - * required alignment constraints. But, it seems that Yukon II have 4096 - * bytes boundary alignment constraints. - */ -#define MSK_RING_ALIGN 4096 -#define MSK_STAT_ALIGN 4096 +#define MSK_RING_ALIGN 32768 +#define MSK_STAT_ALIGN 32768 /* Rx descriptor data structure */ struct msk_rx_desc { From owner-svn-src-stable@freebsd.org Wed Sep 16 00:45:49 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CED799C2F4D; Wed, 16 Sep 2015 00:45:49 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BF7EA1E63; Wed, 16 Sep 2015 00:45:49 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8G0jnpq086191; Wed, 16 Sep 2015 00:45:49 GMT (envelope-from yongari@FreeBSD.org) Received: (from yongari@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8G0jnMs086190; Wed, 16 Sep 2015 00:45:49 GMT (envelope-from yongari@FreeBSD.org) Message-Id: <201509160045.t8G0jnMs086190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yongari set sender to yongari@FreeBSD.org using -f From: Pyun YongHyeon Date: Wed, 16 Sep 2015 00:45:49 +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: r287840 - stable/9/sys/dev/msk X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Sep 2015 00:45:49 -0000 Author: yongari Date: Wed Sep 16 00:45:48 2015 New Revision: 287840 URL: https://svnweb.freebsd.org/changeset/base/287840 Log: MFC r287238: Set DMA alignment constraint of status, TX and RX LEs(List Elements in Marvell terms) to 32768. 32768 looks overkill but it will ensure correct DMAed update. This change addresses occasional watchdog timeouts reported on 10.2-RELEASE. Modified: stable/9/sys/dev/msk/if_mskreg.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/msk/if_mskreg.h ============================================================================== --- stable/9/sys/dev/msk/if_mskreg.h Wed Sep 16 00:25:40 2015 (r287839) +++ stable/9/sys/dev/msk/if_mskreg.h Wed Sep 16 00:45:48 2015 (r287840) @@ -2175,13 +2175,8 @@ #define MSK_ADDR_LO(x) ((uint64_t) (x) & 0xffffffffUL) #define MSK_ADDR_HI(x) ((uint64_t) (x) >> 32) -/* - * At first I guessed 8 bytes, the size of a single descriptor, would be - * required alignment constraints. But, it seems that Yukon II have 4096 - * bytes boundary alignment constraints. - */ -#define MSK_RING_ALIGN 4096 -#define MSK_STAT_ALIGN 4096 +#define MSK_RING_ALIGN 32768 +#define MSK_STAT_ALIGN 32768 /* Rx descriptor data structure */ struct msk_rx_desc { From owner-svn-src-stable@freebsd.org Wed Sep 16 04:15:47 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65F779C2516; Wed, 16 Sep 2015 04:15:47 +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 5649B110D; Wed, 16 Sep 2015 04:15:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8G4FlwD073951; Wed, 16 Sep 2015 04:15:47 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8G4FlSL073950; Wed, 16 Sep 2015 04:15:47 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201509160415.t8G4FlSL073950@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 16 Sep 2015 04:15:47 +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: r287845 - stable/10/sys/ufs/ffs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Sep 2015 04:15:47 -0000 Author: kib Date: Wed Sep 16 04:15:46 2015 New Revision: 287845 URL: https://svnweb.freebsd.org/changeset/base/287845 Log: MFC r287361: Handle excess of D_NEWBLK in the same way as excess of D_INODEDEP and D_DIRREM, by scheduling ast to flush dependencies. For 32bit arches, reduce the total amount of allowed dependencies by two. MFC r287479: Declare the writes around the call to VFS_SYNC() in softdep_ast_cleanup_proc(). MFC r287483: Do not consume extra reference. Modified: stable/10/sys/ufs/ffs/ffs_softdep.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/10/sys/ufs/ffs/ffs_softdep.c Wed Sep 16 04:07:39 2015 (r287844) +++ stable/10/sys/ufs/ffs/ffs_softdep.c Wed Sep 16 04:15:46 2015 (r287845) @@ -923,8 +923,7 @@ static int journal_unsuspend(struct ufsm static void softdep_prelink(struct vnode *, struct vnode *); static void add_to_journal(struct worklist *); static void remove_from_journal(struct worklist *); -static bool softdep_excess_inodes(struct ufsmount *); -static bool softdep_excess_dirrem(struct ufsmount *); +static bool softdep_excess_items(struct ufsmount *, int); static void softdep_process_journal(struct mount *, struct worklist *, int); static struct jremref *newjremref(struct dirrem *, struct inode *, struct inode *ip, off_t, nlink_t); @@ -2212,7 +2211,7 @@ inodedep_lookup(mp, inum, flags, inodede * responsible for more than our share of that usage and * we are not in a rush, request some inodedep cleanup. */ - if (softdep_excess_inodes(ump)) + if (softdep_excess_items(ump, D_INODEDEP)) schedule_cleanup(mp); else FREE_LOCK(ump); @@ -2307,7 +2306,12 @@ newblk_lookup(mp, newblkno, flags, newbl return (1); if ((flags & DEPALLOC) == 0) return (0); - FREE_LOCK(ump); + if (softdep_excess_items(ump, D_NEWBLK) || + softdep_excess_items(ump, D_ALLOCDIRECT) || + softdep_excess_items(ump, D_ALLOCINDIR)) + schedule_cleanup(mp); + else + FREE_LOCK(ump); newblk = malloc(sizeof(union allblk), M_NEWBLK, M_SOFTDEP_FLAGS | M_ZERO); workitem_alloc(&newblk->nb_list, D_NEWBLK, mp); @@ -2406,7 +2410,11 @@ softdep_initialize() { TAILQ_INIT(&softdepmounts); +#ifdef __LP64__ max_softdeps = desiredvnodes * 4; +#else + max_softdeps = desiredvnodes * 2; +#endif /* initialise bioops hack */ bioops.io_start = softdep_disk_io_initiation; @@ -9106,7 +9114,7 @@ newdirrem(bp, dp, ip, isrmdir, prevdirre * the number of freefile and freeblks structures. */ ACQUIRE_LOCK(ip->i_ump); - if (!IS_SNAPSHOT(ip) && softdep_excess_dirrem(ip->i_ump)) + if (!IS_SNAPSHOT(ip) && softdep_excess_items(ip->i_ump, D_DIRREM)) schedule_cleanup(ITOV(dp)->v_mount); else FREE_LOCK(ip->i_ump); @@ -13244,20 +13252,12 @@ retry: } static bool -softdep_excess_inodes(struct ufsmount *ump) +softdep_excess_items(struct ufsmount *ump, int item) { - return (dep_current[D_INODEDEP] > max_softdeps && - ump->softdep_curdeps[D_INODEDEP] > max_softdeps / - stat_flush_threads); -} - -static bool -softdep_excess_dirrem(struct ufsmount *ump) -{ - - return (dep_current[D_DIRREM] > max_softdeps / 2 && - ump->softdep_curdeps[D_DIRREM] > (max_softdeps / 2) / + KASSERT(item >= 0 && item < D_LAST, ("item %d", item)); + return (dep_current[item] > max_softdeps && + ump->softdep_curdeps[item] > max_softdeps / stat_flush_threads); } @@ -13313,15 +13313,25 @@ softdep_ast_cleanup_proc(void) for (;;) { req = false; ACQUIRE_LOCK(ump); - if (softdep_excess_inodes(ump)) { + if (softdep_excess_items(ump, D_INODEDEP)) { req = true; request_cleanup(mp, FLUSH_INODES); } - if (softdep_excess_dirrem(ump)) { + if (softdep_excess_items(ump, D_DIRREM)) { req = true; request_cleanup(mp, FLUSH_BLOCKS); } FREE_LOCK(ump); + if (softdep_excess_items(ump, D_NEWBLK) || + softdep_excess_items(ump, D_ALLOCDIRECT) || + softdep_excess_items(ump, D_ALLOCINDIR)) { + error = vn_start_write(NULL, &mp, V_WAIT); + if (error == 0) { + req = true; + VFS_SYNC(mp, MNT_WAIT); + vn_finished_write(mp); + } + } if ((td->td_pflags & TDP_KTHREAD) != 0 || !req) break; } From owner-svn-src-stable@freebsd.org Wed Sep 16 04:20:40 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8EDE29C287C; Wed, 16 Sep 2015 04:20:40 +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 7C570130E; Wed, 16 Sep 2015 04:20:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8G4KekA074703; Wed, 16 Sep 2015 04:20:40 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8G4KenV074702; Wed, 16 Sep 2015 04:20:40 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201509160420.t8G4KenV074702@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 16 Sep 2015 04:20:40 +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: r287846 - 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-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Sep 2015 04:20:40 -0000 Author: kib Date: Wed Sep 16 04:20:39 2015 New Revision: 287846 URL: https://svnweb.freebsd.org/changeset/base/287846 Log: MFC r287591: There is no reason in the current kernel to disallow write access to the COW wired entry if the entry permissions allow it. Remove the check. Modified: stable/10/sys/vm/vm_map.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_map.c ============================================================================== --- stable/10/sys/vm/vm_map.c Wed Sep 16 04:15:46 2015 (r287845) +++ stable/10/sys/vm/vm_map.c Wed Sep 16 04:20:39 2015 (r287846) @@ -3989,12 +3989,10 @@ RetryLookup:; vm_map_unlock_read(map); return (KERN_PROTECTION_FAILURE); } - if ((entry->eflags & MAP_ENTRY_USER_WIRED) && - (entry->eflags & MAP_ENTRY_COW) && - (fault_type & VM_PROT_WRITE)) { - vm_map_unlock_read(map); - return (KERN_PROTECTION_FAILURE); - } + KASSERT((prot & VM_PROT_WRITE) == 0 || (entry->eflags & + (MAP_ENTRY_USER_WIRED | MAP_ENTRY_NEEDS_COPY)) != + (MAP_ENTRY_USER_WIRED | MAP_ENTRY_NEEDS_COPY), + ("entry %p flags %x", entry, entry->eflags)); if ((fault_typea & VM_PROT_COPY) != 0 && (entry->max_protection & VM_PROT_WRITE) == 0 && (entry->eflags & MAP_ENTRY_COW) == 0) { @@ -4148,10 +4146,6 @@ vm_map_lookup_locked(vm_map_t *var_map, fault_type &= VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE; if ((fault_type & prot) != fault_type) return (KERN_PROTECTION_FAILURE); - if ((entry->eflags & MAP_ENTRY_USER_WIRED) && - (entry->eflags & MAP_ENTRY_COW) && - (fault_type & VM_PROT_WRITE)) - return (KERN_PROTECTION_FAILURE); /* * If this page is not pageable, we have to get it for all possible From owner-svn-src-stable@freebsd.org Wed Sep 16 04:23:09 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F6D09C29DA; Wed, 16 Sep 2015 04:23: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 500ED177A; Wed, 16 Sep 2015 04:23:09 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8G4N9SM078015; Wed, 16 Sep 2015 04:23:09 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8G4N9qn078014; Wed, 16 Sep 2015 04:23:09 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201509160423.t8G4N9qn078014@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 16 Sep 2015 04:23:09 +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: r287847 - 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-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Sep 2015 04:23:09 -0000 Author: kib Date: Wed Sep 16 04:23:08 2015 New Revision: 287847 URL: https://svnweb.freebsd.org/changeset/base/287847 Log: MFC r287599: Correct handling of open("name", O_DIRECTORY | O_CREAT). PR: 202892 Modified: stable/10/sys/kern/vfs_vnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/vfs_vnops.c ============================================================================== --- stable/10/sys/kern/vfs_vnops.c Wed Sep 16 04:20:39 2015 (r287846) +++ stable/10/sys/kern/vfs_vnops.c Wed Sep 16 04:23:08 2015 (r287847) @@ -188,7 +188,10 @@ vn_open_cred(struct nameidata *ndp, int restart: fmode = *flagp; - if (fmode & O_CREAT) { + if ((fmode & (O_CREAT | O_EXCL | O_DIRECTORY)) == (O_CREAT | + O_EXCL | O_DIRECTORY)) + return (EINVAL); + else if ((fmode & (O_CREAT | O_DIRECTORY)) == O_CREAT) { ndp->ni_cnd.cn_nameiop = CREATE; /* * Set NOCACHE to avoid flushing the cache when From owner-svn-src-stable@freebsd.org Wed Sep 16 04:35:24 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BBCD69CD228; Wed, 16 Sep 2015 04:35:24 +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 AC4131F98; Wed, 16 Sep 2015 04:35:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8G4ZOIL082432; Wed, 16 Sep 2015 04:35:24 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8G4ZOGm082431; Wed, 16 Sep 2015 04:35:24 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201509160435.t8G4ZOGm082431@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 16 Sep 2015 04:35: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: r287849 - 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-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Sep 2015 04:35:24 -0000 Author: kib Date: Wed Sep 16 04:35:23 2015 New Revision: 287849 URL: https://svnweb.freebsd.org/changeset/base/287849 Log: MFC r287366: Use SLIST_FOREACH_SAFE() to fix iteration. Modified: stable/10/sys/kern/kern_event.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_event.c ============================================================================== --- stable/10/sys/kern/kern_event.c Wed Sep 16 04:27:12 2015 (r287848) +++ stable/10/sys/kern/kern_event.c Wed Sep 16 04:35:23 2015 (r287849) @@ -1849,7 +1849,7 @@ void knote(struct knlist *list, long hint, int lockflags) { struct kqueue *kq; - struct knote *kn; + struct knote *kn, *tkn; int error; if (list == NULL) @@ -1861,14 +1861,13 @@ knote(struct knlist *list, long hint, in list->kl_lock(list->kl_lockarg); /* - * If we unlock the list lock (and set KN_INFLUX), we can eliminate - * the kqueue scheduling, but this will introduce four - * lock/unlock's for each knote to test. If we do, continue to use - * SLIST_FOREACH, SLIST_FOREACH_SAFE is not safe in our case, it is - * only safe if you want to remove the current item, which we are - * not doing. + * If we unlock the list lock (and set KN_INFLUX), we can + * eliminate the kqueue scheduling, but this will introduce + * four lock/unlock's for each knote to test. Also, marker + * would be needed to keep iteration position, since filters + * or other threads could remove events. */ - SLIST_FOREACH(kn, &list->kl_list, kn_selnext) { + SLIST_FOREACH_SAFE(kn, &list->kl_list, kn_selnext, tkn) { kq = kn->kn_kq; KQ_LOCK(kq); if ((kn->kn_status & (KN_INFLUX | KN_SCAN)) == KN_INFLUX) { From owner-svn-src-stable@freebsd.org Wed Sep 16 04:38:09 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 228929CD39B; Wed, 16 Sep 2015 04:38:09 +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 06A8D11AA; Wed, 16 Sep 2015 04:38:09 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8G4c868082595; Wed, 16 Sep 2015 04:38:08 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8G4c8ho082592; Wed, 16 Sep 2015 04:38:08 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201509160438.t8G4c8ho082592@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 16 Sep 2015 04:38: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: r287850 - in stable/10/sys: geom geom/multipath 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-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Sep 2015 04:38:09 -0000 Author: imp Date: Wed Sep 16 04:38:07 2015 New Revision: 287850 URL: https://svnweb.freebsd.org/changeset/base/287850 Log: MFC 281310, 287567: r287567 | imp | 2015-09-08 11:47:56 -0600 (Tue, 08 Sep 2015) | 16 lines Mark the swap pager as direct dispatch compatible. r281310 | mav | 2015-04-09 07:09:05 -0600 (Thu, 09 Apr 2015) | 4 lines Remove sleeps from geom_up thread on device destruction. Modified: stable/10/sys/geom/geom_dev.c stable/10/sys/geom/multipath/g_multipath.c stable/10/sys/vm/swap_pager.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/geom/geom_dev.c ============================================================================== --- stable/10/sys/geom/geom_dev.c Wed Sep 16 04:35:23 2015 (r287849) +++ stable/10/sys/geom/geom_dev.c Wed Sep 16 04:38:07 2015 (r287850) @@ -570,7 +570,7 @@ g_dev_done(struct bio *bp2) } mtx_unlock(&sc->sc_mtx); if (destroy) - g_post_event(g_dev_destroy, cp, M_WAITOK, NULL); + g_post_event(g_dev_destroy, cp, M_NOWAIT, NULL); biodone(bp); } Modified: stable/10/sys/geom/multipath/g_multipath.c ============================================================================== --- stable/10/sys/geom/multipath/g_multipath.c Wed Sep 16 04:35:23 2015 (r287849) +++ stable/10/sys/geom/multipath/g_multipath.c Wed Sep 16 04:38:07 2015 (r287850) @@ -369,9 +369,9 @@ g_multipath_done(struct bio *bp) mtx_lock(&sc->sc_mtx); (*cnt)--; if (*cnt == 0 && (cp->index & MP_LOST)) { - cp->index |= MP_POSTED; + if (g_post_event(g_mpd, cp, M_NOWAIT, NULL) == 0) + cp->index |= MP_POSTED; mtx_unlock(&sc->sc_mtx); - g_post_event(g_mpd, cp, M_WAITOK, NULL); } else mtx_unlock(&sc->sc_mtx); g_std_done(bp); Modified: stable/10/sys/vm/swap_pager.c ============================================================================== --- stable/10/sys/vm/swap_pager.c Wed Sep 16 04:35:23 2015 (r287849) +++ stable/10/sys/vm/swap_pager.c Wed Sep 16 04:38:07 2015 (r287850) @@ -2354,8 +2354,8 @@ swapoff_one(struct swdevt *sp, struct uc swap_pager_swapoff(sp); sp->sw_close(curthread, sp); - sp->sw_id = NULL; mtx_lock(&sw_dev_mtx); + sp->sw_id = NULL; TAILQ_REMOVE(&swtailq, sp, sw_list); nswapdev--; if (nswapdev == 0) { @@ -2541,13 +2541,39 @@ swapgeom_close_ev(void *arg, int flags) g_destroy_consumer(cp); } +/* + * Add a reference to the g_consumer for an inflight transaction. + */ +static void +swapgeom_acquire(struct g_consumer *cp) +{ + + mtx_assert(&sw_dev_mtx, MA_OWNED); + cp->index++; +} + +/* + * Remove a reference from the g_consumer. Post a close event if + * all referneces go away. + */ +static void +swapgeom_release(struct g_consumer *cp, struct swdevt *sp) +{ + + mtx_assert(&sw_dev_mtx, MA_OWNED); + cp->index--; + if (cp->index == 0) { + if (g_post_event(swapgeom_close_ev, cp, M_NOWAIT, NULL) == 0) + sp->sw_id = NULL; + } +} + static void swapgeom_done(struct bio *bp2) { struct swdevt *sp; struct buf *bp; struct g_consumer *cp; - int destroy; bp = bp2->bio_caller2; cp = bp2->bio_from; @@ -2557,16 +2583,11 @@ swapgeom_done(struct bio *bp2) bp->b_resid = bp->b_bcount - bp2->bio_completed; bp->b_error = bp2->bio_error; bufdone(bp); + sp = bp2->bio_caller1; mtx_lock(&sw_dev_mtx); - destroy = ((--cp->index) == 0 && cp->private); - if (destroy) { - sp = bp2->bio_caller1; - sp->sw_id = NULL; - } + swapgeom_release(cp, sp); mtx_unlock(&sw_dev_mtx); g_destroy_bio(bp2); - if (destroy) - g_waitfor_event(swapgeom_close_ev, cp, M_WAITOK, NULL); } static void @@ -2584,13 +2605,16 @@ swapgeom_strategy(struct buf *bp, struct bufdone(bp); return; } - cp->index++; + swapgeom_acquire(cp); mtx_unlock(&sw_dev_mtx); if (bp->b_iocmd == BIO_WRITE) bio = g_new_bio(); else bio = g_alloc_bio(); if (bio == NULL) { + mtx_lock(&sw_dev_mtx); + swapgeom_release(cp, sp); + mtx_unlock(&sw_dev_mtx); bp->b_error = ENOMEM; bp->b_ioflags |= BIO_ERROR; bufdone(bp); @@ -2630,7 +2654,12 @@ swapgeom_orphan(struct g_consumer *cp) break; } } - cp->private = (void *)(uintptr_t)1; + /* + * Drop reference we were created with. Do directly since we're in a + * special context where we don't have to queue the call to + * swapgeom_close_ev(). + */ + cp->index--; destroy = ((sp != NULL) && (cp->index == 0)); if (destroy) sp->sw_id = NULL; @@ -2691,8 +2720,8 @@ swapongeom_ev(void *arg, int flags) if (gp == NULL) gp = g_new_geomf(&g_swap_class, "swap"); cp = g_new_consumer(gp); - cp->index = 0; /* Number of active I/Os. */ - cp->private = NULL; /* Orphanization flag */ + cp->index = 1; /* Number of active I/Os, plus one for being active. */ + cp->flags |= G_CF_DIRECT_SEND | G_CF_DIRECT_RECEIVE; g_attach(cp, pp); /* * XXX: Everytime you think you can improve the margin for From owner-svn-src-stable@freebsd.org Wed Sep 16 11:15:09 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A38139CE180; Wed, 16 Sep 2015 11:15:09 +0000 (UTC) (envelope-from ray@freebsd.org) Received: from smtp.dlink.ua (smtp.dlink.ua [193.138.187.146]) by mx1.freebsd.org (Postfix) with ESMTP id 617BC1B2A; Wed, 16 Sep 2015 11:15:09 +0000 (UTC) (envelope-from ray@freebsd.org) Received: from terran (unknown [192.168.99.1]) (Authenticated sender: ray) by smtp.dlink.ua (Postfix) with ESMTPA id 65CE0C493A; Wed, 16 Sep 2015 14:15:01 +0300 (EEST) Date: Wed, 16 Sep 2015 14:15:16 +0300 From: Aleksandr Rybalko To: Alexey Dokuchaev Cc: Aleksandr Rybalko , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r287782 - stable/10/sys/dev/vt Message-Id: <20150916141516.eb45a2dc91e5b49aedd2c33b@freebsd.org> In-Reply-To: <20150915013421.GA59565@FreeBSD.org> References: <201509141442.t8EEg7ao012596@repo.freebsd.org> <20150915013421.GA59565@FreeBSD.org> X-Mailer: Sylpheed 3.4.2 (GTK+ 2.24.25; amd64-portbld-freebsd10.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Sep 2015 11:15:09 -0000 On Tue, 15 Sep 2015 01:34:21 +0000 Alexey Dokuchaev wrote: > On Mon, Sep 14, 2015 at 02:42:07PM +0000, Aleksandr Rybalko wrote: > > New Revision: 287782 > > URL: https://svnweb.freebsd.org/changeset/base/287782 > > > > Log: > > MFC: r272715 > > Allow vt(4) to disable terminal bell with > > `sysctl kern.vt.bell_enable=0`, similar as syscons(4) do. > > [...] > > +VT_SYSCTL_INT(enable_bell, 1, "Enable bell"); > > I think you've meant `sysctl kern.vt.enable_bell=0' in the commit log. Yes. Just copied message with mistake of original commit. Sorry for that. :) > > > + if (!vt_enable_bell) > > + return; > > + > > if (vd->vd_flags & VDF_QUIET_BELL) > > return; > > Hm, I'm wondering why having another sysctl is required when there's already > a way to shut the bell up with VDF_QUIET_BELL flag? Many guys found sysctl way as most comfort. I have no objections, because that way was present in the syscons(4). Name was changed to more obvious one, since '.bell' may be treated as type of bell, but switch just do enable/disable. > > Also, there's certain naming inconsistency between syscons(4) and vt(4). > On my stable/8 laptop, I see this: > > $ sysctl -d hw.syscons.bell > hw.syscons.bell: enable bell > > On my -CURRENT desktop, this: > > $ sysctl -d kern.vt.enable_bell > kern.vt.enable_bell: Enable bell > > ./danfe Thanks you, Alexey! WBW -- Aleksandr Rybalko From owner-svn-src-stable@freebsd.org Wed Sep 16 11:32:29 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC5A99CEACE; Wed, 16 Sep 2015 11:32:29 +0000 (UTC) (envelope-from avatar@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7FAD5154E; Wed, 16 Sep 2015 11:32:29 +0000 (UTC) (envelope-from avatar@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8GBWTPG055930; Wed, 16 Sep 2015 11:32:29 GMT (envelope-from avatar@FreeBSD.org) Received: (from avatar@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8GBWTZa055929; Wed, 16 Sep 2015 11:32:29 GMT (envelope-from avatar@FreeBSD.org) Message-Id: <201509161132.t8GBWTZa055929@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avatar set sender to avatar@FreeBSD.org using -f From: Tai-hwa Liang Date: Wed, 16 Sep 2015 11:32:29 +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: r287858 - stable/7/sys/dev/sound/midi X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Sep 2015 11:32:29 -0000 Author: avatar Date: Wed Sep 16 11:32:28 2015 New Revision: 287858 URL: https://svnweb.freebsd.org/changeset/base/287858 Log: MFC r286886: Fixing typo as well as improving readability of a few comments. Modified: stable/7/sys/dev/sound/midi/midi.c Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/dev/sound/midi/midi.c ============================================================================== --- stable/7/sys/dev/sound/midi/midi.c Wed Sep 16 11:06:07 2015 (r287857) +++ stable/7/sys/dev/sound/midi/midi.c Wed Sep 16 11:32:28 2015 (r287858) @@ -86,7 +86,7 @@ enum midi_states { }; /* - * The MPU interface current has init() uninit() inqsize(( outqsize() + * The MPU interface current has init() uninit() inqsize() outqsize() * callback() : fiddle with the tx|rx status. */ @@ -160,10 +160,15 @@ DEFINE_CLASS(midisynth, midisynth_method /* * Module Exports & Interface * - * struct midi_chan *midi_init(MPU_CLASS cls, int unit, int chan) int - * midi_uninit(struct snd_midi *) 0 == no error EBUSY or other error int - * Midi_in(struct midi_chan *, char *buf, int count) int Midi_out(struct - * midi_chan *, char *buf, int count) + * struct midi_chan *midi_init(MPU_CLASS cls, int unit, int chan, + * void *cookie) + * int midi_uninit(struct snd_midi *) + * + * 0 == no error + * EBUSY or other error + * + * int midi_in(struct snd_midi *, char *buf, int count) + * int midi_out(struct snd_midi *, char *buf, int count) * * midi_{in,out} return actual size transfered * @@ -388,7 +393,7 @@ err0: mtx_unlock(&midistat_lock); /* * midi_uninit does not call MIDI_UNINIT, as since this is the implementors - * entry point. midi_unint if fact, does not send any methods. A call to + * entry point. midi_uninit if fact, does not send any methods. A call to * midi_uninit is a defacto promise that you won't manipulate ch anymore * */ From owner-svn-src-stable@freebsd.org Wed Sep 16 23:33:14 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 576A49CEB0F; Wed, 16 Sep 2015 23:33: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 479C41DD5; Wed, 16 Sep 2015 23:33:14 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8GNXEc5057281; Wed, 16 Sep 2015 23:33:14 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8GNXEnv057280; Wed, 16 Sep 2015 23:33:14 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201509162333.t8GNXEnv057280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 16 Sep 2015 23:33:14 +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: r287881 - in stable: 10/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-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Sep 2015 23:33:14 -0000 Author: gjb Date: Wed Sep 16 23:33:12 2015 New Revision: 287881 URL: https://svnweb.freebsd.org/changeset/base/287881 Log: Document EN-15:16, EN-15:17, EN-15:18. Sponsored by: The FreeBSD Foundation Modified: stable/9/release/doc/share/xml/errata.xml Changes in other areas also in this revision: Modified: stable/10/release/doc/share/xml/errata.xml Modified: stable/9/release/doc/share/xml/errata.xml ============================================================================== --- stable/9/release/doc/share/xml/errata.xml Wed Sep 16 23:09:31 2015 (r287880) +++ stable/9/release/doc/share/xml/errata.xml Wed Sep 16 23:33:12 2015 (r287881) @@ -108,6 +108,14 @@ Insufficient check of supported &man.pkg.7; signature methods. + + + FreeBSD-EN-15:18.pkg + 16 September 2015 + Implement pubkey support for + &man.pkg.7; bootstrap. + From owner-svn-src-stable@freebsd.org Wed Sep 16 23:33:13 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A328C9CEB04; Wed, 16 Sep 2015 23:33:13 +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 9332A1DD3; Wed, 16 Sep 2015 23:33:13 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8GNXDnJ057275; Wed, 16 Sep 2015 23:33:13 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8GNXDtD057274; Wed, 16 Sep 2015 23:33:13 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201509162333.t8GNXDtD057274@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 16 Sep 2015 23:33:13 +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: r287881 - in stable: 10/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-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Sep 2015 23:33:13 -0000 Author: gjb Date: Wed Sep 16 23:33:12 2015 New Revision: 287881 URL: https://svnweb.freebsd.org/changeset/base/287881 Log: Document EN-15:16, EN-15:17, EN-15:18. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/doc/share/xml/errata.xml Changes in other areas also in this revision: Modified: stable/9/release/doc/share/xml/errata.xml Modified: stable/10/release/doc/share/xml/errata.xml ============================================================================== --- stable/10/release/doc/share/xml/errata.xml Wed Sep 16 23:09:31 2015 (r287880) +++ stable/10/release/doc/share/xml/errata.xml Wed Sep 16 23:33:12 2015 (r287881) @@ -49,6 +49,30 @@ Insufficient check of supported &man.pkg.7; signature methods. + + + FreeBSD-EN-15:16.pw + 16 September 2015 + Fix &man.pw.8; regression when creating numeric + users or groups. + + + + FreeBSD-EN-15:17.libc + 16 September 2015 + Fix libc handling of signals for multi-threaded + processes. + + + + FreeBSD-EN-15:18.pkg + 16 September 2015 + Implement pubkey support for + &man.pkg.7; bootstrap. + From owner-svn-src-stable@freebsd.org Thu Sep 17 00:19:28 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A9B639CD5BE; Thu, 17 Sep 2015 00:19:28 +0000 (UTC) (envelope-from avatar@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 99AA51DA1; Thu, 17 Sep 2015 00:19:28 +0000 (UTC) (envelope-from avatar@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8H0JS4H074738; Thu, 17 Sep 2015 00:19:28 GMT (envelope-from avatar@FreeBSD.org) Received: (from avatar@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8H0JS16074737; Thu, 17 Sep 2015 00:19:28 GMT (envelope-from avatar@FreeBSD.org) Message-Id: <201509170019.t8H0JS16074737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avatar set sender to avatar@FreeBSD.org using -f From: Tai-hwa Liang Date: Thu, 17 Sep 2015 00:19:28 +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: r287888 - stable/7/sys/dev/sound/midi X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2015 00:19:28 -0000 Author: avatar Date: Thu Sep 17 00:19:27 2015 New Revision: 287888 URL: https://svnweb.freebsd.org/changeset/base/287888 Log: MFC r286887: Using the error return code documented in the comment. Though there is no direct midi_uninit() caller amongst existing drivers at this moment, a quick experiment indicates that EBUSY gives users more precise error message once drivers start to honour this result. For example, emu_midi_detach() should check the result of mpu401_uninit() and block module unloading if there is any MIDI I/O in progress. Modified: stable/7/sys/dev/sound/midi/midi.c Directory Properties: stable/7/sys/ (props changed) Modified: stable/7/sys/dev/sound/midi/midi.c ============================================================================== --- stable/7/sys/dev/sound/midi/midi.c Thu Sep 17 00:17:32 2015 (r287887) +++ stable/7/sys/dev/sound/midi/midi.c Thu Sep 17 00:19:27 2015 (r287888) @@ -403,7 +403,7 @@ midi_uninit(struct snd_midi *m) { int err; - err = ENXIO; + err = EBUSY; mtx_lock(&midistat_lock); mtx_lock(&m->lock); if (m->busy) { From owner-svn-src-stable@freebsd.org Thu Sep 17 00:24:51 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56D9D9CD93B; Thu, 17 Sep 2015 00:24:51 +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 478DB1175; Thu, 17 Sep 2015 00:24:51 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8H0OpjY078629; Thu, 17 Sep 2015 00:24:51 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8H0OoxS078626; Thu, 17 Sep 2015 00:24:50 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201509170024.t8H0OoxS078626@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Thu, 17 Sep 2015 00:24:50 +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: r287889 - stable/10/share/mk X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2015 00:24:51 -0000 Author: bdrewery Date: Thu Sep 17 00:24:50 2015 New Revision: 287889 URL: https://svnweb.freebsd.org/changeset/base/287889 Log: MFC r287436: Avoid sub-shell for realpath(1) for bmake by using its built-in :tA. Modified: stable/10/share/mk/bsd.port.mk stable/10/share/mk/bsd.port.subdir.mk Directory Properties: stable/10/ (props changed) Modified: stable/10/share/mk/bsd.port.mk ============================================================================== --- stable/10/share/mk/bsd.port.mk Thu Sep 17 00:19:27 2015 (r287888) +++ stable/10/share/mk/bsd.port.mk Thu Sep 17 00:24:50 2015 (r287889) @@ -10,8 +10,12 @@ _PORTSDIR= ${.CURDIR}/${RELPATH} .endif .endfor _PORTSDIR?= /usr/ports +.if defined(.PARSEDIR) +PORTSDIR= ${_PORTSDIR:tA} +.else # fmake doesn't have :tA PORTSDIR!= realpath ${_PORTSDIR} .endif +.endif BSDPORTMK?= ${PORTSDIR}/Mk/bsd.port.mk Modified: stable/10/share/mk/bsd.port.subdir.mk ============================================================================== --- stable/10/share/mk/bsd.port.subdir.mk Thu Sep 17 00:19:27 2015 (r287888) +++ stable/10/share/mk/bsd.port.subdir.mk Thu Sep 17 00:24:50 2015 (r287889) @@ -10,8 +10,12 @@ _PORTSDIR= ${.CURDIR}/${RELPATH} .endif .endfor _PORTSDIR?= /usr/ports +.if defined(.PARSEDIR) +PORTSDIR= ${_PORTSDIR:tA} +.else # fmake doesn't have :tA PORTSDIR!= realpath ${_PORTSDIR} .endif +.endif BSDPORTSUBDIRMK?= ${PORTSDIR}/Mk/bsd.port.subdir.mk From owner-svn-src-stable@freebsd.org Thu Sep 17 00:36:19 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C8AE9CDFCF; Thu, 17 Sep 2015 00:36:19 +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 8D7951617; Thu, 17 Sep 2015 00:36:19 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8H0aJrl082908; Thu, 17 Sep 2015 00:36:19 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8H0aJDU082907; Thu, 17 Sep 2015 00:36:19 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201509170036.t8H0aJDU082907@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 17 Sep 2015 00:36: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: r287890 - stable/10/usr.bin/calendar/calendars X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2015 00:36:19 -0000 Author: pfg Date: Thu Sep 17 00:36:18 2015 New Revision: 287890 URL: https://svnweb.freebsd.org/changeset/base/287890 Log: MFC r286891, r286893: calendar(1): add a few more dates to the Christian calendar Bring some well established holidays that also happen to be legal holidays in many Catholic countries. Modified: stable/10/usr.bin/calendar/calendars/calendar.christian Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/calendar/calendars/calendar.christian ============================================================================== --- stable/10/usr.bin/calendar/calendars/calendar.christian Thu Sep 17 00:24:50 2015 (r287889) +++ stable/10/usr.bin/calendar/calendars/calendar.christian Thu Sep 17 00:36:18 2015 (r287890) @@ -5,8 +5,9 @@ */ #ifndef _calendar_christian_ -#define _calendar_christian_ +#define _calendar_christian_ +01/01 Solemnity of Mary, Mother of God 01/05 Last (twelfth) day of Christmastide 01/06 Epiphany Easter-47 Shrove Tuesday / Mardi Gras (day before Ash Wednesday) @@ -21,10 +22,13 @@ Easter+50 Whitmonday Easter+56 Trinity Sunday (7 days after Pentecost) Easter+60 Corpus Christi (11 days after Pentecost) 05/28* Rogation Sunday +08/15 Assumption of the Blessed Virgin Mary 10/18 Feast Day of St. Luke +11/01 All Saints' Day 11/SunLast First Sunday of Advent (4th Sunday before Christmas) 12/SunFirst First Sunday of Advent (4th Sunday before Christmas) 12/06 St. Nicholas' Day +12/08 Feast of the Immaculate Conception 12/24 Christmas Eve 12/25 Christmastide begins: First day of Christmas 12/26 Second day of Christmas (Boxing Day) From owner-svn-src-stable@freebsd.org Thu Sep 17 00:37:41 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 024F39CE076; Thu, 17 Sep 2015 00:37:41 +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 E75ED18A3; Thu, 17 Sep 2015 00:37:40 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8H0be6j083011; Thu, 17 Sep 2015 00:37:40 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8H0beLr083010; Thu, 17 Sep 2015 00:37:40 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201509170037.t8H0beLr083010@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 17 Sep 2015 00:37:40 +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: r287891 - stable/9/usr.bin/calendar/calendars X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2015 00:37:41 -0000 Author: pfg Date: Thu Sep 17 00:37:40 2015 New Revision: 287891 URL: https://svnweb.freebsd.org/changeset/base/287891 Log: MFC r286891, r286893: calendar(1): add a few more dates to the Christian calendar Bring some well established holidays that also happen to be legal holidays in many Catholic countries. Modified: stable/9/usr.bin/calendar/calendars/calendar.christian Directory Properties: stable/9/usr.bin/calendar/ (props changed) stable/9/usr.bin/calendar/calendars/ (props changed) Modified: stable/9/usr.bin/calendar/calendars/calendar.christian ============================================================================== --- stable/9/usr.bin/calendar/calendars/calendar.christian Thu Sep 17 00:36:18 2015 (r287890) +++ stable/9/usr.bin/calendar/calendars/calendar.christian Thu Sep 17 00:37:40 2015 (r287891) @@ -5,8 +5,9 @@ */ #ifndef _calendar_christian_ -#define _calendar_christian_ +#define _calendar_christian_ +01/01 Solemnity of Mary, Mother of God 01/05 Last (twelfth) day of Christmastide 01/06 Epiphany Easter-47 Shrove Tuesday / Mardi Gras (day before Ash Wednesday) @@ -21,10 +22,13 @@ Easter+50 Whitmonday Easter+56 Trinity Sunday (7 days after Pentecost) Easter+60 Corpus Christi (11 days after Pentecost) 05/28* Rogation Sunday +08/15 Assumption of the Blessed Virgin Mary 10/18 Feast Day of St. Luke +11/01 All Saints' Day 11/SunLast First Sunday of Advent (4th Sunday before Christmas) 12/SunFirst First Sunday of Advent (4th Sunday before Christmas) 12/06 St. Nicholas' Day +12/08 Feast of the Immaculate Conception 12/24 Christmas Eve 12/25 Christmastide begins: First day of Christmas 12/26 Second day of Christmas (Boxing Day) From owner-svn-src-stable@freebsd.org Thu Sep 17 17:09:04 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C53AD9CFC47; Thu, 17 Sep 2015 17:09:04 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9BAC4101C; Thu, 17 Sep 2015 17:09:04 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8HH94d6091954; Thu, 17 Sep 2015 17:09:04 GMT (envelope-from rstone@FreeBSD.org) Received: (from rstone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8HH94Im091953; Thu, 17 Sep 2015 17:09:04 GMT (envelope-from rstone@FreeBSD.org) Message-Id: <201509171709.t8HH94Im091953@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rstone set sender to rstone@FreeBSD.org using -f From: Ryan Stone Date: Thu, 17 Sep 2015 17:09:04 +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: r287922 - 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-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2015 17:09:04 -0000 Author: rstone Date: Thu Sep 17 17:09:03 2015 New Revision: 287922 URL: https://svnweb.freebsd.org/changeset/base/287922 Log: MFC r286970: Prevent ticks rollover from preventing vm_lowmem event Currently vm_pageout_scan() uses a ticks-based scheme to rate-limit the number of times that the vm_lowmem event will happen. However if no events happen for long enough for ticks to roll over, this leaves us in a long window in which vm_lowmem events will not happen. Replace the use of ticks with time_t to prevent rollover from ever being an issue. Reviewed by: ian MFC after: 3 weeks Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D3439 Modified: stable/10/sys/vm/vm_pageout.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_pageout.c ============================================================================== --- stable/10/sys/vm/vm_pageout.c Thu Sep 17 17:00:36 2015 (r287921) +++ stable/10/sys/vm/vm_pageout.c Thu Sep 17 17:09:03 2015 (r287922) @@ -93,6 +93,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -170,7 +171,7 @@ static int vm_pageout_update_period; static int defer_swap_pageouts; static int disable_swap_pageouts; static int lowmem_period = 10; -static int lowmem_ticks; +static time_t lowmem_uptime; #if defined(NO_SWAPPING) static int vm_swap_enabled = 0; @@ -932,7 +933,7 @@ vm_pageout_scan(struct vm_domain *vmd, i * some. We rate limit to avoid thrashing. */ if (vmd == &vm_dom[0] && pass > 0 && - (ticks - lowmem_ticks) / hz >= lowmem_period) { + (time_uptime - lowmem_uptime) >= lowmem_period) { /* * Decrease registered cache sizes. */ @@ -943,7 +944,7 @@ vm_pageout_scan(struct vm_domain *vmd, i * drained above. */ uma_reclaim(); - lowmem_ticks = ticks; + lowmem_uptime = time_uptime; } /* From owner-svn-src-stable@freebsd.org Thu Sep 17 17:56:26 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E863F9CE0FA; Thu, 17 Sep 2015 17:56:25 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CCDA51553; Thu, 17 Sep 2015 17:56:25 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8HHuPFl020692; Thu, 17 Sep 2015 17:56:25 GMT (envelope-from rstone@FreeBSD.org) Received: (from rstone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8HHuO9c020685; Thu, 17 Sep 2015 17:56:24 GMT (envelope-from rstone@FreeBSD.org) Message-Id: <201509171756.t8HHuO9c020685@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rstone set sender to rstone@FreeBSD.org using -f From: Ryan Stone Date: Thu, 17 Sep 2015 17:56: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: r287926 - stable/10/sys/dev/puc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2015 17:56:26 -0000 Author: rstone Date: Thu Sep 17 17:56:23 2015 New Revision: 287926 URL: https://svnweb.freebsd.org/changeset/base/287926 Log: MFC r263109 Add MSI support to puc(9) Add support for MSI interrupts in the puc(9) driver. By default the driver will prefer MSI interrupts to legacy interrupts. A tunable, hw.puc.msi_disable, has been added to force the allocation of legacy interrupts. Reviewed by: jhb@ MFC after: 2 weeks Sponsored by: Sandvine Inc. Modified: stable/10/sys/dev/puc/puc.c stable/10/sys/dev/puc/puc_bfe.h stable/10/sys/dev/puc/puc_cfg.c stable/10/sys/dev/puc/puc_pccard.c stable/10/sys/dev/puc/puc_pci.c stable/10/sys/dev/puc/pucdata.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/puc/puc.c ============================================================================== --- stable/10/sys/dev/puc/puc.c Thu Sep 17 17:45:20 2015 (r287925) +++ stable/10/sys/dev/puc/puc.c Thu Sep 17 17:56:23 2015 (r287926) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -70,6 +71,8 @@ const char puc_driver_name[] = "puc"; static MALLOC_DEFINE(M_PUC, "PUC", "PUC driver"); +SYSCTL_NODE(_hw, OID_AUTO, puc, CTLFLAG_RD, 0, "puc(9) driver configuration"); + struct puc_bar * puc_get_bar(struct puc_softc *sc, int rid) { @@ -324,7 +327,6 @@ puc_bfe_attach(device_t dev) if (bootverbose && sc->sc_ilr != 0) device_printf(dev, "using interrupt latch register\n"); - sc->sc_irid = 0; sc->sc_ires = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->sc_irid, RF_ACTIVE|RF_SHAREABLE); if (sc->sc_ires != NULL) { Modified: stable/10/sys/dev/puc/puc_bfe.h ============================================================================== --- stable/10/sys/dev/puc/puc_bfe.h Thu Sep 17 17:45:20 2015 (r287925) +++ stable/10/sys/dev/puc/puc_bfe.h Thu Sep 17 17:56:23 2015 (r287926) @@ -66,6 +66,7 @@ struct puc_softc { int sc_fastintr:1; int sc_leaving:1; int sc_polled:1; + int sc_msi:1; int sc_ilr; @@ -94,4 +95,6 @@ int puc_bus_setup_intr(device_t, device_ driver_filter_t *, driver_intr_t *, void *, void **); int puc_bus_teardown_intr(device_t, device_t, struct resource *, void *); +SYSCTL_DECL(_hw_puc); + #endif /* _DEV_PUC_BFE_H_ */ Modified: stable/10/sys/dev/puc/puc_cfg.c ============================================================================== --- stable/10/sys/dev/puc/puc_cfg.c Thu Sep 17 17:45:20 2015 (r287925) +++ stable/10/sys/dev/puc/puc_cfg.c Thu Sep 17 17:56:23 2015 (r287926) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: stable/10/sys/dev/puc/puc_pccard.c ============================================================================== --- stable/10/sys/dev/puc/puc_pccard.c Thu Sep 17 17:45:20 2015 (r287925) +++ stable/10/sys/dev/puc/puc_pccard.c Thu Sep 17 17:56:23 2015 (r287926) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: stable/10/sys/dev/puc/puc_pci.c ============================================================================== --- stable/10/sys/dev/puc/puc_pci.c Thu Sep 17 17:45:20 2015 (r287925) +++ stable/10/sys/dev/puc/puc_pci.c Thu Sep 17 17:56:23 2015 (r287926) @@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -78,6 +79,11 @@ __FBSDID("$FreeBSD$"); #include #include +static int puc_msi_disable; +TUNABLE_INT("hw.puc.msi_disable", &puc_msi_disable); +SYSCTL_INT(_hw_puc, OID_AUTO, msi_disable, CTLFLAG_RD | CTLFLAG_TUN, + &puc_msi_disable, 0, "Disable use of MSI interrupts by puc(9)"); + static const struct puc_cfg * puc_pci_match(device_t dev, const struct puc_cfg *desc) { @@ -120,11 +126,56 @@ puc_pci_probe(device_t dev) return (puc_bfe_probe(dev, desc)); } +static int +puc_pci_attach(device_t dev) +{ + struct puc_softc *sc; + int error, count; + + sc = device_get_softc(dev); + + if (!puc_msi_disable) { + count = 1; + + if (pci_alloc_msi(dev, &count) == 0) { + sc->sc_msi = 1; + sc->sc_irid = 1; + } + } + + error = puc_bfe_attach(dev); + + if (error != 0 && sc->sc_msi) + pci_release_msi(dev); + + return (error); +} + +static int +puc_pci_detach(device_t dev) +{ + struct puc_softc *sc; + int error; + + sc = device_get_softc(dev); + + error = puc_bfe_detach(dev); + + if (error != 0) + return (error); + + if (sc->sc_msi) + error = pci_release_msi(dev); + + return (error); +} + + static device_method_t puc_pci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, puc_pci_probe), - DEVMETHOD(device_attach, puc_bfe_attach), - DEVMETHOD(device_detach, puc_bfe_detach), + DEVMETHOD(device_attach, puc_pci_attach), + DEVMETHOD(device_detach, puc_pci_detach), DEVMETHOD(bus_alloc_resource, puc_bus_alloc_resource), DEVMETHOD(bus_release_resource, puc_bus_release_resource), Modified: stable/10/sys/dev/puc/pucdata.c ============================================================================== --- stable/10/sys/dev/puc/pucdata.c Thu Sep 17 17:45:20 2015 (r287925) +++ stable/10/sys/dev/puc/pucdata.c Thu Sep 17 17:56:23 2015 (r287926) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include From owner-svn-src-stable@freebsd.org Thu Sep 17 18:19:56 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D0FD9CEDBE; Thu, 17 Sep 2015 18:19:56 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1D2F512E4; Thu, 17 Sep 2015 18:19:56 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8HIJt2s030562; Thu, 17 Sep 2015 18:19:55 GMT (envelope-from rstone@FreeBSD.org) Received: (from rstone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8HIJtTI030561; Thu, 17 Sep 2015 18:19:55 GMT (envelope-from rstone@FreeBSD.org) Message-Id: <201509171819.t8HIJtTI030561@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rstone set sender to rstone@FreeBSD.org using -f From: Ryan Stone Date: Thu, 17 Sep 2015 18:19: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: r287928 - stable/10/sys/dev/watchdog X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2015 18:19:56 -0000 Author: rstone Date: Thu Sep 17 18:19:55 2015 New Revision: 287928 URL: https://svnweb.freebsd.org/changeset/base/287928 Log: MFC r279413: Add a missing include of an options header. watchdog.c does an #ifdef DDB but does not #include "opt_ddb.h". Fixing this turned up a missing include file. Modified: stable/10/sys/dev/watchdog/watchdog.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/watchdog/watchdog.c ============================================================================== --- stable/10/sys/dev/watchdog/watchdog.c Thu Sep 17 18:11:26 2015 (r287927) +++ stable/10/sys/dev/watchdog/watchdog.c Thu Sep 17 18:19:55 2015 (r287928) @@ -28,6 +28,8 @@ * */ +#include "opt_ddb.h" + #include __FBSDID("$FreeBSD$"); @@ -37,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include From owner-svn-src-stable@freebsd.org Thu Sep 17 18:21:48 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C19C69CEFDE; Thu, 17 Sep 2015 18:21:48 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AC43D17B9; Thu, 17 Sep 2015 18:21:48 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8HILmn8034334; Thu, 17 Sep 2015 18:21:48 GMT (envelope-from rstone@FreeBSD.org) Received: (from rstone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8HILm7n034330; Thu, 17 Sep 2015 18:21:48 GMT (envelope-from rstone@FreeBSD.org) Message-Id: <201509171821.t8HILm7n034330@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rstone set sender to rstone@FreeBSD.org using -f From: Ryan Stone Date: Thu, 17 Sep 2015 18:21:48 +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: r287929 - 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-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2015 18:21:48 -0000 Author: rstone Date: Thu Sep 17 18:21:47 2015 New Revision: 287929 URL: https://svnweb.freebsd.org/changeset/base/287929 Log: MFC r279410: Correct the use of an unitialized variable in sendfind_getobj() When sendfile_getobj() is called on a DTYPE_SHM file, it never initializes error, which is eventually returned to the caller. Modified: stable/10/sys/kern/uipc_syscalls.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/uipc_syscalls.c ============================================================================== --- stable/10/sys/kern/uipc_syscalls.c Thu Sep 17 18:19:55 2015 (r287928) +++ stable/10/sys/kern/uipc_syscalls.c Thu Sep 17 18:21:47 2015 (r287929) @@ -2114,6 +2114,7 @@ sendfile_getobj(struct thread *td, struc goto out; } } else if (fp->f_type == DTYPE_SHM) { + error = 0; shmfd = fp->f_data; obj = shmfd->shm_object; *obj_size = shmfd->shm_size; From owner-svn-src-stable@freebsd.org Thu Sep 17 23:31:49 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96FB89C2531; Thu, 17 Sep 2015 23:31:49 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 859A712A0; Thu, 17 Sep 2015 23:31:49 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8HNVnxs061509; Thu, 17 Sep 2015 23:31:49 GMT (envelope-from rstone@FreeBSD.org) Received: (from rstone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8HNVjhM061486; Thu, 17 Sep 2015 23:31:45 GMT (envelope-from rstone@FreeBSD.org) Message-Id: <201509172331.t8HNVjhM061486@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rstone set sender to rstone@FreeBSD.org using -f From: Ryan Stone Date: Thu, 17 Sep 2015 23:31: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: r287945 - in stable/10/sys: amd64/amd64 i386/i386 ia64/ia64 kern mips/mips powerpc/aim sparc64/sparc64 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-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2015 23:31:49 -0000 Author: rstone Date: Thu Sep 17 23:31:44 2015 New Revision: 287945 URL: https://svnweb.freebsd.org/changeset/base/287945 Log: MFC r280957 Fix integer truncation bug in malloc(9) A couple of internal functions used by malloc(9) and uma truncated a size_t down to an int. This could cause any number of issues (e.g. indefinite sleeps, memory corruption) if any kernel subsystem tried to allocate 2GB or more through malloc. zfs would attempt such an allocation when run on a system with 2TB or more of RAM. Modified: stable/10/sys/amd64/amd64/uma_machdep.c stable/10/sys/i386/i386/pmap.c stable/10/sys/ia64/ia64/uma_machdep.c stable/10/sys/kern/kern_mbuf.c stable/10/sys/kern/subr_busdma_bufalloc.c stable/10/sys/kern/subr_vmem.c stable/10/sys/mips/mips/uma_machdep.c stable/10/sys/powerpc/aim/mmu_oea64.c stable/10/sys/powerpc/aim/slb.c stable/10/sys/powerpc/aim/uma_machdep.c stable/10/sys/sparc64/sparc64/vm_machdep.c stable/10/sys/sys/busdma_bufalloc.h stable/10/sys/vm/uma.h stable/10/sys/vm/uma_core.c stable/10/sys/vm/uma_int.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/uma_machdep.c ============================================================================== --- stable/10/sys/amd64/amd64/uma_machdep.c Thu Sep 17 22:28:38 2015 (r287944) +++ stable/10/sys/amd64/amd64/uma_machdep.c Thu Sep 17 23:31:44 2015 (r287945) @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$"); #include void * -uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) +uma_small_alloc(uma_zone_t zone, vm_size_t bytes, u_int8_t *flags, int wait) { vm_page_t m; vm_paddr_t pa; @@ -70,7 +70,7 @@ uma_small_alloc(uma_zone_t zone, int byt } void -uma_small_free(void *mem, int size, u_int8_t flags) +uma_small_free(void *mem, vm_size_t size, u_int8_t flags) { vm_page_t m; vm_paddr_t pa; Modified: stable/10/sys/i386/i386/pmap.c ============================================================================== --- stable/10/sys/i386/i386/pmap.c Thu Sep 17 22:28:38 2015 (r287944) +++ stable/10/sys/i386/i386/pmap.c Thu Sep 17 23:31:44 2015 (r287945) @@ -352,7 +352,8 @@ static pt_entry_t *pmap_pte_quick(pmap_t static void pmap_pte_release(pt_entry_t *pte); static int pmap_unuse_pt(pmap_t, vm_offset_t, struct spglist *); #if defined(PAE) || defined(PAE_TABLES) -static void *pmap_pdpt_allocf(uma_zone_t zone, int bytes, u_int8_t *flags, int wait); +static void *pmap_pdpt_allocf(uma_zone_t zone, vm_size_t bytes, uint8_t *flags, + int wait); #endif static void pmap_set_pg(void); @@ -670,7 +671,7 @@ pmap_page_init(vm_page_t m) #if defined(PAE) || defined(PAE_TABLES) static void * -pmap_pdpt_allocf(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) +pmap_pdpt_allocf(uma_zone_t zone, vm_size_t bytes, uint8_t *flags, int wait) { /* Inform UMA that this allocator uses kernel_map/object. */ Modified: stable/10/sys/ia64/ia64/uma_machdep.c ============================================================================== --- stable/10/sys/ia64/ia64/uma_machdep.c Thu Sep 17 22:28:38 2015 (r287944) +++ stable/10/sys/ia64/ia64/uma_machdep.c Thu Sep 17 23:31:44 2015 (r287945) @@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$"); #include void * -uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) +uma_small_alloc(uma_zone_t zone, vm_size_t bytes, u_int8_t *flags, int wait) { void *va; vm_page_t m; @@ -66,7 +66,7 @@ uma_small_alloc(uma_zone_t zone, int byt } void -uma_small_free(void *mem, int size, u_int8_t flags) +uma_small_free(void *mem, vm_size_t size, u_int8_t flags) { vm_page_t m; Modified: stable/10/sys/kern/kern_mbuf.c ============================================================================== --- stable/10/sys/kern/kern_mbuf.c Thu Sep 17 22:28:38 2015 (r287944) +++ stable/10/sys/kern/kern_mbuf.c Thu Sep 17 23:31:44 2015 (r287945) @@ -284,7 +284,7 @@ static int mb_zinit_pack(void *, int, in static void mb_zfini_pack(void *, int); static void mb_reclaim(void *); -static void *mbuf_jumbo_alloc(uma_zone_t, int, uint8_t *, int); +static void *mbuf_jumbo_alloc(uma_zone_t, vm_size_t, uint8_t *, int); /* Ensure that MSIZE is a power of 2. */ CTASSERT((((MSIZE - 1) ^ MSIZE) + 1) >> 1 == MSIZE); @@ -389,7 +389,7 @@ SYSINIT(mbuf, SI_SUB_MBUF, SI_ORDER_FIRS * pages. */ static void * -mbuf_jumbo_alloc(uma_zone_t zone, int bytes, uint8_t *flags, int wait) +mbuf_jumbo_alloc(uma_zone_t zone, vm_size_t bytes, uint8_t *flags, int wait) { /* Inform UMA that this allocator uses kernel_map/object. */ Modified: stable/10/sys/kern/subr_busdma_bufalloc.c ============================================================================== --- stable/10/sys/kern/subr_busdma_bufalloc.c Thu Sep 17 22:28:38 2015 (r287944) +++ stable/10/sys/kern/subr_busdma_bufalloc.c Thu Sep 17 23:31:44 2015 (r287945) @@ -147,8 +147,8 @@ busdma_bufalloc_findzone(busdma_bufalloc } void * -busdma_bufalloc_alloc_uncacheable(uma_zone_t zone, int size, u_int8_t *pflag, - int wait) +busdma_bufalloc_alloc_uncacheable(uma_zone_t zone, vm_size_t size, + uint8_t *pflag, int wait) { #ifdef VM_MEMATTR_UNCACHEABLE @@ -166,7 +166,7 @@ busdma_bufalloc_alloc_uncacheable(uma_zo } void -busdma_bufalloc_free_uncacheable(void *item, int size, u_int8_t pflag) +busdma_bufalloc_free_uncacheable(void *item, vm_size_t size, uint8_t pflag) { kmem_free(kernel_arena, (vm_offset_t)item, size); Modified: stable/10/sys/kern/subr_vmem.c ============================================================================== --- stable/10/sys/kern/subr_vmem.c Thu Sep 17 22:28:38 2015 (r287944) +++ stable/10/sys/kern/subr_vmem.c Thu Sep 17 23:31:44 2015 (r287945) @@ -608,7 +608,7 @@ static struct mtx_padalign vmem_bt_lock; * we are really out of KVA. */ static void * -vmem_bt_alloc(uma_zone_t zone, int bytes, uint8_t *pflag, int wait) +vmem_bt_alloc(uma_zone_t zone, vm_size_t bytes, uint8_t *pflag, int wait) { vmem_addr_t addr; Modified: stable/10/sys/mips/mips/uma_machdep.c ============================================================================== --- stable/10/sys/mips/mips/uma_machdep.c Thu Sep 17 22:28:38 2015 (r287944) +++ stable/10/sys/mips/mips/uma_machdep.c Thu Sep 17 23:31:44 2015 (r287945) @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD$"); #include void * -uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) +uma_small_alloc(uma_zone_t zone, vm_size_t bytes, u_int8_t *flags, int wait) { vm_paddr_t pa; vm_page_t m; @@ -70,7 +70,7 @@ uma_small_alloc(uma_zone_t zone, int byt } void -uma_small_free(void *mem, int size, u_int8_t flags) +uma_small_free(void *mem, vm_size_t size, u_int8_t flags) { vm_page_t m; vm_paddr_t pa; Modified: stable/10/sys/powerpc/aim/mmu_oea64.c ============================================================================== --- stable/10/sys/powerpc/aim/mmu_oea64.c Thu Sep 17 22:28:38 2015 (r287944) +++ stable/10/sys/powerpc/aim/mmu_oea64.c Thu Sep 17 23:31:44 2015 (r287945) @@ -1432,7 +1432,8 @@ retry: static mmu_t installed_mmu; static void * -moea64_uma_page_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) +moea64_uma_page_alloc(uma_zone_t zone, vm_size_t bytes, uint8_t *flags, + int wait) { /* * This entire routine is a horrible hack to avoid bothering kmem Modified: stable/10/sys/powerpc/aim/slb.c ============================================================================== --- stable/10/sys/powerpc/aim/slb.c Thu Sep 17 22:28:38 2015 (r287944) +++ stable/10/sys/powerpc/aim/slb.c Thu Sep 17 23:31:44 2015 (r287945) @@ -473,7 +473,7 @@ slb_insert_user(pmap_t pm, struct slb *s } static void * -slb_uma_real_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) +slb_uma_real_alloc(uma_zone_t zone, vm_size_t bytes, u_int8_t *flags, int wait) { static vm_offset_t realmax = 0; void *va; Modified: stable/10/sys/powerpc/aim/uma_machdep.c ============================================================================== --- stable/10/sys/powerpc/aim/uma_machdep.c Thu Sep 17 22:28:38 2015 (r287944) +++ stable/10/sys/powerpc/aim/uma_machdep.c Thu Sep 17 23:31:44 2015 (r287945) @@ -50,7 +50,7 @@ SYSCTL_INT(_hw, OID_AUTO, uma_mdpages, C "UMA MD pages in use"); void * -uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) +uma_small_alloc(uma_zone_t zone, vm_size_t bytes, u_int8_t *flags, int wait) { void *va; vm_page_t m; @@ -82,7 +82,7 @@ uma_small_alloc(uma_zone_t zone, int byt } void -uma_small_free(void *mem, int size, u_int8_t flags) +uma_small_free(void *mem, vm_size_t size, u_int8_t flags) { vm_page_t m; Modified: stable/10/sys/sparc64/sparc64/vm_machdep.c ============================================================================== --- stable/10/sys/sparc64/sparc64/vm_machdep.c Thu Sep 17 22:28:38 2015 (r287944) +++ stable/10/sys/sparc64/sparc64/vm_machdep.c Thu Sep 17 23:31:44 2015 (r287945) @@ -502,7 +502,7 @@ swi_vm(void *v) } void * -uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) +uma_small_alloc(uma_zone_t zone, vm_size_t bytes, u_int8_t *flags, int wait) { vm_paddr_t pa; vm_page_t m; @@ -540,7 +540,7 @@ uma_small_alloc(uma_zone_t zone, int byt } void -uma_small_free(void *mem, int size, u_int8_t flags) +uma_small_free(void *mem, vm_size_t size, u_int8_t flags) { vm_page_t m; Modified: stable/10/sys/sys/busdma_bufalloc.h ============================================================================== --- stable/10/sys/sys/busdma_bufalloc.h Thu Sep 17 22:28:38 2015 (r287944) +++ stable/10/sys/sys/busdma_bufalloc.h Thu Sep 17 23:31:44 2015 (r287945) @@ -110,9 +110,10 @@ struct busdma_bufzone * busdma_bufalloc_ * routines support pmap_page_set_memattr() and the VM_MEMATTR_UNCACHEABLE flag * you can probably use these when you need uncacheable buffers. */ -void * busdma_bufalloc_alloc_uncacheable(uma_zone_t zone, int size, - u_int8_t *pflag, int wait); -void busdma_bufalloc_free_uncacheable(void *item, int size, u_int8_t pflag); +void * busdma_bufalloc_alloc_uncacheable(uma_zone_t zone, vm_size_t size, + uint8_t *pflag, int wait); +void busdma_bufalloc_free_uncacheable(void *item, vm_size_t size, + uint8_t pflag); #endif /* _MACHINE_BUSDMA_BUFALLOC_H_ */ Modified: stable/10/sys/vm/uma.h ============================================================================== --- stable/10/sys/vm/uma.h Thu Sep 17 22:28:38 2015 (r287944) +++ stable/10/sys/vm/uma.h Thu Sep 17 23:31:44 2015 (r287945) @@ -382,7 +382,8 @@ uma_zfree(uma_zone_t zone, void *item) * A pointer to the allocated memory or NULL on failure. */ -typedef void *(*uma_alloc)(uma_zone_t zone, int size, uint8_t *pflag, int wait); +typedef void *(*uma_alloc)(uma_zone_t zone, vm_size_t size, uint8_t *pflag, + int wait); /* * Backend page free routines @@ -395,7 +396,7 @@ typedef void *(*uma_alloc)(uma_zone_t zo * Returns: * None */ -typedef void (*uma_free)(void *item, int size, uint8_t pflag); +typedef void (*uma_free)(void *item, vm_size_t size, uint8_t pflag); Modified: stable/10/sys/vm/uma_core.c ============================================================================== --- stable/10/sys/vm/uma_core.c Thu Sep 17 22:28:38 2015 (r287944) +++ stable/10/sys/vm/uma_core.c Thu Sep 17 23:31:44 2015 (r287945) @@ -229,10 +229,10 @@ enum zfreeskip { SKIP_NONE = 0, SKIP_DTO /* Prototypes.. */ -static void *noobj_alloc(uma_zone_t, int, uint8_t *, int); -static void *page_alloc(uma_zone_t, int, uint8_t *, int); -static void *startup_alloc(uma_zone_t, int, uint8_t *, int); -static void page_free(void *, int, uint8_t); +static void *noobj_alloc(uma_zone_t, vm_size_t, uint8_t *, int); +static void *page_alloc(uma_zone_t, vm_size_t, uint8_t *, int); +static void *startup_alloc(uma_zone_t, vm_size_t, uint8_t *, int); +static void page_free(void *, vm_size_t, uint8_t); static uma_slab_t keg_alloc_slab(uma_keg_t, uma_zone_t, int); static void cache_drain(uma_zone_t); static void bucket_drain(uma_zone_t, uma_bucket_t); @@ -1038,7 +1038,7 @@ out: * the VM is ready. */ static void * -startup_alloc(uma_zone_t zone, int bytes, uint8_t *pflag, int wait) +startup_alloc(uma_zone_t zone, vm_size_t bytes, uint8_t *pflag, int wait) { uma_keg_t keg; uma_slab_t tmps; @@ -1098,7 +1098,7 @@ startup_alloc(uma_zone_t zone, int bytes * NULL if M_NOWAIT is set. */ static void * -page_alloc(uma_zone_t zone, int bytes, uint8_t *pflag, int wait) +page_alloc(uma_zone_t zone, vm_size_t bytes, uint8_t *pflag, int wait) { void *p; /* Returned page */ @@ -1120,7 +1120,7 @@ page_alloc(uma_zone_t zone, int bytes, u * NULL if M_NOWAIT is set. */ static void * -noobj_alloc(uma_zone_t zone, int bytes, uint8_t *flags, int wait) +noobj_alloc(uma_zone_t zone, vm_size_t bytes, uint8_t *flags, int wait) { TAILQ_HEAD(, vm_page) alloctail; u_long npages; @@ -1183,7 +1183,7 @@ noobj_alloc(uma_zone_t zone, int bytes, * Nothing */ static void -page_free(void *mem, int size, uint8_t flags) +page_free(void *mem, vm_size_t size, uint8_t flags) { struct vmem *vmem; @@ -3269,7 +3269,7 @@ uma_zone_exhausted_nolock(uma_zone_t zon } void * -uma_large_malloc(int size, int wait) +uma_large_malloc(vm_size_t size, int wait) { void *mem; uma_slab_t slab; Modified: stable/10/sys/vm/uma_int.h ============================================================================== --- stable/10/sys/vm/uma_int.h Thu Sep 17 22:28:38 2015 (r287944) +++ stable/10/sys/vm/uma_int.h Thu Sep 17 23:31:44 2015 (r287945) @@ -341,7 +341,7 @@ zone_first_keg(uma_zone_t zone) #ifdef _KERNEL /* Internal prototypes */ static __inline uma_slab_t hash_sfind(struct uma_hash *hash, uint8_t *data); -void *uma_large_malloc(int size, int wait); +void *uma_large_malloc(vm_size_t size, int wait); void uma_large_free(uma_slab_t slab); /* Lock Macros */ @@ -424,8 +424,9 @@ vsetslab(vm_offset_t va, uma_slab_t slab * if they can provide more effecient allocation functions. This is useful * for using direct mapped addresses. */ -void *uma_small_alloc(uma_zone_t zone, int bytes, uint8_t *pflag, int wait); -void uma_small_free(void *mem, int size, uint8_t flags); +void *uma_small_alloc(uma_zone_t zone, vm_size_t bytes, uint8_t *pflag, + int wait); +void uma_small_free(void *mem, vm_size_t size, uint8_t flags); #endif /* _KERNEL */ #endif /* VM_UMA_INT_H */ From owner-svn-src-stable@freebsd.org Fri Sep 18 17:29:25 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9A299CE0F2; Fri, 18 Sep 2015 17:29:25 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BD3BE1EB7; Fri, 18 Sep 2015 17:29:25 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8IHTPZo076884; Fri, 18 Sep 2015 17:29:25 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8IHTPa7076880; Fri, 18 Sep 2015 17:29:25 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201509181729.t8IHTPa7076880@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Fri, 18 Sep 2015 17:29:25 +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: r287963 - in stable/10: sbin/ipfw sys/netinet sys/netpfil/ipfw X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Sep 2015 17:29:26 -0000 Author: melifaro Date: Fri Sep 18 17:29:24 2015 New Revision: 287963 URL: https://svnweb.freebsd.org/changeset/base/287963 Log: MFC r266310 Fix wrong formatting of 0.0.0.0/X table records in ipfw(8). Add `flags` u16 field to the hole in ipfw_table_xentry structure. Kernel has been guessing address family for supplied record based on xent length size. Userland, however, has been getting fixed-size ipfw_table_xentry structures guessing address family by checking address by IN6_IS_ADDR_V4COMPAT(). Fix this behavior by providing specific IPFW_TCF_INET flag for IPv4 records. PR: bin/189471,kern/200169 Modified: stable/10/sbin/ipfw/ipfw2.c stable/10/sys/netinet/ip_fw.h stable/10/sys/netpfil/ipfw/ip_fw_table.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/ipfw/ipfw2.c ============================================================================== --- stable/10/sbin/ipfw/ipfw2.c Fri Sep 18 17:17:40 2015 (r287962) +++ stable/10/sbin/ipfw/ipfw2.c Fri Sep 18 17:29:24 2015 (r287963) @@ -4389,7 +4389,7 @@ table_list(uint16_t num, int need_header addr6 = &xent->k.addr6; - if (IN6_IS_ADDR_V4COMPAT(addr6)) { + if ((xent->flags & IPFW_TCF_INET) != 0) { /* IPv4 address */ inet_ntop(AF_INET, &addr6->s6_addr32[3], tbuf, sizeof(tbuf)); } else { Modified: stable/10/sys/netinet/ip_fw.h ============================================================================== --- stable/10/sys/netinet/ip_fw.h Fri Sep 18 17:17:40 2015 (r287962) +++ stable/10/sys/netinet/ip_fw.h Fri Sep 18 17:29:24 2015 (r287963) @@ -614,6 +614,7 @@ typedef struct _ipfw_table_xentry { uint8_t type; /* entry type */ uint8_t masklen; /* mask length */ uint16_t tbl; /* table number */ + uint16_t flags; /* record flags */ uint32_t value; /* value */ union { /* Longest field needs to be aligned by 4-byte boundary */ @@ -621,6 +622,7 @@ typedef struct _ipfw_table_xentry { char iface[IF_NAMESIZE]; /* interface name */ } k; } ipfw_table_xentry; +#define IPFW_TCF_INET 0x01 /* CIDR flags: IPv4 record */ typedef struct _ipfw_table { u_int32_t size; /* size of entries in bytes */ Modified: stable/10/sys/netpfil/ipfw/ip_fw_table.c ============================================================================== --- stable/10/sys/netpfil/ipfw/ip_fw_table.c Fri Sep 18 17:17:40 2015 (r287962) +++ stable/10/sys/netpfil/ipfw/ip_fw_table.c Fri Sep 18 17:29:24 2015 (r287963) @@ -697,6 +697,7 @@ dump_table_xentry_base(struct radix_node xent->masklen = 33 - ffs(ntohl(n->mask.sin_addr.s_addr)); /* Save IPv4 address as deprecated IPv6 compatible */ xent->k.addr6.s6_addr32[3] = n->addr.sin_addr.s_addr; + xent->flags = IPFW_TCF_INET; xent->value = n->value; tbl->cnt++; return (0); From owner-svn-src-stable@freebsd.org Sat Sep 19 03:58:32 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 91977A03B7B; Sat, 19 Sep 2015 03:58:32 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 817B41C28; Sat, 19 Sep 2015 03:58:32 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t8J3wWtd067794; Sat, 19 Sep 2015 03:58:32 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t8J3wW6Y067793; Sat, 19 Sep 2015 03:58:32 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201509190358.t8J3wW6Y067793@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 19 Sep 2015 03:58:32 +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: r287984 - stable/10/sys/contrib/ipfilter/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-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Sep 2015 03:58:32 -0000 Author: cy Date: Sat Sep 19 03:58:31 2015 New Revision: 287984 URL: https://svnweb.freebsd.org/changeset/base/287984 Log: MFC r287651, r287652, r287653. Fix mutex errors, fixup typos in comments. Obtained from: NetBSD r1.4. -This lie, anr those below, will be ignored-- > Description of fields to fill in above: 76 columns --| > PR: If a GNATS PR is affected by the change. > Submitted by: If someone else sent in the change. > Reviewed by: If someone else reviewed your modification. > Approved by: If you needed approval for this commit. > Obtained from: If the change is from a third party. > MFC after: N [day[s]|week[s]|month[s]]. Request a reminder email. > MFH: Ports tree branch name. Request approval for merge. > Relnotes: Set to 'yes' for mention in release notes. > Security: Vulnerability reference (one per line) or description. > Sponsored by: If the change was sponsored by an organization. > Differential Revision: https://reviews.freebsd.org/D### (*full* phabric URL needed). > Empty fields above will be automatically removed. _M . M sys/contrib/ipfilter/netinet/ip_state.c Modified: stable/10/sys/contrib/ipfilter/netinet/ip_state.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/contrib/ipfilter/netinet/ip_state.c ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/ip_state.c Sat Sep 19 03:53:37 2015 (r287983) +++ stable/10/sys/contrib/ipfilter/netinet/ip_state.c Sat Sep 19 03:58:31 2015 (r287984) @@ -1,4 +1,4 @@ -/* $FreeBSD$ */ +/* $FreeBSD$ */ /* * Copyright (C) 2012 by Darren Reed. @@ -1054,7 +1054,7 @@ ipf_state_putent(softc, softs, data) /* to pointers and adjusts running stats for the hash table as appropriate. */ /* */ /* This function can fail if the filter rule has had a population policy of */ -/* IP addresses used with stateful filteirng assigned to it. */ +/* IP addresses used with stateful filtering assigned to it. */ /* */ /* Locking: it is assumed that some kind of lock on ipf_state is held. */ /* Exits with is_lock initialised and held - *EVEN IF ERROR*. */ @@ -1081,7 +1081,7 @@ ipf_state_insert(softc, is, rev) } /* - * If we could trust is_hv, then the modulous would not be needed, + * If we could trust is_hv, then the modulus would not be needed, * but when running with IPFILTER_SYNC, this stops bad values. */ hv = is->is_hv % softs->ipf_state_size; @@ -1672,6 +1672,10 @@ ipf_state_add(softc, fin, stsave, flags) SBUMPD(ipf_state_stats, iss_bucket_full); return 4; } + + /* + * No existing state; create new + */ KMALLOC(is, ipstate_t *); if (is == NULL) { SBUMPD(ipf_state_stats, iss_nomem); @@ -1683,7 +1687,7 @@ ipf_state_add(softc, fin, stsave, flags) is->is_rule = fr; /* - * Do not do the modulous here, it is done in ipf_state_insert(). + * Do not do the modulus here, it is done in ipf_state_insert(). */ if (fr != NULL) { ipftq_t *tq; @@ -1711,7 +1715,7 @@ ipf_state_add(softc, fin, stsave, flags) /* * It may seem strange to set is_ref to 2, but if stsave is not NULL * then a copy of the pointer is being stored somewhere else and in - * the end, it will expect to be able to do osmething with it. + * the end, it will expect to be able to do something with it. */ is->is_me = stsave; if (stsave != NULL) { @@ -3652,7 +3656,6 @@ ipf_state_del(softc, is, why) softs->ipf_state_stats.iss_orphan++; return refs; } - MUTEX_EXIT(&is->is_lock); fr = is->is_rule; is->is_rule = NULL; @@ -3664,6 +3667,7 @@ ipf_state_del(softc, is, why) } is->is_ref = 0; + MUTEX_EXIT(&is->is_lock); if (is->is_tqehead[0] != NULL) { if (ipf_deletetimeoutqueue(is->is_tqehead[0]) == 0) From owner-svn-src-stable@freebsd.org Sat Sep 19 06:51:28 2015 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE175A05A70; Sat, 19 Sep 2015 06:51:28 +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 B1F9F1410; Sat, 19 Sep 2015 06:51:28 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id B03FB1FBF; Sat, 19 Sep 2015 06:51:28 +0000 (UTC) Date: Sat, 19 Sep 2015 06:51:28 +0000 From: Alexey Dokuchaev To: Cy Schubert Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r287984 - stable/10/sys/contrib/ipfilter/netinet Message-ID: <20150919065128.GA74689@FreeBSD.org> References: <201509190358.t8J3wW6Y067793@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201509190358.t8J3wW6Y067793@repo.freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Sep 2015 06:51:28 -0000 On Sat, Sep 19, 2015 at 03:58:32AM +0000, Cy Schubert wrote: > New Revision: 287984 > URL: https://svnweb.freebsd.org/changeset/base/287984 > > Log: > MFC r287651, r287652, r287653. > > Fix mutex errors, fixup typos in comments. > > Obtained from: NetBSD r1.4. > -This lie, anr those below, will be ignored-- > [ template remants trimmed ] Every time I see this happen I wonder shall we forbid to execute "svn ci" other than with -F or -m ? ./danfe