From owner-svn-src-releng@freebsd.org Mon Jul 3 04:25:29 2017 Return-Path: Delivered-To: svn-src-releng@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7922E9DD4F4; Mon, 3 Jul 2017 04:25:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4654B8100B; Mon, 3 Jul 2017 04:25:29 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v634PSKO087006; Mon, 3 Jul 2017 04:25:28 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v634PSuF087005; Mon, 3 Jul 2017 04:25:28 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201707030425.v634PSuF087005@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 3 Jul 2017 04:25:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r320584 - releng/11.1/lib/libc/rpc X-SVN-Group: releng X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: releng/11.1/lib/libc/rpc X-SVN-Commit-Revision: 320584 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jul 2017 04:25:29 -0000 Author: delphij Date: Mon Jul 3 04:25:28 2017 New Revision: 320584 URL: https://svnweb.freebsd.org/changeset/base/320584 Log: MFS r320581: MFC r320494: Fix double free by reverting r300385 and r300624 which was false positive reported by cppcheck. Approved by: re (kib) Modified: releng/11.1/lib/libc/rpc/getnetconfig.c Directory Properties: releng/11.1/ (props changed) Modified: releng/11.1/lib/libc/rpc/getnetconfig.c ============================================================================== --- releng/11.1/lib/libc/rpc/getnetconfig.c Mon Jul 3 02:18:10 2017 (r320583) +++ releng/11.1/lib/libc/rpc/getnetconfig.c Mon Jul 3 04:25:28 2017 (r320584) @@ -692,7 +692,7 @@ static struct netconfig * dup_ncp(struct netconfig *ncp) { struct netconfig *p; - char *tmp, *tmp2; + char *tmp; u_int i; if ((tmp=malloc(MAXNETCONFIGLINE)) == NULL) @@ -701,7 +701,6 @@ dup_ncp(struct netconfig *ncp) free(tmp); return(NULL); } - tmp2 = tmp; /* * First we dup all the data from matched netconfig buffer. Then we * adjust some of the member pointer to a pre-allocated buffer where @@ -723,7 +722,6 @@ dup_ncp(struct netconfig *ncp) if (p->nc_lookups == NULL) { free(p->nc_netid); free(p); - free(tmp2); return(NULL); } for (i=0; i < p->nc_nlookups; i++) { From owner-svn-src-releng@freebsd.org Mon Jul 3 05:04:45 2017 Return-Path: Delivered-To: svn-src-releng@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C84D09DE0E5; Mon, 3 Jul 2017 05:04:45 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 95F748221F; Mon, 3 Jul 2017 05:04:45 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6354icW003655; Mon, 3 Jul 2017 05:04:44 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6354iNs003654; Mon, 3 Jul 2017 05:04:44 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201707030504.v6354iNs003654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Mon, 3 Jul 2017 05:04:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r320585 - releng/11.1/sys/geom/part X-SVN-Group: releng X-SVN-Commit-Author: araujo X-SVN-Commit-Paths: releng/11.1/sys/geom/part X-SVN-Commit-Revision: 320585 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jul 2017 05:04:45 -0000 Author: araujo Date: Mon Jul 3 05:04:44 2017 New Revision: 320585 URL: https://svnweb.freebsd.org/changeset/base/320585 Log: MFS r320566: MFC r320390: With r318394 seems it breaks gpart(8) in some embedded systems such like PCEngines, RPI1-B, Alix and APU2 boards as well as NanoBSD with the following message: vnode_pager_generic_getpages_done: I/O read error 5 Seems the breakage was because it was missed to include acr in glabel update. Approved by: re (delphij) Modified: releng/11.1/sys/geom/part/g_part.c Directory Properties: releng/11.1/ (props changed) Modified: releng/11.1/sys/geom/part/g_part.c ============================================================================== --- releng/11.1/sys/geom/part/g_part.c Mon Jul 3 04:25:28 2017 (r320584) +++ releng/11.1/sys/geom/part/g_part.c Mon Jul 3 05:04:44 2017 (r320585) @@ -886,7 +886,8 @@ g_part_ctl_commit(struct gctl_req *req, struct g_part_ if (!entry->gpe_deleted) { /* Notify consumers that provider might be changed. */ if (entry->gpe_modified && ( - entry->gpe_pp->acw + entry->gpe_pp->ace) == 0) + entry->gpe_pp->acw + entry->gpe_pp->ace + + entry->gpe_pp->acr) == 0) g_media_changed(entry->gpe_pp, M_NOWAIT); entry->gpe_created = 0; entry->gpe_modified = 0; From owner-svn-src-releng@freebsd.org Mon Jul 3 05:42:56 2017 Return-Path: Delivered-To: svn-src-releng@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D8E29DE9F8; Mon, 3 Jul 2017 05:42:56 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4ABD1834D3; Mon, 3 Jul 2017 05:42:56 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v635gt0n020170; Mon, 3 Jul 2017 05:42:55 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v635gtJA020169; Mon, 3 Jul 2017 05:42:55 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201707030542.v635gtJA020169@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Mon, 3 Jul 2017 05:42:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r320588 - releng/11.1/usr.sbin/rpc.lockd X-SVN-Group: releng X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: releng/11.1/usr.sbin/rpc.lockd X-SVN-Commit-Revision: 320588 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jul 2017 05:42:56 -0000 Author: delphij Date: Mon Jul 3 05:42:55 2017 New Revision: 320588 URL: https://svnweb.freebsd.org/changeset/base/320588 Log: MFS r320586: MFC r320093: Check return value of seteuid() and bail out if we fail. Approved by: re (kib) Modified: releng/11.1/usr.sbin/rpc.lockd/lock_proc.c Directory Properties: releng/11.1/ (props changed) Modified: releng/11.1/usr.sbin/rpc.lockd/lock_proc.c ============================================================================== --- releng/11.1/usr.sbin/rpc.lockd/lock_proc.c Mon Jul 3 05:30:31 2017 (r320587) +++ releng/11.1/usr.sbin/rpc.lockd/lock_proc.c Mon Jul 3 05:42:55 2017 (r320588) @@ -276,7 +276,10 @@ get_client(struct sockaddr *host_addr, rpcvers_t vers) /* Regain root privileges, for bindresvport. */ old_euid = geteuid(); - seteuid(0); + if (seteuid(0) != 0) { + syslog(LOG_ERR, "seteuid(0) failed"); + return NULL; + } /* * Bind the client FD to a reserved port. @@ -285,7 +288,10 @@ get_client(struct sockaddr *host_addr, rpcvers_t vers) bindresvport(clnt_fd, NULL); /* Drop root privileges again. */ - seteuid(old_euid); + if (seteuid(old_euid) != 0) { + syslog(LOG_ERR, "seteuid(%d) failed", old_euid); + return NULL; + } /* Success - update the cache entry */ clnt_cache_ptr[clnt_cache_next_to_use] = client; From owner-svn-src-releng@freebsd.org Mon Jul 3 10:10:05 2017 Return-Path: Delivered-To: svn-src-releng@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3FF79E2E31; Mon, 3 Jul 2017 10:10:05 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 70D2365D98; Mon, 3 Jul 2017 10:10:05 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v63AA4o5028142; Mon, 3 Jul 2017 10:10:04 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v63AA48p028139; Mon, 3 Jul 2017 10:10:04 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201707031010.v63AA48p028139@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 3 Jul 2017 10:10:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r320594 - in releng/11.1/sys/netpfil/ipfw: nat64 nptv6 pmod X-SVN-Group: releng X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in releng/11.1/sys/netpfil/ipfw: nat64 nptv6 pmod X-SVN-Commit-Revision: 320594 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jul 2017 10:10:05 -0000 Author: ae Date: Mon Jul 3 10:10:04 2017 New Revision: 320594 URL: https://svnweb.freebsd.org/changeset/base/320594 Log: Merge from stable/11 r320593: Fix IPv6 extension header parsing. The length field doesn't include the first 8 octets. Obtained from: Yandex LLC Approved by: re (marius) Modified: releng/11.1/sys/netpfil/ipfw/nat64/nat64_translate.c releng/11.1/sys/netpfil/ipfw/nptv6/nptv6.c releng/11.1/sys/netpfil/ipfw/pmod/tcpmod.c Directory Properties: releng/11.1/ (props changed) Modified: releng/11.1/sys/netpfil/ipfw/nat64/nat64_translate.c ============================================================================== --- releng/11.1/sys/netpfil/ipfw/nat64/nat64_translate.c Mon Jul 3 08:53:22 2017 (r320593) +++ releng/11.1/sys/netpfil/ipfw/nat64/nat64_translate.c Mon Jul 3 10:10:04 2017 (r320594) @@ -1054,7 +1054,7 @@ nat64_getlasthdr(struct mbuf *m, int *offset) if (proto == IPPROTO_HOPOPTS && ip6->ip6_plen == 0) return (-1); proto = hbh->ip6h_nxt; - hlen += hbh->ip6h_len << 3; + hlen += (hbh->ip6h_len + 1) << 3; } if (offset != NULL) *offset = hlen; Modified: releng/11.1/sys/netpfil/ipfw/nptv6/nptv6.c ============================================================================== --- releng/11.1/sys/netpfil/ipfw/nptv6/nptv6.c Mon Jul 3 08:53:22 2017 (r320593) +++ releng/11.1/sys/netpfil/ipfw/nptv6/nptv6.c Mon Jul 3 10:10:04 2017 (r320594) @@ -125,7 +125,7 @@ nptv6_getlasthdr(struct nptv6_cfg *cfg, struct mbuf *m if (m->m_len < hlen) return (-1); proto = hbh->ip6h_nxt; - hlen += hbh->ip6h_len << 3; + hlen += (hbh->ip6h_len + 1) << 3; } if (offset != NULL) *offset = hlen; Modified: releng/11.1/sys/netpfil/ipfw/pmod/tcpmod.c ============================================================================== --- releng/11.1/sys/netpfil/ipfw/pmod/tcpmod.c Mon Jul 3 08:53:22 2017 (r320593) +++ releng/11.1/sys/netpfil/ipfw/pmod/tcpmod.c Mon Jul 3 10:10:04 2017 (r320594) @@ -137,7 +137,7 @@ tcpmod_ipv6_setmss(struct mbuf **mp, uint16_t mss) proto == IPPROTO_DSTOPTS) { hbh = mtodo(*mp, hlen); proto = hbh->ip6h_nxt; - hlen += hbh->ip6h_len << 3; + hlen += (hbh->ip6h_len + 1) << 3; } tcp = mtodo(*mp, hlen); plen = (*mp)->m_pkthdr.len - hlen; From owner-svn-src-releng@freebsd.org Mon Jul 3 13:47:00 2017 Return-Path: Delivered-To: svn-src-releng@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2E8F59E736B; Mon, 3 Jul 2017 13:47:00 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EFC4771131; Mon, 3 Jul 2017 13:46:59 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v63DkxgZ020287; Mon, 3 Jul 2017 13:46:59 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v63DkxlR020286; Mon, 3 Jul 2017 13:46:59 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201707031346.v63DkxlR020286@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 3 Jul 2017 13:46:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r320598 - releng/11.1/sys/sys X-SVN-Group: releng X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: releng/11.1/sys/sys X-SVN-Commit-Revision: 320598 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jul 2017 13:47:00 -0000 Author: gjb Date: Mon Jul 3 13:46:58 2017 New Revision: 320598 URL: https://svnweb.freebsd.org/changeset/base/320598 Log: MFS11 r320596: MFC r320488: Correct the branch naming convention in param.h. While here, consistently use upper-case 'X' to represent the version number. Approved by: re (kib, marius) Sponsored by: The FreeBSD Foundation Modified: releng/11.1/sys/sys/param.h Directory Properties: releng/11.1/ (props changed) Modified: releng/11.1/sys/sys/param.h ============================================================================== --- releng/11.1/sys/sys/param.h Mon Jul 3 13:41:05 2017 (r320597) +++ releng/11.1/sys/sys/param.h Mon Jul 3 13:46:58 2017 (r320598) @@ -54,7 +54,7 @@ * * scheme is: Rxx * 'R' is in the range 0 to 4 if this is a release branch or - * x.0-CURRENT before RELENG_*_0 is created, otherwise 'R' is + * X.0-CURRENT before releng/X.0 is created, otherwise 'R' is * in the range 5 to 9. */ #undef __FreeBSD_version From owner-svn-src-releng@freebsd.org Mon Jul 3 18:07:10 2017 Return-Path: Delivered-To: svn-src-releng@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E44189EC4F3; Mon, 3 Jul 2017 18:07:10 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B2C847A3A5; Mon, 3 Jul 2017 18:07:10 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v63I794B029343; Mon, 3 Jul 2017 18:07:09 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v63I79EP029342; Mon, 3 Jul 2017 18:07:09 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201707031807.v63I79EP029342@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Mon, 3 Jul 2017 18:07:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r320607 - releng/11.1/sys/cam/scsi X-SVN-Group: releng X-SVN-Commit-Author: ken X-SVN-Commit-Paths: releng/11.1/sys/cam/scsi X-SVN-Commit-Revision: 320607 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jul 2017 18:07:11 -0000 Author: ken Date: Mon Jul 3 18:07:09 2017 New Revision: 320607 URL: https://svnweb.freebsd.org/changeset/base/320607 Log: Merge r320600 from stable/11 into releng/11.1: ------------------------------------------------------------------------ r320600 | ken | 2017-07-03 09:10:16 -0600 (Mon, 03 Jul 2017) | 30 lines MFC r320420: ------------------------------------------------------------------------ r320420 | ken | 2017-06-27 11:55:25 -0600 (Tue, 27 Jun 2017) | 25 lines In scsi_zbc_in(), fill in the length in the ZBC IN CDB. Without the allocation length set, the target will either reject the command or complete it without transferring any data. This fixes the REPORT ZONES command for SCSI ZBC protocol devices, as well as ATA ZAC protocol devices that are behind a SCSI to ATA translation layer. (LSI/Broadcom's 12Gb SAS adapters translate ZBC commands to ZAC commands.) Those are Host Aware and Host Managed SMR drives. This will fix REPORT ZONE commands sent to the da(4) driver via the GEOM bio interface and zonectl, and REPORT ZONE commands sent from camcontrol(8). Note that in the case of camcontrol(8), we currently only send SCSI ZBC commands to native SCSI protocol devices, not ATA devices behind a SAT layer. sys/cam/scsi/scsi_da.c: Fill in the length field in scsi_zbc_in(). Sponsored by: Spectra Logic ------------------------------------------------------------------------ ------------------------------------------------------------------------ Approved by: re (gjb) Modified: releng/11.1/sys/cam/scsi/scsi_da.c Directory Properties: releng/11.1/ (props changed) Modified: releng/11.1/sys/cam/scsi/scsi_da.c ============================================================================== --- releng/11.1/sys/cam/scsi/scsi_da.c Mon Jul 3 18:01:58 2017 (r320606) +++ releng/11.1/sys/cam/scsi/scsi_da.c Mon Jul 3 18:07:09 2017 (r320607) @@ -5748,6 +5748,7 @@ scsi_zbc_in(struct ccb_scsiio *csio, uint32_t retries, scsi_cmd = (struct scsi_zbc_in *)&csio->cdb_io.cdb_bytes; scsi_cmd->opcode = ZBC_IN; scsi_cmd->service_action = service_action; + scsi_ulto4b(dxfer_len, scsi_cmd->length); scsi_u64to8b(zone_start_lba, scsi_cmd->zone_start_lba); scsi_cmd->zone_options = zone_options; From owner-svn-src-releng@freebsd.org Mon Jul 3 18:20:46 2017 Return-Path: Delivered-To: svn-src-releng@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 273219EC96E; Mon, 3 Jul 2017 18:20:46 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 03C837ABFD; Mon, 3 Jul 2017 18:20:45 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v63IKjq0033756; Mon, 3 Jul 2017 18:20:45 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v63IKjiH033755; Mon, 3 Jul 2017 18:20:45 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201707031820.v63IKjiH033755@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Mon, 3 Jul 2017 18:20:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r320608 - releng/11.1/sys/cam X-SVN-Group: releng X-SVN-Commit-Author: ken X-SVN-Commit-Paths: releng/11.1/sys/cam X-SVN-Commit-Revision: 320608 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Jul 2017 18:20:46 -0000 Author: ken Date: Mon Jul 3 18:20:45 2017 New Revision: 320608 URL: https://svnweb.freebsd.org/changeset/base/320608 Log: Merge r320602 from stable/11 into releng/11.1: ------------------------------------------------------------------------ r320602 | ken | 2017-07-03 09:34:21 -0600 (Mon, 03 Jul 2017) | 45 lines MFC r320421: ------------------------------------------------------------------------ r320421 | ken | 2017-06-27 13:26:02 -0600 (Tue, 27 Jun 2017) | 37 lines Fix a panic in camperiphfree(). If a peripheral driver (e.g. da, sa, cd) is added or removed from the peripheral driver list while an unrelated peripheral driver instance (e.g. da0, sa5, cd2) is going away and is inside camperiphfree(), we could dereference an invalid pointer. When peripheral drivers are added or removed (see periphdriver_register() and periphdriver_unregister()), the peripheral driver array is resized and existing entries are moved. Although we hold the topology lock while we traverse the peripheral driver list, we retain a pointer to the location of the peripheral driver pointer and then drop the topology lock. So we are still vulnerable to the list getting moved around while the lock is dropped. To solve the problem, cache a copy of the peripheral driver pointer. If its storage location in the list changes while we have the lock dropped, it won't have any effect. This doesn't solve the issue that peripheral drivers ("da", "cd", as opposed to individual instances like "da0", "cd0") are not generally part of a reference counting scheme to guard against deregistering them while there are instances active. The caller (generally the person unloading a module) has to be aware of active drivers and not unload something that is in use. sys/cam/cam_periph.c: In camperiphfree(), cache a pointer to the peripheral driver instance to avoid holding a pointer to an invalid memory location in the event that the peripheral driver list changes while we have the topology lock dropped. PR: kern/219701 Submitted by: avg Sponsored by: Spectra Logic ------------------------------------------------------------------------ ------------------------------------------------------------------------ Approved by: re (gjb) Modified: releng/11.1/sys/cam/cam_periph.c Directory Properties: releng/11.1/ (props changed) Modified: releng/11.1/sys/cam/cam_periph.c ============================================================================== --- releng/11.1/sys/cam/cam_periph.c Mon Jul 3 18:07:09 2017 (r320607) +++ releng/11.1/sys/cam/cam_periph.c Mon Jul 3 18:20:45 2017 (r320608) @@ -654,6 +654,7 @@ static void camperiphfree(struct cam_periph *periph) { struct periph_driver **p_drv; + struct periph_driver *drv; cam_periph_assert(periph, MA_OWNED); KASSERT(periph->periph_allocating == 0, ("%s%d: freed while allocating", @@ -666,6 +667,15 @@ camperiphfree(struct cam_periph *periph) printf("camperiphfree: attempt to free non-existant periph\n"); return; } + /* + * Cache a pointer to the periph_driver structure. If a + * periph_driver is added or removed from the array (see + * periphdriver_register()) while we drop the toplogy lock + * below, p_drv may change. This doesn't protect against this + * particular periph_driver going away. That will require full + * reference counting in the periph_driver infrastructure. + */ + drv = *p_drv; /* * We need to set this flag before dropping the topology lock, to @@ -701,8 +711,8 @@ camperiphfree(struct cam_periph *periph) */ xpt_lock_buses(); - TAILQ_REMOVE(&(*p_drv)->units, periph, unit_links); - (*p_drv)->generation++; + TAILQ_REMOVE(&drv->units, periph, unit_links); + drv->generation++; xpt_remove_periph(periph); From owner-svn-src-releng@freebsd.org Tue Jul 4 05:38:00 2017 Return-Path: Delivered-To: svn-src-releng@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 10BC99F7884; Tue, 4 Jul 2017 05:38:00 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CEDB96AFDB; Tue, 4 Jul 2017 05:37:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v645bw2j020409; Tue, 4 Jul 2017 05:37:58 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v645bwUK020408; Tue, 4 Jul 2017 05:37:58 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707040537.v645bwUK020408@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 4 Jul 2017 05:37:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r320639 - releng/11.1/sys/kern X-SVN-Group: releng X-SVN-Commit-Author: kib X-SVN-Commit-Paths: releng/11.1/sys/kern X-SVN-Commit-Revision: 320639 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jul 2017 05:38:00 -0000 Author: kib Date: Tue Jul 4 05:37:58 2017 New Revision: 320639 URL: https://svnweb.freebsd.org/changeset/base/320639 Log: MFC r320422: Do not ignore an error from vm_mmap_object(). Approved by: re (delphij) Modified: releng/11.1/sys/kern/uipc_shm.c Directory Properties: releng/11.1/ (props changed) Modified: releng/11.1/sys/kern/uipc_shm.c ============================================================================== --- releng/11.1/sys/kern/uipc_shm.c Tue Jul 4 04:53:21 2017 (r320638) +++ releng/11.1/sys/kern/uipc_shm.c Tue Jul 4 05:37:58 2017 (r320639) @@ -906,7 +906,7 @@ shm_mmap(struct file *fp, vm_map_t map, vm_offset_t *a shmfd->shm_object, foff, FALSE, td); if (error != 0) vm_object_deallocate(shmfd->shm_object); - return (0); + return (error); } static int From owner-svn-src-releng@freebsd.org Tue Jul 4 18:36:04 2017 Return-Path: Delivered-To: svn-src-releng@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15545D97FE5; Tue, 4 Jul 2017 18:36:04 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E3DB183FED; Tue, 4 Jul 2017 18:36:03 +0000 (UTC) (envelope-from allanjude@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v64Ia2Ai048731; Tue, 4 Jul 2017 18:36:02 GMT (envelope-from allanjude@FreeBSD.org) Received: (from allanjude@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v64Ia2ru048722; Tue, 4 Jul 2017 18:36:02 GMT (envelope-from allanjude@FreeBSD.org) Message-Id: <201707041836.v64Ia2ru048722@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: allanjude set sender to allanjude@FreeBSD.org using -f From: Allan Jude Date: Tue, 4 Jul 2017 18:36:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r320654 - in releng/11.1: bin/rcp libexec/rlogind libexec/rshd usr.bin/rlogin usr.bin/rsh usr.bin/ruptime usr.bin/rwho usr.sbin/rwhod X-SVN-Group: releng X-SVN-Commit-Author: allanjude X-SVN-Commit-Paths: in releng/11.1: bin/rcp libexec/rlogind libexec/rshd usr.bin/rlogin usr.bin/rsh usr.bin/ruptime usr.bin/rwho usr.sbin/rwhod X-SVN-Commit-Revision: 320654 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Jul 2017 18:36:04 -0000 Author: allanjude Date: Tue Jul 4 18:36:02 2017 New Revision: 320654 URL: https://svnweb.freebsd.org/changeset/base/320654 Log: Merge r320645 from stable/11 into releng/11.1: Add deprecation notices for all rcmd tools Approved by: re (gjb) Relnotes: yes Modified: releng/11.1/bin/rcp/rcp.1 releng/11.1/libexec/rlogind/rlogind.8 releng/11.1/libexec/rshd/rshd.8 releng/11.1/usr.bin/rlogin/rlogin.1 releng/11.1/usr.bin/rsh/rsh.1 releng/11.1/usr.bin/ruptime/ruptime.1 releng/11.1/usr.bin/rwho/rwho.1 releng/11.1/usr.sbin/rwhod/rwhod.8 Directory Properties: releng/11.1/ (props changed) Modified: releng/11.1/bin/rcp/rcp.1 ============================================================================== --- releng/11.1/bin/rcp/rcp.1 Tue Jul 4 18:24:50 2017 (r320653) +++ releng/11.1/bin/rcp/rcp.1 Tue Jul 4 18:36:02 2017 (r320654) @@ -29,7 +29,7 @@ .\" @(#)rcp.1 8.1 (Berkeley) 5/31/93 .\" $FreeBSD$ .\" -.Dd October 16, 2002 +.Dd July 3, 2017 .Dt RCP 1 .Os .Sh NAME @@ -43,6 +43,15 @@ .Op Fl 46pr .Ar .Ar directory +.Sh DEPRECATION NOTICE +.Nm +is deprecated and will be removed from future versions of the +.Fx +base system. +If +.Nm +is still required, it can be installed from ports or packages +(net/bsdrcmds). .Sh DESCRIPTION The .Nm Modified: releng/11.1/libexec/rlogind/rlogind.8 ============================================================================== --- releng/11.1/libexec/rlogind/rlogind.8 Tue Jul 4 18:24:50 2017 (r320653) +++ releng/11.1/libexec/rlogind/rlogind.8 Tue Jul 4 18:36:02 2017 (r320654) @@ -28,7 +28,7 @@ .\" @(#)rlogind.8 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd February 9, 2005 +.Dd July 3, 2017 .Dt RLOGIND 8 .Os .Sh NAME @@ -37,6 +37,15 @@ .Sh SYNOPSIS .Nm .Op Fl Daln +.Sh DEPRECATION NOTICE +.Nm +is deprecated and will be removed from future versions of the +.Fx +base system. +If +.Nm +is still required, it can be installed from ports or packages +(net/bsdrcmds). .Sh DESCRIPTION The .Nm Modified: releng/11.1/libexec/rshd/rshd.8 ============================================================================== --- releng/11.1/libexec/rshd/rshd.8 Tue Jul 4 18:24:50 2017 (r320653) +++ releng/11.1/libexec/rshd/rshd.8 Tue Jul 4 18:36:02 2017 (r320654) @@ -28,7 +28,7 @@ .\" @(#)rshd.8 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd June 4, 1993 +.Dd July 3, 2017 .Dt RSHD 8 .Os .Sh NAME @@ -37,6 +37,15 @@ .Sh SYNOPSIS .Nm .Op Fl aDLln +.Sh DEPRECATION NOTICE +.Nm +is deprecated and will be removed from future versions of the +.Fx +base system. +If +.Nm +is still required, it can be installed from ports or packages +(net/bsdrcmds). .Sh DESCRIPTION The .Nm Modified: releng/11.1/usr.bin/rlogin/rlogin.1 ============================================================================== --- releng/11.1/usr.bin/rlogin/rlogin.1 Tue Jul 4 18:24:50 2017 (r320653) +++ releng/11.1/usr.bin/rlogin/rlogin.1 Tue Jul 4 18:36:02 2017 (r320654) @@ -28,7 +28,7 @@ .\" @(#)rlogin.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd September 26, 2003 +.Dd July 3, 2017 .Dt RLOGIN 1 .Os .Sh NAME @@ -41,6 +41,15 @@ .Op Fl i Ar localname .Op Fl l Ar username .Ar host +.Sh DEPRECATION NOTICE +.Nm +is deprecated and will be removed from future versions of the +.Fx +base system. +If +.Nm +is still required, it can be installed from ports or packages +(net/bsdrcmds). .Sh DESCRIPTION The .Nm Modified: releng/11.1/usr.bin/rsh/rsh.1 ============================================================================== --- releng/11.1/usr.bin/rsh/rsh.1 Tue Jul 4 18:24:50 2017 (r320653) +++ releng/11.1/usr.bin/rsh/rsh.1 Tue Jul 4 18:36:02 2017 (r320654) @@ -28,7 +28,7 @@ .\" @(#)rsh.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd October 16, 2002 +.Dd July 3, 2017 .Dt RSH 1 .Os .Sh NAME @@ -41,6 +41,15 @@ .Op Fl t Ar timeout .Ar host .Op command +.Sh DEPRECATION NOTICE +.Nm +is deprecated and will be removed from future versions of the +.Fx +base system. +If +.Nm +is still required, it can be installed from ports or packages +(net/bsdrcmds). .Sh DESCRIPTION The .Nm Modified: releng/11.1/usr.bin/ruptime/ruptime.1 ============================================================================== --- releng/11.1/usr.bin/ruptime/ruptime.1 Tue Jul 4 18:24:50 2017 (r320653) +++ releng/11.1/usr.bin/ruptime/ruptime.1 Tue Jul 4 18:36:02 2017 (r320654) @@ -28,7 +28,7 @@ .\" @(#)ruptime.1 8.2 (Berkeley) 4/5/94 .\" $FreeBSD$ .\" -.Dd March 1, 2003 +.Dd July 3, 2017 .Dt RUPTIME 1 .Os .Sh NAME @@ -38,6 +38,15 @@ .Nm .Op Fl alrtu .Op Ar host ... +.Sh DEPRECATION NOTICE +.Nm +is deprecated and will be removed from future versions of the +.Fx +base system. +If +.Nm +is still required, it can be installed from ports or packages +(net/bsdrcmds). .Sh DESCRIPTION The .Nm Modified: releng/11.1/usr.bin/rwho/rwho.1 ============================================================================== --- releng/11.1/usr.bin/rwho/rwho.1 Tue Jul 4 18:24:50 2017 (r320653) +++ releng/11.1/usr.bin/rwho/rwho.1 Tue Jul 4 18:36:02 2017 (r320654) @@ -28,7 +28,7 @@ .\" @(#)rwho.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd June 6, 1993 +.Dd July 3, 2017 .Dt RWHO 1 .Os .Sh NAME @@ -37,6 +37,15 @@ .Sh SYNOPSIS .Nm .Op Fl a +.Sh DEPRECATION NOTICE +.Nm +is deprecated and will be removed from future versions of the +.Fx +base system. +If +.Nm +is still required, it can be installed from ports or packages +(net/bsdrcmds). .Sh DESCRIPTION The .Nm Modified: releng/11.1/usr.sbin/rwhod/rwhod.8 ============================================================================== --- releng/11.1/usr.sbin/rwhod/rwhod.8 Tue Jul 4 18:24:50 2017 (r320653) +++ releng/11.1/usr.sbin/rwhod/rwhod.8 Tue Jul 4 18:36:02 2017 (r320654) @@ -28,7 +28,7 @@ .\" @(#)rwhod.8 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd January 21, 2010 +.Dd July 3, 2017 .Dt RWHOD 8 .Os .Sh NAME @@ -40,6 +40,15 @@ .Op Fl p .Op Fl l .Op Fl m Op Ar ttl +.Sh DEPRECATION NOTICE +.Nm +is deprecated and will be removed from future versions of the +.Fx +base system. +If +.Nm +is still required, it can be installed from ports or packages +(net/bsdrcmds). .Sh DESCRIPTION The .Nm From owner-svn-src-releng@freebsd.org Wed Jul 5 17:06:31 2017 Return-Path: Delivered-To: svn-src-releng@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17F75D8AF6D; Wed, 5 Jul 2017 17:06:31 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D596B3E8C; Wed, 5 Jul 2017 17:06:30 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v65H6THu005988; Wed, 5 Jul 2017 17:06:29 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v65H6T0L005987; Wed, 5 Jul 2017 17:06:29 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201707051706.v65H6T0L005987@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 5 Jul 2017 17:06:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r320687 - releng/11.1/release/doc/en_US.ISO8859-1/relnotes X-SVN-Group: releng X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: releng/11.1/release/doc/en_US.ISO8859-1/relnotes X-SVN-Commit-Revision: 320687 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jul 2017 17:06:31 -0000 Author: gjb Date: Wed Jul 5 17:06:29 2017 New Revision: 320687 URL: https://svnweb.freebsd.org/changeset/base/320687 Log: Document r320654, rcmd deprecation. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: releng/11.1/release/doc/en_US.ISO8859-1/relnotes/article.xml Modified: releng/11.1/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- releng/11.1/release/doc/en_US.ISO8859-1/relnotes/article.xml Wed Jul 5 16:55:45 2017 (r320686) +++ releng/11.1/release/doc/en_US.ISO8859-1/relnotes/article.xml Wed Jul 5 17:06:29 2017 (r320687) @@ -252,6 +252,12 @@ enumerates primes beyond 3825123056546413050, up to a new limit of 2^64 - 1. + + The &man.rcp.1;, &man.rlogin.1;, + &man.rsh.1;, &man.ruptime.1;, &man.rwho.1;, &man.rlogind.8;, + &man.rshd.8;, and &man.rwhod.8; utilities have been marked as + deprecated, and planned for removal in + &os; 12.0-RELEASE. From owner-svn-src-releng@freebsd.org Wed Jul 5 17:29:08 2017 Return-Path: Delivered-To: svn-src-releng@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D897D8B9D2; Wed, 5 Jul 2017 17:29:08 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A9A364D2C; Wed, 5 Jul 2017 17:29:08 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v65HT7aZ014397; Wed, 5 Jul 2017 17:29:07 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v65HT7XF014396; Wed, 5 Jul 2017 17:29:07 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707051729.v65HT7XF014396@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 5 Jul 2017 17:29:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r320689 - releng/11.1/sys/fs/fuse X-SVN-Group: releng X-SVN-Commit-Author: markj X-SVN-Commit-Paths: releng/11.1/sys/fs/fuse X-SVN-Commit-Revision: 320689 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jul 2017 17:29:08 -0000 Author: markj Date: Wed Jul 5 17:29:07 2017 New Revision: 320689 URL: https://svnweb.freebsd.org/changeset/base/320689 Log: MFS r320684: MFC r320451 (by cem): Complete support for the IO_APPEND flag in fuse. Approved by: re (gjb) Modified: releng/11.1/sys/fs/fuse/fuse_io.c Directory Properties: releng/11.1/ (props changed) Modified: releng/11.1/sys/fs/fuse/fuse_io.c ============================================================================== --- releng/11.1/sys/fs/fuse/fuse_io.c Wed Jul 5 17:27:03 2017 (r320688) +++ releng/11.1/sys/fs/fuse/fuse_io.c Wed Jul 5 17:29:07 2017 (r320689) @@ -108,7 +108,7 @@ fuse_read_biobackend(struct vnode *vp, struct uio *uio struct ucred *cred, struct fuse_filehandle *fufh); static int fuse_write_directbackend(struct vnode *vp, struct uio *uio, - struct ucred *cred, struct fuse_filehandle *fufh); + struct ucred *cred, struct fuse_filehandle *fufh, int ioflag); static int fuse_write_biobackend(struct vnode *vp, struct uio *uio, struct ucred *cred, struct fuse_filehandle *fufh, int ioflag); @@ -156,7 +156,7 @@ fuse_io_dispatch(struct vnode *vp, struct uio *uio, in if (directio) { FS_DEBUG("direct write of vnode %ju via file handle %ju\n", (uintmax_t)VTOILLU(vp), (uintmax_t)fufh->fh_id); - err = fuse_write_directbackend(vp, uio, cred, fufh); + err = fuse_write_directbackend(vp, uio, cred, fufh, ioflag); } else { FS_DEBUG("buffered write of vnode %ju\n", (uintmax_t)VTOILLU(vp)); @@ -318,7 +318,7 @@ out: static int fuse_write_directbackend(struct vnode *vp, struct uio *uio, - struct ucred *cred, struct fuse_filehandle *fufh) + struct ucred *cred, struct fuse_filehandle *fufh, int ioflag) { struct fuse_vnode_data *fvdat = VTOFUD(vp); struct fuse_write_in *fwi; @@ -327,8 +327,10 @@ fuse_write_directbackend(struct vnode *vp, struct uio int diff; int err = 0; - if (!uio->uio_resid) + if (uio->uio_resid == 0) return (0); + if (ioflag & IO_APPEND) + uio_setoffset(uio, fvdat->filesize); fdisp_init(&fdi, 0); @@ -705,7 +707,7 @@ fuse_io_strategy(struct vnode *vp, struct buf *bp) io.iov_base = (char *)bp->b_data + bp->b_dirtyoff; uiop->uio_rw = UIO_WRITE; - error = fuse_write_directbackend(vp, uiop, cred, fufh); + error = fuse_write_directbackend(vp, uiop, cred, fufh, 0); if (error == EINTR || error == ETIMEDOUT || (!error && (bp->b_flags & B_NEEDCOMMIT))) { From owner-svn-src-releng@freebsd.org Wed Jul 5 19:24:57 2017 Return-Path: Delivered-To: svn-src-releng@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38431D8F0B0; Wed, 5 Jul 2017 19:24:57 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CECCA68774; Wed, 5 Jul 2017 19:24:55 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v65JOsQR063795; Wed, 5 Jul 2017 19:24:54 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v65JOrW5063787; Wed, 5 Jul 2017 19:24:53 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707051924.v65JOrW5063787@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 5 Jul 2017 19:24:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r320693 - in releng/11.1/sys: cddl/compat/opensolaris/sys compat/linprocfs fs/tmpfs sys vm X-SVN-Group: releng X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in releng/11.1/sys: cddl/compat/opensolaris/sys compat/linprocfs fs/tmpfs sys vm X-SVN-Commit-Revision: 320693 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Jul 2017 19:24:57 -0000 Author: markj Date: Wed Jul 5 19:24:53 2017 New Revision: 320693 URL: https://svnweb.freebsd.org/changeset/base/320693 Log: MFS r320605, r320610: MFC r303052, r309017 (by alc): Omit v_cache_count when computing the number of free pages, since its value is always 0. Approved by: re (gjb, kib) Modified: releng/11.1/sys/cddl/compat/opensolaris/sys/kmem.h releng/11.1/sys/compat/linprocfs/linprocfs.c releng/11.1/sys/fs/tmpfs/tmpfs_subr.c releng/11.1/sys/sys/vmmeter.h releng/11.1/sys/vm/swap_pager.c releng/11.1/sys/vm/vm_meter.c releng/11.1/sys/vm/vm_page.c releng/11.1/sys/vm/vm_pageout.c releng/11.1/sys/vm/vnode_pager.c Directory Properties: releng/11.1/ (props changed) Modified: releng/11.1/sys/cddl/compat/opensolaris/sys/kmem.h ============================================================================== --- releng/11.1/sys/cddl/compat/opensolaris/sys/kmem.h Wed Jul 5 19:24:38 2017 (r320692) +++ releng/11.1/sys/cddl/compat/opensolaris/sys/kmem.h Wed Jul 5 19:24:53 2017 (r320693) @@ -77,7 +77,7 @@ void kmem_reap(void); int kmem_debugging(void); void *calloc(size_t n, size_t s); -#define freemem (vm_cnt.v_free_count + vm_cnt.v_cache_count) +#define freemem vm_cnt.v_free_count #define minfree vm_cnt.v_free_min #define heap_arena kmem_arena #define kmem_alloc(size, kmflags) zfs_kmem_alloc((size), (kmflags)) Modified: releng/11.1/sys/compat/linprocfs/linprocfs.c ============================================================================== --- releng/11.1/sys/compat/linprocfs/linprocfs.c Wed Jul 5 19:24:38 2017 (r320692) +++ releng/11.1/sys/compat/linprocfs/linprocfs.c Wed Jul 5 19:24:53 2017 (r320693) @@ -176,7 +176,7 @@ linprocfs_domeminfo(PFS_FILL_ARGS) * like unstaticizing it just for linprocfs's sake. */ buffers = 0; - cached = vm_cnt.v_cache_count * PAGE_SIZE; + cached = vm_cnt.v_inactive_count * PAGE_SIZE; sbuf_printf(sb, "MemTotal: %9lu kB\n" Modified: releng/11.1/sys/fs/tmpfs/tmpfs_subr.c ============================================================================== --- releng/11.1/sys/fs/tmpfs/tmpfs_subr.c Wed Jul 5 19:24:38 2017 (r320692) +++ releng/11.1/sys/fs/tmpfs/tmpfs_subr.c Wed Jul 5 19:24:53 2017 (r320693) @@ -100,8 +100,7 @@ tmpfs_mem_avail(void) { vm_ooffset_t avail; - avail = swap_pager_avail + vm_cnt.v_free_count + vm_cnt.v_cache_count - - tmpfs_pages_reserved; + avail = swap_pager_avail + vm_cnt.v_free_count - tmpfs_pages_reserved; if (__predict_false(avail < 0)) avail = 0; return (avail); Modified: releng/11.1/sys/sys/vmmeter.h ============================================================================== --- releng/11.1/sys/sys/vmmeter.h Wed Jul 5 19:24:38 2017 (r320692) +++ releng/11.1/sys/sys/vmmeter.h Wed Jul 5 19:24:53 2017 (r320693) @@ -118,7 +118,7 @@ struct vmmeter { extern struct vmmeter vm_cnt; -extern int vm_pageout_wakeup_thresh; +extern u_int vm_pageout_wakeup_thresh; /* * Return TRUE if we are under our severe low-free-pages threshold @@ -130,8 +130,7 @@ static inline int vm_page_count_severe(void) { - return (vm_cnt.v_free_severe > vm_cnt.v_free_count + - vm_cnt.v_cache_count); + return (vm_cnt.v_free_severe > vm_cnt.v_free_count); } /* @@ -147,7 +146,7 @@ static inline int vm_page_count_min(void) { - return (vm_cnt.v_free_min > vm_cnt.v_free_count + vm_cnt.v_cache_count); + return (vm_cnt.v_free_min > vm_cnt.v_free_count); } /* @@ -158,8 +157,7 @@ static inline int vm_page_count_target(void) { - return (vm_cnt.v_free_target > vm_cnt.v_free_count + - vm_cnt.v_cache_count); + return (vm_cnt.v_free_target > vm_cnt.v_free_count); } /* @@ -170,8 +168,7 @@ static inline int vm_paging_target(void) { - return (vm_cnt.v_free_target - (vm_cnt.v_free_count + - vm_cnt.v_cache_count)); + return (vm_cnt.v_free_target - vm_cnt.v_free_count); } /* @@ -181,8 +178,7 @@ static inline int vm_paging_needed(void) { - return (vm_cnt.v_free_count + vm_cnt.v_cache_count < - (u_int)vm_pageout_wakeup_thresh); + return (vm_cnt.v_free_count < vm_pageout_wakeup_thresh); } /* Modified: releng/11.1/sys/vm/swap_pager.c ============================================================================== --- releng/11.1/sys/vm/swap_pager.c Wed Jul 5 19:24:38 2017 (r320692) +++ releng/11.1/sys/vm/swap_pager.c Wed Jul 5 19:24:53 2017 (r320693) @@ -2282,10 +2282,8 @@ swapoff_one(struct swdevt *sp, struct ucred *cred) * of data we will have to page back in, plus an epsilon so * the system doesn't become critically low on swap space. */ - if (vm_cnt.v_free_count + vm_cnt.v_cache_count + swap_pager_avail < - nblks + nswap_lowat) { + if (vm_cnt.v_free_count + swap_pager_avail < nblks + nswap_lowat) return (ENOMEM); - } /* * Prevent further allocations on this device. Modified: releng/11.1/sys/vm/vm_meter.c ============================================================================== --- releng/11.1/sys/vm/vm_meter.c Wed Jul 5 19:24:38 2017 (r320692) +++ releng/11.1/sys/vm/vm_meter.c Wed Jul 5 19:24:53 2017 (r320693) @@ -204,7 +204,7 @@ vmtotal(SYSCTL_HANDLER_ARGS) } } mtx_unlock(&vm_object_list_mtx); - total.t_free = vm_cnt.v_free_count + vm_cnt.v_cache_count; + total.t_free = vm_cnt.v_free_count; return (sysctl_handle_opaque(oidp, &total, sizeof(total), req)); } Modified: releng/11.1/sys/vm/vm_page.c ============================================================================== --- releng/11.1/sys/vm/vm_page.c Wed Jul 5 19:24:38 2017 (r320692) +++ releng/11.1/sys/vm/vm_page.c Wed Jul 5 19:24:53 2017 (r320693) @@ -1561,11 +1561,11 @@ vm_page_alloc(vm_object_t object, vm_pindex_t pindex, * for the request class. */ mtx_lock(&vm_page_queue_free_mtx); - if (vm_cnt.v_free_count + vm_cnt.v_cache_count > vm_cnt.v_free_reserved || + if (vm_cnt.v_free_count > vm_cnt.v_free_reserved || (req_class == VM_ALLOC_SYSTEM && - vm_cnt.v_free_count + vm_cnt.v_cache_count > vm_cnt.v_interrupt_free_min) || + vm_cnt.v_free_count > vm_cnt.v_interrupt_free_min) || (req_class == VM_ALLOC_INTERRUPT && - vm_cnt.v_free_count + vm_cnt.v_cache_count > 0)) { + vm_cnt.v_free_count > 0)) { /* * Can we allocate the page from a reservation? */ @@ -1752,11 +1752,11 @@ vm_page_alloc_contig(vm_object_t object, vm_pindex_t p * below the lower bound for the allocation class? */ mtx_lock(&vm_page_queue_free_mtx); - if (vm_cnt.v_free_count + vm_cnt.v_cache_count >= npages + - vm_cnt.v_free_reserved || (req_class == VM_ALLOC_SYSTEM && - vm_cnt.v_free_count + vm_cnt.v_cache_count >= npages + - vm_cnt.v_interrupt_free_min) || (req_class == VM_ALLOC_INTERRUPT && - vm_cnt.v_free_count + vm_cnt.v_cache_count >= npages)) { + if (vm_cnt.v_free_count >= npages + vm_cnt.v_free_reserved || + (req_class == VM_ALLOC_SYSTEM && + vm_cnt.v_free_count >= npages + vm_cnt.v_interrupt_free_min) || + (req_class == VM_ALLOC_INTERRUPT && + vm_cnt.v_free_count >= npages)) { /* * Can we allocate the pages from a reservation? */ @@ -1916,11 +1916,11 @@ vm_page_alloc_freelist(int flind, int req) * Do not allocate reserved pages unless the req has asked for it. */ mtx_lock(&vm_page_queue_free_mtx); - if (vm_cnt.v_free_count + vm_cnt.v_cache_count > vm_cnt.v_free_reserved || + if (vm_cnt.v_free_count > vm_cnt.v_free_reserved || (req_class == VM_ALLOC_SYSTEM && - vm_cnt.v_free_count + vm_cnt.v_cache_count > vm_cnt.v_interrupt_free_min) || + vm_cnt.v_free_count > vm_cnt.v_interrupt_free_min) || (req_class == VM_ALLOC_INTERRUPT && - vm_cnt.v_free_count + vm_cnt.v_cache_count > 0)) + vm_cnt.v_free_count > 0)) m = vm_phys_alloc_freelist_pages(flind, VM_FREEPOOL_DIRECT, 0); else { mtx_unlock(&vm_page_queue_free_mtx); @@ -2448,7 +2448,7 @@ vm_page_reclaim_contig(int req, u_long npages, vm_padd * Return if the number of free pages cannot satisfy the requested * allocation. */ - count = vm_cnt.v_free_count + vm_cnt.v_cache_count; + count = vm_cnt.v_free_count; if (count < npages + vm_cnt.v_free_reserved || (count < npages + vm_cnt.v_interrupt_free_min && req_class == VM_ALLOC_SYSTEM) || (count < npages && req_class == VM_ALLOC_INTERRUPT)) @@ -2731,7 +2731,7 @@ vm_page_free_wakeup(void) * some free. */ if (vm_pageout_pages_needed && - vm_cnt.v_cache_count + vm_cnt.v_free_count >= vm_cnt.v_pageout_free_min) { + vm_cnt.v_free_count >= vm_cnt.v_pageout_free_min) { wakeup(&vm_pageout_pages_needed); vm_pageout_pages_needed = 0; } @@ -3570,8 +3570,8 @@ vm_page_assert_pga_writeable(vm_page_t m, uint8_t bits DB_SHOW_COMMAND(page, vm_page_print_page_info) { + db_printf("vm_cnt.v_free_count: %d\n", vm_cnt.v_free_count); - db_printf("vm_cnt.v_cache_count: %d\n", vm_cnt.v_cache_count); db_printf("vm_cnt.v_inactive_count: %d\n", vm_cnt.v_inactive_count); db_printf("vm_cnt.v_active_count: %d\n", vm_cnt.v_active_count); db_printf("vm_cnt.v_laundry_count: %d\n", vm_cnt.v_laundry_count); @@ -3586,8 +3586,7 @@ DB_SHOW_COMMAND(pageq, vm_page_print_pageq_info) { int dom; - db_printf("pq_free %d pq_cache %d\n", - vm_cnt.v_free_count, vm_cnt.v_cache_count); + db_printf("pq_free %d\n", vm_cnt.v_free_count); for (dom = 0; dom < vm_ndomains; dom++) { db_printf( "dom %d page_cnt %d free %d pq_act %d pq_inact %d pq_laund %d\n", Modified: releng/11.1/sys/vm/vm_pageout.c ============================================================================== --- releng/11.1/sys/vm/vm_pageout.c Wed Jul 5 19:24:38 2017 (r320692) +++ releng/11.1/sys/vm/vm_pageout.c Wed Jul 5 19:24:53 2017 (r320693) @@ -159,7 +159,7 @@ SYSINIT(vmdaemon, SI_SUB_KTHREAD_VM, SI_ORDER_FIRST, k #define VM_INACT_SCAN_RATE 2 int vm_pageout_deficit; /* Estimated number of pages deficit */ -int vm_pageout_wakeup_thresh; +u_int vm_pageout_wakeup_thresh; static int vm_pageout_oom_seq = 12; bool vm_pageout_wanted; /* Event on which pageout daemon sleeps */ bool vm_pages_needed; /* Are threads waiting for free pages? */ Modified: releng/11.1/sys/vm/vnode_pager.c ============================================================================== --- releng/11.1/sys/vm/vnode_pager.c Wed Jul 5 19:24:38 2017 (r320692) +++ releng/11.1/sys/vm/vnode_pager.c Wed Jul 5 19:24:53 2017 (r320693) @@ -1124,8 +1124,7 @@ vnode_pager_putpages(vm_object_t object, vm_page_t *m, * daemon up. This should be probably be addressed XXX. */ - if (vm_cnt.v_free_count + vm_cnt.v_cache_count < - vm_cnt.v_pageout_free_min) + if (vm_cnt.v_free_count < vm_cnt.v_pageout_free_min) flags |= VM_PAGER_PUT_SYNC; /* From owner-svn-src-releng@freebsd.org Thu Jul 6 04:03:22 2017 Return-Path: Delivered-To: svn-src-releng@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2347BD9D24A; Thu, 6 Jul 2017 04:03:22 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F2EEC7E66A; Thu, 6 Jul 2017 04:03:21 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6643Lc9080998; Thu, 6 Jul 2017 04:03:21 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6643LaD080997; Thu, 6 Jul 2017 04:03:21 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201707060403.v6643LaD080997@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 6 Jul 2017 04:03:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r320699 - releng/11.1/release/scripts X-SVN-Group: releng X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: releng/11.1/release/scripts X-SVN-Commit-Revision: 320699 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jul 2017 04:03:22 -0000 Author: gjb Date: Thu Jul 6 04:03:21 2017 New Revision: 320699 URL: https://svnweb.freebsd.org/changeset/base/320699 Log: MFS11 r320697: MFC r320599: Fix Vagrant image upload after recent API changes. - Update ATLAS_UPLOAD_URL to avoid various regular expressions from failing to match due to redirections. - Use ATLAS_UPLOAD_URL throughout the script. - Adjust several regular expression patterns. Approved by: re (kib) Sponsored by: The FreeBSD Foundation Modified: releng/11.1/release/scripts/atlas-upload.sh Directory Properties: releng/11.1/ (props changed) Modified: releng/11.1/release/scripts/atlas-upload.sh ============================================================================== --- releng/11.1/release/scripts/atlas-upload.sh Thu Jul 6 00:53:12 2017 (r320698) +++ releng/11.1/release/scripts/atlas-upload.sh Thu Jul 6 04:03:21 2017 (r320699) @@ -27,7 +27,7 @@ # ATLAS_API_URL='' -ATLAS_UPLOAD_URL='https://binstore.hashicorp.com' +ATLAS_UPLOAD_URL='https://app.vagrantup.com' DESCRIPTION="FreeBSD Snapshot Build" usage() { @@ -76,7 +76,7 @@ main () { fi # Check to see if the box exists or create it - BOXRESULT=$(/usr/local/bin/curl -s "https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}?access_token=${KEY}") + BOXRESULT=$(/usr/local/bin/curl -s "${ATLAS_UPLOAD_URL}/api/v1/box/${USERNAME}/${BOX}?access_token=${KEY}") if [ $? != 0 ]; then echo "Failed to connect to the API" exit 2; @@ -84,26 +84,26 @@ main () { echo $BOXRESULT | grep "\"name\":\"${BOX}\"" > /dev/null if [ $? != 0 ]; then echo "Creating box: ${BOX}" - /usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/boxes -X POST -d "box[name]=${BOX}" -d "access_token=${KEY}" > /dev/null - /usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX} -X PUT -d "box[is_private]=false" -d "access_token=${KEY}" > /dev/null - /usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX} -X PUT -d "box[description]='${DESCRIPTION}'" -d "access_token=${KEY}" > /dev/null + /usr/local/bin/curl -s ${ATLAS_UPLOAD_URL}/api/v1/boxes -X POST -d "box[name]=${BOX}" -d "access_token=${KEY}" > /dev/null + /usr/local/bin/curl -s ${ATLAS_UPLOAD_URL}/api/v1/box/${USERNAME}/${BOX} -X PUT -d "box[is_private]=false" -d "access_token=${KEY}" > /dev/null + /usr/local/bin/curl -s ${ATLAS_UPLOAD_URL}/api/v1/box/${USERNAME}/${BOX} -X PUT -d "box[description]='${DESCRIPTION}'" -d "access_token=${KEY}" > /dev/null else echo "Box already exists" fi # Check to see if the version exists or create it - VERSIONRESULT=$(/usr/local/bin/curl -s "https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/version/${VERSION}?access_token=${KEY}") + VERSIONRESULT=$(/usr/local/bin/curl -s "${ATLAS_UPLOAD_URL}/api/v1/box/${USERNAME}/${BOX}/version/${VERSION}?access_token=${KEY}") if [ $? != 0 ]; then echo "Failed to connect to the API" exit 2; fi - echo $VERSIONRESULT | grep "\"version\":\"${VERSION}\"" > /dev/null + echo $VERSIONRESULT | grep "version/${VERSION}" > /dev/null if [ $? != 0 ]; then echo "Creating version: ${VERSION}" - /usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/versions -X POST -d "version[version]=${VERSION}" -d "access_token=${KEY}" > /dev/null - /usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/version/${VERSION} -X PUT -d "version[description]=${DESCRIPTION}" -d "access_token=${KEY}" > /dev/null - VERSIONRESULT=$(/usr/local/bin/curl -s "https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/version/${VERSION}?access_token=${KEY}") - echo $VERSIONRESULT | grep "\"version\":\"${VERSION}\"" > /dev/null + /usr/local/bin/curl -s ${ATLAS_UPLOAD_URL}/api/v1/box/${USERNAME}/${BOX}/versions -X POST -d "version[version]=${VERSION}" -d "access_token=${KEY}" > /dev/null + /usr/local/bin/curl -s ${ATLAS_UPLOAD_URL}/api/v1/box/${USERNAME}/${BOX}/version/${VERSION} -X PUT -d "version[description]=${DESCRIPTION}" -d "access_token=${KEY}" > /dev/null + VERSIONRESULT=$(/usr/local/bin/curl -s "${ATLAS_UPLOAD_URL}/api/v1/box/${USERNAME}/${BOX}/version/${VERSION}?access_token=${KEY}") + echo $VERSIONRESULT | grep "version/${VERSION}" > /dev/null if [ $? != 0 ]; then echo "Failed to create version" exit 2 @@ -113,37 +113,37 @@ main () { fi # Check to see if the provider exists or create it - PROVIDERRESULT=$(/usr/local/bin/curl -s "https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/version/${VERSION}/provider/${PROVIDER}?access_token=${KEY}") + PROVIDERRESULT=$(/usr/local/bin/curl -s "${ATLAS_UPLOAD_URL}/api/v1/box/${USERNAME}/${BOX}/version/${VERSION}/provider/${PROVIDER}?access_token=${KEY}") if [ $? != 0 ]; then echo "Failed to connect to the API" exit 2; fi - echo $PROVIDERRESULT | grep "\"name\":\"${PROVIDER}\"" > /dev/null + echo $PROVIDERRESULT | grep "provider/${PROVIDER}" > /dev/null if [ $? != 0 ]; then echo "Creating provider: ${PROVIDER}" - /usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/version/${VERSION}/providers -X POST -d "provider[name]=${PROVIDER}" -d "access_token=${KEY}" > /dev/null + /usr/local/bin/curl -s ${ATLAS_UPLOAD_URL}/api/v1/box/${USERNAME}/${BOX}/version/${VERSION}/providers -X POST -d "provider[name]=${PROVIDER}" -d "access_token=${KEY}" > /dev/null else echo "Provider already exists" fi # Request an upload token - TOKENRESULT=$(/usr/local/bin/curl -s "https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/version/${VERSION}/provider/${PROVIDER}/upload?access_token=${KEY}") + TOKENRESULT=$(/usr/local/bin/curl -s "${ATLAS_UPLOAD_URL}/api/v1/box/${USERNAME}/${BOX}/version/${VERSION}/provider/${PROVIDER}/upload?access_token=${KEY}") if [ $? != 0 ]; then echo "Failed to get the token from the API" exit 2; fi - echo ${TOKENRESULT} | grep -E "\"(token|upload_path)\":" > /dev/null + echo ${TOKENRESULT} | grep -E "upload_path" > /dev/null if [ $? != 0 ]; then echo "No token found from the API" exit 2 else TOKEN=$(echo $TOKENRESULT | sed -e 's/.*token":"//' -e 's/.*upload_path":"//' -e 's/}$//g' -e 's/"//g') echo "Uploading to Atlas" - UPLOADRESULT=$(/usr/local/bin/curl -s -X PUT --upload-file ${FILE} ${TOKEN}) + UPLOADRESULT=$(/usr/local/bin/curl -s -X PUT --upload-file ${FILE} "${TOKEN}") # Validate the Upload echo "Validating" - VALIDRESULT=$(/usr/local/bin/curl -s "https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/version/${VERSION}/provider/${PROVIDER}?access_token=${KEY}") + VALIDRESULT=$(/usr/local/bin/curl -s "${ATLAS_UPLOAD_URL}/api/v1/box/${USERNAME}/${BOX}/version/${VERSION}/provider/${PROVIDER}?access_token=${KEY}") HOSTED_TOKEN=$(echo $VALIDRESULT | sed -e 's/.*"hosted"://' -e 's/,.*$//') if [ ! -z ${TOKEN} -a "${HOSTED_TOKEN}" != "true" ]; then echo "Upload failed, try again." @@ -152,7 +152,7 @@ main () { # Release the version echo "Releasing ${VERSION} of ${BOX} in Atlas" - /usr/local/bin/curl -s https://atlas.hashicorp.com/api/v1/box/${USERNAME}/${BOX}/version/${VERSION}/release -X PUT -d "access_token=${KEY}" > /dev/null + /usr/local/bin/curl -s ${ATLAS_UPLOAD_URL}/api/v1/box/${USERNAME}/${BOX}/version/${VERSION}/release -X PUT -d "access_token=${KEY}" > /dev/null fi } From owner-svn-src-releng@freebsd.org Thu Jul 6 17:22:35 2017 Return-Path: Delivered-To: svn-src-releng@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06C8ED8B81F; Thu, 6 Jul 2017 17:22:35 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C7C9077F46; Thu, 6 Jul 2017 17:22:34 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v66HMXbh013441; Thu, 6 Jul 2017 17:22:33 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v66HMXNL013439; Thu, 6 Jul 2017 17:22:33 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201707061722.v66HMXNL013439@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 6 Jul 2017 17:22:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r320745 - in releng/11.1: etc/pkg release/pkg_repos X-SVN-Group: releng X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in releng/11.1: etc/pkg release/pkg_repos X-SVN-Commit-Revision: 320745 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jul 2017 17:22:35 -0000 Author: gjb Date: Thu Jul 6 17:22:33 2017 New Revision: 320745 URL: https://svnweb.freebsd.org/changeset/base/320745 Log: Update the pkg(8) configuration for the default installation and the dvd1.iso to use the quarterly set, now that the new quarterly branch exists and packages have built. This commit was deferred when branching releng/11.1, since the 2017Q3 branch did not exist yet. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: releng/11.1/etc/pkg/FreeBSD.conf releng/11.1/release/pkg_repos/release-dvd.conf Modified: releng/11.1/etc/pkg/FreeBSD.conf ============================================================================== --- releng/11.1/etc/pkg/FreeBSD.conf Thu Jul 6 17:20:35 2017 (r320744) +++ releng/11.1/etc/pkg/FreeBSD.conf Thu Jul 6 17:22:33 2017 (r320745) @@ -8,7 +8,7 @@ # FreeBSD: { - url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest", + url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly", mirror_type: "srv", signature_type: "fingerprints", fingerprints: "/usr/share/keys/pkg", Modified: releng/11.1/release/pkg_repos/release-dvd.conf ============================================================================== --- releng/11.1/release/pkg_repos/release-dvd.conf Thu Jul 6 17:20:35 2017 (r320744) +++ releng/11.1/release/pkg_repos/release-dvd.conf Thu Jul 6 17:22:33 2017 (r320745) @@ -1,6 +1,6 @@ # $FreeBSD$ release: { - url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest", + url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly", mirror_type: "srv", signature_type: "fingerprints", fingerprints: "/usr/share/keys/pkg", From owner-svn-src-releng@freebsd.org Thu Jul 6 17:31:40 2017 Return-Path: Delivered-To: svn-src-releng@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 58C9FD8BA34; Thu, 6 Jul 2017 17:31:40 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 12F44782EA; Thu, 6 Jul 2017 17:31:39 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v66HVdLO014728; Thu, 6 Jul 2017 17:31:39 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v66HVd6V014727; Thu, 6 Jul 2017 17:31:39 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201707061731.v66HVd6V014727@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 6 Jul 2017 17:31:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r320746 - releng/11.1/sys/dev/acpica/Osd X-SVN-Group: releng X-SVN-Commit-Author: markj X-SVN-Commit-Paths: releng/11.1/sys/dev/acpica/Osd X-SVN-Commit-Revision: 320746 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jul 2017 17:31:40 -0000 Author: markj Date: Thu Jul 6 17:31:38 2017 New Revision: 320746 URL: https://svnweb.freebsd.org/changeset/base/320746 Log: MFS r320744: MFC r320690: Defer ACPI taskqueue creation to SI_SUB_KICK_SCHEDULER. PR: 220277 Approved by: re (gjb) Modified: releng/11.1/sys/dev/acpica/Osd/OsdSchedule.c Directory Properties: releng/11.1/ (props changed) Modified: releng/11.1/sys/dev/acpica/Osd/OsdSchedule.c ============================================================================== --- releng/11.1/sys/dev/acpica/Osd/OsdSchedule.c Thu Jul 6 17:22:33 2017 (r320745) +++ releng/11.1/sys/dev/acpica/Osd/OsdSchedule.c Thu Jul 6 17:31:38 2017 (r320746) @@ -128,7 +128,7 @@ acpi_taskq_init(void *arg) acpi_taskq_started = 1; } -SYSINIT(acpi_taskq, SI_SUB_CONFIGURE, SI_ORDER_SECOND, acpi_taskq_init, NULL); +SYSINIT(acpi_taskq, SI_SUB_KICK_SCHEDULER, SI_ORDER_ANY, acpi_taskq_init, NULL); /* * Bounce through this wrapper function since ACPI-CA doesn't understand From owner-svn-src-releng@freebsd.org Thu Jul 6 18:30:54 2017 Return-Path: Delivered-To: svn-src-releng@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A076D8CCF5; Thu, 6 Jul 2017 18:30:54 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 10F337A11E; Thu, 6 Jul 2017 18:30:53 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v66IUrL5038594; Thu, 6 Jul 2017 18:30:53 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v66IUqLZ038589; Thu, 6 Jul 2017 18:30:52 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201707061830.v66IUqLZ038589@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 6 Jul 2017 18:30:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r320751 - in releng/11.1: contrib/elftoolchain/elfdump contrib/elftoolchain/libelftc lib/libelftc X-SVN-Group: releng X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in releng/11.1: contrib/elftoolchain/elfdump contrib/elftoolchain/libelftc lib/libelftc X-SVN-Commit-Revision: 320751 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Jul 2017 18:30:54 -0000 Author: emaste Date: Thu Jul 6 18:30:52 2017 New Revision: 320751 URL: https://svnweb.freebsd.org/changeset/base/320751 Log: MF11 r320685: Update to ELF Tool Chain snapshot at r3561 This update is primarily bug fixes in C++ symbol demangling, including: - rvalue reference - builtin type auto and decltype(auto) - revamped support for function return types - formatting fixes - omit void when its the only param - ref-qualifiers and others in function types - type qualifiers in pointer-to-member function types - incorrect handling regarding CV-qualifiers in function types - ref-qualifier found in nested-name - properly handle ::= - make sure that nested function name is not a substitute candidate - correctly handle expression in template args - skip unknown substitution abbreviations Also r320663 libelftc: bump version, tracking import in r320343 Approved by: re (gjb) Sponsored by: The FreeBSD Foundation Modified: releng/11.1/contrib/elftoolchain/elfdump/elfdump.c releng/11.1/contrib/elftoolchain/libelftc/_libelftc.h releng/11.1/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c releng/11.1/contrib/elftoolchain/libelftc/libelftc_vstr.c releng/11.1/lib/libelftc/elftc_version.c Directory Properties: releng/11.1/ (props changed) Modified: releng/11.1/contrib/elftoolchain/elfdump/elfdump.c ============================================================================== --- releng/11.1/contrib/elftoolchain/elfdump/elfdump.c Thu Jul 6 18:21:30 2017 (r320750) +++ releng/11.1/contrib/elftoolchain/elfdump/elfdump.c Thu Jul 6 18:30:52 2017 (r320751) @@ -50,7 +50,7 @@ #include "_elftc.h" -ELFTC_VCSID("$Id: elfdump.c 3497 2016-10-17 20:57:22Z emaste $"); +ELFTC_VCSID("$Id: elfdump.c 3521 2017-06-04 20:07:09Z jkoshy $"); #if defined(ELFTC_NEED_ELF_NOTE_DEFINITION) #include "native-elf-format.h" @@ -2226,8 +2226,8 @@ elf_print_svr4_hash64(struct elfdump *ed, struct secti uint64_t *buf; uint64_t *bucket, *chain; uint64_t nbucket, nchain; - uint64_t *bl, *c, maxl, total; - uint64_t i, j; + uint64_t *bl, *c, j, maxl, total; + size_t i; int elferr, first; char idx[10]; Modified: releng/11.1/contrib/elftoolchain/libelftc/_libelftc.h ============================================================================== --- releng/11.1/contrib/elftoolchain/libelftc/_libelftc.h Thu Jul 6 18:21:30 2017 (r320750) +++ releng/11.1/contrib/elftoolchain/libelftc/_libelftc.h Thu Jul 6 18:30:52 2017 (r320751) @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: _libelftc.h 3174 2015-03-27 17:13:41Z emaste $ + * $Id: _libelftc.h 3531 2017-06-05 05:08:43Z kaiwang27 $ */ #ifndef __LIBELFTC_H_ @@ -82,6 +82,8 @@ bool vector_str_init(struct vector_str *_vs); bool vector_str_pop(struct vector_str *_vs); bool vector_str_push(struct vector_str *_vs, const char *_str, size_t _len); +bool vector_str_push_vector(struct vector_str *_dst, + struct vector_str *_org); bool vector_str_push_vector_head(struct vector_str *_dst, struct vector_str *_org); char *vector_str_substr(const struct vector_str *_vs, size_t _begin, Modified: releng/11.1/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c ============================================================================== --- releng/11.1/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c Thu Jul 6 18:21:30 2017 (r320750) +++ releng/11.1/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c Thu Jul 6 18:30:52 2017 (r320751) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2007 Hyogeol Lee + * Copyright (c) 2015-2017 Kai Wang * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,7 +37,7 @@ #include "_libelftc.h" -ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3512 2016-12-29 07:04:19Z kaiwang27 $"); +ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3560 2017-06-25 00:28:23Z kaiwang27 $"); /** * @file cpp_demangle.c @@ -50,7 +51,7 @@ ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3512 2016-12-29 enum type_qualifier { TYPE_PTR, TYPE_REF, TYPE_CMX, TYPE_IMG, TYPE_EXT, TYPE_RST, TYPE_VAT, - TYPE_CST, TYPE_VEC + TYPE_CST, TYPE_VEC, TYPE_RREF }; struct vector_type_qualifier { @@ -64,29 +65,49 @@ enum read_cmd { READ_TYPE, READ_FUNC, READ_PTRMEM }; +struct read_cmd_item { + enum read_cmd cmd; + void *data; +}; + struct vector_read_cmd { size_t size, capacity; - enum read_cmd *r_container; + struct read_cmd_item *r_container; }; +enum push_qualifier { + PUSH_ALL_QUALIFIER, + PUSH_CV_QUALIFIER, + PUSH_NON_CV_QUALIFIER, +}; + struct cpp_demangle_data { struct vector_str output; /* output string vector */ - struct vector_str output_tmp; struct vector_str subst; /* substitution string vector */ struct vector_str tmpl; struct vector_str class_type; + struct vector_str *cur_output; /* ptr to current output vec */ struct vector_read_cmd cmd; - bool paren; /* parenthesis opened */ - bool pfirst; /* first element of parameter */ bool mem_rst; /* restrict member function */ bool mem_vat; /* volatile member function */ bool mem_cst; /* const member function */ + bool mem_ref; /* lvalue-ref member func */ + bool mem_rref; /* rvalue-ref member func */ + bool is_tmpl; /* template args */ + bool is_functype; /* function type */ + bool ref_qualifier; /* ref qualifier */ + enum type_qualifier ref_qualifier_type; /* ref qualifier type */ + enum push_qualifier push_qualifier; /* which qualifiers to push */ int func_type; const char *cur; /* current mangled name ptr */ const char *last_sname; /* last source name */ - int push_head; }; +struct type_delimit { + bool paren; + bool firstp; +}; + #define CPP_DEMANGLE_TRY_LIMIT 128 #define FLOAT_SPRINTF_TRY_LIMIT 5 #define FLOAT_QUADRUPLE_BYTES 16 @@ -105,6 +126,7 @@ static int cpp_demangle_push_fp(struct cpp_demangle_da char *(*)(const char *, size_t)); static int cpp_demangle_push_str(struct cpp_demangle_data *, const char *, size_t); +static int cpp_demangle_pop_str(struct cpp_demangle_data *); static int cpp_demangle_push_subst(struct cpp_demangle_data *, const char *, size_t); static int cpp_demangle_push_subst_v(struct cpp_demangle_data *, @@ -137,16 +159,18 @@ static int cpp_demangle_read_number_as_string(struct c static int cpp_demangle_read_nv_offset(struct cpp_demangle_data *); static int cpp_demangle_read_offset(struct cpp_demangle_data *); static int cpp_demangle_read_offset_number(struct cpp_demangle_data *); -static int cpp_demangle_read_pointer_to_member(struct cpp_demangle_data *); +static int cpp_demangle_read_pointer_to_member(struct cpp_demangle_data *, + struct vector_type_qualifier *); static int cpp_demangle_read_sname(struct cpp_demangle_data *); static int cpp_demangle_read_subst(struct cpp_demangle_data *); static int cpp_demangle_read_subst_std(struct cpp_demangle_data *); static int cpp_demangle_read_subst_stdtmpl(struct cpp_demangle_data *, - const char *, size_t); + const char *); static int cpp_demangle_read_tmpl_arg(struct cpp_demangle_data *); static int cpp_demangle_read_tmpl_args(struct cpp_demangle_data *); static int cpp_demangle_read_tmpl_param(struct cpp_demangle_data *); -static int cpp_demangle_read_type(struct cpp_demangle_data *, int); +static int cpp_demangle_read_type(struct cpp_demangle_data *, + struct type_delimit *); static int cpp_demangle_read_type_flat(struct cpp_demangle_data *, char **); static int cpp_demangle_read_uqname(struct cpp_demangle_data *); @@ -158,10 +182,12 @@ static char *decode_fp_to_float80(const char *, size_t static char *decode_fp_to_long_double(const char *, size_t); static int hex_to_dec(char); static void vector_read_cmd_dest(struct vector_read_cmd *); -static int vector_read_cmd_find(struct vector_read_cmd *, enum read_cmd); +static struct read_cmd_item *vector_read_cmd_find(struct vector_read_cmd *, + enum read_cmd); static int vector_read_cmd_init(struct vector_read_cmd *); static int vector_read_cmd_pop(struct vector_read_cmd *); -static int vector_read_cmd_push(struct vector_read_cmd *, enum read_cmd); +static int vector_read_cmd_push(struct vector_read_cmd *, enum read_cmd, + void *); static void vector_type_qualifier_dest(struct vector_type_qualifier *); static int vector_type_qualifier_init(struct vector_type_qualifier *); static int vector_type_qualifier_push(struct vector_type_qualifier *, @@ -178,9 +204,12 @@ char * cpp_demangle_gnu3(const char *org) { struct cpp_demangle_data ddata; + struct vector_str ret_type; + struct type_delimit td; ssize_t org_len; unsigned int limit; char *rtn; + bool has_ret, more_type; if (org == NULL || (org_len = strlen(org)) < 2) return (NULL); @@ -200,26 +229,75 @@ cpp_demangle_gnu3(const char *org) return (NULL); rtn = NULL; + has_ret = more_type = false; if (!cpp_demangle_read_encoding(&ddata)) goto clean; + /* + * Pop function name from substitution candidate list. + */ + if (*ddata.cur != 0 && ddata.subst.size >= 1) { + if (!vector_str_pop(&ddata.subst)) + goto clean; + } + + td.paren = false; + td.firstp = true; limit = 0; + + /* + * The first type is a return type if we just demangled template + * args. (the template args is right next to the function name, + * which means it's a template function) + */ + if (ddata.is_tmpl) { + ddata.is_tmpl = false; + if (!vector_str_init(&ret_type)) + goto clean; + ddata.cur_output = &ret_type; + has_ret = true; + } + while (*ddata.cur != '\0') { /* * Breaking at some gcc info at tail. e.g) @@GLIBCXX_3.4 */ if (*ddata.cur == '@' && *(ddata.cur + 1) == '@') break; - if (!cpp_demangle_read_type(&ddata, 1)) - goto clean; + + if (has_ret) { + /* Read return type */ + if (!cpp_demangle_read_type(&ddata, NULL)) + goto clean; + } else { + /* Read function arg type */ + if (!cpp_demangle_read_type(&ddata, &td)) + goto clean; + } + + if (has_ret) { + /* Push return type to the beginning */ + if (!VEC_PUSH_STR(&ret_type, " ")) + goto clean; + if (!vector_str_push_vector_head(&ddata.output, + &ret_type)) + goto clean; + ddata.cur_output = &ddata.output; + vector_str_dest(&ret_type); + has_ret = false; + more_type = true; + } else if (more_type) + more_type = false; if (limit++ > CPP_DEMANGLE_TRY_LIMIT) goto clean; } + if (more_type) + goto clean; if (ddata.output.size == 0) goto clean; - if (ddata.paren && !VEC_PUSH_STR(&ddata.output, ")")) + if (td.paren && !VEC_PUSH_STR(&ddata.output, ")")) goto clean; if (ddata.mem_vat && !VEC_PUSH_STR(&ddata.output, " volatile")) goto clean; @@ -227,10 +305,17 @@ cpp_demangle_gnu3(const char *org) goto clean; if (ddata.mem_rst && !VEC_PUSH_STR(&ddata.output, " restrict")) goto clean; + if (ddata.mem_ref && !VEC_PUSH_STR(&ddata.output, " &")) + goto clean; + if (ddata.mem_rref && !VEC_PUSH_STR(&ddata.output, " &&")) + goto clean; rtn = vector_str_get_flat(&ddata.output, (size_t *) NULL); clean: + if (has_ret) + vector_str_dest(&ret_type); + cpp_demangle_data_dest(&ddata); return (rtn); @@ -247,7 +332,6 @@ cpp_demangle_data_dest(struct cpp_demangle_data *d) vector_str_dest(&d->class_type); vector_str_dest(&d->tmpl); vector_str_dest(&d->subst); - vector_str_dest(&d->output_tmp); vector_str_dest(&d->output); } @@ -260,43 +344,42 @@ cpp_demangle_data_init(struct cpp_demangle_data *d, co if (!vector_str_init(&d->output)) return (0); - if (!vector_str_init(&d->output_tmp)) - goto clean1; if (!vector_str_init(&d->subst)) - goto clean2; + goto clean1; if (!vector_str_init(&d->tmpl)) - goto clean3; + goto clean2; if (!vector_str_init(&d->class_type)) - goto clean4; + goto clean3; if (!vector_read_cmd_init(&d->cmd)) - goto clean5; + goto clean4; assert(d->output.container != NULL); - assert(d->output_tmp.container != NULL); assert(d->subst.container != NULL); assert(d->tmpl.container != NULL); assert(d->class_type.container != NULL); - d->paren = false; - d->pfirst = false; d->mem_rst = false; d->mem_vat = false; d->mem_cst = false; + d->mem_ref = false; + d->mem_rref = false; + d->is_tmpl = false; + d->is_functype = false; + d->ref_qualifier = false; + d->push_qualifier = PUSH_ALL_QUALIFIER; d->func_type = 0; d->cur = cur; + d->cur_output = &d->output; d->last_sname = NULL; - d->push_head = 0; return (1); -clean5: - vector_str_dest(&d->class_type); clean4: - vector_str_dest(&d->tmpl); + vector_str_dest(&d->class_type); clean3: - vector_str_dest(&d->subst); + vector_str_dest(&d->tmpl); clean2: - vector_str_dest(&d->output_tmp); + vector_str_dest(&d->subst); clean1: vector_str_dest(&d->output); @@ -341,13 +424,27 @@ cpp_demangle_push_str(struct cpp_demangle_data *ddata, if (ddata == NULL || str == NULL || len == 0) return (0); - if (ddata->push_head > 0) - return (vector_str_push(&ddata->output_tmp, str, len)); + /* + * is_tmpl is used to check if the type (function arg) is right next + * to template args, and should always be cleared whenever new string + * pushed. + */ + ddata->is_tmpl = false; - return (vector_str_push(&ddata->output, str, len)); + return (vector_str_push(ddata->cur_output, str, len)); } static int +cpp_demangle_pop_str(struct cpp_demangle_data *ddata) +{ + + if (ddata == NULL) + return (0); + + return (vector_str_pop(ddata->cur_output)); +} + +static int cpp_demangle_push_subst(struct cpp_demangle_data *ddata, const char *str, size_t len) { @@ -386,9 +483,11 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d struct vector_type_qualifier *v, const char *type_str) { struct vector_str subst_v; + enum type_qualifier t; size_t idx, e_idx, e_len; - int rtn; char *buf; + int rtn; + bool cv; if (ddata == NULL || v == NULL) return (0); @@ -404,10 +503,14 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d goto clean; } + cv = true; e_idx = 0; while (idx > 0) { switch (v->q_container[idx - 1]) { case TYPE_PTR: + cv = false; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER) + break; if (!DEM_PUSH_STR(ddata, "*")) goto clean; if (type_str != NULL) { @@ -420,6 +523,9 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d break; case TYPE_REF: + cv = false; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER) + break; if (!DEM_PUSH_STR(ddata, "&")) goto clean; if (type_str != NULL) { @@ -431,7 +537,25 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d } break; + case TYPE_RREF: + cv = false; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER) + break; + if (!DEM_PUSH_STR(ddata, "&&")) + goto clean; + if (type_str != NULL) { + if (!VEC_PUSH_STR(&subst_v, "&&")) + goto clean; + if (!cpp_demangle_push_subst_v(ddata, + &subst_v)) + goto clean; + } + break; + case TYPE_CMX: + cv = false; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER) + break; if (!DEM_PUSH_STR(ddata, " complex")) goto clean; if (type_str != NULL) { @@ -444,6 +568,9 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d break; case TYPE_IMG: + cv = false; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER) + break; if (!DEM_PUSH_STR(ddata, " imaginary")) goto clean; if (type_str != NULL) { @@ -457,6 +584,9 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d break; case TYPE_EXT: + cv = false; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER) + break; if (v->ext_name.size == 0 || e_idx > v->ext_name.size - 1) goto clean; @@ -489,11 +619,22 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d break; case TYPE_RST: + if (ddata->push_qualifier == PUSH_NON_CV_QUALIFIER && + cv) + break; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER && !cv) + break; if (!DEM_PUSH_STR(ddata, " restrict")) goto clean; if (type_str != NULL) { if (!VEC_PUSH_STR(&subst_v, " restrict")) goto clean; + if (idx - 1 > 0) { + t = v->q_container[idx - 2]; + if (t == TYPE_RST || t == TYPE_VAT || + t == TYPE_CST) + break; + } if (!cpp_demangle_push_subst_v(ddata, &subst_v)) goto clean; @@ -501,11 +642,22 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d break; case TYPE_VAT: + if (ddata->push_qualifier == PUSH_NON_CV_QUALIFIER && + cv) + break; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER && !cv) + break; if (!DEM_PUSH_STR(ddata, " volatile")) goto clean; if (type_str != NULL) { if (!VEC_PUSH_STR(&subst_v, " volatile")) goto clean; + if (idx - 1 > 0) { + t = v->q_container[idx - 2]; + if (t == TYPE_RST || t == TYPE_VAT || + t == TYPE_CST) + break; + } if (!cpp_demangle_push_subst_v(ddata, &subst_v)) goto clean; @@ -513,11 +665,22 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d break; case TYPE_CST: + if (ddata->push_qualifier == PUSH_NON_CV_QUALIFIER && + cv) + break; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER && !cv) + break; if (!DEM_PUSH_STR(ddata, " const")) goto clean; if (type_str != NULL) { if (!VEC_PUSH_STR(&subst_v, " const")) goto clean; + if (idx - 1 > 0) { + t = v->q_container[idx - 2]; + if (t == TYPE_RST || t == TYPE_VAT || + t == TYPE_CST) + break; + } if (!cpp_demangle_push_subst_v(ddata, &subst_v)) goto clean; @@ -525,6 +688,9 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_d break; case TYPE_VEC: + cv = false; + if (ddata->push_qualifier == PUSH_CV_QUALIFIER) + break; if (v->ext_name.size == 0 || e_idx > v->ext_name.size - 1) goto clean; @@ -614,7 +780,7 @@ cpp_demangle_read_array(struct cpp_demangle_data *ddat if (*(++ddata->cur) == '\0') return (0); - if (!cpp_demangle_read_type(ddata, 0)) + if (!cpp_demangle_read_type(ddata, NULL)) return (0); if (!DEM_PUSH_STR(ddata, "[]")) @@ -630,7 +796,7 @@ cpp_demangle_read_array(struct cpp_demangle_data *ddat assert(num_len > 0); if (*(++ddata->cur) == '\0') return (0); - if (!cpp_demangle_read_type(ddata, 0)) + if (!cpp_demangle_read_type(ddata, NULL)) return (0); if (!DEM_PUSH_STR(ddata, "[")) return (0); @@ -660,7 +826,7 @@ cpp_demangle_read_array(struct cpp_demangle_data *ddat free(exp); return (0); } - if (!cpp_demangle_read_type(ddata, 0)) { + if (!cpp_demangle_read_type(ddata, NULL)) { free(exp); return (0); } @@ -777,11 +943,11 @@ cpp_demangle_read_expression(struct cpp_demangle_data switch (SIMPLE_HASH(*ddata->cur, *(ddata->cur + 1))) { case SIMPLE_HASH('s', 't'): ddata->cur += 2; - return (cpp_demangle_read_type(ddata, 0)); + return (cpp_demangle_read_type(ddata, NULL)); case SIMPLE_HASH('s', 'r'): ddata->cur += 2; - if (!cpp_demangle_read_type(ddata, 0)) + if (!cpp_demangle_read_type(ddata, NULL)) return (0); if (!cpp_demangle_read_uqname(ddata)) return (0); @@ -1058,8 +1224,7 @@ cpp_demangle_read_expression_flat(struct cpp_demangle_ size_t i, p_idx, idx, exp_len; char *exp; - output = ddata->push_head > 0 ? &ddata->output_tmp : - &ddata->output; + output = &ddata->output; p_idx = output->size; @@ -1136,8 +1301,12 @@ static int cpp_demangle_read_function(struct cpp_demangle_data *ddata, int *ext_c, struct vector_type_qualifier *v) { + struct type_delimit td; + struct read_cmd_item *rc; size_t class_type_size, class_type_len, limit; const char *class_type; + int i; + bool paren, non_cv_qualifier; if (ddata == NULL || *ddata->cur != 'F' || v == NULL) return (0); @@ -1148,12 +1317,43 @@ cpp_demangle_read_function(struct cpp_demangle_data *d *ext_c = 1; ++ddata->cur; } - if (!cpp_demangle_read_type(ddata, 0)) + + /* Return type */ + if (!cpp_demangle_read_type(ddata, NULL)) return (0); + if (*ddata->cur != 'E') { - if (!DEM_PUSH_STR(ddata, "(")) + if (!DEM_PUSH_STR(ddata, " ")) return (0); - if (vector_read_cmd_find(&ddata->cmd, READ_PTRMEM)) { + + non_cv_qualifier = false; + if (v->size > 0) { + for (i = 0; (size_t) i < v->size; i++) { + if (v->q_container[i] != TYPE_RST && + v->q_container[i] != TYPE_VAT && + v->q_container[i] != TYPE_CST) { + non_cv_qualifier = true; + break; + } + } + } + + paren = false; + rc = vector_read_cmd_find(&ddata->cmd, READ_PTRMEM); + if (non_cv_qualifier || rc != NULL) { + if (!DEM_PUSH_STR(ddata, "(")) + return (0); + paren = true; + } + + /* Push non-cv qualifiers. */ + ddata->push_qualifier = PUSH_NON_CV_QUALIFIER; + if (!cpp_demangle_push_type_qualifier(ddata, v, NULL)) + return (0); + + if (rc) { + if (non_cv_qualifier && !DEM_PUSH_STR(ddata, " ")) + return (0); if ((class_type_size = ddata->class_type.size) == 0) return (0); class_type = @@ -1167,40 +1367,67 @@ cpp_demangle_read_function(struct cpp_demangle_data *d return (0); if (!DEM_PUSH_STR(ddata, "::*")) return (0); + /* Push pointer-to-member qualifiers. */ + ddata->push_qualifier = PUSH_ALL_QUALIFIER; + if (!cpp_demangle_push_type_qualifier(ddata, rc->data, + NULL)) + return (0); ++ddata->func_type; - } else { - if (!cpp_demangle_push_type_qualifier(ddata, v, - (const char *) NULL)) + } + + if (paren) { + if (!DEM_PUSH_STR(ddata, ")")) return (0); - vector_type_qualifier_dest(v); - if (!vector_type_qualifier_init(v)) - return (0); + paren = false; } - if (!DEM_PUSH_STR(ddata, ")(")) - return (0); - + td.paren = false; + td.firstp = true; limit = 0; + ddata->is_functype = true; for (;;) { - if (!cpp_demangle_read_type(ddata, 0)) + if (!cpp_demangle_read_type(ddata, &td)) return (0); if (*ddata->cur == 'E') break; if (limit++ > CPP_DEMANGLE_TRY_LIMIT) return (0); } - - if (vector_read_cmd_find(&ddata->cmd, READ_PTRMEM) == 1) { - if (!cpp_demangle_push_type_qualifier(ddata, v, - (const char *) NULL)) + ddata->is_functype = false; + if (td.paren) { + if (!DEM_PUSH_STR(ddata, ")")) return (0); - vector_type_qualifier_dest(v); - if (!vector_type_qualifier_init(v)) - return (0); + td.paren = false; } - if (!DEM_PUSH_STR(ddata, ")")) + /* Push CV qualifiers. */ + ddata->push_qualifier = PUSH_CV_QUALIFIER; + if (!cpp_demangle_push_type_qualifier(ddata, v, NULL)) return (0); + + ddata->push_qualifier = PUSH_ALL_QUALIFIER; + + /* Release type qualifier vector. */ + vector_type_qualifier_dest(v); + if (!vector_type_qualifier_init(v)) + return (0); + + /* Push ref-qualifiers. */ + if (ddata->ref_qualifier) { + switch (ddata->ref_qualifier_type) { + case TYPE_REF: + if (!DEM_PUSH_STR(ddata, " &")) + return (0); + break; + case TYPE_RREF: + if (!DEM_PUSH_STR(ddata, " &&")) + return (0); + break; + default: + return (0); + } + ddata->ref_qualifier = false; + } } ++ddata->cur; @@ -1306,7 +1533,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *d goto clean3; if (*ddata->cur++ != '_') goto clean3; - if (!cpp_demangle_read_type(ddata, 0)) + if (!cpp_demangle_read_type(ddata, NULL)) goto clean3; if (!DEM_PUSH_STR(ddata, "-in-")) goto clean3; @@ -1328,7 +1555,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *d ddata->cur += 2; if (*ddata->cur == '\0') return (0); - return (cpp_demangle_read_type(ddata, 0)); + return (cpp_demangle_read_type(ddata, NULL)); case SIMPLE_HASH('T', 'h'): /* virtual function non-virtual override thunk */ @@ -1358,7 +1585,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *d ddata->cur += 2; if (*ddata->cur == '\0') return (0); - return (cpp_demangle_read_type(ddata, 0)); + return (cpp_demangle_read_type(ddata, NULL)); case SIMPLE_HASH('T', 'J'): /* java class */ @@ -1367,7 +1594,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *d ddata->cur += 2; if (*ddata->cur == '\0') return (0); - return (cpp_demangle_read_type(ddata, 0)); + return (cpp_demangle_read_type(ddata, NULL)); case SIMPLE_HASH('T', 'S'): /* RTTI name (NTBS) */ @@ -1376,7 +1603,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *d ddata->cur += 2; if (*ddata->cur == '\0') return (0); - return (cpp_demangle_read_type(ddata, 0)); + return (cpp_demangle_read_type(ddata, NULL)); case SIMPLE_HASH('T', 'T'): /* VTT table */ @@ -1385,7 +1612,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *d ddata->cur += 2; if (*ddata->cur == '\0') return (0); - return (cpp_demangle_read_type(ddata, 0)); + return (cpp_demangle_read_type(ddata, NULL)); case SIMPLE_HASH('T', 'v'): /* virtual function virtual override thunk */ @@ -1406,7 +1633,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *d ddata->cur += 2; if (*ddata->cur == '\0') return (0); - return (cpp_demangle_read_type(ddata, 0)); + return (cpp_demangle_read_type(ddata, NULL)); case SIMPLE_HASH('T', 'W'): /* TLS wrapper function */ @@ -1424,30 +1651,74 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *d static int cpp_demangle_read_local_name(struct cpp_demangle_data *ddata) { + struct vector_str local_name; + struct type_delimit td; size_t limit; + bool more_type; if (ddata == NULL) return (0); if (*(++ddata->cur) == '\0') return (0); - if (!cpp_demangle_read_encoding(ddata)) + + vector_str_init(&local_name); + ddata->cur_output = &local_name; + + if (!cpp_demangle_read_encoding(ddata)) { + vector_str_dest(&local_name); return (0); + } + ddata->cur_output = &ddata->output; + + td.paren = false; + td.firstp = true; + more_type = false; limit = 0; - for (;;) { - if (!cpp_demangle_read_type(ddata, 1)) + + /* + * The first type is a return type if we just demangled template + * args. (the template args is right next to the function name, + * which means it's a template function) + */ + if (ddata->is_tmpl) { + ddata->is_tmpl = false; + + /* Read return type */ + if (!cpp_demangle_read_type(ddata, NULL)) { + vector_str_dest(&local_name); return (0); + } + + more_type = true; + } + + /* Now we can push the name after possible return type is handled. */ + if (!vector_str_push_vector(&ddata->output, &local_name)) { + vector_str_dest(&local_name); + return (0); + } + vector_str_dest(&local_name); + + while (*ddata->cur != '\0') { + if (!cpp_demangle_read_type(ddata, &td)) + return (0); + if (more_type) + more_type = false; if (*ddata->cur == 'E') break; if (limit++ > CPP_DEMANGLE_TRY_LIMIT) return (0); } + if (more_type) + return (0); + if (*(++ddata->cur) == '\0') return (0); - if (ddata->paren == true) { + if (td.paren == true) { if (!DEM_PUSH_STR(ddata, ")")) return (0); - ddata->paren = false; + td.paren = false; } if (*ddata->cur == 's') ++ddata->cur; @@ -1477,7 +1748,7 @@ cpp_demangle_read_name(struct cpp_demangle_data *ddata if (ddata == NULL || *ddata->cur == '\0') return (0); - output = ddata->push_head > 0 ? &ddata->output_tmp : &ddata->output; + output = ddata->cur_output; subst_str = NULL; @@ -1539,8 +1810,7 @@ cpp_demangle_read_name_flat(struct cpp_demangle_data * size_t i, p_idx, idx, name_len; char *name; - output = ddata->push_head > 0 ? &ddata->output_tmp : - &ddata->output; + output = ddata->cur_output; p_idx = output->size; @@ -1577,8 +1847,7 @@ cpp_demangle_read_nested_name(struct cpp_demangle_data if (*(++ddata->cur) == '\0') return (0); - while (*ddata->cur == 'r' || *ddata->cur == 'V' || - *ddata->cur == 'K') { + do { switch (*ddata->cur) { case 'r': ddata->mem_rst = true; @@ -1589,11 +1858,19 @@ cpp_demangle_read_nested_name(struct cpp_demangle_data case 'K': ddata->mem_cst = true; break; + case 'R': + ddata->mem_ref = true; + break; + case 'O': + ddata->mem_rref = true; + break; + default: + goto next; } - ++ddata->cur; - } + } while (*(++ddata->cur)); - output = ddata->push_head > 0 ? &ddata->output_tmp : &ddata->output; +next: + output = ddata->cur_output; if (!vector_str_init(&v)) return (0); @@ -1619,6 +1896,8 @@ cpp_demangle_read_nested_name(struct cpp_demangle_data goto clean; } + if (p_idx == output->size) + goto next_comp; if ((subst_str = vector_str_substr(output, p_idx, output->size - 1, &subst_str_len)) == NULL) goto clean; @@ -1630,10 +1909,12 @@ cpp_demangle_read_nested_name(struct cpp_demangle_data if (!cpp_demangle_push_subst_v(ddata, &v)) goto clean; + + next_comp: if (*ddata->cur == 'E') break; - else if (*ddata->cur != 'I' && - *ddata->cur != 'C' && *ddata->cur != 'D') { + else if (*ddata->cur != 'I' && *ddata->cur != 'C' && + *ddata->cur != 'D' && p_idx != output->size) { if (!DEM_PUSH_STR(ddata, "::")) goto clean; if (!VEC_PUSH_STR(&v, "::")) @@ -1776,7 +2057,8 @@ cpp_demangle_read_offset_number(struct cpp_demangle_da } static int -cpp_demangle_read_pointer_to_member(struct cpp_demangle_data *ddata) +cpp_demangle_read_pointer_to_member(struct cpp_demangle_data *ddata, + struct vector_type_qualifier *v) { size_t class_type_len, i, idx, p_idx; int p_func_type, rtn; @@ -1786,7 +2068,7 @@ cpp_demangle_read_pointer_to_member(struct cpp_demangl return (0); p_idx = ddata->output.size; - if (!cpp_demangle_read_type(ddata, 0)) + if (!cpp_demangle_read_type(ddata, NULL)) return (0); if ((class_type = vector_str_substr(&ddata->output, p_idx, @@ -1799,14 +2081,14 @@ cpp_demangle_read_pointer_to_member(struct cpp_demangl if (!vector_str_pop(&ddata->output)) goto clean1; - if (!vector_read_cmd_push(&ddata->cmd, READ_PTRMEM)) + if (!vector_read_cmd_push(&ddata->cmd, READ_PTRMEM, v)) goto clean1; if (!vector_str_push(&ddata->class_type, class_type, class_type_len)) goto clean2; p_func_type = ddata->func_type; - if (!cpp_demangle_read_type(ddata, 0)) + if (!cpp_demangle_read_type(ddata, NULL)) goto clean3; if (p_func_type == ddata->func_type) { @@ -1828,6 +2110,10 @@ clean2: clean1: free(class_type); + vector_type_qualifier_dest(v); + if (!vector_type_qualifier_init(v)) + return (0); + return (rtn); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-releng@freebsd.org Fri Jul 7 00:34:53 2017 Return-Path: Delivered-To: svn-src-releng@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1E2BD95984; Fri, 7 Jul 2017 00:34:52 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BC0443EB; Fri, 7 Jul 2017 00:34:52 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v670YqMi093045; Fri, 7 Jul 2017 00:34:52 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v670Yp4Y093037; Fri, 7 Jul 2017 00:34:51 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201707070034.v670Yp4Y093037@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Fri, 7 Jul 2017 00:34:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r320760 - in releng/11.1: release release/tools share/man/man4 sys/conf sys/contrib/ena-com sys/dev/ena sys/modules sys/modules/ena X-SVN-Group: releng X-SVN-Commit-Author: cperciva X-SVN-Commit-Paths: in releng/11.1: release release/tools share/man/man4 sys/conf sys/contrib/ena-com sys/dev/ena sys/modules sys/modules/ena X-SVN-Commit-Revision: 320760 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jul 2017 00:34:53 -0000 Author: cperciva Date: Fri Jul 7 00:34:51 2017 New Revision: 320760 URL: https://svnweb.freebsd.org/changeset/base/320760 Log: MF11 r320731,320749,320759: Add Amazon Elastic Network Adapter driver and turn it on in EC2 AMI builds Approved by: re (gjb) Relnotes: FreeBSD now supports "next generation" Enhanced Networking in the Amazon EC2 cloud Sponsored by: Amazon.com Inc. (original work) Added: releng/11.1/share/man/man4/ena.4 - copied unchanged from r320731, stable/11/share/man/man4/ena.4 releng/11.1/sys/contrib/ena-com/ - copied from r320731, stable/11/sys/contrib/ena-com/ releng/11.1/sys/dev/ena/ - copied from r320731, stable/11/sys/dev/ena/ releng/11.1/sys/modules/ena/ - copied from r320731, stable/11/sys/modules/ena/ Modified: releng/11.1/release/Makefile.ec2 releng/11.1/release/tools/ec2.conf releng/11.1/sys/conf/files releng/11.1/sys/dev/ena/ena.c releng/11.1/sys/dev/ena/ena.h releng/11.1/sys/modules/Makefile Directory Properties: releng/11.1/ (props changed) Modified: releng/11.1/release/Makefile.ec2 ============================================================================== --- releng/11.1/release/Makefile.ec2 Thu Jul 6 22:34:54 2017 (r320759) +++ releng/11.1/release/Makefile.ec2 Fri Jul 7 00:34:51 2017 (r320760) @@ -51,7 +51,7 @@ ec2ami: cw-ec2 ${CW_EC2_PORTINSTALL} @echo "--------------------------------------------------------------" @false .endif - /usr/local/bin/bsdec2-image-upload ${PUBLISH} --sriov \ + /usr/local/bin/bsdec2-image-upload ${PUBLISH} --sriov --ena \ ${.OBJDIR}/ec2.raw \ "${TYPE} ${REVISION}-${BRANCH}-${TARGET}${AMINAMESUFFIX}" \ "${TYPE} ${REVISION}-${BRANCH}-${TARGET}" \ Modified: releng/11.1/release/tools/ec2.conf ============================================================================== --- releng/11.1/release/tools/ec2.conf Thu Jul 6 22:34:54 2017 (r320759) +++ releng/11.1/release/tools/ec2.conf Fri Jul 7 00:34:51 2017 (r320760) @@ -78,6 +78,9 @@ vm_extra_pre_umount() { # nodes, but apply the workaround just in case. echo 'hw.broken_txfifo="1"' >> ${DESTDIR}/boot/loader.conf + # Load the kernel module for the Amazon "Elastic Network Adapter" + echo 'if_ena_load="YES"' >> ${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) Copied: releng/11.1/share/man/man4/ena.4 (from r320731, stable/11/share/man/man4/ena.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ releng/11.1/share/man/man4/ena.4 Fri Jul 7 00:34:51 2017 (r320760, copy of r320731, stable/11/share/man/man4/ena.4) @@ -0,0 +1,255 @@ +.\" Copyright (c) 2015-2017 Amazon.com, Inc. or its affiliates. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in +.\" the documentation and/or other materials provided with the +.\" distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +.\" "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +.\" A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +.\" OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +.\" OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd May 04, 2017 +.Dt ENA 4 +.Os +.Sh NAME +.Nm ena +.Nd "FreeBSD kernel driver for Elastic Network Adapter (ENA) family" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device ena" +.Ed +.Pp +Alternatively, to load the driver as a +module at boot time, place the following line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +if_ena_load="YES" +.Ed +.Sh DESCRIPTION +The ENA is a networking interface designed to make good use of modern CPU +features and system architectures. +.Pp +The ENA device exposes a lightweight management interface with a +minimal set of memory mapped registers and extendable command set +through an Admin Queue. +.Pp +The driver supports a range of ENA devices, is link-speed independent +(i.e., the same driver is used for 10GbE, 25GbE, 40GbE, etc.), and has +a negotiated and extendable feature set. +.Pp +Some ENA devices support SR-IOV. This driver is used for both the +SR-IOV Physical Function (PF) and Virtual Function (VF) devices. +.Pp +The ENA devices enable high speed and low overhead network traffic +processing by providing multiple Tx/Rx queue pairs (the maximum number +is advertised by the device via the Admin Queue), a dedicated MSI-X +interrupt vector per Tx/Rx queue pair, and CPU cacheline optimized +data placement. +.Pp +The +.Nm +driver supports industry standard TCP/IP offload features such +as checksum offload and TCP transmit segmentation offload (TSO). +Receive-side scaling (RSS) is supported for multi-core scaling. +.Pp +The +.Nm +driver and its corresponding devices implement health +monitoring mechanisms such as watchdog, enabling the device and driver +to recover in a manner transparent to the application, as well as +debug logs. +.Pp +Some of the ENA devices support a working mode called Low-latency +Queue (LLQ), which saves several more microseconds. This feature will +be implemented for driver in future releases. +.Sh HARDWARE +Supported PCI vendor ID/device IDs: +.Pp +.Bl -bullet -compact +.It +1d0f:0ec2 - ENA PF +.It +1d0f:1ec2 - ENA PF with LLQ support +.It +1d0f:ec20 - ENA VF +.It +1d0f:ec21 - ENA VF with LLQ support +.El +.Sh DIAGNOSTICS +.Ss Device initialization phase: +.Bl -diag +.It ena%d: failed to init mmio read less +.Pp +Error occured during initialization of the mmio register read request. +.It ena%d: Can not reset device +.Pp +Device could not be reset; device may not be responding or is already +during reset. +.It ena%d: device version is too low +.Pp +Version of the controller is too low and it is not supported by the driver. +.It ena%d: Invalid dma width value %d +.Pp +The controller is able to request dma transcation width. Device stopped +responding or it demanded invalid value. +.It ena%d: Can not initialize ena admin queue with device +.Pp +Initialization of the Admin Queue failed; device may not be responding or there +was a problem with initialization of the resources. +.It ena%d: Cannot get attribute for ena device rc: %d +.Pp +Failed to get attributes of the device from the controller. +.It ena%d: Cannot configure aenq groups rc: %d +.Pp +Errors occured when trying to configure AENQ groups. +.El +.Ss Driver initialisation/shutdown phase: +.Bl -diag +.It ena%d: PCI resource allocation failed! +.It ena%d: allocating ena_dev failed +.It ena%d: failed to pmap registers bar +.It ena%d: Error while setting up bufring +.It ena%d: Error with initialization of IO rings +.It ena%d: can not allocate ifnet structure +.It ena%d: Error with network interface setup +.It ena%d: Failed to enable and set the admin interrupts +.It ena%d: Failed to allocate %d, vectors %d +.It ena%d: Failed to enable MSIX, vectors %d rc %d +.It ena%d: Error with MSI-X enablement +.It ena%d: could not allocate irq vector: %d +.It ena%d: Unable to allocate bus resource: registers +.Pp +Resource allocation failed when initializing the device; driver will not +be attached. +.It ena%d: ENA device init failed (err: %d) +.Pp +Device initialization failed; driver will not be attached. +.It ena%d: could not activate irq vector: %d +.Pp +Error occured when trying to activate interrupt vectors for Admin Queue. +.It ena%d: failed to register interrupt handler for irq %ju: %d +.Pp +Error occured when trying to register Admin Queue interrupt handler. +.It ena%d: Cannot setup mgmnt queue intr +.Pp +Error occured during configuration of the Admin Queue interrupts. +.It ena%d: Enable MSI-X failed +.Pp +Configuration of the MSI-X for Admin Queue failed; there could be lack +of resources or interrupts could not have been configured; driver will +not be attached. +.It ena%d: VLAN is in use, detach first +.Pp +VLANs are being used when trying to detach the driver; VLANs should be detached +first and then detach routine should be called again. +.It ena%d: Unmapped RX DMA tag associations +.It ena%d: Unmapped TX DMA tag associations +.Pp +Error occured when trying to destroy RX/TX DMA tag. +.It ena%d: Cannot init RSS +.It ena%d: Cannot fill indirect table +.It ena%d: Cannot fill indirect table +.It ena%d: Cannot fill hash function +.It ena%d: Cannot fill hash control +.It ena%d: WARNING: RSS was not properly initialized, it will affect bandwidth +.Pp +Error occured during initialization of one of RSS resources; device is still +going to work but it will affect performance because all RX packets will be +passed to queue 0 and there will be no hash information. +.It ena%d: failed to tear down irq: %d +.It ena%d: dev has no parent while releasing res for irq: %d +Release of the interrupts failed. +.El +.Ss Additional diagnostic: +.Bl -diag +.It ena%d: Cannot get attribute for ena device +.Pp +This message appears when trying to change MTU and driver is unable to get +attributes from the device. +.It ena%d: Invalid MTU setting. new_mtu: %d +.Pp +Requested MTU value is not supported and will not be set. +.It ena%d: keep alive watchdog timeout +.Pp +Device stopped responding and will be reset. +.It ena%d: Found a Tx that wasn't completed on time, qid %d, index %d. +.Pp +Packet was pushed to the NIC but not sent within given time limit; it may +be caused by hang of the IO queue. +.It ena%d: The number of lost tx completion is aboce the threshold (%d > %d). Reset the device +.Pp +If too many Tx wasn't completed on time the device is going to be reset; it may +be caused by hanged queue or device. +.It ena%d: trigger reset is on +.Pp +Device will be reset; reset is triggered either by watchdog or if too many TX +packets were not completed on time. +.It ena%d: invalid value recvd +.Pp +Link status received from the device in the AENQ handler is invalid. +.It ena%d: Allocation for Tx Queue %u failed +.It ena%d: Allocation for Rx Queue %u failed +.It ena%d: Unable to create Rx DMA map for buffer %d +.It ena%d: Failed to create io TX queue #%d rc: %d +.It ena%d: Failed to get TX queue handlers. TX queue num %d rc: %d +.It ena%d: Failed to create io RX queue[%d] rc: %d +.It ena%d: Failed to get RX queue handlers. RX queue num %d rc: %d +.It ena%d: failed to request irq +.It ena%d: could not allocate irq vector: %d +.It ena%d: failed to register interrupt handler for irq %ju: %d +.Pp +IO resources initialization failed. Interface will not be brought up. +.It ena%d: LRO[%d] Initialization failed! +.Pp +Initialization of the LRO for the RX ring failed. +.It ena%d: failed to alloc buffer for rx queue +.It ena%d: failed to add buffer for rx queue %d +.It ena%d: refilled rx queue %d with %d pages only +.Pp +Allocation of resources used on RX path failed; if happened during +initialization of the IO queue, the interface will not be brought up. +.It ena%d: ioctl promisc/allmulti +.Pp +IOCTL request for the device to work in promiscuous/allmulti mode; see +.Xr ifconfig 8 +for more details. +.It ena%d: too many fragments. Last fragment: %d! +.Pp +Packet with unsupported number of segments was queued for sending to the +device; packet will be dropped. +.Sh SUPPORT +If an issue is identified with the released source code with a supported adapter +email the specific information related to the issue to +.Aq Mt mk@semihalf.com +and +.Aq Mt mw@semihalf.com . +.Sh SEE ALSO +.Xr vlan 4 , +.Xr ifconfig 8 +.Sh AUTHORS +The +.Nm +driver was written by +.An Semihalf. Modified: releng/11.1/sys/conf/files ============================================================================== --- releng/11.1/sys/conf/files Thu Jul 6 22:34:54 2017 (r320759) +++ releng/11.1/sys/conf/files Fri Jul 7 00:34:51 2017 (r320760) @@ -1547,6 +1547,12 @@ dev/e1000/e1000_mbx.c optional em | igb \ dev/e1000/e1000_osdep.c optional em | igb \ compile-with "${NORMAL_C} -I$S/dev/e1000" dev/et/if_et.c optional et +dev/ena/ena.c optional ena \ + compile-with "${NORMAL_C} -I$S/contrib" +dev/ena/ena_sysctl.c optional ena \ + compile-with "${NORMAL_C} -I$S/contrib" +contrib/ena-com/ena_com.c optional ena +contrib/ena-com/ena_eth_com.c optional ena dev/en/if_en_pci.c optional en pci dev/en/midway.c optional en dev/ep/if_ep.c optional ep Modified: releng/11.1/sys/dev/ena/ena.c ============================================================================== --- stable/11/sys/dev/ena/ena.c Thu Jul 6 11:45:13 2017 (r320731) +++ releng/11.1/sys/dev/ena/ena.c Fri Jul 7 00:34:51 2017 (r320760) @@ -141,6 +141,7 @@ static void ena_free_irqs(struct ena_adapter*); static void ena_disable_msix(struct ena_adapter *); static void ena_unmask_all_io_irqs(struct ena_adapter *); static int ena_rss_configure(struct ena_adapter *); +static void ena_update_hw_stats(void *, int); static int ena_up_complete(struct ena_adapter *); static int ena_up(struct ena_adapter *); static void ena_down(struct ena_adapter *); @@ -2062,6 +2063,25 @@ static int ena_rss_configure(struct ena_adapter *adapt return 0; } +static void +ena_update_hw_stats(void *arg, int pending) +{ + struct ena_adapter *adapter = arg; + int rc; + + for (;;) { + if (!adapter->up) + return; + + rc = ena_update_stats_counters(adapter); + if (rc) + ena_trace(ENA_WARNING, + "Error updating stats counters, rc = %d", rc); + + pause("ena update hw stats", hz); + } +} + static int ena_up_complete(struct ena_adapter *adapter) { @@ -2144,6 +2164,8 @@ ena_up(struct ena_adapter *adapter) callout_reset_sbt(&adapter->timer_service, SBT_1S, SBT_1S, ena_timer_service, (void *)adapter, 0); + taskqueue_enqueue(adapter->stats_tq, &adapter->stats_task); + adapter->up = true; ena_unmask_all_io_irqs(adapter); @@ -2198,24 +2220,8 @@ ena_get_counter(if_t ifp, ift_counter cnt) { struct ena_adapter *adapter; struct ena_hw_stats *stats; - int rc; adapter = if_getsoftc(ifp); - - /* - * Update only when asking for first counter and interface is up. - * Usually asks for all statistics in sequence. - */ - if (adapter->up) { - if (cnt == 0) { - rc = ena_update_stats_counters(adapter); - if (rc) { - ena_trace(ENA_WARNING, - "Error updating stats counters, rc = %d", - rc); - } - } - } stats = &adapter->hw_stats; switch (cnt) { @@ -2510,6 +2516,10 @@ ena_down(struct ena_adapter *adapter) if_setdrvflagbits(adapter->ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); + /* Drain task responsible for updating hw stats */ + while (taskqueue_cancel(adapter->stats_tq, &adapter->stats_task, NULL)) + taskqueue_drain(adapter->stats_tq, &adapter->stats_task); + ena_free_io_irq(adapter); ena_destroy_all_io_queues(adapter); @@ -3627,6 +3637,18 @@ ena_attach(device_t pdev) taskqueue_start_threads(&adapter->reset_tq, 1, PI_NET, "%s rstq", device_get_nameunit(adapter->pdev)); + /* Initialize task queue responsible for updating hw stats */ + TASK_INIT(&adapter->stats_task, 0, ena_update_hw_stats, adapter); + adapter->stats_tq = taskqueue_create_fast("ena_stats_update", + M_WAITOK | M_ZERO, taskqueue_thread_enqueue, &adapter->stats_tq); + if (adapter->stats_tq == NULL) { + device_printf(adapter->pdev, + "Unable to create taskqueue for updating hw stats\n"); + goto err_stats_tq; + } + taskqueue_start_threads(&adapter->stats_tq, 1, PI_REALTIME, + "%s stats tq", device_get_nameunit(adapter->pdev)); + /* Initialize statistics */ ena_alloc_counters((counter_u64_t *)&adapter->dev_stats, sizeof(struct ena_stats_dev)); @@ -3639,6 +3661,8 @@ ena_attach(device_t pdev) adapter->running = true; return (0); +err_stats_tq: + taskqueue_free(adapter->reset_tq); err_reset_tq: ena_free_mgmnt_irq(adapter); ena_disable_msix(adapter); @@ -3693,6 +3717,8 @@ ena_detach(device_t pdev) sx_xlock(&adapter->ioctl_sx); ena_down(adapter); sx_unlock(&adapter->ioctl_sx); + + taskqueue_free(adapter->stats_tq); if (adapter->ifp != NULL) { ether_ifdetach(adapter->ifp); Modified: releng/11.1/sys/dev/ena/ena.h ============================================================================== --- stable/11/sys/dev/ena/ena.h Thu Jul 6 11:45:13 2017 (r320731) +++ releng/11.1/sys/dev/ena/ena.h Fri Jul 7 00:34:51 2017 (r320760) @@ -403,6 +403,10 @@ struct ena_adapter { uint32_t missing_tx_max_queues; uint32_t missing_tx_threshold; + /* Task updating hw stats */ + struct task stats_task; + struct taskqueue *stats_tq; + /* Statistics */ struct ena_stats_dev dev_stats; struct ena_hw_stats hw_stats; Modified: releng/11.1/sys/modules/Makefile ============================================================================== --- releng/11.1/sys/modules/Makefile Thu Jul 6 22:34:54 2017 (r320759) +++ releng/11.1/sys/modules/Makefile Fri Jul 7 00:34:51 2017 (r320760) @@ -109,6 +109,7 @@ SUBDIR= \ ${_efirt} \ ${_elink} \ ${_em} \ + ${_ena} \ en \ ${_ep} \ ${_epic} \ @@ -575,6 +576,7 @@ _drm= drm _drm2= drm2 _ed= ed _em= em +_ena= ena _ep= ep _et= et _exca= exca From owner-svn-src-releng@freebsd.org Fri Jul 7 06:29:20 2017 Return-Path: Delivered-To: svn-src-releng@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7B288D9B7C1; Fri, 7 Jul 2017 06:29:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 266726AAD3; Fri, 7 Jul 2017 06:29:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v676TJA0039810; Fri, 7 Jul 2017 06:29:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v676TIFh039801; Fri, 7 Jul 2017 06:29:18 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201707070629.v676TIFh039801@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 7 Jul 2017 06:29:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r320763 - in releng/11.1: lib/libc/sys sys/sys sys/vm X-SVN-Group: releng X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in releng/11.1: lib/libc/sys sys/sys sys/vm X-SVN-Commit-Revision: 320763 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jul 2017 06:29:20 -0000 Author: kib Date: Fri Jul 7 06:29:18 2017 New Revision: 320763 URL: https://svnweb.freebsd.org/changeset/base/320763 Log: Add MAP_GUARD and use it for stack grow area protection. Bump __FreeBSD_version. This is an MFS of stable/11 r320666. MFC r320317: Implement address space guards. MFC r320338: Remove stale part of the comment. MFC r320339: Correctly handle small MAP_STACK requests. MFC r320344: For now, allow mprotect(2) over the guards to succeed regardless of the requested protection. MFC r320430: Treat the addr argument for mmap(2) request without MAP_FIXED flag as a hint. MFC r320560 (by alc): Modify vm_map_growstack() to protect itself from the possibility of the gap entry in the vm map being smaller than the sysctl-derived stack guard size. Approved by: re (delphij) Modified: releng/11.1/lib/libc/sys/mmap.2 releng/11.1/lib/libc/sys/munmap.2 releng/11.1/sys/sys/mman.h releng/11.1/sys/sys/param.h releng/11.1/sys/vm/vm.h releng/11.1/sys/vm/vm_fault.c releng/11.1/sys/vm/vm_map.c releng/11.1/sys/vm/vm_map.h releng/11.1/sys/vm/vm_mmap.c Directory Properties: releng/11.1/ (props changed) Modified: releng/11.1/lib/libc/sys/mmap.2 ============================================================================== --- releng/11.1/lib/libc/sys/mmap.2 Fri Jul 7 05:43:44 2017 (r320762) +++ releng/11.1/lib/libc/sys/mmap.2 Fri Jul 7 06:29:18 2017 (r320763) @@ -199,6 +199,21 @@ In contrast, if .Dv MAP_EXCL is specified, the request will fail if a mapping already exists within the range. +.It Dv MAP_GUARD +Instead of a mapping, create a guard of the specified size. +Guards allow a process to create reservations in its address space, +which can later be replaced by actual mappings. +.Pp +.Fa mmap +will not create mappings in the address range of a guard unless +the request specifies +.Dv MAP_FIXED . +Guards can be destroyed with +.Xr munmap 2 . +Any memory access by a thread to the guarded range results +in the delivery of a +.Dv SIGSEGV +signal to that thread. .It Dv MAP_NOCORE Region is not included in a core file. .It Dv MAP_NOSYNC @@ -303,6 +318,7 @@ must include at least .Dv PROT_READ and .Dv PROT_WRITE . +.Pp This option creates a memory region that grows to at most .Fa len @@ -313,6 +329,10 @@ stack top is the starting address returned by the call bytes. The bottom of the stack at maximum growth is the starting address returned by the call. +The system uses guards to prevent the inadvertent use of +regions into which stacks created with +.Dv MAP_STACK +will automatically grow, without mapping the whole stack in advance. .El .Pp The @@ -406,6 +426,7 @@ were specified. .It Bq Er EINVAL None of .Dv MAP_ANON , +.Dv MAP_GUARD , .Dv MAP_PRIVATE , .Dv MAP_SHARED , or @@ -455,6 +476,25 @@ were specified, but the requested region is already us was specified, but .Dv MAP_FIXED was not. +.It Bq Er EINVAL +.Dv MAP_GUARD +was specified, but the +.Fa offset +argument was not zero, the +.Fa fd +argument was not -1, or the +.Fa prot +argument was not +.Dv PROT_NONE . +.It Bq Er EINVAL +.Dv MAP_GUARD +was specified together with one of the flags +.Dv MAP_ANON , +.Dv MAP_PREFAULT , +.Dv MAP_PREFAULT_READ , +.Dv MAP_PRIVATE , +.Dv MAP_SHARED , +.Dv MAP_STACK . .It Bq Er ENODEV .Dv MAP_ANON has not been specified and Modified: releng/11.1/lib/libc/sys/munmap.2 ============================================================================== --- releng/11.1/lib/libc/sys/munmap.2 Fri Jul 7 05:43:44 2017 (r320762) +++ releng/11.1/lib/libc/sys/munmap.2 Fri Jul 7 06:29:18 2017 (r320763) @@ -28,7 +28,7 @@ .\" @(#)munmap.2 8.3 (Berkeley) 5/27/94 .\" $FreeBSD$ .\" -.Dd May 27, 1994 +.Dd June 22, 2017 .Dt MUNMAP 2 .Os .Sh NAME @@ -44,7 +44,7 @@ The .Fn munmap system call -deletes the mappings for the specified address range, +deletes the mappings and guards for the specified address range, and causes further references to addresses within the range to generate invalid memory references. .Sh RETURN VALUES Modified: releng/11.1/sys/sys/mman.h ============================================================================== --- releng/11.1/sys/sys/mman.h Fri Jul 7 05:43:44 2017 (r320762) +++ releng/11.1/sys/sys/mman.h Fri Jul 7 06:29:18 2017 (r320763) @@ -90,6 +90,7 @@ /* * Extended flags */ +#define MAP_GUARD 0x00002000 /* reserve but don't map address range */ #define MAP_EXCL 0x00004000 /* for MAP_FIXED, fail if address is used */ #define MAP_NOCORE 0x00020000 /* dont include these pages in a coredump */ #define MAP_PREFAULT_READ 0x00040000 /* prefault mapping for reading */ Modified: releng/11.1/sys/sys/param.h ============================================================================== --- releng/11.1/sys/sys/param.h Fri Jul 7 05:43:44 2017 (r320762) +++ releng/11.1/sys/sys/param.h Fri Jul 7 06:29:18 2017 (r320763) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1101000 /* Master, propagated to newvers */ +#define __FreeBSD_version 1101001 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, @@ -76,12 +76,15 @@ #undef __FreeBSD_kernel__ #define __FreeBSD_kernel__ -#ifdef _KERNEL +#if defined(_KERNEL) || defined(IN_RTLD) #define P_OSREL_SIGWAIT 700000 #define P_OSREL_SIGSEGV 700004 #define P_OSREL_MAP_ANON 800104 #define P_OSREL_MAP_FSTRICT 1100036 #define P_OSREL_SHUTDOWN_ENOTCONN 1100077 +#define P_OSREL_MAP_GUARD 1200035 +#define P_OSREL_MAP_GUARD_11 1101501 +#define P_OSREL_MAP_GUARD_11_1 1101001 #define P_OSREL_MAJOR(x) ((x) / 100000) #endif Modified: releng/11.1/sys/vm/vm.h ============================================================================== --- releng/11.1/sys/vm/vm.h Fri Jul 7 05:43:44 2017 (r320762) +++ releng/11.1/sys/vm/vm.h Fri Jul 7 06:29:18 2017 (r320763) @@ -78,6 +78,7 @@ typedef u_char vm_prot_t; /* protection codes */ #define VM_PROT_WRITE ((vm_prot_t) 0x02) #define VM_PROT_EXECUTE ((vm_prot_t) 0x04) #define VM_PROT_COPY ((vm_prot_t) 0x08) /* copy-on-read */ +#define VM_PROT_FAULT_LOOKUP ((vm_prot_t) 0x010) #define VM_PROT_ALL (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE) #define VM_PROT_RW (VM_PROT_READ|VM_PROT_WRITE) Modified: releng/11.1/sys/vm/vm_fault.c ============================================================================== --- releng/11.1/sys/vm/vm_fault.c Fri Jul 7 05:43:44 2017 (r320762) +++ releng/11.1/sys/vm/vm_fault.c Fri Jul 7 06:29:18 2017 (r320763) @@ -495,13 +495,12 @@ vm_fault_hold(vm_map_t map, vm_offset_t vaddr, vm_prot int locked, nera, result, rv; u_char behavior; boolean_t wired; /* Passed by reference. */ - bool dead, growstack, hardfault, is_first_object_locked; + bool dead, hardfault, is_first_object_locked; PCPU_INC(cnt.v_vm_faults); fs.vp = NULL; faultcount = 0; nera = -1; - growstack = true; hardfault = false; RetryFault:; @@ -511,17 +510,10 @@ RetryFault:; * search. */ fs.map = map; - result = vm_map_lookup(&fs.map, vaddr, fault_type, &fs.entry, - &fs.first_object, &fs.first_pindex, &prot, &wired); + result = vm_map_lookup(&fs.map, vaddr, fault_type | + VM_PROT_FAULT_LOOKUP, &fs.entry, &fs.first_object, + &fs.first_pindex, &prot, &wired); if (result != KERN_SUCCESS) { - if (growstack && result == KERN_INVALID_ADDRESS && - map != kernel_map) { - result = vm_map_growstack(curproc, vaddr); - if (result != KERN_SUCCESS) - return (KERN_FAILURE); - growstack = false; - goto RetryFault; - } unlock_vp(&fs); return (result); } @@ -546,6 +538,8 @@ RetryFault:; vm_map_unlock(fs.map); goto RetryFault; } + + MPASS((fs.entry->eflags & MAP_ENTRY_GUARD) == 0); if (wired) fault_type = prot | (fault_type & VM_PROT_COPY); Modified: releng/11.1/sys/vm/vm_map.c ============================================================================== --- releng/11.1/sys/vm/vm_map.c Fri Jul 7 05:43:44 2017 (r320762) +++ releng/11.1/sys/vm/vm_map.c Fri Jul 7 06:29:18 2017 (r320763) @@ -133,6 +133,8 @@ static void _vm_map_init(vm_map_t map, pmap_t pmap, vm static void vm_map_entry_deallocate(vm_map_entry_t entry, boolean_t system_map); static void vm_map_entry_dispose(vm_map_t map, vm_map_entry_t entry); static void vm_map_entry_unwire(vm_map_t map, vm_map_entry_t entry); +static int vm_map_growstack(vm_map_t map, vm_offset_t addr, + vm_map_entry_t gap_entry); static void vm_map_pmap_enter(vm_map_t map, vm_offset_t addr, vm_prot_t prot, vm_object_t object, vm_pindex_t pindex, vm_size_t size, int flags); #ifdef INVARIANTS @@ -1214,6 +1216,10 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_oof if (prev_entry->next != &map->header && prev_entry->next->start < end) return (KERN_NO_SPACE); + if ((cow & MAP_CREATE_GUARD) != 0 && (object != NULL || + max != VM_PROT_NONE)) + return (KERN_INVALID_ARGUMENT); + protoeflags = 0; if (cow & MAP_COPY_ON_WRITE) protoeflags |= MAP_ENTRY_COW | MAP_ENTRY_NEEDS_COPY; @@ -1229,13 +1235,19 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_oof protoeflags |= MAP_ENTRY_GROWS_UP; if (cow & MAP_VN_WRITECOUNT) protoeflags |= MAP_ENTRY_VN_WRITECNT; + if ((cow & MAP_CREATE_GUARD) != 0) + protoeflags |= MAP_ENTRY_GUARD; + if ((cow & MAP_CREATE_STACK_GAP_DN) != 0) + protoeflags |= MAP_ENTRY_STACK_GAP_DN; + if ((cow & MAP_CREATE_STACK_GAP_UP) != 0) + protoeflags |= MAP_ENTRY_STACK_GAP_UP; if (cow & MAP_INHERIT_SHARE) inheritance = VM_INHERIT_SHARE; else inheritance = VM_INHERIT_DEFAULT; cred = NULL; - if (cow & (MAP_ACC_NO_CHARGE | MAP_NOFAULT)) + if ((cow & (MAP_ACC_NO_CHARGE | MAP_NOFAULT | MAP_CREATE_GUARD)) != 0) goto charged; if ((cow & MAP_ACC_CHARGED) || ((prot & VM_PROT_WRITE) && ((protoeflags & MAP_ENTRY_NEEDS_COPY) || object == NULL))) { @@ -1284,7 +1296,8 @@ charged: if (prev_entry->inheritance == inheritance && prev_entry->protection == prot && prev_entry->max_protection == max) { - map->size += end - prev_entry->end; + if ((prev_entry->eflags & MAP_ENTRY_GUARD) == 0) + map->size += end - prev_entry->end; prev_entry->end = end; vm_map_entry_resize_free(map, prev_entry); vm_map_simplify_entry(map, prev_entry); @@ -1321,7 +1334,6 @@ charged: new_entry->eflags = protoeflags; new_entry->object.vm_object = object; new_entry->offset = offset; - new_entry->avail_ssize = 0; new_entry->inheritance = inheritance; new_entry->protection = prot; @@ -1339,7 +1351,8 @@ charged: * Insert the new entry into the list */ vm_map_entry_link(map, prev_entry, new_entry); - map->size += new_entry->end - new_entry->start; + if ((new_entry->eflags & MAP_ENTRY_GUARD) == 0) + map->size += new_entry->end - new_entry->start; /* * Try to coalesce the new entry with both the previous and next @@ -1543,6 +1556,25 @@ again: return (result); } +int +vm_map_find_min(vm_map_t map, vm_object_t object, vm_ooffset_t offset, + vm_offset_t *addr, vm_size_t length, vm_offset_t min_addr, + vm_offset_t max_addr, int find_space, vm_prot_t prot, vm_prot_t max, + int cow) +{ + vm_offset_t hint; + int rv; + + hint = *addr; + for (;;) { + rv = vm_map_find(map, object, offset, addr, length, max_addr, + find_space, prot, max, cow); + if (rv == KERN_SUCCESS || min_addr >= hint) + return (rv); + *addr = min_addr; + } +} + /* * vm_map_simplify_entry: * @@ -1674,7 +1706,8 @@ _vm_map_clip_start(vm_map_t map, vm_map_entry_t entry, * map. This is a bit of a hack, but is also about the best place to * put this improvement. */ - if (entry->object.vm_object == NULL && !map->system_map) { + if (entry->object.vm_object == NULL && !map->system_map && + (entry->eflags & MAP_ENTRY_GUARD) == 0) { vm_object_t object; object = vm_object_allocate(OBJT_DEFAULT, atop(entry->end - entry->start)); @@ -1753,7 +1786,8 @@ _vm_map_clip_end(vm_map_t map, vm_map_entry_t entry, v * map. This is a bit of a hack, but is also about the best place to * put this improvement. */ - if (entry->object.vm_object == NULL && !map->system_map) { + if (entry->object.vm_object == NULL && !map->system_map && + (entry->eflags & MAP_ENTRY_GUARD) == 0) { vm_object_t object; object = vm_object_allocate(OBJT_DEFAULT, atop(entry->end - entry->start)); @@ -1988,6 +2022,8 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_off */ for (current = entry; current != &map->header && current->start < end; current = current->next) { + if ((current->eflags & MAP_ENTRY_GUARD) != 0) + continue; if (current->eflags & MAP_ENTRY_IS_SUB_MAP) { vm_map_unlock(map); return (KERN_INVALID_ARGUMENT); @@ -2010,7 +2046,8 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_off if (set_max || ((new_prot & ~(current->protection)) & VM_PROT_WRITE) == 0 || - ENTRY_CHARGED(current)) { + ENTRY_CHARGED(current) || + (current->eflags & MAP_ENTRY_GUARD) != 0) { continue; } @@ -2059,6 +2096,9 @@ vm_map_protect(vm_map_t map, vm_offset_t start, vm_off */ for (current = entry; current != &map->header && current->start < end; current = current->next) { + if ((current->eflags & MAP_ENTRY_GUARD) != 0) + continue; + old_prot = current->protection; if (set_max) @@ -2312,7 +2352,9 @@ vm_map_inherit(vm_map_t map, vm_offset_t start, vm_off entry = temp_entry->next; while ((entry != &map->header) && (entry->start < end)) { vm_map_clip_end(map, entry, end); - entry->inheritance = new_inheritance; + if ((entry->eflags & MAP_ENTRY_GUARD) == 0 || + new_inheritance != VM_INHERIT_ZERO) + entry->inheritance = new_inheritance; vm_map_simplify_entry(map, entry); entry = entry->next; } @@ -2918,6 +2960,15 @@ vm_map_entry_delete(vm_map_t map, vm_map_entry_t entry vm_map_entry_unlink(map, entry); object = entry->object.vm_object; + + if ((entry->eflags & MAP_ENTRY_GUARD) != 0) { + MPASS(entry->cred == NULL); + MPASS((entry->eflags & MAP_ENTRY_IS_SUB_MAP) == 0); + MPASS(object == NULL); + vm_map_entry_deallocate(entry, map->system_map); + return; + } + size = entry->end - entry->start; map->size -= size; @@ -3276,6 +3327,8 @@ vmspace_map_entry_forked(const struct vmspace *vm1, st vm_size_t entrysize; vm_offset_t newend; + if ((entry->eflags & MAP_ENTRY_GUARD) != 0) + return; entrysize = entry->end - entry->start; vm2->vm_map.size += entrysize; if (entry->eflags & (MAP_ENTRY_GROWS_DOWN | MAP_ENTRY_GROWS_UP)) { @@ -3312,6 +3365,7 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_c vm_map_entry_t new_entry, old_entry; vm_object_t object; int locked; + vm_inherit_t inh; old_map = &vm1->vm_map; /* Copy immutable fields of vm1 to vm2. */ @@ -3334,7 +3388,12 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_c if (old_entry->eflags & MAP_ENTRY_IS_SUB_MAP) panic("vm_map_fork: encountered a submap"); - switch (old_entry->inheritance) { + inh = old_entry->inheritance; + if ((old_entry->eflags & MAP_ENTRY_GUARD) != 0 && + inh != VM_INHERIT_NONE) + inh = VM_INHERIT_COPY; + + switch (inh) { case VM_INHERIT_NONE: break; @@ -3467,7 +3526,6 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_c new_entry->start = old_entry->start; new_entry->end = old_entry->end; - new_entry->avail_ssize = old_entry->avail_ssize; new_entry->eflags = old_entry->eflags & ~(MAP_ENTRY_USER_WIRED | MAP_ENTRY_IN_TRANSITION | MAP_ENTRY_VN_WRITECNT); @@ -3530,30 +3588,40 @@ out: return (rv); } +static int stack_guard_page = 1; +SYSCTL_INT(_security_bsd, OID_AUTO, stack_guard_page, CTLFLAG_RWTUN, + &stack_guard_page, 0, + "Specifies the number of guard pages for a stack that grows"); + static int vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, vm_size_t max_ssize, vm_size_t growsize, vm_prot_t prot, vm_prot_t max, int cow) { vm_map_entry_t new_entry, prev_entry; - vm_offset_t bot, top; - vm_size_t init_ssize; + vm_offset_t bot, gap_bot, gap_top, top; + vm_size_t init_ssize, sgp; int orient, rv; /* * The stack orientation is piggybacked with the cow argument. * Extract it into orient and mask the cow argument so that we * don't pass it around further. - * NOTE: We explicitly allow bi-directional stacks. */ - orient = cow & (MAP_STACK_GROWS_DOWN|MAP_STACK_GROWS_UP); + orient = cow & (MAP_STACK_GROWS_DOWN | MAP_STACK_GROWS_UP); KASSERT(orient != 0, ("No stack grow direction")); + KASSERT(orient != (MAP_STACK_GROWS_DOWN | MAP_STACK_GROWS_UP), + ("bi-dir stack")); + sgp = (vm_size_t)stack_guard_page * PAGE_SIZE; if (addrbos < vm_map_min(map) || addrbos > vm_map_max(map) || - addrbos + max_ssize < addrbos) + addrbos + max_ssize < addrbos || + sgp >= max_ssize) return (KERN_NO_SPACE); - init_ssize = (max_ssize < growsize) ? max_ssize : growsize; + init_ssize = growsize; + if (max_ssize < init_ssize + sgp) + init_ssize = max_ssize - sgp; /* If addr is already mapped, no go */ if (vm_map_lookup_entry(map, addrbos, &prev_entry)) @@ -3561,12 +3629,6 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, /* * If we can't accommodate max_ssize in the current mapping, no go. - * However, we need to be aware that subsequent user mappings might - * map into the space we have reserved for stack, and currently this - * space is not protected. - * - * Hopefully we will at least detect this condition when we try to - * grow the stack. */ if ((prev_entry->next != &map->header) && (prev_entry->next->start < addrbos + max_ssize)) @@ -3582,57 +3644,53 @@ vm_map_stack_locked(vm_map_t map, vm_offset_t addrbos, * and cow to be 0. Possibly we should eliminate these as input * parameters, and just pass these values here in the insert call. */ - if (orient == MAP_STACK_GROWS_DOWN) + if (orient == MAP_STACK_GROWS_DOWN) { bot = addrbos + max_ssize - init_ssize; - else if (orient == MAP_STACK_GROWS_UP) + top = bot + init_ssize; + gap_bot = addrbos; + gap_top = bot; + } else /* if (orient == MAP_STACK_GROWS_UP) */ { bot = addrbos; - else - bot = round_page(addrbos + max_ssize/2 - init_ssize/2); - top = bot + init_ssize; - rv = vm_map_insert(map, NULL, 0, bot, top, prot, max, cow); - - /* Now set the avail_ssize amount. */ - if (rv == KERN_SUCCESS) { - new_entry = prev_entry->next; - if (new_entry->end != top || new_entry->start != bot) - panic("Bad entry start/end for new stack entry"); - - new_entry->avail_ssize = max_ssize - init_ssize; - KASSERT((orient & MAP_STACK_GROWS_DOWN) == 0 || - (new_entry->eflags & MAP_ENTRY_GROWS_DOWN) != 0, - ("new entry lacks MAP_ENTRY_GROWS_DOWN")); - KASSERT((orient & MAP_STACK_GROWS_UP) == 0 || - (new_entry->eflags & MAP_ENTRY_GROWS_UP) != 0, - ("new entry lacks MAP_ENTRY_GROWS_UP")); + top = bot + init_ssize; + gap_bot = top; + gap_top = addrbos + max_ssize; } - + rv = vm_map_insert(map, NULL, 0, bot, top, prot, max, cow); + if (rv != KERN_SUCCESS) + return (rv); + new_entry = prev_entry->next; + KASSERT(new_entry->end == top || new_entry->start == bot, + ("Bad entry start/end for new stack entry")); + KASSERT((orient & MAP_STACK_GROWS_DOWN) == 0 || + (new_entry->eflags & MAP_ENTRY_GROWS_DOWN) != 0, + ("new entry lacks MAP_ENTRY_GROWS_DOWN")); + KASSERT((orient & MAP_STACK_GROWS_UP) == 0 || + (new_entry->eflags & MAP_ENTRY_GROWS_UP) != 0, + ("new entry lacks MAP_ENTRY_GROWS_UP")); + rv = vm_map_insert(map, NULL, 0, gap_bot, gap_top, VM_PROT_NONE, + VM_PROT_NONE, MAP_CREATE_GUARD | (orient == MAP_STACK_GROWS_DOWN ? + MAP_CREATE_STACK_GAP_DN : MAP_CREATE_STACK_GAP_UP)); + if (rv != KERN_SUCCESS) + (void)vm_map_delete(map, bot, top); return (rv); } -static int stack_guard_page = 0; -SYSCTL_INT(_security_bsd, OID_AUTO, stack_guard_page, CTLFLAG_RWTUN, - &stack_guard_page, 0, - "Insert stack guard page ahead of the growable segments."); - -/* Attempts to grow a vm stack entry. Returns KERN_SUCCESS if the - * desired address is already mapped, or if we successfully grow - * the stack. Also returns KERN_SUCCESS if addr is outside the - * stack range (this is strange, but preserves compatibility with - * the grow function in vm_machdep.c). +/* + * Attempts to grow a vm stack entry. Returns KERN_SUCCESS if we + * successfully grow the stack. */ -int -vm_map_growstack(struct proc *p, vm_offset_t addr) +static int +vm_map_growstack(vm_map_t map, vm_offset_t addr, vm_map_entry_t gap_entry) { - vm_map_entry_t next_entry, prev_entry; - vm_map_entry_t new_entry, stack_entry; - struct vmspace *vm = p->p_vmspace; - vm_map_t map = &vm->vm_map; - vm_offset_t end; - vm_size_t growsize; - size_t grow_amount, max_grow; - rlim_t lmemlim, stacklim, vmemlim; - int is_procstack, rv; + vm_map_entry_t stack_entry; + struct proc *p; + struct vmspace *vm; struct ucred *cred; + vm_offset_t gap_end, gap_start, grow_start; + size_t grow_amount, guard, max_grow; + rlim_t lmemlim, stacklim, vmemlim; + int rv, rv1; + bool gap_deleted, grow_down, is_procstack; #ifdef notyet uint64_t limit; #endif @@ -3640,125 +3698,74 @@ vm_map_growstack(struct proc *p, vm_offset_t addr) int error; #endif + p = curproc; + vm = p->p_vmspace; + MPASS(map == &p->p_vmspace->vm_map); + MPASS(!map->system_map); + + guard = stack_guard_page * PAGE_SIZE; lmemlim = lim_cur(curthread, RLIMIT_MEMLOCK); stacklim = lim_cur(curthread, RLIMIT_STACK); vmemlim = lim_cur(curthread, RLIMIT_VMEM); -Retry: - - vm_map_lock_read(map); - - /* If addr is already in the entry range, no need to grow.*/ - if (vm_map_lookup_entry(map, addr, &prev_entry)) { - vm_map_unlock_read(map); +retry: + /* If addr is not in a hole for a stack grow area, no need to grow. */ + if (gap_entry == NULL && !vm_map_lookup_entry(map, addr, &gap_entry)) + return (KERN_FAILURE); + if ((gap_entry->eflags & MAP_ENTRY_GUARD) == 0) return (KERN_SUCCESS); - } - - next_entry = prev_entry->next; - if (!(prev_entry->eflags & MAP_ENTRY_GROWS_UP)) { - /* - * This entry does not grow upwards. Since the address lies - * beyond this entry, the next entry (if one exists) has to - * be a downward growable entry. The entry list header is - * never a growable entry, so it suffices to check the flags. - */ - if (!(next_entry->eflags & MAP_ENTRY_GROWS_DOWN)) { - vm_map_unlock_read(map); - return (KERN_SUCCESS); - } - stack_entry = next_entry; + if ((gap_entry->eflags & MAP_ENTRY_STACK_GAP_DN) != 0) { + stack_entry = gap_entry->next; + if ((stack_entry->eflags & MAP_ENTRY_GROWS_DOWN) == 0 || + stack_entry->start != gap_entry->end) + return (KERN_FAILURE); + grow_amount = round_page(stack_entry->start - addr); + grow_down = true; + } else if ((gap_entry->eflags & MAP_ENTRY_STACK_GAP_UP) != 0) { + stack_entry = gap_entry->prev; + if ((stack_entry->eflags & MAP_ENTRY_GROWS_UP) == 0 || + stack_entry->end != gap_entry->start) + return (KERN_FAILURE); + grow_amount = round_page(addr + 1 - stack_entry->end); + grow_down = false; } else { - /* - * This entry grows upward. If the next entry does not at - * least grow downwards, this is the entry we need to grow. - * otherwise we have two possible choices and we have to - * select one. - */ - if (next_entry->eflags & MAP_ENTRY_GROWS_DOWN) { - /* - * We have two choices; grow the entry closest to - * the address to minimize the amount of growth. - */ - if (addr - prev_entry->end <= next_entry->start - addr) - stack_entry = prev_entry; - else - stack_entry = next_entry; - } else - stack_entry = prev_entry; + return (KERN_FAILURE); } - - if (stack_entry == next_entry) { - KASSERT(stack_entry->eflags & MAP_ENTRY_GROWS_DOWN, ("foo")); - KASSERT(addr < stack_entry->start, ("foo")); - end = (prev_entry != &map->header) ? prev_entry->end : - stack_entry->start - stack_entry->avail_ssize; - grow_amount = roundup(stack_entry->start - addr, PAGE_SIZE); - max_grow = stack_entry->start - end; - } else { - KASSERT(stack_entry->eflags & MAP_ENTRY_GROWS_UP, ("foo")); - KASSERT(addr >= stack_entry->end, ("foo")); - end = (next_entry != &map->header) ? next_entry->start : - stack_entry->end + stack_entry->avail_ssize; - grow_amount = roundup(addr + 1 - stack_entry->end, PAGE_SIZE); - max_grow = end - stack_entry->end; - } - - if (grow_amount > stack_entry->avail_ssize) { - vm_map_unlock_read(map); + max_grow = gap_entry->end - gap_entry->start; + if (guard > max_grow) return (KERN_NO_SPACE); - } - - /* - * If there is no longer enough space between the entries nogo, and - * adjust the available space. Note: this should only happen if the - * user has mapped into the stack area after the stack was created, - * and is probably an error. - * - * This also effectively destroys any guard page the user might have - * intended by limiting the stack size. - */ - if (grow_amount + (stack_guard_page ? PAGE_SIZE : 0) > max_grow) { - if (vm_map_lock_upgrade(map)) - goto Retry; - - stack_entry->avail_ssize = max_grow; - - vm_map_unlock(map); + max_grow -= guard; + if (grow_amount > max_grow) return (KERN_NO_SPACE); - } - is_procstack = (addr >= (vm_offset_t)vm->vm_maxsaddr && - addr < (vm_offset_t)p->p_sysent->sv_usrstack) ? 1 : 0; - /* * If this is the main process stack, see if we're over the stack * limit. */ - if (is_procstack && (ctob(vm->vm_ssize) + grow_amount > stacklim)) { - vm_map_unlock_read(map); + is_procstack = addr >= (vm_offset_t)vm->vm_maxsaddr && + addr < (vm_offset_t)p->p_sysent->sv_usrstack; + if (is_procstack && (ctob(vm->vm_ssize) + grow_amount > stacklim)) return (KERN_NO_SPACE); - } + #ifdef RACCT if (racct_enable) { PROC_LOCK(p); if (is_procstack && racct_set(p, RACCT_STACK, ctob(vm->vm_ssize) + grow_amount)) { PROC_UNLOCK(p); - vm_map_unlock_read(map); return (KERN_NO_SPACE); } PROC_UNLOCK(p); } #endif - /* Round up the grow amount modulo sgrowsiz */ - growsize = sgrowsiz; - grow_amount = roundup(grow_amount, growsize); - if (grow_amount > stack_entry->avail_ssize) - grow_amount = stack_entry->avail_ssize; + grow_amount = roundup(grow_amount, sgrowsiz); + if (grow_amount > max_grow) + grow_amount = max_grow; if (is_procstack && (ctob(vm->vm_ssize) + grow_amount > stacklim)) { grow_amount = trunc_page((vm_size_t)stacklim) - ctob(vm->vm_ssize); } + #ifdef notyet PROC_LOCK(p); limit = racct_get_available(p, RACCT_STACK); @@ -3766,9 +3773,9 @@ Retry: if (is_procstack && (ctob(vm->vm_ssize) + grow_amount > limit)) grow_amount = limit - ctob(vm->vm_ssize); #endif - if (!old_mlock && map->flags & MAP_WIREFUTURE) { + + if (!old_mlock && (map->flags & MAP_WIREFUTURE) != 0) { if (ptoa(pmap_wired_count(map->pmap)) + grow_amount > lmemlim) { - vm_map_unlock_read(map); rv = KERN_NO_SPACE; goto out; } @@ -3778,7 +3785,6 @@ Retry: if (racct_set(p, RACCT_MEMLOCK, ptoa(pmap_wired_count(map->pmap)) + grow_amount)) { PROC_UNLOCK(p); - vm_map_unlock_read(map); rv = KERN_NO_SPACE; goto out; } @@ -3786,9 +3792,9 @@ Retry: } #endif } + /* If we would blow our VMEM resource limit, no go */ if (map->size + grow_amount > vmemlim) { - vm_map_unlock_read(map); rv = KERN_NO_SPACE; goto out; } @@ -3797,7 +3803,6 @@ Retry: PROC_LOCK(p); if (racct_set(p, RACCT_VMEM, map->size + grow_amount)) { PROC_UNLOCK(p); - vm_map_unlock_read(map); rv = KERN_NO_SPACE; goto out; } @@ -3805,62 +3810,42 @@ Retry: } #endif - if (vm_map_lock_upgrade(map)) - goto Retry; + if (vm_map_lock_upgrade(map)) { + gap_entry = NULL; + vm_map_lock_read(map); + goto retry; + } - if (stack_entry == next_entry) { - /* - * Growing downward. - */ - /* Get the preliminary new entry start value */ - addr = stack_entry->start - grow_amount; - - /* - * If this puts us into the previous entry, cut back our - * growth to the available space. Also, see the note above. - */ - if (addr < end) { - stack_entry->avail_ssize = max_grow; - addr = end; - if (stack_guard_page) - addr += PAGE_SIZE; + if (grow_down) { + grow_start = gap_entry->end - grow_amount; + if (gap_entry->start + grow_amount == gap_entry->end) { + gap_start = gap_entry->start; + gap_end = gap_entry->end; + vm_map_entry_delete(map, gap_entry); + gap_deleted = true; + } else { + MPASS(gap_entry->start < gap_entry->end - grow_amount); + gap_entry->end -= grow_amount; + vm_map_entry_resize_free(map, gap_entry); + gap_deleted = false; } - - rv = vm_map_insert(map, NULL, 0, addr, stack_entry->start, - next_entry->protection, next_entry->max_protection, + rv = vm_map_insert(map, NULL, 0, grow_start, + grow_start + grow_amount, + stack_entry->protection, stack_entry->max_protection, MAP_STACK_GROWS_DOWN); - - /* Adjust the available stack space by the amount we grew. */ - if (rv == KERN_SUCCESS) { - new_entry = prev_entry->next; - KASSERT(new_entry == stack_entry->prev, ("foo")); - KASSERT(new_entry->end == stack_entry->start, ("foo")); - KASSERT(new_entry->start == addr, ("foo")); - KASSERT((new_entry->eflags & MAP_ENTRY_GROWS_DOWN) != - 0, ("new entry lacks MAP_ENTRY_GROWS_DOWN")); - grow_amount = new_entry->end - new_entry->start; - new_entry->avail_ssize = stack_entry->avail_ssize - - grow_amount; - stack_entry->eflags &= ~MAP_ENTRY_GROWS_DOWN; + if (rv != KERN_SUCCESS) { + if (gap_deleted) { + rv1 = vm_map_insert(map, NULL, 0, gap_start, + gap_end, VM_PROT_NONE, VM_PROT_NONE, + MAP_CREATE_GUARD | MAP_CREATE_STACK_GAP_DN); + MPASS(rv1 == KERN_SUCCESS); + } else { + gap_entry->end += grow_amount; + vm_map_entry_resize_free(map, gap_entry); + } } } else { - /* - * Growing upward. - */ - addr = stack_entry->end + grow_amount; - - /* - * If this puts us into the next entry, cut back our growth - * to the available space. Also, see the note above. - */ - if (addr > end) { - stack_entry->avail_ssize = end - stack_entry->end; - addr = end; - if (stack_guard_page) - addr -= PAGE_SIZE; - } - - grow_amount = addr - stack_entry->end; + grow_start = stack_entry->end; cred = stack_entry->cred; if (cred == NULL && stack_entry->object.vm_object != NULL) cred = stack_entry->object.vm_object->cred; @@ -3872,30 +3857,30 @@ Retry: stack_entry->offset, (vm_size_t)(stack_entry->end - stack_entry->start), (vm_size_t)grow_amount, cred != NULL)) { - map->size += (addr - stack_entry->end); - /* Update the current entry. */ - stack_entry->end = addr; - stack_entry->avail_ssize -= grow_amount; + if (gap_entry->start + grow_amount == gap_entry->end) + vm_map_entry_delete(map, gap_entry); + else + gap_entry->start += grow_amount; + stack_entry->end += grow_amount; + map->size += grow_amount; vm_map_entry_resize_free(map, stack_entry); rv = KERN_SUCCESS; } else rv = KERN_FAILURE; } - if (rv == KERN_SUCCESS && is_procstack) vm->vm_ssize += btoc(grow_amount); - vm_map_unlock(map); - /* * Heed the MAP_WIREFUTURE flag if it was set for this process. */ - if (rv == KERN_SUCCESS && (map->flags & MAP_WIREFUTURE)) { - vm_map_wire(map, - (stack_entry == next_entry) ? addr : addr - grow_amount, - (stack_entry == next_entry) ? stack_entry->start : addr, + if (rv == KERN_SUCCESS && (map->flags & MAP_WIREFUTURE) != 0) { + vm_map_unlock(map); + vm_map_wire(map, grow_start, grow_start + grow_amount, VM_MAP_WIRE_USER | VM_MAP_WIRE_NOHOLES); - } + vm_map_lock_read(map); + } else + vm_map_lock_downgrade(map); out: #ifdef RACCT @@ -4019,10 +4004,11 @@ vm_map_lookup(vm_map_t *var_map, /* IN/OUT */ vm_size_t size; struct ucred *cred; -RetryLookup:; +RetryLookup: vm_map_lock_read(map); +RetryLookupLocked: /* * Lookup the faulting address. */ @@ -4048,7 +4034,16 @@ RetryLookup:; * Check whether this task is allowed to have this page. */ prot = entry->protection; - fault_type &= (VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE); + if ((fault_typea & VM_PROT_FAULT_LOOKUP) != 0) { + fault_typea &= ~VM_PROT_FAULT_LOOKUP; + if (prot == VM_PROT_NONE && map != kernel_map && + (entry->eflags & MAP_ENTRY_GUARD) != 0 && + (entry->eflags & (MAP_ENTRY_STACK_GAP_DN | + MAP_ENTRY_STACK_GAP_UP)) != 0 && + vm_map_growstack(map, vaddr, entry) == KERN_SUCCESS) + goto RetryLookupLocked; + } + fault_type &= VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE; if ((fault_type & prot) != fault_type || prot == VM_PROT_NONE) { vm_map_unlock_read(map); return (KERN_PROTECTION_FAILURE); @@ -4282,8 +4277,9 @@ vm_map_print(vm_map_t map) db_indent += 2; for (entry = map->header.next; entry != &map->header; entry = entry->next) { - db_iprintf("map entry %p: start=%p, end=%p\n", - (void *)entry, (void *)entry->start, (void *)entry->end); + db_iprintf("map entry %p: start=%p, end=%p, eflags=%#x, \n", + (void *)entry, (void *)entry->start, (void *)entry->end, + entry->eflags); { static char *inheritance_name[4] = {"share", "copy", "none", "donate_copy"}; Modified: releng/11.1/sys/vm/vm_map.h ============================================================================== --- releng/11.1/sys/vm/vm_map.h Fri Jul 7 05:43:44 2017 (r320762) +++ releng/11.1/sys/vm/vm_map.h Fri Jul 7 06:29:18 2017 (r320763) @@ -103,7 +103,6 @@ struct vm_map_entry { struct vm_map_entry *right; /* right child in binary search tree */ vm_offset_t start; /* start address */ vm_offset_t end; /* end address */ - vm_offset_t avail_ssize; /* amt can grow if this is a stack */ vm_offset_t next_read; /* vaddr of the next sequential read */ vm_size_t adj_free; /* amount of adjacent free space */ vm_size_t max_free; /* max free space in subtree */ @@ -142,6 +141,9 @@ struct vm_map_entry { #define MAP_ENTRY_WIRE_SKIPPED 0x4000 #define MAP_ENTRY_VN_WRITECNT 0x8000 /* writeable vnode mapping */ +#define MAP_ENTRY_GUARD 0x10000 +#define MAP_ENTRY_STACK_GAP_DN 0x20000 +#define MAP_ENTRY_STACK_GAP_UP 0x40000 #ifdef _KERNEL static __inline u_char @@ -315,6 +317,7 @@ long vmspace_resident_count(struct vmspace *vmspace); #define MAP_PREFAULT_PARTIAL 0x0010 #define MAP_DISABLE_SYNCER 0x0020 #define MAP_CHECK_EXCL 0x0040 +#define MAP_CREATE_GUARD 0x0080 #define MAP_DISABLE_COREDUMP 0x0100 #define MAP_PREFAULT_MADVISE 0x0200 /* from (user) madvise request */ #define MAP_VN_WRITECOUNT 0x0400 @@ -322,6 +325,8 @@ long vmspace_resident_count(struct vmspace *vmspace); #define MAP_STACK_GROWS_UP 0x2000 #define MAP_ACC_CHARGED 0x4000 #define MAP_ACC_NO_CHARGE 0x8000 +#define MAP_CREATE_STACK_GAP_UP 0x10000 +#define MAP_CREATE_STACK_GAP_DN 0x20000 /* * vm_fault option flags @@ -367,6 +372,8 @@ vm_map_t vm_map_create(pmap_t, vm_offset_t, vm_offset_ int vm_map_delete(vm_map_t, vm_offset_t, vm_offset_t); int vm_map_find(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t *, vm_size_t, vm_offset_t, int, vm_prot_t, vm_prot_t, int); +int vm_map_find_min(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t *, + vm_size_t, vm_offset_t, vm_offset_t, int, vm_prot_t, vm_prot_t, int); int vm_map_fixed(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t, vm_size_t, vm_prot_t, vm_prot_t, int); int vm_map_findspace (vm_map_t, vm_offset_t, vm_size_t, vm_offset_t *); @@ -387,7 +394,6 @@ int vm_map_submap (vm_map_t, vm_offset_t, vm_offset_t, int vm_map_sync(vm_map_t, vm_offset_t, vm_offset_t, boolean_t, boolean_t); int vm_map_madvise (vm_map_t, vm_offset_t, vm_offset_t, int); int vm_map_stack (vm_map_t, vm_offset_t, vm_size_t, vm_prot_t, vm_prot_t, int); -int vm_map_growstack (struct proc *p, vm_offset_t addr); int vm_map_unwire(vm_map_t map, vm_offset_t start, vm_offset_t end, int flags); int vm_map_wire(vm_map_t map, vm_offset_t start, vm_offset_t end, Modified: releng/11.1/sys/vm/vm_mmap.c ============================================================================== --- releng/11.1/sys/vm/vm_mmap.c Fri Jul 7 05:43:44 2017 (r320762) +++ releng/11.1/sys/vm/vm_mmap.c Fri Jul 7 06:29:18 2017 (r320763) @@ -226,7 +226,7 @@ kern_mmap(struct thread *td, uintptr_t addr0, size_t s *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-releng@freebsd.org Fri Jul 7 15:00:26 2017 Return-Path: Delivered-To: svn-src-releng@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 85503DA5041; Fri, 7 Jul 2017 15:00:26 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4DE7A7D13E; Fri, 7 Jul 2017 15:00:26 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v67F0PVj053334; Fri, 7 Jul 2017 15:00:25 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v67F0PEp053333; Fri, 7 Jul 2017 15:00:25 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201707071500.v67F0PEp053333@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 7 Jul 2017 15:00:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r320778 - releng/11.1/release X-SVN-Group: releng X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: releng/11.1/release X-SVN-Commit-Revision: 320778 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jul 2017 15:00:26 -0000 Author: gjb Date: Fri Jul 7 15:00:25 2017 New Revision: 320778 URL: https://svnweb.freebsd.org/changeset/base/320778 Log: MFS11 r320753: MFC r320748: Allow passing NOPKG= to make(1) to enable the pkg-stage target from getting executed when NOPKG is defined but empty. Approved by: re (kib) Sponsored by: The FreeBSD Foundation Modified: releng/11.1/release/Makefile Directory Properties: releng/11.1/ (props changed) Modified: releng/11.1/release/Makefile ============================================================================== --- releng/11.1/release/Makefile Fri Jul 7 13:55:11 2017 (r320777) +++ releng/11.1/release/Makefile Fri Jul 7 15:00:25 2017 (r320778) @@ -265,7 +265,7 @@ packagesystem: base.txz kernel.txz ${EXTRA_PACKAGES} touch ${.TARGET} pkg-stage: -.if !defined(NOPKG) +.if !defined(NOPKG) || empty(NOPKG) env PORTSDIR=${PORTSDIR} REPOS_DIR=${.CURDIR}/pkg_repos/ \ sh ${.CURDIR}/scripts/pkg-stage.sh mkdir -p ${.OBJDIR}/dvd/packages/repos/ From owner-svn-src-releng@freebsd.org Fri Jul 7 15:01:11 2017 Return-Path: Delivered-To: svn-src-releng@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78ABDDA50CC; Fri, 7 Jul 2017 15:01:11 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 45DD57D2E2; Fri, 7 Jul 2017 15:01:11 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v67F1AgY055819; Fri, 7 Jul 2017 15:01:10 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v67F1AqI055818; Fri, 7 Jul 2017 15:01:10 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201707071501.v67F1AqI055818@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 7 Jul 2017 15:01:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r320779 - releng/11.1/sys/conf X-SVN-Group: releng X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: releng/11.1/sys/conf X-SVN-Commit-Revision: 320779 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jul 2017 15:01:11 -0000 Author: gjb Date: Fri Jul 7 15:01:10 2017 New Revision: 320779 URL: https://svnweb.freebsd.org/changeset/base/320779 Log: Rename releng/11.1 to RC2 as part of the 11.1-RELEASE cycle. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: releng/11.1/sys/conf/newvers.sh Modified: releng/11.1/sys/conf/newvers.sh ============================================================================== --- releng/11.1/sys/conf/newvers.sh Fri Jul 7 15:00:25 2017 (r320778) +++ releng/11.1/sys/conf/newvers.sh Fri Jul 7 15:01:10 2017 (r320779) @@ -44,7 +44,7 @@ TYPE="FreeBSD" REVISION="11.1" -BRANCH="RC1" +BRANCH="RC2" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-releng@freebsd.org Fri Jul 7 15:41:48 2017 Return-Path: Delivered-To: svn-src-releng@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8AB2EDA636B; Fri, 7 Jul 2017 15:41:48 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 554DD7F2E8; Fri, 7 Jul 2017 15:41:48 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v67FflR4074046; Fri, 7 Jul 2017 15:41:47 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v67FflKp074043; Fri, 7 Jul 2017 15:41:47 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201707071541.v67FflKp074043@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 7 Jul 2017 15:41:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r320783 - in releng/11.1/release/doc: en_US.ISO8859-1/relnotes share/xml X-SVN-Group: releng X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: in releng/11.1/release/doc: en_US.ISO8859-1/relnotes share/xml X-SVN-Commit-Revision: 320783 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 07 Jul 2017 15:41:48 -0000 Author: gjb Date: Fri Jul 7 15:41:47 2017 New Revision: 320783 URL: https://svnweb.freebsd.org/changeset/base/320783 Log: Document r320760, ena(4) addition. Add the ena(4) manual page. Add Amazon.com to the sponsors.ent file. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: releng/11.1/release/doc/en_US.ISO8859-1/relnotes/article.xml releng/11.1/release/doc/share/xml/release.ent releng/11.1/release/doc/share/xml/sponsor.ent Modified: releng/11.1/release/doc/en_US.ISO8859-1/relnotes/article.xml ============================================================================== --- releng/11.1/release/doc/en_US.ISO8859-1/relnotes/article.xml Fri Jul 7 15:35:42 2017 (r320782) +++ releng/11.1/release/doc/en_US.ISO8859-1/relnotes/article.xml Fri Jul 7 15:41:47 2017 (r320783) @@ -785,6 +785,11 @@ The &os; virtual machines provided on Amazon® EC2™ now enable IPv6 by default. + + The + &man.ena.4; driver has been added, providing support for + "next generation" Enhanced Networking on the + Amazon® EC2™ platform. Modified: releng/11.1/release/doc/share/xml/release.ent ============================================================================== --- releng/11.1/release/doc/share/xml/release.ent Fri Jul 7 15:35:42 2017 (r320782) +++ releng/11.1/release/doc/share/xml/release.ent Fri Jul 7 15:41:47 2017 (r320783) @@ -80,3 +80,6 @@ + + +ena4"> Modified: releng/11.1/release/doc/share/xml/sponsor.ent ============================================================================== --- releng/11.1/release/doc/share/xml/sponsor.ent Fri Jul 7 15:35:42 2017 (r320782) +++ releng/11.1/release/doc/share/xml/sponsor.ent Fri Jul 7 15:41:47 2017 (r320783) @@ -10,6 +10,7 @@ + From owner-svn-src-releng@freebsd.org Sat Jul 8 04:53:13 2017 Return-Path: Delivered-To: svn-src-releng@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B2057D907FC; Sat, 8 Jul 2017 04:53:13 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7F049743CA; Sat, 8 Jul 2017 04:53:13 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v684rCgr002695; Sat, 8 Jul 2017 04:53:12 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v684rCGq002693; Sat, 8 Jul 2017 04:53:12 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201707080453.v684rCGq002693@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 8 Jul 2017 04:53:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r320800 - releng/11.1/libexec/rtld-elf X-SVN-Group: releng X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: releng/11.1/libexec/rtld-elf X-SVN-Commit-Revision: 320800 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-releng@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the release engineering / security commits to the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Jul 2017 04:53:13 -0000 Author: delphij Date: Sat Jul 8 04:53:12 2017 New Revision: 320800 URL: https://svnweb.freebsd.org/changeset/base/320800 Log: MFS r320799: MFC r320665: In open_binary_fd: when using buffer size for strl* and snprintf, always use >= instead of > to avoid truncation. Approved by: re (kib) Modified: releng/11.1/libexec/rtld-elf/rtld.c Directory Properties: releng/11.1/ (props changed) Modified: releng/11.1/libexec/rtld-elf/rtld.c ============================================================================== --- releng/11.1/libexec/rtld-elf/rtld.c Sat Jul 8 04:30:11 2017 (r320799) +++ releng/11.1/libexec/rtld-elf/rtld.c Sat Jul 8 04:53:12 2017 (r320800) @@ -5295,14 +5295,14 @@ open_binary_fd(const char *argv0, bool search_in_path) fd = -1; errno = ENOENT; while ((pe = strsep(&pathenv, ":")) != NULL) { - if (strlcpy(binpath, pe, sizeof(binpath)) > + if (strlcpy(binpath, pe, sizeof(binpath)) >= sizeof(binpath)) continue; if (binpath[0] != '\0' && - strlcat(binpath, "/", sizeof(binpath)) > + strlcat(binpath, "/", sizeof(binpath)) >= sizeof(binpath)) continue; - if (strlcat(binpath, argv0, sizeof(binpath)) > + if (strlcat(binpath, argv0, sizeof(binpath)) >= sizeof(binpath)) continue; fd = open(binpath, O_RDONLY | O_CLOEXEC | O_VERIFY);