From owner-svn-src-stable@freebsd.org Sun May 19 04:56:04 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1D9C15A2F6F; Sun, 19 May 2019 04:56:03 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 993DB76D0D; Sun, 19 May 2019 04:56:03 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C70B2241; Sun, 19 May 2019 04:56:03 +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 x4J4u39K001642; Sun, 19 May 2019 04:56:03 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4J4u38X001641; Sun, 19 May 2019 04:56:03 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201905190456.x4J4u38X001641@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 19 May 2019 04:56:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r347965 - stable/12/usr.sbin/ntp/ntpd X-SVN-Group: stable-12 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/12/usr.sbin/ntp/ntpd X-SVN-Commit-Revision: 347965 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 993DB76D0D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.954,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 May 2019 04:56:04 -0000 Author: delphij Date: Sun May 19 04:56:02 2019 New Revision: 347965 URL: https://svnweb.freebsd.org/changeset/base/347965 Log: MFC r347488,347606: Update leap-seconds to leap-seconds.3676924800. Modified: stable/12/usr.sbin/ntp/ntpd/leap-seconds Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/ntp/ntpd/leap-seconds ============================================================================== --- stable/12/usr.sbin/ntp/ntpd/leap-seconds Sat May 18 21:20:38 2019 (r347964) +++ stable/12/usr.sbin/ntp/ntpd/leap-seconds Sun May 19 04:56:02 2019 (r347965) @@ -61,7 +61,12 @@ # or # Terry Quinn, "The BIPM and the Accurate Measurement # of Time," Proc. of the IEEE, Vol. 79, pp. 894-905, -# July, 1991. +# July, 1991. +# reprinted in: +# Christine Hackman and Donald B Sullivan (eds.) +# Time and Frequency Measurement +# American Association of Physics Teachers (1996) +# , pp. 75-86 # # 4. The decision to insert a leap second into UTC is currently # the responsibility of the International Earth Rotation and @@ -199,10 +204,10 @@ # current -- the update time stamp, the data and the name of the file # will not change. # -# Updated through IERS Bulletin C53 -# File expires on: 28 December 2017 +# Updated through IERS Bulletin C57 +# File expires on: 28 December 2019 # -#@ 3723408000 +#@ 3786480000 # 2272060800 10 # 1 Jan 1972 2287785600 11 # 1 Jul 1972 @@ -247,4 +252,4 @@ # the hash line is also ignored in the # computation. # -#h 62cf8c5d 8bbb6dcc c61e3b56 c308343 869bb80d +#h 83c68138 d3650221 07dbbbcd 11fcc859 ced1106a From owner-svn-src-stable@freebsd.org Sun May 19 09:24:52 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF74615A8CDE; Sun, 19 May 2019 09:24:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 520D086563; Sun, 19 May 2019 09:24:52 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2715951F1; Sun, 19 May 2019 09:24:52 +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 x4J9OqPH041749; Sun, 19 May 2019 09:24:52 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4J9OqQp041748; Sun, 19 May 2019 09:24:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201905190924.x4J9OqQp041748@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 19 May 2019 09:24:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r347970 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 347970 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 520D086563 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 May 2019 09:24:52 -0000 Author: kib Date: Sun May 19 09:24:51 2019 New Revision: 347970 URL: https://svnweb.freebsd.org/changeset/base/347970 Log: MFC r347690, r347946: imgact_elf.c: Add comment explaining the malloc/VOP_UNLOCK() dance from r347148. Modified: stable/12/sys/kern/imgact_elf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/imgact_elf.c ============================================================================== --- stable/12/sys/kern/imgact_elf.c Sun May 19 09:23:20 2019 (r347969) +++ stable/12/sys/kern/imgact_elf.c Sun May 19 09:24:51 2019 (r347970) @@ -958,12 +958,22 @@ __elfN(get_interp)(struct image_params *imgp, const El interp_name_len = phdr->p_filesz; if (phdr->p_offset > PAGE_SIZE || interp_name_len > PAGE_SIZE - phdr->p_offset) { + /* + * The vnode lock might be needed by the pagedaemon to + * clean pages owned by the vnode. Do not allow sleep + * waiting for memory with the vnode locked, instead + * try non-sleepable allocation first, and if it + * fails, go to the slow path were we drop the lock + * and do M_WAITOK. A text reference prevents + * modifications to the vnode content. + */ interp = malloc(interp_name_len + 1, M_TEMP, M_NOWAIT); if (interp == NULL) { VOP_UNLOCK(imgp->vp, 0); interp = malloc(interp_name_len + 1, M_TEMP, M_WAITOK); vn_lock(imgp->vp, LK_EXCLUSIVE | LK_RETRY); } + error = vn_rdwr(UIO_READ, imgp->vp, interp, interp_name_len, phdr->p_offset, UIO_SYSSPACE, IO_NODELOCKED, td->td_ucred, From owner-svn-src-stable@freebsd.org Sun May 19 13:14:26 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EE18C15ADED7; Sun, 19 May 2019 13:14:25 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2E37D8C37E; Sun, 19 May 2019 13:14:25 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x4JDENJk069404; Sun, 19 May 2019 06:14:23 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x4JDENmf069403; Sun, 19 May 2019 06:14:23 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201905191314.x4JDENmf069403@gndrsh.dnsmgr.net> Subject: Re: svn commit: r347962 - in stable/11: share/man/man4 share/man/man4/man4.i386 share/man/man4/man4.powerpc sys/dev/bm sys/dev/cs sys/dev/de sys/dev/ed sys/dev/ep sys/dev/ex sys/dev/fe sys/dev/pcn sys/... In-Reply-To: <201905182043.x4IKhDdD038241@repo.freebsd.org> To: Brooks Davis Date: Sun, 19 May 2019 06:14:23 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 2E37D8C37E X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.93 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.933,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 May 2019 13:14:26 -0000 > Author: brooks > Date: Sat May 18 20:43:13 2019 > New Revision: 347962 > URL: https://svnweb.freebsd.org/changeset/base/347962 > > Log: > MFC r339703, r347365, r347703, r347940 > > r339703: > Deprecate a number of less used 10 and 10/100 Ethernet devices. > > The current deprecated list is: ae, bm, cs, de, dme, ed, ep, ex, fe, > pcn, sf, sn, tl, tx, txp, vx, wb, xe > > The list as refined as part of FCP-0101. Per the FCP, devices may be > removed from the deprecation list if enough users are found or they are > converted to iflib. > > FCP: https://github.com/freebsd/fcp/blob/master/fcp-0101.md > > r347365: > Update dme(4) to reflect that it will not be removed due to FCP-101. > > dme(4) is the built-in NIC on a couple non-expandable mips platforms and > thus should remain. The FCP has been updated to reflect this fact. > > Discussed with: imp > > r347703: > FCP-101: ae(4) is sufficently popular to be moved to the keep list. > > r347940: > Remove the notice that ae(4) will be removed in FreeBSD 13. > > MFC requested by: rgrimes > Approved by: re (kib) Thank you for following through with gettings this back to stable/11 for the upcoming release. Rod > Modified: > stable/11/share/man/man4/de.4 > stable/11/share/man/man4/ed.4 > stable/11/share/man/man4/man4.i386/cs.4 > stable/11/share/man/man4/man4.i386/ep.4 > stable/11/share/man/man4/man4.i386/ex.4 > stable/11/share/man/man4/man4.i386/fe.4 > stable/11/share/man/man4/man4.i386/vx.4 > stable/11/share/man/man4/man4.powerpc/bm.4 > stable/11/share/man/man4/pcn.4 > stable/11/share/man/man4/sf.4 > stable/11/share/man/man4/sn.4 > stable/11/share/man/man4/tl.4 > stable/11/share/man/man4/tx.4 > stable/11/share/man/man4/txp.4 > stable/11/share/man/man4/wb.4 > stable/11/share/man/man4/xe.4 > stable/11/sys/dev/bm/if_bm.c > stable/11/sys/dev/cs/if_cs.c > stable/11/sys/dev/de/if_de.c > stable/11/sys/dev/ed/if_ed.c > stable/11/sys/dev/ep/if_ep.c > stable/11/sys/dev/ex/if_ex.c > stable/11/sys/dev/fe/if_fe.c > stable/11/sys/dev/pcn/if_pcn.c > stable/11/sys/dev/sf/if_sf.c > stable/11/sys/dev/sn/if_sn.c > stable/11/sys/dev/tl/if_tl.c > stable/11/sys/dev/tx/if_tx.c > stable/11/sys/dev/txp/if_txp.c > stable/11/sys/dev/vx/if_vx.c > stable/11/sys/dev/wb/if_wb.c > stable/11/sys/dev/xe/if_xe.c > stable/11/sys/sys/systm.h > Directory Properties: > stable/11/ (props changed) > > Modified: stable/11/share/man/man4/de.4 > ============================================================================== > --- stable/11/share/man/man4/de.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/de.4 Sat May 18 20:43:13 2019 (r347962) > @@ -25,7 +25,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 16, 2005 > +.Dd October 24, 2018 > .Dt DE 4 > .Os > .Sh NAME > @@ -45,6 +45,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_de_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/ed.4 > ============================================================================== > --- stable/11/share/man/man4/ed.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/ed.4 Sat May 18 20:43:13 2019 (r347962) > @@ -30,7 +30,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd February 25, 2012 > +.Dd October 24, 2018 > .Dt ED 4 > .Os > .Sh NAME > @@ -51,6 +51,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_ed_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/man4.i386/cs.4 > ============================================================================== > --- stable/11/share/man/man4/man4.i386/cs.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/man4.i386/cs.4 Sat May 18 20:43:13 2019 (r347962) > @@ -25,7 +25,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 16, 2005 > +.Dd October 24 2018 > .Dt CS 4 i386 > .Os > .Sh NAME > @@ -52,6 +52,14 @@ In > .Cd hint.cs.0.port="0x300" > .Cd hint.cs.0.irq="10" > .Cd hint.cs.0.maddr="0xd000" > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/man4.i386/ep.4 > ============================================================================== > --- stable/11/share/man/man4/man4.i386/ep.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/man4.i386/ep.4 Sat May 18 20:43:13 2019 (r347962) > @@ -29,7 +29,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd April 1, 2011 > +.Dd October 24, 2018 > .Dt EP 4 i386 > .Os > .Sh NAME > @@ -49,6 +49,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_ep_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/man4.i386/ex.4 > ============================================================================== > --- stable/11/share/man/man4/man4.i386/ex.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/man4.i386/ex.4 Sat May 18 20:43:13 2019 (r347962) > @@ -25,7 +25,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 16, 2005 > +.Dd October 24, 2018 > .Dt EX 4 i386 > .Os > .Sh NAME > @@ -45,6 +45,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_ex_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/man4.i386/fe.4 > ============================================================================== > --- stable/11/share/man/man4/man4.i386/fe.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/man4.i386/fe.4 Sat May 18 20:43:13 2019 (r347962) > @@ -22,7 +22,7 @@ > .\" for fe driver. > .\" > .\" $FreeBSD$ > -.Dd July 16, 2005 > +.Dd October 24, 2018 > .Dt FE 4 i386 > .Os > .Sh NAME > @@ -48,6 +48,14 @@ In > .Cd hint.fe.0.at="isa" > .Cd hint.fe.0.port="0x300" > .Cd hint.fe.0.flags="0x0" > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/man4.i386/vx.4 > ============================================================================== > --- stable/11/share/man/man4/man4.i386/vx.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/man4.i386/vx.4 Sat May 18 20:43:13 2019 (r347962) > @@ -30,7 +30,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 16, 2005 > +.Dd October 24, 2018 > .Dt VX 4 i386 > .Os > .Sh NAME > @@ -50,6 +50,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_vx_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/man4.powerpc/bm.4 > ============================================================================== > --- stable/11/share/man/man4/man4.powerpc/bm.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/man4.powerpc/bm.4 Sat May 18 20:43:13 2019 (r347962) > @@ -25,7 +25,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 3, 2008 > +.Dd October 24, 2018 > .Dt BM 4 > .Os > .Sh NAME > @@ -46,6 +46,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_bm_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/pcn.4 > ============================================================================== > --- stable/11/share/man/man4/pcn.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/pcn.4 Sat May 18 20:43:13 2019 (r347962) > @@ -31,7 +31,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd January 31, 2006 > +.Dd October 24, 2018 > .Dt PCN 4 > .Os > .Sh NAME > @@ -52,6 +52,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_pcn_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/sf.4 > ============================================================================== > --- stable/11/share/man/man4/sf.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/sf.4 Sat May 18 20:43:13 2019 (r347962) > @@ -30,7 +30,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd January 21, 2008 > +.Dd October 24, 2018 > .Dt SF 4 > .Os > .Sh NAME > @@ -53,6 +53,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_sf_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/sn.4 > ============================================================================== > --- stable/11/share/man/man4/sn.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/sn.4 Sat May 18 20:43:13 2019 (r347962) > @@ -24,7 +24,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 16, 2005 > +.Dd October 24, 2018 > .Dt SN 4 > .Os > .Sh NAME > @@ -44,6 +44,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_sn_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/tl.4 > ============================================================================== > --- stable/11/share/man/man4/tl.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/tl.4 Sat May 18 20:43:13 2019 (r347962) > @@ -30,7 +30,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 16, 2005 > +.Dd October 24, 2018 > .Dt TL 4 > .Os > .Sh NAME > @@ -51,6 +51,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_tl_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/tx.4 > ============================================================================== > --- stable/11/share/man/man4/tx.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/tx.4 Sat May 18 20:43:13 2019 (r347962) > @@ -25,7 +25,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 16, 2005 > +.Dd October 24, 2018 > .Dt TX 4 > .Os > .Sh NAME > @@ -46,6 +46,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_tx_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/txp.4 > ============================================================================== > --- stable/11/share/man/man4/txp.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/txp.4 Sat May 18 20:43:13 2019 (r347962) > @@ -26,7 +26,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd January 26, 2012 > +.Dd October 24, 2018 > .Dt TXP 4 > .Os > .Sh NAME > @@ -46,6 +46,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_txp_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/wb.4 > ============================================================================== > --- stable/11/share/man/man4/wb.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/wb.4 Sat May 18 20:43:13 2019 (r347962) > @@ -30,7 +30,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 16, 2005 > +.Dd October 24, 2018 > .Dt WB 4 > .Os > .Sh NAME > @@ -51,6 +51,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_wb_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/share/man/man4/xe.4 > ============================================================================== > --- stable/11/share/man/man4/xe.4 Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/share/man/man4/xe.4 Sat May 18 20:43:13 2019 (r347962) > @@ -25,7 +25,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd July 16, 2005 > +.Dd October 24 2018 > .Dt XE 4 > .Os > .Sh NAME > @@ -45,6 +45,14 @@ module at boot time, place the following line in > .Bd -literal -offset indent > if_xe_load="YES" > .Ed > +.Sh DEPRECATION NOTICE > +The > +.Nm > +driver is not present in > +.Fx 13.0 > +and later. > +See https://github.com/freebsd/fcp/blob/master/fcp-0101.md for more > +information. > .Sh DESCRIPTION > The > .Nm > > Modified: stable/11/sys/dev/bm/if_bm.c > ============================================================================== > --- stable/11/sys/dev/bm/if_bm.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/bm/if_bm.c Sat May 18 20:43:13 2019 (r347962) > @@ -481,6 +481,8 @@ bm_attach(device_t dev) > ether_ifattach(ifp, sc->sc_enaddr); > ifp->if_hwassist = 0; > > + gone_by_fcp101_dev(dev); > + > return (0); > } > > > Modified: stable/11/sys/dev/cs/if_cs.c > ============================================================================== > --- stable/11/sys/dev/cs/if_cs.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/cs/if_cs.c Sat May 18 20:43:13 2019 (r347962) > @@ -572,6 +572,8 @@ cs_attach(device_t dev) > return (error); > } > > + gone_by_fcp101_dev(dev); > + > return (0); > } > > > Modified: stable/11/sys/dev/de/if_de.c > ============================================================================== > --- stable/11/sys/dev/de/if_de.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/de/if_de.c Sat May 18 20:43:13 2019 (r347962) > @@ -4430,6 +4430,8 @@ tulip_attach(tulip_softc_t * const sc) > TULIP_LOCK(sc); > sc->tulip_flags &= ~TULIP_DEVICEPROBE; > TULIP_UNLOCK(sc); > + > + gone_by_fcp101_dev(sc->tulip_dev); > } > > /* Release memory for a single descriptor ring. */ > > Modified: stable/11/sys/dev/ed/if_ed.c > ============================================================================== > --- stable/11/sys/dev/ed/if_ed.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/ed/if_ed.c Sat May 18 20:43:13 2019 (r347962) > @@ -363,6 +363,9 @@ ed_attach(device_t dev) > #endif > printf("\n"); > } > + > + gone_by_fcp101_dev(dev); > + > return (0); > } > > > Modified: stable/11/sys/dev/ep/if_ep.c > ============================================================================== > --- stable/11/sys/dev/ep/if_ep.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/ep/if_ep.c Sat May 18 20:43:13 2019 (r347962) > @@ -348,6 +348,8 @@ ep_attach(struct ep_softc *sc) > epstop(sc); > EP_UNLOCK(sc); > > + gone_by_fcp101_dev(sc->dev); > + > return (0); > } > > > Modified: stable/11/sys/dev/ex/if_ex.c > ============================================================================== > --- stable/11/sys/dev/ex/if_ex.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/ex/if_ex.c Sat May 18 20:43:13 2019 (r347962) > @@ -274,6 +274,8 @@ ex_attach(device_t dev) > return (error); > } > > + gone_by_fcp101_dev(dev); > + > return(0); > } > > > Modified: stable/11/sys/dev/fe/if_fe.c > ============================================================================== > --- stable/11/sys/dev/fe/if_fe.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/fe/if_fe.c Sat May 18 20:43:13 2019 (r347962) > @@ -870,6 +870,8 @@ fe_attach (device_t dev) > if (sc->stability & UNSTABLE_TYPE) > device_printf(dev, "warning: hardware type was not validated\n"); > > + gone_by_fcp101_dev(dev); > + > return 0; > } > > > Modified: stable/11/sys/dev/pcn/if_pcn.c > ============================================================================== > --- stable/11/sys/dev/pcn/if_pcn.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/pcn/if_pcn.c Sat May 18 20:43:13 2019 (r347962) > @@ -680,6 +680,8 @@ fail: > if (error) > pcn_detach(dev); > > + gone_by_fcp101_dev(dev); > + > return(error); > } > > > Modified: stable/11/sys/dev/sf/if_sf.c > ============================================================================== > --- stable/11/sys/dev/sf/if_sf.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/sf/if_sf.c Sat May 18 20:43:13 2019 (r347962) > @@ -914,6 +914,8 @@ sf_attach(device_t dev) > goto fail; > } > > + gone_by_fcp101_dev(dev); > + > fail: > if (error) > sf_detach(dev); > > Modified: stable/11/sys/dev/sn/if_sn.c > ============================================================================== > --- stable/11/sys/dev/sn/if_sn.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/sn/if_sn.c Sat May 18 20:43:13 2019 (r347962) > @@ -225,6 +225,9 @@ sn_attach(device_t dev) > sn_detach(dev); > return err; > } > + > + gone_by_fcp101_dev(dev); > + > return 0; > } > > > Modified: stable/11/sys/dev/tl/if_tl.c > ============================================================================== > --- stable/11/sys/dev/tl/if_tl.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/tl/if_tl.c Sat May 18 20:43:13 2019 (r347962) > @@ -1239,6 +1239,8 @@ tl_attach(dev) > goto fail; > } > > + gone_by_fcp101_dev(dev); > + > fail: > if (error) > tl_detach(dev); > > Modified: stable/11/sys/dev/tx/if_tx.c > ============================================================================== > --- stable/11/sys/dev/tx/if_tx.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/tx/if_tx.c Sat May 18 20:43:13 2019 (r347962) > @@ -426,6 +426,8 @@ epic_attach(device_t dev) > goto fail; > } > > + gone_by_fcp101_dev(dev); > + > return (0); > fail: > epic_release(sc); > > Modified: stable/11/sys/dev/txp/if_txp.c > ============================================================================== > --- stable/11/sys/dev/txp/if_txp.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/txp/if_txp.c Sat May 18 20:43:13 2019 (r347962) > @@ -471,6 +471,8 @@ txp_attach(device_t dev) > goto fail; > } > > + gone_by_fcp101_dev(dev); > + > return (0); > > fail: > > Modified: stable/11/sys/dev/vx/if_vx.c > ============================================================================== > --- stable/11/sys/dev/vx/if_vx.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/vx/if_vx.c Sat May 18 20:43:13 2019 (r347962) > @@ -204,6 +204,8 @@ vx_attach(device_t dev) > vx_stop(sc); > VX_UNLOCK(sc); > > + gone_by_fcp101_dev(dev); > + > return 1; > } > > > Modified: stable/11/sys/dev/wb/if_wb.c > ============================================================================== > --- stable/11/sys/dev/wb/if_wb.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/wb/if_wb.c Sat May 18 20:43:13 2019 (r347962) > @@ -692,6 +692,8 @@ wb_attach(dev) > goto fail; > } > > + gone_by_fcp101_dev(dev); > + > fail: > if (error) > wb_detach(dev); > > Modified: stable/11/sys/dev/xe/if_xe.c > ============================================================================== > --- stable/11/sys/dev/xe/if_xe.c Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/dev/xe/if_xe.c Sat May 18 20:43:13 2019 (r347962) > @@ -315,6 +315,8 @@ xe_attach(device_t dev) > return (err); > } > > + gone_by_fcp101_dev(dev); > + > /* Done */ > return (0); > } > > Modified: stable/11/sys/sys/systm.h > ============================================================================== > --- stable/11/sys/sys/systm.h Sat May 18 19:36:23 2019 (r347961) > +++ stable/11/sys/sys/systm.h Sat May 18 20:43:13 2019 (r347962) > @@ -482,6 +482,9 @@ void _gone_in_dev(struct device *dev, int major, const > #endif > #define gone_in(major, msg) __gone_ok(major, msg) _gone_in(major, msg) > #define gone_in_dev(dev, major, msg) __gone_ok(major, msg) _gone_in_dev(dev, major, msg) > +#define gone_by_fcp101_dev(dev) \ > + gone_in_dev((dev), 13, \ > + "see https://github.com/freebsd/fcp/blob/master/fcp-0101.md") > > __NULLABILITY_PRAGMA_POP > > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-stable@freebsd.org Sun May 19 15:55:51 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C68A715B15AF; Sun, 19 May 2019 15:55:51 +0000 (UTC) (envelope-from ota@j.email.ne.jp) Received: from mail03.asahi-net.or.jp (mail03.asahi-net.or.jp [202.224.55.15]) by mx1.freebsd.org (Postfix) with ESMTP id 17B6F6A501; Sun, 19 May 2019 15:55:49 +0000 (UTC) (envelope-from ota@j.email.ne.jp) Received: from vmware.advok.com (pool-72-76-119-135.nwrknj.fios.verizon.net [72.76.119.135]) (Authenticated sender: NR2Y-OOT) by mail03.asahi-net.or.jp (Postfix) with ESMTPSA id 05A1B43A04; Mon, 20 May 2019 00:55:45 +0900 (JST) Date: Sun, 19 May 2019 11:54:56 -0400 From: Yoshihiro Ota To: rgrimes@freebsd.org Cc: "Rodney W. Grimes" , Benedict Reuschling , src-committers@freebsd.org, svn-src-stable@freebsd.org, svn-src-all@freebsd.org, svn-src-stable-12@freebsd.org, Bruce Evans , Konstantin Belousov Subject: Re: svn commit: r347951 - stable/12/lib/libc/stdlib Message-Id: <20190519115456.40571481c85c9f178657d6b9@j.email.ne.jp> In-Reply-To: <201905181306.x4ID6piX064982@gndrsh.dnsmgr.net> References: <201905181306.x4ID6piX064982@gndrsh.dnsmgr.net> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; i386-portbld-freebsd12.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 17B6F6A501 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of ota@j.email.ne.jp designates 202.224.55.15 as permitted sender) smtp.mailfrom=ota@j.email.ne.jp X-Spamd-Result: default: False [-0.79 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[15.55.224.202.list.dnswl.org : 127.0.5.1]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:202.224.55.0/24]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[email.ne.jp]; NEURAL_HAM_LONG(-0.98)[-0.980,0]; NEURAL_SPAM_SHORT(0.49)[0.491,0]; RECEIVED_SPAMHAUS_PBL(0.00)[135.119.76.72.zen.spamhaus.org : 127.0.0.10]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[sbmx.asahi-net.or.jp]; RCPT_COUNT_SEVEN(0.00)[9]; NEURAL_HAM_MEDIUM(-0.57)[-0.575,0]; IP_SCORE(0.08)[asn: 4685(0.47), country: JP(-0.05)]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:4685, ipnet:202.224.32.0/19, country:JP]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 May 2019 15:55:52 -0000 I wonder if we can use a tool to confirm coding style like clang-format or something else. I tried to setup clang-format and 2 others in the past like a year ago but wasn't able to do... Hiro On Sat, 18 May 2019 06:06:51 -0700 (PDT) "Rodney W. Grimes" wrote: > > Hello Konstantin and Bruce, > > > > thank you for your comments. Clearly, this should have been addressed in > > the review and checked by a second pair of eyes. I mostly did the man > > page changes and can't comment much on the actual coding example. Two > > people (dab and jilles) approved the revision in the Phabricator review. > > There was plenty of time to review it between April 16 and May 15 when > > then the original submitter asked if there was anything else that needs > > to be done. > > The quality of a code review is highly dependent on who is invited > to do the reviewing, and how much participation and care those invited > have with respect to the process. Man pages that contain code samples > need to have more reviewers, you need man page experts, you need subject > mater experts, and you need coding experts. This review could of used > more reviewers (hind sight is 20/20) but if they had not been the right > reviewers the low quality commit would of probably still occurred. > > The amount of time in review is not a good measure of review completness, > that falls more onto the quality of the workmanship of those actually > commented on a review. I myself consider a LGTM, or a accept by a reviewer > who makes 0 comments on my code in phab as if that reviewer probably > just rubber stamped my change, UNLESS I have extremly high trust in > that person. If bde, imp, or kib stamp an approve on something of mine my > confidence level is very high and I do consider that code well reviewed, > if I get a rubber stamp from some others I am not so confident. > > Now we have the problem in that note every code review can be done by > such high quality engineers due to time and work load constraints, so > we need to raise the level of others closer to these shinning stars > and offset this lack of avaliable resources by other means (more > reviewers, long review cycles, automations, etc.) > > > > Now, having said that and the the change is now both in HEAD and > > stable/12, how do we proceed? Revert them both or patch those issues as > > follow-ups? Note that a src committer should do that and not me trying > > to add more EXAMPLE sections to man pages with my doc commit bit. > > There is another option, a revert is actually a local operation > to your checked out code, ou can check out head, revert this > commit, but do not commit, make the corrections, and then commit. > > When MFC's this single commit does the right thing. > > You could also revert in head, commit and later fix these > issues, commit, and then MFC both of those commits. > > All of your proposed solutions, and my additions are workable, > and I really have no preference on a single file change like > this. > > Good Day, > Rod > > > Regards, > > Benedict > > > > > > > > Am 18.05.19 um 07:45 schrieb Bruce Evans: > > > On Sat, 18 May 2019, Konstantin Belousov wrote: > > > > > >> On Sat, May 18, 2019 at 03:15:08AM +0000, Benedict Reuschling wrote: > > >>> Author: bcr (doc committer) > > >>> Date: Sat May 18 03:15:07 2019 > > >>> New Revision: 347951 > > >>> URL: https://svnweb.freebsd.org/changeset/base/347951 > > >>> > > >>> Log: > > >>> ? MFC r347617: > > >>> ? Add small EXAMPLE section to bsearch.3. > > >>> > > >>> ? Submitted by:??????????? fernape (via Phabricator) > > >>> ? Reviewed by:??????????? bcr, jilles, dab > > >>> ? Approved by:??????????? bcr (man pages), jilles (src) > > >>> ? Differential Revision:??????? https://reviews.freebsd.org/D19902 > > >>> > > >>> Modified: > > >>> ? stable/12/lib/libc/stdlib/bsearch.3 > > >>> Directory Properties: > > >>> ? stable/12/?? (props changed) > > >>> > > >>> Modified: stable/12/lib/libc/stdlib/bsearch.3 > > >>> ============================================================================== > > >>> > > >>> --- stable/12/lib/libc/stdlib/bsearch.3??? Sat May 18 02:02:14 > > >>> 2019??? (r347950) > > >>> +++ stable/12/lib/libc/stdlib/bsearch.3??? Sat May 18 03:15:07 > > >>> 2019??? (r347951) > > >>> @@ -32,7 +32,7 @@ > > >>> ?.\"???? @(#)bsearch.3??? 8.3 (Berkeley) 4/19/94 > > >>> ?.\" $FreeBSD$ > > >>> ?.\" > > >>> -.Dd February 22, 2013 > > >>> +.Dd May 15, 2019 > > >>> ?.Dt BSEARCH 3 > > >>> ?.Os > > >>> ?.Sh NAME > > >>> @@ -83,6 +83,61 @@ The > > >>> ?function returns a pointer to a matching member of the array, or a null > > >>> ?pointer if no match is found. > > >>> ?If two members compare as equal, which member is matched is > > >>> unspecified. > > >>> +.Sh EXAMPLES > > >>> +A sample program that searches people by age in a sorted array: > > >>> +.Bd -literal > > >>> +#include > > >>> +#include > > >>> +#include > > >>> +#include > > >>> +#include > > >>> + > > >>> +struct person { > > >>> +??? char name[5]; > > >>> +??? int age; > > >>> +}; > > > > > > This example has a high density of style bugs.? kib pointed out some. > > > Some of the others are: > > > > > > (1) Not sorting the struct members on alignment.? (style(9) says to sort > > > ??? on use, then size, but means alignment). > > > (2) Not indenting the struct member names. > > > (3) Not use a prefix for struct member names.? This is not important for > > > ??? small programs. > > > > > >>> + > > >>> +int > > >>> +compare(const void *key, const void *array_member) > > >>> +{ > > >>> +??? int age = (intptr_t) key; > > >>> +??? struct person person = *(struct person *) array_member; > > >> These two lines contain at least three style(9) bugs, and at least one > > >> warning at higher warning level. > > >> > > >>> + > > >>> +??? return (age - person.age); > > >>> +} > > >>> + > > >>> +int > > >>> +main() > > >> Why use K&R definition ? > > >> > > >>> +{ > > >>> +??? struct person *friend; > > >>> + > > >>> +??? /* Sorted array */ > > >>> +??? struct person friends[6] = { > > >>> +??????? { "paul", 22 }, > > >>> +??????? { "anne", 25 }, > > >>> +??????? { "fred", 25 }, > > >>> +??????? { "mary", 27 }, > > >>> +??????? { "mark", 35 }, > > >>> +??????? { "bill", 50 } > > >>> +??? }; > > >>> + > > >>> +??? size_t array_size = sizeof(friends) / sizeof(struct person); > > >> Since you used const elsewere, why did not you used it there ? > > > > > > (4) The size expression is obfuscated by spelling the element size as > > > ??? sizeof(struct person) instead of sizeof(friends[0]). > > > (5?) FreeBSD now spells this size expression as nitems(friends).? I don't > > > ??? like the unportability of this, especially in an example. > > > > > >> > > >>> + > > >>> +??? friend = bsearch((void *)22, &friends, array_size, sizeof(struct > > >>> person), compare); > > >> Taking address of an array is weird. > > >> Line is too long. > > > > > > (6) C99 specifies that the search is for a member of the array that matches > > > ??? the object pointed to by 'key'.? Here the key of (void *)22 is a > > > ??? not a pointer to an object.? It is a cookie which points to garbage. > > > ??? The cookie is unique enough to work in practice.? Perhaps you can > > > ??? prove it to always work if the option type intptr_t is supported. > > > ??? But this is a bad example. > > > (4a) same obfuscation of the element size. > > > > > >> > > >>> +??? assert(strcmp(friend->name, "paul") == 0); > > >>> +??? printf("name: %s\enage: %d\en", friend->name, friend->age); > > >>> + > > > > > > (7) Extra blank line.? This is not too bad, but is not done consistently. > > > > > >>> +??? friend = bsearch((void *)25, &friends, array_size, sizeof(struct > > >>> person), compare); > > > > > > (8) More too-long lines. > > > (4b) More sizeof(person)'s. > > > > > >>> +??? assert(strcmp(friend->name, "fred") == 0 || strcmp(friend->name, > > >>> "anne") == 0); > > > > > > (7a) No extra blank line for "fred". > > > > > >>> +??? printf("name: %s\enage: %d\en", friend->name, friend->age); > > >>> + > > >>> +??? friend = bsearch((void *)30, &friends, array_size, sizeof(struct > > >>> person), compare); > > >>> +??? assert(friend == NULL); > > >>> +??? printf("friend aged 30 not found\en"); > > > > > > I didn't notice before that the key cookie was an encoding of the age. > > > > > > The key is not unique (there are 2 25's).? This gives an example of low > > > quality data and the example has minimal error handling handling for this > > > without describing what it is doing (it asserts uniqueness for age 22 and > > > it asserts one of the 2 possibilities for age 25.? It can only do this > > > because it knows too much about the data). > > > > > > It is more than a style bug to handle errors in data by assert() or > > > otherwise killing the program, except possibly when the data is supposed > > > to be good. > > > > > >>> + > > >>> +??? return (EXIT_SUCCESS); > > >>> +} > > >>> +.Ed > > >>> ?.Sh SEE ALSO > > >>> ?.Xr db 3 , > > >>> ?.Xr lsearch 3 , > > > > > > Bruce > > > > > > -- > Rod Grimes rgrimes@freebsd.org > _______________________________________________ > svn-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" From owner-svn-src-stable@freebsd.org Sun May 19 18:31:23 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E774F158AEF0; Sun, 19 May 2019 18:31:22 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 832FE6F675; Sun, 19 May 2019 18:31:22 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 59BD6AD92; Sun, 19 May 2019 18:31:22 +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 x4JIVM97026315; Sun, 19 May 2019 18:31:22 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4JIVMc0026314; Sun, 19 May 2019 18:31:22 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201905191831.x4JIVMc0026314@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sun, 19 May 2019 18:31:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347977 - stable/11/etc/ntp X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/11/etc/ntp X-SVN-Commit-Revision: 347977 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 832FE6F675 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 May 2019 18:31:23 -0000 Author: delphij Date: Sun May 19 18:31:21 2019 New Revision: 347977 URL: https://svnweb.freebsd.org/changeset/base/347977 Log: MFC r347488,347606: Update leap-seconds to leap-seconds.3676924800. Approved by: re (kib) Modified: stable/11/etc/ntp/leap-seconds Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/ntp/leap-seconds ============================================================================== --- stable/11/etc/ntp/leap-seconds Sun May 19 17:53:36 2019 (r347976) +++ stable/11/etc/ntp/leap-seconds Sun May 19 18:31:21 2019 (r347977) @@ -61,7 +61,12 @@ # or # Terry Quinn, "The BIPM and the Accurate Measurement # of Time," Proc. of the IEEE, Vol. 79, pp. 894-905, -# July, 1991. +# July, 1991. +# reprinted in: +# Christine Hackman and Donald B Sullivan (eds.) +# Time and Frequency Measurement +# American Association of Physics Teachers (1996) +# , pp. 75-86 # # 4. The decision to insert a leap second into UTC is currently # the responsibility of the International Earth Rotation and @@ -199,10 +204,10 @@ # current -- the update time stamp, the data and the name of the file # will not change. # -# Updated through IERS Bulletin C53 -# File expires on: 28 December 2017 +# Updated through IERS Bulletin C57 +# File expires on: 28 December 2019 # -#@ 3723408000 +#@ 3786480000 # 2272060800 10 # 1 Jan 1972 2287785600 11 # 1 Jul 1972 @@ -247,4 +252,4 @@ # the hash line is also ignored in the # computation. # -#h 62cf8c5d 8bbb6dcc c61e3b56 c308343 869bb80d +#h 83c68138 d3650221 07dbbbcd 11fcc859 ced1106a From owner-svn-src-stable@freebsd.org Sun May 19 18:57:10 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C11B0158B884; Sun, 19 May 2019 18:57:09 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from mxout1bln1.prossl.de (mxout1bln1.prossl.de [91.233.87.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 164EF706EE; Sun, 19 May 2019 18:57:08 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from Voyager-109.local ([207.164.22.10]) (authenticated bits=0) by mx1bln1.prossl.de (8.15.2/8.14.9) with ESMTPSA id x4JIv2GX095222 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 19 May 2019 20:57:04 +0200 Subject: Re: svn commit: r347951 - stable/12/lib/libc/stdlib To: Yoshihiro Ota , rgrimes@freebsd.org Cc: "Rodney W. Grimes" , src-committers@freebsd.org, svn-src-stable@freebsd.org, svn-src-all@freebsd.org, svn-src-stable-12@freebsd.org, Bruce Evans , Konstantin Belousov , Ed Maste References: <201905181306.x4ID6piX064982@gndrsh.dnsmgr.net> <20190519115456.40571481c85c9f178657d6b9@j.email.ne.jp> From: Benedict Reuschling Openpgp: preference=signencrypt Autocrypt: addr=bcr@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFr4feYBCACdrnRpuvW/d/PeKuFu54ifaGhG+yFf3wnWaQX8hTCvySbv6A24Owot6cyU vhjdsifZ9iRQ82Likl+6OxI9qBXR9N+WCv1ut46q+mL50YLnYRejRCz8vEmVunlyVDKjsBY5 DtjsaRXMJ/D56wh3ROd9VYjrDHWobu+bg9D7RIv0kCyoPd0JsYRFXISgt4IocWVLT8ciWqiT Pp3m37BPrtXhR3EDOnHmGWPf6SuolvveqyOlpdguD3LAkFJDLeq3isnMaLXUhcsTqBTBLdOT 6EJHBYCcq39izNVC88JsVBmEuByhpb0LaXrBFQWhUG5RyecROAqrx+DWhcZnxayCtr3NABEB AAG0N0JlbmVkaWN0IFJldXNjaGxpbmcgKHd3dy5mcmVlYnNkLm9yZykgPGJjckBGcmVlQlNE Lm9yZz6JAVQEEwEKAD4CGwMFCwkIBwMFFQoJCAsFFgIDAQACHgECF4AWIQRTQnZtbeuE5dPj 3Pah0MHTBYXRWAUCWviOpwUJA8J3wQAKCRCh0MHTBYXRWJfJB/9qxBylB2KlA5EkdhyOp9cO O8kGpx301Rg6I/IUDACmDRvZckthpaUlNJ/RBYtid12o9A9kIhabdEaZfoBcV+ehyq3iSnff 9U+YlXkQ0iOflujWfgyMKNmaseWAPl6aCYc4gUsRH6YTVJFANPdofAIghEFLeY4jPsfkCIPP SAzUK1kQDtsHc5zwTYltqiKRBxQe1Y8WftitRp4LkTkR2wxWggp5oS6yKzh0kRir+U+5pFWZ 9g4ZQGxqodp8fKHI1IsJvs921UArjbmtLmDbrd28SK96i5ck4xga6mPf7ShhE9haYy1A+cbK fDhwizaJUl/H3jjXXbPv1MuIsvo+qEKVuQENBFr4f7wBCACxULIM5UFaEyZwAojYMXwIF/QW zq20MXaQXjn2JxJp04VaQHCL794ZrNtvkTvyqxYVFCKjvJHPXsT4zKuglMSTi83choejs7DJ 4YNmBBJKDHbugAcb5OgdTaT+ztUGl1VL4S3iEvWJwBAOUuzd9TTC/4GhYnUJR7A0CeEZnPfF av2K+d8BZ8x/XryFgQo3Wi5FnOekwls4v1wzzJE4ssaW4p357fmXRG2Czzytzf/W3I2/VWFm 2J8P8TIzSoJq+girktqhH+dYwbDeWkldWj6egcMdpVzJ89ottXARQYeu6YFSHnmHHnBhX2hV z+K2WkVLqYwj7XdBQAtPxIk8VlMBABEBAAGJAnIEGAEKACYCGwIWIQRTQnZtbeuE5dPj3Pah 0MHTBYXRWAUCWviOsgUJA8J19gFAwHQgBBkBCgAdFiEEwXonQDvNfP/33IoBVXQ7/QHhjTUF Alr4f7wACgkQVXQ7/QHhjTWg7Qf/WzBvcfskO8HBHfmLEE5zJRIOgogl6kVwvwR6PjihhMFC iBeH2fGz8nTtkouSttcbMnLnmV0qVv/r5FgIohTlEimaQUh7LgQKiql2SdYVpF1ha/3NHerR 1Rc0OGW+eliseI9b9/OKkY1AOaRM98HGJZB6TO2iKf2wiJDjr1RdlN2VcCST+ksG2Ehc3RvZ UTY1Kw5i9BOKsTsiQkrpCsrZ2/0tqvwv7efYJ0FOHfm0WbmvAlfdpxqsWmtgdsa0m/ItBtpo zIhlZs8/BlOmDK5571bAmWOV0apXSgp6OTmeQkpIsJKjwj/JwOhzvfkxZv03Js4+51xKjotT ma8XGjnJKgkQodDB0wWF0Vj+Wwf/f5cEjvLmq+Xw0KYjPA8oqk9L5a4Z9J/BdeH630koZ2wP YUwUsF/rFfdZf7jHvJJas1I0ctsutvhlgu4Elb7kJrfNRMSXUXe8ucdPS/cH9M/y9e7flW3i c/Ik14rV1Z1E9ME0CtDzfUtS3BfhyxpgmHbQmgPv/NkCE8Zu+nU/1QInpi7ZrDWWyJOCndcm R4kZpP0MJ0OCTWGDkDtJG4zIRQKeJKscqolWo7yu3GiG/Fr9W5cfr3IIo9xp8UQ06idbjjSV jItrSmL/HoZYQ7DSGCsQObC6snbkdeWRSaz/TCzEth5O0NGgA37apNaF3TZTbxRWcMG9uICc oGpDIZeCe7kBDQRa+IBQAQgA2EV0IFUgcJEpznzSxRhKajgLUmP/CJkUrXRipRrR0PqeXEH2 dF1+T8JObDVBN33oXwbXfIvBUhEw2uWsAHDW8OqzUsCTUxdy3ehVHkxHw1deXfvYf5VTtSli QsVIEJ0LZtD3V0idDnfGAhWqbMubBtF2tj1I6P2Py+RlU1pMD4B4g8zcWU+H4H39tpLkd9c/ kTemaX6QwRNW42L8+tDjL4pUogf8/tweMOj9LDOWVTqE2lipWxCH0uTEj8G8kSMLCyGgjxni MFDpjJLu3ETBZMevA+HNWS80RGbT2byu0FbeqXdRV3/+PL3MUY3mOs91bVgxpULG3aDcEmWd IJzNgQARAQABiQE8BBgBCgAmAhsMFiEEU0J2bW3rhOXT49z2odDB0wWF0VgFAlr4jsAFCQPC dXAACgkQodDB0wWF0VgnUQf/T1Z0SBj8YdepF91TTQnvH21USuyEsWCIX8d2xrUqGdVnwlIS fllS3SKTZQJdFhqQtEEYrKRhUDHrPt5Sm0NBisiD+lLcRajv7si4Xj8/ZY/gFjt7RrraYv5D Yb1BjSzsY4YEtq55jDknGufmBpannhnLFFlltt12Sa+xVgZMOl3g8zMjQkiPMtesw1DMDy9N lPB2WlbBVQlkzNHMifpIEiqc+ckZJavYabl/Nsv/kbMFGTizdIllN2EML6l9/KUC3Iw0OWB9 pnge7j3cX7+6sv4ypu65B/XMb4h/4HvXs4D2NW0HIIWtPA50fjjPSJs2JHJt9qVkI7/rNNNL byRcKQ== Organization: The FreeBSD Project Message-ID: <7fd4e212-79b2-c632-c7ae-60687bbe1a61@FreeBSD.org> Date: Sun, 19 May 2019 14:57:01 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190519115456.40571481c85c9f178657d6b9@j.email.ne.jp> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="yrDxsoDbMU0Jyuot8MnziHlkVEGtvvtLR" X-Null-Tag: 50e5d1d20b4377aea219fcf568502c90 X-Rspamd-Queue-Id: 164EF706EE X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.98 / 15.00]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-Mailman-Approved-At: Sun, 19 May 2019 20:18:06 +0000 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 May 2019 18:57:10 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --yrDxsoDbMU0Jyuot8MnziHlkVEGtvvtLR Content-Type: multipart/mixed; boundary="pWqGWROSTzjf1uL0jHtKl2NlNiQzWFRf9"; protected-headers="v1" From: Benedict Reuschling To: Yoshihiro Ota , rgrimes@freebsd.org Cc: "Rodney W. Grimes" , src-committers@freebsd.org, svn-src-stable@freebsd.org, svn-src-all@freebsd.org, svn-src-stable-12@freebsd.org, Bruce Evans , Konstantin Belousov , Ed Maste Message-ID: <7fd4e212-79b2-c632-c7ae-60687bbe1a61@FreeBSD.org> Subject: Re: svn commit: r347951 - stable/12/lib/libc/stdlib References: <201905181306.x4ID6piX064982@gndrsh.dnsmgr.net> <20190519115456.40571481c85c9f178657d6b9@j.email.ne.jp> In-Reply-To: <20190519115456.40571481c85c9f178657d6b9@j.email.ne.jp> --pWqGWROSTzjf1uL0jHtKl2NlNiQzWFRf9 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Am 19.05.19 um 11:54 schrieb Yoshihiro Ota: > I wonder if we can use a tool to confirm coding style like > clang-format or something else. >=20 > I tried to setup clang-format and 2 others in the past like > a year ago but wasn't able to do... >=20 We were discussing that a little bit at BSDCan. clang-format has a few edge cases (or our style(9) needs to change (many potential bikesheds there). There was also talk about using annotations to give the tool some hints about which parts it should ignore that are different in our style. Ed Maste is the better person to talk to about it than me (and on separate different mailing list perhaps). Back the original issue: I reopened the review and have asked the submitter to incorporate the feedback from here. Regards to all Benedict >=20 > On Sat, 18 May 2019 06:06:51 -0700 (PDT) > "Rodney W. Grimes" wrote: >=20 >>> Hello Konstantin and Bruce, >>> >>> thank you for your comments. Clearly, this should have been addressed= in >>> the review and checked by a second pair of eyes. I mostly did the man= >>> page changes and can't comment much on the actual coding example. Two= >>> people (dab and jilles) approved the revision in the Phabricator revi= ew. >>> There was plenty of time to review it between April 16 and May 15 whe= n >>> then the original submitter asked if there was anything else that nee= ds >>> to be done. >> >> The quality of a code review is highly dependent on who is invited >> to do the reviewing, and how much participation and care those invited= >> have with respect to the process. Man pages that contain code samples= >> need to have more reviewers, you need man page experts, you need subje= ct >> mater experts, and you need coding experts. This review could of used= >> more reviewers (hind sight is 20/20) but if they had not been the righ= t >> reviewers the low quality commit would of probably still occurred. >> >> The amount of time in review is not a good measure of review completne= ss, >> that falls more onto the quality of the workmanship of those actually >> commented on a review. I myself consider a LGTM, or a accept by a rev= iewer >> who makes 0 comments on my code in phab as if that reviewer probably >> just rubber stamped my change, UNLESS I have extremly high trust in >> that person. If bde, imp, or kib stamp an approve on something of min= e my >> confidence level is very high and I do consider that code well reviewe= d, >> if I get a rubber stamp from some others I am not so confident. >> >> Now we have the problem in that note every code review can be done by >> such high quality engineers due to time and work load constraints, so >> we need to raise the level of others closer to these shinning stars >> and offset this lack of avaliable resources by other means (more >> reviewers, long review cycles, automations, etc.) >>> >>> Now, having said that and the the change is now both in HEAD and >>> stable/12, how do we proceed? Revert them both or patch those issues = as >>> follow-ups? Note that a src committer should do that and not me tryin= g >>> to add more EXAMPLE sections to man pages with my doc commit bit. >> >> There is another option, a revert is actually a local operation >> to your checked out code, ou can check out head, revert this >> commit, but do not commit, make the corrections, and then commit. >> >> When MFC's this single commit does the right thing. >> >> You could also revert in head, commit and later fix these >> issues, commit, and then MFC both of those commits. >> >> All of your proposed solutions, and my additions are workable, >> and I really have no preference on a single file change like >> this. >> >> Good Day, >> Rod >> >>> Regards, >>> Benedict >>> >>> >>> >>> Am 18.05.19 um 07:45 schrieb Bruce Evans: >>>> On Sat, 18 May 2019, Konstantin Belousov wrote: >>>> >>>>> On Sat, May 18, 2019 at 03:15:08AM +0000, Benedict Reuschling wrote= : >>>>>> Author: bcr (doc committer) >>>>>> Date: Sat May 18 03:15:07 2019 >>>>>> New Revision: 347951 >>>>>> URL: https://svnweb.freebsd.org/changeset/base/347951 >>>>>> >>>>>> Log: >>>>>> ? MFC r347617: >>>>>> ? Add small EXAMPLE section to bsearch.3. >>>>>> >>>>>> ? Submitted by:??????????? fernape (via Phabricator) >>>>>> ? Reviewed by:??????????? bcr, jilles, dab >>>>>> ? Approved by:??????????? bcr (man pages), jilles (src) >>>>>> ? Differential Revision:??????? https://reviews.freebsd.org/D19902= >>>>>> >>>>>> Modified: >>>>>> ? stable/12/lib/libc/stdlib/bsearch.3 >>>>>> Directory Properties: >>>>>> ? stable/12/?? (props changed) >>>>>> >>>>>> Modified: stable/12/lib/libc/stdlib/bsearch.3 >>>>>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D >>>>>> >>>>>> --- stable/12/lib/libc/stdlib/bsearch.3??? Sat May 18 02:02:14 >>>>>> 2019??? (r347950) >>>>>> +++ stable/12/lib/libc/stdlib/bsearch.3??? Sat May 18 03:15:07 >>>>>> 2019??? (r347951) >>>>>> @@ -32,7 +32,7 @@ >>>>>> ?.\"???? @(#)bsearch.3??? 8.3 (Berkeley) 4/19/94 >>>>>> ?.\" $FreeBSD$ >>>>>> ?.\" >>>>>> -.Dd February 22, 2013 >>>>>> +.Dd May 15, 2019 >>>>>> ?.Dt BSEARCH 3 >>>>>> ?.Os >>>>>> ?.Sh NAME >>>>>> @@ -83,6 +83,61 @@ The >>>>>> ?function returns a pointer to a matching member of the array, or = a null >>>>>> ?pointer if no match is found. >>>>>> ?If two members compare as equal, which member is matched is >>>>>> unspecified. >>>>>> +.Sh EXAMPLES >>>>>> +A sample program that searches people by age in a sorted array: >>>>>> +.Bd -literal >>>>>> +#include >>>>>> +#include >>>>>> +#include >>>>>> +#include >>>>>> +#include >>>>>> + >>>>>> +struct person { >>>>>> +??? char name[5]; >>>>>> +??? int age; >>>>>> +}; >>>> >>>> This example has a high density of style bugs.? kib pointed out some= =2E >>>> Some of the others are: >>>> >>>> (1) Not sorting the struct members on alignment.? (style(9) says to = sort >>>> ??? on use, then size, but means alignment). >>>> (2) Not indenting the struct member names. >>>> (3) Not use a prefix for struct member names.? This is not important= for >>>> ??? small programs. >>>> >>>>>> + >>>>>> +int >>>>>> +compare(const void *key, const void *array_member) >>>>>> +{ >>>>>> +??? int age =3D (intptr_t) key; >>>>>> +??? struct person person =3D *(struct person *) array_member; >>>>> These two lines contain at least three style(9) bugs, and at least = one >>>>> warning at higher warning level. >>>>> >>>>>> + >>>>>> +??? return (age - person.age); >>>>>> +} >>>>>> + >>>>>> +int >>>>>> +main() >>>>> Why use K&R definition ? >>>>> >>>>>> +{ >>>>>> +??? struct person *friend; >>>>>> + >>>>>> +??? /* Sorted array */ >>>>>> +??? struct person friends[6] =3D { >>>>>> +??????? { "paul", 22 }, >>>>>> +??????? { "anne", 25 }, >>>>>> +??????? { "fred", 25 }, >>>>>> +??????? { "mary", 27 }, >>>>>> +??????? { "mark", 35 }, >>>>>> +??????? { "bill", 50 } >>>>>> +??? }; >>>>>> + >>>>>> +??? size_t array_size =3D sizeof(friends) / sizeof(struct person)= ; >>>>> Since you used const elsewere, why did not you used it there ? >>>> >>>> (4) The size expression is obfuscated by spelling the element size a= s >>>> ??? sizeof(struct person) instead of sizeof(friends[0]). >>>> (5?) FreeBSD now spells this size expression as nitems(friends).? I = don't >>>> ??? like the unportability of this, especially in an example. >>>> >>>>> >>>>>> + >>>>>> +??? friend =3D bsearch((void *)22, &friends, array_size, sizeof(s= truct >>>>>> person), compare); >>>>> Taking address of an array is weird. >>>>> Line is too long. >>>> >>>> (6) C99 specifies that the search is for a member of the array that = matches >>>> ??? the object pointed to by 'key'.? Here the key of (void *)22 is a= >>>> ??? not a pointer to an object.? It is a cookie which points to garb= age. >>>> ??? The cookie is unique enough to work in practice.? Perhaps you ca= n >>>> ??? prove it to always work if the option type intptr_t is supported= =2E >>>> ??? But this is a bad example. >>>> (4a) same obfuscation of the element size. >>>> >>>>> >>>>>> +??? assert(strcmp(friend->name, "paul") =3D=3D 0); >>>>>> +??? printf("name: %s\enage: %d\en", friend->name, friend->age); >>>>>> + >>>> >>>> (7) Extra blank line.? This is not too bad, but is not done consiste= ntly. >>>> >>>>>> +??? friend =3D bsearch((void *)25, &friends, array_size, sizeof(s= truct >>>>>> person), compare); >>>> >>>> (8) More too-long lines. >>>> (4b) More sizeof(person)'s. >>>> >>>>>> +??? assert(strcmp(friend->name, "fred") =3D=3D 0 || strcmp(friend= ->name, >>>>>> "anne") =3D=3D 0); >>>> >>>> (7a) No extra blank line for "fred". >>>> >>>>>> +??? printf("name: %s\enage: %d\en", friend->name, friend->age); >>>>>> + >>>>>> +??? friend =3D bsearch((void *)30, &friends, array_size, sizeof(s= truct >>>>>> person), compare); >>>>>> +??? assert(friend =3D=3D NULL); >>>>>> +??? printf("friend aged 30 not found\en"); >>>> >>>> I didn't notice before that the key cookie was an encoding of the ag= e. >>>> >>>> The key is not unique (there are 2 25's).? This gives an example of = low >>>> quality data and the example has minimal error handling handling for= this >>>> without describing what it is doing (it asserts uniqueness for age 2= 2 and >>>> it asserts one of the 2 possibilities for age 25.? It can only do th= is >>>> because it knows too much about the data). >>>> >>>> It is more than a style bug to handle errors in data by assert() or >>>> otherwise killing the program, except possibly when the data is supp= osed >>>> to be good. >>>> >>>>>> + >>>>>> +??? return (EXIT_SUCCESS); >>>>>> +} >>>>>> +.Ed >>>>>> ?.Sh SEE ALSO >>>>>> ?.Xr db 3 , >>>>>> ?.Xr lsearch 3 , >>>> >>>> Bruce >>> >>> >> >> --=20 >> Rod Grimes rgrimes@fre= ebsd.org >> _______________________________________________ >> svn-src-all@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/svn-src-all >> To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"= --pWqGWROSTzjf1uL0jHtKl2NlNiQzWFRf9-- --yrDxsoDbMU0Jyuot8MnziHlkVEGtvvtLR Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEwXonQDvNfP/33IoBVXQ7/QHhjTUFAlzhpv0ACgkQVXQ7/QHh jTW2YAf+J++lPrES6tz+MpfJq/0E5EJ6n+IMmvqe3voAQWurhVnIesFAaXc7ZIdg eUWO44mzRE1RAzdvRb4TPyFtCYl1DQibwSP7oW4RjryeWNqUpvi+PRFMfZHG2G8X P7GqQDm5/X12wP4axKXAh9sd52nNr2Mm02GTB+6lOATAtFmJpCreYn2bGc4EtSBF ND4OAgqb53wUkHonvwIubtOKPbsyuafDWloYp4UIAjbuTPZQVSTOtJnx5qA8qO3L HJvjJLdPWHyUvHB9dzbyX8VuHF6DNqyUwRC1VFLUb/50dynIiw9lsx1WtimVqqS9 UTNQ2DTsKIiV/2r0ak3DuxpjX5A2FA== =UeGS -----END PGP SIGNATURE----- --yrDxsoDbMU0Jyuot8MnziHlkVEGtvvtLR-- From owner-svn-src-stable@freebsd.org Sun May 19 23:56:06 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C2F31595F00; Sun, 19 May 2019 23:56:06 +0000 (UTC) (envelope-from ygy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8B98082EFC; Sun, 19 May 2019 23:56:05 +0000 (UTC) (envelope-from ygy@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 61B6AE5E5; Sun, 19 May 2019 23:56:05 +0000 (UTC) (envelope-from ygy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4JNu5OL099137; Sun, 19 May 2019 23:56:05 GMT (envelope-from ygy@FreeBSD.org) Received: (from ygy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4JNu5lx099136; Sun, 19 May 2019 23:56:05 GMT (envelope-from ygy@FreeBSD.org) Message-Id: <201905192356.x4JNu5lx099136@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ygy set sender to ygy@FreeBSD.org using -f From: Guangyuan Yang Date: Sun, 19 May 2019 23:56:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r347983 - stable/12/share/man/man4 X-SVN-Group: stable-12 X-SVN-Commit-Author: ygy X-SVN-Commit-Paths: stable/12/share/man/man4 X-SVN-Commit-Revision: 347983 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8B98082EFC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.945,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 May 2019 23:56:06 -0000 Author: ygy (doc committer) Date: Sun May 19 23:56:04 2019 New Revision: 347983 URL: https://svnweb.freebsd.org/changeset/base/347983 Log: MFC r347565: Fix some spelling errors in ng_eiface(4). PR: 237764 Submitted by: Tom Marcoen Modified: stable/12/share/man/man4/ng_eiface.4 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/ng_eiface.4 ============================================================================== --- stable/12/share/man/man4/ng_eiface.4 Sun May 19 21:49:56 2019 (r347982) +++ stable/12/share/man/man4/ng_eiface.4 Sun May 19 23:56:04 2019 (r347983) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 3, 2005 +.Dd May 14, 2019 .Dt NG_EIFACE 4 .Os .Sh NAME @@ -36,7 +36,7 @@ The .Vt eiface netgraph node implements the generic Ethernet interface. -When +When an .Vt eiface node is created, a new interface appears which is accessible via .Xr ifconfig 8 . @@ -78,7 +78,7 @@ which requires as an argument an string consisting of 6 colon-separated hex digits. .It Dv NGM_EIFACE_GET_IFNAME Pq Ic getifname Return the name of the associated interface as a -.Dv NUL Ns -terminated +.Dv NULL Ns -terminated .Tn ASCII string. .It Dv NGM_EIFACE_GET_IFADDRS @@ -97,7 +97,7 @@ Unlike most other node types, an .Vt eiface node does .Em not -go away when all hooks have been disconnected; rather, and explicit +go away when all hooks have been disconnected; rather, an explicit .Dv NGM_SHUTDOWN control message is required. .Sh SEE ALSO From owner-svn-src-stable@freebsd.org Mon May 20 05:28:06 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 14B2915A2467 for ; Mon, 20 May 2019 05:28:06 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 40FBB8CC74 for ; Mon, 20 May 2019 05:28:05 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x82d.google.com with SMTP id z19so14836517qtz.13 for ; Sun, 19 May 2019 22:28:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LmVi7xbGpzpQ3mXFaAmOj1aRTtqzhNPnAL808nADH5c=; b=qkRBVFiM3HcmQYDpuvUL+lITMQqeVpSPhVIHyYGgErH1Pf+NVdYnr9unhScEhvU4ew E0SvQrJorz1/Ip97FeaXkyac0jjeJJRI77B79UstWYqnThUDfFhcJdnQH1ky6zRhgt5R hReaglhOP1qA/ZOtJco0jHd9JntkavrVgyXgMqwjZZohAPFr8bR3sirD0K0kjrpEIIm3 KcdsdKNvvGp1trrWHVk4UgWDquAbLP1Eox3FEIN734d79nfP0Rlxjli3N7C9lG7kX/CA PED6OahKJjy6RFv+Vf3u4ADqGVx/R8WSLlzdFPzdW6vg8yvadM0vw6Oi2ZhShBfahzuW IYSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LmVi7xbGpzpQ3mXFaAmOj1aRTtqzhNPnAL808nADH5c=; b=pcuUbT8/khVcqMQr9XVPKc4+Diw5rTvaGGgBvIjzXw2WjYkRMj4blgIHSPSDpxKJlU SMv3RntMOXpX2REL02Ev9epmF6du6Uts4ryCk9/fZ5FfsrUajzTj3TofdqewuqyJrXXy CXlPe6ogW0kkyA4TP18FuGxXqE90YeZTZj1WOExJVRbP8EeIZZxge2JFwijncfRAuE7f E2MsBhorVphNLH6IUaxMHJRloR8YBCyATK17x+/B+T9OvXYB62FcLcGHBR0gJ56OBNf6 ehKVJnaHFFqpWt8TMOgAJrKjlfn/JrhHEbCuKGCSHu28bUCftWay04BMhE0/NNqxtyUd DQyQ== X-Gm-Message-State: APjAAAXXKkFSGhgLzjI1kmSyTbDCHIN/ctOoFublEjO0tB92qn51D6bm KGM6j6O/SammnBnexcgGNRqGb8ib9UlJmPhxuKTrnA== X-Google-Smtp-Source: APXvYqyyDC3NdDjlGdBY/GRe6CocJp6Xrl5m/rE/GtNIWsLTI6mBFjOQ4BvezgwXoKsze+k5ffpO3jZaBPWyn77O6D0= X-Received: by 2002:a0c:9562:: with SMTP id m31mr41174613qvm.27.1558330084528; Sun, 19 May 2019 22:28:04 -0700 (PDT) MIME-Version: 1.0 References: <201905181306.x4ID6piX064982@gndrsh.dnsmgr.net> <20190519115456.40571481c85c9f178657d6b9@j.email.ne.jp> In-Reply-To: <20190519115456.40571481c85c9f178657d6b9@j.email.ne.jp> From: Warner Losh Date: Sun, 19 May 2019 23:27:53 -0600 Message-ID: Subject: Re: svn commit: r347951 - stable/12/lib/libc/stdlib To: Yoshihiro Ota Cc: "Rodney W. Grimes" , "Rodney W. Grimes" , Benedict Reuschling , src-committers , svn-src-stable@freebsd.org, svn-src-all , svn-src-stable-12@freebsd.org, Bruce Evans , Konstantin Belousov X-Rspamd-Queue-Id: 40FBB8CC74 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-Mailman-Approved-At: Mon, 20 May 2019 10:29:06 +0000 Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 May 2019 05:28:06 -0000 On Sun, May 19, 2019 at 9:56 AM Yoshihiro Ota wrote: > I wonder if we can use a tool to confirm coding style like > clang-format or something else. > I don't know... it might be hard to do that inside a man page... Warner From owner-svn-src-stable@freebsd.org Mon May 20 10:21:13 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 70C4615A8865; Mon, 20 May 2019 10:21:13 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id 53E6D6EF0B; Mon, 20 May 2019 10:21:03 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id 7FAF93DBD1E; Mon, 20 May 2019 20:20:51 +1000 (AEST) Date: Mon, 20 May 2019 20:20:51 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Warner Losh cc: Yoshihiro Ota , "Rodney W. Grimes" , "Rodney W. Grimes" , Benedict Reuschling , src-committers , svn-src-stable@freebsd.org, svn-src-all , svn-src-stable-12@freebsd.org, Bruce Evans , Konstantin Belousov Subject: Re: svn commit: r347951 - stable/12/lib/libc/stdlib In-Reply-To: Message-ID: <20190520201507.R1014@besplex.bde.org> References: <201905181306.x4ID6piX064982@gndrsh.dnsmgr.net> <20190519115456.40571481c85c9f178657d6b9@j.email.ne.jp> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=FNpr/6gs c=1 sm=1 tr=0 cx=a_idp_d a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=sgSoKbxsTZY4yqxDgxsA:9 a=CjuIK1q_8ugA:10 X-Rspamd-Queue-Id: 53E6D6EF0B X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of brde@optusnet.com.au designates 211.29.132.42 as permitted sender) smtp.mailfrom=brde@optusnet.com.au X-Spamd-Result: default: False [-6.02 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_IN_DNSWL_LOW(-0.10)[42.132.29.211.list.dnswl.org : 127.0.5.1]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:211.29.132.0/23]; FREEMAIL_FROM(0.00)[optusnet.com.au]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[optusnet.com.au]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[extmail.optusnet.com.au]; NEURAL_HAM_SHORT(-0.95)[-0.955,0]; RCPT_COUNT_SEVEN(0.00)[11]; IP_SCORE(-2.76)[ip: (-7.74), ipnet: 211.28.0.0/14(-3.36), asn: 4804(-2.68), country: AU(-0.02)]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[optusnet.com.au]; ASN(0.00)[asn:4804, ipnet:211.28.0.0/14, country:AU]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2] X-Mailman-Approved-At: Mon, 20 May 2019 10:29:06 +0000 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 May 2019 10:21:13 -0000 On Sun, 19 May 2019, Warner Losh wrote: > On Sun, May 19, 2019 at 9:56 AM Yoshihiro Ota wrote: > >> I wonder if we can use a tool to confirm coding style like >> clang-format or something else. > > I don't know... it might be hard to do that inside a man page... Examples in man pages need special treatment since man adds a 5 column left margin and then must mangle tabs to preserve 8-column indentation. The examples must at least be formatted for width 74 instead of 79, but 74 is better anyway. I had some success turning SYNOPSIS sections into C code for checking that the headers are complete and the documented prototypes agree with the headers. Large examples would probably have to be extracted manually since they are less structured than SYNOPSIS sections. Bruce From owner-svn-src-stable@freebsd.org Mon May 20 16:31:48 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3AD6915B1EB5; Mon, 20 May 2019 16:31:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CBF0A86150; Mon, 20 May 2019 16:31:47 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A5B0020D8C; Mon, 20 May 2019 16:31:47 +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 x4KGVlp1019491; Mon, 20 May 2019 16:31:47 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4KGVkKp019484; Mon, 20 May 2019 16:31:46 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201905201631.x4KGVkKp019484@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 20 May 2019 16:31:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r347995 - in stable/11: sys/sys usr.bin/ipcrm usr.bin/ipcs X-SVN-Group: stable-11 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/11: sys/sys usr.bin/ipcrm usr.bin/ipcs X-SVN-Commit-Revision: 347995 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CBF0A86150 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 May 2019 16:31:48 -0000 Author: kib Date: Mon May 20 16:31:45 2019 New Revision: 347995 URL: https://svnweb.freebsd.org/changeset/base/347995 Log: MFC r329348 (by brooks): Get rid of the requirement to include SysV IPC headers with _KERNEL defined in ipcrm by introducing _WANT_SYSVxxx_INTERNALS defines. MFC r329390 (by lwhsu): Follow r329348 in ipcs for getting rid of the requirement to include SysV IPC headers with _KERNEL. Sponsored by: Mellanox Technologies Approved by: re (gjb) Modified: stable/11/sys/sys/ipc.h stable/11/sys/sys/msg.h stable/11/sys/sys/sem.h stable/11/sys/sys/shm.h stable/11/usr.bin/ipcrm/ipcrm.c stable/11/usr.bin/ipcs/ipc.c stable/11/usr.bin/ipcs/ipc.h stable/11/usr.bin/ipcs/ipcs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/ipc.h ============================================================================== --- stable/11/sys/sys/ipc.h Mon May 20 16:23:35 2019 (r347994) +++ stable/11/sys/sys/ipc.h Mon May 20 16:31:45 2019 (r347995) @@ -117,12 +117,14 @@ struct ipc_perm { #define IPC_INFO 3 /* get info */ #endif -#ifdef _KERNEL +#if defined(_KERNEL) || defined(_WANT_SYSVIPC_INTERNALS) /* Macros to convert between ipc ids and array indices or sequence ids */ #define IPCID_TO_IX(id) ((id) & 0xffff) #define IPCID_TO_SEQ(id) (((id) >> 16) & 0xffff) #define IXSEQ_TO_IPCID(ix,perm) (((perm.seq) << 16) | (ix & 0xffff)) +#endif +#ifdef _KERNEL struct thread; struct proc; struct vmspace; Modified: stable/11/sys/sys/msg.h ============================================================================== --- stable/11/sys/sys/msg.h Mon May 20 16:23:35 2019 (r347994) +++ stable/11/sys/sys/msg.h Mon May 20 16:31:45 2019 (r347995) @@ -25,6 +25,9 @@ #include #include +#ifdef _WANT_SYSVMSG_INTERNALS +#define _WANT_SYSVIPC_INTERNALS +#endif #include /* @@ -116,7 +119,6 @@ struct mymsg { #endif #ifdef _KERNEL - struct msg { struct msg *msg_next; /* next msg in the chain */ long msg_type; /* type of this message */ @@ -126,7 +128,9 @@ struct msg { short msg_spot; /* location of start of msg in buffer */ struct label *label; /* MAC Framework label */ }; +#endif +#if defined(_KERNEL) || defined(_WANT_SYSVMSG_INTERNALS) /* * Based on the configuration parameters described in an SVR2 (yes, two) * config(1m) man page. @@ -145,7 +149,6 @@ struct msginfo { msgssz, /* size of a message segment (see notes above) */ msgseg; /* number of message segments */ }; -extern struct msginfo msginfo; /* * Kernel wrapper for the user-level structure. @@ -162,10 +165,13 @@ struct msqid_kernel { struct label *label; /* MAC label */ struct ucred *cred; /* creator's credentials */ }; +#endif -#endif /* _KERNEL */ +#ifdef _KERNEL +extern struct msginfo msginfo; -#if !defined(_KERNEL) || defined(_WANT_MSG_PROTOTYPES) +#else /* _KERNEL */ + __BEGIN_DECLS int msgctl(int, int, struct msqid_ds *); int msgget(key_t, int); @@ -176,7 +182,6 @@ int msgsnd(int, const void *, size_t, int); int msgsys(int, ...); #endif __END_DECLS - -#endif /* !_KERNEL || _WANT_MSG_PROTOTYPES */ +#endif /* !_KERNEL */ #endif /* !_SYS_MSG_H_ */ Modified: stable/11/sys/sys/sem.h ============================================================================== --- stable/11/sys/sys/sem.h Mon May 20 16:23:35 2019 (r347994) +++ stable/11/sys/sys/sem.h Mon May 20 16:31:45 2019 (r347995) @@ -10,6 +10,9 @@ #ifndef _SYS_SEM_H_ #define _SYS_SEM_H_ +#ifdef _WANT_SYSVSEM_INTERNALS +#define _WANT_SYSVIPC_INTERNALS +#endif #include #ifndef _PID_T_DECLARED @@ -101,8 +104,7 @@ union semun { #define SEM_A IPC_W /* alter permission */ #define SEM_R IPC_R /* read permission */ -#ifdef _KERNEL - +#if defined(_KERNEL) || defined(_WANT_SYSVSEM_INTERNALS) /* * semaphore info struct */ @@ -117,7 +119,6 @@ struct seminfo { semvmx, /* semaphore maximum value */ semaem; /* adjust on exit max value */ }; -extern struct seminfo seminfo; /* * Kernel wrapper for the user-level structure @@ -131,15 +132,17 @@ struct semid_kernel { /* internal "mode" bits */ #define SEM_ALLOC 01000 /* semaphore is allocated */ #define SEM_DEST 02000 /* semaphore will be destroyed on last detach */ +#endif +#ifdef _KERNEL +extern struct seminfo seminfo; /* * Process sem_undo vectors at proc exit. */ void semexit(struct proc *p); -#endif /* _KERNEL */ +#else /* !_KERNEL */ -#if !defined(_KERNEL) || defined(_WANT_SEM_PROTOTYPES) __BEGIN_DECLS #if __BSD_VISIBLE int semsys(int, ...); @@ -149,6 +152,6 @@ int semget(key_t, int, int); int semop(int, struct sembuf *, size_t); __END_DECLS -#endif /* !_KERNEL || _WANT_SEM_PROTOTYPES */ +#endif /* !_KERNEL */ #endif /* !_SYS_SEM_H_ */ Modified: stable/11/sys/sys/shm.h ============================================================================== --- stable/11/sys/sys/shm.h Mon May 20 16:23:35 2019 (r347994) +++ stable/11/sys/sys/shm.h Mon May 20 16:31:45 2019 (r347995) @@ -40,6 +40,9 @@ #define _SYS_SHM_H_ #include +#ifdef _WANT_SYSVSHM_INTERNALS +#define _WANT_SYSVIPC_INTERNALS +#endif #include #include @@ -104,9 +107,7 @@ struct shmid_ds { time_t shm_ctime; /* time of last change by shmctl() */ }; -#ifdef _KERNEL -#include - +#if defined(_KERNEL) || defined(_WANT_SYSVSHM_INTERNALS) /* * System 5 style catch-all structure for shared memory constants that * might be of interest to user programs. Do we really want/need this? @@ -119,19 +120,20 @@ struct shminfo { u_long shmall; /* max amount of shared memory (pages) */ }; +struct vm_object; + /* * Add a kernel wrapper to the shmid_ds struct so that private info (like the * MAC label) can be added to it, without changing the user interface. */ struct shmid_kernel { struct shmid_ds u; - vm_object_t object; + struct vm_object *object; struct label *label; /* MAC label */ struct ucred *cred; /* creator's credendials */ }; +#endif -extern struct shminfo shminfo; - struct shm_info { int used_ids; unsigned long shm_tot; @@ -141,15 +143,17 @@ struct shm_info { unsigned long swap_successes; }; -struct thread; +#ifdef _KERNEL struct proc; struct vmspace; +extern struct shminfo shminfo; + void shmexit(struct vmspace *); void shmfork(struct proc *, struct proc *); -#endif /* _KERNEL */ -#if !defined(_KERNEL) || defined(_WANT_SHM_PROTOTYPES) +#else /* !_KERNEL */ + #include #ifndef _SIZE_T_DECLARED @@ -167,6 +171,6 @@ int shmctl(int, int, struct shmid_ds *); int shmdt(const void *); __END_DECLS -#endif /* _KERNEL || _WANT_SHM_PROTOTYPES */ +#endif /* _KERNEL */ #endif /* !_SYS_SHM_H_ */ Modified: stable/11/usr.bin/ipcrm/ipcrm.c ============================================================================== --- stable/11/usr.bin/ipcrm/ipcrm.c Mon May 20 16:23:35 2019 (r347994) +++ stable/11/usr.bin/ipcrm/ipcrm.c Mon May 20 16:31:45 2019 (r347995) @@ -36,14 +36,12 @@ __FBSDID("$FreeBSD$"); #include -#define _WANT_MSG_PROTOTYPES -#define _WANT_SEM_PROTOTYPES -#define _WANT_SHM_PROTOTYPES -#define _KERNEL +#define _WANT_SYSVMSG_INTERNALS +#include +#define _WANT_SYSVSEM_INTERNALS #include +#define _WANT_SYSVSHM_INTERNALS #include -#include -#undef _KERNEL #include #include Modified: stable/11/usr.bin/ipcs/ipc.c ============================================================================== --- stable/11/usr.bin/ipcs/ipc.c Mon May 20 16:23:35 2019 (r347994) +++ stable/11/usr.bin/ipcs/ipc.c Mon May 20 16:31:45 2019 (r347995) @@ -35,11 +35,12 @@ __FBSDID("$FreeBSD$"); #include #include -#define _KERNEL +#define _WANT_SYSVMSG_INTERNALS +#include +#define _WANT_SYSVSEM_INTERNALS #include +#define _WANT_SYSVSHM_INTERNALS #include -#include -#undef _KERNEL #include #include Modified: stable/11/usr.bin/ipcs/ipc.h ============================================================================== --- stable/11/usr.bin/ipcs/ipc.h Mon May 20 16:23:35 2019 (r347994) +++ stable/11/usr.bin/ipcs/ipc.h Mon May 20 16:31:45 2019 (r347995) @@ -68,3 +68,6 @@ extern kvm_t *kd; extern struct semid_kernel *sema; extern struct msqid_kernel *msqids; extern struct shmid_kernel *shmsegs; +extern struct seminfo seminfo; +extern struct msginfo msginfo; +extern struct shminfo shminfo; Modified: stable/11/usr.bin/ipcs/ipcs.c ============================================================================== --- stable/11/usr.bin/ipcs/ipcs.c Mon May 20 16:23:35 2019 (r347994) +++ stable/11/usr.bin/ipcs/ipcs.c Mon May 20 16:31:45 2019 (r347995) @@ -32,11 +32,12 @@ __FBSDID("$FreeBSD$"); #include #include -#define _KERNEL +#define _WANT_SYSVMSG_INTERNALS +#include +#define _WANT_SYSVSEM_INTERNALS #include +#define _WANT_SYSVSHM_INTERNALS #include -#include -#undef _KERNEL #include #include From owner-svn-src-stable@freebsd.org Mon May 20 17:34:38 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF23315B3B80; Mon, 20 May 2019 17:34:38 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0495688F64; Mon, 20 May 2019 17:34:37 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x4KHY8Mk074765; Mon, 20 May 2019 10:34:08 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x4KHY7wH074764; Mon, 20 May 2019 10:34:07 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201905201734.x4KHY7wH074764@gndrsh.dnsmgr.net> Subject: Re: svn commit: r347951 - stable/12/lib/libc/stdlib In-Reply-To: To: Warner Losh Date: Mon, 20 May 2019 10:34:07 -0700 (PDT) CC: Yoshihiro Ota , "Rodney W. Grimes" , "Rodney W. Grimes" , Benedict Reuschling , src-committers , svn-src-stable@freebsd.org, svn-src-all , svn-src-stable-12@freebsd.org, Bruce Evans , Konstantin Belousov Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 0495688F64 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.95 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.95)[-0.955,0] X-Mailman-Approved-At: Mon, 20 May 2019 17:44:55 +0000 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 May 2019 17:34:38 -0000 > On Sun, May 19, 2019 at 9:56 AM Yoshihiro Ota wrote: > > > I wonder if we can use a tool to confirm coding style like > > clang-format or something else. > > > > I don't know... it might be hard to do that inside a man page... Given the current tooling I concur, so we need .include for mandoc, and teach mandoc how to format example code which is mostly knows how to do, or atleast there was lots of groff code to do that. > Warner -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-stable@freebsd.org Mon May 20 21:33:24 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3AE4F15936E4; Mon, 20 May 2019 21:33:24 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BCCBF93D2B; Mon, 20 May 2019 21:33:23 +0000 (UTC) (envelope-from brooks@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7854F241A1; Mon, 20 May 2019 21:33:23 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4KLXNXW088722; Mon, 20 May 2019 21:33:23 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4KLXMPE088717; Mon, 20 May 2019 21:33:22 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201905202133.x4KLXMPE088717@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 20 May 2019 21:33:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348012 - in stable/12: libexec/rc sbin/ifconfig share/man/man5 tools/tools/tinybsd/conf/firewall/etc usr.sbin/jail X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in stable/12: libexec/rc sbin/ifconfig share/man/man5 tools/tools/tinybsd/conf/firewall/etc usr.sbin/jail X-SVN-Commit-Revision: 348012 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BCCBF93D2B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.959,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 May 2019 21:33:24 -0000 Author: brooks Date: Mon May 20 21:33:22 2019 New Revision: 348012 URL: https://svnweb.freebsd.org/changeset/base/348012 Log: MFC r347963: Change ed(4), ep(4), and fxp(4) examples to em(4). ed(4) and ep(4) will be removed in FreeBSD 13. fxp(4) remains popular in older systems, but isn't as future proof as em(4). Reviewed by: bz, jhb Differential Revision: https://reviews.freebsd.org/D20311 Modified: stable/12/libexec/rc/rc.conf stable/12/sbin/ifconfig/ifconfig.8 stable/12/share/man/man5/rc.conf.5 stable/12/tools/tools/tinybsd/conf/firewall/etc/rc.firewall stable/12/usr.sbin/jail/jail.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rc/rc.conf ============================================================================== --- stable/12/libexec/rc/rc.conf Mon May 20 21:23:33 2019 (r348011) +++ stable/12/libexec/rc/rc.conf Mon May 20 21:33:22 2019 (r348012) @@ -121,9 +121,9 @@ hostid_file="/etc/hostid" # File with hostuuid. nisdomainname="NO" # Set to NIS domain if using NIS (or NO). dhclient_program="/sbin/dhclient" # Path to dhcp client program. dhclient_flags="" # Extra flags to pass to dhcp client. -#dhclient_flags_fxp0="" # Extra dhclient flags for fxp0 only +#dhclient_flags_em0="" # Extra dhclient flags for em0 only background_dhclient="NO" # Start dhcp client in the background. -#background_dhclient_fxp0="YES" # Start dhcp client on fxp0 in the background. +#background_dhclient_em0="YES" # Start dhcp client on em0 in the background. synchronous_dhclient="NO" # Start dhclient directly on configured # interfaces during startup. defaultroute_delay="30" # Time to wait for a default route on a DHCP interface. @@ -147,19 +147,19 @@ firewall_client_net="192.0.2.0/24" # IPv4 Network addr # firewall. #firewall_client_net_ipv6="2001:db8:2:1::/64" # IPv6 network prefix for # "client" firewall. -firewall_simple_iif="ed1" # Inside network interface for "simple" +firewall_simple_iif="em1" # Inside network interface for "simple" # firewall. firewall_simple_inet="192.0.2.16/28" # Inside network address for "simple" # firewall. -firewall_simple_oif="ed0" # Outside network interface for "simple" +firewall_simple_oif="em0" # Outside network interface for "simple" # firewall. firewall_simple_onet="192.0.2.0/28" # Outside network address for "simple" # firewall. -#firewall_simple_iif_ipv6="ed1" # Inside IPv6 network interface for "simple" +#firewall_simple_iif_ipv6="em1" # Inside IPv6 network interface for "simple" # firewall. #firewall_simple_inet_ipv6="2001:db8:2:800::/56" # Inside IPv6 network prefix # for "simple" firewall. -#firewall_simple_oif_ipv6="ed0" # Outside IPv6 network interface for "simple" +#firewall_simple_oif_ipv6="em0" # Outside IPv6 network interface for "simple" # firewall. #firewall_simple_onet_ipv6="2001:db8:2:0::/56" # Outside IPv6 network prefix # for "simple" firewall. @@ -241,14 +241,14 @@ cloned_interfaces="" # List of cloned network interfa #cloned_interfaces="gif0 gif1 gif2 gif3" # Pre-cloning GENERIC config. #ifconfig_lo0="inet 127.0.0.1" # default loopback device configuration. #ifconfig_lo0_alias0="inet 127.0.0.254 netmask 0xffffffff" # Sample alias entry. -#ifconfig_ed0_ipv6="inet6 2001:db8:1::1 prefixlen 64" # Sample IPv6 addr entry -#ifconfig_ed0_alias0="inet6 2001:db8:2::1 prefixlen 64" # Sample IPv6 alias -#ifconfig_fxp0_name="net0" # Change interface name from fxp0 to net0. -#vlans_fxp0="101 vlan0" # vlan(4) interfaces for fxp0 device +#ifconfig_em0_ipv6="inet6 2001:db8:1::1 prefixlen 64" # Sample IPv6 addr entry +#ifconfig_em0_alias0="inet6 2001:db8:2::1 prefixlen 64" # Sample IPv6 alias +#ifconfig_em0_name="net0" # Change interface name from em0 to net0. +#vlans_em0="101 vlan0" # vlan(4) interfaces for em0 device #create_args_vlan0="vlan 102" # vlan tag for vlan0 device #wlans_ath0="wlan0" # wlan(4) interfaces for ath0 device #wlandebug_wlan0="scan+auth+assoc" # Set debug flags with wlandebug(8) -#ipv4_addrs_fxp0="192.168.0.1/24 192.168.1.1-5/28" # example IPv4 address entry. +#ipv4_addrs_em0="192.168.0.1/24 192.168.1.1-5/28" # example IPv4 address entry. # #autobridge_interfaces="bridge0" # List of bridges to check #autobridge_bridge0="tap* vlan0" # Interface glob to automatically add to the bridge @@ -336,7 +336,7 @@ bootparamd_flags="" # Flags to bootparamd pppoed_enable="NO" # Run the PPP over Ethernet daemon. pppoed_provider="*" # Provider and ppp(8) config file entry. pppoed_flags="-P /var/run/pppoed.pid" # Flags to pppoed (if enabled). -pppoed_interface="fxp0" # The interface that pppoed runs on. +pppoed_interface="em0" # The interface that pppoed runs on. sshd_enable="NO" # Enable sshd sshd_program="/usr/sbin/sshd" # path to sshd, if you want a different one. sshd_flags="" # Additional flags for sshd. @@ -506,11 +506,11 @@ route6d_flags="" # Flags to IPv6 routing daemon. # addrs. #route6d_flags="-q" # If you want to run a routing daemon on an end # node, you should stop advertisement. -#ipv6_network_interfaces="ed0 ep0" # Examples for router +#ipv6_network_interfaces="em0 em1" # Examples for router # or static configuration for end node. # Choose correct prefix value. -#ipv6_prefix_ed0="fec0:0000:0000:0001 fec0:0000:0000:0002" # Examples for rtr. -#ipv6_prefix_ep0="fec0:0000:0000:0003 fec0:0000:0000:0004" # Examples for rtr. +#ipv6_prefix_em0="fec0:0000:0000:0001 fec0:0000:0000:0002" # Examples for rtr. +#ipv6_prefix_em1="fec0:0000:0000:0003 fec0:0000:0000:0004" # Examples for rtr. ipv6_default_interface="NO" # Default output interface for scoped addrs. # This works only with # ipv6_gateway_enable="NO". Modified: stable/12/sbin/ifconfig/ifconfig.8 ============================================================================== --- stable/12/sbin/ifconfig/ifconfig.8 Mon May 20 21:23:33 2019 (r348011) +++ stable/12/sbin/ifconfig/ifconfig.8 Mon May 20 21:33:22 2019 (r348012) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd June 27, 2018 +.Dd May 18, 2019 .Dt IFCONFIG 8 .Os .Sh NAME @@ -196,7 +196,7 @@ This parameter is a string of the form .Dq name unit , for example, -.Dq Li ed0 . +.Dq Li em0 . .It Ar groupname List the interfaces in the given group. .El @@ -2919,26 +2919,26 @@ Assign the IPv4 address with a network mask of .Li 255.255.255.0 , to the interface -.Li fxp0 : -.Dl # ifconfig fxp0 inet 192.0.2.10 netmask 255.255.255.0 +.Li em0 : +.Dl # ifconfig em0 inet 192.0.2.10 netmask 255.255.255.0 .Pp Add the IPv4 address .Li 192.0.2.45 , with the CIDR network prefix .Li /28 , to the interface -.Li ed0 , +.Li em0 , using .Cm add as a synonym for the canonical form of the option .Cm alias : -.Dl # ifconfig ed0 inet 192.0.2.45/28 add +.Dl # ifconfig em0 inet 192.0.2.45/28 add .Pp Remove the IPv4 address .Li 192.0.2.45 from the interface -.Li ed0 : -.Dl # ifconfig ed0 inet 192.0.2.45 -alias +.Li em0 : +.Dl # ifconfig em0 inet 192.0.2.45 -alias .Pp Enable IPv6 functionality of the interface: .Dl # ifconfig em0 inet6 -ifdisabled Modified: stable/12/share/man/man5/rc.conf.5 ============================================================================== --- stable/12/share/man/man5/rc.conf.5 Mon May 20 21:23:33 2019 (r348011) +++ stable/12/share/man/man5/rc.conf.5 Mon May 20 21:33:22 2019 (r348012) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 21, 2019 +.Dd May 18, 2019 .Dt RC.CONF 5 .Os .Sh NAME @@ -1262,11 +1262,11 @@ It is possible to add IP alias entries using syntax with the address family keyword such as .Li inet . Assuming that the interface in question was -.Li ed0 , +.Li em0 , it might look something like this: .Bd -literal -ifconfig_ed0_alias0="inet 127.0.0.253 netmask 0xffffffff" -ifconfig_ed0_alias1="inet 127.0.0.254 netmask 0xffffffff" +ifconfig_em0_alias0="inet 127.0.0.253 netmask 0xffffffff" +ifconfig_em0_alias1="inet 127.0.0.254 netmask 0xffffffff" .Ed .Pp It also possible to configure multiple IP addresses in Classless @@ -1306,11 +1306,11 @@ not for the other address families such as .Li inet6 . .Pp With the interface in question being -.Li ed0 , +.Li em0 , an example could look like: .Bd -literal -ifconfig_ed0_alias2="inet 192.0.2.129/27" -ifconfig_ed0_alias3="inet 192.0.2.1-5/28" +ifconfig_em0_alias2="inet 192.0.2.129/27" +ifconfig_em0_alias3="inet 192.0.2.1-5/28" .Ed .Pp and so on. @@ -1332,10 +1332,10 @@ its contents are passed to Execution stops at the first unsuccessful access, so if something like this is present: .Bd -literal -ifconfig_ed0_alias0="inet 127.0.0.251 netmask 0xffffffff" -ifconfig_ed0_alias1="inet 127.0.0.252 netmask 0xffffffff" -ifconfig_ed0_alias2="inet 127.0.0.253 netmask 0xffffffff" -ifconfig_ed0_alias4="inet 127.0.0.254 netmask 0xffffffff" +ifconfig_em0_alias0="inet 127.0.0.251 netmask 0xffffffff" +ifconfig_em0_alias1="inet 127.0.0.252 netmask 0xffffffff" +ifconfig_em0_alias2="inet 127.0.0.253 netmask 0xffffffff" +ifconfig_em0_alias4="inet 127.0.0.254 netmask 0xffffffff" .Ed .Pp Then note that alias4 would @@ -1351,7 +1351,7 @@ variable, which has the same functionality as .Va ifconfig_ Ns Ao Ar interface Ac Ns Va _alias Ns Aq Ar n and can have all of entries in a variable like the following: .Bd -literal -ifconfig_ed0_aliases="\\ +ifconfig_em0_aliases="\\ inet 127.0.0.251 netmask 0xffffffff \\ inet 127.0.0.252 netmask 0xffffffff \\ inet 127.0.0.253 netmask 0xffffffff \\ @@ -1458,11 +1458,11 @@ to the .Va ifconfig_ Ns Aq Ar interface variable. For instance, to initialize the -.Li ed0 +.Li em0 device via DHCP, it is possible to use something like: .Bd -literal -ifconfig_ed0="DHCP" +ifconfig_em0="DHCP" .Ed .Pp If you want to configure your wireless interface with @@ -1513,7 +1513,7 @@ variable. .Pp It is also possible to rename an interface by doing: .Bd -literal -ifconfig_ed0_name="net0" +ifconfig_em0_name="net0" ifconfig_net0="inet 192.0.2.1 netmask 0xffffff00" .Ed .It Va ipv6_enable @@ -1686,8 +1686,8 @@ with keyword. For example: .Bd -literal -ifconfig_ed0_ipv6="inet6 2001:db8:1::1 prefixlen 64" -ifconfig_ed0_alias0="inet6 2001:db8:2::1 prefixlen 64" +ifconfig_em0_ipv6="inet6 2001:db8:1::1 prefixlen 64" +ifconfig_em0_alias0="inet6 2001:db8:2::1 prefixlen 64" .Ed .Pp Interfaces that have an @@ -1714,7 +1714,7 @@ defined in If only a link-local address is needed on the interface, the following configuration can be used: .Bd -literal -ifconfig_ed0_ipv6="inet6 auto_linklocal" +ifconfig_em0_ipv6="inet6 auto_linklocal" .Ed .Pp A link-local address can also be configured manually. @@ -1723,7 +1723,7 @@ so that it does not change when the network interface card is replaced. For example: .Bd -literal -ifconfig_ed0_ipv6="inet6 fe80::1 prefixlen 64" +ifconfig_em0_ipv6="inet6 fe80::1 prefixlen 64" .Ed .It Va ipv6_prefix_ Ns Aq Ar interface .Pq Vt str @@ -1737,15 +1737,15 @@ is empty. .Pp For example, the following configuration .Bd -literal -ipv6_prefix_ed0="2001:db8:1:0 2001:db8:2:0" +ipv6_prefix_em0="2001:db8:1:0 2001:db8:2:0" .Ed .Pp is equivalent to the following: .Bd -literal -ifconfig_ed0_alias0="inet6 2001:db8:1:: eui64 prefixlen 64" -ifconfig_ed0_alias1="inet6 2001:db8:1:: prefixlen 64 anycast" -ifconfig_ed0_alias2="inet6 2001:db8:2:: eui64 prefixlen 64" -ifconfig_ed0_alias3="inet6 2001:db8:2:: prefixlen 64 anycast" +ifconfig_em0_alias0="inet6 2001:db8:1:: eui64 prefixlen 64" +ifconfig_em0_alias1="inet6 2001:db8:1:: prefixlen 64 anycast" +ifconfig_em0_alias2="inet6 2001:db8:2:: eui64 prefixlen 64" +ifconfig_em0_alias3="inet6 2001:db8:2:: prefixlen 64 anycast" .Ed .Pp These Subnet-Router anycast addresses will be added only when Modified: stable/12/tools/tools/tinybsd/conf/firewall/etc/rc.firewall ============================================================================== --- stable/12/tools/tools/tinybsd/conf/firewall/etc/rc.firewall Mon May 20 21:23:33 2019 (r348011) +++ stable/12/tools/tools/tinybsd/conf/firewall/etc/rc.firewall Mon May 20 21:33:22 2019 (r348012) @@ -195,13 +195,13 @@ case ${firewall_type} in ############ # set these to your outside interface network and netmask and ip - oif="ed0" + oif="em0" onet="192.0.2.0" omask="255.255.255.240" oip="192.0.2.1" # set these to your inside interface network and netmask and ip - iif="ed1" + iif="em1" inet="192.0.2.16" imask="255.255.255.240" iip="192.0.2.17" Modified: stable/12/usr.sbin/jail/jail.8 ============================================================================== --- stable/12/usr.sbin/jail/jail.8 Mon May 20 21:23:33 2019 (r348011) +++ stable/12/usr.sbin/jail/jail.8 Mon May 20 21:33:22 2019 (r348012) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 10, 2018 +.Dd May 18, 2019 .Dt JAIL 8 .Os .Sh NAME @@ -1099,7 +1099,7 @@ testjail { mount.devfs; host.hostname = testhostname; ip4.addr = 192.0.2.100; - interface = ed0; + interface = em0; exec.start = "/bin/sh /etc/rc"; exec.stop = "/bin/sh /etc/rc.shutdown"; } From owner-svn-src-stable@freebsd.org Tue May 21 01:27:09 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42BF11599C29; Tue, 21 May 2019 01:27:09 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DD2B86D7E0; Tue, 21 May 2019 01:27: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B51C0268CB; Tue, 21 May 2019 01:27: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 x4L1R8Al011211; Tue, 21 May 2019 01:27:08 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4L1R8xi011210; Tue, 21 May 2019 01:27:08 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201905210127.x4L1R8xi011210@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 21 May 2019 01:27:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348027 - stable/12/sys/conf X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/conf X-SVN-Commit-Revision: 348027 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DD2B86D7E0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.971,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 May 2019 01:27:09 -0000 Author: markj Date: Tue May 21 01:27:08 2019 New Revision: 348027 URL: https://svnweb.freebsd.org/changeset/base/348027 Log: MFC r347570: Specify -z notext when building with -z ifunc-noplt. Modified: stable/12/sys/conf/kern.pre.mk Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/kern.pre.mk ============================================================================== --- stable/12/sys/conf/kern.pre.mk Tue May 21 01:18:43 2019 (r348026) +++ stable/12/sys/conf/kern.pre.mk Tue May 21 01:27:08 2019 (r348027) @@ -131,7 +131,7 @@ LDFLAGS+= -z max-page-size=2097152 .if ${LINKER_TYPE} != "lld" LDFLAGS+= -z common-page-size=4096 .else -LDFLAGS+= -z ifunc-noplt +LDFLAGS+= -z notext -z ifunc-noplt .endif .endif From owner-svn-src-stable@freebsd.org Tue May 21 01:30:29 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E4F3F1599CFD; Tue, 21 May 2019 01:30:28 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 162CE6D967; Tue, 21 May 2019 01:30:27 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x4L1UQrf076512; Mon, 20 May 2019 18:30:26 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x4L1UQhN076511; Mon, 20 May 2019 18:30:26 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201905210130.x4L1UQhN076511@gndrsh.dnsmgr.net> Subject: Re: svn commit: r348012 - in stable/12: libexec/rc sbin/ifconfig share/man/man5 tools/tools/tinybsd/conf/firewall/etc usr.sbin/jail In-Reply-To: <201905202133.x4KLXMPE088717@repo.freebsd.org> To: Brooks Davis Date: Mon, 20 May 2019 18:30:26 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 162CE6D967 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.97 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 May 2019 01:30:29 -0000 > Author: brooks > Date: Mon May 20 21:33:22 2019 > New Revision: 348012 > URL: https://svnweb.freebsd.org/changeset/base/348012 > > Log: > MFC r347963: > > Change ed(4), ep(4), and fxp(4) examples to em(4). > > ed(4) and ep(4) will be removed in FreeBSD 13. fxp(4) remains > popular in older systems, but isn't as future proof as em(4). > > Reviewed by: bz, jhb > Differential Revision: https://reviews.freebsd.org/D20311 Though this made since to me in head, it does not in stable, as you may of just broke someones running system when they do a merge master if they happened to of depended on the very long standing defaults of fxp that are NOT in comment lines below. IMHO we should not change user visible defaults in /etc/defaults/rc.conf on a brance, mininal is this requires some form of merge master update notice mechanism which we do not have. Should of laso been tagged Release Notes: Yes. > > Modified: > stable/12/libexec/rc/rc.conf > stable/12/sbin/ifconfig/ifconfig.8 > stable/12/share/man/man5/rc.conf.5 > stable/12/tools/tools/tinybsd/conf/firewall/etc/rc.firewall > stable/12/usr.sbin/jail/jail.8 > Directory Properties: > stable/12/ (props changed) > > Modified: stable/12/libexec/rc/rc.conf > ============================================================================== > --- stable/12/libexec/rc/rc.conf Mon May 20 21:23:33 2019 (r348011) > +++ stable/12/libexec/rc/rc.conf Mon May 20 21:33:22 2019 (r348012) > @@ -121,9 +121,9 @@ hostid_file="/etc/hostid" # File with hostuuid. > nisdomainname="NO" # Set to NIS domain if using NIS (or NO). > dhclient_program="/sbin/dhclient" # Path to dhcp client program. > dhclient_flags="" # Extra flags to pass to dhcp client. > -#dhclient_flags_fxp0="" # Extra dhclient flags for fxp0 only > +#dhclient_flags_em0="" # Extra dhclient flags for em0 only > background_dhclient="NO" # Start dhcp client in the background. > -#background_dhclient_fxp0="YES" # Start dhcp client on fxp0 in the background. > +#background_dhclient_em0="YES" # Start dhcp client on em0 in the background. > synchronous_dhclient="NO" # Start dhclient directly on configured > # interfaces during startup. > defaultroute_delay="30" # Time to wait for a default route on a DHCP interface. > @@ -147,19 +147,19 @@ firewall_client_net="192.0.2.0/24" # IPv4 Network addr > # firewall. > #firewall_client_net_ipv6="2001:db8:2:1::/64" # IPv6 network prefix for > # "client" firewall. > -firewall_simple_iif="ed1" # Inside network interface for "simple" > +firewall_simple_iif="em1" # Inside network interface for "simple" The effects active real possible used default value, though low likely hood being edX. > firewall_simple_inet="192.0.2.16/28" # Inside network address for "simple" > # firewall. > -firewall_simple_oif="ed0" # Outside network interface for "simple" > +firewall_simple_oif="em0" # Outside network interface for "simple" > # firewall. > firewall_simple_onet="192.0.2.0/28" # Outside network address for "simple" > # firewall. > -#firewall_simple_iif_ipv6="ed1" # Inside IPv6 network interface for "simple" > +#firewall_simple_iif_ipv6="em1" # Inside IPv6 network interface for "simple" > # firewall. > #firewall_simple_inet_ipv6="2001:db8:2:800::/56" # Inside IPv6 network prefix > # for "simple" firewall. > -#firewall_simple_oif_ipv6="ed0" # Outside IPv6 network interface for "simple" > +#firewall_simple_oif_ipv6="em0" # Outside IPv6 network interface for "simple" > # firewall. > #firewall_simple_onet_ipv6="2001:db8:2:0::/56" # Outside IPv6 network prefix > # for "simple" firewall. > @@ -241,14 +241,14 @@ cloned_interfaces="" # List of cloned network interfa > #cloned_interfaces="gif0 gif1 gif2 gif3" # Pre-cloning GENERIC config. > #ifconfig_lo0="inet 127.0.0.1" # default loopback device configuration. > #ifconfig_lo0_alias0="inet 127.0.0.254 netmask 0xffffffff" # Sample alias entry. > -#ifconfig_ed0_ipv6="inet6 2001:db8:1::1 prefixlen 64" # Sample IPv6 addr entry > -#ifconfig_ed0_alias0="inet6 2001:db8:2::1 prefixlen 64" # Sample IPv6 alias > -#ifconfig_fxp0_name="net0" # Change interface name from fxp0 to net0. > -#vlans_fxp0="101 vlan0" # vlan(4) interfaces for fxp0 device > +#ifconfig_em0_ipv6="inet6 2001:db8:1::1 prefixlen 64" # Sample IPv6 addr entry > +#ifconfig_em0_alias0="inet6 2001:db8:2::1 prefixlen 64" # Sample IPv6 alias > +#ifconfig_em0_name="net0" # Change interface name from em0 to net0. > +#vlans_em0="101 vlan0" # vlan(4) interfaces for em0 device > #create_args_vlan0="vlan 102" # vlan tag for vlan0 device > #wlans_ath0="wlan0" # wlan(4) interfaces for ath0 device > #wlandebug_wlan0="scan+auth+assoc" # Set debug flags with wlandebug(8) > -#ipv4_addrs_fxp0="192.168.0.1/24 192.168.1.1-5/28" # example IPv4 address entry. > +#ipv4_addrs_em0="192.168.0.1/24 192.168.1.1-5/28" # example IPv4 address entry. > # > #autobridge_interfaces="bridge0" # List of bridges to check > #autobridge_bridge0="tap* vlan0" # Interface glob to automatically add to the bridge > @@ -336,7 +336,7 @@ bootparamd_flags="" # Flags to bootparamd > pppoed_enable="NO" # Run the PPP over Ethernet daemon. > pppoed_provider="*" # Provider and ppp(8) config file entry. > pppoed_flags="-P /var/run/pppoed.pid" # Flags to pppoed (if enabled). > -pppoed_interface="fxp0" # The interface that pppoed runs on. > +pppoed_interface="em0" # The interface that pppoed runs on. This one effects a higher likely used default. > sshd_enable="NO" # Enable sshd > sshd_program="/usr/sbin/sshd" # path to sshd, if you want a different one. > sshd_flags="" # Additional flags for sshd. > @@ -506,11 +506,11 @@ route6d_flags="" # Flags to IPv6 routing daemon. > # addrs. > #route6d_flags="-q" # If you want to run a routing daemon on an end > # node, you should stop advertisement. > -#ipv6_network_interfaces="ed0 ep0" # Examples for router > +#ipv6_network_interfaces="em0 em1" # Examples for router > # or static configuration for end node. > # Choose correct prefix value. > -#ipv6_prefix_ed0="fec0:0000:0000:0001 fec0:0000:0000:0002" # Examples for rtr. > -#ipv6_prefix_ep0="fec0:0000:0000:0003 fec0:0000:0000:0004" # Examples for rtr. > +#ipv6_prefix_em0="fec0:0000:0000:0001 fec0:0000:0000:0002" # Examples for rtr. > +#ipv6_prefix_em1="fec0:0000:0000:0003 fec0:0000:0000:0004" # Examples for rtr. > ipv6_default_interface="NO" # Default output interface for scoped addrs. > # This works only with > # ipv6_gateway_enable="NO". > > Modified: stable/12/sbin/ifconfig/ifconfig.8 > ============================================================================== > --- stable/12/sbin/ifconfig/ifconfig.8 Mon May 20 21:23:33 2019 (r348011) > +++ stable/12/sbin/ifconfig/ifconfig.8 Mon May 20 21:33:22 2019 (r348012) > @@ -28,7 +28,7 @@ > .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 > .\" $FreeBSD$ > .\" > -.Dd June 27, 2018 > +.Dd May 18, 2019 > .Dt IFCONFIG 8 > .Os > .Sh NAME > @@ -196,7 +196,7 @@ This > parameter is a string of the form > .Dq name unit , > for example, > -.Dq Li ed0 . > +.Dq Li em0 . > .It Ar groupname > List the interfaces in the given group. > .El > @@ -2919,26 +2919,26 @@ Assign the IPv4 address > with a network mask of > .Li 255.255.255.0 , > to the interface > -.Li fxp0 : > -.Dl # ifconfig fxp0 inet 192.0.2.10 netmask 255.255.255.0 > +.Li em0 : > +.Dl # ifconfig em0 inet 192.0.2.10 netmask 255.255.255.0 > .Pp > Add the IPv4 address > .Li 192.0.2.45 , > with the CIDR network prefix > .Li /28 , > to the interface > -.Li ed0 , > +.Li em0 , > using > .Cm add > as a synonym for the canonical form of the option > .Cm alias : > -.Dl # ifconfig ed0 inet 192.0.2.45/28 add > +.Dl # ifconfig em0 inet 192.0.2.45/28 add > .Pp > Remove the IPv4 address > .Li 192.0.2.45 > from the interface > -.Li ed0 : > -.Dl # ifconfig ed0 inet 192.0.2.45 -alias > +.Li em0 : > +.Dl # ifconfig em0 inet 192.0.2.45 -alias > .Pp > Enable IPv6 functionality of the interface: > .Dl # ifconfig em0 inet6 -ifdisabled > > Modified: stable/12/share/man/man5/rc.conf.5 > ============================================================================== > --- stable/12/share/man/man5/rc.conf.5 Mon May 20 21:23:33 2019 (r348011) > +++ stable/12/share/man/man5/rc.conf.5 Mon May 20 21:33:22 2019 (r348012) > @@ -24,7 +24,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd March 21, 2019 > +.Dd May 18, 2019 > .Dt RC.CONF 5 > .Os > .Sh NAME > @@ -1262,11 +1262,11 @@ It is possible to add IP alias entries using > syntax with the address family keyword such as > .Li inet . > Assuming that the interface in question was > -.Li ed0 , > +.Li em0 , > it might look something like this: > .Bd -literal > -ifconfig_ed0_alias0="inet 127.0.0.253 netmask 0xffffffff" > -ifconfig_ed0_alias1="inet 127.0.0.254 netmask 0xffffffff" > +ifconfig_em0_alias0="inet 127.0.0.253 netmask 0xffffffff" > +ifconfig_em0_alias1="inet 127.0.0.254 netmask 0xffffffff" > .Ed > .Pp > It also possible to configure multiple IP addresses in Classless > @@ -1306,11 +1306,11 @@ not for the other address families such as > .Li inet6 . > .Pp > With the interface in question being > -.Li ed0 , > +.Li em0 , > an example could look like: > .Bd -literal > -ifconfig_ed0_alias2="inet 192.0.2.129/27" > -ifconfig_ed0_alias3="inet 192.0.2.1-5/28" > +ifconfig_em0_alias2="inet 192.0.2.129/27" > +ifconfig_em0_alias3="inet 192.0.2.1-5/28" > .Ed > .Pp > and so on. > @@ -1332,10 +1332,10 @@ its contents are passed to > Execution stops at the first unsuccessful access, so if > something like this is present: > .Bd -literal > -ifconfig_ed0_alias0="inet 127.0.0.251 netmask 0xffffffff" > -ifconfig_ed0_alias1="inet 127.0.0.252 netmask 0xffffffff" > -ifconfig_ed0_alias2="inet 127.0.0.253 netmask 0xffffffff" > -ifconfig_ed0_alias4="inet 127.0.0.254 netmask 0xffffffff" > +ifconfig_em0_alias0="inet 127.0.0.251 netmask 0xffffffff" > +ifconfig_em0_alias1="inet 127.0.0.252 netmask 0xffffffff" > +ifconfig_em0_alias2="inet 127.0.0.253 netmask 0xffffffff" > +ifconfig_em0_alias4="inet 127.0.0.254 netmask 0xffffffff" > .Ed > .Pp > Then note that alias4 would > @@ -1351,7 +1351,7 @@ variable, which has the same functionality as > .Va ifconfig_ Ns Ao Ar interface Ac Ns Va _alias Ns Aq Ar n > and can have all of entries in a variable like the following: > .Bd -literal > -ifconfig_ed0_aliases="\\ > +ifconfig_em0_aliases="\\ > inet 127.0.0.251 netmask 0xffffffff \\ > inet 127.0.0.252 netmask 0xffffffff \\ > inet 127.0.0.253 netmask 0xffffffff \\ > @@ -1458,11 +1458,11 @@ to the > .Va ifconfig_ Ns Aq Ar interface > variable. > For instance, to initialize the > -.Li ed0 > +.Li em0 > device via DHCP, > it is possible to use something like: > .Bd -literal > -ifconfig_ed0="DHCP" > +ifconfig_em0="DHCP" > .Ed > .Pp > If you want to configure your wireless interface with > @@ -1513,7 +1513,7 @@ variable. > .Pp > It is also possible to rename an interface by doing: > .Bd -literal > -ifconfig_ed0_name="net0" > +ifconfig_em0_name="net0" > ifconfig_net0="inet 192.0.2.1 netmask 0xffffff00" > .Ed > .It Va ipv6_enable > @@ -1686,8 +1686,8 @@ with > keyword. > For example: > .Bd -literal > -ifconfig_ed0_ipv6="inet6 2001:db8:1::1 prefixlen 64" > -ifconfig_ed0_alias0="inet6 2001:db8:2::1 prefixlen 64" > +ifconfig_em0_ipv6="inet6 2001:db8:1::1 prefixlen 64" > +ifconfig_em0_alias0="inet6 2001:db8:2::1 prefixlen 64" > .Ed > .Pp > Interfaces that have an > @@ -1714,7 +1714,7 @@ defined in > If only a link-local address is needed on the interface, > the following configuration can be used: > .Bd -literal > -ifconfig_ed0_ipv6="inet6 auto_linklocal" > +ifconfig_em0_ipv6="inet6 auto_linklocal" > .Ed > .Pp > A link-local address can also be configured manually. > @@ -1723,7 +1723,7 @@ so that it does not change when the network interface > card is replaced. > For example: > .Bd -literal > -ifconfig_ed0_ipv6="inet6 fe80::1 prefixlen 64" > +ifconfig_em0_ipv6="inet6 fe80::1 prefixlen 64" > .Ed > .It Va ipv6_prefix_ Ns Aq Ar interface > .Pq Vt str > @@ -1737,15 +1737,15 @@ is empty. > .Pp > For example, the following configuration > .Bd -literal > -ipv6_prefix_ed0="2001:db8:1:0 2001:db8:2:0" > +ipv6_prefix_em0="2001:db8:1:0 2001:db8:2:0" > .Ed > .Pp > is equivalent to the following: > .Bd -literal > -ifconfig_ed0_alias0="inet6 2001:db8:1:: eui64 prefixlen 64" > -ifconfig_ed0_alias1="inet6 2001:db8:1:: prefixlen 64 anycast" > -ifconfig_ed0_alias2="inet6 2001:db8:2:: eui64 prefixlen 64" > -ifconfig_ed0_alias3="inet6 2001:db8:2:: prefixlen 64 anycast" > +ifconfig_em0_alias0="inet6 2001:db8:1:: eui64 prefixlen 64" > +ifconfig_em0_alias1="inet6 2001:db8:1:: prefixlen 64 anycast" > +ifconfig_em0_alias2="inet6 2001:db8:2:: eui64 prefixlen 64" > +ifconfig_em0_alias3="inet6 2001:db8:2:: prefixlen 64 anycast" > .Ed > .Pp > These Subnet-Router anycast addresses will be added only when > > Modified: stable/12/tools/tools/tinybsd/conf/firewall/etc/rc.firewall > ============================================================================== > --- stable/12/tools/tools/tinybsd/conf/firewall/etc/rc.firewall Mon May 20 21:23:33 2019 (r348011) > +++ stable/12/tools/tools/tinybsd/conf/firewall/etc/rc.firewall Mon May 20 21:33:22 2019 (r348012) > @@ -195,13 +195,13 @@ case ${firewall_type} in > ############ > > # set these to your outside interface network and netmask and ip > - oif="ed0" > + oif="em0" > onet="192.0.2.0" > omask="255.255.255.240" > oip="192.0.2.1" > > # set these to your inside interface network and netmask and ip > - iif="ed1" > + iif="em1" > inet="192.0.2.16" > imask="255.255.255.240" > iip="192.0.2.17" > > Modified: stable/12/usr.sbin/jail/jail.8 > ============================================================================== > --- stable/12/usr.sbin/jail/jail.8 Mon May 20 21:23:33 2019 (r348011) > +++ stable/12/usr.sbin/jail/jail.8 Mon May 20 21:33:22 2019 (r348012) > @@ -25,7 +25,7 @@ > .\" > .\" $FreeBSD$ > .\" > -.Dd November 10, 2018 > +.Dd May 18, 2019 > .Dt JAIL 8 > .Os > .Sh NAME > @@ -1099,7 +1099,7 @@ testjail { > mount.devfs; > host.hostname = testhostname; > ip4.addr = 192.0.2.100; > - interface = ed0; > + interface = em0; > exec.start = "/bin/sh /etc/rc"; > exec.stop = "/bin/sh /etc/rc.shutdown"; > } > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-stable@freebsd.org Tue May 21 02:31:35 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D46B159E4B4; Tue, 21 May 2019 02:31:35 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 107D36F98D; Tue, 21 May 2019 02:31:35 +0000 (UTC) (envelope-from johalun@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DEB6927363; Tue, 21 May 2019 02:31:34 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4L2VYXI046844; Tue, 21 May 2019 02:31:34 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4L2VYEl046841; Tue, 21 May 2019 02:31:34 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201905210231.x4L2VYEl046841@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Tue, 21 May 2019 02:31:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348033 - in stable/12/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: in stable/12/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 348033 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 107D36F98D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.949,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 May 2019 02:31:35 -0000 Author: johalun Date: Tue May 21 02:31:34 2019 New Revision: 348033 URL: https://svnweb.freebsd.org/changeset/base/348033 Log: MFC r347592: LinuxKPI: Let del_timer return a value to match Linux. This patch is part of https://reviews.freebsd.org/D19565. Reviewed by: hps Approved by: imp (mentor), hps Modified: stable/12/sys/compat/linuxkpi/common/include/linux/timer.h stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/timer.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/timer.h Tue May 21 02:30:43 2019 (r348032) +++ stable/12/sys/compat/linuxkpi/common/include/linux/timer.h Tue May 21 02:31:34 2019 (r348033) @@ -81,8 +81,8 @@ extern unsigned long linux_timer_hz_mask; extern void mod_timer(struct timer_list *, int); extern void add_timer(struct timer_list *); extern void add_timer_on(struct timer_list *, int cpu); +extern int del_timer(struct timer_list *); -#define del_timer(timer) (void)callout_stop(&(timer)->callout) #define del_timer_sync(timer) (void)callout_drain(&(timer)->callout) #define timer_pending(timer) callout_pending(&(timer)->callout) #define round_jiffies(j) \ Modified: stable/12/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Tue May 21 02:30:43 2019 (r348032) +++ stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Tue May 21 02:31:34 2019 (r348033) @@ -1906,6 +1906,15 @@ add_timer_on(struct timer_list *timer, int cpu) &linux_timer_callback_wrapper, timer, cpu); } +int +del_timer(struct timer_list *timer) +{ + + if (callout_stop(&(timer)->callout) == -1) + return (0); + return (1); +} + static void linux_timer_init(void *arg) { From owner-svn-src-stable@freebsd.org Tue May 21 02:36:13 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 770B8159E7CB; Tue, 21 May 2019 02:36:13 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 148626FC05; Tue, 21 May 2019 02:36:13 +0000 (UTC) (envelope-from johalun@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E4EB9274B5; Tue, 21 May 2019 02:36:12 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4L2aCna048109; Tue, 21 May 2019 02:36:12 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4L2aCSO048108; Tue, 21 May 2019 02:36:12 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201905210236.x4L2aCSO048108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Tue, 21 May 2019 02:36:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348034 - stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 348034 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 148626FC05 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.949,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 May 2019 02:36:13 -0000 Author: johalun Date: Tue May 21 02:36:12 2019 New Revision: 348034 URL: https://svnweb.freebsd.org/changeset/base/348034 Log: MFC r347600: LinuxKPI: Add vm_fault_t type. This patch is part of D19565 Reviewed by: hps Approved by: imp (mentor), hps Modified: stable/12/sys/compat/linuxkpi/common/include/linux/mm_types.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/mm_types.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/mm_types.h Tue May 21 02:31:34 2019 (r348033) +++ stable/12/sys/compat/linuxkpi/common/include/linux/mm_types.h Tue May 21 02:36:12 2019 (r348034) @@ -35,6 +35,8 @@ #include +typedef int vm_fault_t; + struct vm_area_struct; struct task_struct; From owner-svn-src-stable@freebsd.org Tue May 21 02:38:22 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2A1B9159E887; Tue, 21 May 2019 02:38:22 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BD8256FD2D; Tue, 21 May 2019 02:38:21 +0000 (UTC) (envelope-from johalun@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9150F274B8; Tue, 21 May 2019 02:38:21 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4L2cLQ5048258; Tue, 21 May 2019 02:38:21 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4L2cLoA048257; Tue, 21 May 2019 02:38:21 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201905210238.x4L2cLoA048257@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Tue, 21 May 2019 02:38:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348035 - stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 348035 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BD8256FD2D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.949,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 May 2019 02:38:22 -0000 Author: johalun Date: Tue May 21 02:38:21 2019 New Revision: 348035 URL: https://svnweb.freebsd.org/changeset/base/348035 Log: MFC r347601: LinuxKPI: Add prepare to pm_ops and bump FreeBSD version. This patch is part of D19565 Reviewed by: hps Approved by: imp (mentor), hps Modified: stable/12/sys/compat/linuxkpi/common/include/linux/device.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/device.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/device.h Tue May 21 02:36:12 2019 (r348034) +++ stable/12/sys/compat/linuxkpi/common/include/linux/device.h Tue May 21 02:38:21 2019 (r348035) @@ -61,6 +61,7 @@ struct class { }; struct dev_pm_ops { + int (*prepare)(struct device *dev); int (*suspend)(struct device *dev); int (*suspend_late)(struct device *dev); int (*resume)(struct device *dev); From owner-svn-src-stable@freebsd.org Tue May 21 02:42:43 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3236159EC6C; Tue, 21 May 2019 02:42:43 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 71235701B4; Tue, 21 May 2019 02:42:43 +0000 (UTC) (envelope-from johalun@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 480EF27675; Tue, 21 May 2019 02:42:43 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4L2gh8H053131; Tue, 21 May 2019 02:42:43 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4L2gh1c053130; Tue, 21 May 2019 02:42:43 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201905210242.x4L2gh1c053130@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Tue, 21 May 2019 02:42:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348036 - stable/12/sys/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: stable/12/sys/sys X-SVN-Commit-Revision: 348036 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 71235701B4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.949,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 May 2019 02:42:44 -0000 Author: johalun Date: Tue May 21 02:42:42 2019 New Revision: 348036 URL: https://svnweb.freebsd.org/changeset/base/348036 Log: Bump FreeBSD version after change to struct in linuxkpi from r348035. Modified: stable/12/sys/sys/param.h Modified: stable/12/sys/sys/param.h ============================================================================== --- stable/12/sys/sys/param.h Tue May 21 02:38:21 2019 (r348035) +++ stable/12/sys/sys/param.h Tue May 21 02:42:42 2019 (r348036) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200509 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200510 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable@freebsd.org Tue May 21 15:19:50 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F35F315B03A1; Tue, 21 May 2019 15:19:49 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 98A606AC1D; Tue, 21 May 2019 15:19:49 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 88E017805; Tue, 21 May 2019 15:19:49 +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 x4LFJnRw048308; Tue, 21 May 2019 15:19:49 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4LFJn33048307; Tue, 21 May 2019 15:19:49 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201905211519.x4LFJn33048307@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 21 May 2019 15:19:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348053 - stable/12/sys/x86/include X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/x86/include X-SVN-Commit-Revision: 348053 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 98A606AC1D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.93)[-0.933,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 May 2019 15:19:50 -0000 Author: kib Date: Tue May 21 15:19:49 2019 New Revision: 348053 URL: https://svnweb.freebsd.org/changeset/base/348053 Log: MFC r347216: amd64: fix BUS_SPACE_MAXSIZE to 64bit max value. Modified: stable/12/sys/x86/include/bus.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/x86/include/bus.h ============================================================================== --- stable/12/sys/x86/include/bus.h Tue May 21 15:12:13 2019 (r348052) +++ stable/12/sys/x86/include/bus.h Tue May 21 15:19:49 2019 (r348053) @@ -114,7 +114,11 @@ #define BUS_SPACE_MAXSIZE_24BIT 0xFFFFFF #define BUS_SPACE_MAXSIZE_32BIT 0xFFFFFFFF +#if defined(__amd64__) +#define BUS_SPACE_MAXSIZE 0xFFFFFFFFFFFFFFFFULL +#else #define BUS_SPACE_MAXSIZE 0xFFFFFFFF +#endif #define BUS_SPACE_MAXADDR_24BIT 0xFFFFFF #define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFF #if defined(__amd64__) || defined(PAE) From owner-svn-src-stable@freebsd.org Tue May 21 16:15:14 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7BCA515B190F; Tue, 21 May 2019 16:15:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1AD9E6CC38; Tue, 21 May 2019 16:15:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-3.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 7AC368192; Tue, 21 May 2019 16:15:12 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r348012 - in stable/12: libexec/rc sbin/ifconfig share/man/man5 tools/tools/tinybsd/conf/firewall/etc usr.sbin/jail To: rgrimes@freebsd.org, Brooks Davis Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org References: <201905210130.x4L1UQhN076511@gndrsh.dnsmgr.net> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <951303cd-eef0-725f-7a5f-60d8adc1819f@FreeBSD.org> Date: Tue, 21 May 2019 09:15:11 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <201905210130.x4L1UQhN076511@gndrsh.dnsmgr.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 1AD9E6CC38 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.96 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.956,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 May 2019 16:15:14 -0000 On 5/20/19 6:30 PM, Rodney W. Grimes wrote: >> Author: brooks >> Date: Mon May 20 21:33:22 2019 >> New Revision: 348012 >> URL: https://svnweb.freebsd.org/changeset/base/348012 >> >> Log: >> MFC r347963: >> >> Change ed(4), ep(4), and fxp(4) examples to em(4). >> >> ed(4) and ep(4) will be removed in FreeBSD 13. fxp(4) remains >> popular in older systems, but isn't as future proof as em(4). >> >> Reviewed by: bz, jhb >> Differential Revision: https://reviews.freebsd.org/D20311 > > Though this made since to me in head, it does not in stable, > as you may of just broke someones running system when they > do a merge master if they happened to of depended on the very > long standing defaults of fxp that are NOT in comment lines > below. > > IMHO we should not change user visible defaults > in /etc/defaults/rc.conf on a brance, mininal is > this requires some form of merge master update notice > mechanism which we do not have. While I agree with the sentiment, the fact that these values are set is just broken. The ones that aren't already comments should be fixed to be comments in HEAD at least. I think it is safe to merge all of the changes that aren't uncommented lines in rc.conf though. -- John Baldwin From owner-svn-src-stable@freebsd.org Tue May 21 16:36:31 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D94B015B1DF3; Tue, 21 May 2019 16:36:30 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 70C946D654; Tue, 21 May 2019 16:36:30 +0000 (UTC) (envelope-from brooks@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 36AF2859C; Tue, 21 May 2019 16:36:30 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4LGaU07089933; Tue, 21 May 2019 16:36:30 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4LGaT3B089926; Tue, 21 May 2019 16:36:29 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201905211636.x4LGaT3B089926@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 21 May 2019 16:36:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348055 - in stable/12: libexec/rc sbin/ifconfig share/man/man5 tools/tools/tinybsd/conf/firewall/etc usr.sbin/jail X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in stable/12: libexec/rc sbin/ifconfig share/man/man5 tools/tools/tinybsd/conf/firewall/etc usr.sbin/jail X-SVN-Commit-Revision: 348055 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 70C946D654 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 May 2019 16:36:31 -0000 Author: brooks Date: Tue May 21 16:36:28 2019 New Revision: 348055 URL: https://svnweb.freebsd.org/changeset/base/348055 Log: Revert r348012, MFC r347963. Several of the changes touch actual defaults. These defaults are all mistakes and no one should rely on them, but changing them in a stable branch is clearly inappropriate. Reported by: rgrimes Modified: stable/12/libexec/rc/rc.conf stable/12/sbin/ifconfig/ifconfig.8 stable/12/share/man/man5/rc.conf.5 stable/12/tools/tools/tinybsd/conf/firewall/etc/rc.firewall stable/12/usr.sbin/jail/jail.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rc/rc.conf ============================================================================== --- stable/12/libexec/rc/rc.conf Tue May 21 15:59:17 2019 (r348054) +++ stable/12/libexec/rc/rc.conf Tue May 21 16:36:28 2019 (r348055) @@ -121,9 +121,9 @@ hostid_file="/etc/hostid" # File with hostuuid. nisdomainname="NO" # Set to NIS domain if using NIS (or NO). dhclient_program="/sbin/dhclient" # Path to dhcp client program. dhclient_flags="" # Extra flags to pass to dhcp client. -#dhclient_flags_em0="" # Extra dhclient flags for em0 only +#dhclient_flags_fxp0="" # Extra dhclient flags for fxp0 only background_dhclient="NO" # Start dhcp client in the background. -#background_dhclient_em0="YES" # Start dhcp client on em0 in the background. +#background_dhclient_fxp0="YES" # Start dhcp client on fxp0 in the background. synchronous_dhclient="NO" # Start dhclient directly on configured # interfaces during startup. defaultroute_delay="30" # Time to wait for a default route on a DHCP interface. @@ -147,19 +147,19 @@ firewall_client_net="192.0.2.0/24" # IPv4 Network addr # firewall. #firewall_client_net_ipv6="2001:db8:2:1::/64" # IPv6 network prefix for # "client" firewall. -firewall_simple_iif="em1" # Inside network interface for "simple" +firewall_simple_iif="ed1" # Inside network interface for "simple" # firewall. firewall_simple_inet="192.0.2.16/28" # Inside network address for "simple" # firewall. -firewall_simple_oif="em0" # Outside network interface for "simple" +firewall_simple_oif="ed0" # Outside network interface for "simple" # firewall. firewall_simple_onet="192.0.2.0/28" # Outside network address for "simple" # firewall. -#firewall_simple_iif_ipv6="em1" # Inside IPv6 network interface for "simple" +#firewall_simple_iif_ipv6="ed1" # Inside IPv6 network interface for "simple" # firewall. #firewall_simple_inet_ipv6="2001:db8:2:800::/56" # Inside IPv6 network prefix # for "simple" firewall. -#firewall_simple_oif_ipv6="em0" # Outside IPv6 network interface for "simple" +#firewall_simple_oif_ipv6="ed0" # Outside IPv6 network interface for "simple" # firewall. #firewall_simple_onet_ipv6="2001:db8:2:0::/56" # Outside IPv6 network prefix # for "simple" firewall. @@ -241,14 +241,14 @@ cloned_interfaces="" # List of cloned network interfa #cloned_interfaces="gif0 gif1 gif2 gif3" # Pre-cloning GENERIC config. #ifconfig_lo0="inet 127.0.0.1" # default loopback device configuration. #ifconfig_lo0_alias0="inet 127.0.0.254 netmask 0xffffffff" # Sample alias entry. -#ifconfig_em0_ipv6="inet6 2001:db8:1::1 prefixlen 64" # Sample IPv6 addr entry -#ifconfig_em0_alias0="inet6 2001:db8:2::1 prefixlen 64" # Sample IPv6 alias -#ifconfig_em0_name="net0" # Change interface name from em0 to net0. -#vlans_em0="101 vlan0" # vlan(4) interfaces for em0 device +#ifconfig_ed0_ipv6="inet6 2001:db8:1::1 prefixlen 64" # Sample IPv6 addr entry +#ifconfig_ed0_alias0="inet6 2001:db8:2::1 prefixlen 64" # Sample IPv6 alias +#ifconfig_fxp0_name="net0" # Change interface name from fxp0 to net0. +#vlans_fxp0="101 vlan0" # vlan(4) interfaces for fxp0 device #create_args_vlan0="vlan 102" # vlan tag for vlan0 device #wlans_ath0="wlan0" # wlan(4) interfaces for ath0 device #wlandebug_wlan0="scan+auth+assoc" # Set debug flags with wlandebug(8) -#ipv4_addrs_em0="192.168.0.1/24 192.168.1.1-5/28" # example IPv4 address entry. +#ipv4_addrs_fxp0="192.168.0.1/24 192.168.1.1-5/28" # example IPv4 address entry. # #autobridge_interfaces="bridge0" # List of bridges to check #autobridge_bridge0="tap* vlan0" # Interface glob to automatically add to the bridge @@ -336,7 +336,7 @@ bootparamd_flags="" # Flags to bootparamd pppoed_enable="NO" # Run the PPP over Ethernet daemon. pppoed_provider="*" # Provider and ppp(8) config file entry. pppoed_flags="-P /var/run/pppoed.pid" # Flags to pppoed (if enabled). -pppoed_interface="em0" # The interface that pppoed runs on. +pppoed_interface="fxp0" # The interface that pppoed runs on. sshd_enable="NO" # Enable sshd sshd_program="/usr/sbin/sshd" # path to sshd, if you want a different one. sshd_flags="" # Additional flags for sshd. @@ -506,11 +506,11 @@ route6d_flags="" # Flags to IPv6 routing daemon. # addrs. #route6d_flags="-q" # If you want to run a routing daemon on an end # node, you should stop advertisement. -#ipv6_network_interfaces="em0 em1" # Examples for router +#ipv6_network_interfaces="ed0 ep0" # Examples for router # or static configuration for end node. # Choose correct prefix value. -#ipv6_prefix_em0="fec0:0000:0000:0001 fec0:0000:0000:0002" # Examples for rtr. -#ipv6_prefix_em1="fec0:0000:0000:0003 fec0:0000:0000:0004" # Examples for rtr. +#ipv6_prefix_ed0="fec0:0000:0000:0001 fec0:0000:0000:0002" # Examples for rtr. +#ipv6_prefix_ep0="fec0:0000:0000:0003 fec0:0000:0000:0004" # Examples for rtr. ipv6_default_interface="NO" # Default output interface for scoped addrs. # This works only with # ipv6_gateway_enable="NO". Modified: stable/12/sbin/ifconfig/ifconfig.8 ============================================================================== --- stable/12/sbin/ifconfig/ifconfig.8 Tue May 21 15:59:17 2019 (r348054) +++ stable/12/sbin/ifconfig/ifconfig.8 Tue May 21 16:36:28 2019 (r348055) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd May 18, 2019 +.Dd May 3, 2019 .Dt IFCONFIG 8 .Os .Sh NAME @@ -196,7 +196,7 @@ This parameter is a string of the form .Dq name unit , for example, -.Dq Li em0 . +.Dq Li ed0 . .It Ar groupname List the interfaces in the given group. .El @@ -2919,26 +2919,26 @@ Assign the IPv4 address with a network mask of .Li 255.255.255.0 , to the interface -.Li em0 : -.Dl # ifconfig em0 inet 192.0.2.10 netmask 255.255.255.0 +.Li fxp0 : +.Dl # ifconfig fxp0 inet 192.0.2.10 netmask 255.255.255.0 .Pp Add the IPv4 address .Li 192.0.2.45 , with the CIDR network prefix .Li /28 , to the interface -.Li em0 , +.Li ed0 , using .Cm add as a synonym for the canonical form of the option .Cm alias : -.Dl # ifconfig em0 inet 192.0.2.45/28 add +.Dl # ifconfig ed0 inet 192.0.2.45/28 add .Pp Remove the IPv4 address .Li 192.0.2.45 from the interface -.Li em0 : -.Dl # ifconfig em0 inet 192.0.2.45 -alias +.Li ed0 : +.Dl # ifconfig ed0 inet 192.0.2.45 -alias .Pp Enable IPv6 functionality of the interface: .Dl # ifconfig em0 inet6 -ifdisabled Modified: stable/12/share/man/man5/rc.conf.5 ============================================================================== --- stable/12/share/man/man5/rc.conf.5 Tue May 21 15:59:17 2019 (r348054) +++ stable/12/share/man/man5/rc.conf.5 Tue May 21 16:36:28 2019 (r348055) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 18, 2019 +.Dd March 21, 2019 .Dt RC.CONF 5 .Os .Sh NAME @@ -1262,11 +1262,11 @@ It is possible to add IP alias entries using syntax with the address family keyword such as .Li inet . Assuming that the interface in question was -.Li em0 , +.Li ed0 , it might look something like this: .Bd -literal -ifconfig_em0_alias0="inet 127.0.0.253 netmask 0xffffffff" -ifconfig_em0_alias1="inet 127.0.0.254 netmask 0xffffffff" +ifconfig_ed0_alias0="inet 127.0.0.253 netmask 0xffffffff" +ifconfig_ed0_alias1="inet 127.0.0.254 netmask 0xffffffff" .Ed .Pp It also possible to configure multiple IP addresses in Classless @@ -1306,11 +1306,11 @@ not for the other address families such as .Li inet6 . .Pp With the interface in question being -.Li em0 , +.Li ed0 , an example could look like: .Bd -literal -ifconfig_em0_alias2="inet 192.0.2.129/27" -ifconfig_em0_alias3="inet 192.0.2.1-5/28" +ifconfig_ed0_alias2="inet 192.0.2.129/27" +ifconfig_ed0_alias3="inet 192.0.2.1-5/28" .Ed .Pp and so on. @@ -1332,10 +1332,10 @@ its contents are passed to Execution stops at the first unsuccessful access, so if something like this is present: .Bd -literal -ifconfig_em0_alias0="inet 127.0.0.251 netmask 0xffffffff" -ifconfig_em0_alias1="inet 127.0.0.252 netmask 0xffffffff" -ifconfig_em0_alias2="inet 127.0.0.253 netmask 0xffffffff" -ifconfig_em0_alias4="inet 127.0.0.254 netmask 0xffffffff" +ifconfig_ed0_alias0="inet 127.0.0.251 netmask 0xffffffff" +ifconfig_ed0_alias1="inet 127.0.0.252 netmask 0xffffffff" +ifconfig_ed0_alias2="inet 127.0.0.253 netmask 0xffffffff" +ifconfig_ed0_alias4="inet 127.0.0.254 netmask 0xffffffff" .Ed .Pp Then note that alias4 would @@ -1351,7 +1351,7 @@ variable, which has the same functionality as .Va ifconfig_ Ns Ao Ar interface Ac Ns Va _alias Ns Aq Ar n and can have all of entries in a variable like the following: .Bd -literal -ifconfig_em0_aliases="\\ +ifconfig_ed0_aliases="\\ inet 127.0.0.251 netmask 0xffffffff \\ inet 127.0.0.252 netmask 0xffffffff \\ inet 127.0.0.253 netmask 0xffffffff \\ @@ -1458,11 +1458,11 @@ to the .Va ifconfig_ Ns Aq Ar interface variable. For instance, to initialize the -.Li em0 +.Li ed0 device via DHCP, it is possible to use something like: .Bd -literal -ifconfig_em0="DHCP" +ifconfig_ed0="DHCP" .Ed .Pp If you want to configure your wireless interface with @@ -1513,7 +1513,7 @@ variable. .Pp It is also possible to rename an interface by doing: .Bd -literal -ifconfig_em0_name="net0" +ifconfig_ed0_name="net0" ifconfig_net0="inet 192.0.2.1 netmask 0xffffff00" .Ed .It Va ipv6_enable @@ -1686,8 +1686,8 @@ with keyword. For example: .Bd -literal -ifconfig_em0_ipv6="inet6 2001:db8:1::1 prefixlen 64" -ifconfig_em0_alias0="inet6 2001:db8:2::1 prefixlen 64" +ifconfig_ed0_ipv6="inet6 2001:db8:1::1 prefixlen 64" +ifconfig_ed0_alias0="inet6 2001:db8:2::1 prefixlen 64" .Ed .Pp Interfaces that have an @@ -1714,7 +1714,7 @@ defined in If only a link-local address is needed on the interface, the following configuration can be used: .Bd -literal -ifconfig_em0_ipv6="inet6 auto_linklocal" +ifconfig_ed0_ipv6="inet6 auto_linklocal" .Ed .Pp A link-local address can also be configured manually. @@ -1723,7 +1723,7 @@ so that it does not change when the network interface card is replaced. For example: .Bd -literal -ifconfig_em0_ipv6="inet6 fe80::1 prefixlen 64" +ifconfig_ed0_ipv6="inet6 fe80::1 prefixlen 64" .Ed .It Va ipv6_prefix_ Ns Aq Ar interface .Pq Vt str @@ -1737,15 +1737,15 @@ is empty. .Pp For example, the following configuration .Bd -literal -ipv6_prefix_em0="2001:db8:1:0 2001:db8:2:0" +ipv6_prefix_ed0="2001:db8:1:0 2001:db8:2:0" .Ed .Pp is equivalent to the following: .Bd -literal -ifconfig_em0_alias0="inet6 2001:db8:1:: eui64 prefixlen 64" -ifconfig_em0_alias1="inet6 2001:db8:1:: prefixlen 64 anycast" -ifconfig_em0_alias2="inet6 2001:db8:2:: eui64 prefixlen 64" -ifconfig_em0_alias3="inet6 2001:db8:2:: prefixlen 64 anycast" +ifconfig_ed0_alias0="inet6 2001:db8:1:: eui64 prefixlen 64" +ifconfig_ed0_alias1="inet6 2001:db8:1:: prefixlen 64 anycast" +ifconfig_ed0_alias2="inet6 2001:db8:2:: eui64 prefixlen 64" +ifconfig_ed0_alias3="inet6 2001:db8:2:: prefixlen 64 anycast" .Ed .Pp These Subnet-Router anycast addresses will be added only when Modified: stable/12/tools/tools/tinybsd/conf/firewall/etc/rc.firewall ============================================================================== --- stable/12/tools/tools/tinybsd/conf/firewall/etc/rc.firewall Tue May 21 15:59:17 2019 (r348054) +++ stable/12/tools/tools/tinybsd/conf/firewall/etc/rc.firewall Tue May 21 16:36:28 2019 (r348055) @@ -195,13 +195,13 @@ case ${firewall_type} in ############ # set these to your outside interface network and netmask and ip - oif="em0" + oif="ed0" onet="192.0.2.0" omask="255.255.255.240" oip="192.0.2.1" # set these to your inside interface network and netmask and ip - iif="em1" + iif="ed1" inet="192.0.2.16" imask="255.255.255.240" iip="192.0.2.17" Modified: stable/12/usr.sbin/jail/jail.8 ============================================================================== --- stable/12/usr.sbin/jail/jail.8 Tue May 21 15:59:17 2019 (r348054) +++ stable/12/usr.sbin/jail/jail.8 Tue May 21 16:36:28 2019 (r348055) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 18, 2019 +.Dd November 27, 2018 .Dt JAIL 8 .Os .Sh NAME @@ -1099,7 +1099,7 @@ testjail { mount.devfs; host.hostname = testhostname; ip4.addr = 192.0.2.100; - interface = em0; + interface = ed0; exec.start = "/bin/sh /etc/rc"; exec.stop = "/bin/sh /etc/rc.shutdown"; } From owner-svn-src-stable@freebsd.org Tue May 21 16:40:36 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2A4F15B1F6C; Tue, 21 May 2019 16:40:35 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: from spindle.one-eyed-alien.net (spindle.one-eyed-alien.net [199.48.129.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9665E6DA57; Tue, 21 May 2019 16:40:35 +0000 (UTC) (envelope-from brooks@spindle.one-eyed-alien.net) Received: by spindle.one-eyed-alien.net (Postfix, from userid 3001) id DBCC93C475F; Tue, 21 May 2019 16:40:33 +0000 (UTC) Date: Tue, 21 May 2019 16:40:33 +0000 From: Brooks Davis To: rgrimes@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: Re: svn commit: r348012 - in stable/12: libexec/rc sbin/ifconfig share/man/man5 tools/tools/tinybsd/conf/firewall/etc usr.sbin/jail Message-ID: <20190521164033.GG68351@spindle.one-eyed-alien.net> References: <201905202133.x4KLXMPE088717@repo.freebsd.org> <201905210130.x4L1UQhN076511@gndrsh.dnsmgr.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="cYtjc4pxslFTELvY" Content-Disposition: inline In-Reply-To: <201905210130.x4L1UQhN076511@gndrsh.dnsmgr.net> User-Agent: Mutt/1.9.4 (2018-02-28) X-Rspamd-Queue-Id: 9665E6DA57 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.92 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.92)[-0.921,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 May 2019 16:40:36 -0000 --cYtjc4pxslFTELvY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, May 20, 2019 at 06:30:26PM -0700, Rodney W. Grimes wrote: > > Author: brooks > > Date: Mon May 20 21:33:22 2019 > > New Revision: 348012 > > URL: https://svnweb.freebsd.org/changeset/base/348012 > >=20 > > Log: > > MFC r347963: > > =20 > > Change ed(4), ep(4), and fxp(4) examples to em(4). > > =20 > > ed(4) and ep(4) will be removed in FreeBSD 13. fxp(4) remains > > popular in older systems, but isn't as future proof as em(4). > > =20 > > Reviewed by: bz, jhb > > Differential Revision: https://reviews.freebsd.org/D20311 >=20 > Though this made since to me in head, it does not in stable, > as you may of just broke someones running system when they > do a merge master if they happened to of depended on the very > long standing defaults of fxp that are NOT in comment lines > below. I didn't really thing about fact these are actual defaults. We should comment out or remove most/all of these out. They are a terrible idea... I've reverted in r348055. -- Brooks --cYtjc4pxslFTELvY Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJc5CoBAAoJEKzQXbSebgfAhYEH/iYSrjerHOr41M0KP2TN+/Mf SENkSYdTWBPQwZsYd9to/y7ybOUGKZfzoa5s8HZN9wdOpditdiKc6cCHEhXC1HwJ T2kNfPMJ3XO6IMdRGwCeSHekIG8giTntw2IjhX7rF6eWUMjEYJctqwzSv9CP2WIm qdOg6ychO6UohChzS7aMVtr5H1tcd4efc5C61IdF/lJU7T7dwvk/VSeoB5GWhJCw nXII3Mvb4t4uSfNHwuRMJXsOH2g+FGJ29mG3/Kg1lg14s2+3NpbBea49NwadBydZ tNLS/UN06Tju+LO89FWFD/uOZwRjzUGfVZmsMuCI0mxiMrLPcf3P3R7cUBUe7jk= =4gpw -----END PGP SIGNATURE----- --cYtjc4pxslFTELvY-- From owner-svn-src-stable@freebsd.org Tue May 21 16:54:17 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 475D715B2676; Tue, 21 May 2019 16:54:17 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C81A06E438; Tue, 21 May 2019 16:54:16 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x4LGsEDv080016; Tue, 21 May 2019 09:54:14 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x4LGsEAR080015; Tue, 21 May 2019 09:54:14 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201905211654.x4LGsEAR080015@gndrsh.dnsmgr.net> Subject: Re: svn commit: r348012 - in stable/12: libexec/rc sbin/ifconfig share/man/man5 tools/tools/tinybsd/conf/firewall/etc usr.sbin/jail In-Reply-To: <20190521164033.GG68351@spindle.one-eyed-alien.net> To: Brooks Davis Date: Tue, 21 May 2019 09:54:14 -0700 (PDT) CC: rgrimes@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: C81A06E438 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.98)[-0.977,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 May 2019 16:54:17 -0000 > On Mon, May 20, 2019 at 06:30:26PM -0700, Rodney W. Grimes wrote: > > > Author: brooks > > > Date: Mon May 20 21:33:22 2019 > > > New Revision: 348012 > > > URL: https://svnweb.freebsd.org/changeset/base/348012 > > > > > > Log: > > > MFC r347963: > > > > > > Change ed(4), ep(4), and fxp(4) examples to em(4). > > > > > > ed(4) and ep(4) will be removed in FreeBSD 13. fxp(4) remains > > > popular in older systems, but isn't as future proof as em(4). > > > > > > Reviewed by: bz, jhb > > > Differential Revision: https://reviews.freebsd.org/D20311 > > > > Though this made since to me in head, it does not in stable, > > as you may of just broke someones running system when they > > do a merge master if they happened to of depended on the very > > long standing defaults of fxp that are NOT in comment lines > > below. > > I didn't really thing about fact these are actual defaults. We should > comment out or remove most/all of these out. They are a terrible idea... > > I've reverted in r348055. Thank you, and I fully agree on the terrible idea, perhaps look at rewritting the effected code so that it errors out or at least warns if these values are not set, then remove the setting of them in etc/default/rc.conf would be one way to clean this up. > -- Brooks -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-stable@freebsd.org Tue May 21 16:09:56 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD3A615B1668; Tue, 21 May 2019 16:09:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 80BC76C766; Tue, 21 May 2019 16:09:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-3.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 174DF804E; Tue, 21 May 2019 16:09:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r347951 - stable/12/lib/libc/stdlib To: rgrimes@freebsd.org, Warner Losh Cc: Yoshihiro Ota , "Rodney W. Grimes" , Benedict Reuschling , src-committers , svn-src-stable@freebsd.org, svn-src-all , svn-src-stable-12@freebsd.org, Bruce Evans , Konstantin Belousov References: <201905201734.x4KHY7wH074764@gndrsh.dnsmgr.net> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <00fa30ef-a454-d658-d81f-74efbe1d0429@FreeBSD.org> Date: Tue, 21 May 2019 09:09:52 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <201905201734.x4KHY7wH074764@gndrsh.dnsmgr.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 80BC76C766 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.95 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-Mailman-Approved-At: Tue, 21 May 2019 18:22:46 +0000 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 May 2019 16:09:56 -0000 On 5/20/19 10:34 AM, Rodney W. Grimes wrote: >> On Sun, May 19, 2019 at 9:56 AM Yoshihiro Ota wrote: >> >>> I wonder if we can use a tool to confirm coding style like >>> clang-format or something else. >>> >> >> I don't know... it might be hard to do that inside a man page... > > Given the current tooling I concur, so we need .include > for mandoc, and teach mandoc how to format example code which > is mostly knows how to do, or atleast there was lots of groff > code to do that. I would prefer this approach if at all possible. -- John Baldwin From owner-svn-src-stable@freebsd.org Wed May 22 03:54:26 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6AB73159AD24; Wed, 22 May 2019 03:54:26 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 02B1C8F3F0; Wed, 22 May 2019 03:54:26 +0000 (UTC) (envelope-from johalun@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9AFFCFE3B; Wed, 22 May 2019 03:54:25 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4M3sP8d046530; Wed, 22 May 2019 03:54:25 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4M3sPsE046529; Wed, 22 May 2019 03:54:25 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201905220354.x4M3sPsE046529@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Wed, 22 May 2019 03:54:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348084 - stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 348084 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 02B1C8F3F0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.93)[-0.931,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 03:54:26 -0000 Author: johalun Date: Wed May 22 03:54:25 2019 New Revision: 348084 URL: https://svnweb.freebsd.org/changeset/base/348084 Log: MFC r347622: LinuxKPI: Include asm/atomic-long.h from atomic.h. This patch is part of D19565 Reviewed by: hps Approved by: imp (mentor), hps Modified: stable/12/sys/compat/linuxkpi/common/include/linux/atomic.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/atomic.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/atomic.h Wed May 22 03:52:39 2019 (r348083) +++ stable/12/sys/compat/linuxkpi/common/include/linux/atomic.h Wed May 22 03:54:25 2019 (r348084) @@ -31,5 +31,6 @@ #include #include +#include #endif /* _LINUX_ATOMIC_H_ */ From owner-svn-src-stable@freebsd.org Wed May 22 03:58:43 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E306A159AE21; Wed, 22 May 2019 03:58:42 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 81BB48F594; Wed, 22 May 2019 03:58:42 +0000 (UTC) (envelope-from johalun@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 57DE0FE43; Wed, 22 May 2019 03:58:42 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4M3wgtV046782; Wed, 22 May 2019 03:58:42 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4M3wgeP046781; Wed, 22 May 2019 03:58:42 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201905220358.x4M3wgeP046781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Wed, 22 May 2019 03:58:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348085 - stable/12/sys/compat/linuxkpi/common/include/asm X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/include/asm X-SVN-Commit-Revision: 348085 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 81BB48F594 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.93)[-0.931,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 03:58:43 -0000 Author: johalun Date: Wed May 22 03:58:41 2019 New Revision: 348085 URL: https://svnweb.freebsd.org/changeset/base/348085 Log: MFC r347620: LinuxKPI: Update user_access_begin for Linux v5.0. Check the new LINUXKPI_VERSION macro for backwards compatibility. This patch is part of D19565 Reviewed by: hps Approved by: imp (mentor), hps Modified: stable/12/sys/compat/linuxkpi/common/include/asm/uaccess.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/asm/uaccess.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/asm/uaccess.h Wed May 22 03:54:25 2019 (r348084) +++ stable/12/sys/compat/linuxkpi/common/include/asm/uaccess.h Wed May 22 03:58:41 2019 (r348085) @@ -52,7 +52,11 @@ copy_from_user(void *to, const void *from, unsigned lo #define __copy_from_user(...) copy_from_user(__VA_ARGS__) #define __copy_in_user(...) copy_from_user(__VA_ARGS__) +#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 50000 +#define user_access_begin(ptr, len) access_ok(ptr, len) +#else #define user_access_begin() do { } while (0) +#endif #define user_access_end() do { } while (0) #define unsafe_get_user(x, ptr, err) do { \ From owner-svn-src-stable@freebsd.org Wed May 22 04:00:14 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0D6D159AEDC; Wed, 22 May 2019 04:00:14 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46E0C8F6F3; Wed, 22 May 2019 04:00:14 +0000 (UTC) (envelope-from johalun@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 22056FE4C; Wed, 22 May 2019 04:00:14 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4M40EG0046960; Wed, 22 May 2019 04:00:14 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4M40Es1046959; Wed, 22 May 2019 04:00:14 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201905220400.x4M40Es1046959@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Wed, 22 May 2019 04:00:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348086 - stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 348086 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 46E0C8F6F3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.931,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 04:00:14 -0000 Author: johalun Date: Wed May 22 04:00:13 2019 New Revision: 348086 URL: https://svnweb.freebsd.org/changeset/base/348086 Log: MFC r347626: LinuxKPI: Add helper macros IS_ALIGNED and DIV_ROUND_DOWN_ULL. This patch is part of D19565 Reviewed by: hps Approved by: imp (mentor), hps Modified: stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h Wed May 22 03:58:41 2019 (r348085) +++ stable/12/sys/compat/linuxkpi/common/include/linux/kernel.h Wed May 22 04:00:13 2019 (r348086) @@ -130,9 +130,14 @@ #define ALIGN(x, y) roundup2((x), (y)) #undef PTR_ALIGN #define PTR_ALIGN(p, a) ((__typeof(p))ALIGN((uintptr_t)(p), (a))) +#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 50000 +/* Moved from linuxkpi_gplv2 */ +#define IS_ALIGNED(x, a) (((x) & ((__typeof(x))(a) - 1)) == 0) +#endif #define DIV_ROUND_UP(x, n) howmany(x, n) #define __KERNEL_DIV_ROUND_UP(x, n) howmany(x, n) #define DIV_ROUND_UP_ULL(x, n) DIV_ROUND_UP((unsigned long long)(x), (n)) +#define DIV_ROUND_DOWN_ULL(x, n) (((unsigned long long)(x) / (n)) * (n)) #define FIELD_SIZEOF(t, f) sizeof(((t *)0)->f) #define printk(...) printf(__VA_ARGS__) From owner-svn-src-stable@freebsd.org Wed May 22 04:02:11 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05625159E155; Wed, 22 May 2019 04:02:11 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9C8968FA9C; Wed, 22 May 2019 04:02:10 +0000 (UTC) (envelope-from johalun@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 77737FFE4; Wed, 22 May 2019 04:02:10 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4M42Ah4051201; Wed, 22 May 2019 04:02:10 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4M42Afs051200; Wed, 22 May 2019 04:02:10 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201905220402.x4M42Afs051200@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Wed, 22 May 2019 04:02:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348087 - stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 348087 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9C8968FA9C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.93)[-0.931,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 04:02:11 -0000 Author: johalun Date: Wed May 22 04:02:10 2019 New Revision: 348087 URL: https://svnweb.freebsd.org/changeset/base/348087 Log: MFC r347623: LinuxKPI: Move {lower|upper}_32_bits macros from port to base. This patch is part of D19565 Reviewed by: hps Approved by: imp (mentor), hps Modified: stable/12/sys/compat/linuxkpi/common/include/linux/compiler.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/compiler.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/compiler.h Wed May 22 04:00:13 2019 (r348086) +++ stable/12/sys/compat/linuxkpi/common/include/linux/compiler.h Wed May 22 04:02:10 2019 (r348087) @@ -81,6 +81,12 @@ #define barrier() __asm__ __volatile__("": : :"memory") +#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 50000 +/* Moved from drm_os_freebsd.h */ +#define lower_32_bits(n) ((u32)(n)) +#define upper_32_bits(n) ((u32)(((n) >> 16) >> 16)) +#endif + #define ___PASTE(a,b) a##b #define __PASTE(a,b) ___PASTE(a,b) From owner-svn-src-stable@freebsd.org Wed May 22 04:08:46 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F0DF159E38A; Wed, 22 May 2019 04:08:46 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D32278FF7F; Wed, 22 May 2019 04:08:45 +0000 (UTC) (envelope-from johalun@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B6EF618007; Wed, 22 May 2019 04:08:45 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4M48jqU052915; Wed, 22 May 2019 04:08:45 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4M48jDJ052914; Wed, 22 May 2019 04:08:45 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201905220408.x4M48jDJ052914@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Wed, 22 May 2019 04:08:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348088 - stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 348088 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D32278FF7F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.93)[-0.931,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 04:08:46 -0000 Author: johalun Date: Wed May 22 04:08:45 2019 New Revision: 348088 URL: https://svnweb.freebsd.org/changeset/base/348088 Log: MFC r347619: LinuxKPI: Expand ktime functionality. Also, make ktime_get_raw call getnanouptime instead of getnanotime to match (the correct) ktime_get_raw_ns. This patch is part of D19565 Reviewed by: hps Approved by: imp (mentor), hps Modified: stable/12/sys/compat/linuxkpi/common/include/linux/ktime.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/ktime.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/ktime.h Wed May 22 04:02:10 2019 (r348087) +++ stable/12/sys/compat/linuxkpi/common/include/linux/ktime.h Wed May 22 04:08:45 2019 (r348088) @@ -35,8 +35,6 @@ #include #include -#define ktime_get_ts(x) getnanouptime(x) - /* time values in nanoseconds */ typedef s64 ktime_t; @@ -93,6 +91,13 @@ ktime_add_ms(ktime_t kt, int64_t ms) } static inline ktime_t +ktime_add_us(ktime_t kt, int64_t us) +{ + + return (ktime_add_ns(kt, us * NSEC_PER_USEC)); +} + +static inline ktime_t ktime_sub_ns(ktime_t kt, int64_t ns) { return (kt - ns); @@ -172,11 +177,20 @@ timeval_to_ktime(struct timeval tv) return (ktime_set(tv.tv_sec, tv.tv_usec * NSEC_PER_USEC)); } +static inline int64_t +timespec64_to_ns(struct timespec64 *ts) +{ + return (timespec_to_ns(ts)); +} + #define ktime_to_timespec(kt) ns_to_timespec(kt) #define ktime_to_timespec64(kt) ns_to_timespec(kt) #define ktime_to_timeval(kt) ns_to_timeval(kt) #define ktime_to_ns(kt) (kt) -#define ktime_get_ts64(ts) ktime_get_ts(ts) +#define ktime_get_ts(ts) getnanouptime(ts) +#define ktime_get_ts64(ts) getnanouptime(ts) +#define ktime_get_raw_ts64(ts) getnanouptime(ts) +#define getrawmonotonic64(ts) getnanouptime(ts) static inline int64_t ktime_get_ns(void) @@ -229,7 +243,7 @@ ktime_get_raw(void) { struct timespec ts; - nanotime(&ts); + nanouptime(&ts); return (timespec_to_ktime(ts)); } From owner-svn-src-stable@freebsd.org Wed May 22 04:10:25 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96FB2159E57C; Wed, 22 May 2019 04:10:25 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3DE4168159; Wed, 22 May 2019 04:10:25 +0000 (UTC) (envelope-from johalun@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 18F961800C; Wed, 22 May 2019 04:10:25 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4M4AOfQ053076; Wed, 22 May 2019 04:10:24 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4M4AOma053075; Wed, 22 May 2019 04:10:24 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201905220410.x4M4AOma053075@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Wed, 22 May 2019 04:10:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348089 - stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 348089 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3DE4168159 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.93 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.93)[-0.931,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 04:10:25 -0000 Author: johalun Date: Wed May 22 04:10:24 2019 New Revision: 348089 URL: https://svnweb.freebsd.org/changeset/base/348089 Log: MFC r347621: LinuxKPI: Add get_random_u32 function. This patch is part of D19565 Reviewed by: hps Approved by: imp (mentor), hps Modified: stable/12/sys/compat/linuxkpi/common/include/linux/random.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/random.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/random.h Wed May 22 04:08:45 2019 (r348088) +++ stable/12/sys/compat/linuxkpi/common/include/linux/random.h Wed May 22 04:10:24 2019 (r348089) @@ -35,6 +35,8 @@ #include #include +#define get_random_u32() get_random_int() + static inline void get_random_bytes(void *buf, int nbytes) { From owner-svn-src-stable@freebsd.org Wed May 22 05:32:42 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 344AA159FF03; Wed, 22 May 2019 05:32:42 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BF4996C161; Wed, 22 May 2019 05:32:41 +0000 (UTC) (envelope-from dchagin@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 429E418F6E; Wed, 22 May 2019 05:32:41 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4M5WfZd099703; Wed, 22 May 2019 05:32:41 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4M5Wdne099695; Wed, 22 May 2019 05:32:39 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201905220532.x4M5Wdne099695@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Wed, 22 May 2019 05:32:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348092 - in stable/12/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: in stable/12/sys: amd64/linux amd64/linux32 arm64/linux compat/linux i386/linux X-SVN-Commit-Revision: 348092 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BF4996C161 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 05:32:42 -0000 Author: dchagin Date: Wed May 22 05:32:39 2019 New Revision: 348092 URL: https://svnweb.freebsd.org/changeset/base/348092 Log: MFC r347052: In order to reduce duplication between MD parts of the Linuxulator move bits that are MI out into the headers in compat/linux. For that remove bogus _packed attribute from struct l_sockaddr and use MI types for struct members. And continue to move into the linux_common module a code that is intended for both Linuxulator modules (both instruction set - 32 & 64 bit) or for external modules like linsysfs or linprocfs. To avoid header pollution introduce new sys/compat/linux_common.h header. Added: stable/12/sys/compat/linux/linux_common.h - copied unchanged from r347052, head/sys/compat/linux/linux_common.h Modified: stable/12/sys/amd64/linux/linux.h stable/12/sys/amd64/linux32/linux.h stable/12/sys/arm64/linux/linux.h stable/12/sys/compat/linux/linux.c stable/12/sys/compat/linux/linux.h stable/12/sys/compat/linux/linux_ioctl.c stable/12/sys/i386/linux/linux.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/linux/linux.h ============================================================================== --- stable/12/sys/amd64/linux/linux.h Wed May 22 04:51:08 2019 (r348091) +++ stable/12/sys/amd64/linux/linux.h Wed May 22 05:32:39 2019 (r348092) @@ -377,11 +377,6 @@ union l_semun { l_uintptr_t __pad; }; -struct l_sockaddr { - l_ushort sa_family; - char sa_data[14]; -}; - struct l_ifmap { l_ulong mem_start; l_ulong mem_end; @@ -390,9 +385,6 @@ struct l_ifmap { u_char dma; u_char port; } __packed; - -#define LINUX_IFHWADDRLEN 6 -#define LINUX_IFNAMSIZ 16 struct l_ifreq { union { Modified: stable/12/sys/amd64/linux32/linux.h ============================================================================== --- stable/12/sys/amd64/linux32/linux.h Wed May 22 04:51:08 2019 (r348091) +++ stable/12/sys/amd64/linux32/linux.h Wed May 22 05:32:39 2019 (r348092) @@ -478,11 +478,6 @@ union l_semun { l_uintptr_t __pad; } __packed; -struct l_sockaddr { - l_ushort sa_family; - char sa_data[14]; -} __packed; - struct l_ifmap { l_ulong mem_start; l_ulong mem_end; @@ -491,9 +486,6 @@ struct l_ifmap { u_char dma; u_char port; } __packed; - -#define LINUX_IFHWADDRLEN 6 -#define LINUX_IFNAMSIZ 16 struct l_ifreq { union { Modified: stable/12/sys/arm64/linux/linux.h ============================================================================== --- stable/12/sys/arm64/linux/linux.h Wed May 22 04:51:08 2019 (r348091) +++ stable/12/sys/arm64/linux/linux.h Wed May 22 05:32:39 2019 (r348092) @@ -264,11 +264,6 @@ union l_semun { l_uintptr_t __pad; }; -struct l_sockaddr { - l_ushort sa_family; - char sa_data[14]; -}; - struct l_ifmap { l_ulong mem_start; l_ulong mem_end; @@ -277,9 +272,6 @@ struct l_ifmap { u_char dma; u_char port; } __packed; - -#define LINUX_IFHWADDRLEN 6 -#define LINUX_IFNAMSIZ 16 struct l_ifreq { union { Modified: stable/12/sys/compat/linux/linux.c ============================================================================== --- stable/12/sys/compat/linux/linux.c Wed May 22 04:51:08 2019 (r348091) +++ stable/12/sys/compat/linux/linux.c Wed May 22 05:32:39 2019 (r348092) @@ -29,10 +29,21 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include #include +#include +#include +#include +#include +#include + #include +#include +CTASSERT(LINUX_IFNAMSIZ == IFNAMSIZ); static int bsd_to_linux_sigtbl[LINUX_SIGTBLSZ] = { LINUX_SIGHUP, /* SIGHUP */ @@ -202,4 +213,98 @@ bsd_to_linux_sigset(sigset_t *bss, l_sigset_t *lss) LINUX_SIGADDSET(*lss, l); } } +} + +/* + * Translate a Linux interface name to a FreeBSD interface name, + * and return the associated ifnet structure + * bsdname and lxname need to be least IFNAMSIZ bytes long, but + * can point to the same buffer. + */ +struct ifnet * +ifname_linux_to_bsd(struct thread *td, const char *lxname, char *bsdname) +{ + struct ifnet *ifp; + int len, unit; + char *ep; + int is_eth, is_lo, index; + + for (len = 0; len < LINUX_IFNAMSIZ; ++len) + if (!isalpha(lxname[len]) || lxname[len] == 0) + break; + if (len == 0 || len == LINUX_IFNAMSIZ) + return (NULL); + /* Linux loopback interface name is lo (not lo0) */ + is_lo = (len == 2 && !strncmp(lxname, "lo", len)) ? 1 : 0; + unit = (int)strtoul(lxname + len, &ep, 10); + if ((ep == NULL || ep == lxname + len || ep >= lxname + LINUX_IFNAMSIZ) && + is_lo == 0) + return (NULL); + index = 0; + is_eth = (len == 3 && !strncmp(lxname, "eth", len)) ? 1 : 0; + + CURVNET_SET(TD_TO_VNET(td)); + IFNET_RLOCK(); + CK_STAILQ_FOREACH(ifp, &V_ifnet, if_link) { + /* + * Allow Linux programs to use FreeBSD names. Don't presume + * we never have an interface named "eth", so don't make + * the test optional based on is_eth. + */ + if (strncmp(ifp->if_xname, lxname, LINUX_IFNAMSIZ) == 0) + break; + if (is_eth && IFP_IS_ETH(ifp) && unit == index++) + break; + if (is_lo && IFP_IS_LOOP(ifp)) + break; + } + IFNET_RUNLOCK(); + CURVNET_RESTORE(); + if (ifp != NULL && bsdname != NULL) + strlcpy(bsdname, ifp->if_xname, IFNAMSIZ); + return (ifp); +} + +void +linux_ifflags(struct ifnet *ifp, short *flags) +{ + + *flags = (ifp->if_flags | ifp->if_drv_flags) & 0xffff; + /* these flags have no Linux equivalent */ + *flags &= ~(IFF_DRV_OACTIVE|IFF_SIMPLEX| + IFF_LINK0|IFF_LINK1|IFF_LINK2); + /* Linux' multicast flag is in a different bit */ + if (*flags & IFF_MULTICAST) { + *flags &= ~IFF_MULTICAST; + *flags |= 0x1000; + } +} + +int +linux_ifhwaddr(struct ifnet *ifp, struct l_sockaddr *lsa) +{ + struct ifaddr *ifa; + struct sockaddr_dl *sdl; + + if (IFP_IS_LOOP(ifp)) { + bzero(lsa, sizeof(*lsa)); + lsa->sa_family = LINUX_ARPHRD_LOOPBACK; + return (0); + } + + if (!IFP_IS_ETH(ifp)) + return (ENOENT); + + CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { + sdl = (struct sockaddr_dl*)ifa->ifa_addr; + if (sdl != NULL && (sdl->sdl_family == AF_LINK) && + (sdl->sdl_type == IFT_ETHER)) { + bzero(lsa, sizeof(*lsa)); + lsa->sa_family = LINUX_ARPHRD_ETHER; + bcopy(LLADDR(sdl), lsa->sa_data, LINUX_IFHWADDRLEN); + return (0); + } + } + + return (ENOENT); } Modified: stable/12/sys/compat/linux/linux.h ============================================================================== --- stable/12/sys/compat/linux/linux.h Wed May 22 04:51:08 2019 (r348091) +++ stable/12/sys/compat/linux/linux.h Wed May 22 05:32:39 2019 (r348092) @@ -29,6 +29,23 @@ #ifndef _LINUX_MI_H_ #define _LINUX_MI_H_ +#define LINUX_IFHWADDRLEN 6 +#define LINUX_IFNAMSIZ 16 + +/* + * Criteria for interface name translation + */ +#define IFP_IS_ETH(ifp) (ifp->if_type == IFT_ETHER) +#define IFP_IS_LOOP(ifp) (ifp->if_type == IFT_LOOP) + +struct l_sockaddr { + unsigned short sa_family; + char sa_data[14]; +}; + +#define LINUX_ARPHRD_ETHER 1 +#define LINUX_ARPHRD_LOOPBACK 772 + /* sigaltstack */ #define LINUX_SS_ONSTACK 1 #define LINUX_SS_DISABLE 2 Copied: stable/12/sys/compat/linux/linux_common.h (from r347052, head/sys/compat/linux/linux_common.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/compat/linux/linux_common.h Wed May 22 05:32:39 2019 (r348092, copy of r347052, head/sys/compat/linux/linux_common.h) @@ -0,0 +1,38 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2019 Dmitry Chagin + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _LINUX_COMMON_H_ +#define _LINUX_COMMON_H_ + +struct ifnet *ifname_linux_to_bsd(struct thread *td, + const char *lxname, char *bsdname); +void linux_ifflags(struct ifnet *ifp, short *flags); +int linux_ifhwaddr(struct ifnet *ifp, struct l_sockaddr *lsa); + +#endif /* _LINUX_COMMON_H_ */ Modified: stable/12/sys/compat/linux/linux_ioctl.c ============================================================================== --- stable/12/sys/compat/linux/linux_ioctl.c Wed May 22 04:51:08 2019 (r348091) +++ stable/12/sys/compat/linux/linux_ioctl.c Wed May 22 05:32:39 2019 (r348092) @@ -81,6 +81,7 @@ __FBSDID("$FreeBSD$"); #include #endif +#include #include #include #include @@ -2122,56 +2123,6 @@ linux_ioctl_console(struct thread *td, struct linux_io } /* - * Criteria for interface name translation - */ -#define IFP_IS_ETH(ifp) (ifp->if_type == IFT_ETHER) - -/* - * Translate a Linux interface name to a FreeBSD interface name, - * and return the associated ifnet structure - * bsdname and lxname need to be least IFNAMSIZ bytes long, but - * can point to the same buffer. - */ - -static struct ifnet * -ifname_linux_to_bsd(struct thread *td, const char *lxname, char *bsdname) -{ - struct ifnet *ifp; - int len, unit; - char *ep; - int is_eth, index; - - for (len = 0; len < LINUX_IFNAMSIZ; ++len) - if (!isalpha(lxname[len])) - break; - if (len == 0 || len == LINUX_IFNAMSIZ) - return (NULL); - unit = (int)strtoul(lxname + len, &ep, 10); - if (ep == NULL || ep == lxname + len || ep >= lxname + LINUX_IFNAMSIZ) - return (NULL); - index = 0; - is_eth = (len == 3 && !strncmp(lxname, "eth", len)) ? 1 : 0; - CURVNET_SET(TD_TO_VNET(td)); - IFNET_RLOCK(); - CK_STAILQ_FOREACH(ifp, &V_ifnet, if_link) { - /* - * Allow Linux programs to use FreeBSD names. Don't presume - * we never have an interface named "eth", so don't make - * the test optional based on is_eth. - */ - if (strncmp(ifp->if_xname, lxname, LINUX_IFNAMSIZ) == 0) - break; - if (is_eth && IFP_IS_ETH(ifp) && unit == index++) - break; - } - IFNET_RUNLOCK(); - CURVNET_RESTORE(); - if (ifp != NULL) - strlcpy(bsdname, ifp->if_xname, IFNAMSIZ); - return (ifp); -} - -/* * Implement the SIOCGIFNAME ioctl */ @@ -2332,50 +2283,20 @@ linux_gifflags(struct thread *td, struct ifnet *ifp, s { l_short flags; - flags = (ifp->if_flags | ifp->if_drv_flags) & 0xffff; - /* these flags have no Linux equivalent */ - flags &= ~(IFF_DRV_OACTIVE|IFF_SIMPLEX| - IFF_LINK0|IFF_LINK1|IFF_LINK2); - /* Linux' multicast flag is in a different bit */ - if (flags & IFF_MULTICAST) { - flags &= ~IFF_MULTICAST; - flags |= 0x1000; - } + linux_ifflags(ifp, &flags); return (copyout(&flags, &ifr->ifr_flags, sizeof(flags))); } -#define ARPHRD_ETHER 1 -#define ARPHRD_LOOPBACK 772 - static int linux_gifhwaddr(struct ifnet *ifp, struct l_ifreq *ifr) { - struct ifaddr *ifa; - struct sockaddr_dl *sdl; struct l_sockaddr lsa; - if (ifp->if_type == IFT_LOOP) { - bzero(&lsa, sizeof(lsa)); - lsa.sa_family = ARPHRD_LOOPBACK; - return (copyout(&lsa, &ifr->ifr_hwaddr, sizeof(lsa))); - } - - if (ifp->if_type != IFT_ETHER) + if (linux_ifhwaddr(ifp, &lsa) != 0) return (ENOENT); - CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { - sdl = (struct sockaddr_dl*)ifa->ifa_addr; - if (sdl != NULL && (sdl->sdl_family == AF_LINK) && - (sdl->sdl_type == IFT_ETHER)) { - bzero(&lsa, sizeof(lsa)); - lsa.sa_family = ARPHRD_ETHER; - bcopy(LLADDR(sdl), lsa.sa_data, LINUX_IFHWADDRLEN); - return (copyout(&lsa, &ifr->ifr_hwaddr, sizeof(lsa))); - } - } - - return (ENOENT); + return (copyout(&lsa, &ifr->ifr_hwaddr, sizeof(lsa))); } Modified: stable/12/sys/i386/linux/linux.h ============================================================================== --- stable/12/sys/i386/linux/linux.h Wed May 22 04:51:08 2019 (r348091) +++ stable/12/sys/i386/linux/linux.h Wed May 22 05:32:39 2019 (r348092) @@ -454,11 +454,6 @@ union l_semun { l_uintptr_t __pad; }; -struct l_sockaddr { - l_ushort sa_family; - char sa_data[14]; -}; - struct l_ifmap { l_ulong mem_start; l_ulong mem_end; @@ -467,9 +462,6 @@ struct l_ifmap { u_char dma; u_char port; }; - -#define LINUX_IFHWADDRLEN 6 -#define LINUX_IFNAMSIZ 16 struct l_ifreq { union { From owner-svn-src-stable@freebsd.org Wed May 22 05:33:49 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04D5F159FF78; Wed, 22 May 2019 05:33:49 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 94DB06C29A; Wed, 22 May 2019 05:33:48 +0000 (UTC) (envelope-from dchagin@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6FAD218F70; Wed, 22 May 2019 05:33:48 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4M5Xmxo099823; Wed, 22 May 2019 05:33:48 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4M5XmV9099822; Wed, 22 May 2019 05:33:48 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201905220533.x4M5XmV9099822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Wed, 22 May 2019 05:33:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348093 - in stable/12/sys/modules: linux linux64 X-SVN-Group: stable-12 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: in stable/12/sys/modules: linux linux64 X-SVN-Commit-Revision: 348093 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 94DB06C29A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 05:33:49 -0000 Author: dchagin Date: Wed May 22 05:33:47 2019 New Revision: 348093 URL: https://svnweb.freebsd.org/changeset/base/348093 Log: MFC r347196: The build process generates assym.inc from genassym.o, so don't forget to clean genassym.o Modified: stable/12/sys/modules/linux/Makefile stable/12/sys/modules/linux64/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/modules/linux/Makefile ============================================================================== --- stable/12/sys/modules/linux/Makefile Wed May 22 05:32:39 2019 (r348092) +++ stable/12/sys/modules/linux/Makefile Wed May 22 05:33:47 2019 (r348093) @@ -47,7 +47,8 @@ EXPORT_SYMS+= linux_ioctl_register_handler EXPORT_SYMS+= linux_ioctl_unregister_handler .endif -CLEANFILES= linux${SFX}_assym.h linux${SFX}_genassym.o linux${SFX}_locore.o +CLEANFILES= linux${SFX}_assym.h linux${SFX}_genassym.o linux${SFX}_locore.o \ + genassym.o linux${SFX}_assym.h: linux${SFX}_genassym.o sh ${SYSDIR}/kern/genassym.sh linux${SFX}_genassym.o > ${.TARGET} Modified: stable/12/sys/modules/linux64/Makefile ============================================================================== --- stable/12/sys/modules/linux64/Makefile Wed May 22 05:32:39 2019 (r348092) +++ stable/12/sys/modules/linux64/Makefile Wed May 22 05:33:47 2019 (r348093) @@ -21,7 +21,8 @@ SRCS+= opt_kstack_pages.h opt_nfs.h opt_hwpmc_hooks.h SRCS+= opt_apic.h .endif -CLEANFILES= linux_assym.h linux_genassym.o linux_locore.o +CLEANFILES= linux_assym.h linux_genassym.o linux_locore.o \ + genassym.o OBJS= ${VDSO}.so From owner-svn-src-stable@freebsd.org Wed May 22 05:34:45 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41CE8159FFF2; Wed, 22 May 2019 05:34:45 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D9EE66C3C8; Wed, 22 May 2019 05:34:44 +0000 (UTC) (envelope-from dchagin@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD28818F71; Wed, 22 May 2019 05:34:44 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4M5YiUk099918; Wed, 22 May 2019 05:34:44 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4M5Yi2m099917; Wed, 22 May 2019 05:34:44 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201905220534.x4M5Yi2m099917@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Wed, 22 May 2019 05:34:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348094 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 348094 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D9EE66C3C8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 05:34:45 -0000 Author: dchagin Date: Wed May 22 05:34:44 2019 New Revision: 348094 URL: https://svnweb.freebsd.org/changeset/base/348094 Log: MFC r347202: Complete r347052 (https://reviews.freebsd.org/D20137) as it it was not a final revision. Fix style issues and change bool-like variables from int to bool. Modified: stable/12/sys/compat/linux/linux.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux.c ============================================================================== --- stable/12/sys/compat/linux/linux.c Wed May 22 05:33:47 2019 (r348093) +++ stable/12/sys/compat/linux/linux.c Wed May 22 05:34:44 2019 (r348094) @@ -227,21 +227,22 @@ ifname_linux_to_bsd(struct thread *td, const char *lxn struct ifnet *ifp; int len, unit; char *ep; - int is_eth, is_lo, index; + int index; + bool is_eth, is_lo; for (len = 0; len < LINUX_IFNAMSIZ; ++len) - if (!isalpha(lxname[len]) || lxname[len] == 0) + if (!isalpha(lxname[len]) || lxname[len] == '\0') break; if (len == 0 || len == LINUX_IFNAMSIZ) return (NULL); /* Linux loopback interface name is lo (not lo0) */ - is_lo = (len == 2 && !strncmp(lxname, "lo", len)) ? 1 : 0; + is_lo = (len == 2 && strncmp(lxname, "lo", len) == 0); unit = (int)strtoul(lxname + len, &ep, 10); if ((ep == NULL || ep == lxname + len || ep >= lxname + LINUX_IFNAMSIZ) && is_lo == 0) return (NULL); index = 0; - is_eth = (len == 3 && !strncmp(lxname, "eth", len)) ? 1 : 0; + is_eth = (len == 3 && strncmp(lxname, "eth", len) == 0); CURVNET_SET(TD_TO_VNET(td)); IFNET_RLOCK(); From owner-svn-src-stable@freebsd.org Wed May 22 05:35:37 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E91015A1093; Wed, 22 May 2019 05:35:37 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A7B686C510; Wed, 22 May 2019 05:35:36 +0000 (UTC) (envelope-from dchagin@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8245718F73; Wed, 22 May 2019 05:35:36 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4M5ZaWG000129; Wed, 22 May 2019 05:35:36 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4M5Za3v000128; Wed, 22 May 2019 05:35:36 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201905220535.x4M5Za3v000128@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Wed, 22 May 2019 05:35:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348095 - stable/12/sys/compat/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: stable/12/sys/compat/linux X-SVN-Commit-Revision: 348095 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A7B686C510 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 05:35:37 -0000 Author: dchagin Date: Wed May 22 05:35:35 2019 New Revision: 348095 URL: https://svnweb.freebsd.org/changeset/base/348095 Log: MFC r347203: Rewrite linux_ifflags() in more readable Linuxulator style. Modified: stable/12/sys/compat/linux/linux.c stable/12/sys/compat/linux/linux.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linux/linux.c ============================================================================== --- stable/12/sys/compat/linux/linux.c Wed May 22 05:34:44 2019 (r348094) +++ stable/12/sys/compat/linux/linux.c Wed May 22 05:35:35 2019 (r348095) @@ -269,16 +269,30 @@ ifname_linux_to_bsd(struct thread *td, const char *lxn void linux_ifflags(struct ifnet *ifp, short *flags) { + unsigned short fl; - *flags = (ifp->if_flags | ifp->if_drv_flags) & 0xffff; - /* these flags have no Linux equivalent */ - *flags &= ~(IFF_DRV_OACTIVE|IFF_SIMPLEX| - IFF_LINK0|IFF_LINK1|IFF_LINK2); - /* Linux' multicast flag is in a different bit */ - if (*flags & IFF_MULTICAST) { - *flags &= ~IFF_MULTICAST; - *flags |= 0x1000; - } + fl = (ifp->if_flags | ifp->if_drv_flags) & 0xffff; + *flags = 0; + if (fl & IFF_UP) + *flags |= LINUX_IFF_UP; + if (fl & IFF_BROADCAST) + *flags |= LINUX_IFF_BROADCAST; + if (fl & IFF_DEBUG) + *flags |= LINUX_IFF_DEBUG; + if (fl & IFF_LOOPBACK) + *flags |= LINUX_IFF_LOOPBACK; + if (fl & IFF_POINTOPOINT) + *flags |= LINUX_IFF_POINTOPOINT; + if (fl & IFF_DRV_RUNNING) + *flags |= LINUX_IFF_RUNNING; + if (fl & IFF_NOARP) + *flags |= LINUX_IFF_NOARP; + if (fl & IFF_PROMISC) + *flags |= LINUX_IFF_PROMISC; + if (fl & IFF_ALLMULTI) + *flags |= LINUX_IFF_ALLMULTI; + if (fl & IFF_MULTICAST) + *flags |= LINUX_IFF_MULTICAST; } int Modified: stable/12/sys/compat/linux/linux.h ============================================================================== --- stable/12/sys/compat/linux/linux.h Wed May 22 05:34:44 2019 (r348094) +++ stable/12/sys/compat/linux/linux.h Wed May 22 05:35:35 2019 (r348095) @@ -46,6 +46,26 @@ struct l_sockaddr { #define LINUX_ARPHRD_ETHER 1 #define LINUX_ARPHRD_LOOPBACK 772 +/* + * net device flags + */ +#define LINUX_IFF_UP 0x0001 +#define LINUX_IFF_BROADCAST 0x0002 +#define LINUX_IFF_DEBUG 0x0004 +#define LINUX_IFF_LOOPBACK 0x0008 +#define LINUX_IFF_POINTOPOINT 0x0010 +#define LINUX_IFF_NOTRAILERS 0x0020 +#define LINUX_IFF_RUNNING 0x0040 +#define LINUX_IFF_NOARP 0x0080 +#define LINUX_IFF_PROMISC 0x0100 +#define LINUX_IFF_ALLMULTI 0x0200 +#define LINUX_IFF_MASTER 0x0400 +#define LINUX_IFF_SLAVE 0x0800 +#define LINUX_IFF_MULTICAST 0x1000 +#define LINUX_IFF_PORTSEL 0x2000 +#define LINUX_IFF_AUTOMEDIA 0x4000 +#define LINUX_IFF_DYNAMIC 0x8000 + /* sigaltstack */ #define LINUX_SS_ONSTACK 1 #define LINUX_SS_DISABLE 2 From owner-svn-src-stable@freebsd.org Wed May 22 05:37:31 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E62B315A1165; Wed, 22 May 2019 05:37:30 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8D3D66C665; Wed, 22 May 2019 05:37:30 +0000 (UTC) (envelope-from dchagin@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4302A18F74; Wed, 22 May 2019 05:37:30 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4M5bUY1000264; Wed, 22 May 2019 05:37:30 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4M5bUxR000263; Wed, 22 May 2019 05:37:30 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201905220537.x4M5bUxR000263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Wed, 22 May 2019 05:37:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348096 - stable/12/sys/compat/linsysfs X-SVN-Group: stable-12 X-SVN-Commit-Author: dchagin X-SVN-Commit-Paths: stable/12/sys/compat/linsysfs X-SVN-Commit-Revision: 348096 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8D3D66C665 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.974,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 05:37:31 -0000 Author: dchagin Date: Wed May 22 05:37:29 2019 New Revision: 348096 URL: https://svnweb.freebsd.org/changeset/base/348096 Log: MFC r347204: Adds sys/class/net devices to linsysfs. Only two interfaces are created eth0 and lo and they expose the following properties: address, addr_len, flags, ifindex, mty, tx_queue_len and type. Initial patch developed by Carlos Neira in 2017 and finished by me. MFC r347218: Remove wrong copyright line. Discussed with Carlos Neira. Modified: stable/12/sys/compat/linsysfs/linsysfs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linsysfs/linsysfs.c ============================================================================== --- stable/12/sys/compat/linsysfs/linsysfs.c Wed May 22 05:35:35 2019 (r348095) +++ stable/12/sys/compat/linsysfs/linsysfs.c Wed May 22 05:37:29 2019 (r348096) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -44,7 +45,11 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include +#include #include #include @@ -64,6 +69,146 @@ atoi(const char *str) return (int)strtol(str, (char **)NULL, 10); } +static int +linsysfs_ifnet_addr(PFS_FILL_ARGS) +{ + struct l_sockaddr lsa; + struct ifnet *ifp; + + ifp = ifname_linux_to_bsd(td, pn->pn_parent->pn_name, NULL); + if (ifp == NULL) + return (ENOENT); + if (linux_ifhwaddr(ifp, &lsa) != 0) + return (ENOENT); + sbuf_printf(sb, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\n", + lsa.sa_data[0], lsa.sa_data[1], lsa.sa_data[2], + lsa.sa_data[3], lsa.sa_data[4], lsa.sa_data[5]); + return (0); +} + +static int +linsysfs_ifnet_addrlen(PFS_FILL_ARGS) +{ + + sbuf_printf(sb, "%d\n", LINUX_IFHWADDRLEN); + return (0); +} + +static int +linsysfs_ifnet_flags(PFS_FILL_ARGS) +{ + struct ifnet *ifp; + unsigned short flags; + + ifp = ifname_linux_to_bsd(td, pn->pn_parent->pn_name, NULL); + if (ifp == NULL) + return (ENOENT); + linux_ifflags(ifp, &flags); + sbuf_printf(sb, "0x%x\n", flags); + return (0); +} + +static int +linsysfs_ifnet_ifindex(PFS_FILL_ARGS) +{ + struct ifnet *ifp; + + ifp = ifname_linux_to_bsd(td, pn->pn_parent->pn_name, NULL); + if (ifp == NULL) + return (ENOENT); + sbuf_printf(sb, "%u\n", ifp->if_index); + return (0); +} + +static int +linsysfs_ifnet_mtu(PFS_FILL_ARGS) +{ + struct ifnet *ifp; + + ifp = ifname_linux_to_bsd(td, pn->pn_parent->pn_name, NULL); + if (ifp == NULL) + return (ENOENT); + sbuf_printf(sb, "%u\n", ifp->if_mtu); + return (0); +} + +static int +linsysfs_ifnet_tx_queue_len(PFS_FILL_ARGS) +{ + + /* XXX */ + sbuf_printf(sb, "1000\n"); + return (0); +} + +static int +linsysfs_ifnet_type(PFS_FILL_ARGS) +{ + struct l_sockaddr lsa; + struct ifnet *ifp; + + ifp = ifname_linux_to_bsd(td, pn->pn_parent->pn_name, NULL); + if (ifp == NULL) + return (ENOENT); + if (linux_ifhwaddr(ifp, &lsa) != 0) + return (ENOENT); + sbuf_printf(sb, "%d\n", lsa.sa_family); + return (0); +} + +static void +linsysfs_listnics(struct pfs_node *dir) +{ + struct pfs_node *nic; + struct pfs_node *lo; + + nic = pfs_create_dir(dir, "eth0", NULL, NULL, NULL, 0); + + pfs_create_file(nic, "address", &linsysfs_ifnet_addr, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(nic, "addr_len", &linsysfs_ifnet_addrlen, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(nic, "flags", &linsysfs_ifnet_flags, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(nic, "ifindex", &linsysfs_ifnet_ifindex, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(nic, "mtu", &linsysfs_ifnet_mtu, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(nic, "tx_queue_len", &linsysfs_ifnet_tx_queue_len, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(nic, "type", &linsysfs_ifnet_type, + NULL, NULL, NULL, PFS_RD); + + lo = pfs_create_dir(dir, "lo", NULL, NULL, NULL, 0); + + pfs_create_file(lo, "address", &linsysfs_ifnet_addr, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(lo, "addr_len", &linsysfs_ifnet_addrlen, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(lo, "flags", &linsysfs_ifnet_flags, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(lo, "ifindex", &linsysfs_ifnet_ifindex, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(lo, "mtu", &linsysfs_ifnet_mtu, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(lo, "tx_queue_len", &linsysfs_ifnet_tx_queue_len, + NULL, NULL, NULL, PFS_RD); + + pfs_create_file(lo, "type", &linsysfs_ifnet_type, + NULL, NULL, NULL, PFS_RD); +} + /* * Filler function for proc_name */ @@ -475,6 +620,7 @@ linsysfs_init(PFS_INIT_ARGS) struct pfs_node *drm; struct pfs_node *pci; struct pfs_node *scsi; + struct pfs_node *net; struct pfs_node *devdir, *chardev; devclass_t devclass; device_t dev; @@ -488,6 +634,9 @@ linsysfs_init(PFS_INIT_ARGS) scsi = pfs_create_dir(class, "scsi_host", NULL, NULL, NULL, 0); drm = pfs_create_dir(class, "drm", NULL, NULL, NULL, 0); + /* /sys/class/net/.. */ + net = pfs_create_dir(class, "net", NULL, NULL, NULL, 0); + /* /sys/dev/... */ devdir = pfs_create_dir(root, "dev", NULL, NULL, NULL, 0); chardev = pfs_create_dir(devdir, "char", NULL, NULL, NULL, 0); @@ -514,6 +663,7 @@ linsysfs_init(PFS_INIT_ARGS) NULL, NULL, NULL, PFS_RD); linsysfs_listcpus(cpu); + linsysfs_listnics(net); return (0); } From owner-svn-src-stable@freebsd.org Wed May 22 07:25:18 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 65BC415A32E2; Wed, 22 May 2019 07:25:18 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F2D457053D; Wed, 22 May 2019 07:25:17 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [176.74.212.121]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id CB88E260298; Wed, 22 May 2019 09:25:15 +0200 (CEST) Subject: Re: svn commit: r348089 - stable/12/sys/compat/linuxkpi/common/include/linux To: Johannes Lundberg , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org References: <201905220410.x4M4AOma053075@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <8dba7fb5-daf0-0764-2bde-1b8c30131b4b@selasky.org> Date: Wed, 22 May 2019 09:24:45 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <201905220410.x4M4AOma053075@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: F2D457053D X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.91 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.91)[-0.914,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 07:25:18 -0000 On 2019-05-22 06:10, Johannes Lundberg wrote: > Author: johalun > Date: Wed May 22 04:10:24 2019 > New Revision: 348089 > URL: https://svnweb.freebsd.org/changeset/base/348089 > > Log: > MFC r347621: > LinuxKPI: Add get_random_u32 function. > > This patch is part of D19565 > > Reviewed by: hps > Approved by: imp (mentor), hps > > Modified: > stable/12/sys/compat/linuxkpi/common/include/linux/random.h > Directory Properties: > stable/12/ (props changed) > > Modified: stable/12/sys/compat/linuxkpi/common/include/linux/random.h > ============================================================================== > --- stable/12/sys/compat/linuxkpi/common/include/linux/random.h Wed May 22 04:08:45 2019 (r348088) > +++ stable/12/sys/compat/linuxkpi/common/include/linux/random.h Wed May 22 04:10:24 2019 (r348089) > @@ -35,6 +35,8 @@ > #include > #include > > +#define get_random_u32() get_random_int() > + > static inline void > get_random_bytes(void *buf, int nbytes) > { > > Please also MFC your patches to FreeBSD -11 . --HPS From owner-svn-src-stable@freebsd.org Wed May 22 17:42:24 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 022FC15B3243; Wed, 22 May 2019 17:42:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8F71290D92; Wed, 22 May 2019 17:42:23 +0000 (UTC) (envelope-from dim@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 69D5720CC7; Wed, 22 May 2019 17:42:23 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4MHgN5q081073; Wed, 22 May 2019 17:42:23 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4MHgNjK081072; Wed, 22 May 2019 17:42:23 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201905221742.x4MHgNjK081072@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 22 May 2019 17:42:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348116 - in stable/12: lib/libomp tools/build/mk X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable/12: lib/libomp tools/build/mk X-SVN-Commit-Revision: 348116 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8F71290D92 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 17:42:24 -0000 Author: dim Date: Wed May 22 17:42:22 2019 New Revision: 348116 URL: https://svnweb.freebsd.org/changeset/base/348116 Log: MFC r347978: Fix OptionalObsoleteFiles copy/paste mistake from r345236, which connected libomp to the build. The comparison should not have been against ${MK_OPENSSH}, but against ${MK_OPENMP}, obviously. MFC r347979: To avoid unnecessarily modifying ports, add a -lgomp symlink, since GCC does not ship a -lomp symlink. Also update OptionalObsoleteFiles for this, and add 32-bit variants while here. Submitted by: jbeich PR: 237975 Modified: stable/12/lib/libomp/Makefile stable/12/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libomp/Makefile ============================================================================== --- stable/12/lib/libomp/Makefile Wed May 22 17:40:54 2019 (r348115) +++ stable/12/lib/libomp/Makefile Wed May 22 17:42:22 2019 (r348116) @@ -68,4 +68,6 @@ VERSION_MAP= ${OMPSRC}/exports_so.txt LIBADD+= pthread LIBADD+= m +SYMLINKS+= ${SHLIB_NAME} ${LIBDIR}/libgomp.so + .include Modified: stable/12/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/12/tools/build/mk/OptionalObsoleteFiles.inc Wed May 22 17:40:54 2019 (r348115) +++ stable/12/tools/build/mk/OptionalObsoleteFiles.inc Wed May 22 17:42:22 2019 (r348116) @@ -2739,12 +2739,16 @@ OLD_FILES+=usr/include/omp.h .endif OLD_FILES+=usr/lib/libgcov.a OLD_FILES+=usr/lib/libgomp.a +.if ${MK_OPENMP} == no OLD_FILES+=usr/lib/libgomp.so +.endif OLD_LIBS+=usr/lib/libgomp.so.1 OLD_FILES+=usr/lib/libgomp_p.a OLD_FILES+=usr/lib32/libgcov.a OLD_FILES+=usr/lib32/libgomp.a +.if ${MK_OPENMP} == no OLD_FILES+=usr/lib32/libgomp.so +.endif OLD_LIBS+=usr/lib32/libgomp.so.1 OLD_FILES+=usr/lib32/libgomp_p.a OLD_FILES+=usr/libexec/cc1 @@ -7193,11 +7197,14 @@ OLD_FILES+=usr/share/man/man8/ntpq.8.gz OLD_FILES+=usr/share/man/man8/ntptime.8.gz .endif -.if ${MK_OPENSSH} == no +.if ${MK_OPENMP} == no .if ${MK_GCC} == no OLD_FILES+=usr/include/omp.h +OLD_LIBS+=usr/lib/libgomp.so +OLD_LIBS+=usr/lib32/libgomp.so .endif OLD_LIBS+=usr/lib/libomp.so +OLD_LIBS+=usr/lib32/libomp.so .endif .if ${MK_OPENSSH} == no From owner-svn-src-stable@freebsd.org Wed May 22 19:39:57 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F27B915B5A19; Wed, 22 May 2019 19:39:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8C4C795271; Wed, 22 May 2019 19:39:56 +0000 (UTC) (envelope-from dim@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 64C7C21FAB; Wed, 22 May 2019 19:39:56 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4MJdu4H039747; Wed, 22 May 2019 19:39:56 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4MJduJa039745; Wed, 22 May 2019 19:39:56 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201905221939.x4MJduJa039745@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 22 May 2019 19:39:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r348118 - in stable/11: lib/libomp tools/build/mk X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable/11: lib/libomp tools/build/mk X-SVN-Commit-Revision: 348118 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8C4C795271 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.973,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 19:39:57 -0000 Author: dim Date: Wed May 22 19:39:55 2019 New Revision: 348118 URL: https://svnweb.freebsd.org/changeset/base/348118 Log: MFC r347978: Fix OptionalObsoleteFiles copy/paste mistake from r345236, which connected libomp to the build. The comparison should not have been against ${MK_OPENSSH}, but against ${MK_OPENMP}, obviously. MFC r347979: To avoid unnecessarily modifying ports, add a -lgomp symlink, since GCC does not ship a -lomp symlink. Also update OptionalObsoleteFiles for this, and add 32-bit variants while here. Approved by: re (gjb) Submitted by: jbeich PR: 237975 Modified: stable/11/lib/libomp/Makefile stable/11/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libomp/Makefile ============================================================================== --- stable/11/lib/libomp/Makefile Wed May 22 18:43:48 2019 (r348117) +++ stable/11/lib/libomp/Makefile Wed May 22 19:39:55 2019 (r348118) @@ -68,4 +68,6 @@ VERSION_MAP= ${OMPSRC}/exports_so.txt LIBADD+= pthread LIBADD+= m +SYMLINKS+= ${SHLIB_NAME} ${LIBDIR}/libgomp.so + .include Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/11/tools/build/mk/OptionalObsoleteFiles.inc Wed May 22 18:43:48 2019 (r348117) +++ stable/11/tools/build/mk/OptionalObsoleteFiles.inc Wed May 22 19:39:55 2019 (r348118) @@ -2434,12 +2434,16 @@ OLD_FILES+=usr/include/omp.h .endif OLD_FILES+=usr/lib/libgcov.a OLD_FILES+=usr/lib/libgomp.a +.if ${MK_OPENMP} == no OLD_FILES+=usr/lib/libgomp.so +.endif OLD_LIBS+=usr/lib/libgomp.so.1 OLD_FILES+=usr/lib/libgomp_p.a OLD_FILES+=usr/lib32/libgcov.a OLD_FILES+=usr/lib32/libgomp.a +.if ${MK_OPENMP} == no OLD_FILES+=usr/lib32/libgomp.so +.endif OLD_LIBS+=usr/lib32/libgomp.so.1 OLD_FILES+=usr/lib32/libgomp_p.a OLD_FILES+=usr/libexec/cc1 @@ -6847,11 +6851,14 @@ OLD_FILES+=usr/share/man/man8/ntpq.8.gz OLD_FILES+=usr/share/man/man8/ntptime.8.gz .endif -.if ${MK_OPENSSH} == no +.if ${MK_OPENMP} == no .if ${MK_GCC} == no OLD_FILES+=usr/include/omp.h +OLD_LIBS+=usr/lib/libgomp.so +OLD_LIBS+=usr/lib32/libgomp.so .endif OLD_LIBS+=usr/lib/libomp.so +OLD_LIBS+=usr/lib32/libomp.so .endif .if ${MK_OPENSSH} == no From owner-svn-src-stable@freebsd.org Wed May 22 22:34:36 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B661158F877; Wed, 22 May 2019 22:34:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ECFD56E25E; Wed, 22 May 2019 22:34:35 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ACAA623ECD; Wed, 22 May 2019 22:34:35 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4MMYZ8u035655; Wed, 22 May 2019 22:34:35 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4MMYZho035654; Wed, 22 May 2019 22:34:35 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201905222234.x4MMYZho035654@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 22 May 2019 22:34:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348124 - stable/12/sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/sys/net X-SVN-Commit-Revision: 348124 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: ECFD56E25E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 22:34:36 -0000 Author: kevans Date: Wed May 22 22:34:35 2019 New Revision: 348124 URL: https://svnweb.freebsd.org/changeset/base/348124 Log: MFC r347578: tun/tap: Defer clearing if_softc until after if_detach (Commit massaged to match stable structure; tun and tap have been merged in head) r346670 added an sx to close a race between the ifioctl handler and interface destruction. Unfortunately, it clears if_softc immediately after the interface is closed, but before if_detach has been invoked. Any time before detachment, an interface that's part of a bridge may still receive traffic that's pushed through tunstart/tunstart_l2 and promptly lead to a panic because if_softc is now NULL. Fix it by deferring the clearing of if_softc until after the interface has detached and thus been removed from the bridge. if_softc still gets cleared in case another thread has already entered the ioctl handler before it's replaced with ifdead_ioctl. Modified: stable/12/sys/net/if_tap.c stable/12/sys/net/if_tun.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/if_tap.c ============================================================================== --- stable/12/sys/net/if_tap.c Wed May 22 21:47:26 2019 (r348123) +++ stable/12/sys/net/if_tap.c Wed May 22 22:34:35 2019 (r348124) @@ -223,15 +223,17 @@ tap_destroy(struct tap_softc *tp) struct ifnet *ifp = tp->tap_ifp; CURVNET_SET(ifp->if_vnet); - sx_xlock(&tap_ioctl_sx); - ifp->if_softc = NULL; - sx_xunlock(&tap_ioctl_sx); destroy_dev(tp->tap_dev); seldrain(&tp->tap_rsel); knlist_clear(&tp->tap_rsel.si_note, 0); knlist_destroy(&tp->tap_rsel.si_note); ether_ifdetach(ifp); + + sx_xlock(&tap_ioctl_sx); + ifp->if_softc = NULL; + sx_xunlock(&tap_ioctl_sx); + if_free(ifp); mtx_destroy(&tp->tap_mtx); Modified: stable/12/sys/net/if_tun.c ============================================================================== --- stable/12/sys/net/if_tun.c Wed May 22 21:47:26 2019 (r348123) +++ stable/12/sys/net/if_tun.c Wed May 22 22:34:35 2019 (r348124) @@ -278,13 +278,15 @@ tun_destroy(struct tun_softc *tp) mtx_unlock(&tp->tun_mtx); CURVNET_SET(TUN2IFP(tp)->if_vnet); - sx_xlock(&tun_ioctl_sx); - TUN2IFP(tp)->if_softc = NULL; - sx_xunlock(&tun_ioctl_sx); dev = tp->tun_dev; bpfdetach(TUN2IFP(tp)); if_detach(TUN2IFP(tp)); + + sx_xlock(&tun_ioctl_sx); + TUN2IFP(tp)->if_softc = NULL; + sx_xunlock(&tun_ioctl_sx); + free_unr(tun_unrhdr, TUN2IFP(tp)->if_dunit); if_free(TUN2IFP(tp)); destroy_dev(dev); From owner-svn-src-stable@freebsd.org Wed May 22 22:55:28 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 41EFF1590125; Wed, 22 May 2019 22:55:28 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DC12F6ED2F; Wed, 22 May 2019 22:55:27 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BEA5024255; Wed, 22 May 2019 22:55:27 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4MMtRVJ045762; Wed, 22 May 2019 22:55:27 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4MMtR99045761; Wed, 22 May 2019 22:55:27 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201905222255.x4MMtR99045761@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 22 May 2019 22:55:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348125 - stable/12/lib/libbe X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/lib/libbe X-SVN-Commit-Revision: 348125 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DC12F6ED2F X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 22:55:28 -0000 Author: kevans Date: Wed May 22 22:55:27 2019 New Revision: 348125 URL: https://svnweb.freebsd.org/changeset/base/348125 Log: MFC r347640: libbe(3): Descend into children of datasets w/ mountpoint=none These datasets will generally be canmount=noauto,mountpoint=none (e.g. zroot/var) but have children that may need to be mounted. Instead of skipping that segment for no good reason, descend. Modified: stable/12/lib/libbe/be_access.c Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libbe/be_access.c ============================================================================== --- stable/12/lib/libbe/be_access.c Wed May 22 22:34:35 2019 (r348124) +++ stable/12/lib/libbe/be_access.c Wed May 22 22:55:27 2019 (r348125) @@ -99,13 +99,12 @@ be_mount_iter(zfs_handle_t *zfs_hdl, void *data) if (strcmp("none", zfs_mnt) == 0) { /* * mountpoint=none; we'll mount it at info->mountpoint assuming - * we're at the root. If we're not at the root... that's less - * than stellar and not entirely sure what to do with that. - * For now, we won't treat it as an error condition -- we just - * won't mount it, and we'll continue on. + * we're at the root. If we're not at the root, we're likely + * at some intermediate dataset (e.g. zroot/var) that will have + * children that may need to be mounted. */ if (info->depth > 0) - return (0); + goto skipmount; snprintf(tmp, BE_MAXPATHLEN, "%s", info->mountpoint); } else { @@ -136,6 +135,7 @@ be_mount_iter(zfs_handle_t *zfs_hdl, void *data) if (!info->deepmount) return (0); +skipmount: ++info->depth; err = zfs_iter_filesystems(zfs_hdl, be_mount_iter, info); --info->depth; From owner-svn-src-stable@freebsd.org Wed May 22 22:56:06 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6061F15901B9; Wed, 22 May 2019 22:56:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CE6FA6EE53; Wed, 22 May 2019 22:56:05 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A056B24257; Wed, 22 May 2019 22:56:05 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4MMu5bM045836; Wed, 22 May 2019 22:56:05 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4MMu5x5045834; Wed, 22 May 2019 22:56:05 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201905222256.x4MMu5x5045834@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 22 May 2019 22:56:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r348126 - stable/11/sys/net X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/sys/net X-SVN-Commit-Revision: 348126 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CE6FA6EE53 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 22:56:06 -0000 Author: kevans Date: Wed May 22 22:56:05 2019 New Revision: 348126 URL: https://svnweb.freebsd.org/changeset/base/348126 Log: MFC r347578: tun/tap: Defer clearing if_softc until after if_detach (Commit massaged to match stable structure; tun and tap have been merged in head) r346670 added an sx to close a race between the ifioctl handler and interface destruction. Unfortunately, it clears if_softc immediately after the interface is closed, but before if_detach has been invoked. Any time before detachment, an interface that's part of a bridge may still receive traffic that's pushed through tunstart/tunstart_l2 and promptly lead to a panic because if_softc is now NULL. Fix it by deferring the clearing of if_softc until after the interface has detached and thus been removed from the bridge. if_softc still gets cleared in case another thread has already entered the ioctl handler before it's replaced with ifdead_ioctl. Approved by: re (kib) Modified: stable/11/sys/net/if_tap.c stable/11/sys/net/if_tun.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/if_tap.c ============================================================================== --- stable/11/sys/net/if_tap.c Wed May 22 22:55:27 2019 (r348125) +++ stable/11/sys/net/if_tap.c Wed May 22 22:56:05 2019 (r348126) @@ -223,15 +223,17 @@ tap_destroy(struct tap_softc *tp) struct ifnet *ifp = tp->tap_ifp; CURVNET_SET(ifp->if_vnet); - sx_xlock(&tap_ioctl_sx); - ifp->if_softc = NULL; - sx_xunlock(&tap_ioctl_sx); destroy_dev(tp->tap_dev); seldrain(&tp->tap_rsel); knlist_clear(&tp->tap_rsel.si_note, 0); knlist_destroy(&tp->tap_rsel.si_note); ether_ifdetach(ifp); + + sx_xlock(&tap_ioctl_sx); + ifp->if_softc = NULL; + sx_xunlock(&tap_ioctl_sx); + if_free(ifp); mtx_destroy(&tp->tap_mtx); Modified: stable/11/sys/net/if_tun.c ============================================================================== --- stable/11/sys/net/if_tun.c Wed May 22 22:55:27 2019 (r348125) +++ stable/11/sys/net/if_tun.c Wed May 22 22:56:05 2019 (r348126) @@ -278,13 +278,15 @@ tun_destroy(struct tun_softc *tp) mtx_unlock(&tp->tun_mtx); CURVNET_SET(TUN2IFP(tp)->if_vnet); - sx_xlock(&tun_ioctl_sx); - TUN2IFP(tp)->if_softc = NULL; - sx_xunlock(&tun_ioctl_sx); dev = tp->tun_dev; bpfdetach(TUN2IFP(tp)); if_detach(TUN2IFP(tp)); + + sx_xlock(&tun_ioctl_sx); + TUN2IFP(tp)->if_softc = NULL; + sx_xunlock(&tun_ioctl_sx); + free_unr(tun_unrhdr, TUN2IFP(tp)->if_dunit); if_free(TUN2IFP(tp)); destroy_dev(dev); From owner-svn-src-stable@freebsd.org Wed May 22 23:19:22 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4564B1590C43; Wed, 22 May 2019 23:19:22 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AA43E6FF6D; Wed, 22 May 2019 23:19:21 +0000 (UTC) (envelope-from sjg@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8168224603; Wed, 22 May 2019 23:19:21 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4MNJLSI057227; Wed, 22 May 2019 23:19:21 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4MNJKBG057223; Wed, 22 May 2019 23:19:20 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201905222319.x4MNJKBG057223@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Wed, 22 May 2019 23:19:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348129 - in stable/12/lib/libsecureboot: . h tests X-SVN-Group: stable-12 X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: in stable/12/lib/libsecureboot: . h tests X-SVN-Commit-Revision: 348129 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AA43E6FF6D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 23:19:22 -0000 Author: sjg Date: Wed May 22 23:19:20 2019 New Revision: 348129 URL: https://svnweb.freebsd.org/changeset/base/348129 Log: libsecureboot: allow control of when pseudo pcr is updated During boot we only want to measure things which *must* be verified - this should provide more deterministic ordering. MFC r347981 Reviewed by: stevek Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D20297 Modified: stable/12/lib/libsecureboot/h/libsecureboot.h stable/12/lib/libsecureboot/tests/tvo.c stable/12/lib/libsecureboot/vepcr.c stable/12/lib/libsecureboot/verify_file.c Modified: stable/12/lib/libsecureboot/h/libsecureboot.h ============================================================================== --- stable/12/lib/libsecureboot/h/libsecureboot.h Wed May 22 23:11:16 2019 (r348128) +++ stable/12/lib/libsecureboot/h/libsecureboot.h Wed May 22 23:19:20 2019 (r348129) @@ -81,6 +81,8 @@ unsigned char *verify_asc(const char *, int); /* OpenP void ve_pcr_init(void); void ve_pcr_update(unsigned char *, size_t); ssize_t ve_pcr_get(unsigned char *, size_t); +int ve_pcr_updating_get(void); +void ve_pcr_updating_set(int); /* flags for verify_{asc,sig,signed} */ #define VEF_VERBOSE 1 Modified: stable/12/lib/libsecureboot/tests/tvo.c ============================================================================== --- stable/12/lib/libsecureboot/tests/tvo.c Wed May 22 23:11:16 2019 (r348128) +++ stable/12/lib/libsecureboot/tests/tvo.c Wed May 22 23:19:20 2019 (r348129) @@ -74,6 +74,9 @@ main(int argc, char *argv[]) } } +#ifdef VE_PCR_SUPPORT + ve_pcr_updating_set(1); +#endif ve_self_tests(); for ( ; optind < argc; optind++) { @@ -176,6 +179,10 @@ main(int argc, char *argv[]) } } } +#ifdef VE_PCR_SUPPORT + verify_pcr_export(); + printf("pcr=%s\n", getenv("loader.ve.pcr")); +#endif return (0); } Modified: stable/12/lib/libsecureboot/vepcr.c ============================================================================== --- stable/12/lib/libsecureboot/vepcr.c Wed May 22 23:11:16 2019 (r348128) +++ stable/12/lib/libsecureboot/vepcr.c Wed May 22 23:19:20 2019 (r348129) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); static const br_hash_class *pcr_md = NULL; static br_hash_compat_context pcr_ctx; static size_t pcr_hlen = 0; +static int pcr_updating; /** * @brief initialize pcr context @@ -53,18 +54,37 @@ static size_t pcr_hlen = 0; void ve_pcr_init(void) { + pcr_updating = 0; pcr_hlen = br_sha256_SIZE; pcr_md = &br_sha256_vtable; pcr_md->init(&pcr_ctx.vtable); } /** + * @brief get pcr_updating state + */ +int +ve_pcr_updating_get(void) +{ + return (pcr_updating); +} + +/** + * @brief set pcr_updating state + */ +void +ve_pcr_updating_set(int updating) +{ + pcr_updating = updating; +} + +/** * @brief update pcr context */ void ve_pcr_update(unsigned char *data, size_t dlen) { - if (pcr_md) + if (pcr_updating != 0 && pcr_md != NULL) pcr_md->update(&pcr_ctx.vtable, data, dlen); } Modified: stable/12/lib/libsecureboot/verify_file.c ============================================================================== --- stable/12/lib/libsecureboot/verify_file.c Wed May 22 23:11:16 2019 (r348128) +++ stable/12/lib/libsecureboot/verify_file.c Wed May 22 23:19:20 2019 (r348129) @@ -340,6 +340,14 @@ verify_file(int fd, const char *filename, off_t off, i if (rc != VE_FINGERPRINT_WRONG && loaded_manifests) { if (severity <= VE_GUESS) severity = severity_guess(filename); +#ifdef VE_PCR_SUPPORT + /* + * Only update pcr with things that must verify + * these tend to be processed in a more deterministic + * order, which makes our pseudo pcr more useful. + */ + ve_pcr_updating_set((severity == VE_MUST)); +#endif if ((rc = verify_fd(fd, filename, off, &st)) >= 0) { if (verbose || severity > VE_WANT) { #if defined(VE_DEBUG_LEVEL) && VE_DEBUG_LEVEL > 0 From owner-svn-src-stable@freebsd.org Wed May 22 23:23:18 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D49E31590FA8; Wed, 22 May 2019 23:23:17 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7850D70527; Wed, 22 May 2019 23:23:17 +0000 (UTC) (envelope-from sjg@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5238C247A7; Wed, 22 May 2019 23:23:17 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4MNNHS6062176; Wed, 22 May 2019 23:23:17 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4MNNH5v062175; Wed, 22 May 2019 23:23:17 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201905222323.x4MNNH5v062175@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Wed, 22 May 2019 23:23:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348131 - stable/12/lib/libsecureboot/openpgp X-SVN-Group: stable-12 X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: stable/12/lib/libsecureboot/openpgp X-SVN-Commit-Revision: 348131 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7850D70527 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 23:23:18 -0000 Author: sjg Date: Wed May 22 23:23:16 2019 New Revision: 348131 URL: https://svnweb.freebsd.org/changeset/base/348131 Log: load_key_buf do not free data from dearmor The data returned by dearmor is referenced by the key leave it alone! MFC r347980 Reviewed by: stevek Modified: stable/12/lib/libsecureboot/openpgp/opgp_key.c stable/12/lib/libsecureboot/openpgp/opgp_sig.c Modified: stable/12/lib/libsecureboot/openpgp/opgp_key.c ============================================================================== --- stable/12/lib/libsecureboot/openpgp/opgp_key.c Wed May 22 23:22:36 2019 (r348130) +++ stable/12/lib/libsecureboot/openpgp/opgp_key.c Wed May 22 23:23:16 2019 (r348131) @@ -168,6 +168,7 @@ load_key_buf(unsigned char *buf, size_t nbytes) initialize(); if (!(buf[0] & OPENPGP_TAG_ISTAG)) { + /* Note: we do *not* free data */ data = dearmor((char *)buf, nbytes, &nbytes); ptr = data; } else @@ -190,7 +191,6 @@ load_key_buf(unsigned char *buf, size_t nbytes) } } } - free(data); return (key); } @@ -209,8 +209,10 @@ openpgp_trust_add(OpenPGP_key *key) LIST_INIT(&trust_list); } - if (key) + if (key) { + DEBUG_PRINTF(2, ("openpgp_trust_add(%s)\n", key->id)); LIST_INSERT_HEAD(&trust_list, key, entries); + } } /** @@ -296,6 +298,7 @@ load_key_id(const char *keyID) if (!key) key = load_trusted_key_id(keyID); #endif + DEBUG_PRINTF(2, ("load_key_id(%s): %s\n", keyID, key ? "found" : "nope")); return (key); } Modified: stable/12/lib/libsecureboot/openpgp/opgp_sig.c ============================================================================== --- stable/12/lib/libsecureboot/openpgp/opgp_sig.c Wed May 22 23:22:36 2019 (r348130) +++ stable/12/lib/libsecureboot/openpgp/opgp_sig.c Wed May 22 23:23:16 2019 (r348131) @@ -318,6 +318,7 @@ openpgp_verify(const char *filename, sdata = ddata = dearmor((char *)sdata, sbytes, &sbytes); ptr = sdata; rc = decode_packet(2, &ptr, sbytes, (decoder_t)decode_sig, sig); + DEBUG_PRINTF(2, ("rc=%d keyID=%s\n", rc, sig->key_id ? sig->key_id : "?")); if (rc == 0 && sig->key_id) { key = load_key_id(sig->key_id); if (!key) { From owner-svn-src-stable@freebsd.org Wed May 22 23:34:42 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 071041591577; Wed, 22 May 2019 23:34:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A307E70D76; Wed, 22 May 2019 23:34:41 +0000 (UTC) (envelope-from kevans@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7930F24948; Wed, 22 May 2019 23:34:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4MNYfU0067677; Wed, 22 May 2019 23:34:41 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4MNYfdg067676; Wed, 22 May 2019 23:34:41 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201905222334.x4MNYfdg067676@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 22 May 2019 23:34:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r348133 - stable/11/lib/libbe X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/11/lib/libbe X-SVN-Commit-Revision: 348133 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A307E70D76 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 May 2019 23:34:42 -0000 Author: kevans Date: Wed May 22 23:34:41 2019 New Revision: 348133 URL: https://svnweb.freebsd.org/changeset/base/348133 Log: MFC r347640: libbe(3): Descend into children of datasets w/ mountpoint=none These datasets will generally be canmount=noauto,mountpoint=none (e.g. zroot/var) but have children that may need to be mounted. Instead of skipping that segment for no good reason, descend. Approved by: re (kib) Modified: stable/11/lib/libbe/be_access.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libbe/be_access.c ============================================================================== --- stable/11/lib/libbe/be_access.c Wed May 22 23:30:51 2019 (r348132) +++ stable/11/lib/libbe/be_access.c Wed May 22 23:34:41 2019 (r348133) @@ -99,13 +99,12 @@ be_mount_iter(zfs_handle_t *zfs_hdl, void *data) if (strcmp("none", zfs_mnt) == 0) { /* * mountpoint=none; we'll mount it at info->mountpoint assuming - * we're at the root. If we're not at the root... that's less - * than stellar and not entirely sure what to do with that. - * For now, we won't treat it as an error condition -- we just - * won't mount it, and we'll continue on. + * we're at the root. If we're not at the root, we're likely + * at some intermediate dataset (e.g. zroot/var) that will have + * children that may need to be mounted. */ if (info->depth > 0) - return (0); + goto skipmount; snprintf(tmp, BE_MAXPATHLEN, "%s", info->mountpoint); } else { @@ -136,6 +135,7 @@ be_mount_iter(zfs_handle_t *zfs_hdl, void *data) if (!info->deepmount) return (0); +skipmount: ++info->depth; err = zfs_iter_filesystems(zfs_hdl, be_mount_iter, info); --info->depth; From owner-svn-src-stable@freebsd.org Thu May 23 00:55:36 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 03FA71593176; Thu, 23 May 2019 00:55:36 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 94EC073118; Thu, 23 May 2019 00:55:35 +0000 (UTC) (envelope-from ngie@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C1172571D; Thu, 23 May 2019 00:55:35 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4N0tZhM009514; Thu, 23 May 2019 00:55:35 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4N0tS6H009477; Thu, 23 May 2019 00:55:28 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201905230055.x4N0tS6H009477@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Enji Cooper Date: Thu, 23 May 2019 00:55:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348136 - in stable/12: cddl/usr.sbin/zfsd cddl/usr.sbin/zfsd/tests contrib/googletest contrib/googletest/googletest contrib/googletest/googletest/docs contrib/googletest/googletest/inc... X-SVN-Group: stable-12 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: in stable/12: cddl/usr.sbin/zfsd cddl/usr.sbin/zfsd/tests contrib/googletest contrib/googletest/googletest contrib/googletest/googletest/docs contrib/googletest/googletest/include/gtest contrib/google... X-SVN-Commit-Revision: 348136 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 94EC073118 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.952,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 00:55:36 -0000 Author: ngie Date: Thu May 23 00:55:28 2019 New Revision: 348136 URL: https://svnweb.freebsd.org/changeset/base/348136 Log: MFC r345203,r345205,r345353,r345645,r345708,r345709,r345735,r345770,r346574,r346576: r345203: Initial googlemock/googletest integration into the build/FreeBSD test suite This initial integration takes googlemock/googletest release 1.8.1, integrates the library, tests, and sample unit tests into the build. googlemock/googletest's inclusion is optionally available via `MK_GOOGLETEST`. `MK_GOOGLETEST` is dependent on `MK_TESTS` and is enabled by default when built with a C++11 capable toolchain. Google tests can be specified via the `GTESTS` variable, which, in comparison with the other test drivers, is more simplified/streamlined, as Googletest only supports C++ tests; not raw C or shell tests (C tests can be written in C++ using the standard embedding methods). No dependent libraries are assumed for the tests. One must specify `gmock`, `gmock_main`, `gtest`, or `gtest_main`, via `LIBADD` for the program. More information about googlemock and googletest can be found on the Googletest [project page](https://github.com/google/googletest), and the [GoogleMock](https://github.com/google/googletest/blob/v1.8.x/googlemock/docs/Documentation.md) and [GoogleTest](https://github.com/google/googletest/tree/v1.8.x/googletest/docs) docs. These tests are originally integrated into the build as plain driver tests, but will be natively integrated into Kyua in a later version. Known issues/Errata: * [WhenDynamicCastToTest.AmbiguousCast fails on FreeBSD](https://github.com/google/googletest/issues/2172) r345205: Integrate cddl/usr.sbin/zfds/tests into the FreeBSD test suite This change integrates the unit tests for zfsd into the test suite using the integration method described in r345203. This change removes the `LOCALBASE` includes added for the port version of googlemock/googletest, as well as unnecessary `LIBADD`/`DPADD` and `CXXFLAGS` defines, which are included in the `GTEST_CXXFLAGS` variable, as part of r345203. r345353 (by asomers): googletest: backport GTEST_SKIP to googletest 1.8.1 This commit backports revisions 00938b2b228f3b70d3d9e51f29a1505bdad43f1e and 59f90a338bce2376b540ee239cf4e269bf6d68ad from googletest's master branch to our included version of googletest, which is based on 1.8.1. It adds the GTEST_SKIP feature, which is very useful for a project like FreeBSD where some tests depend on particular system configurations. Obtained from: github.com/google/googletest r345645: Spam CXXFLAGS with `-I${DESTDIR}/usr/include/private`, instead of GTEST_CXXFLAGS This makes it easier for googletest users to leverage googletest, instead of forcing them to plug GTEST_CXXFLAGS into CXXFLAGS manually (resulting in unnecessary duplication). I will be following this up with a more proper fix in src.libnames.mk, as src.libnames.mk should be automatically adding this directory to CFLAGS/CXXFLAGS when private libraries are referenced. Not doing so can result in mismatches between base-provided private library's and ports-provided library's headers. While here, tweak the comment to clarify what the intent is behind spamming CXXFLAGS. r345708: Standardize `-std=c++* as `CXXSTD` CXXSTD was added as the C++ analogue to CSTD. CXXSTD defaults to `-std=c++11` with supporting compilers; `-std=gnu++98`, otherwise for older versions of g++. This change standardizes the CXXSTD variable, originally added to googletest.test.inc.mk as part of r345203. As part of this effort, convert all `CXXFLAGS+= -std=*` calls to use `CXXSTD`. Notes: This value is not sanity checked in bsd.sys.mk, however, given the two most used C++ compilers on FreeBSD (clang++ and g++) support both modes, it is likely to work with both toolchains. This method will be refined in the future to support more variants of C++, as not all versions of clang++ and g++ (for instance) support C++14, C++17, etc. Any manual appending of `-std=*` to `CXXFLAGS` should be replaced with CXXSTD. Example: Before this commit: ``` CXXFLAGS+= -std=c++14 ``` After this commit: ``` CXXSTD= c++14 ``` Relnotes: yes Tested with: make tinderbox r345709: Allow users to override CSTD/CXXSTD on a per-prog basis The current logic for CSTD/CXXSTD requires homogenity as far as the supported C/C++ standards, which is a sensible default. However, when dealing with differing versions of C++, some code may compile with C++11, but not C++17 (for instance). So in order to avoid having people convert over their code to the new standard, give the users the ability to specify the standard on a per-program basis. This will allow a user to override the supporting standard for a set of programs, mixing C++11 with C++14 (for instance). Approved by: emaste (mentor) r345735: Allow programs to set `NO_SHARED` on a per-PROG basis This is particularly useful when installing programs for tests that need to be linked statically, e.g., mini-me from capsicum-test, which is linked statically to avoid the dynamic library lookup in the upstream project. r345770: Import proof-of-concept for handling `GTEST_SKIP()` in `Environment::SetUp` Per the upstream pull-request [1]: ``` gtest prior to this change would completely ignore `GTEST_SKIP()` if called in `Environment::SetUp()`, instead of bailing out early, unlike `Test::SetUp()`, which would cause the tests themselves to be skipped. The only way (prior to this change) to skip the tests would be to trigger a fatal error via `GTEST_FAIL()`. Desirable behavior, in this case, when dealing with `Environment::SetUp()` is to check for prerequisites on a system (example, kernel supports a particular featureset, e.g., capsicum), and skip the tests. The alternatives prior to this change would be undesirable: - Failing sends the wrong message to the test user, as the result of the tests is indeterminate, not failed. - Having to add per-test class abstractions that override `SetUp()` to test for the capsicum feature set, then skip all of the tests in their respective SetUp fixtures, would be a lot of human and computational work; checking for the feature would need to be done for all of the tests, instead of once for all of the tests. For those reasons, making `Environment::SetUp()` handle `GTEST_SKIP()`, by not executing the testcases, is the most desirable solution. In order to properly diagnose what happened when running the tests if they are skipped, print out the diagnostics in an ad hoc manner. Update the documentation to note this change and integrate a new test, gtest_skip_in_environment_setup_test, into the test suite. This change addresses #2189. Signed-off-by: Enji Cooper ``` The goal with my merging in this change is to avoid requiring extensive refactoring/retesting of test suites when ensuring prerequisites are met, e.g., checking for a CAPABILITIES-enabled kernel before running capsicum-test (see D19758 for more details). The proof-of-concept is being imported before accepted by the upstream project due to the fact that the upstream project is undergoing a potential development freeze and the maintainers aren't responding to my PR. 1. https://github.com/google/googletest/pull/2203 r346574: Rework CXXSTD setting via r345708 This change allows the user to once again override the C++ standard, restoring high-level pre-r345708 behavior. This also unbreaks building lib/ofed/libibnetdisc/Makefile with a non-C++11 capable compiler, e.g., g++ 4.2.1, as the library supported being built with older C++ standards. r346576: Fix up CXXSTD support originally added in r345708 r345708 worked for the base system, but unfortunately, caused a lot of disruption for third-party packages that relied on C++, since bsd.sys.mk is used by applications outside the base system. The defaults picked didn't match the compiler's defaults and broke some builds that didn't specify a standard, as well as some that overrode the value by setting `-std=gnu++14` (for example) manually. This change takes a more relaxed approach to appending `-std=${CXXSTD}` to CXXFLAGS, by only doing so when the value is specified, as opposed to overriding the standard set by an end-user. This avoids the need for having to bake NOP default into bsd.sys.mk for supported compiler-toolchain versions. In order to make this change possible, add CXXSTD to Makefile snippets which relied on the default value (c++11) added in r345708. Added: stable/12/contrib/googletest/ - copied from r345203, head/contrib/googletest/ stable/12/contrib/googletest/googletest/test/gtest_skip_in_environment_setup_test.cc - copied unchanged from r345770, head/contrib/googletest/googletest/test/gtest_skip_in_environment_setup_test.cc stable/12/contrib/googletest/googletest/test/gtest_skip_test.cc - copied unchanged from r345353, head/contrib/googletest/googletest/test/gtest_skip_test.cc stable/12/lib/googletest/ - copied from r345203, head/lib/googletest/ stable/12/share/examples/tests/tests/googletest/ - copied from r345203, head/share/examples/tests/tests/googletest/ stable/12/share/mk/googletest.test.inc.mk - copied, changed from r345203, head/share/mk/googletest.test.inc.mk stable/12/share/mk/googletest.test.mk - copied unchanged from r345203, head/share/mk/googletest.test.mk stable/12/tools/build/options/WITHOUT_GOOGLETEST - copied unchanged from r345203, head/tools/build/options/WITHOUT_GOOGLETEST Modified: stable/12/cddl/usr.sbin/zfsd/Makefile stable/12/cddl/usr.sbin/zfsd/Makefile.common stable/12/cddl/usr.sbin/zfsd/tests/Makefile stable/12/contrib/googletest/googletest/CMakeLists.txt stable/12/contrib/googletest/googletest/Makefile.am stable/12/contrib/googletest/googletest/docs/advanced.md stable/12/contrib/googletest/googletest/include/gtest/gtest-test-part.h stable/12/contrib/googletest/googletest/include/gtest/gtest.h stable/12/contrib/googletest/googletest/include/gtest/internal/gtest-internal.h stable/12/contrib/googletest/googletest/src/gtest-internal-inl.h stable/12/contrib/googletest/googletest/src/gtest-test-part.cc stable/12/contrib/googletest/googletest/src/gtest.cc stable/12/contrib/googletest/googletest/test/BUILD.bazel stable/12/contrib/googletest/googletest/test/googletest-test-part-test.cc stable/12/contrib/googletest/googletest/test/gtest_all_test.cc stable/12/contrib/mandoc/lib.in stable/12/etc/mtree/BSD.tests.dist stable/12/etc/mtree/BSD.usr.dist stable/12/lib/Makefile stable/12/lib/clang/llvm.build.mk stable/12/lib/googletest/gtest_main/tests/Makefile stable/12/lib/libc++/Makefile stable/12/lib/libc++experimental/Makefile stable/12/lib/libc++fs/Makefile stable/12/lib/libc/tests/stdlib/Makefile stable/12/lib/libclang_rt/Makefile.inc stable/12/lib/libcxxrt/Makefile stable/12/lib/libgcc_eh/Makefile.inc stable/12/lib/libomp/Makefile stable/12/lib/ofed/libibnetdisc/Makefile stable/12/share/examples/tests/tests/Makefile stable/12/share/mk/Makefile stable/12/share/mk/bsd.README stable/12/share/mk/bsd.progs.mk stable/12/share/mk/bsd.sys.mk stable/12/share/mk/bsd.test.mk stable/12/share/mk/src.libnames.mk stable/12/share/mk/src.opts.mk stable/12/tests/sys/opencrypto/cryptodev.py stable/12/tests/sys/opencrypto/cryptodevh.py stable/12/tests/sys/opencrypto/cryptotest.py stable/12/tests/sys/opencrypto/runtests.sh stable/12/tools/build/mk/OptionalObsoleteFiles.inc stable/12/usr.bin/dtc/Makefile stable/12/usr.sbin/pmc/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/usr.sbin/zfsd/Makefile ============================================================================== --- stable/12/cddl/usr.sbin/zfsd/Makefile Thu May 23 00:44:01 2019 (r348135) +++ stable/12/cddl/usr.sbin/zfsd/Makefile Thu May 23 00:55:28 2019 (r348136) @@ -1,12 +1,13 @@ # $FreeBSD$ +.include + .include "Makefile.common" PROG_CXX= zfsd MAN= zfsd.8 -.include +HAS_TESTS= +SUBDIR.${MK_GOOGLETEST}+= tests -# The unittests require devel/googletest and devel/googlemock from ports. -# Don't automatically build them. -SUBDIR= +.include Modified: stable/12/cddl/usr.sbin/zfsd/Makefile.common ============================================================================== --- stable/12/cddl/usr.sbin/zfsd/Makefile.common Thu May 23 00:44:01 2019 (r348135) +++ stable/12/cddl/usr.sbin/zfsd/Makefile.common Thu May 23 00:55:28 2019 (r348136) @@ -28,12 +28,11 @@ INCFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/li INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs +INCFLAGS+= -I${SRCTOP}/cddl/usr.sbin CFLAGS= -g -DNEED_SOLARIS_BOOLEAN ${INCFLAGS} -DPADD= ${LIBDEVDCTL} ${LIBZFS} ${LIBZFS_CORE} ${LIBUTIL} ${LIBGEOM} \ - ${LIBBSDXML} ${LIBSBUF} ${LIBNVPAIR} ${LIBUUTIL} -LIBADD= devdctl zfs zfs_core util geom bsdxml sbuf nvpair uutil +LIBADD+= devdctl zfs zfs_core util geom bsdxml sbuf nvpair uutil cscope: find ${.CURDIR} -type f -a \( -name "*.[ch]" -o -name "*.cc" \) \ Modified: stable/12/cddl/usr.sbin/zfsd/tests/Makefile ============================================================================== --- stable/12/cddl/usr.sbin/zfsd/tests/Makefile Thu May 23 00:44:01 2019 (r348135) +++ stable/12/cddl/usr.sbin/zfsd/tests/Makefile Thu May 23 00:55:28 2019 (r348136) @@ -3,30 +3,12 @@ .include "${.CURDIR}/../Makefile.common" .PATH: ${.CURDIR:H} -PLAIN_TESTS_CXX= zfsd_unittest -SRCS.zfsd_unittest:= ${SRCS:Nzfsd_main.cc} -SRCS.zfsd_unittest+= libmocks.c zfsd_unittest.cc -SRCS= +GTESTS= zfsd_unittest -# Use #include in test programs. -INCFLAGS+= -I${.CURDIR:H:H} +SRCS.zfsd_unittest:= ${SRCS:Nzfsd_main.cc} +SRCS.zfsd_unittest+= libmocks.c zfsd_unittest.cc +.undef SRCS -.if defined(DESTDIR) || defined(SYSROOT) -INCFLAGS+= -I${SYSROOT:U${DESTDIR}}/usr/include -LDFLAGS.zfsd_unittest+= -L${SYSROOT:U${DESTDIR}}/lib \ - -L${SYSROOT:U${DESTDIR}}/usr/lib -.endif - -# Googletest options -INCFLAGS+= -I${LOCALBASE}/include -D_THREAD_SAFE -pthread -LDFLAGS.zfsd_unittest+= -L${LOCALBASE}/lib -D_THREAD_SAFE -pthread -LDADD.zfsd_unittest+= ${LOCALBASE}/lib/libgtest.a - -# GoogleMock options -LDADD.zfsd_unittest+= ${LOCALBASE}/lib/libgmock.a ${LOCALBASE}/lib/libgmock_main.a - -# Googlemock fails if we don't have this line -# https://groups.google.com/forum/#!msg/googletestframework/h8ixEPCFm0o/amwfu4xGJb0J -CFLAGS.zfsd_unittest+= -DGTEST_HAS_PTHREAD +LIBADD.zfsd_unittest+= gmock_main .include Modified: stable/12/contrib/googletest/googletest/CMakeLists.txt ============================================================================== --- head/contrib/googletest/googletest/CMakeLists.txt Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/contrib/googletest/googletest/CMakeLists.txt Thu May 23 00:55:28 2019 (r348136) @@ -217,6 +217,8 @@ if (gtest_build_tests) test/gtest-typed-test2_test.cc) cxx_test(gtest_unittest gtest_main) cxx_test(gtest-unittest-api_test gtest) + cxx_test(gtest_skip_in_environment_setup_test gtest_main) + cxx_test(gtest_skip_test gtest_main) ############################################################ # C++ tests built with non-standard compiler flags. Modified: stable/12/contrib/googletest/googletest/Makefile.am ============================================================================== --- head/contrib/googletest/googletest/Makefile.am Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/contrib/googletest/googletest/Makefile.am Thu May 23 00:55:28 2019 (r348136) @@ -290,6 +290,12 @@ test_gtest_all_test_SOURCES = test/gtest_all_test.cc test_gtest_all_test_LDADD = lib/libgtest_main.la \ lib/libgtest.la +TESTS += test/gtest_skip_in_environment_setup_test +check_PROGRAMS += test/gtest_skip_in_environment_setup_test +test_gtest_skip_in_environment_setup_test_SOURCES = test/gtest_skip_in_environment_setup_test.cc +test_gtest_skip_in_environment_setup_test_LDADD= lib/libgtest_main.la \ + lib/libgtest.la + # Tests that fused gtest files compile and work. FUSED_GTEST_SRC = \ fused-src/gtest/gtest-all.cc \ Modified: stable/12/contrib/googletest/googletest/docs/advanced.md ============================================================================== --- head/contrib/googletest/googletest/docs/advanced.md Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/contrib/googletest/googletest/docs/advanced.md Thu May 23 00:55:28 2019 (r348136) @@ -1289,8 +1289,10 @@ Environment* AddGlobalTestEnvironment(Environment* env ``` Now, when `RUN_ALL_TESTS()` is called, it first calls the `SetUp()` method of -the environment object, then runs the tests if there was no fatal failures, and -finally calls `TearDown()` of the environment object. +each environment object, then runs the tests if none of the environments +reported fatal failures and `GTEST_SKIP()` was not called. `RUN_ALL_TESTS()` +always calls `TearDown()` with each environment object, regardless of whether +or not the tests were run. It's OK to register multiple environment objects. In this case, their `SetUp()` will be called in the order they are registered, and their `TearDown()` will be Modified: stable/12/contrib/googletest/googletest/include/gtest/gtest-test-part.h ============================================================================== --- head/contrib/googletest/googletest/include/gtest/gtest-test-part.h Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/contrib/googletest/googletest/include/gtest/gtest-test-part.h Thu May 23 00:55:28 2019 (r348136) @@ -53,7 +53,8 @@ class GTEST_API_ TestPartResult { enum Type { kSuccess, // Succeeded. kNonFatalFailure, // Failed but the test can continue. - kFatalFailure // Failed and the test should be terminated. + kFatalFailure, // Failed and the test should be terminated. + kSkip // Skipped. }; // C'tor. TestPartResult does NOT have a default constructor. @@ -89,17 +90,20 @@ class GTEST_API_ TestPartResult { // Gets the message associated with the test part. const char* message() const { return message_.c_str(); } + // Returns true iff the test part was skipped. + bool skipped() const { return type_ == kSkip; } + // Returns true iff the test part passed. bool passed() const { return type_ == kSuccess; } - // Returns true iff the test part failed. - bool failed() const { return type_ != kSuccess; } - // Returns true iff the test part non-fatally failed. bool nonfatally_failed() const { return type_ == kNonFatalFailure; } // Returns true iff the test part fatally failed. bool fatally_failed() const { return type_ == kFatalFailure; } + + // Returns true iff the test part failed. + bool failed() const { return fatally_failed() || nonfatally_failed(); } private: Type type_; Modified: stable/12/contrib/googletest/googletest/include/gtest/gtest.h ============================================================================== --- head/contrib/googletest/googletest/include/gtest/gtest.h Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/contrib/googletest/googletest/include/gtest/gtest.h Thu May 23 00:55:28 2019 (r348136) @@ -440,6 +440,9 @@ class GTEST_API_ Test { // Returns true iff the current test has a non-fatal failure. static bool HasNonfatalFailure(); + // Returns true iff the current test was skipped. + static bool IsSkipped(); + // Returns true iff the current test has a (either fatal or // non-fatal) failure. static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); } @@ -574,8 +577,11 @@ class GTEST_API_ TestResult { int test_property_count() const; // Returns true iff the test passed (i.e. no test part failed). - bool Passed() const { return !Failed(); } + bool Passed() const { return !Skipped() && !Failed(); } + // Returns true iff the test was skipped. + bool Skipped() const; + // Returns true iff the test failed. bool Failed() const; @@ -854,6 +860,9 @@ class GTEST_API_ TestCase { // Gets the number of successful tests in this test case. int successful_test_count() const; + // Gets the number of skipped tests in this test case. + int skipped_test_count() const; + // Gets the number of failed tests in this test case. int failed_test_count() const; @@ -936,6 +945,11 @@ class GTEST_API_ TestCase { return test_info->should_run() && test_info->result()->Passed(); } + // Returns true iff test skipped. + static bool TestSkipped(const TestInfo* test_info) { + return test_info->should_run() && test_info->result()->Skipped(); + } + // Returns true iff test failed. static bool TestFailed(const TestInfo* test_info) { return test_info->should_run() && test_info->result()->Failed(); @@ -1258,6 +1272,9 @@ class GTEST_API_ UnitTest { // Gets the number of successful tests. int successful_test_count() const; + // Gets the number of skipped tests. + int skipped_test_count() const; + // Gets the number of failed tests. int failed_test_count() const; @@ -1834,6 +1851,11 @@ class TestWithParam : public Test, public WithParamInt }; // Macros for indicating success/failure in test code. + +// Skips test in runtime. +// Skipping test aborts current function. +// Skipped tests are neither successful nor failed. +#define GTEST_SKIP() GTEST_SKIP_("Skipped") // ADD_FAILURE unconditionally adds a failure to the current test. // SUCCEED generates a success - it doesn't automatically make the Modified: stable/12/contrib/googletest/googletest/include/gtest/internal/gtest-internal.h ============================================================================== --- head/contrib/googletest/googletest/include/gtest/internal/gtest-internal.h Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/contrib/googletest/googletest/include/gtest/internal/gtest-internal.h Thu May 23 00:55:28 2019 (r348136) @@ -1208,7 +1208,10 @@ class NativeArray { #define GTEST_SUCCESS_(message) \ GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess) -// Suppress MSVC warning 4702 (unreachable code) for the code following +#define GTEST_SKIP_(message) \ + return GTEST_MESSAGE_(message, ::testing::TestPartResult::kSkip) + +// Suppress MSVC warning 4072 (unreachable code) for the code following // statement if it returns or throws (or doesn't return or throw in some // situations). #define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \ Modified: stable/12/contrib/googletest/googletest/src/gtest-internal-inl.h ============================================================================== --- head/contrib/googletest/googletest/src/gtest-internal-inl.h Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/contrib/googletest/googletest/src/gtest-internal-inl.h Thu May 23 00:55:28 2019 (r348136) @@ -544,6 +544,9 @@ class GTEST_API_ UnitTestImpl { // Gets the number of successful tests. int successful_test_count() const; + // Gets the number of skipped tests. + int skipped_test_count() const; + // Gets the number of failed tests. int failed_test_count() const; Modified: stable/12/contrib/googletest/googletest/src/gtest-test-part.cc ============================================================================== --- head/contrib/googletest/googletest/src/gtest-test-part.cc Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/contrib/googletest/googletest/src/gtest-test-part.cc Thu May 23 00:55:28 2019 (r348136) @@ -47,12 +47,16 @@ std::string TestPartResult::ExtractSummary(const char* // Prints a TestPartResult object. std::ostream& operator<<(std::ostream& os, const TestPartResult& result) { - return os - << result.file_name() << ":" << result.line_number() << ": " - << (result.type() == TestPartResult::kSuccess ? "Success" : - result.type() == TestPartResult::kFatalFailure ? "Fatal failure" : - "Non-fatal failure") << ":\n" - << result.message() << std::endl; + return os << result.file_name() << ":" << result.line_number() << ": " + << (result.type() == TestPartResult::kSuccess + ? "Success" + : result.type() == TestPartResult::kSkip + ? "Skipped" + : result.type() == TestPartResult::kFatalFailure + ? "Fatal failure" + : "Non-fatal failure") + << ":\n" + << result.message() << std::endl; } // Appends a TestPartResult to the array. Modified: stable/12/contrib/googletest/googletest/src/gtest.cc ============================================================================== --- head/contrib/googletest/googletest/src/gtest.cc Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/contrib/googletest/googletest/src/gtest.cc Thu May 23 00:55:28 2019 (r348136) @@ -796,6 +796,11 @@ int UnitTestImpl::successful_test_count() const { return SumOverTestCaseList(test_cases_, &TestCase::successful_test_count); } +// Gets the number of skipped tests. +int UnitTestImpl::skipped_test_count() const { + return SumOverTestCaseList(test_cases_, &TestCase::skipped_test_count); +} + // Gets the number of failed tests. int UnitTestImpl::failed_test_count() const { return SumOverTestCaseList(test_cases_, &TestCase::failed_test_count); @@ -2207,6 +2212,16 @@ void TestResult::Clear() { elapsed_time_ = 0; } +// Returns true off the test part was skipped. +static bool TestPartSkipped(const TestPartResult& result) { + return result.skipped(); +} + +// Returns true iff the test was skipped. +bool TestResult::Skipped() const { + return !Failed() && CountIf(test_part_results_, TestPartSkipped) > 0; +} + // Returns true iff the test failed. bool TestResult::Failed() const { for (int i = 0; i < total_part_count(); ++i) { @@ -2511,8 +2526,9 @@ void Test::Run() { internal::UnitTestImpl* const impl = internal::GetUnitTestImpl(); impl->os_stack_trace_getter()->UponLeavingGTest(); internal::HandleExceptionsInMethodIfSupported(this, &Test::SetUp, "SetUp()"); - // We will run the test only if SetUp() was successful. - if (!HasFatalFailure()) { + // We will run the test only if SetUp() was successful and didn't call + // GTEST_SKIP(). + if (!HasFatalFailure() && !IsSkipped()) { impl->os_stack_trace_getter()->UponLeavingGTest(); internal::HandleExceptionsInMethodIfSupported( this, &Test::TestBody, "the test body"); @@ -2537,6 +2553,11 @@ bool Test::HasNonfatalFailure() { HasNonfatalFailure(); } +// Returns true iff the current test was skipped. +bool Test::IsSkipped() { + return internal::GetUnitTestImpl()->current_test_result()->Skipped(); +} + // class TestInfo // Constructs a TestInfo object. It assumes ownership of the test factory @@ -2685,9 +2706,10 @@ void TestInfo::Run() { factory_, &internal::TestFactoryBase::CreateTest, "the test fixture's constructor"); - // Runs the test if the constructor didn't generate a fatal failure. + // Runs the test if the constructor didn't generate a fatal failure or invoke + // GTEST_SKIP(). // Note that the object will not be null - if (!Test::HasFatalFailure()) { + if (!Test::HasFatalFailure() && !Test::IsSkipped()) { // This doesn't throw as all user code that can throw are wrapped into // exception handling code. test->Run(); @@ -2715,6 +2737,11 @@ int TestCase::successful_test_count() const { return CountIf(test_info_list_, TestPassed); } +// Gets the number of successful tests in this test case. +int TestCase::skipped_test_count() const { + return CountIf(test_info_list_, TestSkipped); +} + // Gets the number of failed tests in this test case. int TestCase::failed_test_count() const { return CountIf(test_info_list_, TestFailed); @@ -2866,6 +2893,8 @@ static std::string FormatTestCaseCount(int test_case_c // between the two when viewing the test result. static const char * TestPartResultTypeToString(TestPartResult::Type type) { switch (type) { + case TestPartResult::kSkip: + return "Skipped"; case TestPartResult::kSuccess: return "Success"; @@ -3119,6 +3148,7 @@ class PrettyUnitTestResultPrinter : public TestEventLi private: static void PrintFailedTests(const UnitTest& unit_test); + static void PrintSkippedTests(const UnitTest& unit_test); }; // Fired before each iteration of tests starts. @@ -3187,18 +3217,25 @@ void PrettyUnitTestResultPrinter::OnTestStart(const Te // Called after an assertion failure. void PrettyUnitTestResultPrinter::OnTestPartResult( const TestPartResult& result) { - // If the test part succeeded, we don't need to do anything. - if (result.type() == TestPartResult::kSuccess) - return; - - // Print failure message from the assertion (e.g. expected this and got that). - PrintTestPartResult(result); - fflush(stdout); + switch (result.type()) { + // If the test part succeeded, or was skipped, + // we don't need to do anything. + case TestPartResult::kSkip: + case TestPartResult::kSuccess: + return; + default: + // Print failure message from the assertion + // (e.g. expected this and got that). + PrintTestPartResult(result); + fflush(stdout); + } } void PrettyUnitTestResultPrinter::OnTestEnd(const TestInfo& test_info) { if (test_info.result()->Passed()) { ColoredPrintf(COLOR_GREEN, "[ OK ] "); + } else if (test_info.result()->Skipped()) { + ColoredPrintf(COLOR_GREEN, "[ SKIPPED ] "); } else { ColoredPrintf(COLOR_RED, "[ FAILED ] "); } @@ -3248,7 +3285,7 @@ void PrettyUnitTestResultPrinter::PrintFailedTests(con } for (int j = 0; j < test_case.total_test_count(); ++j) { const TestInfo& test_info = *test_case.GetTestInfo(j); - if (!test_info.should_run() || test_info.result()->Passed()) { + if (!test_info.should_run() || !test_info.result()->Failed()) { continue; } ColoredPrintf(COLOR_RED, "[ FAILED ] "); @@ -3259,6 +3296,30 @@ void PrettyUnitTestResultPrinter::PrintFailedTests(con } } +// Internal helper for printing the list of skipped tests. +void PrettyUnitTestResultPrinter::PrintSkippedTests(const UnitTest& unit_test) { + const int skipped_test_count = unit_test.skipped_test_count(); + if (skipped_test_count == 0) { + return; + } + + for (int i = 0; i < unit_test.total_test_case_count(); ++i) { + const TestCase& test_case = *unit_test.GetTestCase(i); + if (!test_case.should_run() || (test_case.skipped_test_count() == 0)) { + continue; + } + for (int j = 0; j < test_case.total_test_count(); ++j) { + const TestInfo& test_info = *test_case.GetTestInfo(j); + if (!test_info.should_run() || !test_info.result()->Skipped()) { + continue; + } + ColoredPrintf(COLOR_GREEN, "[ SKIPPED ] "); + printf("%s.%s", test_case.name(), test_info.name()); + printf("\n"); + } + } +} + void PrettyUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test, int /*iteration*/) { ColoredPrintf(COLOR_GREEN, "[==========] "); @@ -3273,6 +3334,13 @@ void PrettyUnitTestResultPrinter::OnTestIterationEnd(c ColoredPrintf(COLOR_GREEN, "[ PASSED ] "); printf("%s.\n", FormatTestCount(unit_test.successful_test_count()).c_str()); + const int skipped_test_count = unit_test.skipped_test_count(); + if (skipped_test_count > 0) { + ColoredPrintf(COLOR_GREEN, "[ SKIPPED ] "); + printf("%s, listed below:\n", FormatTestCount(skipped_test_count).c_str()); + PrintSkippedTests(unit_test); + } + int num_failures = unit_test.failed_test_count(); if (!unit_test.Passed()) { const int failed_test_count = unit_test.failed_test_count(); @@ -4540,6 +4608,11 @@ int UnitTest::successful_test_count() const { return impl()->successful_test_count(); } +// Gets the number of skipped tests. +int UnitTest::skipped_test_count() const { + return impl()->skipped_test_count(); +} + // Gets the number of failed tests. int UnitTest::failed_test_count() const { return impl()->failed_test_count(); } @@ -4660,7 +4733,8 @@ void UnitTest::AddTestPartResult( impl_->GetTestPartResultReporterForCurrentThread()-> ReportTestPartResult(result); - if (result_type != TestPartResult::kSuccess) { + if (result_type != TestPartResult::kSuccess && + result_type != TestPartResult::kSkip) { // gtest_break_on_failure takes precedence over // gtest_throw_on_failure. This allows a user to set the latter // in the code (perhaps in order to use Google Test assertions @@ -5169,9 +5243,23 @@ bool UnitTestImpl::RunAllTests() { ForEach(environments_, SetUpEnvironment); repeater->OnEnvironmentsSetUpEnd(*parent_); - // Runs the tests only if there was no fatal failure during global - // set-up. - if (!Test::HasFatalFailure()) { + // Runs the tests only if there was no fatal failure or skip triggered + // during global set-up. + if (Test::IsSkipped()) { + // Emit diagnostics when global set-up calls skip, as it will not be + // emitted by default. + TestResult& test_result = + *internal::GetUnitTestImpl()->current_test_result(); + for (int j = 0; j < test_result.total_part_count(); ++j) { + const TestPartResult& test_part_result = + test_result.GetTestPartResult(j); + if (test_part_result.type() == TestPartResult::kSkip) { + const std::string& result = test_part_result.message(); + printf("%s\n", result.c_str()); + } + } + fflush(stdout); + } else if (!Test::HasFatalFailure()) { for (int test_index = 0; test_index < total_test_case_count(); test_index++) { GetMutableTestCase(test_index)->Run(); Modified: stable/12/contrib/googletest/googletest/test/BUILD.bazel ============================================================================== --- head/contrib/googletest/googletest/test/BUILD.bazel Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/contrib/googletest/googletest/test/BUILD.bazel Thu May 23 00:55:28 2019 (r348136) @@ -311,6 +311,13 @@ cc_binary( deps = ["//:gtest"], ) +cc_test( + name = "gtest_skip_in_environment_setup_test", + size = "small", + srcs = ["gtest_skip_in_environment_setup_test.cc"], + deps = ["//:gtest_main"], +) + py_test( name = "googletest-list-tests-unittest", size = "small", Modified: stable/12/contrib/googletest/googletest/test/googletest-test-part-test.cc ============================================================================== --- head/contrib/googletest/googletest/test/googletest-test-part-test.cc Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/contrib/googletest/googletest/test/googletest-test-part-test.cc Thu May 23 00:55:28 2019 (r348136) @@ -46,9 +46,10 @@ class TestPartResultTest : public Test { TestPartResultTest() : r1_(TestPartResult::kSuccess, "foo/bar.cc", 10, "Success!"), r2_(TestPartResult::kNonFatalFailure, "foo/bar.cc", -1, "Failure!"), - r3_(TestPartResult::kFatalFailure, NULL, -1, "Failure!") {} + r3_(TestPartResult::kFatalFailure, nullptr, -1, "Failure!"), + r4_(TestPartResult::kSkip, "foo/bar.cc", 2, "Skipped!") {} - TestPartResult r1_, r2_, r3_; + TestPartResult r1_, r2_, r3_, r4_; }; @@ -79,6 +80,7 @@ TEST_F(TestPartResultTest, ResultAccessorsWork) { EXPECT_FALSE(success.failed()); EXPECT_FALSE(success.nonfatally_failed()); EXPECT_FALSE(success.fatally_failed()); + EXPECT_FALSE(success.skipped()); const TestPartResult nonfatal_failure(TestPartResult::kNonFatalFailure, "file.cc", @@ -88,6 +90,7 @@ TEST_F(TestPartResultTest, ResultAccessorsWork) { EXPECT_TRUE(nonfatal_failure.failed()); EXPECT_TRUE(nonfatal_failure.nonfatally_failed()); EXPECT_FALSE(nonfatal_failure.fatally_failed()); + EXPECT_FALSE(nonfatal_failure.skipped()); const TestPartResult fatal_failure(TestPartResult::kFatalFailure, "file.cc", @@ -97,6 +100,14 @@ TEST_F(TestPartResultTest, ResultAccessorsWork) { EXPECT_TRUE(fatal_failure.failed()); EXPECT_FALSE(fatal_failure.nonfatally_failed()); EXPECT_TRUE(fatal_failure.fatally_failed()); + EXPECT_FALSE(fatal_failure.skipped()); + + const TestPartResult skip(TestPartResult::kSkip, "file.cc", 42, "message"); + EXPECT_FALSE(skip.passed()); + EXPECT_FALSE(skip.failed()); + EXPECT_FALSE(skip.nonfatally_failed()); + EXPECT_FALSE(skip.fatally_failed()); + EXPECT_TRUE(skip.skipped()); } // Tests TestPartResult::type(). @@ -104,23 +115,27 @@ TEST_F(TestPartResultTest, type) { EXPECT_EQ(TestPartResult::kSuccess, r1_.type()); EXPECT_EQ(TestPartResult::kNonFatalFailure, r2_.type()); EXPECT_EQ(TestPartResult::kFatalFailure, r3_.type()); + EXPECT_EQ(TestPartResult::kSkip, r4_.type()); } // Tests TestPartResult::file_name(). TEST_F(TestPartResultTest, file_name) { EXPECT_STREQ("foo/bar.cc", r1_.file_name()); EXPECT_STREQ(NULL, r3_.file_name()); + EXPECT_STREQ("foo/bar.cc", r4_.file_name()); } // Tests TestPartResult::line_number(). TEST_F(TestPartResultTest, line_number) { EXPECT_EQ(10, r1_.line_number()); EXPECT_EQ(-1, r2_.line_number()); + EXPECT_EQ(2, r4_.line_number()); } // Tests TestPartResult::message(). TEST_F(TestPartResultTest, message) { EXPECT_STREQ("Success!", r1_.message()); + EXPECT_STREQ("Skipped!", r4_.message()); } // Tests TestPartResult::passed(). @@ -128,6 +143,7 @@ TEST_F(TestPartResultTest, Passed) { EXPECT_TRUE(r1_.passed()); EXPECT_FALSE(r2_.passed()); EXPECT_FALSE(r3_.passed()); + EXPECT_FALSE(r4_.passed()); } // Tests TestPartResult::failed(). @@ -135,13 +151,23 @@ TEST_F(TestPartResultTest, Failed) { EXPECT_FALSE(r1_.failed()); EXPECT_TRUE(r2_.failed()); EXPECT_TRUE(r3_.failed()); + EXPECT_FALSE(r4_.failed()); } +// Tests TestPartResult::failed(). +TEST_F(TestPartResultTest, Skipped) { + EXPECT_FALSE(r1_.skipped()); + EXPECT_FALSE(r2_.skipped()); + EXPECT_FALSE(r3_.skipped()); + EXPECT_TRUE(r4_.skipped()); +} + // Tests TestPartResult::fatally_failed(). TEST_F(TestPartResultTest, FatallyFailed) { EXPECT_FALSE(r1_.fatally_failed()); EXPECT_FALSE(r2_.fatally_failed()); EXPECT_TRUE(r3_.fatally_failed()); + EXPECT_FALSE(r4_.fatally_failed()); } // Tests TestPartResult::nonfatally_failed(). @@ -149,6 +175,7 @@ TEST_F(TestPartResultTest, NonfatallyFailed) { EXPECT_FALSE(r1_.nonfatally_failed()); EXPECT_TRUE(r2_.nonfatally_failed()); EXPECT_FALSE(r3_.nonfatally_failed()); + EXPECT_FALSE(r4_.nonfatally_failed()); } // Tests the TestPartResultArray class. Modified: stable/12/contrib/googletest/googletest/test/gtest_all_test.cc ============================================================================== --- head/contrib/googletest/googletest/test/gtest_all_test.cc Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/contrib/googletest/googletest/test/gtest_all_test.cc Thu May 23 00:55:28 2019 (r348136) @@ -37,10 +37,11 @@ #include "test/googletest-message-test.cc" #include "test/googletest-options-test.cc" #include "test/googletest-port-test.cc" -#include "test/gtest_pred_impl_unittest.cc" -#include "test/gtest_prod_test.cc" #include "test/googletest-test-part-test.cc" -#include "test/gtest-typed-test_test.cc" #include "test/gtest-typed-test2_test.cc" +#include "test/gtest-typed-test_test.cc" +#include "test/gtest_pred_impl_unittest.cc" +#include "test/gtest_prod_test.cc" +#include "test/gtest_skip_test.cc" #include "test/gtest_unittest.cc" #include "test/production.cc" Copied: stable/12/contrib/googletest/googletest/test/gtest_skip_in_environment_setup_test.cc (from r345770, head/contrib/googletest/googletest/test/gtest_skip_in_environment_setup_test.cc) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/contrib/googletest/googletest/test/gtest_skip_in_environment_setup_test.cc Thu May 23 00:55:28 2019 (r348136, copy of r345770, head/contrib/googletest/googletest/test/gtest_skip_in_environment_setup_test.cc) @@ -0,0 +1,60 @@ +// Copyright 2019, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * 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. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// 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. +// +// This test verifies that skipping in the environment results in the +// testcases being skipped. +// +// This is a reproduction case for +// https://github.com/google/googletest/issues/2189 . + +#include +#include + +class SetupEnvironment : public testing::Environment { +public: + void SetUp() override { + GTEST_SKIP() << "Skipping the entire environment"; + } +}; + +TEST(Test, AlwaysPasses) { + EXPECT_EQ(true, true); +} + +TEST(Test, AlwaysFails) { + EXPECT_EQ(true, false); +} + +int main(int argc, char **argv) { + testing::InitGoogleTest(&argc, argv); + + testing::AddGlobalTestEnvironment(new SetupEnvironment()); + + return (RUN_ALL_TESTS()); +} Copied: stable/12/contrib/googletest/googletest/test/gtest_skip_test.cc (from r345353, head/contrib/googletest/googletest/test/gtest_skip_test.cc) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/contrib/googletest/googletest/test/gtest_skip_test.cc Thu May 23 00:55:28 2019 (r348136, copy of r345353, head/contrib/googletest/googletest/test/gtest_skip_test.cc) @@ -0,0 +1,55 @@ +// Copyright 2008 Google Inc. +// All Rights Reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * 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. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// 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. +// +// Author: arseny.aprelev@gmail.com (Arseny Aprelev) +// + +#include "gtest/gtest.h" + +using ::testing::Test; + +TEST(SkipTest, DoesSkip) { + GTEST_SKIP(); + EXPECT_EQ(0, 1); +} + +class Fixture : public Test { + protected: + void SetUp() override { + GTEST_SKIP() << "skipping all tests for this fixture"; + } +}; + +TEST_F(Fixture, SkipsOneTest) { + EXPECT_EQ(5, 7); +} + +TEST_F(Fixture, SkipsAnotherTest) { + EXPECT_EQ(99, 100); +} Modified: stable/12/contrib/mandoc/lib.in ============================================================================== --- stable/12/contrib/mandoc/lib.in Thu May 23 00:44:01 2019 (r348135) +++ stable/12/contrib/mandoc/lib.in Thu May 23 00:55:28 2019 (r348136) @@ -62,7 +62,9 @@ LINE("libfsid", "Filesystem Identification Library (l LINE("libftpio", "FTP Connection Management Library (libftpio, \\-lftpio)") LINE("libform", "Curses Form Library (libform, \\-lform)") LINE("libgeom", "Userland API Library for Kernel GEOM subsystem (libgeom, \\-lgeom)") +LINE("libgmock", "GoogleMock library (libgmock, \\-lgmock)") LINE("libgpio", "General-Purpose Input Output (GPIO) library (libgpio, \\-lgpio)") +LINE("libgtest", "GoogleTest library (libgtest, \\-lgtest)") LINE("libhammer", "HAMMER Filesystem Userland Library (libhammer, \\-lhammer)") LINE("libi386", "i386 Architecture Library (libi386, \\-li386)") LINE("libintl", "Internationalized Message Handling Library (libintl, \\-lintl)") Modified: stable/12/etc/mtree/BSD.tests.dist ============================================================================== --- stable/12/etc/mtree/BSD.tests.dist Thu May 23 00:44:01 2019 (r348135) +++ stable/12/etc/mtree/BSD.tests.dist Thu May 23 00:55:28 2019 (r348136) @@ -270,6 +270,16 @@ test-programs .. .. + googletest + gmock + .. + gmock_main + .. + gtest + .. + gtest_main + .. + .. libarchive .. libbe @@ -423,6 +433,8 @@ examples tests atf + .. + googletest .. plain .. Modified: stable/12/etc/mtree/BSD.usr.dist ============================================================================== --- stable/12/etc/mtree/BSD.usr.dist Thu May 23 00:44:01 2019 (r348135) +++ stable/12/etc/mtree/BSD.usr.dist Thu May 23 00:55:28 2019 (r348136) @@ -13,6 +13,18 @@ .. event .. + gmock + internal + custom + .. + .. + .. + gtest + internal + custom + .. + .. + .. sqlite3 .. ucl Modified: stable/12/lib/Makefile ============================================================================== --- stable/12/lib/Makefile Thu May 23 00:44:01 2019 (r348135) +++ stable/12/lib/Makefile Thu May 23 00:55:28 2019 (r348136) @@ -170,6 +170,7 @@ _libcplusplus+= libc++fs .endif SUBDIR.${MK_EFI}+= libefivar +SUBDIR.${MK_GOOGLETEST}+= googletest SUBDIR.${MK_LIBTHR}+= libthr SUBDIR.${MK_LLVM_LIBUNWIND}+= libgcc_eh SUBDIR.${MK_LLVM_LIBUNWIND}+= libgcc_s Modified: stable/12/lib/clang/llvm.build.mk ============================================================================== --- stable/12/lib/clang/llvm.build.mk Thu May 23 00:44:01 2019 (r348135) +++ stable/12/lib/clang/llvm.build.mk Thu May 23 00:55:28 2019 (r348136) @@ -101,7 +101,7 @@ CFLAGS+= -ffunction-sections CFLAGS+= -fdata-sections LDFLAGS+= -Wl,--gc-sections -CXXFLAGS+= -std=c++11 +CXXSTD?= c++11 CXXFLAGS+= -fno-exceptions CXXFLAGS+= -fno-rtti CXXFLAGS.clang+= -stdlib=libc++ Modified: stable/12/lib/googletest/gtest_main/tests/Makefile ============================================================================== --- head/lib/googletest/gtest_main/tests/Makefile Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/lib/googletest/gtest_main/tests/Makefile Thu May 23 00:55:28 2019 (r348136) @@ -18,6 +18,8 @@ GTESTS+= gtest_prod_test GTESTS+= gtest_sole_header_test GTESTS+= googletest-test-part-test GTESTS+= gtest-typed-test_test +GTESTS+= gtest_skip_test +GTESTS+= gtest_skip_in_environment_setup_test GTESTS+= gtest_unittest CXXFLAGS+= -I${GOOGLETEST_SRCROOT}/include Modified: stable/12/lib/libc++/Makefile ============================================================================== --- stable/12/lib/libc++/Makefile Thu May 23 00:44:01 2019 (r348135) +++ stable/12/lib/libc++/Makefile Thu May 23 00:55:28 2019 (r348136) @@ -76,9 +76,7 @@ CFLAGS+= -nostdinc++ CFLAGS+= -nostdlib CFLAGS+= -D_LIBCPP_BUILDING_LIBRARY CFLAGS+= -DLIBCXXRT -.if empty(CXXFLAGS:M-std=*) -CXXFLAGS+= -std=c++11 -.endif +CXXSTD?= c++11 LIBADD+= cxxrt INCSGROUPS= STD EXP EXT Modified: stable/12/lib/libc++experimental/Makefile ============================================================================== --- stable/12/lib/libc++experimental/Makefile Thu May 23 00:44:01 2019 (r348135) +++ stable/12/lib/libc++experimental/Makefile Thu May 23 00:55:28 2019 (r348136) @@ -20,8 +20,6 @@ CXXFLAGS+= -nostdinc++ CXXFLAGS+= -nostdlib CXXFLAGS+= -D_LIBCPP_BUILDING_LIBRARY CXXFLAGS+= -DLIBCXXRT -.if empty(CXXFLAGS:M-std=*) -CXXFLAGS+= -std=c++14 -.endif +CXXSTD?= c++14 .include Modified: stable/12/lib/libc++fs/Makefile ============================================================================== --- stable/12/lib/libc++fs/Makefile Thu May 23 00:44:01 2019 (r348135) +++ stable/12/lib/libc++fs/Makefile Thu May 23 00:55:28 2019 (r348136) @@ -22,8 +22,6 @@ CXXFLAGS+= -nostdinc++ CXXFLAGS+= -nostdlib CXXFLAGS+= -D_LIBCPP_BUILDING_LIBRARY CXXFLAGS+= -DLIBCXXRT -.if empty(CXXFLAGS:M-std=*) -CXXFLAGS+= -std=c++14 -.endif +CXXSTD?= c++14 .include Modified: stable/12/lib/libc/tests/stdlib/Makefile ============================================================================== --- stable/12/lib/libc/tests/stdlib/Makefile Thu May 23 00:44:01 2019 (r348135) +++ stable/12/lib/libc/tests/stdlib/Makefile Thu May 23 00:55:28 2019 (r348136) @@ -49,8 +49,8 @@ PROGS+= h_getopt h_getopt_long CFLAGS+= -I${.CURDIR} -CXXFLAGS.cxa_thread_atexit_test+= -std=c++11 -CXXFLAGS.cxa_thread_atexit_nothr_test+= -std=c++11 +CXXSTD.cxa_thread_atexit_test= c++11 +CXXSTD.cxa_thread_atexit_nothr_test= c++11 LIBADD.cxa_thread_atexit_test+= pthread .for t in h_getopt h_getopt_long Modified: stable/12/lib/libclang_rt/Makefile.inc ============================================================================== --- stable/12/lib/libclang_rt/Makefile.inc Thu May 23 00:44:01 2019 (r348135) +++ stable/12/lib/libclang_rt/Makefile.inc Thu May 23 00:55:28 2019 (r348136) @@ -41,4 +41,4 @@ CFLAGS+= -funwind-tables CXXFLAGS+= -fvisibility-inlines-hidden CXXFLAGS+= -fvisibility=hidden CFLAGS+= -I${CRTSRC}/lib -CXXFLAGS+= -std=c++11 +CXXSTD= c++11 Modified: stable/12/lib/libcxxrt/Makefile ============================================================================== --- stable/12/lib/libcxxrt/Makefile Thu May 23 00:44:01 2019 (r348135) +++ stable/12/lib/libcxxrt/Makefile Thu May 23 00:55:28 2019 (r348136) @@ -22,9 +22,7 @@ SRCS+= libelftc_dem_gnu3.c\ WARNS= 0 CFLAGS+= -isystem ${SRCDIR} -nostdinc++ -.if empty(CXXFLAGS:M-std=*) -CXXFLAGS+= -std=c++11 -.endif +CXXSTD?= c++11 VERSION_MAP= ${.CURDIR}/Version.map .include Modified: stable/12/lib/libgcc_eh/Makefile.inc ============================================================================== --- stable/12/lib/libgcc_eh/Makefile.inc Thu May 23 00:44:01 2019 (r348135) +++ stable/12/lib/libgcc_eh/Makefile.inc Thu May 23 00:55:28 2019 (r348136) @@ -27,10 +27,8 @@ CXXFLAGS.${file}+= -fno-exceptions -funwind-tables .endfor CFLAGS+= -I${UNWINDINCDIR} -I${.CURDIR} -D_LIBUNWIND_IS_NATIVE_ONLY -.if empty(CXXFLAGS:M-std=*) -CXXFLAGS+= -std=c++11 -.endif CXXFLAGS+= -fno-rtti +CXXSTD?= c++11 STATIC_CXXFLAGS+= -fvisibility=hidden -fPIC # Probably need to just move this earlier or use CXXFLAGS .if ${MK_DIRDEPS_BUILD} == "yes" Modified: stable/12/lib/libomp/Makefile ============================================================================== --- stable/12/lib/libomp/Makefile Thu May 23 00:44:01 2019 (r348135) +++ stable/12/lib/libomp/Makefile Thu May 23 00:55:28 2019 (r348136) @@ -53,9 +53,9 @@ CFLAGS+= -I${ITTSRC} CFLAGS+= -ffunction-sections CFLAGS+= -fdata-sections CXXFLAGS+= -fvisibility-inlines-hidden -CXXFLAGS+= -std=c++11 CXXFLAGS+= -fno-exceptions CXXFLAGS+= -fno-rtti +CXXSTD= c++11 LDFLAGS+= -Wl,--warn-shared-textrel LDFLAGS+= -Wl,--gc-sections Modified: stable/12/lib/ofed/libibnetdisc/Makefile ============================================================================== --- stable/12/lib/ofed/libibnetdisc/Makefile Thu May 23 00:44:01 2019 (r348135) +++ stable/12/lib/ofed/libibnetdisc/Makefile Thu May 23 00:55:28 2019 (r348136) @@ -32,7 +32,7 @@ CFLAGS+= -DHAVE_CONFIG_H=1 CFLAGS+= -I${_spath} CFLAGS+= -I${SYSROOT:U${DESTDIR}}/${INCLUDEDIR}/infiniband .if ${COMPILER_FEATURES:Mc++11} -CXXFLAGS+= -std=c++11 +CXXSTD= c++11 .endif VERSION_MAP= ${_spath}/libibnetdisc.map Modified: stable/12/share/examples/tests/tests/Makefile ============================================================================== --- stable/12/share/examples/tests/tests/Makefile Thu May 23 00:44:01 2019 (r348135) +++ stable/12/share/examples/tests/tests/Makefile Thu May 23 00:55:28 2019 (r348136) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + # Directory into which the Kyuafile provided by this directory will be # installed. # @@ -20,6 +22,10 @@ TESTS_SUBDIRS+= atf TESTS_SUBDIRS+= plain TESTS_SUBDIRS+= tap + +.if ${MK_GOOGLETEST} != no +TESTS_SUBDIRS+= googletest +.endif # We leave KYUAFILE unset so that bsd.test.mk auto-generates a Kyuafile # for us based on the contents of the TESTS_SUBDIRS line above. The Modified: stable/12/share/mk/Makefile ============================================================================== --- stable/12/share/mk/Makefile Thu May 23 00:44:01 2019 (r348135) +++ stable/12/share/mk/Makefile Thu May 23 00:55:28 2019 (r348136) @@ -73,6 +73,8 @@ FILESDIR= ${BINDIR}/mk *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Thu May 23 00:59:12 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0696315932ED; Thu, 23 May 2019 00:59:12 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A5A1C732C6; Thu, 23 May 2019 00:59:11 +0000 (UTC) (envelope-from ngie@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6F21725725; Thu, 23 May 2019 00:59:11 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4N0xBtT009753; Thu, 23 May 2019 00:59:11 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4N0x5Vx009724; Thu, 23 May 2019 00:59:05 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201905230059.x4N0x5Vx009724@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Enji Cooper Date: Thu, 23 May 2019 00:59:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348137 - in stable/12: cddl/usr.sbin/zfsd cddl/usr.sbin/zfsd/tests contrib/googletest contrib/mandoc etc/mtree lib lib/clang lib/googletest lib/libc++ lib/libc++experimental lib/libc++... X-SVN-Group: stable-12 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: in stable/12: cddl/usr.sbin/zfsd cddl/usr.sbin/zfsd/tests contrib/googletest contrib/mandoc etc/mtree lib lib/clang lib/googletest lib/libc++ lib/libc++experimental lib/libc++fs lib/libc/tests/stdlib ... X-SVN-Commit-Revision: 348137 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A5A1C732C6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.952,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 00:59:12 -0000 Author: ngie Date: Thu May 23 00:59:05 2019 New Revision: 348137 URL: https://svnweb.freebsd.org/changeset/base/348137 Log: Revert r348136 I accidentally committed some unrelated local changes to `.../tests/sys/opencrypto` along with this MFC set. Deleted: stable/12/contrib/googletest/ stable/12/lib/googletest/ stable/12/share/examples/tests/tests/googletest/ stable/12/share/mk/googletest.test.inc.mk stable/12/share/mk/googletest.test.mk stable/12/tools/build/options/WITHOUT_GOOGLETEST Modified: stable/12/cddl/usr.sbin/zfsd/Makefile stable/12/cddl/usr.sbin/zfsd/Makefile.common stable/12/cddl/usr.sbin/zfsd/tests/Makefile stable/12/contrib/mandoc/lib.in stable/12/etc/mtree/BSD.tests.dist stable/12/etc/mtree/BSD.usr.dist stable/12/lib/Makefile stable/12/lib/clang/llvm.build.mk stable/12/lib/libc++/Makefile stable/12/lib/libc++experimental/Makefile stable/12/lib/libc++fs/Makefile stable/12/lib/libc/tests/stdlib/Makefile stable/12/lib/libclang_rt/Makefile.inc stable/12/lib/libcxxrt/Makefile stable/12/lib/libgcc_eh/Makefile.inc stable/12/lib/libomp/Makefile stable/12/lib/ofed/libibnetdisc/Makefile stable/12/share/examples/tests/tests/Makefile stable/12/share/mk/Makefile stable/12/share/mk/bsd.README stable/12/share/mk/bsd.progs.mk stable/12/share/mk/bsd.sys.mk stable/12/share/mk/bsd.test.mk stable/12/share/mk/src.libnames.mk stable/12/share/mk/src.opts.mk stable/12/tests/sys/opencrypto/cryptodev.py stable/12/tests/sys/opencrypto/cryptodevh.py stable/12/tests/sys/opencrypto/cryptotest.py stable/12/tests/sys/opencrypto/runtests.sh stable/12/tools/build/mk/OptionalObsoleteFiles.inc stable/12/usr.bin/dtc/Makefile stable/12/usr.sbin/pmc/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/usr.sbin/zfsd/Makefile ============================================================================== --- stable/12/cddl/usr.sbin/zfsd/Makefile Thu May 23 00:55:28 2019 (r348136) +++ stable/12/cddl/usr.sbin/zfsd/Makefile Thu May 23 00:59:05 2019 (r348137) @@ -1,13 +1,12 @@ # $FreeBSD$ -.include - .include "Makefile.common" PROG_CXX= zfsd MAN= zfsd.8 -HAS_TESTS= -SUBDIR.${MK_GOOGLETEST}+= tests - .include + +# The unittests require devel/googletest and devel/googlemock from ports. +# Don't automatically build them. +SUBDIR= Modified: stable/12/cddl/usr.sbin/zfsd/Makefile.common ============================================================================== --- stable/12/cddl/usr.sbin/zfsd/Makefile.common Thu May 23 00:55:28 2019 (r348136) +++ stable/12/cddl/usr.sbin/zfsd/Makefile.common Thu May 23 00:59:05 2019 (r348137) @@ -28,11 +28,12 @@ INCFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/li INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs -INCFLAGS+= -I${SRCTOP}/cddl/usr.sbin CFLAGS= -g -DNEED_SOLARIS_BOOLEAN ${INCFLAGS} -LIBADD+= devdctl zfs zfs_core util geom bsdxml sbuf nvpair uutil +DPADD= ${LIBDEVDCTL} ${LIBZFS} ${LIBZFS_CORE} ${LIBUTIL} ${LIBGEOM} \ + ${LIBBSDXML} ${LIBSBUF} ${LIBNVPAIR} ${LIBUUTIL} +LIBADD= devdctl zfs zfs_core util geom bsdxml sbuf nvpair uutil cscope: find ${.CURDIR} -type f -a \( -name "*.[ch]" -o -name "*.cc" \) \ Modified: stable/12/cddl/usr.sbin/zfsd/tests/Makefile ============================================================================== --- stable/12/cddl/usr.sbin/zfsd/tests/Makefile Thu May 23 00:55:28 2019 (r348136) +++ stable/12/cddl/usr.sbin/zfsd/tests/Makefile Thu May 23 00:59:05 2019 (r348137) @@ -3,12 +3,30 @@ .include "${.CURDIR}/../Makefile.common" .PATH: ${.CURDIR:H} -GTESTS= zfsd_unittest +PLAIN_TESTS_CXX= zfsd_unittest +SRCS.zfsd_unittest:= ${SRCS:Nzfsd_main.cc} +SRCS.zfsd_unittest+= libmocks.c zfsd_unittest.cc +SRCS= -SRCS.zfsd_unittest:= ${SRCS:Nzfsd_main.cc} -SRCS.zfsd_unittest+= libmocks.c zfsd_unittest.cc -.undef SRCS +# Use #include in test programs. +INCFLAGS+= -I${.CURDIR:H:H} -LIBADD.zfsd_unittest+= gmock_main +.if defined(DESTDIR) || defined(SYSROOT) +INCFLAGS+= -I${SYSROOT:U${DESTDIR}}/usr/include +LDFLAGS.zfsd_unittest+= -L${SYSROOT:U${DESTDIR}}/lib \ + -L${SYSROOT:U${DESTDIR}}/usr/lib +.endif + +# Googletest options +INCFLAGS+= -I${LOCALBASE}/include -D_THREAD_SAFE -pthread +LDFLAGS.zfsd_unittest+= -L${LOCALBASE}/lib -D_THREAD_SAFE -pthread +LDADD.zfsd_unittest+= ${LOCALBASE}/lib/libgtest.a + +# GoogleMock options +LDADD.zfsd_unittest+= ${LOCALBASE}/lib/libgmock.a ${LOCALBASE}/lib/libgmock_main.a + +# Googlemock fails if we don't have this line +# https://groups.google.com/forum/#!msg/googletestframework/h8ixEPCFm0o/amwfu4xGJb0J +CFLAGS.zfsd_unittest+= -DGTEST_HAS_PTHREAD .include Modified: stable/12/contrib/mandoc/lib.in ============================================================================== --- stable/12/contrib/mandoc/lib.in Thu May 23 00:55:28 2019 (r348136) +++ stable/12/contrib/mandoc/lib.in Thu May 23 00:59:05 2019 (r348137) @@ -62,9 +62,7 @@ LINE("libfsid", "Filesystem Identification Library (l LINE("libftpio", "FTP Connection Management Library (libftpio, \\-lftpio)") LINE("libform", "Curses Form Library (libform, \\-lform)") LINE("libgeom", "Userland API Library for Kernel GEOM subsystem (libgeom, \\-lgeom)") -LINE("libgmock", "GoogleMock library (libgmock, \\-lgmock)") LINE("libgpio", "General-Purpose Input Output (GPIO) library (libgpio, \\-lgpio)") -LINE("libgtest", "GoogleTest library (libgtest, \\-lgtest)") LINE("libhammer", "HAMMER Filesystem Userland Library (libhammer, \\-lhammer)") LINE("libi386", "i386 Architecture Library (libi386, \\-li386)") LINE("libintl", "Internationalized Message Handling Library (libintl, \\-lintl)") Modified: stable/12/etc/mtree/BSD.tests.dist ============================================================================== --- stable/12/etc/mtree/BSD.tests.dist Thu May 23 00:55:28 2019 (r348136) +++ stable/12/etc/mtree/BSD.tests.dist Thu May 23 00:59:05 2019 (r348137) @@ -270,16 +270,6 @@ test-programs .. .. - googletest - gmock - .. - gmock_main - .. - gtest - .. - gtest_main - .. - .. libarchive .. libbe @@ -433,8 +423,6 @@ examples tests atf - .. - googletest .. plain .. Modified: stable/12/etc/mtree/BSD.usr.dist ============================================================================== --- stable/12/etc/mtree/BSD.usr.dist Thu May 23 00:55:28 2019 (r348136) +++ stable/12/etc/mtree/BSD.usr.dist Thu May 23 00:59:05 2019 (r348137) @@ -13,18 +13,6 @@ .. event .. - gmock - internal - custom - .. - .. - .. - gtest - internal - custom - .. - .. - .. sqlite3 .. ucl Modified: stable/12/lib/Makefile ============================================================================== --- stable/12/lib/Makefile Thu May 23 00:55:28 2019 (r348136) +++ stable/12/lib/Makefile Thu May 23 00:59:05 2019 (r348137) @@ -170,7 +170,6 @@ _libcplusplus+= libc++fs .endif SUBDIR.${MK_EFI}+= libefivar -SUBDIR.${MK_GOOGLETEST}+= googletest SUBDIR.${MK_LIBTHR}+= libthr SUBDIR.${MK_LLVM_LIBUNWIND}+= libgcc_eh SUBDIR.${MK_LLVM_LIBUNWIND}+= libgcc_s Modified: stable/12/lib/clang/llvm.build.mk ============================================================================== --- stable/12/lib/clang/llvm.build.mk Thu May 23 00:55:28 2019 (r348136) +++ stable/12/lib/clang/llvm.build.mk Thu May 23 00:59:05 2019 (r348137) @@ -101,7 +101,7 @@ CFLAGS+= -ffunction-sections CFLAGS+= -fdata-sections LDFLAGS+= -Wl,--gc-sections -CXXSTD?= c++11 +CXXFLAGS+= -std=c++11 CXXFLAGS+= -fno-exceptions CXXFLAGS+= -fno-rtti CXXFLAGS.clang+= -stdlib=libc++ Modified: stable/12/lib/libc++/Makefile ============================================================================== --- stable/12/lib/libc++/Makefile Thu May 23 00:55:28 2019 (r348136) +++ stable/12/lib/libc++/Makefile Thu May 23 00:59:05 2019 (r348137) @@ -76,7 +76,9 @@ CFLAGS+= -nostdinc++ CFLAGS+= -nostdlib CFLAGS+= -D_LIBCPP_BUILDING_LIBRARY CFLAGS+= -DLIBCXXRT -CXXSTD?= c++11 +.if empty(CXXFLAGS:M-std=*) +CXXFLAGS+= -std=c++11 +.endif LIBADD+= cxxrt INCSGROUPS= STD EXP EXT Modified: stable/12/lib/libc++experimental/Makefile ============================================================================== --- stable/12/lib/libc++experimental/Makefile Thu May 23 00:55:28 2019 (r348136) +++ stable/12/lib/libc++experimental/Makefile Thu May 23 00:59:05 2019 (r348137) @@ -20,6 +20,8 @@ CXXFLAGS+= -nostdinc++ CXXFLAGS+= -nostdlib CXXFLAGS+= -D_LIBCPP_BUILDING_LIBRARY CXXFLAGS+= -DLIBCXXRT -CXXSTD?= c++14 +.if empty(CXXFLAGS:M-std=*) +CXXFLAGS+= -std=c++14 +.endif .include Modified: stable/12/lib/libc++fs/Makefile ============================================================================== --- stable/12/lib/libc++fs/Makefile Thu May 23 00:55:28 2019 (r348136) +++ stable/12/lib/libc++fs/Makefile Thu May 23 00:59:05 2019 (r348137) @@ -22,6 +22,8 @@ CXXFLAGS+= -nostdinc++ CXXFLAGS+= -nostdlib CXXFLAGS+= -D_LIBCPP_BUILDING_LIBRARY CXXFLAGS+= -DLIBCXXRT -CXXSTD?= c++14 +.if empty(CXXFLAGS:M-std=*) +CXXFLAGS+= -std=c++14 +.endif .include Modified: stable/12/lib/libc/tests/stdlib/Makefile ============================================================================== --- stable/12/lib/libc/tests/stdlib/Makefile Thu May 23 00:55:28 2019 (r348136) +++ stable/12/lib/libc/tests/stdlib/Makefile Thu May 23 00:59:05 2019 (r348137) @@ -49,8 +49,8 @@ PROGS+= h_getopt h_getopt_long CFLAGS+= -I${.CURDIR} -CXXSTD.cxa_thread_atexit_test= c++11 -CXXSTD.cxa_thread_atexit_nothr_test= c++11 +CXXFLAGS.cxa_thread_atexit_test+= -std=c++11 +CXXFLAGS.cxa_thread_atexit_nothr_test+= -std=c++11 LIBADD.cxa_thread_atexit_test+= pthread .for t in h_getopt h_getopt_long Modified: stable/12/lib/libclang_rt/Makefile.inc ============================================================================== --- stable/12/lib/libclang_rt/Makefile.inc Thu May 23 00:55:28 2019 (r348136) +++ stable/12/lib/libclang_rt/Makefile.inc Thu May 23 00:59:05 2019 (r348137) @@ -41,4 +41,4 @@ CFLAGS+= -funwind-tables CXXFLAGS+= -fvisibility-inlines-hidden CXXFLAGS+= -fvisibility=hidden CFLAGS+= -I${CRTSRC}/lib -CXXSTD= c++11 +CXXFLAGS+= -std=c++11 Modified: stable/12/lib/libcxxrt/Makefile ============================================================================== --- stable/12/lib/libcxxrt/Makefile Thu May 23 00:55:28 2019 (r348136) +++ stable/12/lib/libcxxrt/Makefile Thu May 23 00:59:05 2019 (r348137) @@ -22,7 +22,9 @@ SRCS+= libelftc_dem_gnu3.c\ WARNS= 0 CFLAGS+= -isystem ${SRCDIR} -nostdinc++ -CXXSTD?= c++11 +.if empty(CXXFLAGS:M-std=*) +CXXFLAGS+= -std=c++11 +.endif VERSION_MAP= ${.CURDIR}/Version.map .include Modified: stable/12/lib/libgcc_eh/Makefile.inc ============================================================================== --- stable/12/lib/libgcc_eh/Makefile.inc Thu May 23 00:55:28 2019 (r348136) +++ stable/12/lib/libgcc_eh/Makefile.inc Thu May 23 00:59:05 2019 (r348137) @@ -27,8 +27,10 @@ CXXFLAGS.${file}+= -fno-exceptions -funwind-tables .endfor CFLAGS+= -I${UNWINDINCDIR} -I${.CURDIR} -D_LIBUNWIND_IS_NATIVE_ONLY +.if empty(CXXFLAGS:M-std=*) +CXXFLAGS+= -std=c++11 +.endif CXXFLAGS+= -fno-rtti -CXXSTD?= c++11 STATIC_CXXFLAGS+= -fvisibility=hidden -fPIC # Probably need to just move this earlier or use CXXFLAGS .if ${MK_DIRDEPS_BUILD} == "yes" Modified: stable/12/lib/libomp/Makefile ============================================================================== --- stable/12/lib/libomp/Makefile Thu May 23 00:55:28 2019 (r348136) +++ stable/12/lib/libomp/Makefile Thu May 23 00:59:05 2019 (r348137) @@ -53,9 +53,9 @@ CFLAGS+= -I${ITTSRC} CFLAGS+= -ffunction-sections CFLAGS+= -fdata-sections CXXFLAGS+= -fvisibility-inlines-hidden +CXXFLAGS+= -std=c++11 CXXFLAGS+= -fno-exceptions CXXFLAGS+= -fno-rtti -CXXSTD= c++11 LDFLAGS+= -Wl,--warn-shared-textrel LDFLAGS+= -Wl,--gc-sections Modified: stable/12/lib/ofed/libibnetdisc/Makefile ============================================================================== --- stable/12/lib/ofed/libibnetdisc/Makefile Thu May 23 00:55:28 2019 (r348136) +++ stable/12/lib/ofed/libibnetdisc/Makefile Thu May 23 00:59:05 2019 (r348137) @@ -32,7 +32,7 @@ CFLAGS+= -DHAVE_CONFIG_H=1 CFLAGS+= -I${_spath} CFLAGS+= -I${SYSROOT:U${DESTDIR}}/${INCLUDEDIR}/infiniband .if ${COMPILER_FEATURES:Mc++11} -CXXSTD= c++11 +CXXFLAGS+= -std=c++11 .endif VERSION_MAP= ${_spath}/libibnetdisc.map Modified: stable/12/share/examples/tests/tests/Makefile ============================================================================== --- stable/12/share/examples/tests/tests/Makefile Thu May 23 00:55:28 2019 (r348136) +++ stable/12/share/examples/tests/tests/Makefile Thu May 23 00:59:05 2019 (r348137) @@ -1,7 +1,5 @@ # $FreeBSD$ -.include - # Directory into which the Kyuafile provided by this directory will be # installed. # @@ -22,10 +20,6 @@ TESTS_SUBDIRS+= atf TESTS_SUBDIRS+= plain TESTS_SUBDIRS+= tap - -.if ${MK_GOOGLETEST} != no -TESTS_SUBDIRS+= googletest -.endif # We leave KYUAFILE unset so that bsd.test.mk auto-generates a Kyuafile # for us based on the contents of the TESTS_SUBDIRS line above. The Modified: stable/12/share/mk/Makefile ============================================================================== --- stable/12/share/mk/Makefile Thu May 23 00:55:28 2019 (r348136) +++ stable/12/share/mk/Makefile Thu May 23 00:59:05 2019 (r348137) @@ -73,8 +73,6 @@ FILESDIR= ${BINDIR}/mk .if ${MK_TESTS} != "no" FILES+= atf.test.mk -FILES+= googletest.test.inc.mk -FILES+= googletest.test.mk FILES+= plain.test.mk FILES+= suite.test.mk FILES+= tap.test.mk Modified: stable/12/share/mk/bsd.README ============================================================================== --- stable/12/share/mk/bsd.README Thu May 23 00:55:28 2019 (r348136) +++ stable/12/share/mk/bsd.README Thu May 23 00:59:05 2019 (r348137) @@ -649,8 +649,6 @@ ATF_TESTS_CXX The names of the ATF C++ test programs t ATF_TESTS_SH The names of the ATF sh test programs to build. -GTESTS The names of the GoogleTest test programs to build. - KYUAFILE If 'auto' (the default), generate a Kyuafile out of the test programs defined in the Makefile. If 'yes', then a manually-crafted Kyuafile must be supplied with the Modified: stable/12/share/mk/bsd.progs.mk ============================================================================== --- stable/12/share/mk/bsd.progs.mk Thu May 23 00:55:28 2019 (r348136) +++ stable/12/share/mk/bsd.progs.mk Thu May 23 00:59:05 2019 (r348137) @@ -22,8 +22,8 @@ PROGS += ${PROGS_CXX} .if defined(PROG) # just one of many -PROG_OVERRIDE_VARS += BINDIR BINGRP BINOWN BINMODE CSTD CXXSTD DPSRCS MAN \ - NO_SHARED NO_WERROR PROGNAME SRCS STRIP WARNS +PROG_OVERRIDE_VARS += BINDIR BINGRP BINOWN BINMODE DPSRCS MAN NO_WERROR \ + PROGNAME SRCS STRIP WARNS PROG_VARS += CFLAGS CXXFLAGS DEBUG_FLAGS DPADD INTERNALPROG LDADD LIBADD \ LINKS LDFLAGS MLINKS ${PROG_OVERRIDE_VARS} .for v in ${PROG_VARS:O:u} Modified: stable/12/share/mk/bsd.sys.mk ============================================================================== --- stable/12/share/mk/bsd.sys.mk Thu May 23 00:55:28 2019 (r348136) +++ stable/12/share/mk/bsd.sys.mk Thu May 23 00:59:05 2019 (r348137) @@ -24,11 +24,6 @@ CFLAGS+= -std=iso9899:1999 .else # CSTD CFLAGS+= -std=${CSTD} .endif # CSTD - -.if !empty(CXXSTD) -CXXFLAGS+= -std=${CXXSTD} -.endif - # -pedantic is problematic because it also imposes namespace restrictions #CFLAGS+= -pedantic .if defined(WARNS) Modified: stable/12/share/mk/bsd.test.mk ============================================================================== --- stable/12/share/mk/bsd.test.mk Thu May 23 00:55:28 2019 (r348136) +++ stable/12/share/mk/bsd.test.mk Thu May 23 00:59:05 2019 (r348137) @@ -63,7 +63,6 @@ _TESTS= # Pull in the definitions of all supported test interfaces. .include -.include .include .include Modified: stable/12/share/mk/src.libnames.mk ============================================================================== --- stable/12/share/mk/src.libnames.mk Thu May 23 00:55:28 2019 (r348136) +++ stable/12/share/mk/src.libnames.mk Thu May 23 00:59:05 2019 (r348137) @@ -18,10 +18,6 @@ _PRIVATELIBS= \ bsdstat \ devdctl \ event \ - gmock \ - gtest \ - gmock_main \ - gtest_main \ heimipcc \ heimipcs \ ifconfig \ @@ -304,10 +300,6 @@ _DP_dpv= dialog figpar util ncursesw _DP_dialog= ncursesw m _DP_cuse= pthread _DP_atf_cxx= atf_c -_DP_gtest= pthread -_DP_gmock= gtest -_DP_gmock_main= gmock -_DP_gtest_main= gtest _DP_devstat= kvm _DP_pam= radius tacplus opie md util .if ${MK_KERBEROS} != "no" @@ -385,15 +377,6 @@ LIBATF_CXX= ${LIBDESTDIR}${LIBDIR_BASE}/libprivateatf- LDADD_atf_c= -lprivateatf-c LDADD_atf_cxx= -lprivateatf-c++ -LIBGMOCK= ${LIBDESTDIR}${LIBDIR_BASE}/libprivategmock.a -LIBGMOCK_MAIN= ${LIBDESTDIR}${LIBDIR_BASE}/libprivategmock_main.a -LIBGTEST= ${LIBDESTDIR}${LIBDIR_BASE}/libprivategtest.a -LIBGTEST_MAIN= ${LIBDESTDIR}${LIBDIR_BASE}/libprivategtest_main.a -LDADD_gmock= -lprivategmock -LDADD_gtest= -lprivategtest -LDADD_gmock_main= -lprivategmock_main -LDADD_gtest_main= -lprivategtest_main - .for _l in ${_PRIVATELIBS} LIB${_l:tu}?= ${LIBDESTDIR}${LIBDIR_BASE}/libprivate${_l}.a .endfor @@ -430,15 +413,6 @@ LDADD_${_l}+= ${LDADD_${_d}} DPADD_atf_cxx+= ${DPADD_atf_c} LDADD_atf_cxx+= ${LDADD_atf_c} -DPADD_gmock+= ${DPADD_gtest} -LDADD_gmock+= ${LDADD_gtest} - -DPADD_gmock_main+= ${DPADD_gmock} -LDADD_gmock_main+= ${LDADD_gmock} - -DPADD_gtest_main+= ${DPADD_gtest} -LDADD_gtest_main+= ${LDADD_gtest} - # Detect LDADD/DPADD that should be LIBADD, before modifying LDADD here. _BADLDADD= .for _l in ${LDADD:M-l*:N-l*/*:C,^-l,,} @@ -577,10 +551,6 @@ LIBROKENDIR= ${OBJTOP}/kerberos5/lib/libroken LIBWINDDIR= ${OBJTOP}/kerberos5/lib/libwind LIBATF_CDIR= ${OBJTOP}/lib/atf/libatf-c LIBATF_CXXDIR= ${OBJTOP}/lib/atf/libatf-c++ -LIBGMOCKDIR= ${OBJTOP}/lib/googletest/gmock -LIBGMOCK_MAINDIR= ${OBJTOP}/lib/googletest/gmock_main -LIBGTESTDIR= ${OBJTOP}/lib/googletest/gtest -LIBGTEST_MAINDIR= ${OBJTOP}/lib/googletest/gtest_main LIBALIASDIR= ${OBJTOP}/lib/libalias/libalias LIBBLACKLISTDIR= ${OBJTOP}/lib/libblacklist LIBBLOCKSRUNTIMEDIR= ${OBJTOP}/lib/libblocksruntime Modified: stable/12/share/mk/src.opts.mk ============================================================================== --- stable/12/share/mk/src.opts.mk Thu May 23 00:55:28 2019 (r348136) +++ stable/12/share/mk/src.opts.mk Thu May 23 00:59:05 2019 (r348137) @@ -108,7 +108,6 @@ __DEFAULT_YES_OPTIONS = \ GDB \ GNU_DIFF \ GNU_GREP \ - GOOGLETEST \ GPIO \ HAST \ HTML \ @@ -435,7 +434,6 @@ MK_${var}:= no # Order is somewhat important. # .if !${COMPILER_FEATURES:Mc++11} -MK_GOOGLETEST:= no MK_LLVM_LIBUNWIND:= no .endif @@ -518,10 +516,6 @@ MK_FREEBSD_UPDATE:= no .if ${MK_TESTS} == "no" MK_DTRACE_TESTS:= no -.endif - -.if ${MK_TESTS_SUPPORT} == "no" -MK_GOOGLETEST:= no .endif .if ${MK_ZONEINFO} == "no" Modified: stable/12/tests/sys/opencrypto/cryptodev.py ============================================================================== --- stable/12/tests/sys/opencrypto/cryptodev.py Thu May 23 00:55:28 2019 (r348136) +++ stable/12/tests/sys/opencrypto/cryptodev.py Thu May 23 00:59:05 2019 (r348137) @@ -3,7 +3,6 @@ # Copyright (c) 2014 The FreeBSD Foundation # Copyright 2014 John-Mark Gurney # All rights reserved. -# Copyright 2019 Enji Cooper # # This software was developed by John-Mark Gurney under # the sponsorship from the FreeBSD Foundation. @@ -33,85 +32,76 @@ from __future__ import print_function import array -import binascii +import dpkt from fcntl import ioctl import os -import random import signal from struct import pack as _pack -import sys -import time -import dpkt - from cryptodevh import * __all__ = [ 'Crypto', 'MismatchError', ] class FindOp(dpkt.Packet): - __byte_order__ = '@' - __hdr__ = ( - ('crid', 'i', 0), - ('name', '32s', 0), - ) + __byte_order__ = '@' + __hdr__ = ( ('crid', 'i', 0), + ('name', '32s', 0), + ) class SessionOp(dpkt.Packet): - __byte_order__ = '@' - __hdr__ = ( - ('cipher', 'I', 0), - ('mac', 'I', 0), - ('keylen', 'I', 0), - ('key', 'P', 0), - ('mackeylen', 'i', 0), - ('mackey', 'P', 0), - ('ses', 'I', 0), - ) + __byte_order__ = '@' + __hdr__ = ( ('cipher', 'I', 0), + ('mac', 'I', 0), + ('keylen', 'I', 0), + ('key', 'P', 0), + ('mackeylen', 'i', 0), + ('mackey', 'P', 0), + ('ses', 'I', 0), + ) class SessionOp2(dpkt.Packet): - __byte_order__ = '@' - __hdr__ = ( - ('cipher', 'I', 0), - ('mac', 'I', 0), - ('keylen', 'I', 0), - ('key', 'P', 0), - ('mackeylen', 'i', 0), - ('mackey', 'P', 0), - ('ses', 'I', 0), - ('crid', 'i', 0), - ('pad0', 'i', 0), - ('pad1', 'i', 0), - ('pad2', 'i', 0), - ('pad3', 'i', 0), - ) + __byte_order__ = '@' + __hdr__ = ( ('cipher', 'I', 0), + ('mac', 'I', 0), + ('keylen', 'I', 0), + ('key', 'P', 0), + ('mackeylen', 'i', 0), + ('mackey', 'P', 0), + ('ses', 'I', 0), + ('crid', 'i', 0), + ('pad0', 'i', 0), + ('pad1', 'i', 0), + ('pad2', 'i', 0), + ('pad3', 'i', 0), + ) class CryptOp(dpkt.Packet): - __byte_order__ = '@' - __hdr__ = ( - ('ses', 'I', 0), - ('op', 'H', 0), - ('flags', 'H', 0), - ('len', 'I', 0), - ('src', 'P', 0), - ('dst', 'P', 0), - ('mac', 'P', 0), - ('iv', 'P', 0), - ) + __byte_order__ = '@' + __hdr__ = ( ('ses', 'I', 0), + ('op', 'H', 0), + ('flags', 'H', 0), + ('len', 'I', 0), + ('src', 'P', 0), + ('dst', 'P', 0), + ('mac', 'P', 0), + ('iv', 'P', 0), + ) class CryptAEAD(dpkt.Packet): - __byte_order__ = '@' - __hdr__ = ( - ('ses', 'I', 0), - ('op', 'H', 0), - ('flags', 'H', 0), - ('len', 'I', 0), - ('aadlen', 'I', 0), - ('ivlen', 'I', 0), - ('src', 'P', 0), - ('dst', 'P', 0), - ('aad', 'P', 0), - ('tag', 'P', 0), - ('iv', 'P', 0), - ) + __byte_order__ = '@' + __hdr__ = ( + ('ses', 'I', 0), + ('op', 'H', 0), + ('flags', 'H', 0), + ('len', 'I', 0), + ('aadlen', 'I', 0), + ('ivlen', 'I', 0), + ('src', 'P', 0), + ('dst', 'P', 0), + ('aad', 'P', 0), + ('tag', 'P', 0), + ('iv', 'P', 0), + ) # h2py.py can't handle multiarg macros CRIOGET = 3221513060 @@ -126,595 +116,445 @@ CIOCFINDDEV = 3223610220 CIOCCRYPTAEAD = 3225445229 def _getdev(): - buf = array.array('I', [0]) - fd = os.open('/dev/crypto', os.O_RDWR) - try: - ioctl(fd, CRIOGET, buf, 1) - finally: - os.close(fd) + fd = os.open('/dev/crypto', os.O_RDWR) + buf = array.array('I', [0]) + ioctl(fd, CRIOGET, buf, 1) + os.close(fd) - return buf[0] + return buf[0] _cryptodev = _getdev() -def str_to_ascii(val): - if sys.version_info[0] >= 3: - if isinstance(val, str): - return val.encode("ascii") - return val - def _findop(crid, name): - fop = FindOp() - fop.crid = crid - fop.name = str_to_ascii(name) - s = array.array('B', fop.pack_hdr()) - ioctl(_cryptodev, CIOCFINDDEV, s, 1) - fop.unpack(s) + fop = FindOp() + fop.crid = crid + fop.name = name + s = array.array('B', fop.pack_hdr()) + ioctl(_cryptodev, CIOCFINDDEV, s, 1) + fop.unpack(s) - try: - idx = fop.name.index(b'\x00') - name = fop.name[:idx] - except ValueError: - name = fop.name + try: + idx = fop.name.index('\x00') + name = fop.name[:idx] + except ValueError: + name = fop.name - return fop.crid, name + return fop.crid, name -def array_tobytes(array_obj): - if sys.version_info[:2] >= (3, 2): - return array_obj.tobytes() - return array_obj.tostring() - class Crypto: - @staticmethod - def findcrid(name): - return _findop(-1, name)[0] + @staticmethod + def findcrid(name): + return _findop(-1, name)[0] - @staticmethod - def getcridname(crid): - return _findop(crid, '')[1] + @staticmethod + def getcridname(crid): + return _findop(crid, '')[1] - def __init__(self, cipher=0, key=None, mac=0, mackey=None, - crid=CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_HARDWARE, maclen=None): - self._ses = None - self._maclen = maclen - ses = SessionOp2() - ses.cipher = cipher - ses.mac = mac + def __init__(self, cipher=0, key=None, mac=0, mackey=None, + crid=CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_HARDWARE): + self._ses = None + ses = SessionOp2() + ses.cipher = cipher + ses.mac = mac - if key is not None: - ses.keylen = len(key) - k = array.array('B', key) - ses.key = k.buffer_info()[0] - else: - self.key = None + if key is not None: + ses.keylen = len(key) + k = array.array('B', key) + ses.key = k.buffer_info()[0] + else: + self.key = None - if mackey is not None: - ses.mackeylen = len(mackey) - mk = array.array('B', mackey) - ses.mackey = mk.buffer_info()[0] + if mackey is not None: + ses.mackeylen = len(mackey) + mk = array.array('B', mackey) + ses.mackey = mk.buffer_info()[0] + self._maclen = 16 # parameterize? + else: + self._maclen = None - if not cipher and not mac: - raise ValueError('one of cipher or mac MUST be specified.') - ses.crid = crid - #print(ses) - s = array.array('B', ses.pack_hdr()) - #print(s) - ioctl(_cryptodev, CIOCGSESSION2, s, 1) - ses.unpack(s) + if not cipher and not mac: + raise ValueError('one of cipher or mac MUST be specified.') + ses.crid = crid + #print(ses) + s = array.array('B', ses.pack_hdr()) + #print(s) + ioctl(_cryptodev, CIOCGSESSION2, s, 1) + ses.unpack(s) - self._ses = ses.ses + self._ses = ses.ses - def __del__(self): - if self._ses is None: - return + def __del__(self): + if self._ses is None: + return - try: - ioctl(_cryptodev, CIOCFSESSION, _pack('I', self._ses)) - except TypeError: - pass - self._ses = None + try: + ioctl(_cryptodev, CIOCFSESSION, _pack('I', self._ses)) + except TypeError: + pass + self._ses = None - def _doop(self, op, src, iv): - cop = CryptOp() - cop.ses = self._ses - cop.op = op - cop.flags = 0 - cop.len = len(src) - s = array.array('B', src) - cop.src = cop.dst = s.buffer_info()[0] - if self._maclen is not None: - m = array.array('B', [0] * self._maclen) - cop.mac = m.buffer_info()[0] - ivbuf = array.array('B', str_to_ascii(iv)) - cop.iv = ivbuf.buffer_info()[0] + def _doop(self, op, src, iv): + cop = CryptOp() + cop.ses = self._ses + cop.op = op + cop.flags = 0 + cop.len = len(src) + s = array.array('B', src) + cop.src = cop.dst = s.buffer_info()[0] + if self._maclen is not None: + m = array.array('B', [0] * self._maclen) + cop.mac = m.buffer_info()[0] + ivbuf = array.array('B', iv) + cop.iv = ivbuf.buffer_info()[0] - cop_b = bytes(cop) - #print('cop:', cop_b) - ioctl(_cryptodev, CIOCCRYPT, cop_b) + #print('cop:', cop) + ioctl(_cryptodev, CIOCCRYPT, str(cop)) - s = array_tobytes(s) - if self._maclen is not None: - return s, array_tobytes(m) + s = s.tostring() + if self._maclen is not None: + return s, m.tostring() - return s + return s - def _doaead(self, op, src, aad, iv, tag=None): - caead = CryptAEAD() - caead.ses = self._ses - caead.op = op - caead.flags = CRD_F_IV_EXPLICIT - caead.flags = 0 - caead.len = len(src) - src = str_to_ascii(src) - s = array.array("B", src) - caead.src = caead.dst = s.buffer_info()[0] - caead.aadlen = len(aad) - aad = str_to_ascii(aad) - saad = array.array('B', aad) - caead.aad = saad.buffer_info()[0] + def _doaead(self, op, src, aad, iv, tag=None): + caead = CryptAEAD() + caead.ses = self._ses + caead.op = op + caead.flags = CRD_F_IV_EXPLICIT + caead.flags = 0 + caead.len = len(src) + s = array.array('B', src) + caead.src = caead.dst = s.buffer_info()[0] + caead.aadlen = len(aad) + saad = array.array('B', aad) + caead.aad = saad.buffer_info()[0] - if self._maclen is None: - raise ValueError('must have a tag length') + if self._maclen is None: + raise ValueError('must have a tag length') - if tag is None: - tag = array.array('B', [0] * self._maclen) - else: - assert len(tag) == self._maclen, \ + if tag is None: + tag = array.array('B', [0] * self._maclen) + else: + assert len(tag) == self._maclen, \ '%d != %d' % (len(tag), self._maclen) - tag = str_to_ascii(tag) - tag = array.array('B', tag) + tag = array.array('B', tag) - caead.tag = tag.buffer_info()[0] + caead.tag = tag.buffer_info()[0] - ivbuf = array.array('B', iv) - caead.ivlen = len(iv) - caead.iv = ivbuf.buffer_info()[0] + ivbuf = array.array('B', iv) + caead.ivlen = len(iv) + caead.iv = ivbuf.buffer_info()[0] - caead_b = bytes(caead) - ioctl(_cryptodev, CIOCCRYPTAEAD, caead_b) + ioctl(_cryptodev, CIOCCRYPTAEAD, str(caead)) - s = array_tobytes(s) + s = s.tostring() - return s, array_tobytes(tag) + return s, tag.tostring() - def perftest(self, op, size, timeo=3): - inp = array.array('B', (random.randint(0, 255) for x in range(size))) - out = array.array('B', str_to_ascii(inp)) + def perftest(self, op, size, timeo=3): + import random + import time - # prep ioctl - cop = CryptOp() - cop.ses = self._ses - cop.op = op - cop.flags = 0 - cop.len = len(inp) - s = array.array('B', str_to_ascii(inp)) - cop.src = s.buffer_info()[0] - cop.dst = out.buffer_info()[0] - if self._maclen is not None: - m = array.array('B', [0] * self._maclen) - cop.mac = m.buffer_info()[0] - ivbuf = array.array('B', (random.randint(0, 255) for x in range(16))) - cop.iv = ivbuf.buffer_info()[0] + inp = array.array('B', (random.randint(0, 255) for x in xrange(size))) + out = array.array('B', inp) - exit = [ False ] - def alarmhandle(a, b, exit=exit): - exit[0] = True + # prep ioctl + cop = CryptOp() + cop.ses = self._ses + cop.op = op + cop.flags = 0 + cop.len = len(inp) + s = array.array('B', inp) + cop.src = s.buffer_info()[0] + cop.dst = out.buffer_info()[0] + if self._maclen is not None: + m = array.array('B', [0] * self._maclen) + cop.mac = m.buffer_info()[0] + ivbuf = array.array('B', (random.randint(0, 255) for x in xrange(16))) + cop.iv = ivbuf.buffer_info()[0] - oldalarm = signal.signal(signal.SIGALRM, alarmhandle) - signal.alarm(timeo) + exit = [ False ] + def alarmhandle(a, b, exit=exit): + exit[0] = True - start = time.time() - reps = 0 - cop_b = bytes(cop) - while not exit[0]: - ioctl(_cryptodev, CIOCCRYPT, cop_b) - reps += 1 + oldalarm = signal.signal(signal.SIGALRM, alarmhandle) + signal.alarm(timeo) - end = time.time() + start = time.time() + reps = 0 + while not exit[0]: + ioctl(_cryptodev, CIOCCRYPT, str(cop)) + reps += 1 - signal.signal(signal.SIGALRM, oldalarm) + end = time.time() - print('time:', end - start) - print('perf MB/sec:', (reps * size) / (end - start) / 1024 / 1024) + signal.signal(signal.SIGALRM, oldalarm) - def encrypt(self, data, iv, aad=None): - if aad is None: - return self._doop(COP_ENCRYPT, data, iv) - else: - return self._doaead(COP_ENCRYPT, data, aad, - iv) + print('time:', end - start) + print('perf MB/sec:', (reps * size) / (end - start) / 1024 / 1024) - def decrypt(self, data, iv, aad=None, tag=None): - if aad is None: - return self._doop(COP_DECRYPT, data, iv) - else: - return self._doaead(COP_DECRYPT, data, aad, - iv, tag=tag) + def encrypt(self, data, iv, aad=None): + if aad is None: + return self._doop(COP_ENCRYPT, data, iv) + else: + return self._doaead(COP_ENCRYPT, data, aad, + iv) + def decrypt(self, data, iv, aad=None, tag=None): + if aad is None: + return self._doop(COP_DECRYPT, data, iv) + else: + return self._doaead(COP_DECRYPT, data, aad, + iv, tag=tag) + class MismatchError(Exception): - pass + pass class KATParser: - def __init__(self, fname, fields): - self.fields = set(fields) - self._pending = None - self.fname = fname - self.fp = None + def __init__(self, fname, fields): + self.fp = open(fname) + self.fields = set(fields) + self._pending = None - def __enter__(self): - self.fp = open(self.fname) - return self + def __iter__(self): + while True: + didread = False + if self._pending is not None: + i = self._pending + self._pending = None + else: + i = self.fp.readline() + didread = True - def __exit__(self, exc_type, exc_value, exc_tb): - if self.fp is not None: - self.fp.close() + if didread and not i: + return - def __iter__(self): - return self + if (i and i[0] == '#') or not i.strip(): + continue + if i[0] == '[': + yield i[1:].split(']', 1)[0], self.fielditer() + else: + raise ValueError('unknown line: %r' % repr(i)) - def __next__(self): - while True: - didread = False - if self._pending is not None: - i = self._pending - self._pending = None - else: - i = self.fp.readline() *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Thu May 23 01:09:18 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF175159370A; Thu, 23 May 2019 01:09:17 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B18EF737FA; Thu, 23 May 2019 01:09:17 +0000 (UTC) (envelope-from ngie@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 73653258D2; Thu, 23 May 2019 01:09:17 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4N19HEg015404; Thu, 23 May 2019 01:09:17 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4N19A1r015367; Thu, 23 May 2019 01:09:10 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201905230109.x4N19A1r015367@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Enji Cooper Date: Thu, 23 May 2019 01:09:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348138 - in stable/12: cddl/usr.sbin/zfsd cddl/usr.sbin/zfsd/tests contrib/googletest contrib/googletest/googletest contrib/googletest/googletest/docs contrib/googletest/googletest/inc... X-SVN-Group: stable-12 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: in stable/12: cddl/usr.sbin/zfsd cddl/usr.sbin/zfsd/tests contrib/googletest contrib/googletest/googletest contrib/googletest/googletest/docs contrib/googletest/googletest/include/gtest contrib/google... X-SVN-Commit-Revision: 348138 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B18EF737FA X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.952,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 01:09:18 -0000 Author: ngie Date: Thu May 23 01:09:10 2019 New Revision: 348138 URL: https://svnweb.freebsd.org/changeset/base/348138 Log: MFC r345203,r345205,r345353,r345645,r345708,r345709,r345735,r345770,r346081,r346270,r346574,r346576: r345203: Initial googlemock/googletest integration into the build/FreeBSD test suite This initial integration takes googlemock/googletest release 1.8.1, integrates the library, tests, and sample unit tests into the build. googlemock/googletest's inclusion is optionally available via `MK_GOOGLETEST`. `MK_GOOGLETEST` is dependent on `MK_TESTS` and is enabled by default when built with a C++11 capable toolchain. Google tests can be specified via the `GTESTS` variable, which, in comparison with the other test drivers, is more simplified/streamlined, as Googletest only supports C++ tests; not raw C or shell tests (C tests can be written in C++ using the standard embedding methods). No dependent libraries are assumed for the tests. One must specify `gmock`, `gmock_main`, `gtest`, or `gtest_main`, via `LIBADD` for the program. More information about googlemock and googletest can be found on the Googletest [project page](https://github.com/google/googletest), and the [GoogleMock](https://github.com/google/googletest/blob/v1.8.x/googlemock/docs/Documentation.md) and [GoogleTest](https://github.com/google/googletest/tree/v1.8.x/googletest/docs) docs. These tests are originally integrated into the build as plain driver tests, but will be natively integrated into Kyua in a later version. Known issues/Errata: * [WhenDynamicCastToTest.AmbiguousCast fails on FreeBSD](https://github.com/google/googletest/issues/2172) r345205: Integrate cddl/usr.sbin/zfds/tests into the FreeBSD test suite This change integrates the unit tests for zfsd into the test suite using the integration method described in r345203. This change removes the `LOCALBASE` includes added for the port version of googlemock/googletest, as well as unnecessary `LIBADD`/`DPADD` and `CXXFLAGS` defines, which are included in the `GTEST_CXXFLAGS` variable, as part of r345203. r345353 (by asomers): googletest: backport GTEST_SKIP to googletest 1.8.1 This commit backports revisions 00938b2b228f3b70d3d9e51f29a1505bdad43f1e and 59f90a338bce2376b540ee239cf4e269bf6d68ad from googletest's master branch to our included version of googletest, which is based on 1.8.1. It adds the GTEST_SKIP feature, which is very useful for a project like FreeBSD where some tests depend on particular system configurations. Obtained from: github.com/google/googletest r345645: Spam CXXFLAGS with `-I${DESTDIR}/usr/include/private`, instead of GTEST_CXXFLAGS This makes it easier for googletest users to leverage googletest, instead of forcing them to plug GTEST_CXXFLAGS into CXXFLAGS manually (resulting in unnecessary duplication). I will be following this up with a more proper fix in src.libnames.mk, as src.libnames.mk should be automatically adding this directory to CFLAGS/CXXFLAGS when private libraries are referenced. Not doing so can result in mismatches between base-provided private library's and ports-provided library's headers. While here, tweak the comment to clarify what the intent is behind spamming CXXFLAGS. r345708: Standardize `-std=c++* as `CXXSTD` CXXSTD was added as the C++ analogue to CSTD. CXXSTD defaults to `-std=c++11` with supporting compilers; `-std=gnu++98`, otherwise for older versions of g++. This change standardizes the CXXSTD variable, originally added to googletest.test.inc.mk as part of r345203. As part of this effort, convert all `CXXFLAGS+= -std=*` calls to use `CXXSTD`. Notes: This value is not sanity checked in bsd.sys.mk, however, given the two most used C++ compilers on FreeBSD (clang++ and g++) support both modes, it is likely to work with both toolchains. This method will be refined in the future to support more variants of C++, as not all versions of clang++ and g++ (for instance) support C++14, C++17, etc. Any manual appending of `-std=*` to `CXXFLAGS` should be replaced with CXXSTD. Example: Before this commit: ``` CXXFLAGS+= -std=c++14 ``` After this commit: ``` CXXSTD= c++14 ``` Relnotes: yes Tested with: make tinderbox r345709: Allow users to override CSTD/CXXSTD on a per-prog basis The current logic for CSTD/CXXSTD requires homogenity as far as the supported C/C++ standards, which is a sensible default. However, when dealing with differing versions of C++, some code may compile with C++11, but not C++17 (for instance). So in order to avoid having people convert over their code to the new standard, give the users the ability to specify the standard on a per-program basis. This will allow a user to override the supporting standard for a set of programs, mixing C++11 with C++14 (for instance). Apprved by: emaste (mentor) r345735: Allow programs to set `NO_SHARED` on a per-PROG basis This is particularly useful when installing programs for tests that need to be linked statically, e.g., mini-me from capsicum-test, which is linked statically to avoid the dynamic library lookup in the upstream project. r345770: Import proof-of-concept for handling `GTEST_SKIP()` in `Environment::SetUp` Per the upstream pull-request [1]: ``` gtest prior to this change would completely ignore `GTEST_SKIP()` if called in `Environment::SetUp()`, instead of bailing out early, unlike `Test::SetUp()`, which would cause the tests themselves to be skipped. The only way (prior to this change) to skip the tests would be to trigger a fatal error via `GTEST_FAIL()`. Desirable behavior, in this case, when dealing with `Environment::SetUp()` is to check for prerequisites on a system (example, kernel supports a particular featureset, e.g., capsicum), and skip the tests. The alternatives prior to this change would be undesirable: - Failing sends the wrong message to the test user, as the result of the tests is indeterminate, not failed. - Having to add per-test class abstractions that override `SetUp()` to test for the capsicum feature set, then skip all of the tests in their respective SetUp fixtures, would be a lot of human and computational work; checking for the feature would need to be done for all of the tests, instead of once for all of the tests. For those reasons, making `Environment::SetUp()` handle `GTEST_SKIP()`, by not executing the testcases, is the most desirable solution. In order to properly diagnose what happened when running the tests if they are skipped, print out the diagnostics in an ad hoc manner. Update the documentation to note this change and integrate a new test, gtest_skip_in_environment_setup_test, into the test suite. This change addresses #2189. Signed-off-by: Enji Cooper ``` The goal with my merging in this change is to avoid requiring extensive refactoring/retesting of test suites when ensuring prerequisites are met, e.g., checking for a CAPABILITIES-enabled kernel before running capsicum-test (see D19758 for more details). The proof-of-concept is being imported before accepted by the upstream project due to the fact that the upstream project is undergoing a potential development freeze and the maintainers aren't responding to my PR. 1. https://github.com/google/googletest/pull/2203 r346081 (by trasz): Make zfsd(8) build obey CFLAGS. Obtained from: CheriBSD r346270 (by trasz): Drop -g from CFLAGS for zfsd(8). No idea why it was ever there. r346574: Rework CXXSTD setting via r345708 This change allows the user to once again override the C++ standard, restoring high-level pre-r345708 behavior. This also unbreaks building lib/ofed/libibnetdisc/Makefile with a non-C++11 capable compiler, e.g., g++ 4.2.1, as the library supported being built with older C++ standards. r346576: Fix up CXXSTD support originally added in r345708 r345708 worked for the base system, but unfortunately, caused a lot of disruption for third-party packages that relied on C++, since bsd.sys.mk is used by applications outside the base system. The defaults picked didn't match the compiler's defaults and broke some builds that didn't specify a standard, as well as some that overrode the value by setting `-std=gnu++14` (for example) manually. This change takes a more relaxed approach to appending `-std=${CXXSTD}` to CXXFLAGS, by only doing so when the value is specified, as opposed to overriding the standard set by an end-user. This avoids the need for having to bake NOP default into bsd.sys.mk for supported compiler-toolchain versions. In order to make this change possible, add CXXSTD to Makefile snippets which relied on the default value (c++11) added in r345708. Added: stable/12/contrib/googletest/ - copied from r345203, head/contrib/googletest/ stable/12/contrib/googletest/googletest/test/gtest_skip_in_environment_setup_test.cc - copied unchanged from r345770, head/contrib/googletest/googletest/test/gtest_skip_in_environment_setup_test.cc stable/12/contrib/googletest/googletest/test/gtest_skip_test.cc - copied unchanged from r345353, head/contrib/googletest/googletest/test/gtest_skip_test.cc stable/12/lib/googletest/ - copied from r345203, head/lib/googletest/ stable/12/share/examples/tests/tests/googletest/ - copied from r345203, head/share/examples/tests/tests/googletest/ stable/12/share/mk/googletest.test.inc.mk - copied, changed from r345203, head/share/mk/googletest.test.inc.mk stable/12/share/mk/googletest.test.mk - copied unchanged from r345203, head/share/mk/googletest.test.mk stable/12/tools/build/options/WITHOUT_GOOGLETEST - copied unchanged from r345203, head/tools/build/options/WITHOUT_GOOGLETEST Modified: stable/12/cddl/usr.sbin/zfsd/Makefile stable/12/cddl/usr.sbin/zfsd/Makefile.common stable/12/cddl/usr.sbin/zfsd/tests/Makefile stable/12/contrib/googletest/googletest/CMakeLists.txt stable/12/contrib/googletest/googletest/Makefile.am stable/12/contrib/googletest/googletest/docs/advanced.md stable/12/contrib/googletest/googletest/include/gtest/gtest-test-part.h stable/12/contrib/googletest/googletest/include/gtest/gtest.h stable/12/contrib/googletest/googletest/include/gtest/internal/gtest-internal.h stable/12/contrib/googletest/googletest/src/gtest-internal-inl.h stable/12/contrib/googletest/googletest/src/gtest-test-part.cc stable/12/contrib/googletest/googletest/src/gtest.cc stable/12/contrib/googletest/googletest/test/BUILD.bazel stable/12/contrib/googletest/googletest/test/googletest-test-part-test.cc stable/12/contrib/googletest/googletest/test/gtest_all_test.cc stable/12/contrib/mandoc/lib.in stable/12/etc/mtree/BSD.tests.dist stable/12/etc/mtree/BSD.usr.dist stable/12/lib/Makefile stable/12/lib/clang/llvm.build.mk stable/12/lib/googletest/gtest_main/tests/Makefile stable/12/lib/libc++/Makefile stable/12/lib/libc++experimental/Makefile stable/12/lib/libc++fs/Makefile stable/12/lib/libc/tests/stdlib/Makefile stable/12/lib/libclang_rt/Makefile.inc stable/12/lib/libcxxrt/Makefile stable/12/lib/libgcc_eh/Makefile.inc stable/12/lib/libomp/Makefile stable/12/lib/ofed/libibnetdisc/Makefile stable/12/share/examples/tests/tests/Makefile stable/12/share/mk/Makefile stable/12/share/mk/bsd.README stable/12/share/mk/bsd.progs.mk stable/12/share/mk/bsd.sys.mk stable/12/share/mk/bsd.test.mk stable/12/share/mk/src.libnames.mk stable/12/share/mk/src.opts.mk stable/12/tools/build/mk/OptionalObsoleteFiles.inc stable/12/usr.bin/dtc/Makefile stable/12/usr.sbin/pmc/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/usr.sbin/zfsd/Makefile ============================================================================== --- stable/12/cddl/usr.sbin/zfsd/Makefile Thu May 23 00:59:05 2019 (r348137) +++ stable/12/cddl/usr.sbin/zfsd/Makefile Thu May 23 01:09:10 2019 (r348138) @@ -1,12 +1,13 @@ # $FreeBSD$ +.include + .include "Makefile.common" PROG_CXX= zfsd MAN= zfsd.8 -.include +HAS_TESTS= +SUBDIR.${MK_GOOGLETEST}+= tests -# The unittests require devel/googletest and devel/googlemock from ports. -# Don't automatically build them. -SUBDIR= +.include Modified: stable/12/cddl/usr.sbin/zfsd/Makefile.common ============================================================================== --- stable/12/cddl/usr.sbin/zfsd/Makefile.common Thu May 23 00:59:05 2019 (r348137) +++ stable/12/cddl/usr.sbin/zfsd/Makefile.common Thu May 23 01:09:10 2019 (r348138) @@ -28,12 +28,11 @@ INCFLAGS+= -I${SRCTOP}/cddl/contrib/opensolaris/lib/li INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/common/zfs INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common INCFLAGS+= -I${SRCTOP}/sys/cddl/contrib/opensolaris/uts/common/fs/zfs +INCFLAGS+= -I${SRCTOP}/cddl/usr.sbin -CFLAGS= -g -DNEED_SOLARIS_BOOLEAN ${INCFLAGS} +CFLAGS+= -DNEED_SOLARIS_BOOLEAN ${INCFLAGS} -DPADD= ${LIBDEVDCTL} ${LIBZFS} ${LIBZFS_CORE} ${LIBUTIL} ${LIBGEOM} \ - ${LIBBSDXML} ${LIBSBUF} ${LIBNVPAIR} ${LIBUUTIL} -LIBADD= devdctl zfs zfs_core util geom bsdxml sbuf nvpair uutil +LIBADD+= devdctl zfs zfs_core util geom bsdxml sbuf nvpair uutil cscope: find ${.CURDIR} -type f -a \( -name "*.[ch]" -o -name "*.cc" \) \ Modified: stable/12/cddl/usr.sbin/zfsd/tests/Makefile ============================================================================== --- stable/12/cddl/usr.sbin/zfsd/tests/Makefile Thu May 23 00:59:05 2019 (r348137) +++ stable/12/cddl/usr.sbin/zfsd/tests/Makefile Thu May 23 01:09:10 2019 (r348138) @@ -3,30 +3,12 @@ .include "${.CURDIR}/../Makefile.common" .PATH: ${.CURDIR:H} -PLAIN_TESTS_CXX= zfsd_unittest -SRCS.zfsd_unittest:= ${SRCS:Nzfsd_main.cc} -SRCS.zfsd_unittest+= libmocks.c zfsd_unittest.cc -SRCS= +GTESTS= zfsd_unittest -# Use #include in test programs. -INCFLAGS+= -I${.CURDIR:H:H} +SRCS.zfsd_unittest:= ${SRCS:Nzfsd_main.cc} +SRCS.zfsd_unittest+= libmocks.c zfsd_unittest.cc +.undef SRCS -.if defined(DESTDIR) || defined(SYSROOT) -INCFLAGS+= -I${SYSROOT:U${DESTDIR}}/usr/include -LDFLAGS.zfsd_unittest+= -L${SYSROOT:U${DESTDIR}}/lib \ - -L${SYSROOT:U${DESTDIR}}/usr/lib -.endif - -# Googletest options -INCFLAGS+= -I${LOCALBASE}/include -D_THREAD_SAFE -pthread -LDFLAGS.zfsd_unittest+= -L${LOCALBASE}/lib -D_THREAD_SAFE -pthread -LDADD.zfsd_unittest+= ${LOCALBASE}/lib/libgtest.a - -# GoogleMock options -LDADD.zfsd_unittest+= ${LOCALBASE}/lib/libgmock.a ${LOCALBASE}/lib/libgmock_main.a - -# Googlemock fails if we don't have this line -# https://groups.google.com/forum/#!msg/googletestframework/h8ixEPCFm0o/amwfu4xGJb0J -CFLAGS.zfsd_unittest+= -DGTEST_HAS_PTHREAD +LIBADD.zfsd_unittest+= gmock_main .include Modified: stable/12/contrib/googletest/googletest/CMakeLists.txt ============================================================================== --- head/contrib/googletest/googletest/CMakeLists.txt Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/contrib/googletest/googletest/CMakeLists.txt Thu May 23 01:09:10 2019 (r348138) @@ -217,6 +217,8 @@ if (gtest_build_tests) test/gtest-typed-test2_test.cc) cxx_test(gtest_unittest gtest_main) cxx_test(gtest-unittest-api_test gtest) + cxx_test(gtest_skip_in_environment_setup_test gtest_main) + cxx_test(gtest_skip_test gtest_main) ############################################################ # C++ tests built with non-standard compiler flags. Modified: stable/12/contrib/googletest/googletest/Makefile.am ============================================================================== --- head/contrib/googletest/googletest/Makefile.am Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/contrib/googletest/googletest/Makefile.am Thu May 23 01:09:10 2019 (r348138) @@ -290,6 +290,12 @@ test_gtest_all_test_SOURCES = test/gtest_all_test.cc test_gtest_all_test_LDADD = lib/libgtest_main.la \ lib/libgtest.la +TESTS += test/gtest_skip_in_environment_setup_test +check_PROGRAMS += test/gtest_skip_in_environment_setup_test +test_gtest_skip_in_environment_setup_test_SOURCES = test/gtest_skip_in_environment_setup_test.cc +test_gtest_skip_in_environment_setup_test_LDADD= lib/libgtest_main.la \ + lib/libgtest.la + # Tests that fused gtest files compile and work. FUSED_GTEST_SRC = \ fused-src/gtest/gtest-all.cc \ Modified: stable/12/contrib/googletest/googletest/docs/advanced.md ============================================================================== --- head/contrib/googletest/googletest/docs/advanced.md Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/contrib/googletest/googletest/docs/advanced.md Thu May 23 01:09:10 2019 (r348138) @@ -1289,8 +1289,10 @@ Environment* AddGlobalTestEnvironment(Environment* env ``` Now, when `RUN_ALL_TESTS()` is called, it first calls the `SetUp()` method of -the environment object, then runs the tests if there was no fatal failures, and -finally calls `TearDown()` of the environment object. +each environment object, then runs the tests if none of the environments +reported fatal failures and `GTEST_SKIP()` was not called. `RUN_ALL_TESTS()` +always calls `TearDown()` with each environment object, regardless of whether +or not the tests were run. It's OK to register multiple environment objects. In this case, their `SetUp()` will be called in the order they are registered, and their `TearDown()` will be Modified: stable/12/contrib/googletest/googletest/include/gtest/gtest-test-part.h ============================================================================== --- head/contrib/googletest/googletest/include/gtest/gtest-test-part.h Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/contrib/googletest/googletest/include/gtest/gtest-test-part.h Thu May 23 01:09:10 2019 (r348138) @@ -53,7 +53,8 @@ class GTEST_API_ TestPartResult { enum Type { kSuccess, // Succeeded. kNonFatalFailure, // Failed but the test can continue. - kFatalFailure // Failed and the test should be terminated. + kFatalFailure, // Failed and the test should be terminated. + kSkip // Skipped. }; // C'tor. TestPartResult does NOT have a default constructor. @@ -89,17 +90,20 @@ class GTEST_API_ TestPartResult { // Gets the message associated with the test part. const char* message() const { return message_.c_str(); } + // Returns true iff the test part was skipped. + bool skipped() const { return type_ == kSkip; } + // Returns true iff the test part passed. bool passed() const { return type_ == kSuccess; } - // Returns true iff the test part failed. - bool failed() const { return type_ != kSuccess; } - // Returns true iff the test part non-fatally failed. bool nonfatally_failed() const { return type_ == kNonFatalFailure; } // Returns true iff the test part fatally failed. bool fatally_failed() const { return type_ == kFatalFailure; } + + // Returns true iff the test part failed. + bool failed() const { return fatally_failed() || nonfatally_failed(); } private: Type type_; Modified: stable/12/contrib/googletest/googletest/include/gtest/gtest.h ============================================================================== --- head/contrib/googletest/googletest/include/gtest/gtest.h Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/contrib/googletest/googletest/include/gtest/gtest.h Thu May 23 01:09:10 2019 (r348138) @@ -440,6 +440,9 @@ class GTEST_API_ Test { // Returns true iff the current test has a non-fatal failure. static bool HasNonfatalFailure(); + // Returns true iff the current test was skipped. + static bool IsSkipped(); + // Returns true iff the current test has a (either fatal or // non-fatal) failure. static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); } @@ -574,8 +577,11 @@ class GTEST_API_ TestResult { int test_property_count() const; // Returns true iff the test passed (i.e. no test part failed). - bool Passed() const { return !Failed(); } + bool Passed() const { return !Skipped() && !Failed(); } + // Returns true iff the test was skipped. + bool Skipped() const; + // Returns true iff the test failed. bool Failed() const; @@ -854,6 +860,9 @@ class GTEST_API_ TestCase { // Gets the number of successful tests in this test case. int successful_test_count() const; + // Gets the number of skipped tests in this test case. + int skipped_test_count() const; + // Gets the number of failed tests in this test case. int failed_test_count() const; @@ -936,6 +945,11 @@ class GTEST_API_ TestCase { return test_info->should_run() && test_info->result()->Passed(); } + // Returns true iff test skipped. + static bool TestSkipped(const TestInfo* test_info) { + return test_info->should_run() && test_info->result()->Skipped(); + } + // Returns true iff test failed. static bool TestFailed(const TestInfo* test_info) { return test_info->should_run() && test_info->result()->Failed(); @@ -1258,6 +1272,9 @@ class GTEST_API_ UnitTest { // Gets the number of successful tests. int successful_test_count() const; + // Gets the number of skipped tests. + int skipped_test_count() const; + // Gets the number of failed tests. int failed_test_count() const; @@ -1834,6 +1851,11 @@ class TestWithParam : public Test, public WithParamInt }; // Macros for indicating success/failure in test code. + +// Skips test in runtime. +// Skipping test aborts current function. +// Skipped tests are neither successful nor failed. +#define GTEST_SKIP() GTEST_SKIP_("Skipped") // ADD_FAILURE unconditionally adds a failure to the current test. // SUCCEED generates a success - it doesn't automatically make the Modified: stable/12/contrib/googletest/googletest/include/gtest/internal/gtest-internal.h ============================================================================== --- head/contrib/googletest/googletest/include/gtest/internal/gtest-internal.h Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/contrib/googletest/googletest/include/gtest/internal/gtest-internal.h Thu May 23 01:09:10 2019 (r348138) @@ -1208,7 +1208,10 @@ class NativeArray { #define GTEST_SUCCESS_(message) \ GTEST_MESSAGE_(message, ::testing::TestPartResult::kSuccess) -// Suppress MSVC warning 4702 (unreachable code) for the code following +#define GTEST_SKIP_(message) \ + return GTEST_MESSAGE_(message, ::testing::TestPartResult::kSkip) + +// Suppress MSVC warning 4072 (unreachable code) for the code following // statement if it returns or throws (or doesn't return or throw in some // situations). #define GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) \ Modified: stable/12/contrib/googletest/googletest/src/gtest-internal-inl.h ============================================================================== --- head/contrib/googletest/googletest/src/gtest-internal-inl.h Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/contrib/googletest/googletest/src/gtest-internal-inl.h Thu May 23 01:09:10 2019 (r348138) @@ -544,6 +544,9 @@ class GTEST_API_ UnitTestImpl { // Gets the number of successful tests. int successful_test_count() const; + // Gets the number of skipped tests. + int skipped_test_count() const; + // Gets the number of failed tests. int failed_test_count() const; Modified: stable/12/contrib/googletest/googletest/src/gtest-test-part.cc ============================================================================== --- head/contrib/googletest/googletest/src/gtest-test-part.cc Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/contrib/googletest/googletest/src/gtest-test-part.cc Thu May 23 01:09:10 2019 (r348138) @@ -47,12 +47,16 @@ std::string TestPartResult::ExtractSummary(const char* // Prints a TestPartResult object. std::ostream& operator<<(std::ostream& os, const TestPartResult& result) { - return os - << result.file_name() << ":" << result.line_number() << ": " - << (result.type() == TestPartResult::kSuccess ? "Success" : - result.type() == TestPartResult::kFatalFailure ? "Fatal failure" : - "Non-fatal failure") << ":\n" - << result.message() << std::endl; + return os << result.file_name() << ":" << result.line_number() << ": " + << (result.type() == TestPartResult::kSuccess + ? "Success" + : result.type() == TestPartResult::kSkip + ? "Skipped" + : result.type() == TestPartResult::kFatalFailure + ? "Fatal failure" + : "Non-fatal failure") + << ":\n" + << result.message() << std::endl; } // Appends a TestPartResult to the array. Modified: stable/12/contrib/googletest/googletest/src/gtest.cc ============================================================================== --- head/contrib/googletest/googletest/src/gtest.cc Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/contrib/googletest/googletest/src/gtest.cc Thu May 23 01:09:10 2019 (r348138) @@ -796,6 +796,11 @@ int UnitTestImpl::successful_test_count() const { return SumOverTestCaseList(test_cases_, &TestCase::successful_test_count); } +// Gets the number of skipped tests. +int UnitTestImpl::skipped_test_count() const { + return SumOverTestCaseList(test_cases_, &TestCase::skipped_test_count); +} + // Gets the number of failed tests. int UnitTestImpl::failed_test_count() const { return SumOverTestCaseList(test_cases_, &TestCase::failed_test_count); @@ -2207,6 +2212,16 @@ void TestResult::Clear() { elapsed_time_ = 0; } +// Returns true off the test part was skipped. +static bool TestPartSkipped(const TestPartResult& result) { + return result.skipped(); +} + +// Returns true iff the test was skipped. +bool TestResult::Skipped() const { + return !Failed() && CountIf(test_part_results_, TestPartSkipped) > 0; +} + // Returns true iff the test failed. bool TestResult::Failed() const { for (int i = 0; i < total_part_count(); ++i) { @@ -2511,8 +2526,9 @@ void Test::Run() { internal::UnitTestImpl* const impl = internal::GetUnitTestImpl(); impl->os_stack_trace_getter()->UponLeavingGTest(); internal::HandleExceptionsInMethodIfSupported(this, &Test::SetUp, "SetUp()"); - // We will run the test only if SetUp() was successful. - if (!HasFatalFailure()) { + // We will run the test only if SetUp() was successful and didn't call + // GTEST_SKIP(). + if (!HasFatalFailure() && !IsSkipped()) { impl->os_stack_trace_getter()->UponLeavingGTest(); internal::HandleExceptionsInMethodIfSupported( this, &Test::TestBody, "the test body"); @@ -2537,6 +2553,11 @@ bool Test::HasNonfatalFailure() { HasNonfatalFailure(); } +// Returns true iff the current test was skipped. +bool Test::IsSkipped() { + return internal::GetUnitTestImpl()->current_test_result()->Skipped(); +} + // class TestInfo // Constructs a TestInfo object. It assumes ownership of the test factory @@ -2685,9 +2706,10 @@ void TestInfo::Run() { factory_, &internal::TestFactoryBase::CreateTest, "the test fixture's constructor"); - // Runs the test if the constructor didn't generate a fatal failure. + // Runs the test if the constructor didn't generate a fatal failure or invoke + // GTEST_SKIP(). // Note that the object will not be null - if (!Test::HasFatalFailure()) { + if (!Test::HasFatalFailure() && !Test::IsSkipped()) { // This doesn't throw as all user code that can throw are wrapped into // exception handling code. test->Run(); @@ -2715,6 +2737,11 @@ int TestCase::successful_test_count() const { return CountIf(test_info_list_, TestPassed); } +// Gets the number of successful tests in this test case. +int TestCase::skipped_test_count() const { + return CountIf(test_info_list_, TestSkipped); +} + // Gets the number of failed tests in this test case. int TestCase::failed_test_count() const { return CountIf(test_info_list_, TestFailed); @@ -2866,6 +2893,8 @@ static std::string FormatTestCaseCount(int test_case_c // between the two when viewing the test result. static const char * TestPartResultTypeToString(TestPartResult::Type type) { switch (type) { + case TestPartResult::kSkip: + return "Skipped"; case TestPartResult::kSuccess: return "Success"; @@ -3119,6 +3148,7 @@ class PrettyUnitTestResultPrinter : public TestEventLi private: static void PrintFailedTests(const UnitTest& unit_test); + static void PrintSkippedTests(const UnitTest& unit_test); }; // Fired before each iteration of tests starts. @@ -3187,18 +3217,25 @@ void PrettyUnitTestResultPrinter::OnTestStart(const Te // Called after an assertion failure. void PrettyUnitTestResultPrinter::OnTestPartResult( const TestPartResult& result) { - // If the test part succeeded, we don't need to do anything. - if (result.type() == TestPartResult::kSuccess) - return; - - // Print failure message from the assertion (e.g. expected this and got that). - PrintTestPartResult(result); - fflush(stdout); + switch (result.type()) { + // If the test part succeeded, or was skipped, + // we don't need to do anything. + case TestPartResult::kSkip: + case TestPartResult::kSuccess: + return; + default: + // Print failure message from the assertion + // (e.g. expected this and got that). + PrintTestPartResult(result); + fflush(stdout); + } } void PrettyUnitTestResultPrinter::OnTestEnd(const TestInfo& test_info) { if (test_info.result()->Passed()) { ColoredPrintf(COLOR_GREEN, "[ OK ] "); + } else if (test_info.result()->Skipped()) { + ColoredPrintf(COLOR_GREEN, "[ SKIPPED ] "); } else { ColoredPrintf(COLOR_RED, "[ FAILED ] "); } @@ -3248,7 +3285,7 @@ void PrettyUnitTestResultPrinter::PrintFailedTests(con } for (int j = 0; j < test_case.total_test_count(); ++j) { const TestInfo& test_info = *test_case.GetTestInfo(j); - if (!test_info.should_run() || test_info.result()->Passed()) { + if (!test_info.should_run() || !test_info.result()->Failed()) { continue; } ColoredPrintf(COLOR_RED, "[ FAILED ] "); @@ -3259,6 +3296,30 @@ void PrettyUnitTestResultPrinter::PrintFailedTests(con } } +// Internal helper for printing the list of skipped tests. +void PrettyUnitTestResultPrinter::PrintSkippedTests(const UnitTest& unit_test) { + const int skipped_test_count = unit_test.skipped_test_count(); + if (skipped_test_count == 0) { + return; + } + + for (int i = 0; i < unit_test.total_test_case_count(); ++i) { + const TestCase& test_case = *unit_test.GetTestCase(i); + if (!test_case.should_run() || (test_case.skipped_test_count() == 0)) { + continue; + } + for (int j = 0; j < test_case.total_test_count(); ++j) { + const TestInfo& test_info = *test_case.GetTestInfo(j); + if (!test_info.should_run() || !test_info.result()->Skipped()) { + continue; + } + ColoredPrintf(COLOR_GREEN, "[ SKIPPED ] "); + printf("%s.%s", test_case.name(), test_info.name()); + printf("\n"); + } + } +} + void PrettyUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test, int /*iteration*/) { ColoredPrintf(COLOR_GREEN, "[==========] "); @@ -3273,6 +3334,13 @@ void PrettyUnitTestResultPrinter::OnTestIterationEnd(c ColoredPrintf(COLOR_GREEN, "[ PASSED ] "); printf("%s.\n", FormatTestCount(unit_test.successful_test_count()).c_str()); + const int skipped_test_count = unit_test.skipped_test_count(); + if (skipped_test_count > 0) { + ColoredPrintf(COLOR_GREEN, "[ SKIPPED ] "); + printf("%s, listed below:\n", FormatTestCount(skipped_test_count).c_str()); + PrintSkippedTests(unit_test); + } + int num_failures = unit_test.failed_test_count(); if (!unit_test.Passed()) { const int failed_test_count = unit_test.failed_test_count(); @@ -4540,6 +4608,11 @@ int UnitTest::successful_test_count() const { return impl()->successful_test_count(); } +// Gets the number of skipped tests. +int UnitTest::skipped_test_count() const { + return impl()->skipped_test_count(); +} + // Gets the number of failed tests. int UnitTest::failed_test_count() const { return impl()->failed_test_count(); } @@ -4660,7 +4733,8 @@ void UnitTest::AddTestPartResult( impl_->GetTestPartResultReporterForCurrentThread()-> ReportTestPartResult(result); - if (result_type != TestPartResult::kSuccess) { + if (result_type != TestPartResult::kSuccess && + result_type != TestPartResult::kSkip) { // gtest_break_on_failure takes precedence over // gtest_throw_on_failure. This allows a user to set the latter // in the code (perhaps in order to use Google Test assertions @@ -5169,9 +5243,23 @@ bool UnitTestImpl::RunAllTests() { ForEach(environments_, SetUpEnvironment); repeater->OnEnvironmentsSetUpEnd(*parent_); - // Runs the tests only if there was no fatal failure during global - // set-up. - if (!Test::HasFatalFailure()) { + // Runs the tests only if there was no fatal failure or skip triggered + // during global set-up. + if (Test::IsSkipped()) { + // Emit diagnostics when global set-up calls skip, as it will not be + // emitted by default. + TestResult& test_result = + *internal::GetUnitTestImpl()->current_test_result(); + for (int j = 0; j < test_result.total_part_count(); ++j) { + const TestPartResult& test_part_result = + test_result.GetTestPartResult(j); + if (test_part_result.type() == TestPartResult::kSkip) { + const std::string& result = test_part_result.message(); + printf("%s\n", result.c_str()); + } + } + fflush(stdout); + } else if (!Test::HasFatalFailure()) { for (int test_index = 0; test_index < total_test_case_count(); test_index++) { GetMutableTestCase(test_index)->Run(); Modified: stable/12/contrib/googletest/googletest/test/BUILD.bazel ============================================================================== --- head/contrib/googletest/googletest/test/BUILD.bazel Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/contrib/googletest/googletest/test/BUILD.bazel Thu May 23 01:09:10 2019 (r348138) @@ -311,6 +311,13 @@ cc_binary( deps = ["//:gtest"], ) +cc_test( + name = "gtest_skip_in_environment_setup_test", + size = "small", + srcs = ["gtest_skip_in_environment_setup_test.cc"], + deps = ["//:gtest_main"], +) + py_test( name = "googletest-list-tests-unittest", size = "small", Modified: stable/12/contrib/googletest/googletest/test/googletest-test-part-test.cc ============================================================================== --- head/contrib/googletest/googletest/test/googletest-test-part-test.cc Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/contrib/googletest/googletest/test/googletest-test-part-test.cc Thu May 23 01:09:10 2019 (r348138) @@ -46,9 +46,10 @@ class TestPartResultTest : public Test { TestPartResultTest() : r1_(TestPartResult::kSuccess, "foo/bar.cc", 10, "Success!"), r2_(TestPartResult::kNonFatalFailure, "foo/bar.cc", -1, "Failure!"), - r3_(TestPartResult::kFatalFailure, NULL, -1, "Failure!") {} + r3_(TestPartResult::kFatalFailure, nullptr, -1, "Failure!"), + r4_(TestPartResult::kSkip, "foo/bar.cc", 2, "Skipped!") {} - TestPartResult r1_, r2_, r3_; + TestPartResult r1_, r2_, r3_, r4_; }; @@ -79,6 +80,7 @@ TEST_F(TestPartResultTest, ResultAccessorsWork) { EXPECT_FALSE(success.failed()); EXPECT_FALSE(success.nonfatally_failed()); EXPECT_FALSE(success.fatally_failed()); + EXPECT_FALSE(success.skipped()); const TestPartResult nonfatal_failure(TestPartResult::kNonFatalFailure, "file.cc", @@ -88,6 +90,7 @@ TEST_F(TestPartResultTest, ResultAccessorsWork) { EXPECT_TRUE(nonfatal_failure.failed()); EXPECT_TRUE(nonfatal_failure.nonfatally_failed()); EXPECT_FALSE(nonfatal_failure.fatally_failed()); + EXPECT_FALSE(nonfatal_failure.skipped()); const TestPartResult fatal_failure(TestPartResult::kFatalFailure, "file.cc", @@ -97,6 +100,14 @@ TEST_F(TestPartResultTest, ResultAccessorsWork) { EXPECT_TRUE(fatal_failure.failed()); EXPECT_FALSE(fatal_failure.nonfatally_failed()); EXPECT_TRUE(fatal_failure.fatally_failed()); + EXPECT_FALSE(fatal_failure.skipped()); + + const TestPartResult skip(TestPartResult::kSkip, "file.cc", 42, "message"); + EXPECT_FALSE(skip.passed()); + EXPECT_FALSE(skip.failed()); + EXPECT_FALSE(skip.nonfatally_failed()); + EXPECT_FALSE(skip.fatally_failed()); + EXPECT_TRUE(skip.skipped()); } // Tests TestPartResult::type(). @@ -104,23 +115,27 @@ TEST_F(TestPartResultTest, type) { EXPECT_EQ(TestPartResult::kSuccess, r1_.type()); EXPECT_EQ(TestPartResult::kNonFatalFailure, r2_.type()); EXPECT_EQ(TestPartResult::kFatalFailure, r3_.type()); + EXPECT_EQ(TestPartResult::kSkip, r4_.type()); } // Tests TestPartResult::file_name(). TEST_F(TestPartResultTest, file_name) { EXPECT_STREQ("foo/bar.cc", r1_.file_name()); EXPECT_STREQ(NULL, r3_.file_name()); + EXPECT_STREQ("foo/bar.cc", r4_.file_name()); } // Tests TestPartResult::line_number(). TEST_F(TestPartResultTest, line_number) { EXPECT_EQ(10, r1_.line_number()); EXPECT_EQ(-1, r2_.line_number()); + EXPECT_EQ(2, r4_.line_number()); } // Tests TestPartResult::message(). TEST_F(TestPartResultTest, message) { EXPECT_STREQ("Success!", r1_.message()); + EXPECT_STREQ("Skipped!", r4_.message()); } // Tests TestPartResult::passed(). @@ -128,6 +143,7 @@ TEST_F(TestPartResultTest, Passed) { EXPECT_TRUE(r1_.passed()); EXPECT_FALSE(r2_.passed()); EXPECT_FALSE(r3_.passed()); + EXPECT_FALSE(r4_.passed()); } // Tests TestPartResult::failed(). @@ -135,13 +151,23 @@ TEST_F(TestPartResultTest, Failed) { EXPECT_FALSE(r1_.failed()); EXPECT_TRUE(r2_.failed()); EXPECT_TRUE(r3_.failed()); + EXPECT_FALSE(r4_.failed()); } +// Tests TestPartResult::failed(). +TEST_F(TestPartResultTest, Skipped) { + EXPECT_FALSE(r1_.skipped()); + EXPECT_FALSE(r2_.skipped()); + EXPECT_FALSE(r3_.skipped()); + EXPECT_TRUE(r4_.skipped()); +} + // Tests TestPartResult::fatally_failed(). TEST_F(TestPartResultTest, FatallyFailed) { EXPECT_FALSE(r1_.fatally_failed()); EXPECT_FALSE(r2_.fatally_failed()); EXPECT_TRUE(r3_.fatally_failed()); + EXPECT_FALSE(r4_.fatally_failed()); } // Tests TestPartResult::nonfatally_failed(). @@ -149,6 +175,7 @@ TEST_F(TestPartResultTest, NonfatallyFailed) { EXPECT_FALSE(r1_.nonfatally_failed()); EXPECT_TRUE(r2_.nonfatally_failed()); EXPECT_FALSE(r3_.nonfatally_failed()); + EXPECT_FALSE(r4_.nonfatally_failed()); } // Tests the TestPartResultArray class. Modified: stable/12/contrib/googletest/googletest/test/gtest_all_test.cc ============================================================================== --- head/contrib/googletest/googletest/test/gtest_all_test.cc Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/contrib/googletest/googletest/test/gtest_all_test.cc Thu May 23 01:09:10 2019 (r348138) @@ -37,10 +37,11 @@ #include "test/googletest-message-test.cc" #include "test/googletest-options-test.cc" #include "test/googletest-port-test.cc" -#include "test/gtest_pred_impl_unittest.cc" -#include "test/gtest_prod_test.cc" #include "test/googletest-test-part-test.cc" -#include "test/gtest-typed-test_test.cc" #include "test/gtest-typed-test2_test.cc" +#include "test/gtest-typed-test_test.cc" +#include "test/gtest_pred_impl_unittest.cc" +#include "test/gtest_prod_test.cc" +#include "test/gtest_skip_test.cc" #include "test/gtest_unittest.cc" #include "test/production.cc" Copied: stable/12/contrib/googletest/googletest/test/gtest_skip_in_environment_setup_test.cc (from r345770, head/contrib/googletest/googletest/test/gtest_skip_in_environment_setup_test.cc) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/contrib/googletest/googletest/test/gtest_skip_in_environment_setup_test.cc Thu May 23 01:09:10 2019 (r348138, copy of r345770, head/contrib/googletest/googletest/test/gtest_skip_in_environment_setup_test.cc) @@ -0,0 +1,60 @@ +// Copyright 2019, Google Inc. +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * 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. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// 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. +// +// This test verifies that skipping in the environment results in the +// testcases being skipped. +// +// This is a reproduction case for +// https://github.com/google/googletest/issues/2189 . + +#include +#include + +class SetupEnvironment : public testing::Environment { +public: + void SetUp() override { + GTEST_SKIP() << "Skipping the entire environment"; + } +}; + +TEST(Test, AlwaysPasses) { + EXPECT_EQ(true, true); +} + +TEST(Test, AlwaysFails) { + EXPECT_EQ(true, false); +} + +int main(int argc, char **argv) { + testing::InitGoogleTest(&argc, argv); + + testing::AddGlobalTestEnvironment(new SetupEnvironment()); + + return (RUN_ALL_TESTS()); +} Copied: stable/12/contrib/googletest/googletest/test/gtest_skip_test.cc (from r345353, head/contrib/googletest/googletest/test/gtest_skip_test.cc) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/contrib/googletest/googletest/test/gtest_skip_test.cc Thu May 23 01:09:10 2019 (r348138, copy of r345353, head/contrib/googletest/googletest/test/gtest_skip_test.cc) @@ -0,0 +1,55 @@ +// Copyright 2008 Google Inc. +// All Rights Reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * 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. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// 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. +// +// Author: arseny.aprelev@gmail.com (Arseny Aprelev) +// + +#include "gtest/gtest.h" + +using ::testing::Test; + +TEST(SkipTest, DoesSkip) { + GTEST_SKIP(); + EXPECT_EQ(0, 1); +} + +class Fixture : public Test { + protected: + void SetUp() override { + GTEST_SKIP() << "skipping all tests for this fixture"; + } +}; + +TEST_F(Fixture, SkipsOneTest) { + EXPECT_EQ(5, 7); +} + +TEST_F(Fixture, SkipsAnotherTest) { + EXPECT_EQ(99, 100); +} Modified: stable/12/contrib/mandoc/lib.in ============================================================================== --- stable/12/contrib/mandoc/lib.in Thu May 23 00:59:05 2019 (r348137) +++ stable/12/contrib/mandoc/lib.in Thu May 23 01:09:10 2019 (r348138) @@ -62,7 +62,9 @@ LINE("libfsid", "Filesystem Identification Library (l LINE("libftpio", "FTP Connection Management Library (libftpio, \\-lftpio)") LINE("libform", "Curses Form Library (libform, \\-lform)") LINE("libgeom", "Userland API Library for Kernel GEOM subsystem (libgeom, \\-lgeom)") +LINE("libgmock", "GoogleMock library (libgmock, \\-lgmock)") LINE("libgpio", "General-Purpose Input Output (GPIO) library (libgpio, \\-lgpio)") +LINE("libgtest", "GoogleTest library (libgtest, \\-lgtest)") LINE("libhammer", "HAMMER Filesystem Userland Library (libhammer, \\-lhammer)") LINE("libi386", "i386 Architecture Library (libi386, \\-li386)") LINE("libintl", "Internationalized Message Handling Library (libintl, \\-lintl)") Modified: stable/12/etc/mtree/BSD.tests.dist ============================================================================== --- stable/12/etc/mtree/BSD.tests.dist Thu May 23 00:59:05 2019 (r348137) +++ stable/12/etc/mtree/BSD.tests.dist Thu May 23 01:09:10 2019 (r348138) @@ -270,6 +270,16 @@ test-programs .. .. + googletest + gmock + .. + gmock_main + .. + gtest + .. + gtest_main + .. + .. libarchive .. libbe @@ -423,6 +433,8 @@ examples tests atf + .. + googletest .. plain .. Modified: stable/12/etc/mtree/BSD.usr.dist ============================================================================== --- stable/12/etc/mtree/BSD.usr.dist Thu May 23 00:59:05 2019 (r348137) +++ stable/12/etc/mtree/BSD.usr.dist Thu May 23 01:09:10 2019 (r348138) @@ -13,6 +13,18 @@ .. event .. + gmock + internal + custom + .. + .. + .. + gtest + internal + custom + .. + .. + .. sqlite3 .. ucl Modified: stable/12/lib/Makefile ============================================================================== --- stable/12/lib/Makefile Thu May 23 00:59:05 2019 (r348137) +++ stable/12/lib/Makefile Thu May 23 01:09:10 2019 (r348138) @@ -170,6 +170,7 @@ _libcplusplus+= libc++fs .endif SUBDIR.${MK_EFI}+= libefivar +SUBDIR.${MK_GOOGLETEST}+= googletest SUBDIR.${MK_LIBTHR}+= libthr SUBDIR.${MK_LLVM_LIBUNWIND}+= libgcc_eh SUBDIR.${MK_LLVM_LIBUNWIND}+= libgcc_s Modified: stable/12/lib/clang/llvm.build.mk ============================================================================== --- stable/12/lib/clang/llvm.build.mk Thu May 23 00:59:05 2019 (r348137) +++ stable/12/lib/clang/llvm.build.mk Thu May 23 01:09:10 2019 (r348138) @@ -101,7 +101,7 @@ CFLAGS+= -ffunction-sections CFLAGS+= -fdata-sections LDFLAGS+= -Wl,--gc-sections -CXXFLAGS+= -std=c++11 +CXXSTD?= c++11 CXXFLAGS+= -fno-exceptions CXXFLAGS+= -fno-rtti CXXFLAGS.clang+= -stdlib=libc++ Modified: stable/12/lib/googletest/gtest_main/tests/Makefile ============================================================================== --- head/lib/googletest/gtest_main/tests/Makefile Fri Mar 15 21:43:52 2019 (r345203) +++ stable/12/lib/googletest/gtest_main/tests/Makefile Thu May 23 01:09:10 2019 (r348138) @@ -18,6 +18,8 @@ GTESTS+= gtest_prod_test GTESTS+= gtest_sole_header_test GTESTS+= googletest-test-part-test GTESTS+= gtest-typed-test_test +GTESTS+= gtest_skip_test +GTESTS+= gtest_skip_in_environment_setup_test GTESTS+= gtest_unittest CXXFLAGS+= -I${GOOGLETEST_SRCROOT}/include Modified: stable/12/lib/libc++/Makefile ============================================================================== --- stable/12/lib/libc++/Makefile Thu May 23 00:59:05 2019 (r348137) +++ stable/12/lib/libc++/Makefile Thu May 23 01:09:10 2019 (r348138) @@ -76,9 +76,7 @@ CFLAGS+= -nostdinc++ CFLAGS+= -nostdlib CFLAGS+= -D_LIBCPP_BUILDING_LIBRARY CFLAGS+= -DLIBCXXRT -.if empty(CXXFLAGS:M-std=*) -CXXFLAGS+= -std=c++11 -.endif +CXXSTD?= c++11 LIBADD+= cxxrt INCSGROUPS= STD EXP EXT Modified: stable/12/lib/libc++experimental/Makefile ============================================================================== --- stable/12/lib/libc++experimental/Makefile Thu May 23 00:59:05 2019 (r348137) +++ stable/12/lib/libc++experimental/Makefile Thu May 23 01:09:10 2019 (r348138) @@ -20,8 +20,6 @@ CXXFLAGS+= -nostdinc++ CXXFLAGS+= -nostdlib CXXFLAGS+= -D_LIBCPP_BUILDING_LIBRARY CXXFLAGS+= -DLIBCXXRT -.if empty(CXXFLAGS:M-std=*) -CXXFLAGS+= -std=c++14 -.endif +CXXSTD?= c++14 .include Modified: stable/12/lib/libc++fs/Makefile ============================================================================== --- stable/12/lib/libc++fs/Makefile Thu May 23 00:59:05 2019 (r348137) +++ stable/12/lib/libc++fs/Makefile Thu May 23 01:09:10 2019 (r348138) @@ -22,8 +22,6 @@ CXXFLAGS+= -nostdinc++ CXXFLAGS+= -nostdlib CXXFLAGS+= -D_LIBCPP_BUILDING_LIBRARY CXXFLAGS+= -DLIBCXXRT -.if empty(CXXFLAGS:M-std=*) -CXXFLAGS+= -std=c++14 -.endif +CXXSTD?= c++14 .include Modified: stable/12/lib/libc/tests/stdlib/Makefile ============================================================================== --- stable/12/lib/libc/tests/stdlib/Makefile Thu May 23 00:59:05 2019 (r348137) +++ stable/12/lib/libc/tests/stdlib/Makefile Thu May 23 01:09:10 2019 (r348138) @@ -49,8 +49,8 @@ PROGS+= h_getopt h_getopt_long CFLAGS+= -I${.CURDIR} -CXXFLAGS.cxa_thread_atexit_test+= -std=c++11 -CXXFLAGS.cxa_thread_atexit_nothr_test+= -std=c++11 +CXXSTD.cxa_thread_atexit_test= c++11 +CXXSTD.cxa_thread_atexit_nothr_test= c++11 LIBADD.cxa_thread_atexit_test+= pthread .for t in h_getopt h_getopt_long Modified: stable/12/lib/libclang_rt/Makefile.inc ============================================================================== --- stable/12/lib/libclang_rt/Makefile.inc Thu May 23 00:59:05 2019 (r348137) +++ stable/12/lib/libclang_rt/Makefile.inc Thu May 23 01:09:10 2019 (r348138) @@ -41,4 +41,4 @@ CFLAGS+= -funwind-tables CXXFLAGS+= -fvisibility-inlines-hidden CXXFLAGS+= -fvisibility=hidden CFLAGS+= -I${CRTSRC}/lib -CXXFLAGS+= -std=c++11 +CXXSTD= c++11 Modified: stable/12/lib/libcxxrt/Makefile ============================================================================== --- stable/12/lib/libcxxrt/Makefile Thu May 23 00:59:05 2019 (r348137) +++ stable/12/lib/libcxxrt/Makefile Thu May 23 01:09:10 2019 (r348138) @@ -22,9 +22,7 @@ SRCS+= libelftc_dem_gnu3.c\ WARNS= 0 CFLAGS+= -isystem ${SRCDIR} -nostdinc++ -.if empty(CXXFLAGS:M-std=*) -CXXFLAGS+= -std=c++11 -.endif +CXXSTD?= c++11 VERSION_MAP= ${.CURDIR}/Version.map .include Modified: stable/12/lib/libgcc_eh/Makefile.inc ============================================================================== --- stable/12/lib/libgcc_eh/Makefile.inc Thu May 23 00:59:05 2019 (r348137) +++ stable/12/lib/libgcc_eh/Makefile.inc Thu May 23 01:09:10 2019 (r348138) @@ -27,10 +27,8 @@ CXXFLAGS.${file}+= -fno-exceptions -funwind-tables .endfor CFLAGS+= -I${UNWINDINCDIR} -I${.CURDIR} -D_LIBUNWIND_IS_NATIVE_ONLY -.if empty(CXXFLAGS:M-std=*) -CXXFLAGS+= -std=c++11 -.endif CXXFLAGS+= -fno-rtti +CXXSTD?= c++11 STATIC_CXXFLAGS+= -fvisibility=hidden -fPIC # Probably need to just move this earlier or use CXXFLAGS .if ${MK_DIRDEPS_BUILD} == "yes" Modified: stable/12/lib/libomp/Makefile ============================================================================== --- stable/12/lib/libomp/Makefile Thu May 23 00:59:05 2019 (r348137) +++ stable/12/lib/libomp/Makefile Thu May 23 01:09:10 2019 (r348138) @@ -53,9 +53,9 @@ CFLAGS+= -I${ITTSRC} CFLAGS+= -ffunction-sections CFLAGS+= -fdata-sections CXXFLAGS+= -fvisibility-inlines-hidden -CXXFLAGS+= -std=c++11 CXXFLAGS+= -fno-exceptions CXXFLAGS+= -fno-rtti +CXXSTD= c++11 LDFLAGS+= -Wl,--warn-shared-textrel LDFLAGS+= -Wl,--gc-sections Modified: stable/12/lib/ofed/libibnetdisc/Makefile ============================================================================== --- stable/12/lib/ofed/libibnetdisc/Makefile Thu May 23 00:59:05 2019 (r348137) +++ stable/12/lib/ofed/libibnetdisc/Makefile Thu May 23 01:09:10 2019 (r348138) @@ -32,7 +32,7 @@ CFLAGS+= -DHAVE_CONFIG_H=1 CFLAGS+= -I${_spath} CFLAGS+= -I${SYSROOT:U${DESTDIR}}/${INCLUDEDIR}/infiniband .if ${COMPILER_FEATURES:Mc++11} -CXXFLAGS+= -std=c++11 +CXXSTD= c++11 .endif VERSION_MAP= ${_spath}/libibnetdisc.map Modified: stable/12/share/examples/tests/tests/Makefile ============================================================================== --- stable/12/share/examples/tests/tests/Makefile Thu May 23 00:59:05 2019 (r348137) +++ stable/12/share/examples/tests/tests/Makefile Thu May 23 01:09:10 2019 (r348138) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + # Directory into which the Kyuafile provided by this directory will be # installed. # @@ -20,6 +22,10 @@ TESTS_SUBDIRS+= atf TESTS_SUBDIRS+= plain TESTS_SUBDIRS+= tap + +.if ${MK_GOOGLETEST} != no +TESTS_SUBDIRS+= googletest +.endif # We leave KYUAFILE unset so that bsd.test.mk auto-generates a Kyuafile # for us based on the contents of the TESTS_SUBDIRS line above. The Modified: stable/12/share/mk/Makefile ============================================================================== --- stable/12/share/mk/Makefile Thu May 23 00:59:05 2019 (r348137) +++ stable/12/share/mk/Makefile Thu May 23 01:09:10 2019 (r348138) @@ -73,6 +73,8 @@ FILESDIR= ${BINDIR}/mk *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Thu May 23 01:13:13 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 144401593A58; Thu, 23 May 2019 01:13:13 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ADE5B73C40; Thu, 23 May 2019 01:13:12 +0000 (UTC) (envelope-from ngie@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6DFCB25A7D; Thu, 23 May 2019 01:13:12 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4N1DCOq020397; Thu, 23 May 2019 01:13:12 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4N1DCbF020396; Thu, 23 May 2019 01:13:12 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201905230113.x4N1DCbF020396@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Enji Cooper Date: Thu, 23 May 2019 01:13:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348139 - stable/12/share/man/man5 X-SVN-Group: stable-12 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: stable/12/share/man/man5 X-SVN-Commit-Revision: 348139 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: ADE5B73C40 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.949,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 01:13:13 -0000 Author: ngie Date: Thu May 23 01:13:12 2019 New Revision: 348139 URL: https://svnweb.freebsd.org/changeset/base/348139 Log: Regenerate src.conf(5) after r348138 Modified: stable/12/share/man/man5/src.conf.5 Modified: stable/12/share/man/man5/src.conf.5 ============================================================================== --- stable/12/share/man/man5/src.conf.5 Thu May 23 01:09:10 2019 (r348138) +++ stable/12/share/man/man5/src.conf.5 Thu May 23 01:13:12 2019 (r348139) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd March 29, 2019 +.Dd May 22, 2019 .Dt SRC.CONF 5 .Os .Sh NAME @@ -384,10 +384,6 @@ is set explicitly) (unless .Va WITH_LLVM_TARGET_POWERPC is set explicitly) -.It Va WITHOUT_LLVM_TARGET_RISCV -(unless -.Va WITH_LLVM_TARGET_RISCV -is set explicitly) .It Va WITHOUT_LLVM_TARGET_SPARC (unless .Va WITH_LLVM_TARGET_SPARC @@ -822,6 +818,11 @@ Set to not build GNU Set this option to include GNU extensions in .Xr bsdgrep 1 by linking against libgnuregex. +.It Va WITHOUT_GOOGLETEST +Set to neither build nor install +.Lb libgmock , +.Lb libgtest , +and dependent tests. .It Va WITHOUT_GPIO Set to not build .Xr gpioctl 8 @@ -1198,20 +1199,11 @@ option should be used rather than this in most cases. .Pp This is a default setting on amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. -.It Va WITHOUT_LLVM_TARGET_RISCV -Set to not build LLVM target support for RISC-V. -The -.Va LLVM_TARGET_ALL -option should be used rather than this in most cases. -.Pp -This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, and sparc/sparc64. .It Va WITH_LLVM_TARGET_RISCV Set to build LLVM target support for RISC-V. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. -.Pp .It Va WITHOUT_LLVM_TARGET_SPARC Set to not build LLVM target support for SPARC. The @@ -1816,6 +1808,10 @@ When set, it enforces these options: When set, these options are also in effect: .Pp .Bl -inset -compact +.It Va WITHOUT_GOOGLETEST +(unless +.Va WITH_GOOGLETEST +is set explicitly) .It Va WITHOUT_TESTS_SUPPORT (unless .Va WITH_TESTS_SUPPORT @@ -1823,6 +1819,12 @@ is set explicitly) .El .It Va WITHOUT_TESTS_SUPPORT Set to disables the build of all test-related dependencies, including ATF. +When set, it enforces these options: +.Pp +.Bl -item -compact +.It +.Va WITHOUT_GOOGLETEST +.El .It Va WITHOUT_TEXTPROC Set to not build programs used for text processing. From owner-svn-src-stable@freebsd.org Thu May 23 01:25:36 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80AF71593EE3; Thu, 23 May 2019 01:25:36 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1E1A4747F2; Thu, 23 May 2019 01:25:36 +0000 (UTC) (envelope-from ngie@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CFB9E25C31; Thu, 23 May 2019 01:25:35 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4N1PZlh025999; Thu, 23 May 2019 01:25:35 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4N1PYOr025994; Thu, 23 May 2019 01:25:34 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201905230125.x4N1PYOr025994@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Enji Cooper Date: Thu, 23 May 2019 01:25:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348140 - in stable/12: . tests/sys/opencrypto X-SVN-Group: stable-12 X-SVN-Commit-Author: ngie X-SVN-Commit-Paths: in stable/12: . tests/sys/opencrypto X-SVN-Commit-Revision: 348140 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1E1A4747F2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.95)[-0.949,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 01:25:36 -0000 Author: ngie Date: Thu May 23 01:25:34 2019 New Revision: 348140 URL: https://svnweb.freebsd.org/changeset/base/348140 Log: MFC r346431,r347417,r348019: r346431 (by lwhsu): Specify using Python2, these .py files have not been converted to use Python3 yet, but the default Python version in ports has been switched to 3. r347417: Refactor tests/sys/opencrypto/runtests * Convert from plain to TAP for slightly improved introspection when skipping the tests due to requirements not being met. * Test for the net/py-dpkt (origin) package being required when running the tests, instead of relying on a copy of the dpkt.py module from 2014. This enables the tests to work with py3. Subsequently, remove `tests/sys/opencrypto/dpkt.py(c)?` via `make delete-old`. * Parameterize out `python2` as `$PYTHON`. PR: 237403 r348019: Allow the end-user to pass along arguments to cryptotest.py via `$CRYPTOTEST_ARGS` This allows someone to use `-v` to dump out standard output. Deleted: stable/12/tests/sys/opencrypto/dpkt.py Modified: stable/12/ObsoleteFiles.inc stable/12/tests/sys/opencrypto/Makefile stable/12/tests/sys/opencrypto/cryptodev.py stable/12/tests/sys/opencrypto/cryptotest.py stable/12/tests/sys/opencrypto/runtests.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/ObsoleteFiles.inc ============================================================================== --- stable/12/ObsoleteFiles.inc Thu May 23 01:13:12 2019 (r348139) +++ stable/12/ObsoleteFiles.inc Thu May 23 01:25:34 2019 (r348140) @@ -38,6 +38,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20190509: tests/sys/opencrypto requires the net/py-dpkt package. +OLD_FILES+=usr/tests/sys/opencrypto/dpkt.py +OLD_FILES+=usr/tests/sys/opencrypto/dpkt.pyc # 20190412: new libc++ import which bumps version from 7.0.1 to 8.0.0. OLD_FILES+=usr/include/c++/v1/experimental/dynarray # 20190412: new clang import which bumps version from 7.0.1 to 8.0.0. Modified: stable/12/tests/sys/opencrypto/Makefile ============================================================================== --- stable/12/tests/sys/opencrypto/Makefile Thu May 23 01:13:12 2019 (r348139) +++ stable/12/tests/sys/opencrypto/Makefile Thu May 23 01:25:34 2019 (r348140) @@ -12,12 +12,12 @@ CFLAGS.poly1305_test.c += -I${SRCTOP}/sys/opencrypto ATF_TESTS_C+= blake2_test poly1305_test -PLAIN_TESTS_SH= runtests +TAP_TESTS_SH+= runtests -TEST_METADATA.runtests+= required_programs="python" +TEST_METADATA.runtests+= required_programs="python2" TEST_METADATA.runtests+= required_user="root" -PYMODULES= cryptodev.py cryptodevh.py cryptotest.py dpkt.py +PYMODULES= cryptodev.py cryptodevh.py cryptotest.py ${PACKAGE}FILES+= ${PYMODULES} Modified: stable/12/tests/sys/opencrypto/cryptodev.py ============================================================================== --- stable/12/tests/sys/opencrypto/cryptodev.py Thu May 23 01:13:12 2019 (r348139) +++ stable/12/tests/sys/opencrypto/cryptodev.py Thu May 23 01:25:34 2019 (r348140) @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/local/bin/python2 # # Copyright (c) 2014 The FreeBSD Foundation # Copyright 2014 John-Mark Gurney Modified: stable/12/tests/sys/opencrypto/cryptotest.py ============================================================================== --- stable/12/tests/sys/opencrypto/cryptotest.py Thu May 23 01:13:12 2019 (r348139) +++ stable/12/tests/sys/opencrypto/cryptotest.py Thu May 23 01:25:34 2019 (r348140) @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/local/bin/python2 # # Copyright (c) 2014 The FreeBSD Foundation # All rights reserved. Modified: stable/12/tests/sys/opencrypto/runtests.sh ============================================================================== --- stable/12/tests/sys/opencrypto/runtests.sh Thu May 23 01:13:12 2019 (r348139) +++ stable/12/tests/sys/opencrypto/runtests.sh Thu May 23 01:25:34 2019 (r348140) @@ -29,13 +29,18 @@ # $FreeBSD$ # -set -ex +: ${PYTHON=python2} if [ ! -d /usr/local/share/nist-kat ]; then - echo 'Skipping, nist-kat package not installed for test vectors.' + echo "1..0 # SKIP: nist-kat package not installed for test vectors" exit 0 fi +if ! $PYTHON -c "from dpkt import dpkt"; then + echo "1..0 # SKIP: py-dpkt package not installed" + exit 0 +fi + loaded_modules= cleanup_tests() { @@ -43,6 +48,10 @@ cleanup_tests() set +e + if [ -n "$oldcdas" ]; then + sysctl "$oldcdas" 2>/dev/null + fi + # Unload modules in reverse order for loaded_module in $(echo $loaded_modules | tr ' ' '\n' | sort -r); do kldunload $loaded_module @@ -52,15 +61,28 @@ trap cleanup_tests EXIT INT TERM for required_module in nexus/aesni cryptodev; do if ! kldstat -q -m $required_module; then - kldload ${required_module#nexus/} + module_to_load=${required_module#nexus/} + if ! kldload ${module_to_load}; then + echo "1..0 # SKIP: could not load ${module_to_load}" + exit 0 + fi loaded_modules="$loaded_modules $required_module" fi done -# Run software crypto test -oldcdas=$(sysctl -e kern.cryptodevallowsoft) -sysctl kern.cryptodevallowsoft=1 +cdas_sysctl=kern.cryptodevallowsoft +if ! oldcdas=$(sysctl -e $cdas_sysctl); then + echo "1..0 # SKIP: could not resolve sysctl: $cdas_sysctl" + exit 0 +fi +if ! sysctl $cdas_sysctl=1; then + echo "1..0 # SKIP: could not enable /dev/crypto access via $cdas_sysctl sysctl." + exit 0 +fi -python $(dirname $0)/cryptotest.py - -sysctl "$oldcdas" +echo "1..1" +if "$PYTHON" $(dirname $0)/cryptotest.py $CRYPTOTEST_ARGS; then + echo "ok 1" +else + echo "not ok 1" +fi From owner-svn-src-stable@freebsd.org Thu May 23 02:12:02 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D87BA1594C02; Thu, 23 May 2019 02:12:01 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7FB887604B; Thu, 23 May 2019 02:12:01 +0000 (UTC) (envelope-from ian@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 596102646B; Thu, 23 May 2019 02:12:01 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4N2C1G3052192; Thu, 23 May 2019 02:12:01 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4N2C1W6052191; Thu, 23 May 2019 02:12:01 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201905230212.x4N2C1W6052191@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Thu, 23 May 2019 02:12:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348145 - stable/12/tools/boot X-SVN-Group: stable-12 X-SVN-Commit-Author: ian X-SVN-Commit-Paths: stable/12/tools/boot X-SVN-Commit-Revision: 348145 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7FB887604B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 02:12:02 -0000 Author: ian Date: Thu May 23 02:12:00 2019 New Revision: 348145 URL: https://svnweb.freebsd.org/changeset/base/348145 Log: MFC r346652-r346654 r346652: Complain and exit the script if the 'make install' phase fails. Also, there is no need to install any debug files. r346653: The zfs module has grown a dependency on zcl_nfs4.ko, so copy it into all the test images. r346654: For the geli-gpt-zfs test images, both bios and uefi flavors, add a dummy ufs partition as p2, and put the zfs partition at p3, to test the ability of the zfs probe code to find a zfs pool on something other than the first partition. Modified: stable/12/tools/boot/rootgen.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/tools/boot/rootgen.sh ============================================================================== --- stable/12/tools/boot/rootgen.sh Thu May 23 02:10:41 2019 (r348144) +++ stable/12/tools/boot/rootgen.sh Thu May 23 02:12:00 2019 (r348145) @@ -130,6 +130,7 @@ mk_nogeli_gpt_zfs_legacy() { zfs_load=YES opensolaris_load=YES EOF + cp /boot/kernel/acl_nfs4.ko ${mntpt}/boot/kernel/acl_nfs4.ko cp /boot/kernel/zfs.ko ${mntpt}/boot/kernel/zfs.ko cp /boot/kernel/opensolaris.ko ${mntpt}/boot/kernel/opensolaris.ko # end tweaks @@ -168,6 +169,7 @@ mk_nogeli_gpt_zfs_uefi() { zfs_load=YES opensolaris_load=YES EOF + cp /boot/kernel/acl_nfs4.ko ${mntpt}/boot/kernel/acl_nfs4.ko cp /boot/kernel/zfs.ko ${mntpt}/boot/kernel/zfs.ko cp /boot/kernel/opensolaris.ko ${mntpt}/boot/kernel/opensolaris.ko # end tweaks @@ -207,6 +209,7 @@ mk_nogeli_gpt_zfs_both() { zfs_load=YES opensolaris_load=YES EOF + cp /boot/kernel/acl_nfs4.ko ${mntpt}/boot/kernel/acl_nfs4.ko cp /boot/kernel/zfs.ko ${mntpt}/boot/kernel/zfs.ko cp /boot/kernel/opensolaris.ko ${mntpt}/boot/kernel/opensolaris.ko # end tweaks @@ -288,6 +291,7 @@ mk_nogeli_mbr_zfs_legacy() { zfs_load=YES opensolaris_load=YES EOF + cp /boot/kernel/acl_nfs4.ko ${mntpt}/boot/kernel/acl_nfs4.ko cp /boot/kernel/zfs.ko ${mntpt}/boot/kernel/zfs.ko cp /boot/kernel/opensolaris.ko ${mntpt}/boot/kernel/opensolaris.ko # end tweaks @@ -329,6 +333,7 @@ mk_nogeli_mbr_zfs_uefi() { zfs_load=YES opensolaris_load=YES EOF + cp /boot/kernel/acl_nfs4.ko ${mntpt}/boot/kernel/acl_nfs4.ko cp /boot/kernel/zfs.ko ${mntpt}/boot/kernel/zfs.ko cp /boot/kernel/opensolaris.ko ${mntpt}/boot/kernel/opensolaris.ko # end tweaks @@ -370,6 +375,7 @@ mk_nogeli_mbr_zfs_both() { zfs_load=YES opensolaris_load=YES EOF + cp /boot/kernel/acl_nfs4.ko ${mntpt}/boot/kernel/acl_nfs4.ko cp /boot/kernel/zfs.ko ${mntpt}/boot/kernel/zfs.ko cp /boot/kernel/opensolaris.ko ${mntpt}/boot/kernel/opensolaris.ko # end tweaks @@ -501,15 +507,20 @@ mk_geli_gpt_zfs_legacy() { bios=$7 pool=geli-gpt-zfs-legacy - dd if=/dev/zero of=${img} count=1 seek=$(( 200 * 1024 * 1024 / 512 )) + # Note that in this flavor we create an empty p2 ufs partition, and put + # the bootable zfs stuff on p3, just to test the ability of the zfs probe + # probe routines to find a pool on a partition other than the first one. + + dd if=/dev/zero of=${img} count=1 seek=$(( 300 * 1024 * 1024 / 512 )) md=$(mdconfig -f ${img}) gpart create -s gpt ${md} gpart add -t freebsd-boot -s 400k -a 4k ${md} # <= ~540k + gpart add -t freebsd-ufs -s 100m ${md} gpart add -t freebsd-zfs -l root $md # install-boot will make this bootable - echo ${passphrase} | geli init -bg -e AES-XTS -i ${iterations} -J - -l 256 -s 4096 ${md}p2 - echo ${passphrase} | geli attach -j - ${md}p2 - zpool create -O mountpoint=none -R ${mntpt} ${pool} ${md}p2.eli + echo ${passphrase} | geli init -bg -e AES-XTS -i ${iterations} -J - -l 256 -s 4096 ${md}p3 + echo ${passphrase} | geli attach -j - ${md}p3 + zpool create -O mountpoint=none -R ${mntpt} ${pool} ${md}p3.eli zpool set bootfs=${pool} ${pool} zfs create -po mountpoint=/ ${pool}/ROOT/default # NB: The online guides go nuts customizing /var and other mountpoints here, no need @@ -520,6 +531,7 @@ zfs_load=YES opensolaris_load=YES geom_eli_load=YES EOF + cp /boot/kernel/acl_nfs4.ko ${mntpt}/boot/kernel/acl_nfs4.ko cp /boot/kernel/zfs.ko ${mntpt}/boot/kernel/zfs.ko cp /boot/kernel/opensolaris.ko ${mntpt}/boot/kernel/opensolaris.ko cp /boot/kernel/geom_eli.ko ${mntpt}/boot/kernel/geom_eli.ko @@ -529,7 +541,7 @@ EOF zpool set bootfs=${pool}/ROOT/default ${pool} zpool set autoexpand=on ${pool} zpool export ${pool} - geli detach ${md}p2 + geli detach ${md}p3 ${SRCTOP}/tools/boot/install-boot.sh -g ${geli} -s ${scheme} -f ${fs} -b ${bios} -d ${src} ${md} mdconfig -d -u ${md} } @@ -544,15 +556,20 @@ mk_geli_gpt_zfs_uefi() { bios=$7 pool=geli-gpt-zfs-uefi - dd if=/dev/zero of=${img} count=1 seek=$(( 200 * 1024 * 1024 / 512 )) + # Note that in this flavor we create an empty p2 ufs partition, and put + # the bootable zfs stuff on p3, just to test the ability of the zfs probe + # probe routines to find a pool on a partition other than the first one. + + dd if=/dev/zero of=${img} count=1 seek=$(( 300 * 1024 * 1024 / 512 )) md=$(mdconfig -f ${img}) gpart create -s gpt ${md} gpart add -t efi -s 800k -a 4k ${md} + gpart add -t freebsd-ufs -s 100m ${md} gpart add -t freebsd-zfs -l root $md # install-boot will make this bootable - echo ${passphrase} | geli init -bg -e AES-XTS -i ${iterations} -J - -l 256 -s 4096 ${md}p2 - echo ${passphrase} | geli attach -j - ${md}p2 - zpool create -O mountpoint=none -R ${mntpt} ${pool} ${md}p2.eli + echo ${passphrase} | geli init -bg -e AES-XTS -i ${iterations} -J - -l 256 -s 4096 ${md}p3 + echo ${passphrase} | geli attach -j - ${md}p3 + zpool create -O mountpoint=none -R ${mntpt} ${pool} ${md}p3.eli zpool set bootfs=${pool} ${pool} zfs create -po mountpoint=/ ${pool}/ROOT/default # NB: The online guides go nuts customizing /var and other mountpoints here, no need @@ -563,6 +580,7 @@ zfs_load=YES opensolaris_load=YES geom_eli_load=YES EOF + cp /boot/kernel/acl_nfs4.ko ${mntpt}/boot/kernel/acl_nfs4.ko cp /boot/kernel/zfs.ko ${mntpt}/boot/kernel/zfs.ko cp /boot/kernel/opensolaris.ko ${mntpt}/boot/kernel/opensolaris.ko cp /boot/kernel/geom_eli.ko ${mntpt}/boot/kernel/geom_eli.ko @@ -572,7 +590,7 @@ EOF zpool set bootfs=${pool}/ROOT/default ${pool} zpool set autoexpand=on ${pool} zpool export ${pool} - geli detach ${md}p2 + geli detach ${md}p3 ${SRCTOP}/tools/boot/install-boot.sh -g ${geli} -s ${scheme} -f ${fs} -b ${bios} -d ${src} ${md} mdconfig -d -u ${md} } @@ -607,6 +625,7 @@ zfs_load=YES opensolaris_load=YES geom_eli_load=YES EOF + cp /boot/kernel/acl_nfs4.ko ${mntpt}/boot/kernel/acl_nfs4.ko cp /boot/kernel/zfs.ko ${mntpt}/boot/kernel/zfs.ko cp /boot/kernel/opensolaris.ko ${mntpt}/boot/kernel/opensolaris.ko cp /boot/kernel/geom_eli.ko ${mntpt}/boot/kernel/geom_eli.ko @@ -803,7 +822,11 @@ EOF # XXX cp /boot/device.hints ${DESTDIR}/boot/device.hints # Assume we're already built -make install DESTDIR=${DESTDIR} MK_MAN=no MK_INSTALL_AS_USER=yes +make install DESTDIR=${DESTDIR} MK_MAN=no MK_INSTALL_AS_USER=yes WITHOUT_DEBUG_FILES=yes +if [ $? -ne 0 ]; then + echo "make install failed" + exit 1 +fi # Copy init, /bin/sh, minimal libraries and testing /etc/rc mkdir -p ${DESTDIR}/sbin ${DESTDIR}/bin \ ${DESTDIR}/lib ${DESTDIR}/libexec \ From owner-svn-src-stable@freebsd.org Thu May 23 05:49:46 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4184159A903; Thu, 23 May 2019 05:49:45 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4913284269; Thu, 23 May 2019 05:49:45 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 00DEA8FF; Thu, 23 May 2019 05:49:44 +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 x4N5nij6063050; Thu, 23 May 2019 05:49:44 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4N5nigC063045; Thu, 23 May 2019 05:49:44 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201905230549.x4N5nigC063045@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 23 May 2019 05:49:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348149 - in stable/12: contrib/zlib lib/libz stand/libsa usr.bin/minigzip X-SVN-Group: stable-12 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable/12: contrib/zlib lib/libz stand/libsa usr.bin/minigzip X-SVN-Commit-Revision: 348149 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4913284269 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.982,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 05:49:46 -0000 Author: delphij Date: Thu May 23 05:49:43 2019 New Revision: 348149 URL: https://svnweb.freebsd.org/changeset/base/348149 Log: MFC r347244: Move contrib/zlib to sys/contrib/zlib so that we can use it in kernel. This is a prerequisite of unifying kernel zlib instances. Submitted by: Yoshihiro Ota Added: - copied from r347244, head/sys/contrib/zlib/ Directory Properties: stable/12/sys/contrib/zlib/ (props changed) Deleted: stable/12/contrib/zlib/ Modified: stable/12/lib/libz/FREEBSD-upgrade stable/12/lib/libz/Makefile stable/12/stand/libsa/Makefile stable/12/usr.bin/minigzip/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/lib/libz/FREEBSD-upgrade ============================================================================== --- stable/12/lib/libz/FREEBSD-upgrade Thu May 23 05:17:18 2019 (r348148) +++ stable/12/lib/libz/FREEBSD-upgrade Thu May 23 05:49:43 2019 (r348149) @@ -8,7 +8,7 @@ benefit other consumers. To Update: 1) Unpack vendor sources into a clean directory. 2) Import onto the vendor area. - 3) Merge the vendor tree to contrib/zlib, which contains a stripped down + 3) Merge the vendor tree to sys/contrib/zlib, which contains a stripped down version of upstream source, resolve any conflicts. 4) Double check zconf.h, zlib.pc, and Symbol.map to make sure that we have the required changes. Test universe and commit them. Modified: stable/12/lib/libz/Makefile ============================================================================== --- stable/12/lib/libz/Makefile Thu May 23 05:17:18 2019 (r348148) +++ stable/12/lib/libz/Makefile Thu May 23 05:49:43 2019 (r348149) @@ -8,7 +8,7 @@ SHLIBDIR?= /lib SHLIB_MAJOR= 6 MAN= zlib.3 zopen.3 -ZLIBSRC= ${SRCTOP}/contrib/zlib +ZLIBSRC= ${SRCTOP}/sys/contrib/zlib .PATH: ${ZLIBSRC} Modified: stable/12/stand/libsa/Makefile ============================================================================== --- stable/12/stand/libsa/Makefile Thu May 23 05:17:18 2019 (r348148) +++ stable/12/stand/libsa/Makefile Thu May 23 05:49:43 2019 (r348149) @@ -99,8 +99,8 @@ CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS SRCS+=bzlib.c crctable.c decompress.c huffman.c randtable.c # decompression functionality from zlib -.PATH: ${SRCTOP}/contrib/zlib -CFLAGS+=-DHAVE_MEMCPY -I${SRCTOP}/contrib/zlib +.PATH: ${SRCTOP}/sys/contrib/zlib +CFLAGS+=-DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib SRCS+= adler32.c crc32.c SRCS+= infback.c inffast.c inflate.c inftrees.c zutil.c Modified: stable/12/usr.bin/minigzip/Makefile ============================================================================== --- stable/12/usr.bin/minigzip/Makefile Thu May 23 05:17:18 2019 (r348148) +++ stable/12/usr.bin/minigzip/Makefile Thu May 23 05:49:43 2019 (r348149) @@ -1,6 +1,6 @@ # $FreeBSD$ -SRCDIR= ${SRCTOP}/contrib/zlib/test +SRCDIR= ${SRCTOP}/sys/contrib/zlib/test .PATH: ${SRCDIR} PROG= minigzip From owner-svn-src-stable@freebsd.org Thu May 23 12:51:30 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A88BD15A9888; Thu, 23 May 2019 12:51:30 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 506E86B355; Thu, 23 May 2019 12:51:30 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E9B75421; Thu, 23 May 2019 12:51:30 +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 x4NCpTcf085524; Thu, 23 May 2019 12:51:29 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4NCpTxb085523; Thu, 23 May 2019 12:51:29 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201905231251.x4NCpTxb085523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 23 May 2019 12:51:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348160 - stable/12/libexec/rtld-elf X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/libexec/rtld-elf X-SVN-Commit-Revision: 348160 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 506E86B355 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_SHORT(-0.97)[-0.965,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 12:51:30 -0000 Author: kib Date: Thu May 23 12:51:29 2019 New Revision: 348160 URL: https://svnweb.freebsd.org/changeset/base/348160 Log: MFC r347692: Remove more dead definitions from rtld_malloc.c after r347019. Modified: stable/12/libexec/rtld-elf/rtld_malloc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rtld-elf/rtld_malloc.c ============================================================================== --- stable/12/libexec/rtld-elf/rtld_malloc.c Thu May 23 12:51:13 2019 (r348159) +++ stable/12/libexec/rtld-elf/rtld_malloc.c Thu May 23 12:51:29 2019 (r348160) @@ -81,17 +81,13 @@ union overhead { } ovu; #define ov_magic ovu.ovu_magic #define ov_index ovu.ovu_index -#define ov_rmagic ovu.ovu_rmagic -#define ov_size ovu.ovu_size }; static void morecore(int bucket); static int morepages(int n); static int findbucket(union overhead *freep, int srchlen); - #define MAGIC 0xef /* magic # on accounting info */ -#define RMAGIC 0x5555 /* magic # on range info */ /* * nextf[i] is the pointer to the next free block of size 2^(i+3). The From owner-svn-src-stable@freebsd.org Thu May 23 12:52:20 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CC89615A991F; Thu, 23 May 2019 12:52:20 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6D1EF6B574; Thu, 23 May 2019 12:52: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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4039B545E; Thu, 23 May 2019 12:52: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 x4NCqKu4088785; Thu, 23 May 2019 12:52:20 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4NCqKiL088784; Thu, 23 May 2019 12:52:20 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201905231252.x4NCqKiL088784@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 23 May 2019 12:52:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348161 - stable/12/libexec/rtld-elf X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/libexec/rtld-elf X-SVN-Commit-Revision: 348161 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6D1EF6B574 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_SHORT(-0.97)[-0.965,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 12:52:21 -0000 Author: kib Date: Thu May 23 12:52:19 2019 New Revision: 348161 URL: https://svnweb.freebsd.org/changeset/base/348161 Log: MFC r347693: rtld_malloc.c: cleanup morepages(). Modified: stable/12/libexec/rtld-elf/rtld_malloc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rtld-elf/rtld_malloc.c ============================================================================== --- stable/12/libexec/rtld-elf/rtld_malloc.c Thu May 23 12:51:29 2019 (r348160) +++ stable/12/libexec/rtld-elf/rtld_malloc.c Thu May 23 12:52:19 2019 (r348161) @@ -345,12 +345,11 @@ findbucket(union overhead *freep, int srchlen) static int morepages(int n) { - int fd = -1; - int offset; + caddr_t addr; + int offset; if (pagepool_end - pagepool_start > pagesz) { - caddr_t addr = (caddr_t) - (((long)pagepool_start + pagesz - 1) & ~(pagesz - 1)); + addr = (caddr_t)roundup2((long)pagepool_start, pagesz); if (munmap(addr, pagepool_end - addr) != 0) { #ifdef IN_RTLD rtld_fdprintf(STDERR_FILENO, _BASENAME_RTLD ": " @@ -360,20 +359,21 @@ morepages(int n) } } - offset = (long)pagepool_start - ((long)pagepool_start & ~(pagesz - 1)); + offset = (long)pagepool_start - rounddown2((long)pagepool_start, + pagesz); - if ((pagepool_start = mmap(0, n * pagesz, - PROT_READ|PROT_WRITE, - MAP_ANON|MAP_PRIVATE, fd, 0)) == (caddr_t)-1) { + pagepool_start = mmap(0, n * pagesz, PROT_READ | PROT_WRITE, + MAP_ANON | MAP_PRIVATE, -1, 0); + if (pagepool_start == MAP_FAILED) { #ifdef IN_RTLD rtld_fdprintf(STDERR_FILENO, _BASENAME_RTLD ": morepages: " "cannot mmap anonymous memory: %s\n", rtld_strerror(errno)); #endif - return 0; + return (0); } pagepool_end = pagepool_start + n * pagesz; pagepool_start += offset; - return n; + return (n); } From owner-svn-src-stable@freebsd.org Thu May 23 13:03:11 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C67E415A9CEB; Thu, 23 May 2019 13:03:11 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6B11E6BC2E; Thu, 23 May 2019 13:03:11 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E1CD5613; Thu, 23 May 2019 13:03:11 +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 x4ND3A6r094805; Thu, 23 May 2019 13:03:10 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4ND3AXD094804; Thu, 23 May 2019 13:03:10 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201905231303.x4ND3AXD094804@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 23 May 2019 13:03:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348162 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 348162 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6B11E6BC2E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 13:03:12 -0000 Author: kib Date: Thu May 23 13:03:10 2019 New Revision: 348162 URL: https://svnweb.freebsd.org/changeset/base/348162 Log: MFC r347694: subr_turnstile: Extract some common code to a helper. Modified: stable/12/sys/kern/subr_turnstile.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/subr_turnstile.c ============================================================================== --- stable/12/sys/kern/subr_turnstile.c Thu May 23 12:52:19 2019 (r348161) +++ stable/12/sys/kern/subr_turnstile.c Thu May 23 13:03:10 2019 (r348162) @@ -897,6 +897,24 @@ turnstile_broadcast(struct turnstile *ts, int queue) } } +static u_char +turnstile_calc_unlend_prio_locked(struct thread *td) +{ + struct turnstile *nts; + u_char cp, pri; + + THREAD_LOCK_ASSERT(td, MA_OWNED); + mtx_assert(&td_contested_lock, MA_OWNED); + + pri = PRI_MAX; + LIST_FOREACH(nts, &td->td_contested, ts_link) { + cp = turnstile_first_waiter(nts)->td_priority; + if (cp < pri) + pri = cp; + } + return (pri); +} + /* * Wakeup all threads on the pending list and adjust the priority of the * current thread appropriately. This must be called with the turnstile @@ -906,9 +924,8 @@ void turnstile_unpend(struct turnstile *ts) { TAILQ_HEAD( ,thread) pending_threads; - struct turnstile *nts; struct thread *td; - u_char cp, pri; + u_char pri; MPASS(ts != NULL); mtx_assert(&ts->ts_lock, MA_OWNED); @@ -932,7 +949,6 @@ turnstile_unpend(struct turnstile *ts) * priority however. */ td = curthread; - pri = PRI_MAX; thread_lock(td); mtx_lock_spin(&td_contested_lock); /* @@ -946,11 +962,7 @@ turnstile_unpend(struct turnstile *ts) ts->ts_owner = NULL; LIST_REMOVE(ts, ts_link); } - LIST_FOREACH(nts, &td->td_contested, ts_link) { - cp = turnstile_first_waiter(nts)->td_priority; - if (cp < pri) - pri = cp; - } + pri = turnstile_calc_unlend_prio_locked(td); mtx_unlock_spin(&td_contested_lock); sched_unlend_prio(td, pri); thread_unlock(td); @@ -991,7 +1003,7 @@ void turnstile_disown(struct turnstile *ts) { struct thread *td; - u_char cp, pri; + u_char pri; MPASS(ts != NULL); mtx_assert(&ts->ts_lock, MA_OWNED); @@ -1017,15 +1029,10 @@ turnstile_disown(struct turnstile *ts) * priority however. */ td = curthread; - pri = PRI_MAX; thread_lock(td); mtx_unlock_spin(&ts->ts_lock); mtx_lock_spin(&td_contested_lock); - LIST_FOREACH(ts, &td->td_contested, ts_link) { - cp = turnstile_first_waiter(ts)->td_priority; - if (cp < pri) - pri = cp; - } + pri = turnstile_calc_unlend_prio_locked(td); mtx_unlock_spin(&td_contested_lock); sched_unlend_prio(td, pri); thread_unlock(td); From owner-svn-src-stable@freebsd.org Thu May 23 13:05:48 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 691E215A9DDD; Thu, 23 May 2019 13:05:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0B8166BDE5; Thu, 23 May 2019 13:05:48 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D671F5615; Thu, 23 May 2019 13:05:47 +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 x4ND5lY6094983; Thu, 23 May 2019 13:05:47 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4ND5lqq094982; Thu, 23 May 2019 13:05:47 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201905231305.x4ND5lqq094982@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 23 May 2019 13:05:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348163 - stable/12/sys/amd64/amd64 X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/amd64/amd64 X-SVN-Commit-Revision: 348163 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0B8166BDE5 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.981,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 13:05:48 -0000 Author: kib Date: Thu May 23 13:05:47 2019 New Revision: 348163 URL: https://svnweb.freebsd.org/changeset/base/348163 Log: MFC r347698: amd64 pmap: sysctl vm.pmap.pcid_save_cnt should be read-only. Modified: stable/12/sys/amd64/amd64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/pmap.c ============================================================================== --- stable/12/sys/amd64/amd64/pmap.c Thu May 23 13:03:10 2019 (r348162) +++ stable/12/sys/amd64/amd64/pmap.c Thu May 23 13:05:47 2019 (r348163) @@ -466,7 +466,7 @@ pmap_pcid_save_cnt_proc(SYSCTL_HANDLER_ARGS) } return (sysctl_handle_64(oidp, &res, 0, req)); } -SYSCTL_PROC(_vm_pmap, OID_AUTO, pcid_save_cnt, CTLTYPE_U64 | CTLFLAG_RW | +SYSCTL_PROC(_vm_pmap, OID_AUTO, pcid_save_cnt, CTLTYPE_U64 | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0, pmap_pcid_save_cnt_proc, "QU", "Count of saved TLB context on switch"); From owner-svn-src-stable@freebsd.org Thu May 23 16:05:49 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BED6F15AEB94; Thu, 23 May 2019 16:05:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 62B4172CCC; Thu, 23 May 2019 16:05:48 +0000 (UTC) (envelope-from tuexen@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 38E6D759D; Thu, 23 May 2019 16:05:48 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4NG5mmC089417; Thu, 23 May 2019 16:05:48 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4NG5lRm089414; Thu, 23 May 2019 16:05:47 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201905231605.x4NG5lRm089414@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 23 May 2019 16:05:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r348174 - stable/11/sys/netinet X-SVN-Group: stable-11 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: stable/11/sys/netinet X-SVN-Commit-Revision: 348174 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 62B4172CCC X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.967,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 16:05:49 -0000 Author: tuexen Date: Thu May 23 16:05:47 2019 New Revision: 348174 URL: https://svnweb.freebsd.org/changeset/base/348174 Log: MFC r347975: Improve input validation for the IPPROTO_SCTP level socket options SCTP_CONNECT_X and SCTP_CONNECT_X_DELAYED. MFC r347976: Allow sending on demand SCTP HEARTBEATS only in the ESTABLISHED state. This issue was found by running syzkaller. Approved by: re (gjb@) Modified: stable/11/sys/netinet/sctp_usrreq.c stable/11/sys/netinet/sctputil.c stable/11/sys/netinet/sctputil.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/11/sys/netinet/sctp_usrreq.c Thu May 23 16:03:30 2019 (r348173) +++ stable/11/sys/netinet/sctp_usrreq.c Thu May 23 16:05:47 2019 (r348174) @@ -1352,13 +1352,12 @@ static int sctp_do_connect_x(struct socket *so, struct sctp_inpcb *inp, void *optval, size_t optsize, void *p, int delay) { - int error = 0; + int error; int creat_lock_on = 0; struct sctp_tcb *stcb = NULL; struct sockaddr *sa; unsigned int num_v6 = 0, num_v4 = 0, *totaddrp, totaddr; uint32_t vrf_id; - int bad_addresses = 0; sctp_assoc_t *a_id; SCTPDBG(SCTP_DEBUG_PCB1, "Connectx called\n"); @@ -1397,17 +1396,12 @@ sctp_do_connect_x(struct socket *so, struct sctp_inpcb totaddrp = (unsigned int *)optval; totaddr = *totaddrp; sa = (struct sockaddr *)(totaddrp + 1); - stcb = sctp_connectx_helper_find(inp, sa, &totaddr, &num_v4, &num_v6, &error, (unsigned int)(optsize - sizeof(int)), &bad_addresses); - if ((stcb != NULL) || bad_addresses) { + error = sctp_connectx_helper_find(inp, sa, totaddr, &num_v4, &num_v6, (unsigned int)(optsize - sizeof(int))); + if (error != 0) { /* Already have or am bring up an association */ SCTP_ASOC_CREATE_UNLOCK(inp); creat_lock_on = 0; - if (stcb) - SCTP_TCB_UNLOCK(stcb); - if (bad_addresses == 0) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EALREADY); - error = EALREADY; - } + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error); goto out_now; } #ifdef INET6 @@ -5338,10 +5332,11 @@ sctp_setopt(struct socket *so, int optname, void *optv net->dest_state &= ~SCTP_ADDR_NOHB; } if (paddrp->spp_flags & SPP_HB_DEMAND) { - /* on demand HB */ - sctp_send_hb(stcb, net, SCTP_SO_LOCKED); - sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_SOCKOPT, SCTP_SO_LOCKED); - sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net); + if (SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) { + sctp_send_hb(stcb, net, SCTP_SO_LOCKED); + sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_SOCKOPT, SCTP_SO_LOCKED); + sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net); + } } if ((paddrp->spp_flags & SPP_PMTUD_DISABLE) && (paddrp->spp_pathmtu >= SCTP_SMALLEST_PMTU)) { if (SCTP_OS_TIMER_PENDING(&net->pmtu_timer.timer)) { Modified: stable/11/sys/netinet/sctputil.c ============================================================================== --- stable/11/sys/netinet/sctputil.c Thu May 23 16:03:30 2019 (r348173) +++ stable/11/sys/netinet/sctputil.c Thu May 23 16:05:47 2019 (r348174) @@ -6387,30 +6387,33 @@ out_now: return (added); } -struct sctp_tcb * +int sctp_connectx_helper_find(struct sctp_inpcb *inp, struct sockaddr *addr, - unsigned int *totaddr, - unsigned int *num_v4, unsigned int *num_v6, int *error, - unsigned int limit, int *bad_addr) + unsigned int totaddr, + unsigned int *num_v4, unsigned int *num_v6, + unsigned int limit) { struct sockaddr *sa; - struct sctp_tcb *stcb = NULL; + struct sctp_tcb *stcb; unsigned int incr, at, i; at = 0; sa = addr; - *error = *num_v6 = *num_v4 = 0; + *num_v6 = *num_v4 = 0; /* account and validate addresses */ - for (i = 0; i < *totaddr; i++) { + if (totaddr == 0) { + return (EINVAL); + } + for (i = 0; i < totaddr; i++) { + if (at + sizeof(struct sockaddr) > limit) { + return (EINVAL); + } switch (sa->sa_family) { #ifdef INET case AF_INET: incr = (unsigned int)sizeof(struct sockaddr_in); if (sa->sa_len != incr) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, EINVAL); - *error = EINVAL; - *bad_addr = 1; - return (NULL); + return (EINVAL); } (*num_v4) += 1; break; @@ -6423,46 +6426,34 @@ sctp_connectx_helper_find(struct sctp_inpcb *inp, stru sin6 = (struct sockaddr_in6 *)sa; if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) { /* Must be non-mapped for connectx */ - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, EINVAL); - *error = EINVAL; - *bad_addr = 1; - return (NULL); + return (EINVAL); } incr = (unsigned int)sizeof(struct sockaddr_in6); if (sa->sa_len != incr) { - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTPUTIL, EINVAL); - *error = EINVAL; - *bad_addr = 1; - return (NULL); + return (EINVAL); } (*num_v6) += 1; break; } #endif default: - *totaddr = i; - incr = 0; - /* we are done */ - break; + return (EINVAL); } - if (i == *totaddr) { - break; + if ((at + incr) > limit) { + return (EINVAL); } SCTP_INP_INCR_REF(inp); stcb = sctp_findassociation_ep_addr(&inp, sa, NULL, NULL, NULL); if (stcb != NULL) { - /* Already have or am bring up an association */ - return (stcb); + SCTP_TCB_UNLOCK(stcb); + return (EALREADY); } else { SCTP_INP_DECR_REF(inp); } - if ((at + incr) > limit) { - *totaddr = i; - break; - } + at += incr; sa = (struct sockaddr *)((caddr_t)sa + incr); } - return ((struct sctp_tcb *)NULL); + return (0); } /* Modified: stable/11/sys/netinet/sctputil.h ============================================================================== --- stable/11/sys/netinet/sctputil.h Thu May 23 16:03:30 2019 (r348173) +++ stable/11/sys/netinet/sctputil.h Thu May 23 16:05:47 2019 (r348174) @@ -209,10 +209,9 @@ int sctp_connectx_helper_add(struct sctp_tcb *stcb, struct sockaddr *addr, int totaddr, int *error); -struct sctp_tcb * -sctp_connectx_helper_find(struct sctp_inpcb *inp, struct sockaddr *addr, - unsigned int *totaddr, unsigned int *num_v4, unsigned int *num_v6, - int *error, unsigned int limit, int *bad_addr); +int +sctp_connectx_helper_find(struct sctp_inpcb *, struct sockaddr *, + unsigned int, unsigned int *, unsigned int *, unsigned int); int sctp_is_there_an_abort_here(struct mbuf *, int, uint32_t *); #ifdef INET6 From owner-svn-src-stable@freebsd.org Thu May 23 18:48:48 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 30DAF15B2694; Thu, 23 May 2019 18:48:48 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B090481E51; Thu, 23 May 2019 18:48:47 +0000 (UTC) (envelope-from rgrimes@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8768991D5; Thu, 23 May 2019 18:48:47 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4NImlkQ074576; Thu, 23 May 2019 18:48:47 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4NImljq074575; Thu, 23 May 2019 18:48:47 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201905231848.x4NImljq074575@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Thu, 23 May 2019 18:48:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348186 - stable/12/usr.sbin/bhyve X-SVN-Group: stable-12 X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: stable/12/usr.sbin/bhyve X-SVN-Commit-Revision: 348186 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B090481E51 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 18:48:48 -0000 Author: rgrimes Date: Thu May 23 18:48:46 2019 New Revision: 348186 URL: https://svnweb.freebsd.org/changeset/base/348186 Log: MFC: r347960: bhyve virtio needs barriers Under certain tight race conditions, we found that the lack of a memory barrier in bhyve's virtio handling causes it to miss a NO_NOTIFY state transition on block devices, resulting in guest stall. The investigation is recorded in OS-7613. As part of the examination into bhyve's use of barriers, one other section was found to be problematic, but only on non-x86 ISAs with less strict memory ordering. That was addressed in this patch as well, although it was not at all a problem on x86. PR: 231117 Submitted by: Patrick Mooney Reviewed by: jhb, kib, rgrimes Approved by: jhb Differential Revision: https://reviews.freebsd.org/D19501 Modified: stable/12/usr.sbin/bhyve/virtio.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/virtio.c ============================================================================== --- stable/12/usr.sbin/bhyve/virtio.c Thu May 23 18:37:05 2019 (r348185) +++ stable/12/usr.sbin/bhyve/virtio.c Thu May 23 18:48:46 2019 (r348186) @@ -3,6 +3,7 @@ * * Copyright (c) 2013 Chris Torek * All rights reserved. + * Copyright (c) 2019 Joyent, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,6 +33,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include #include @@ -422,6 +425,12 @@ vq_relchain(struct vqueue_info *vq, uint16_t idx, uint vue = &vuh->vu_ring[uidx++ & mask]; vue->vu_idx = idx; vue->vu_tlen = iolen; + + /* + * Ensure the used descriptor is visible before updating the index. + * This is necessary on ISAs with memory ordering less strict than x86. + */ + atomic_thread_fence_rel(); vuh->vu_idx = uidx; } @@ -459,6 +468,13 @@ vq_endchains(struct vqueue_info *vq, int used_all_avai vs = vq->vq_vs; old_idx = vq->vq_save_used; vq->vq_save_used = new_idx = vq->vq_used->vu_idx; + + /* + * Use full memory barrier between vu_idx store from preceding + * vq_relchain() call and the loads from VQ_USED_EVENT_IDX() or + * va_flags below. + */ + atomic_thread_fence_seq_cst(); if (used_all_avail && (vs->vs_negotiated_caps & VIRTIO_F_NOTIFY_ON_EMPTY)) intr = 1; From owner-svn-src-stable@freebsd.org Thu May 23 18:58:07 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6D9D515B2A59; Thu, 23 May 2019 18:58:07 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 13654825B3; Thu, 23 May 2019 18:58:07 +0000 (UTC) (envelope-from rgrimes@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E2395938C; Thu, 23 May 2019 18:58:06 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4NIw6xc079848; Thu, 23 May 2019 18:58:06 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4NIw6fQ079847; Thu, 23 May 2019 18:58:06 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201905231858.x4NIw6fQ079847@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Thu, 23 May 2019 18:58:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r348188 - stable/11/usr.sbin/bhyve X-SVN-Group: stable-11 X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: stable/11/usr.sbin/bhyve X-SVN-Commit-Revision: 348188 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 13654825B3 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 18:58:07 -0000 Author: rgrimes Date: Thu May 23 18:58:06 2019 New Revision: 348188 URL: https://svnweb.freebsd.org/changeset/base/348188 Log: MFC: r347960: bhyve virtio needs barriers Under certain tight race conditions, we found that the lack of a memory barrier in bhyve's virtio handling causes it to miss a NO_NOTIFY state transition on block devices, resulting in guest stall. The investigation is recorded in OS-7613. As part of the examination into bhyve's use of barriers, one other section was found to be problematic, but only on non-x86 ISAs with less strict memory ordering. That was addressed in this patch as well, although it was not at all a problem on x86. PR: 231117 Submitted by: Patrick Mooney Reviewed by: jhb, kib, rgrimes Approved by: re (gjb), jhb Differential Revision: https://reviews.freebsd.org/D19501 Modified: stable/11/usr.sbin/bhyve/virtio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyve/virtio.c ============================================================================== --- stable/11/usr.sbin/bhyve/virtio.c Thu May 23 18:55:48 2019 (r348187) +++ stable/11/usr.sbin/bhyve/virtio.c Thu May 23 18:58:06 2019 (r348188) @@ -3,6 +3,7 @@ * * Copyright (c) 2013 Chris Torek * All rights reserved. + * Copyright (c) 2019 Joyent, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,6 +33,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + #include #include #include @@ -422,6 +425,12 @@ vq_relchain(struct vqueue_info *vq, uint16_t idx, uint vue = &vuh->vu_ring[uidx++ & mask]; vue->vu_idx = idx; vue->vu_tlen = iolen; + + /* + * Ensure the used descriptor is visible before updating the index. + * This is necessary on ISAs with memory ordering less strict than x86. + */ + atomic_thread_fence_rel(); vuh->vu_idx = uidx; } @@ -459,6 +468,13 @@ vq_endchains(struct vqueue_info *vq, int used_all_avai vs = vq->vq_vs; old_idx = vq->vq_save_used; vq->vq_save_used = new_idx = vq->vq_used->vu_idx; + + /* + * Use full memory barrier between vu_idx store from preceding + * vq_relchain() call and the loads from VQ_USED_EVENT_IDX() or + * va_flags below. + */ + atomic_thread_fence_seq_cst(); if (used_all_avail && (vs->vs_negotiated_caps & VIRTIO_F_NOTIFY_ON_EMPTY)) intr = 1; From owner-svn-src-stable@freebsd.org Thu May 23 19:12:48 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2D49115B324B; Thu, 23 May 2019 19:12:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C454A832A6; Thu, 23 May 2019 19:12:47 +0000 (UTC) (envelope-from jhb@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A10B496EF; Thu, 23 May 2019 19:12:47 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4NJClu9090277; Thu, 23 May 2019 19:12:47 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4NJClgh090276; Thu, 23 May 2019 19:12:47 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201905231912.x4NJClgh090276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 23 May 2019 19:12:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348189 - stable/12/tests/sys/opencrypto X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/12/tests/sys/opencrypto X-SVN-Commit-Revision: 348189 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C454A832A6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 19:12:48 -0000 Author: jhb Date: Thu May 23 19:12:47 2019 New Revision: 348189 URL: https://svnweb.freebsd.org/changeset/base/348189 Log: MFC 346419: Sync cryptographic algorithm constants with current cryptodev.h. Modified: stable/12/tests/sys/opencrypto/cryptodevh.py Directory Properties: stable/12/ (props changed) Modified: stable/12/tests/sys/opencrypto/cryptodevh.py ============================================================================== --- stable/12/tests/sys/opencrypto/cryptodevh.py Thu May 23 18:58:06 2019 (r348188) +++ stable/12/tests/sys/opencrypto/cryptodevh.py Thu May 23 19:12:47 2019 (r348189) @@ -197,7 +197,19 @@ CRYPTO_AES_NIST_GCM_16 = 25 CRYPTO_AES_128_NIST_GMAC = 26 CRYPTO_AES_192_NIST_GMAC = 27 CRYPTO_AES_256_NIST_GMAC = 28 -CRYPTO_ALGORITHM_MAX = 28 +CRYPTO_BLAKE2B = 29 +CRYPTO_BLAKE2S = 30 +CRYPTO_CHACHA20 = 31 +CRYPTO_SHA2_224_HMAC = 32 +CRYPTO_RIPEMD160 = 33 +CRYPTO_SHA2_224 = 34 +CRYPTO_SHA2_256 = 35 +CRYPTO_SHA2_384 = 36 +CRYPTO_SHA2_512 = 37 +CRYPTO_POLY1305 = 38 +CRYPTO_AES_CCM_CBC_MAC = 39 +CRYPTO_AES_CCM_16 = 40 +CRYPTO_ALGORITHM_MAX = 40 CRYPTO_ALG_FLAG_SUPPORTED = 0x01 CRYPTO_ALG_FLAG_RNG_ENABLE = 0x02 CRYPTO_ALG_FLAG_DSA_SHA = 0x04 From owner-svn-src-stable@freebsd.org Thu May 23 19:13:39 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4B4B015B32B1; Thu, 23 May 2019 19:13:39 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E3F5883409; Thu, 23 May 2019 19:13:38 +0000 (UTC) (envelope-from jhb@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B54BC96F0; Thu, 23 May 2019 19:13:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4NJDcAk090378; Thu, 23 May 2019 19:13:38 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4NJDc1M090377; Thu, 23 May 2019 19:13:38 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201905231913.x4NJDc1M090377@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 23 May 2019 19:13:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348190 - stable/12/tests/sys/opencrypto X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/12/tests/sys/opencrypto X-SVN-Commit-Revision: 348190 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E3F5883409 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 19:13:39 -0000 Author: jhb Date: Thu May 23 19:13:38 2019 New Revision: 348190 URL: https://svnweb.freebsd.org/changeset/base/348190 Log: MFC 346421: Test SHA2-224-HMAC now that OCF supports it. Modified: stable/12/tests/sys/opencrypto/cryptotest.py Directory Properties: stable/12/ (props changed) Modified: stable/12/tests/sys/opencrypto/cryptotest.py ============================================================================== --- stable/12/tests/sys/opencrypto/cryptotest.py Thu May 23 19:12:47 2019 (r348189) +++ stable/12/tests/sys/opencrypto/cryptotest.py Thu May 23 19:13:38 2019 (r348190) @@ -279,11 +279,8 @@ def GenTestCase(cname): alg = cryptodev.CRYPTO_SHA1_HMAC blocksize = 64 elif hashlen == 28: - # Cryptodev doesn't support SHA-224 - # Slurp remaining input in section - for data in lines: - continue - continue + alg = cryptodev.CRYPTO_SHA2_224_HMAC + blocksize = 64 elif hashlen == 32: alg = cryptodev.CRYPTO_SHA2_256_HMAC blocksize = 64 From owner-svn-src-stable@freebsd.org Thu May 23 19:18:22 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9C09115B3398; Thu, 23 May 2019 19:18:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 406F4836BE; Thu, 23 May 2019 19:18:22 +0000 (UTC) (envelope-from jhb@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1DC1F96FA; Thu, 23 May 2019 19:18:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4NJIMx2090629; Thu, 23 May 2019 19:18:22 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4NJILg7090628; Thu, 23 May 2019 19:18:21 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201905231918.x4NJILg7090628@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 23 May 2019 19:18:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348191 - stable/12/tests/sys/opencrypto X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/12/tests/sys/opencrypto X-SVN-Commit-Revision: 348191 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 406F4836BE X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 19:18:22 -0000 Author: jhb Date: Thu May 23 19:18:21 2019 New Revision: 348191 URL: https://svnweb.freebsd.org/changeset/base/348191 Log: MFC 346614: Skip tests with missing test vectors instead of failing. This copes more gracefully when older version of the nist-kat package are intalled that don't have newer test vectors such as CCM or plain SHA. If the nist-kat package is not installed at all, this still fails with an error. Modified: stable/12/tests/sys/opencrypto/cryptotest.py Directory Properties: stable/12/ (props changed) Modified: stable/12/tests/sys/opencrypto/cryptotest.py ============================================================================== --- stable/12/tests/sys/opencrypto/cryptotest.py Thu May 23 19:13:38 2019 (r348190) +++ stable/12/tests/sys/opencrypto/cryptotest.py Thu May 23 19:18:21 2019 (r348191) @@ -42,7 +42,9 @@ from glob import iglob katdir = '/usr/local/share/nist-kat' def katg(base, glob): - assert os.path.exists(os.path.join(katdir, base)), "Please 'pkg install nist-kat'" + assert os.path.exists(katdir), "Please 'pkg install nist-kat'" + if not os.path.exists(os.path.join(katdir, base)): + raise unittest.SkipTest("Missing %s test vectors" % (base)) return iglob(os.path.join(katdir, base, glob)) aesmodules = [ 'cryptosoft0', 'aesni0', 'ccr0', 'ccp0' ] From owner-svn-src-stable@freebsd.org Thu May 23 19:19:11 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C40AB15B3402; Thu, 23 May 2019 19:19:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6CE6C8380B; Thu, 23 May 2019 19:19:10 +0000 (UTC) (envelope-from jhb@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4A41F96FB; Thu, 23 May 2019 19:19:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4NJJAR5090723; Thu, 23 May 2019 19:19:10 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4NJJArd090722; Thu, 23 May 2019 19:19:10 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201905231919.x4NJJArd090722@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 23 May 2019 19:19:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348192 - stable/12/tests/sys/opencrypto X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/12/tests/sys/opencrypto X-SVN-Commit-Revision: 348192 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6CE6C8380B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 19:19:11 -0000 Author: jhb Date: Thu May 23 19:19:09 2019 New Revision: 348192 URL: https://svnweb.freebsd.org/changeset/base/348192 Log: MFC 346615: Use more descriptive algorithm names in skip messages. Modified: stable/12/tests/sys/opencrypto/cryptotest.py Directory Properties: stable/12/ (props changed) Modified: stable/12/tests/sys/opencrypto/cryptotest.py ============================================================================== --- stable/12/tests/sys/opencrypto/cryptotest.py Thu May 23 19:18:21 2019 (r348191) +++ stable/12/tests/sys/opencrypto/cryptotest.py Thu May 23 19:19:09 2019 (r348192) @@ -61,17 +61,17 @@ def GenTestCase(cname): ############### ##### AES ##### ############### - @unittest.skipIf(cname not in aesmodules, 'skipping AES on %s' % (cname)) + @unittest.skipIf(cname not in aesmodules, 'skipping AES-XTS on %s' % (cname)) def test_xts(self): for i in katg('XTSTestVectors/format tweak value input - data unit seq no', '*.rsp'): self.runXTS(i, cryptodev.CRYPTO_AES_XTS) - @unittest.skipIf(cname not in aesmodules, 'skipping AES on %s' % (cname)) + @unittest.skipIf(cname not in aesmodules, 'skipping AES-CBC on %s' % (cname)) def test_cbc(self): for i in katg('KAT_AES', 'CBC[GKV]*.rsp'): self.runCBC(i) - @unittest.skipIf(cname not in aesmodules, 'skipping AES on %s' % (cname)) + @unittest.skipIf(cname not in aesmodules, 'skipping AES-GCM on %s' % (cname)) def test_gcm(self): for i in katg('gcmtestvectors', 'gcmEncrypt*'): self.runGCM(i, 'ENCRYPT') @@ -265,7 +265,7 @@ def GenTestCase(cname): #for i in iglob('SHA1*'): # self.runSHA(i) - @unittest.skipIf(cname not in shamodules, 'skipping SHA on %s' % str(cname)) + @unittest.skipIf(cname not in shamodules, 'skipping SHA-HMAC on %s' % str(cname)) def test_sha1hmac(self): for i in katg('hmactestvectors', 'HMAC.rsp'): self.runSHA1HMAC(i) From owner-svn-src-stable@freebsd.org Thu May 23 19:20:38 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 422FF15B34BB; Thu, 23 May 2019 19:20:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DA56683AAB; Thu, 23 May 2019 19:20:37 +0000 (UTC) (envelope-from jhb@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8FAD9715; Thu, 23 May 2019 19:20:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4NJKbFn091049; Thu, 23 May 2019 19:20:37 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4NJKbNi091047; Thu, 23 May 2019 19:20:37 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201905231920.x4NJKbNi091047@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 23 May 2019 19:20:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348193 - stable/12/tests/sys/opencrypto X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/12/tests/sys/opencrypto X-SVN-Commit-Revision: 348193 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DA56683AAB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 19:20:38 -0000 Author: jhb Date: Thu May 23 19:20:37 2019 New Revision: 348193 URL: https://svnweb.freebsd.org/changeset/base/348193 Log: MFC 346616: Run the plain SHA digest tests from NIST. Pass in an explicit digest length to the Crypto constructor since it was assuming only sessions with a MAC key would have a MAC. Passing an explicit size allows us to test the full digest in HMAC tests as well. Modified: stable/12/tests/sys/opencrypto/cryptodev.py stable/12/tests/sys/opencrypto/cryptotest.py Directory Properties: stable/12/ (props changed) Modified: stable/12/tests/sys/opencrypto/cryptodev.py ============================================================================== --- stable/12/tests/sys/opencrypto/cryptodev.py Thu May 23 19:19:09 2019 (r348192) +++ stable/12/tests/sys/opencrypto/cryptodev.py Thu May 23 19:20:37 2019 (r348193) @@ -151,8 +151,9 @@ class Crypto: return _findop(crid, '')[1] def __init__(self, cipher=0, key=None, mac=0, mackey=None, - crid=CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_HARDWARE): + crid=CRYPTOCAP_F_SOFTWARE | CRYPTOCAP_F_HARDWARE, maclen=None): self._ses = None + self._maclen = maclen ses = SessionOp2() ses.cipher = cipher ses.mac = mac @@ -168,9 +169,6 @@ class Crypto: ses.mackeylen = len(mackey) mk = array.array('B', mackey) ses.mackey = mk.buffer_info()[0] - self._maclen = 16 # parameterize? - else: - self._maclen = None if not cipher and not mac: raise ValueError('one of cipher or mac MUST be specified.') Modified: stable/12/tests/sys/opencrypto/cryptotest.py ============================================================================== --- stable/12/tests/sys/opencrypto/cryptotest.py Thu May 23 19:19:09 2019 (r348192) +++ stable/12/tests/sys/opencrypto/cryptotest.py Thu May 23 19:20:37 2019 (r348193) @@ -114,7 +114,8 @@ def GenTestCase(cname): c = Crypto(cryptodev.CRYPTO_AES_NIST_GCM_16, cipherkey, mac=self._gmacsizes[len(cipherkey)], - mackey=cipherkey, crid=crid) + mackey=cipherkey, crid=crid, + maclen=16) except EnvironmentError, e: # Can't test algorithms the driver does not support. if e.errno != errno.EOPNOTSUPP: @@ -260,11 +261,55 @@ def GenTestCase(cname): ############### @unittest.skipIf(cname not in shamodules, 'skipping SHA on %s' % str(cname)) def test_sha(self): - # SHA not available in software - pass - #for i in iglob('SHA1*'): - # self.runSHA(i) + for i in katg('shabytetestvectors', 'SHA*Msg.rsp'): + self.runSHA(i) + def runSHA(self, fname): + # Skip SHA512_(224|256) tests + if fname.find('SHA512_') != -1: + return + + for hashlength, lines in cryptodev.KATParser(fname, + [ 'Len', 'Msg', 'MD' ]): + # E.g., hashlength will be "L=20" (bytes) + hashlen = int(hashlength.split("=")[1]) + + if hashlen == 20: + alg = cryptodev.CRYPTO_SHA1 + elif hashlen == 28: + alg = cryptodev.CRYPTO_SHA2_224 + elif hashlen == 32: + alg = cryptodev.CRYPTO_SHA2_256 + elif hashlen == 48: + alg = cryptodev.CRYPTO_SHA2_384 + elif hashlen == 64: + alg = cryptodev.CRYPTO_SHA2_512 + else: + # Skip unsupported hashes + # Slurp remaining input in section + for data in lines: + continue + continue + + for data in lines: + msg = data['Msg'].decode('hex') + msg = msg[:int(data['Len'])] + md = data['MD'].decode('hex') + + try: + c = Crypto(mac=alg, crid=crid, + maclen=hashlen) + except EnvironmentError, e: + # Can't test hashes the driver does not support. + if e.errno != errno.EOPNOTSUPP: + raise + continue + + _, r = c.encrypt(msg, iv="") + + self.assertEqual(r, md, "Actual: " + \ + repr(r.encode("hex")) + " Expected: " + repr(data) + " on " + cname) + @unittest.skipIf(cname not in shamodules, 'skipping SHA-HMAC on %s' % str(cname)) def test_sha1hmac(self): for i in katg('hmactestvectors', 'HMAC.rsp'): @@ -310,7 +355,7 @@ def GenTestCase(cname): try: c = Crypto(mac=alg, mackey=key, - crid=crid) + crid=crid, maclen=hashlen) except EnvironmentError, e: # Can't test hashes the driver does not support. if e.errno != errno.EOPNOTSUPP: @@ -319,13 +364,8 @@ def GenTestCase(cname): _, r = c.encrypt(msg, iv="") - # A limitation in cryptodev.py means we - # can only store MACs up to 16 bytes. - # That's good enough to validate the - # correct behavior, more or less. - maclen = min(tlen, 16) - self.assertEqual(r[:maclen], mac[:maclen], "Actual: " + \ - repr(r[:maclen].encode("hex")) + " Expected: " + repr(data)) + self.assertEqual(r[:tlen], mac, "Actual: " + \ + repr(r.encode("hex")) + " Expected: " + repr(data)) return GendCryptoTestCase From owner-svn-src-stable@freebsd.org Thu May 23 21:05:06 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 25F4815B5BA8; Thu, 23 May 2019 21:05:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BA0F4880C4; Thu, 23 May 2019 21:05:05 +0000 (UTC) (envelope-from jhb@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 90105AA89; Thu, 23 May 2019 21:05:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4NL55g7049237; Thu, 23 May 2019 21:05:05 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4NL550G049236; Thu, 23 May 2019 21:05:05 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201905232105.x4NL550G049236@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 23 May 2019 21:05:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348200 - stable/12/sys/dev/cxgbe/crypto X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/12/sys/dev/cxgbe/crypto X-SVN-Commit-Revision: 348200 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BA0F4880C4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_SHORT(-0.98)[-0.982,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 21:05:06 -0000 Author: jhb Date: Thu May 23 21:05:05 2019 New Revision: 348200 URL: https://svnweb.freebsd.org/changeset/base/348200 Log: MFC 346648: Fix requests for "plain" SHA digests of an empty buffer. To workaround limitations in the crypto engine, empty buffers are handled by manually constructing the final length block as the payload passed to the crypto engine and disabling the normal "final" handling. For HMAC this length block should hold the length of a single block since the hash is actually the hash of the IPAD digest, but for "plain" SHA the length should be zero instead. Modified: stable/12/sys/dev/cxgbe/crypto/t4_crypto.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/cxgbe/crypto/t4_crypto.c ============================================================================== --- stable/12/sys/dev/cxgbe/crypto/t4_crypto.c Thu May 23 21:02:27 2019 (r348199) +++ stable/12/sys/dev/cxgbe/crypto/t4_crypto.c Thu May 23 21:05:05 2019 (r348200) @@ -537,8 +537,9 @@ ccr_hash(struct ccr_softc *sc, struct ccr_session *s, dst = (char *)(crwr + 1) + kctx_len + DUMMY_BYTES; if (crd->crd_len == 0) { dst[0] = 0x80; - *(uint64_t *)(dst + axf->blocksize - sizeof(uint64_t)) = - htobe64(axf->blocksize << 3); + if (s->mode == HMAC) + *(uint64_t *)(dst + axf->blocksize - sizeof(uint64_t)) = + htobe64(axf->blocksize << 3); } else if (imm_len != 0) crypto_copydata(crp->crp_flags, crp->crp_buf, crd->crd_skip, crd->crd_len, dst); From owner-svn-src-stable@freebsd.org Thu May 23 21:23:22 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F53B15B6395; Thu, 23 May 2019 21:23:22 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AE7D388E46; Thu, 23 May 2019 21:23:21 +0000 (UTC) (envelope-from rgrimes@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 156BBAE0F; Thu, 23 May 2019 21:23:21 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4NLNLok061413; Thu, 23 May 2019 21:23:21 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4NLNJg9061403; Thu, 23 May 2019 21:23:19 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201905232123.x4NLNJg9061403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Thu, 23 May 2019 21:23:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r348201 - in stable/11: lib/libvmmapi sys/amd64/include sys/amd64/vmm usr.sbin/bhyve usr.sbin/bhyvectl X-SVN-Group: stable-11 X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: in stable/11: lib/libvmmapi sys/amd64/include sys/amd64/vmm usr.sbin/bhyve usr.sbin/bhyvectl X-SVN-Commit-Revision: 348201 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AE7D388E46 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_SHORT(-0.97)[-0.967,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 21:23:22 -0000 Author: rgrimes Date: Thu May 23 21:23:18 2019 New Revision: 348201 URL: https://svnweb.freebsd.org/changeset/base/348201 Log: MFC: r332298,333712,334199,334216,334219 bhyve cpu topology Approved by: re (gjb), bde/phk (mentor, implicit) Modified: stable/11/lib/libvmmapi/vmmapi.c stable/11/lib/libvmmapi/vmmapi.h stable/11/sys/amd64/include/vmm.h stable/11/sys/amd64/include/vmm_dev.h stable/11/sys/amd64/vmm/vmm.c stable/11/sys/amd64/vmm/vmm_dev.c stable/11/sys/amd64/vmm/x86.c stable/11/usr.sbin/bhyve/bhyve.8 stable/11/usr.sbin/bhyve/bhyverun.c stable/11/usr.sbin/bhyvectl/bhyvectl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libvmmapi/vmmapi.c ============================================================================== --- stable/11/lib/libvmmapi/vmmapi.c Thu May 23 21:05:05 2019 (r348200) +++ stable/11/lib/libvmmapi/vmmapi.c Thu May 23 21:23:18 2019 (r348201) @@ -1417,6 +1417,38 @@ vm_restart_instruction(void *arg, int vcpu) } int +vm_set_topology(struct vmctx *ctx, + uint16_t sockets, uint16_t cores, uint16_t threads, uint16_t maxcpus) +{ + struct vm_cpu_topology topology; + + bzero(&topology, sizeof (struct vm_cpu_topology)); + topology.sockets = sockets; + topology.cores = cores; + topology.threads = threads; + topology.maxcpus = maxcpus; + return (ioctl(ctx->fd, VM_SET_TOPOLOGY, &topology)); +} + +int +vm_get_topology(struct vmctx *ctx, + uint16_t *sockets, uint16_t *cores, uint16_t *threads, uint16_t *maxcpus) +{ + struct vm_cpu_topology topology; + int error; + + bzero(&topology, sizeof (struct vm_cpu_topology)); + error = ioctl(ctx->fd, VM_GET_TOPOLOGY, &topology); + if (error == 0) { + *sockets = topology.sockets; + *cores = topology.cores; + *threads = topology.threads; + *maxcpus = topology.maxcpus; + } + return (error); +} + +int vm_get_device_fd(struct vmctx *ctx) { @@ -1443,7 +1475,7 @@ vm_get_ioctls(size_t *len) VM_GET_HPET_CAPABILITIES, VM_GET_GPA_PMAP, VM_GLA2GPA, VM_ACTIVATE_CPU, VM_GET_CPUS, VM_SET_INTINFO, VM_GET_INTINFO, VM_RTC_WRITE, VM_RTC_READ, VM_RTC_SETTIME, VM_RTC_GETTIME, - VM_RESTART_INSTRUCTION }; + VM_RESTART_INSTRUCTION, VM_SET_TOPOLOGY, VM_GET_TOPOLOGY }; if (len == NULL) { cmds = malloc(sizeof(vm_ioctl_cmds)); Modified: stable/11/lib/libvmmapi/vmmapi.h ============================================================================== --- stable/11/lib/libvmmapi/vmmapi.h Thu May 23 21:05:05 2019 (r348200) +++ stable/11/lib/libvmmapi/vmmapi.h Thu May 23 21:23:18 2019 (r348201) @@ -209,6 +209,12 @@ int vm_active_cpus(struct vmctx *ctx, cpuset_t *cpus); int vm_suspended_cpus(struct vmctx *ctx, cpuset_t *cpus); int vm_activate_cpu(struct vmctx *ctx, int vcpu); +/* CPU topology */ +int vm_set_topology(struct vmctx *ctx, uint16_t sockets, uint16_t cores, + uint16_t threads, uint16_t maxcpus); +int vm_get_topology(struct vmctx *ctx, uint16_t *sockets, uint16_t *cores, + uint16_t *threads, uint16_t *maxcpus); + /* * FreeBSD specific APIs */ Modified: stable/11/sys/amd64/include/vmm.h ============================================================================== --- stable/11/sys/amd64/include/vmm.h Thu May 23 21:05:05 2019 (r348200) +++ stable/11/sys/amd64/include/vmm.h Thu May 23 21:23:18 2019 (r348201) @@ -184,6 +184,10 @@ int vm_create(const char *name, struct vm **retvm); void vm_destroy(struct vm *vm); int vm_reinit(struct vm *vm); const char *vm_name(struct vm *vm); +void vm_get_topology(struct vm *vm, uint16_t *sockets, uint16_t *cores, + uint16_t *threads, uint16_t *maxcpus); +int vm_set_topology(struct vm *vm, uint16_t sockets, uint16_t cores, + uint16_t threads, uint16_t maxcpus); /* * APIs that modify the guest memory map require all vcpus to be frozen. Modified: stable/11/sys/amd64/include/vmm_dev.h ============================================================================== --- stable/11/sys/amd64/include/vmm_dev.h Thu May 23 21:05:05 2019 (r348200) +++ stable/11/sys/amd64/include/vmm_dev.h Thu May 23 21:23:18 2019 (r348201) @@ -216,6 +216,13 @@ struct vm_rtc_data { uint8_t value; }; +struct vm_cpu_topology { + uint16_t sockets; + uint16_t cores; + uint16_t threads; + uint16_t maxcpus; +}; + enum { /* general routines */ IOCNUM_ABIVERS = 0, @@ -271,6 +278,10 @@ enum { IOCNUM_GET_X2APIC_STATE = 61, IOCNUM_GET_HPET_CAPABILITIES = 62, + /* CPU Topology */ + IOCNUM_SET_TOPOLOGY = 63, + IOCNUM_GET_TOPOLOGY = 64, + /* legacy interrupt injection */ IOCNUM_ISA_ASSERT_IRQ = 80, IOCNUM_ISA_DEASSERT_IRQ = 81, @@ -360,6 +371,10 @@ enum { _IOWR('v', IOCNUM_GET_X2APIC_STATE, struct vm_x2apic) #define VM_GET_HPET_CAPABILITIES \ _IOR('v', IOCNUM_GET_HPET_CAPABILITIES, struct vm_hpet_cap) +#define VM_SET_TOPOLOGY \ + _IOW('v', IOCNUM_SET_TOPOLOGY, struct vm_cpu_topology) +#define VM_GET_TOPOLOGY \ + _IOR('v', IOCNUM_GET_TOPOLOGY, struct vm_cpu_topology) #define VM_GET_GPA_PMAP \ _IOWR('v', IOCNUM_GET_GPA_PMAP, struct vm_gpa_pte) #define VM_GLA2GPA \ Modified: stable/11/sys/amd64/vmm/vmm.c ============================================================================== --- stable/11/sys/amd64/vmm/vmm.c Thu May 23 21:05:05 2019 (r348200) +++ stable/11/sys/amd64/vmm/vmm.c Thu May 23 21:23:18 2019 (r348201) @@ -163,6 +163,11 @@ struct vm { struct vmspace *vmspace; /* (o) guest's address space */ char name[VM_MAX_NAMELEN]; /* (o) virtual machine name */ struct vcpu vcpu[VM_MAXCPU]; /* (i) guest vcpus */ + /* The following describe the vm cpu topology */ + uint16_t sockets; /* (o) num of sockets */ + uint16_t cores; /* (o) num of cores/socket */ + uint16_t threads; /* (o) num of threads/core */ + uint16_t maxcpus; /* (o) max pluggable cpus */ }; static int vmm_initialized; @@ -423,6 +428,12 @@ vm_init(struct vm *vm, bool create) vcpu_init(vm, i, create); } +/* + * The default CPU topology is a single thread per package. + */ +u_int cores_per_package = 1; +u_int threads_per_core = 1; + int vm_create(const char *name, struct vm **retvm) { @@ -448,10 +459,41 @@ vm_create(const char *name, struct vm **retvm) vm->vmspace = vmspace; mtx_init(&vm->rendezvous_mtx, "vm rendezvous lock", 0, MTX_DEF); + vm->sockets = 1; + vm->cores = cores_per_package; /* XXX backwards compatibility */ + vm->threads = threads_per_core; /* XXX backwards compatibility */ + vm->maxcpus = 0; /* XXX not implemented */ + vm_init(vm, true); *retvm = vm; return (0); +} + +void +vm_get_topology(struct vm *vm, uint16_t *sockets, uint16_t *cores, + uint16_t *threads, uint16_t *maxcpus) +{ + *sockets = vm->sockets; + *cores = vm->cores; + *threads = vm->threads; + *maxcpus = vm->maxcpus; +} + +int +vm_set_topology(struct vm *vm, uint16_t sockets, uint16_t cores, + uint16_t threads, uint16_t maxcpus) +{ + if (maxcpus != 0) + return (EINVAL); /* XXX remove when supported */ + if ((sockets * cores * threads) > VM_MAXCPU) + return (EINVAL); + /* XXX need to check sockets * cores * threads == vCPU, how? */ + vm->sockets = sockets; + vm->cores = cores; + vm->threads = threads; + vm->maxcpus = maxcpus; + return(0); } static void Modified: stable/11/sys/amd64/vmm/vmm_dev.c ============================================================================== --- stable/11/sys/amd64/vmm/vmm_dev.c Thu May 23 21:05:05 2019 (r348200) +++ stable/11/sys/amd64/vmm/vmm_dev.c Thu May 23 21:23:18 2019 (r348201) @@ -314,6 +314,7 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t da struct vm_rtc_time *rtctime; struct vm_rtc_data *rtcdata; struct vm_memmap *mm; + struct vm_cpu_topology *topology; sc = vmmdev_lookup2(cdev); if (sc == NULL) @@ -640,6 +641,17 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t da break; case VM_RESTART_INSTRUCTION: error = vm_restart_instruction(sc->vm, vcpu); + break; + case VM_SET_TOPOLOGY: + topology = (struct vm_cpu_topology *)data; + error = vm_set_topology(sc->vm, topology->sockets, + topology->cores, topology->threads, topology->maxcpus); + break; + case VM_GET_TOPOLOGY: + topology = (struct vm_cpu_topology *)data; + vm_get_topology(sc->vm, &topology->sockets, &topology->cores, + &topology->threads, &topology->maxcpus); + error = 0; break; default: error = ENOTTY; Modified: stable/11/sys/amd64/vmm/x86.c ============================================================================== --- stable/11/sys/amd64/vmm/x86.c Thu May 23 21:05:05 2019 (r348200) +++ stable/11/sys/amd64/vmm/x86.c Thu May 23 21:23:18 2019 (r348201) @@ -58,16 +58,15 @@ static uint64_t bhyve_xcpuids; SYSCTL_ULONG(_hw_vmm, OID_AUTO, bhyve_xcpuids, CTLFLAG_RW, &bhyve_xcpuids, 0, "Number of times an unknown cpuid leaf was accessed"); -/* - * The default CPU topology is a single thread per package. - */ -static u_int threads_per_core = 1; +#if __FreeBSD_version < 1200060 /* Remove after 11 EOL helps MFCing */ +extern u_int threads_per_core; SYSCTL_UINT(_hw_vmm_topology, OID_AUTO, threads_per_core, CTLFLAG_RDTUN, &threads_per_core, 0, NULL); -static u_int cores_per_package = 1; +extern u_int cores_per_package; SYSCTL_UINT(_hw_vmm_topology, OID_AUTO, cores_per_package, CTLFLAG_RDTUN, &cores_per_package, 0, NULL); +#endif static int cpuid_leaf_b = 1; SYSCTL_INT(_hw_vmm_topology, OID_AUTO, cpuid_leaf_b, CTLFLAG_RDTUN, @@ -93,6 +92,7 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, int error, enable_invpcid, level, width, x2apic_id; unsigned int func, regs[4], logical_cpus; enum x2apic_state x2apic_state; + uint16_t cores, maxcpus, sockets, threads; VCPU_CTR2(vm, vcpu_id, "cpuid %#x,%#x", *eax, *ecx); @@ -140,11 +140,11 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, * * However this matches the logical cpus as * advertised by leaf 0x1 and will work even - * if the 'threads_per_core' tunable is set - * incorrectly on an AMD host. + * if threads is set incorrectly on an AMD host. */ - logical_cpus = threads_per_core * - cores_per_package; + vm_get_topology(vm, &sockets, &cores, &threads, + &maxcpus); + logical_cpus = threads * cores; regs[2] = logical_cpus - 1; } break; @@ -303,7 +303,9 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, */ regs[3] |= (CPUID_MCA | CPUID_MCE | CPUID_MTRR); - logical_cpus = threads_per_core * cores_per_package; + vm_get_topology(vm, &sockets, &cores, &threads, + &maxcpus); + logical_cpus = threads * cores; regs[1] &= ~CPUID_HTT_CORES; regs[1] |= (logical_cpus & 0xff) << 16; regs[3] |= CPUID_HTT; @@ -313,8 +315,10 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, cpuid_count(*eax, *ecx, regs); if (regs[0] || regs[1] || regs[2] || regs[3]) { + vm_get_topology(vm, &sockets, &cores, &threads, + &maxcpus); regs[0] &= 0x3ff; - regs[0] |= (cores_per_package - 1) << 26; + regs[0] |= (cores - 1) << 26; /* * Cache topology: * - L1 and L2 are shared only by the logical @@ -322,10 +326,10 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, * - L3 and above are shared by all logical * processors in the package. */ - logical_cpus = threads_per_core; + logical_cpus = threads; level = (regs[0] >> 5) & 0x7; if (level >= 3) - logical_cpus *= cores_per_package; + logical_cpus *= cores; regs[0] |= (logical_cpus - 1) << 14; } break; @@ -387,16 +391,17 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, /* * Processor topology enumeration */ + vm_get_topology(vm, &sockets, &cores, &threads, + &maxcpus); if (*ecx == 0) { - logical_cpus = threads_per_core; + logical_cpus = threads; width = log2(logical_cpus); level = CPUID_TYPE_SMT; x2apic_id = vcpu_id; } if (*ecx == 1) { - logical_cpus = threads_per_core * - cores_per_package; + logical_cpus = threads * cores; width = log2(logical_cpus); level = CPUID_TYPE_CORE; x2apic_id = vcpu_id; Modified: stable/11/usr.sbin/bhyve/bhyve.8 ============================================================================== --- stable/11/usr.sbin/bhyve/bhyve.8 Thu May 23 21:05:05 2019 (r348200) +++ stable/11/usr.sbin/bhyve/bhyve.8 Thu May 23 21:23:18 2019 (r348201) @@ -33,7 +33,16 @@ .Sh SYNOPSIS .Nm .Op Fl abehuwxACHPSWY -.Op Fl c Ar numcpus +.Oo +.Fl c\~ Ns +.Oo +.Op Ar cpus= Ns +.Ar numcpus Ns +.Oc Ns +.Op Ar ,sockets=n Ns +.Op Ar ,cores=n Ns +.Op Ar ,threads=n +.Oc .Op Fl g Ar gdbport .Op Fl l Ar lpcdev Ns Op , Ns Ar conf .Op Fl m Ar memsize Ns Op Ar K|k|M|m|G|g|T|t @@ -77,9 +86,30 @@ Enable a low-level console device supported by kernels compiled with .Cd "device bvmconsole" . This option will be deprecated in a future version. -.It Fl c Ar numcpus -Number of guest virtual CPUs. -The default is 1 and the maximum is 16. +.It Fl c Op Ar setting ... +Number of guest virtual CPUs +and/or the CPU topology. +The default value for each of +.Ar numcpus , +.Ar sockets , +.Ar cores , +and +.Ar threads +is 1. +The current maximum number of guest virtual CPUs is 16. +If +.Ar numcpus +is not specified then it will be calculated from the other arguments. +The topology must be consistent in that the +.Ar numcpus +must equal the product of +.Ar sockets , +.Ar cores , +and +.Ar threads . +If a +.Ar setting +is specified more than once the last one has precedence. .It Fl C Include guest memory in core file. .It Fl e Modified: stable/11/usr.sbin/bhyve/bhyverun.c ============================================================================== --- stable/11/usr.sbin/bhyve/bhyverun.c Thu May 23 21:05:05 2019 (r348200) +++ stable/11/usr.sbin/bhyve/bhyverun.c Thu May 23 21:23:18 2019 (r348201) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifndef WITHOUT_CAPSICUM #include #include @@ -163,6 +164,8 @@ extern int vmexit_task_switch(struct vmctx *, struct v char *vmname; int guest_ncpus; +uint16_t cores, maxcpus, sockets, threads; + char *guest_uuid_str; static int guest_vmexit_on_hlt, guest_vmexit_on_pause; @@ -207,11 +210,13 @@ usage(int code) { fprintf(stderr, - "Usage: %s [-abehuwxACHPSWY] [-c vcpus] [-g ] [-l ]\n" + "Usage: %s [-abehuwxACHPSWY]\n" + " %*s [-c [[cpus=]numcpus][,sockets=n][,cores=n][,threads=n]]\n" + " %*s [-g ] [-l ]\n" " %*s [-m mem] [-p vcpu:hostcpu] [-s ] [-U uuid] \n" " -a: local apic is in xAPIC mode (deprecated)\n" " -A: create ACPI tables\n" - " -c: # cpus (default 1)\n" + " -c: number of cpus and/or topology specification\n" " -C: include guest memory in core file\n" " -e: exit on unhandled I/O access\n" " -g: gdb port\n" @@ -229,7 +234,8 @@ usage(int code) " -W: force virtio to use single-vector MSI\n" " -x: local apic is in x2APIC mode\n" " -Y: disable MPtable generation\n", - progname, (int)strlen(progname), ""); + progname, (int)strlen(progname), "", (int)strlen(progname), "", + (int)strlen(progname), ""); exit(code); } @@ -271,7 +277,95 @@ bhyve_caph_limit_stdoe(void) #endif +/* + * XXX This parser is known to have the following issues: + * 1. It accepts null key=value tokens ",,". + * 2. It accepts whitespace after = and before value. + * 3. Values out of range of INT are silently wrapped. + * 4. It doesn't check non-final values. + * 5. The apparently bogus limits of UINT16_MAX are for future expansion. + * + * The acceptance of a null specification ('-c ""') is by design to match the + * manual page syntax specification, this results in a topology of 1 vCPU. + */ static int +topology_parse(const char *opt) +{ + uint64_t ncpus; + int c, chk, n, s, t, tmp; + char *cp, *str; + bool ns, scts; + + c = 1, n = 1, s = 1, t = 1; + ns = false, scts = false; + str = strdup(opt); + if (str == NULL) + goto out; + + while ((cp = strsep(&str, ",")) != NULL) { + if (sscanf(cp, "%i%n", &tmp, &chk) == 1) { + n = tmp; + ns = true; + } else if (sscanf(cp, "cpus=%i%n", &tmp, &chk) == 1) { + n = tmp; + ns = true; + } else if (sscanf(cp, "sockets=%i%n", &tmp, &chk) == 1) { + s = tmp; + scts = true; + } else if (sscanf(cp, "cores=%i%n", &tmp, &chk) == 1) { + c = tmp; + scts = true; + } else if (sscanf(cp, "threads=%i%n", &tmp, &chk) == 1) { + t = tmp; + scts = true; +#ifdef notyet /* Do not expose this until vmm.ko implements it */ + } else if (sscanf(cp, "maxcpus=%i%n", &tmp, &chk) == 1) { + m = tmp; +#endif + /* Skip the empty argument case from -c "" */ + } else if (cp[0] == '\0') + continue; + else + goto out; + /* Any trailing garbage causes an error */ + if (cp[chk] != '\0') + goto out; + } + free(str); + str = NULL; + + /* + * Range check 1 <= n <= UINT16_MAX all values + */ + if (n < 1 || s < 1 || c < 1 || t < 1 || + n > UINT16_MAX || s > UINT16_MAX || c > UINT16_MAX || + t > UINT16_MAX) + return (-1); + + /* If only the cpus was specified, use that as sockets */ + if (!scts) + s = n; + /* + * Compute sockets * cores * threads avoiding overflow + * The range check above insures these are 16 bit values + * If n was specified check it against computed ncpus + */ + ncpus = (uint64_t)s * c * t; + if (ncpus > UINT16_MAX || (ns && n != ncpus)) + return (-1); + + guest_ncpus = ncpus; + sockets = s; + cores = c; + threads = t; + return(0); + +out: + free(str); + return (-1); +} + +static int pincpu_parse(const char *opt) { int vcpu, pcpu; @@ -899,6 +993,9 @@ do_open(const char *vmname) exit(4); } } + error = vm_set_topology(ctx, sockets, cores, threads, maxcpus); + if (error) + errx(EX_OSERR, "vm_set_topology"); return (ctx); } @@ -917,6 +1014,8 @@ main(int argc, char *argv[]) progname = basename(argv[0]); gdb_port = 0; guest_ncpus = 1; + sockets = cores = threads = 1; + maxcpus = 0; memsize = 256 * MB; mptgen = 1; rtc_localtime = 1; @@ -941,7 +1040,10 @@ main(int argc, char *argv[]) } break; case 'c': - guest_ncpus = atoi(optarg); + if (topology_parse(optarg) != 0) { + errx(EX_USAGE, "invalid cpu topology " + "'%s'", optarg); + } break; case 'C': memflags |= VM_MEM_F_INCORE; @@ -1018,11 +1120,6 @@ main(int argc, char *argv[]) vmname = argv[0]; ctx = do_open(vmname); - - if (guest_ncpus < 1) { - fprintf(stderr, "Invalid guest vCPUs (%d)\n", guest_ncpus); - exit(1); - } max_vcpus = num_vcpus_allowed(ctx); if (guest_ncpus > max_vcpus) { Modified: stable/11/usr.sbin/bhyvectl/bhyvectl.c ============================================================================== --- stable/11/usr.sbin/bhyvectl/bhyvectl.c Thu May 23 21:05:05 2019 (r348200) +++ stable/11/usr.sbin/bhyvectl/bhyvectl.c Thu May 23 21:23:18 2019 (r348201) @@ -191,7 +191,8 @@ usage(bool cpu_intel) " [--get-msr-bitmap]\n" " [--get-msr-bitmap-address]\n" " [--get-guest-sysenter]\n" - " [--get-exit-reason]\n", + " [--get-exit-reason]\n" + " [--get-cpu-topology]\n", progname); if (cpu_intel) { @@ -285,6 +286,7 @@ static int set_x2apic_state, get_x2apic_state; enum x2apic_state x2apic_state; static int unassign_pptdev, bus, slot, func; static int run; +static int get_cpu_topology; /* * VMCB specific. @@ -1456,6 +1458,7 @@ setup_options(bool cpu_intel) { "get-active-cpus", NO_ARG, &get_active_cpus, 1 }, { "get-suspended-cpus", NO_ARG, &get_suspended_cpus, 1 }, { "get-intinfo", NO_ARG, &get_intinfo, 1 }, + { "get-cpu-topology", NO_ARG, &get_cpu_topology, 1 }, }; const struct option intel_opts[] = { @@ -2310,6 +2313,14 @@ main(int argc, char *argv[]) printf("%-40s\t%ld\n", desc, stats[i]); } } + } + + if (!error && (get_cpu_topology || get_all)) { + uint16_t sockets, cores, threads, maxcpus; + + vm_get_topology(ctx, &sockets, &cores, &threads, &maxcpus); + printf("cpu_topology:\tsockets=%hu, cores=%hu, threads=%hu, " + "maxcpus=%hu\n", sockets, cores, threads, maxcpus); } if (!error && run) { From owner-svn-src-stable@freebsd.org Thu May 23 21:52:25 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96CE515B6EF7; Thu, 23 May 2019 21:52:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 37BD48A2FE; Thu, 23 May 2019 21:52:25 +0000 (UTC) (envelope-from jhb@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0D7C5B352; Thu, 23 May 2019 21:52:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4NLqOWc077671; Thu, 23 May 2019 21:52:24 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4NLqOJV077670; Thu, 23 May 2019 21:52:24 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201905232152.x4NLqOJV077670@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 23 May 2019 21:52:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348202 - stable/12/sys/opencrypto X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/12/sys/opencrypto X-SVN-Commit-Revision: 348202 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 37BD48A2FE X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_SHORT(-0.96)[-0.962,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 21:52:25 -0000 Author: jhb Date: Thu May 23 21:52:24 2019 New Revision: 348202 URL: https://svnweb.freebsd.org/changeset/base/348202 Log: MFC 346649: Don't panic for empty CCM requests. A request to encrypt an empty payload without any AAD is unusual, but it is defined behavior. Removing this assertion removes a panic and instead returns the correct tag for an empty buffer. Modified: stable/12/sys/opencrypto/cbc_mac.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/opencrypto/cbc_mac.c ============================================================================== --- stable/12/sys/opencrypto/cbc_mac.c Thu May 23 21:23:18 2019 (r348201) +++ stable/12/sys/opencrypto/cbc_mac.c Thu May 23 21:52:24 2019 (r348202) @@ -82,9 +82,6 @@ AES_CBC_MAC_Reinit(struct aes_cbc_mac_ctx *ctx, const uint8_t *bp = b0, flags = 0; uint8_t L = 0; uint64_t dataLength = ctx->cryptDataLength; - - KASSERT(ctx->authDataLength != 0 || ctx->cryptDataLength != 0, - ("Auth Data and Data lengths cannot both be 0")); KASSERT(nonceLen >= 7 && nonceLen <= 13, ("nonceLen must be between 7 and 13 bytes")); From owner-svn-src-stable@freebsd.org Thu May 23 21:58:00 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D060615B7109; Thu, 23 May 2019 21:57:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6F2DD8A7C4; Thu, 23 May 2019 21:57:59 +0000 (UTC) (envelope-from jhb@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 49EA2B36E; Thu, 23 May 2019 21:57:59 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4NLvxEn078382; Thu, 23 May 2019 21:57:59 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4NLvwEZ078381; Thu, 23 May 2019 21:57:58 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201905232157.x4NLvwEZ078381@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 23 May 2019 21:57:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348203 - stable/12/tests/sys/opencrypto X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/12/tests/sys/opencrypto X-SVN-Commit-Revision: 348203 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6F2DD8A7C4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 May 2019 21:58:00 -0000 Author: jhb Date: Thu May 23 21:57:58 2019 New Revision: 348203 URL: https://svnweb.freebsd.org/changeset/base/348203 Log: MFC 346617: Test the AES-CCM test vectors from the NIST Known Answer Tests. The CCM test vectors use a slightly different file format in that there are global key-value pairs as well as section key-value pairs that need to be used in each test. In addition, the sections can set multiple key-value pairs in the section name. The CCM KAT parser class is an iterator that returns a dictionary once per test where the dictionary contains all of the relevant key-value pairs for a given test (global, section name, section, test-specific). Note that all of the CCM decrypt tests use nonce and tag lengths that are not supported by OCF (OCF only supports a 12 byte nonce and 16 byte tag), so none of the decryption vectors are actually tested. Modified: stable/12/tests/sys/opencrypto/cryptodev.py stable/12/tests/sys/opencrypto/cryptotest.py Directory Properties: stable/12/ (props changed) Modified: stable/12/tests/sys/opencrypto/cryptodev.py ============================================================================== --- stable/12/tests/sys/opencrypto/cryptodev.py Thu May 23 21:52:24 2019 (r348202) +++ stable/12/tests/sys/opencrypto/cryptodev.py Thu May 23 21:57:58 2019 (r348203) @@ -381,6 +381,112 @@ class KATParser: yield values +# The CCM files use a bit of a different syntax that doesn't quite fit +# the generic KATParser. In particular, some keys are set globally at +# the start of the file, and some are set globally at the start of a +# section. +class KATCCMParser: + def __init__(self, fname): + self.fp = open(fname) + self._pending = None + self.read_globals() + + def read_globals(self): + self.global_values = {} + while True: + line = self.fp.readline() + if not line: + return + if line[0] == '#' or not line.strip(): + continue + if line[0] == '[': + self._pending = line + return + + try: + f, v = line.split(' =') + except: + print('line:', repr(line)) + raise + + v = v.strip() + + if f in self.global_values: + raise ValueError('already present: %r' % repr(f)) + self.global_values[f] = v + + def read_section_values(self, kwpairs): + self.section_values = self.global_values.copy() + for pair in kwpairs.split(', '): + f, v = pair.split(' = ') + if f in self.section_values: + raise ValueError('already present: %r' % repr(f)) + self.section_values[f] = v + + while True: + line = self.fp.readline() + if not line: + return + if line[0] == '#' or not line.strip(): + continue + if line[0] == '[': + self._pending = line + return + + try: + f, v = line.split(' =') + except: + print('line:', repr(line)) + raise + + if f == 'Count': + self._pending = line + return + + v = v.strip() + + if f in self.section_values: + raise ValueError('already present: %r' % repr(f)) + self.section_values[f] = v + + def __iter__(self): + while True: + if self._pending: + line = self._pending + self._pending = None + else: + line = self.fp.readline() + if not line: + return + + if (line and line[0] == '#') or not line.strip(): + continue + + if line[0] == '[': + section = line[1:].split(']', 1)[0] + self.read_section_values(section) + continue + + values = self.section_values.copy() + + while True: + try: + f, v = line.split(' =') + except: + print('line:', repr(line)) + raise + v = v.strip() + + if f in values: + raise ValueError('already present: %r' % repr(f)) + values[f] = v + line = self.fp.readline().strip() + if not line: + break + + yield values + + def _spdechex(s): return ''.join(s.split()).decode('hex') Modified: stable/12/tests/sys/opencrypto/cryptotest.py ============================================================================== --- stable/12/tests/sys/opencrypto/cryptotest.py Thu May 23 21:52:24 2019 (r348202) +++ stable/12/tests/sys/opencrypto/cryptotest.py Thu May 23 21:57:58 2019 (r348203) @@ -71,6 +71,14 @@ def GenTestCase(cname): for i in katg('KAT_AES', 'CBC[GKV]*.rsp'): self.runCBC(i) + @unittest.skipIf(cname not in aesmodules, 'skipping AES-CCM on %s' % (cname)) + def test_ccm(self): + for i in katg('ccmtestvectors', 'V*.rsp'): + self.runCCMEncrypt(i) + + for i in katg('ccmtestvectors', 'D*.rsp'): + self.runCCMDecrypt(i) + @unittest.skipIf(cname not in aesmodules, 'skipping AES-GCM on %s' % (cname)) def test_gcm(self): for i in katg('gcmtestvectors', 'gcmEncrypt*'): @@ -219,6 +227,93 @@ def GenTestCase(cname): raise continue self.assertEqual(r, ct) + + def runCCMEncrypt(self, fname): + for data in cryptodev.KATCCMParser(fname): + Nlen = int(data['Nlen']) + if Nlen != 12: + # OCF only supports 12 byte IVs + continue + key = data['Key'].decode('hex') + nonce = data['Nonce'].decode('hex') + Alen = int(data['Alen']) + if Alen != 0: + aad = data['Adata'].decode('hex') + else: + aad = None + payload = data['Payload'].decode('hex') + ct = data['CT'].decode('hex') + + try: + c = Crypto(crid=crid, + cipher=cryptodev.CRYPTO_AES_CCM_16, + key=key, + mac=cryptodev.CRYPTO_AES_CCM_CBC_MAC, + mackey=key, maclen=16) + r, tag = Crypto.encrypt(c, payload, + nonce, aad) + except EnvironmentError, e: + if e.errno != errno.EOPNOTSUPP: + raise + continue + + out = r + tag + self.assertEqual(out, ct, + "Count " + data['Count'] + " Actual: " + \ + repr(out.encode("hex")) + " Expected: " + \ + repr(data) + " on " + cname) + + def runCCMDecrypt(self, fname): + # XXX: Note that all of the current CCM + # decryption test vectors use IV and tag sizes + # that aren't supported by OCF none of the + # tests are actually ran. + for data in cryptodev.KATCCMParser(fname): + Nlen = int(data['Nlen']) + if Nlen != 12: + # OCF only supports 12 byte IVs + continue + Tlen = int(data['Tlen']) + if Tlen != 16: + # OCF only supports 16 byte tags + continue + key = data['Key'].decode('hex') + nonce = data['Nonce'].decode('hex') + Alen = int(data['Alen']) + if Alen != 0: + aad = data['Adata'].decode('hex') + else: + aad = None + ct = data['CT'].decode('hex') + tag = ct[-16:] + ct = ct[:-16] + + try: + c = Crypto(crid=crid, + cipher=cryptodev.CRYPTO_AES_CCM_16, + key=key, + mac=cryptodev.CRYPTO_AES_CCM_CBC_MAC, + mackey=key, maclen=16) + except EnvironmentError, e: + if e.errno != errno.EOPNOTSUPP: + raise + continue + + if data['Result'] == 'Fail': + self.assertRaises(IOError, + c.decrypt, payload, nonce, aad, tag) + else: + r = Crypto.decrypt(c, payload, nonce, + aad, tag) + + payload = data['Payload'].decode('hex') + Plen = int(data('Plen')) + payload = payload[:plen] + self.assertEqual(r, payload, + "Count " + data['Count'] + \ + " Actual: " + repr(r.encode("hex")) + \ + " Expected: " + repr(data) + \ + " on " + cname) ############### ##### DES ##### From owner-svn-src-stable@freebsd.org Fri May 24 00:00:30 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3BFDF15B9BAA; Fri, 24 May 2019 00:00:30 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D0DBC69A86; Fri, 24 May 2019 00:00:29 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AA0F9CA58; Fri, 24 May 2019 00:00:29 +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 x4O00TDv046334; Fri, 24 May 2019 00:00:29 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4O00T9h046333; Fri, 24 May 2019 00:00:29 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201905240000.x4O00T9h046333@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Fri, 24 May 2019 00:00:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r348211 - stable/11/sys/conf X-SVN-Group: stable-11 X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: stable/11/sys/conf X-SVN-Commit-Revision: 348211 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D0DBC69A86 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2019 00:00:30 -0000 Author: gjb Date: Fri May 24 00:00:29 2019 New Revision: 348211 URL: https://svnweb.freebsd.org/changeset/base/348211 Log: Update stable/11 to BETA1 as part of the 11.3-RELEASE cycle. Approved by: re (implicit) Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/conf/newvers.sh Modified: stable/11/sys/conf/newvers.sh ============================================================================== --- stable/11/sys/conf/newvers.sh Thu May 23 23:37:11 2019 (r348210) +++ stable/11/sys/conf/newvers.sh Fri May 24 00:00:29 2019 (r348211) @@ -44,7 +44,7 @@ TYPE="FreeBSD" REVISION="11.3" -BRANCH="PRERELEASE" +BRANCH="BETA1" if [ -n "${BRANCH_OVERRIDE}" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-stable@freebsd.org Fri May 24 00:44:32 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 97D6615911F9; Fri, 24 May 2019 00:44:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3A8246B7C8; Fri, 24 May 2019 00:44:32 +0000 (UTC) (envelope-from jhb@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 193CAD2E2; Fri, 24 May 2019 00:44:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4O0iVYe072856; Fri, 24 May 2019 00:44:31 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4O0iVsV072853; Fri, 24 May 2019 00:44:31 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201905240044.x4O0iVsV072853@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 24 May 2019 00:44:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348213 - in stable/12/sys/dev/cxgbe: crypto tom X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable/12/sys/dev/cxgbe: crypto tom X-SVN-Commit-Revision: 348213 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3A8246B7C8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.964,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2019 00:44:32 -0000 Author: jhb Date: Fri May 24 00:44:31 2019 New Revision: 348213 URL: https://svnweb.freebsd.org/changeset/base/348213 Log: MFC 340486: Consolidate on a single set of constants for SCMD fields. Both ccr(4) and the TOE TLS code had separate sets of constants for fields in SCMD messages. Modified: stable/12/sys/dev/cxgbe/crypto/t4_crypto.c stable/12/sys/dev/cxgbe/crypto/t4_crypto.h stable/12/sys/dev/cxgbe/tom/t4_tls.c stable/12/sys/dev/cxgbe/tom/t4_tls.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/cxgbe/crypto/t4_crypto.c ============================================================================== --- stable/12/sys/dev/cxgbe/crypto/t4_crypto.c Fri May 24 00:34:13 2019 (r348212) +++ stable/12/sys/dev/cxgbe/crypto/t4_crypto.c Fri May 24 00:44:31 2019 (r348213) @@ -444,10 +444,10 @@ ccr_hash(struct ccr_softc *sc, struct ccr_session *s, if (s->mode == HMAC) { use_opad = 1; - hmac_ctrl = CHCR_SCMD_HMAC_CTRL_NO_TRUNC; + hmac_ctrl = SCMD_HMAC_CTRL_NO_TRUNC; } else { use_opad = 0; - hmac_ctrl = CHCR_SCMD_HMAC_CTRL_NOP; + hmac_ctrl = SCMD_HMAC_CTRL_NOP; } /* PADs must be 128-bit aligned. */ @@ -513,8 +513,8 @@ ccr_hash(struct ccr_softc *sc, struct ccr_session *s, /* These two flits are actually a CPL_TLS_TX_SCMD_FMT. */ crwr->sec_cpl.seqno_numivs = htobe32( V_SCMD_SEQ_NO_CTRL(0) | - V_SCMD_PROTO_VERSION(CHCR_SCMD_PROTO_VERSION_GENERIC) | - V_SCMD_CIPH_MODE(CHCR_SCMD_CIPHER_MODE_NOP) | + V_SCMD_PROTO_VERSION(SCMD_PROTO_VERSION_GENERIC) | + V_SCMD_CIPH_MODE(SCMD_CIPH_MODE_NOP) | V_SCMD_AUTH_MODE(s->hmac.auth_mode) | V_SCMD_HMAC_CTRL(hmac_ctrl)); crwr->sec_cpl.ivgen_hdrlen = htobe32( @@ -683,11 +683,11 @@ ccr_blkcipher(struct ccr_softc *sc, struct ccr_session /* These two flits are actually a CPL_TLS_TX_SCMD_FMT. */ crwr->sec_cpl.seqno_numivs = htobe32( V_SCMD_SEQ_NO_CTRL(0) | - V_SCMD_PROTO_VERSION(CHCR_SCMD_PROTO_VERSION_GENERIC) | + V_SCMD_PROTO_VERSION(SCMD_PROTO_VERSION_GENERIC) | V_SCMD_ENC_DEC_CTRL(op_type) | V_SCMD_CIPH_MODE(s->blkcipher.cipher_mode) | - V_SCMD_AUTH_MODE(CHCR_SCMD_AUTH_MODE_NOP) | - V_SCMD_HMAC_CTRL(CHCR_SCMD_HMAC_CTRL_NOP) | + V_SCMD_AUTH_MODE(SCMD_AUTH_MODE_NOP) | + V_SCMD_HMAC_CTRL(SCMD_HMAC_CTRL_NOP) | V_SCMD_IV_SIZE(s->blkcipher.iv_len / 2) | V_SCMD_NUM_IVS(0)); crwr->sec_cpl.ivgen_hdrlen = htobe32( @@ -761,12 +761,12 @@ ccr_hmac_ctrl(unsigned int hashsize, unsigned int auth { if (authsize == 10) - return (CHCR_SCMD_HMAC_CTRL_TRUNC_RFC4366); + return (SCMD_HMAC_CTRL_TRUNC_RFC4366); if (authsize == 12) - return (CHCR_SCMD_HMAC_CTRL_IPSEC_96BIT); + return (SCMD_HMAC_CTRL_IPSEC_96BIT); if (authsize == hashsize / 2) - return (CHCR_SCMD_HMAC_CTRL_DIV2); - return (CHCR_SCMD_HMAC_CTRL_NO_TRUNC); + return (SCMD_HMAC_CTRL_DIV2); + return (SCMD_HMAC_CTRL_NO_TRUNC); } static int @@ -1019,7 +1019,7 @@ ccr_authenc(struct ccr_softc *sc, struct ccr_session * hmac_ctrl = ccr_hmac_ctrl(axf->hashsize, hash_size_in_response); crwr->sec_cpl.seqno_numivs = htobe32( V_SCMD_SEQ_NO_CTRL(0) | - V_SCMD_PROTO_VERSION(CHCR_SCMD_PROTO_VERSION_GENERIC) | + V_SCMD_PROTO_VERSION(SCMD_PROTO_VERSION_GENERIC) | V_SCMD_ENC_DEC_CTRL(op_type) | V_SCMD_CIPH_AUTH_SEQ_CTRL(op_type == CHCR_ENCRYPT_OP ? 1 : 0) | V_SCMD_CIPH_MODE(s->blkcipher.cipher_mode) | @@ -1362,11 +1362,11 @@ ccr_gcm(struct ccr_softc *sc, struct ccr_session *s, s hmac_ctrl = ccr_hmac_ctrl(AES_GMAC_HASH_LEN, hash_size_in_response); crwr->sec_cpl.seqno_numivs = htobe32( V_SCMD_SEQ_NO_CTRL(0) | - V_SCMD_PROTO_VERSION(CHCR_SCMD_PROTO_VERSION_GENERIC) | + V_SCMD_PROTO_VERSION(SCMD_PROTO_VERSION_GENERIC) | V_SCMD_ENC_DEC_CTRL(op_type) | V_SCMD_CIPH_AUTH_SEQ_CTRL(op_type == CHCR_ENCRYPT_OP ? 1 : 0) | - V_SCMD_CIPH_MODE(CHCR_SCMD_CIPHER_MODE_AES_GCM) | - V_SCMD_AUTH_MODE(CHCR_SCMD_AUTH_MODE_GHASH) | + V_SCMD_CIPH_MODE(SCMD_CIPH_MODE_AES_GCM) | + V_SCMD_AUTH_MODE(SCMD_AUTH_MODE_GHASH) | V_SCMD_HMAC_CTRL(hmac_ctrl) | V_SCMD_IV_SIZE(iv_len / 2) | V_SCMD_NUM_IVS(0)); @@ -1928,8 +1928,8 @@ ccr_newsession(device_t dev, crypto_session_t cses, st cipher = NULL; hash = NULL; auth_hash = NULL; - auth_mode = CHCR_SCMD_AUTH_MODE_NOP; - cipher_mode = CHCR_SCMD_CIPHER_MODE_NOP; + auth_mode = SCMD_AUTH_MODE_NOP; + cipher_mode = SCMD_CIPH_MODE_NOP; iv_len = 0; mk_size = 0; partial_digest_len = 0; @@ -1955,35 +1955,35 @@ ccr_newsession(device_t dev, crypto_session_t cses, st case CRYPTO_SHA1: case CRYPTO_SHA1_HMAC: auth_hash = &auth_hash_hmac_sha1; - auth_mode = CHCR_SCMD_AUTH_MODE_SHA1; + auth_mode = SCMD_AUTH_MODE_SHA1; mk_size = CHCR_KEYCTX_MAC_KEY_SIZE_160; partial_digest_len = SHA1_HASH_LEN; break; case CRYPTO_SHA2_224: case CRYPTO_SHA2_224_HMAC: auth_hash = &auth_hash_hmac_sha2_224; - auth_mode = CHCR_SCMD_AUTH_MODE_SHA224; + auth_mode = SCMD_AUTH_MODE_SHA224; mk_size = CHCR_KEYCTX_MAC_KEY_SIZE_256; partial_digest_len = SHA2_256_HASH_LEN; break; case CRYPTO_SHA2_256: case CRYPTO_SHA2_256_HMAC: auth_hash = &auth_hash_hmac_sha2_256; - auth_mode = CHCR_SCMD_AUTH_MODE_SHA256; + auth_mode = SCMD_AUTH_MODE_SHA256; mk_size = CHCR_KEYCTX_MAC_KEY_SIZE_256; partial_digest_len = SHA2_256_HASH_LEN; break; case CRYPTO_SHA2_384: case CRYPTO_SHA2_384_HMAC: auth_hash = &auth_hash_hmac_sha2_384; - auth_mode = CHCR_SCMD_AUTH_MODE_SHA512_384; + auth_mode = SCMD_AUTH_MODE_SHA512_384; mk_size = CHCR_KEYCTX_MAC_KEY_SIZE_512; partial_digest_len = SHA2_512_HASH_LEN; break; case CRYPTO_SHA2_512: case CRYPTO_SHA2_512_HMAC: auth_hash = &auth_hash_hmac_sha2_512; - auth_mode = CHCR_SCMD_AUTH_MODE_SHA512_512; + auth_mode = SCMD_AUTH_MODE_SHA512_512; mk_size = CHCR_KEYCTX_MAC_KEY_SIZE_512; partial_digest_len = SHA2_512_HASH_LEN; break; @@ -1991,7 +1991,7 @@ ccr_newsession(device_t dev, crypto_session_t cses, st case CRYPTO_AES_192_NIST_GMAC: case CRYPTO_AES_256_NIST_GMAC: gcm_hash = true; - auth_mode = CHCR_SCMD_AUTH_MODE_GHASH; + auth_mode = SCMD_AUTH_MODE_GHASH; mk_size = CHCR_KEYCTX_MAC_KEY_SIZE_128; break; } @@ -2014,19 +2014,19 @@ ccr_newsession(device_t dev, crypto_session_t cses, st cipher = c; switch (c->cri_alg) { case CRYPTO_AES_CBC: - cipher_mode = CHCR_SCMD_CIPHER_MODE_AES_CBC; + cipher_mode = SCMD_CIPH_MODE_AES_CBC; iv_len = AES_BLOCK_LEN; break; case CRYPTO_AES_ICM: - cipher_mode = CHCR_SCMD_CIPHER_MODE_AES_CTR; + cipher_mode = SCMD_CIPH_MODE_AES_CTR; iv_len = AES_BLOCK_LEN; break; case CRYPTO_AES_NIST_GCM_16: - cipher_mode = CHCR_SCMD_CIPHER_MODE_AES_GCM; + cipher_mode = SCMD_CIPH_MODE_AES_GCM; iv_len = AES_GCM_IV_LEN; break; case CRYPTO_AES_XTS: - cipher_mode = CHCR_SCMD_CIPHER_MODE_AES_XTS; + cipher_mode = SCMD_CIPH_MODE_AES_XTS; iv_len = AES_BLOCK_LEN; break; } @@ -2041,7 +2041,7 @@ ccr_newsession(device_t dev, crypto_session_t cses, st return (EINVAL); } } - if (gcm_hash != (cipher_mode == CHCR_SCMD_CIPHER_MODE_AES_GCM)) + if (gcm_hash != (cipher_mode == SCMD_CIPH_MODE_AES_GCM)) return (EINVAL); if (hash == NULL && cipher == NULL) return (EINVAL); Modified: stable/12/sys/dev/cxgbe/crypto/t4_crypto.h ============================================================================== --- stable/12/sys/dev/cxgbe/crypto/t4_crypto.h Fri May 24 00:34:13 2019 (r348212) +++ stable/12/sys/dev/cxgbe/crypto/t4_crypto.h Fri May 24 00:44:31 2019 (r348213) @@ -132,36 +132,41 @@ struct phys_sge_pairs { #define CHCR_ENCRYPT_OP 0 #define CHCR_DECRYPT_OP 1 -#define CHCR_SCMD_PROTO_VERSION_GENERIC 4 +#define SCMD_ENCDECCTRL_ENCRYPT 0 +#define SCMD_ENCDECCTRL_DECRYPT 1 -#define CHCR_SCMD_CIPHER_MODE_NOP 0 -#define CHCR_SCMD_CIPHER_MODE_AES_CBC 1 -#define CHCR_SCMD_CIPHER_MODE_AES_GCM 2 -#define CHCR_SCMD_CIPHER_MODE_AES_CTR 3 -#define CHCR_SCMD_CIPHER_MODE_GENERIC_AES 4 -#define CHCR_SCMD_CIPHER_MODE_AES_XTS 6 -#define CHCR_SCMD_CIPHER_MODE_AES_CCM 7 +#define SCMD_PROTO_VERSION_TLS_1_2 0 +#define SCMD_PROTO_VERSION_TLS_1_1 1 +#define SCMD_PROTO_VERSION_GENERIC 4 -#define CHCR_SCMD_AUTH_MODE_NOP 0 -#define CHCR_SCMD_AUTH_MODE_SHA1 1 -#define CHCR_SCMD_AUTH_MODE_SHA224 2 -#define CHCR_SCMD_AUTH_MODE_SHA256 3 -#define CHCR_SCMD_AUTH_MODE_GHASH 4 -#define CHCR_SCMD_AUTH_MODE_SHA512_224 5 -#define CHCR_SCMD_AUTH_MODE_SHA512_256 6 -#define CHCR_SCMD_AUTH_MODE_SHA512_384 7 -#define CHCR_SCMD_AUTH_MODE_SHA512_512 8 -#define CHCR_SCMD_AUTH_MODE_CBCMAC 9 -#define CHCR_SCMD_AUTH_MODE_CMAC 10 +#define SCMD_CIPH_MODE_NOP 0 +#define SCMD_CIPH_MODE_AES_CBC 1 +#define SCMD_CIPH_MODE_AES_GCM 2 +#define SCMD_CIPH_MODE_AES_CTR 3 +#define SCMD_CIPH_MODE_GENERIC_AES 4 +#define SCMD_CIPH_MODE_AES_XTS 6 +#define SCMD_CIPH_MODE_AES_CCM 7 -#define CHCR_SCMD_HMAC_CTRL_NOP 0 -#define CHCR_SCMD_HMAC_CTRL_NO_TRUNC 1 -#define CHCR_SCMD_HMAC_CTRL_TRUNC_RFC4366 2 -#define CHCR_SCMD_HMAC_CTRL_IPSEC_96BIT 3 -#define CHCR_SCMD_HMAC_CTRL_PL1 4 -#define CHCR_SCMD_HMAC_CTRL_PL2 5 -#define CHCR_SCMD_HMAC_CTRL_PL3 6 -#define CHCR_SCMD_HMAC_CTRL_DIV2 7 +#define SCMD_AUTH_MODE_NOP 0 +#define SCMD_AUTH_MODE_SHA1 1 +#define SCMD_AUTH_MODE_SHA224 2 +#define SCMD_AUTH_MODE_SHA256 3 +#define SCMD_AUTH_MODE_GHASH 4 +#define SCMD_AUTH_MODE_SHA512_224 5 +#define SCMD_AUTH_MODE_SHA512_256 6 +#define SCMD_AUTH_MODE_SHA512_384 7 +#define SCMD_AUTH_MODE_SHA512_512 8 +#define SCMD_AUTH_MODE_CBCMAC 9 +#define SCMD_AUTH_MODE_CMAC 10 + +#define SCMD_HMAC_CTRL_NOP 0 +#define SCMD_HMAC_CTRL_NO_TRUNC 1 +#define SCMD_HMAC_CTRL_TRUNC_RFC4366 2 +#define SCMD_HMAC_CTRL_IPSEC_96BIT 3 +#define SCMD_HMAC_CTRL_PL1 4 +#define SCMD_HMAC_CTRL_PL2 5 +#define SCMD_HMAC_CTRL_PL3 6 +#define SCMD_HMAC_CTRL_DIV2 7 /* This are not really mac key size. They are intermediate values * of sha engine and its size Modified: stable/12/sys/dev/cxgbe/tom/t4_tls.c ============================================================================== --- stable/12/sys/dev/cxgbe/tom/t4_tls.c Fri May 24 00:34:13 2019 (r348212) +++ stable/12/sys/dev/cxgbe/tom/t4_tls.c Fri May 24 00:44:31 2019 (r348213) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #ifdef TCP_OFFLOAD #include "common/common.h" #include "common/t4_tcb.h" +#include "crypto/t4_crypto.h" #include "tom/t4_tom_l2t.h" #include "tom/t4_tom.h" Modified: stable/12/sys/dev/cxgbe/tom/t4_tls.h ============================================================================== --- stable/12/sys/dev/cxgbe/tom/t4_tls.h Fri May 24 00:34:13 2019 (r348212) +++ stable/12/sys/dev/cxgbe/tom/t4_tls.h Fri May 24 00:44:31 2019 (r348213) @@ -249,16 +249,6 @@ enum { CH_MK_SIZE_NOP, }; -#define SCMD_ENCDECCTRL_ENCRYPT 0 -#define SCMD_ENCDECCTRL_DECRYPT 1 - -#define SCMD_CIPH_MODE_NOP 0 -#define SCMD_CIPH_MODE_AES_CBC 1 -#define SCMD_CIPH_MODE_AES_GCM 2 -#define SCMD_CIPH_MODE_AES_CTR 3 -#define SCMD_CIPH_MODE_AES_GEN 4 -#define SCMD_CIPH_MODE_AES_CCM 7 - struct tls_scmd { __be32 seqno_numivs; __be32 ivgen_hdrlen; From owner-svn-src-stable@freebsd.org Fri May 24 01:51:59 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 57E071592E0B; Fri, 24 May 2019 01:51:59 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ECC506DC0C; Fri, 24 May 2019 01:51:58 +0000 (UTC) (envelope-from jhibbits@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C8EA5DD7B; Fri, 24 May 2019 01:51:58 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4O1pwVo007529; Fri, 24 May 2019 01:51:58 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4O1pwci007528; Fri, 24 May 2019 01:51:58 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201905240151.x4O1pwci007528@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 24 May 2019 01:51:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348218 - stable/12/sys/powerpc/aim X-SVN-Group: stable-12 X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: stable/12/sys/powerpc/aim X-SVN-Commit-Revision: 348218 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: ECC506DC0C X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2019 01:51:59 -0000 Author: jhibbits Date: Fri May 24 01:51:58 2019 New Revision: 348218 URL: https://svnweb.freebsd.org/changeset/base/348218 Log: MFC r347463: powerpc: Initialize the Hardware Interrupt Offset Register (HIOR) earlier for ppc970 Since we now have a much larger KVA on powerpc64, it's possible to get SLB traps earlier in boot, possibly even before the HIOR is properly configured for us. Move the HIOR setup to immediately after reset, so that we use our exception handlers instead of Open Firmware's. PR: 233863 Modified: stable/12/sys/powerpc/aim/mp_cpudep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/powerpc/aim/mp_cpudep.c ============================================================================== --- stable/12/sys/powerpc/aim/mp_cpudep.c Fri May 24 01:43:35 2019 (r348217) +++ stable/12/sys/powerpc/aim/mp_cpudep.c Fri May 24 01:51:58 2019 (r348218) @@ -68,6 +68,10 @@ cpudep_ap_early_bootstrap(void) case IBM970: case IBM970FX: case IBM970MP: + /* Set HIOR to 0 */ + __asm __volatile("mtspr 311,%0" :: "r"(0)); + powerpc_sync(); + /* Restore HID4 and HID5, which are necessary for the MMU */ #ifdef __powerpc64__ @@ -307,10 +311,6 @@ cpudep_ap_setup() case IBM970: case IBM970FX: case IBM970MP: - /* Set HIOR to 0 */ - __asm __volatile("mtspr 311,%0" :: "r"(0)); - powerpc_sync(); - /* * The 970 has strange rules about how to update HID registers. * See Table 2-3, 970MP manual From owner-svn-src-stable@freebsd.org Fri May 24 04:15:41 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5C961596B1B; Fri, 24 May 2019 04:15:40 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 60A2F727B2; Fri, 24 May 2019 04:15:40 +0000 (UTC) (envelope-from rgrimes@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3A181F832; Fri, 24 May 2019 04:15:40 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4O4FeIb084591; Fri, 24 May 2019 04:15:40 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4O4Fc85084583; Fri, 24 May 2019 04:15:38 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201905240415.x4O4Fc85084583@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Fri, 24 May 2019 04:15:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348223 - in stable/12/sys/amd64: include vmm vmm/amd vmm/intel vmm/io X-SVN-Group: stable-12 X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: in stable/12/sys/amd64: include vmm vmm/amd vmm/intel vmm/io X-SVN-Commit-Revision: 348223 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 60A2F727B2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.98)[-0.977,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2019 04:15:41 -0000 Author: rgrimes Date: Fri May 24 04:15:38 2019 New Revision: 348223 URL: https://svnweb.freebsd.org/changeset/base/348223 Log: MFC: r346714: Add accessor function for vm->maxcpus Replace most VM_MAXCPU constant useses with an accessor function to vm->maxcpus which for now is initialized and kept at the value of VM_MAXCPUS. This is a rework of Fabian Freyer (fabian.freyer_physik.tu-berlin.de) work from D10070 to adjust it for the cpu topology changes that occured in r332298 Approved by: bde (implicit) Modified: stable/12/sys/amd64/include/vmm.h stable/12/sys/amd64/vmm/amd/svm.c stable/12/sys/amd64/vmm/intel/vmx.c stable/12/sys/amd64/vmm/io/vlapic.c stable/12/sys/amd64/vmm/vmm.c stable/12/sys/amd64/vmm/vmm_dev.c stable/12/sys/amd64/vmm/vmm_lapic.c stable/12/sys/amd64/vmm/vmm_stat.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/include/vmm.h ============================================================================== --- stable/12/sys/amd64/include/vmm.h Fri May 24 02:44:15 2019 (r348222) +++ stable/12/sys/amd64/include/vmm.h Fri May 24 04:15:38 2019 (r348223) @@ -186,6 +186,7 @@ int vm_create(const char *name, struct vm **retvm); void vm_destroy(struct vm *vm); int vm_reinit(struct vm *vm); const char *vm_name(struct vm *vm); +uint16_t vm_get_maxcpus(struct vm *vm); void vm_get_topology(struct vm *vm, uint16_t *sockets, uint16_t *cores, uint16_t *threads, uint16_t *maxcpus); int vm_set_topology(struct vm *vm, uint16_t sockets, uint16_t cores, Modified: stable/12/sys/amd64/vmm/amd/svm.c ============================================================================== --- stable/12/sys/amd64/vmm/amd/svm.c Fri May 24 02:44:15 2019 (r348222) +++ stable/12/sys/amd64/vmm/amd/svm.c Fri May 24 04:15:38 2019 (r348223) @@ -524,6 +524,7 @@ svm_vminit(struct vm *vm, pmap_t pmap) struct svm_vcpu *vcpu; vm_paddr_t msrpm_pa, iopm_pa, pml4_pa; int i; + uint16_t maxcpus; svm_sc = malloc(sizeof (*svm_sc), M_SVM, M_WAITOK | M_ZERO); if (((uintptr_t)svm_sc & PAGE_MASK) != 0) @@ -577,7 +578,8 @@ svm_vminit(struct vm *vm, pmap_t pmap) iopm_pa = vtophys(svm_sc->iopm_bitmap); msrpm_pa = vtophys(svm_sc->msr_bitmap); pml4_pa = svm_sc->nptp; - for (i = 0; i < VM_MAXCPU; i++) { + maxcpus = vm_get_maxcpus(svm_sc->vm); + for (i = 0; i < maxcpus; i++) { vcpu = svm_get_vcpu(svm_sc, i); vcpu->nextrip = ~0; vcpu->lastcpu = NOCPU; Modified: stable/12/sys/amd64/vmm/intel/vmx.c ============================================================================== --- stable/12/sys/amd64/vmm/intel/vmx.c Fri May 24 02:44:15 2019 (r348222) +++ stable/12/sys/amd64/vmm/intel/vmx.c Fri May 24 04:15:38 2019 (r348223) @@ -943,6 +943,7 @@ vmx_vminit(struct vm *vm, pmap_t pmap) struct vmx *vmx; struct vmcs *vmcs; uint32_t exc_bitmap; + uint16_t maxcpus; vmx = malloc(sizeof(struct vmx), M_VMX, M_WAITOK | M_ZERO); if ((uintptr_t)vmx & PAGE_MASK) { @@ -1004,7 +1005,8 @@ vmx_vminit(struct vm *vm, pmap_t pmap) KASSERT(error == 0, ("vm_map_mmio(apicbase) error %d", error)); } - for (i = 0; i < VM_MAXCPU; i++) { + maxcpus = vm_get_maxcpus(vm); + for (i = 0; i < maxcpus; i++) { vmcs = &vmx->vmcs[i]; vmcs->identifier = vmx_revision(); error = vmclear(vmcs); @@ -3002,11 +3004,13 @@ vmx_vmcleanup(void *arg) { int i; struct vmx *vmx = arg; + uint16_t maxcpus; if (apic_access_virtualization(vmx, 0)) vm_unmap_mmio(vmx->vm, DEFAULT_APIC_BASE, PAGE_SIZE); - for (i = 0; i < VM_MAXCPU; i++) + maxcpus = vm_get_maxcpus(vmx->vm); + for (i = 0; i < maxcpus; i++) vpid_free(vmx->state[i].vpid); free(vmx, M_VMX); Modified: stable/12/sys/amd64/vmm/io/vlapic.c ============================================================================== --- stable/12/sys/amd64/vmm/io/vlapic.c Fri May 24 02:44:15 2019 (r348222) +++ stable/12/sys/amd64/vmm/io/vlapic.c Fri May 24 04:15:38 2019 (r348223) @@ -838,7 +838,7 @@ vlapic_calcdest(struct vm *vm, cpuset_t *dmask, uint32 */ CPU_ZERO(dmask); vcpuid = vm_apicid2vcpuid(vm, dest); - if (vcpuid < VM_MAXCPU) + if (vcpuid < vm_get_maxcpus(vm)) CPU_SET(vcpuid, dmask); } else { /* @@ -965,6 +965,7 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic, bool struct vlapic *vlapic2; struct vm_exit *vmexit; struct LAPIC *lapic; + uint16_t maxcpus; lapic = vlapic->apic_page; lapic->icr_lo &= ~APIC_DELSTAT_PEND; @@ -1026,11 +1027,12 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic, bool return (0); /* handled completely in the kernel */ } + maxcpus = vm_get_maxcpus(vlapic->vm); if (mode == APIC_DELMODE_INIT) { if ((icrval & APIC_LEVEL_MASK) == APIC_LEVEL_DEASSERT) return (0); - if (vlapic->vcpuid == 0 && dest != 0 && dest < VM_MAXCPU) { + if (vlapic->vcpuid == 0 && dest != 0 && dest < maxcpus) { vlapic2 = vm_lapic(vlapic->vm, dest); /* move from INIT to waiting-for-SIPI state */ @@ -1043,7 +1045,7 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic, bool } if (mode == APIC_DELMODE_STARTUP) { - if (vlapic->vcpuid == 0 && dest != 0 && dest < VM_MAXCPU) { + if (vlapic->vcpuid == 0 && dest != 0 && dest < maxcpus) { vlapic2 = vm_lapic(vlapic->vm, dest); /* @@ -1447,7 +1449,8 @@ void vlapic_init(struct vlapic *vlapic) { KASSERT(vlapic->vm != NULL, ("vlapic_init: vm is not initialized")); - KASSERT(vlapic->vcpuid >= 0 && vlapic->vcpuid < VM_MAXCPU, + KASSERT(vlapic->vcpuid >= 0 && + vlapic->vcpuid < vm_get_maxcpus(vlapic->vm), ("vlapic_init: vcpuid is not initialized")); KASSERT(vlapic->apic_page != NULL, ("vlapic_init: apic_page is not " "initialized")); Modified: stable/12/sys/amd64/vmm/vmm.c ============================================================================== --- stable/12/sys/amd64/vmm/vmm.c Fri May 24 02:44:15 2019 (r348222) +++ stable/12/sys/amd64/vmm/vmm.c Fri May 24 04:15:38 2019 (r348223) @@ -276,7 +276,7 @@ vcpu_init(struct vm *vm, int vcpu_id, bool create) { struct vcpu *vcpu; - KASSERT(vcpu_id >= 0 && vcpu_id < VM_MAXCPU, + KASSERT(vcpu_id >= 0 && vcpu_id < vm->maxcpus, ("vcpu_init: invalid vcpu %d", vcpu_id)); vcpu = &vm->vcpu[vcpu_id]; @@ -315,7 +315,7 @@ vm_exitinfo(struct vm *vm, int cpuid) { struct vcpu *vcpu; - if (cpuid < 0 || cpuid >= VM_MAXCPU) + if (cpuid < 0 || cpuid >= vm->maxcpus) panic("vm_exitinfo: invalid cpuid %d", cpuid); vcpu = &vm->vcpu[cpuid]; @@ -428,7 +428,7 @@ vm_init(struct vm *vm, bool create) vm->suspend = 0; CPU_ZERO(&vm->suspended_cpus); - for (i = 0; i < VM_MAXCPU; i++) + for (i = 0; i < vm->maxcpus; i++) vcpu_init(vm, i, create); } @@ -466,7 +466,7 @@ vm_create(const char *name, struct vm **retvm) vm->sockets = 1; vm->cores = cores_per_package; /* XXX backwards compatibility */ vm->threads = threads_per_core; /* XXX backwards compatibility */ - vm->maxcpus = 0; /* XXX not implemented */ + vm->maxcpus = VM_MAXCPU; /* XXX temp to keep code working */ vm_init(vm, true); @@ -484,19 +484,25 @@ vm_get_topology(struct vm *vm, uint16_t *sockets, uint *maxcpus = vm->maxcpus; } +uint16_t +vm_get_maxcpus(struct vm *vm) +{ + return (vm->maxcpus); +} + int vm_set_topology(struct vm *vm, uint16_t sockets, uint16_t cores, uint16_t threads, uint16_t maxcpus) { if (maxcpus != 0) return (EINVAL); /* XXX remove when supported */ - if ((sockets * cores * threads) > VM_MAXCPU) + if ((sockets * cores * threads) > vm->maxcpus) return (EINVAL); /* XXX need to check sockets * cores * threads == vCPU, how? */ vm->sockets = sockets; vm->cores = cores; vm->threads = threads; - vm->maxcpus = maxcpus; + vm->maxcpus = VM_MAXCPU; /* XXX temp to keep code working */ return(0); } @@ -521,7 +527,7 @@ vm_cleanup(struct vm *vm, bool destroy) vatpic_cleanup(vm->vatpic); vioapic_cleanup(vm->vioapic); - for (i = 0; i < VM_MAXCPU; i++) + for (i = 0; i < vm->maxcpus; i++) vcpu_cleanup(vm, i, destroy); VMCLEANUP(vm->cookie); @@ -956,9 +962,9 @@ vm_gpa_hold(struct vm *vm, int vcpuid, vm_paddr_t gpa, * guaranteed if at least one vcpu is in the VCPU_FROZEN state. */ int state; - KASSERT(vcpuid >= -1 && vcpuid < VM_MAXCPU, ("%s: invalid vcpuid %d", + KASSERT(vcpuid >= -1 && vcpuid < vm->maxcpus, ("%s: invalid vcpuid %d", __func__, vcpuid)); - for (i = 0; i < VM_MAXCPU; i++) { + for (i = 0; i < vm->maxcpus; i++) { if (vcpuid != -1 && vcpuid != i) continue; state = vcpu_get_state(vm, i, NULL); @@ -1004,7 +1010,7 @@ int vm_get_register(struct vm *vm, int vcpu, int reg, uint64_t *retval) { - if (vcpu < 0 || vcpu >= VM_MAXCPU) + if (vcpu < 0 || vcpu >= vm->maxcpus) return (EINVAL); if (reg >= VM_REG_LAST) @@ -1019,7 +1025,7 @@ vm_set_register(struct vm *vm, int vcpuid, int reg, ui struct vcpu *vcpu; int error; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); if (reg >= VM_REG_LAST) @@ -1073,7 +1079,7 @@ vm_get_seg_desc(struct vm *vm, int vcpu, int reg, struct seg_desc *desc) { - if (vcpu < 0 || vcpu >= VM_MAXCPU) + if (vcpu < 0 || vcpu >= vm->maxcpus) return (EINVAL); if (!is_segment_register(reg) && !is_descriptor_table(reg)) @@ -1086,7 +1092,7 @@ int vm_set_seg_desc(struct vm *vm, int vcpu, int reg, struct seg_desc *desc) { - if (vcpu < 0 || vcpu >= VM_MAXCPU) + if (vcpu < 0 || vcpu >= vm->maxcpus) return (EINVAL); if (!is_segment_register(reg) && !is_descriptor_table(reg)) @@ -1258,7 +1264,7 @@ static void vm_handle_rendezvous(struct vm *vm, int vcpuid) { - KASSERT(vcpuid == -1 || (vcpuid >= 0 && vcpuid < VM_MAXCPU), + KASSERT(vcpuid == -1 || (vcpuid >= 0 && vcpuid < vm->maxcpus), ("vm_handle_rendezvous: invalid vcpuid %d", vcpuid)); mtx_lock(&vm->rendezvous_mtx); @@ -1537,7 +1543,7 @@ vm_handle_suspend(struct vm *vm, int vcpuid, bool *ret /* * Wakeup the other sleeping vcpus and return to userspace. */ - for (i = 0; i < VM_MAXCPU; i++) { + for (i = 0; i < vm->maxcpus; i++) { if (CPU_ISSET(i, &vm->suspended_cpus)) { vcpu_notify_event(vm, i, false); } @@ -1579,7 +1585,7 @@ vm_suspend(struct vm *vm, enum vm_suspend_how how) /* * Notify all active vcpus that they are now suspended. */ - for (i = 0; i < VM_MAXCPU; i++) { + for (i = 0; i < vm->maxcpus; i++) { if (CPU_ISSET(i, &vm->active_cpus)) vcpu_notify_event(vm, i, false); } @@ -1665,7 +1671,7 @@ vm_run(struct vm *vm, struct vm_run *vmrun) vcpuid = vmrun->cpuid; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); if (!CPU_ISSET(vcpuid, &vm->active_cpus)) @@ -1766,7 +1772,7 @@ vm_restart_instruction(void *arg, int vcpuid) int error; vm = arg; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); vcpu = &vm->vcpu[vcpuid]; @@ -1805,7 +1811,7 @@ vm_exit_intinfo(struct vm *vm, int vcpuid, uint64_t in struct vcpu *vcpu; int type, vector; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); vcpu = &vm->vcpu[vcpuid]; @@ -1946,7 +1952,8 @@ vm_entry_intinfo(struct vm *vm, int vcpuid, uint64_t * uint64_t info1, info2; int valid; - KASSERT(vcpuid >= 0 && vcpuid < VM_MAXCPU, ("invalid vcpu %d", vcpuid)); + KASSERT(vcpuid >= 0 && + vcpuid < vm->maxcpus, ("invalid vcpu %d", vcpuid)); vcpu = &vm->vcpu[vcpuid]; @@ -1986,7 +1993,7 @@ vm_get_intinfo(struct vm *vm, int vcpuid, uint64_t *in { struct vcpu *vcpu; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); vcpu = &vm->vcpu[vcpuid]; @@ -2003,7 +2010,7 @@ vm_inject_exception(struct vm *vm, int vcpuid, int vec uint64_t regval; int error; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); if (vector < 0 || vector >= 32) @@ -2094,7 +2101,7 @@ vm_inject_nmi(struct vm *vm, int vcpuid) { struct vcpu *vcpu; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); vcpu = &vm->vcpu[vcpuid]; @@ -2109,7 +2116,7 @@ vm_nmi_pending(struct vm *vm, int vcpuid) { struct vcpu *vcpu; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) panic("vm_nmi_pending: invalid vcpuid %d", vcpuid); vcpu = &vm->vcpu[vcpuid]; @@ -2122,7 +2129,7 @@ vm_nmi_clear(struct vm *vm, int vcpuid) { struct vcpu *vcpu; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) panic("vm_nmi_pending: invalid vcpuid %d", vcpuid); vcpu = &vm->vcpu[vcpuid]; @@ -2141,7 +2148,7 @@ vm_inject_extint(struct vm *vm, int vcpuid) { struct vcpu *vcpu; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); vcpu = &vm->vcpu[vcpuid]; @@ -2156,7 +2163,7 @@ vm_extint_pending(struct vm *vm, int vcpuid) { struct vcpu *vcpu; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) panic("vm_extint_pending: invalid vcpuid %d", vcpuid); vcpu = &vm->vcpu[vcpuid]; @@ -2169,7 +2176,7 @@ vm_extint_clear(struct vm *vm, int vcpuid) { struct vcpu *vcpu; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) panic("vm_extint_pending: invalid vcpuid %d", vcpuid); vcpu = &vm->vcpu[vcpuid]; @@ -2184,7 +2191,7 @@ vm_extint_clear(struct vm *vm, int vcpuid) int vm_get_capability(struct vm *vm, int vcpu, int type, int *retval) { - if (vcpu < 0 || vcpu >= VM_MAXCPU) + if (vcpu < 0 || vcpu >= vm->maxcpus) return (EINVAL); if (type < 0 || type >= VM_CAP_MAX) @@ -2196,7 +2203,7 @@ vm_get_capability(struct vm *vm, int vcpu, int type, i int vm_set_capability(struct vm *vm, int vcpu, int type, int val) { - if (vcpu < 0 || vcpu >= VM_MAXCPU) + if (vcpu < 0 || vcpu >= vm->maxcpus) return (EINVAL); if (type < 0 || type >= VM_CAP_MAX) @@ -2281,7 +2288,7 @@ vcpu_set_state(struct vm *vm, int vcpuid, enum vcpu_st int error; struct vcpu *vcpu; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) panic("vm_set_run_state: invalid vcpuid %d", vcpuid); vcpu = &vm->vcpu[vcpuid]; @@ -2299,7 +2306,7 @@ vcpu_get_state(struct vm *vm, int vcpuid, int *hostcpu struct vcpu *vcpu; enum vcpu_state state; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) panic("vm_get_run_state: invalid vcpuid %d", vcpuid); vcpu = &vm->vcpu[vcpuid]; @@ -2317,7 +2324,7 @@ int vm_activate_cpu(struct vm *vm, int vcpuid) { - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); if (CPU_ISSET(vcpuid, &vm->active_cpus)) @@ -2333,12 +2340,12 @@ vm_suspend_cpu(struct vm *vm, int vcpuid) { int i; - if (vcpuid < -1 || vcpuid >= VM_MAXCPU) + if (vcpuid < -1 || vcpuid >= vm->maxcpus) return (EINVAL); if (vcpuid == -1) { vm->debug_cpus = vm->active_cpus; - for (i = 0; i < VM_MAXCPU; i++) { + for (i = 0; i < vm->maxcpus; i++) { if (CPU_ISSET(i, &vm->active_cpus)) vcpu_notify_event(vm, i, false); } @@ -2356,7 +2363,7 @@ int vm_resume_cpu(struct vm *vm, int vcpuid) { - if (vcpuid < -1 || vcpuid >= VM_MAXCPU) + if (vcpuid < -1 || vcpuid >= vm->maxcpus) return (EINVAL); if (vcpuid == -1) { @@ -2408,7 +2415,7 @@ vcpu_stats(struct vm *vm, int vcpuid) int vm_get_x2apic_state(struct vm *vm, int vcpuid, enum x2apic_state *state) { - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); *state = vm->vcpu[vcpuid].x2apic_state; @@ -2419,7 +2426,7 @@ vm_get_x2apic_state(struct vm *vm, int vcpuid, enum x2 int vm_set_x2apic_state(struct vm *vm, int vcpuid, enum x2apic_state state) { - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); if (state >= X2APIC_STATE_LAST) @@ -2506,7 +2513,7 @@ vm_smp_rendezvous(struct vm *vm, int vcpuid, cpuset_t * Enforce that this function is called without any locks */ WITNESS_WARN(WARN_PANIC, NULL, "vm_smp_rendezvous"); - KASSERT(vcpuid == -1 || (vcpuid >= 0 && vcpuid < VM_MAXCPU), + KASSERT(vcpuid == -1 || (vcpuid >= 0 && vcpuid < vm->maxcpus), ("vm_smp_rendezvous: invalid vcpuid %d", vcpuid)); restart: @@ -2536,7 +2543,7 @@ restart: * Wake up any sleeping vcpus and trigger a VM-exit in any running * vcpus so they handle the rendezvous as soon as possible. */ - for (i = 0; i < VM_MAXCPU; i++) { + for (i = 0; i < vm->maxcpus; i++) { if (CPU_ISSET(i, &dest)) vcpu_notify_event(vm, i, false); } Modified: stable/12/sys/amd64/vmm/vmm_dev.c ============================================================================== --- stable/12/sys/amd64/vmm/vmm_dev.c Fri May 24 02:44:15 2019 (r348222) +++ stable/12/sys/amd64/vmm/vmm_dev.c Fri May 24 04:15:38 2019 (r348223) @@ -111,7 +111,7 @@ vcpu_lock_one(struct vmmdev_softc *sc, int vcpu) { int error; - if (vcpu < 0 || vcpu >= VM_MAXCPU) + if (vcpu < 0 || vcpu >= vm_get_maxcpus(sc->vm)) return (EINVAL); error = vcpu_set_state(sc->vm, vcpu, VCPU_FROZEN, true); @@ -136,8 +136,10 @@ static int vcpu_lock_all(struct vmmdev_softc *sc) { int error, vcpu; + uint16_t maxcpus; - for (vcpu = 0; vcpu < VM_MAXCPU; vcpu++) { + maxcpus = vm_get_maxcpus(sc->vm); + for (vcpu = 0; vcpu < maxcpus; vcpu++) { error = vcpu_lock_one(sc, vcpu); if (error) break; @@ -155,8 +157,10 @@ static void vcpu_unlock_all(struct vmmdev_softc *sc) { int vcpu; + uint16_t maxcpus; - for (vcpu = 0; vcpu < VM_MAXCPU; vcpu++) + maxcpus = vm_get_maxcpus(sc->vm); + for (vcpu = 0; vcpu < maxcpus; vcpu++) vcpu_unlock_one(sc, vcpu); } @@ -191,6 +195,7 @@ vmmdev_rw(struct cdev *cdev, struct uio *uio, int flag vm_paddr_t gpa, maxaddr; void *hpa, *cookie; struct vmmdev_softc *sc; + uint16_t lastcpu; error = vmm_priv_check(curthread->td_ucred); if (error) @@ -203,7 +208,8 @@ vmmdev_rw(struct cdev *cdev, struct uio *uio, int flag /* * Get a read lock on the guest memory map by freezing any vcpu. */ - error = vcpu_lock_one(sc, VM_MAXCPU - 1); + lastcpu = vm_get_maxcpus(sc->vm) - 1; + error = vcpu_lock_one(sc, lastcpu); if (error) return (error); @@ -222,7 +228,8 @@ vmmdev_rw(struct cdev *cdev, struct uio *uio, int flag * Since this device does not support lseek(2), dd(1) will * read(2) blocks of data to simulate the lseek(2). */ - hpa = vm_gpa_hold(sc->vm, VM_MAXCPU - 1, gpa, c, prot, &cookie); + hpa = vm_gpa_hold(sc->vm, lastcpu, gpa, c, + prot, &cookie); if (hpa == NULL) { if (uio->uio_rw == UIO_READ && gpa < maxaddr) error = uiomove(__DECONST(void *, zero_region), @@ -234,7 +241,7 @@ vmmdev_rw(struct cdev *cdev, struct uio *uio, int flag vm_gpa_release(cookie); } } - vcpu_unlock_one(sc, VM_MAXCPU - 1); + vcpu_unlock_one(sc, lastcpu); return (error); } @@ -437,7 +444,7 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t da * Lock a vcpu to make sure that the memory map cannot be * modified while it is being inspected. */ - vcpu = VM_MAXCPU - 1; + vcpu = vm_get_maxcpus(sc->vm) - 1; error = vcpu_lock_one(sc, vcpu); if (error) goto done; @@ -797,6 +804,7 @@ vmmdev_mmap_single(struct cdev *cdev, vm_ooffset_t *of size_t len; vm_ooffset_t segoff, first, last; int error, found, segid; + uint16_t lastcpu; bool sysmem; error = vmm_priv_check(curthread->td_ucred); @@ -817,7 +825,8 @@ vmmdev_mmap_single(struct cdev *cdev, vm_ooffset_t *of /* * Get a read lock on the guest memory map by freezing any vcpu. */ - error = vcpu_lock_one(sc, VM_MAXCPU - 1); + lastcpu = vm_get_maxcpus(sc->vm) - 1; + error = vcpu_lock_one(sc, lastcpu); if (error) return (error); @@ -846,7 +855,7 @@ vmmdev_mmap_single(struct cdev *cdev, vm_ooffset_t *of error = EINVAL; } } - vcpu_unlock_one(sc, VM_MAXCPU - 1); + vcpu_unlock_one(sc, lastcpu); return (error); } @@ -1045,6 +1054,7 @@ devmem_mmap_single(struct cdev *cdev, vm_ooffset_t *of vm_ooffset_t first, last; size_t seglen; int error; + uint16_t lastcpu; bool sysmem; dsc = cdev->si_drv1; @@ -1058,7 +1068,8 @@ devmem_mmap_single(struct cdev *cdev, vm_ooffset_t *of if ((nprot & PROT_EXEC) || first < 0 || first >= last) return (EINVAL); - error = vcpu_lock_one(dsc->sc, VM_MAXCPU - 1); + lastcpu = vm_get_maxcpus(dsc->sc->vm) - 1; + error = vcpu_lock_one(dsc->sc, lastcpu); if (error) return (error); @@ -1066,7 +1077,7 @@ devmem_mmap_single(struct cdev *cdev, vm_ooffset_t *of KASSERT(error == 0 && !sysmem && *objp != NULL, ("%s: invalid devmem segment %d", __func__, dsc->segid)); - vcpu_unlock_one(dsc->sc, VM_MAXCPU - 1); + vcpu_unlock_one(dsc->sc, lastcpu); if (seglen >= last) { vm_object_reference(*objp); Modified: stable/12/sys/amd64/vmm/vmm_lapic.c ============================================================================== --- stable/12/sys/amd64/vmm/vmm_lapic.c Fri May 24 02:44:15 2019 (r348222) +++ stable/12/sys/amd64/vmm/vmm_lapic.c Fri May 24 04:15:38 2019 (r348223) @@ -56,7 +56,7 @@ lapic_set_intr(struct vm *vm, int cpu, int vector, boo { struct vlapic *vlapic; - if (cpu < 0 || cpu >= VM_MAXCPU) + if (cpu < 0 || cpu >= vm_get_maxcpus(vm)) return (EINVAL); /* @@ -79,7 +79,7 @@ lapic_set_local_intr(struct vm *vm, int cpu, int vecto cpuset_t dmask; int error; - if (cpu < -1 || cpu >= VM_MAXCPU) + if (cpu < -1 || cpu >= vm_get_maxcpus(vm)) return (EINVAL); if (cpu == -1) Modified: stable/12/sys/amd64/vmm/vmm_stat.c ============================================================================== --- stable/12/sys/amd64/vmm/vmm_stat.c Fri May 24 02:44:15 2019 (r348222) +++ stable/12/sys/amd64/vmm/vmm_stat.c Fri May 24 04:15:38 2019 (r348223) @@ -88,7 +88,7 @@ vmm_stat_copy(struct vm *vm, int vcpu, int *num_stats, uint64_t *stats; int i; - if (vcpu < 0 || vcpu >= VM_MAXCPU) + if (vcpu < 0 || vcpu >= vm_get_maxcpus(vm)) return (EINVAL); /* Let stats functions update their counters */ From owner-svn-src-stable@freebsd.org Fri May 24 05:47:17 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 422D31598FAA; Fri, 24 May 2019 05:47:17 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DB7687576A; Fri, 24 May 2019 05:47:16 +0000 (UTC) (envelope-from rgrimes@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B2EB818782; Fri, 24 May 2019 05:47:16 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4O5lG4N032013; Fri, 24 May 2019 05:47:16 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4O5lG0I032011; Fri, 24 May 2019 05:47:16 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201905240547.x4O5lG0I032011@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Fri, 24 May 2019 05:47:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348226 - stable/12/usr.sbin/bhyve X-SVN-Group: stable-12 X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: stable/12/usr.sbin/bhyve X-SVN-Commit-Revision: 348226 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DB7687576A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.94 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.946,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2019 05:47:17 -0000 Author: rgrimes Date: Fri May 24 05:47:16 2019 New Revision: 348226 URL: https://svnweb.freebsd.org/changeset/base/348226 Log: MFC: r346717: Make bhyve SMBIOS table topology aware When the CPU Topology was added to bhyve in r332298 the SMBIOS table was missed, this table passes topology information to the system and was still using the old concept of each vCPU is a socket with 1 core and 1 thread. This code did not even try to use the old sysctl information to adjust this data. Correct that by building a proper SMBios table, mapping the > 254 cases to 0 per the SMBios 2.6 specification that is claimed by the structure. Approved by: bde (implicit/mentor) Modified: stable/12/usr.sbin/bhyve/bhyverun.h stable/12/usr.sbin/bhyve/smbiostbl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/bhyverun.h ============================================================================== --- stable/12/usr.sbin/bhyve/bhyverun.h Fri May 24 05:34:21 2019 (r348225) +++ stable/12/usr.sbin/bhyve/bhyverun.h Fri May 24 05:47:16 2019 (r348226) @@ -36,6 +36,7 @@ struct vmctx; extern int guest_ncpus; +extern uint16_t cores, sockets, threads; extern char *guest_uuid_str; extern char *vmname; Modified: stable/12/usr.sbin/bhyve/smbiostbl.c ============================================================================== --- stable/12/usr.sbin/bhyve/smbiostbl.c Fri May 24 05:34:21 2019 (r348225) +++ stable/12/usr.sbin/bhyve/smbiostbl.c Fri May 24 05:47:16 2019 (r348226) @@ -636,7 +636,7 @@ smbios_type4_initializer(struct smbios_structure *temp { int i; - for (i = 0; i < guest_ncpus; i++) { + for (i = 0; i < sockets; i++) { struct smbios_table_type4 *type4; char *p; int nstrings, len; @@ -655,6 +655,16 @@ smbios_type4_initializer(struct smbios_structure *temp *(*endaddr) = '\0'; (*endaddr)++; type4->socket = nstrings + 1; + /* Revise cores and threads after update to smbios 3.0 */ + if (cores > 254) + type4->cores = 0; + else + type4->cores = cores; + /* This threads is total threads in a socket */ + if ((cores * threads) > 254) + type4->threads = 0; + else + type4->threads = (cores * threads); curaddr = *endaddr; } From owner-svn-src-stable@freebsd.org Fri May 24 06:27:13 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 11AC7159E1DA; Fri, 24 May 2019 06:27:13 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A7F6C76CB6; Fri, 24 May 2019 06:27:12 +0000 (UTC) (envelope-from glebius@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8351E18E31; Fri, 24 May 2019 06:27:12 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4O6RC5i052948; Fri, 24 May 2019 06:27:12 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4O6RCHe052946; Fri, 24 May 2019 06:27:12 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201905240627.x4O6RCHe052946@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Fri, 24 May 2019 06:27:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348230 - in stable/12: share/man/man4 sys/netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/netinet X-SVN-Commit-Revision: 348230 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A7F6C76CB6 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.973,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2019 06:27:13 -0000 Author: glebius Date: Fri May 24 06:27:11 2019 New Revision: 348230 URL: https://svnweb.freebsd.org/changeset/base/348230 Log: Merge r344481: Support struct ip_mreqn as argument for IP_ADD_MEMBERSHIP. Legacy support for struct ip_mreq remains in place. The struct ip_mreqn is Linux extension to classic BSD multicast API. It has extra field allowing to specify the interface index explicitly. In Linux it used as argument for IP_MULTICAST_IF and IP_ADD_MEMBERSHIP. FreeBSD kernel also declares this structure and supports it as argument to IP_MULTICAST_IF since r170613. So, we have structure declared but not fully supported, this confused third party application configure scripts. Code handling IP_ADD_MEMBERSHIP was mixed together with code for IP_ADD_SOURCE_MEMBERSHIP. Bringing legacy and new structure support into the mess would made the "argument switcharoo" intolerable, so code was separated into its own switch case clause. Modified: stable/12/share/man/man4/ip.4 stable/12/sys/netinet/in_mcast.c Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/ip.4 ============================================================================== --- stable/12/share/man/man4/ip.4 Fri May 24 06:07:33 2019 (r348229) +++ stable/12/share/man/man4/ip.4 Fri May 24 06:27:11 2019 (r348230) @@ -28,7 +28,7 @@ .\" @(#)ip.4 8.2 (Berkeley) 11/30/93 .\" $FreeBSD$ .\" -.Dd August 19, 2018 +.Dd February 22, 2019 .Dt IP 4 .Os .Sh NAME @@ -571,32 +571,55 @@ To join a multicast group, use the .Dv IP_ADD_MEMBERSHIP option: .Bd -literal -struct ip_mreq mreq; -setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq)); +struct ip_mreqn mreqn; +setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreqn, sizeof(mreqn)); .Ed .Pp where -.Fa mreq +.Fa mreqn is the following structure: .Bd -literal -struct ip_mreq { +struct ip_mreqn { struct in_addr imr_multiaddr; /* IP multicast address of group */ struct in_addr imr_interface; /* local IP address of interface */ + int imr_ifindex; /* interface index */ } .Ed .Pp -.Va imr_interface -should be set to the -.Tn IP -address of a particular multicast-capable interface if +.Va imr_ifindex +should be set to the index of a particular multicast-capable interface if the host is multihomed. -It may be set to -.Dv INADDR_ANY -to choose the default interface, although this is not recommended; -this is considered to be the first interface corresponding -to the default route. -Otherwise, the first multicast-capable interface -configured in the system will be used. +If +.Va imr_ifindex +is non-zero, value of +.Va imr_interface +is ignored. +Otherwise, if +.Va imr_ifindex +is 0, kernel will use IP address from +.Va imr_interface +to lookup the interface. +Value of +.Va imr_interface +may be set to +.Va INADDR_ANY +to choose the default interface, although this is not recommended; this is +considered to be the first interface corresponding to the default route. +Otherwise, the first multicast-capable interface configured in the system +will be used. +.Pp +Legacy +.Vt "struct ip_mreq" , +that lacks +.Va imr_ifindex +field is also supported by +.Dv IP_ADD_MEMBERSHIP +setsockopt. +In this case kernel would behave as if +.Va imr_ifindex +was set to zero: +.Va imr_interface +will be used to lookup interface. .Pp Prior to .Fx 7.0 , Modified: stable/12/sys/netinet/in_mcast.c ============================================================================== --- stable/12/sys/netinet/in_mcast.c Fri May 24 06:07:33 2019 (r348229) +++ stable/12/sys/netinet/in_mcast.c Fri May 24 06:27:11 2019 (r348230) @@ -2046,40 +2046,49 @@ inp_join_group(struct inpcb *inp, struct sockopt *sopt ssa->ss.ss_family = AF_UNSPEC; switch (sopt->sopt_name) { - case IP_ADD_MEMBERSHIP: - case IP_ADD_SOURCE_MEMBERSHIP: { - struct ip_mreq_source mreqs; + case IP_ADD_MEMBERSHIP: { + struct ip_mreqn mreqn; - if (sopt->sopt_name == IP_ADD_MEMBERSHIP) { - error = sooptcopyin(sopt, &mreqs, - sizeof(struct ip_mreq), - sizeof(struct ip_mreq)); - /* - * Do argument switcharoo from ip_mreq into - * ip_mreq_source to avoid using two instances. - */ - mreqs.imr_interface = mreqs.imr_sourceaddr; - mreqs.imr_sourceaddr.s_addr = INADDR_ANY; - } else if (sopt->sopt_name == IP_ADD_SOURCE_MEMBERSHIP) { - error = sooptcopyin(sopt, &mreqs, - sizeof(struct ip_mreq_source), - sizeof(struct ip_mreq_source)); - } + if (sopt->sopt_valsize == sizeof(struct ip_mreqn)) + error = sooptcopyin(sopt, &mreqn, + sizeof(struct ip_mreqn), sizeof(struct ip_mreqn)); + else + error = sooptcopyin(sopt, &mreqn, + sizeof(struct ip_mreq), sizeof(struct ip_mreq)); if (error) return (error); gsa->sin.sin_family = AF_INET; gsa->sin.sin_len = sizeof(struct sockaddr_in); - gsa->sin.sin_addr = mreqs.imr_multiaddr; + gsa->sin.sin_addr = mreqn.imr_multiaddr; + if (!IN_MULTICAST(ntohl(gsa->sin.sin_addr.s_addr))) + return (EINVAL); - if (sopt->sopt_name == IP_ADD_SOURCE_MEMBERSHIP) { - ssa->sin.sin_family = AF_INET; - ssa->sin.sin_len = sizeof(struct sockaddr_in); - ssa->sin.sin_addr = mreqs.imr_sourceaddr; - } + if (sopt->sopt_valsize == sizeof(struct ip_mreqn) && + mreqn.imr_ifindex != 0) + ifp = ifnet_byindex(mreqn.imr_ifindex); + else + ifp = inp_lookup_mcast_ifp(inp, &gsa->sin, + mreqn.imr_address); + break; + } + case IP_ADD_SOURCE_MEMBERSHIP: { + struct ip_mreq_source mreqs; + error = sooptcopyin(sopt, &mreqs, sizeof(struct ip_mreq_source), + sizeof(struct ip_mreq_source)); + if (error) + return (error); + + gsa->sin.sin_family = ssa->sin.sin_family = AF_INET; + gsa->sin.sin_len = ssa->sin.sin_len = + sizeof(struct sockaddr_in); + + gsa->sin.sin_addr = mreqs.imr_multiaddr; if (!IN_MULTICAST(ntohl(gsa->sin.sin_addr.s_addr))) return (EINVAL); + + ssa->sin.sin_addr = mreqs.imr_sourceaddr; ifp = inp_lookup_mcast_ifp(inp, &gsa->sin, mreqs.imr_interface); From owner-svn-src-stable@freebsd.org Fri May 24 08:40:38 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C61315A36E6; Fri, 24 May 2019 08:40:38 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2F97582B78; Fri, 24 May 2019 08:40:38 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1DCC81A43A; Fri, 24 May 2019 08:40:38 +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 x4O8ebme022194; Fri, 24 May 2019 08:40:38 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4O8ebk4022176; Fri, 24 May 2019 08:40:37 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201905240840.x4O8ebk4022176@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 24 May 2019 08:40:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348232 - stable/12/sys/netinet6 X-SVN-Group: stable-12 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/12/sys/netinet6 X-SVN-Commit-Revision: 348232 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2F97582B78 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.95)[-0.952,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2019 08:40:38 -0000 Author: ae Date: Fri May 24 08:40:37 2019 New Revision: 348232 URL: https://svnweb.freebsd.org/changeset/base/348232 Log: MFC r347383: In mld_v2_cancel_link_timers() check number of references and disconnect inm before releasing the last reference. This fixes possible panics and assertion. PR: 237329 Reviewed by: mmacy Modified: stable/12/sys/netinet6/mld6.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet6/mld6.c ============================================================================== --- stable/12/sys/netinet6/mld6.c Fri May 24 06:49:47 2019 (r348231) +++ stable/12/sys/netinet6/mld6.c Fri May 24 08:40:37 2019 (r348232) @@ -1704,6 +1704,8 @@ mld_v2_cancel_link_timers(struct mld_ifsoftc *mli) * version, we need to release the final * reference held for issuing the INCLUDE {}. */ + if (inm->in6m_refcount == 1) + in6m_disconnect_locked(&inmh, inm); in6m_rele_locked(&inmh, inm); /* FALLTHROUGH */ case MLD_G_QUERY_PENDING_MEMBER: From owner-svn-src-stable@freebsd.org Fri May 24 08:42:36 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 953BA15A3976; Fri, 24 May 2019 08:42:36 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3E0F282FCF; Fri, 24 May 2019 08:42:36 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 09C111A5E9; Fri, 24 May 2019 08:42:36 +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 x4O8gZZ4026798; Fri, 24 May 2019 08:42:35 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4O8gYRa026791; Fri, 24 May 2019 08:42:34 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201905240842.x4O8gYRa026791@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 24 May 2019 08:42:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348233 - in stable/12: sbin/ifconfig share/man/man4 sys/modules/if_gre sys/net sys/netinet sys/netinet6 X-SVN-Group: stable-12 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in stable/12: sbin/ifconfig share/man/man4 sys/modules/if_gre sys/net sys/netinet sys/netinet6 X-SVN-Commit-Revision: 348233 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3E0F282FCF X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.96)[-0.955,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2019 08:42:36 -0000 Author: ae Date: Fri May 24 08:42:34 2019 New Revision: 348233 URL: https://svnweb.freebsd.org/changeset/base/348233 Log: MFC r346630: Add GRE-in-UDP encapsulation support as defined in RFC8086. This GRE-in-UDP encapsulation allows the UDP source port field to be used as an entropy field for load-balancing of GRE traffic in transit networks. Also most of multiqueue network cards are able distribute incoming UDP datagrams to different NIC queues, while very little are able do this for GRE packets. When an administrator enables UDP encapsulation with command `ifconfig gre0 udpencap`, the driver creates kernel socket, that binds to tunnel source address and after udp_set_kernel_tunneling() starts receiving of all UDP packets destined to 4754 port. Each kernel socket maintains list of tunnels with different destination addresses. Thus when several tunnels use the same source address, they all handled by single socket. The IP[V6]_BINDANY socket option is used to be able bind socket to source address even if it is not yet available in the system. This may happen on system boot, when gre(4) interface is created before source address become available. The encapsulation and sending of packets is done directly from gre(4) into ip[6]_output() without using sockets. Reviewed by: eugen Relnotes: yes Differential Revision: https://reviews.freebsd.org/D19921 Modified: stable/12/sbin/ifconfig/ifgre.c stable/12/share/man/man4/gre.4 stable/12/sys/modules/if_gre/Makefile stable/12/sys/net/if_gre.c stable/12/sys/net/if_gre.h stable/12/sys/netinet/ip_gre.c stable/12/sys/netinet6/ip6_gre.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/ifconfig/ifgre.c ============================================================================== --- stable/12/sbin/ifconfig/ifgre.c Fri May 24 08:40:37 2019 (r348232) +++ stable/12/sbin/ifconfig/ifgre.c Fri May 24 08:42:34 2019 (r348233) @@ -44,15 +44,16 @@ __FBSDID("$FreeBSD$"); #include "ifconfig.h" -#define GREBITS "\020\01ENABLE_CSUM\02ENABLE_SEQ" +#define GREBITS "\020\01ENABLE_CSUM\02ENABLE_SEQ\03UDPENCAP" static void gre_status(int s); static void gre_status(int s) { - uint32_t opts = 0; + uint32_t opts, port; + opts = 0; ifr.ifr_data = (caddr_t)&opts; if (ioctl(s, GREGKEY, &ifr) == 0) if (opts != 0) @@ -60,6 +61,11 @@ gre_status(int s) opts = 0; if (ioctl(s, GREGOPTS, &ifr) != 0 || opts == 0) return; + + port = 0; + ifr.ifr_data = (caddr_t)&port; + if (ioctl(s, GREGPORT, &ifr) == 0 && port != 0) + printf("\tudpport: %u\n", port); printb("\toptions", opts, GREBITS); putchar('\n'); } @@ -77,6 +83,18 @@ setifgrekey(const char *val, int dummy __unused, int s } static void +setifgreport(const char *val, int dummy __unused, int s, + const struct afswtch *afp) +{ + uint32_t udpport = strtol(val, NULL, 0); + + strlcpy(ifr.ifr_name, name, sizeof (ifr.ifr_name)); + ifr.ifr_data = (caddr_t)&udpport; + if (ioctl(s, GRESPORT, (caddr_t)&ifr) < 0) + warn("ioctl (set udpport)"); +} + +static void setifgreopts(const char *val, int d, int s, const struct afswtch *afp) { uint32_t opts; @@ -101,10 +119,13 @@ setifgreopts(const char *val, int d, int s, const stru static struct cmd gre_cmds[] = { DEF_CMD_ARG("grekey", setifgrekey), + DEF_CMD_ARG("udpport", setifgreport), DEF_CMD("enable_csum", GRE_ENABLE_CSUM, setifgreopts), DEF_CMD("-enable_csum",-GRE_ENABLE_CSUM,setifgreopts), DEF_CMD("enable_seq", GRE_ENABLE_SEQ, setifgreopts), DEF_CMD("-enable_seq",-GRE_ENABLE_SEQ, setifgreopts), + DEF_CMD("udpencap", GRE_UDPENCAP, setifgreopts), + DEF_CMD("-udpencap",-GRE_UDPENCAP, setifgreopts), }; static struct afswtch af_gre = { .af_name = "af_gre", Modified: stable/12/share/man/man4/gre.4 ============================================================================== --- stable/12/share/man/man4/gre.4 Fri May 24 08:40:37 2019 (r348232) +++ stable/12/share/man/man4/gre.4 Fri May 24 08:42:34 2019 (r348233) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 2, 2015 +.Dd April 24, 2019 .Dt GRE 4 .Os .Sh NAME @@ -89,7 +89,45 @@ A value of 0 disables the key option. Enables checksum calculation for outgoing packets. .It Ar enable_seq Enables use of sequence number field in the GRE header for outgoing packets. +.It Ar udpencap +Enables UDP-in-GRE encapsulation (see the +.Sx GRE-IN-UDP ENCAPSULATION +Section below for details). +.It Ar udpport +Set the source UDP port for outgoing packets. +A value of 0 disables the persistence of source UDP port for outgoing packets. +See the +.Sx GRE-IN-UDP ENCAPSULATION +Section below for details. .El +.Sh GRE-IN-UDP ENCAPSULATION +The +.Nm +supports GRE in UDP encapsulation as defined in RFC 8086. +A GRE in UDP tunnel offers the possibility of better performance for +load-balancing GRE traffic in transit networks. +Encapsulating GRE in UDP enables use of the UDP source port to provide +entropy to ECMP hashing. +.Pp +The GRE in UDP tunnel uses single value 4754 as UDP destination port. +The UDP source port contains a 14-bit entropy value that is generated +by the encapsulator to identify a flow for the encapsulated packet. +The +.Ar udpport +option can be used to disable this behaviour and use single source UDP +port value. +The value of +.Ar udpport +should be within the ephemeral port range, i.e., 49152 to 65535 by default. +.Pp +Note that a GRE in UDP tunnel is unidirectional; the tunnel traffic is not +expected to be returned back to the UDP source port values used to generate +entropy. +This may impact NAPT (Network Address Port Translator) middleboxes. +If such tunnels are expected to be used on a path with a middlebox, +the tunnel can be configured either to disable use of the UDP source port +for entropy or to enable middleboxes to pass packets with UDP source port +entropy. .Sh EXAMPLES .Bd -literal 192.168.1.* --- Router A -------tunnel-------- Router B --- 192.168.2.* Modified: stable/12/sys/modules/if_gre/Makefile ============================================================================== --- stable/12/sys/modules/if_gre/Makefile Fri May 24 08:40:37 2019 (r348232) +++ stable/12/sys/modules/if_gre/Makefile Fri May 24 08:42:34 2019 (r348233) @@ -5,7 +5,7 @@ SYSDIR?=${SRCTOP}/sys .include "${SYSDIR}/conf/kern.opts.mk" KMOD= if_gre -SRCS= if_gre.c opt_inet.h opt_inet6.h +SRCS= if_gre.c opt_inet.h opt_inet6.h opt_rss.h SRCS.INET= ip_gre.c SRCS.INET6= ip6_gre.c Modified: stable/12/sys/net/if_gre.c ============================================================================== --- stable/12/sys/net/if_gre.c Fri May 24 08:40:37 2019 (r348232) +++ stable/12/sys/net/if_gre.c Fri May 24 08:42:34 2019 (r348233) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet.h" #include "opt_inet6.h" +#include "opt_rss.h" #include #include @@ -49,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -65,19 +67,27 @@ __FBSDID("$FreeBSD$"); #include #include +#include #ifdef INET #include #include #include +#ifdef RSS +#include #endif +#endif #ifdef INET6 #include #include #include +#ifdef RSS +#include #endif +#endif #include +#include #include #include @@ -151,6 +161,7 @@ vnet_gre_uninit(const void *unused __unused) #ifdef INET6 in6_gre_uninit(); #endif + /* XXX: epoch_call drain */ } VNET_SYSUNINIT(vnet_gre_uninit, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY, vnet_gre_uninit, NULL); @@ -266,6 +277,7 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) break; case GRESKEY: case GRESOPTS: + case GRESPORT: if ((error = priv_check(curthread, PRIV_NET_GRE)) != 0) break; if ((error = copyin(ifr_data_get_ptr(ifr), &opt, @@ -281,23 +293,45 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) } if (sc->gre_options == opt) break; + } else if (cmd == GRESPORT) { + if (opt != 0 && (opt < V_ipport_hifirstauto || + opt > V_ipport_hilastauto)) { + error = EINVAL; + break; + } + if (sc->gre_port == opt) + break; + if ((sc->gre_options & GRE_UDPENCAP) == 0) { + /* + * UDP encapsulation is not enabled, thus + * there is no need to reattach softc. + */ + sc->gre_port = opt; + break; + } } switch (sc->gre_family) { #ifdef INET case AF_INET: - in_gre_setopts(sc, cmd, opt); + error = in_gre_setopts(sc, cmd, opt); break; #endif #ifdef INET6 case AF_INET6: - in6_gre_setopts(sc, cmd, opt); + error = in6_gre_setopts(sc, cmd, opt); break; #endif default: + /* + * Tunnel is not yet configured. + * We can just change any parameters. + */ if (cmd == GRESKEY) sc->gre_key = opt; - else + if (cmd == GRESOPTS) sc->gre_options = opt; + if (cmd == GRESPORT) + sc->gre_port = opt; break; } /* @@ -313,6 +347,10 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = copyout(&sc->gre_options, ifr_data_get_ptr(ifr), sizeof(sc->gre_options)); break; + case GREGPORT: + error = copyout(&sc->gre_port, ifr_data_get_ptr(ifr), + sizeof(sc->gre_port)); + break; default: error = EINVAL; break; @@ -337,6 +375,7 @@ end: static void gre_delete_tunnel(struct gre_softc *sc) { + struct gre_socket *gs; sx_assert(&gre_ioctl_sx, SA_XLOCKED); if (sc->gre_family != 0) { @@ -346,6 +385,16 @@ gre_delete_tunnel(struct gre_softc *sc) free(sc->gre_hdr, M_GRE); sc->gre_family = 0; } + /* + * If this Tunnel was the last one that could use UDP socket, + * we should unlink socket from hash table and close it. + */ + if ((gs = sc->gre_so) != NULL && CK_LIST_EMPTY(&gs->list)) { + CK_LIST_REMOVE(gs, chain); + soclose(gs->so); + epoch_call(net_epoch_preempt, &gs->epoch_ctx, gre_sofree); + sc->gre_so = NULL; + } GRE2IFP(sc)->if_drv_flags &= ~IFF_DRV_RUNNING; if_link_state_change(GRE2IFP(sc), LINK_STATE_DOWN); } @@ -372,8 +421,39 @@ gre_hashdestroy(struct gre_list *hash) } void -gre_updatehdr(struct gre_softc *sc, struct grehdr *gh) +gre_sofree(epoch_context_t ctx) { + struct gre_socket *gs; + + gs = __containerof(ctx, struct gre_socket, epoch_ctx); + free(gs, M_GRE); +} + +static __inline uint16_t +gre_cksum_add(uint16_t sum, uint16_t a) +{ + uint16_t res; + + res = sum + a; + return (res + (res < a)); +} + +void +gre_update_udphdr(struct gre_softc *sc, struct udphdr *udp, uint16_t csum) +{ + + sx_assert(&gre_ioctl_sx, SA_XLOCKED); + MPASS(sc->gre_options & GRE_UDPENCAP); + + udp->uh_dport = htons(GRE_UDPPORT); + udp->uh_sport = htons(sc->gre_port); + udp->uh_sum = csum; + udp->uh_ulen = 0; +} + +void +gre_update_hdr(struct gre_softc *sc, struct grehdr *gh) +{ uint32_t *opts; uint16_t flags; @@ -539,6 +619,52 @@ gre_setseqn(struct grehdr *gh, uint32_t seq) *opts = htonl(seq); } +static uint32_t +gre_flowid(struct gre_softc *sc, struct mbuf *m, uint32_t af) +{ + uint32_t flowid; + + if ((sc->gre_options & GRE_UDPENCAP) == 0 || sc->gre_port != 0) + return (0); +#ifndef RSS + switch (af) { +#ifdef INET + case AF_INET: + flowid = mtod(m, struct ip *)->ip_src.s_addr ^ + mtod(m, struct ip *)->ip_dst.s_addr; + break; +#endif +#ifdef INET6 + case AF_INET6: + flowid = mtod(m, struct ip6_hdr *)->ip6_src.s6_addr32[3] ^ + mtod(m, struct ip6_hdr *)->ip6_dst.s6_addr32[3]; + break; +#endif + default: + flowid = 0; + } +#else /* RSS */ + switch (af) { +#ifdef INET + case AF_INET: + flowid = rss_hash_ip4_2tuple(mtod(m, struct ip *)->ip_src, + mtod(m, struct ip *)->ip_dst); + break; +#endif +#ifdef INET6 + case AF_INET6: + flowid = rss_hash_ip6_2tuple( + &mtod(m, struct ip6_hdr *)->ip6_src, + &mtod(m, struct ip6_hdr *)->ip6_dst); + break; +#endif + default: + flowid = 0; + } +#endif + return (flowid); +} + #define MTAG_GRE 1307983903 static int gre_transmit(struct ifnet *ifp, struct mbuf *m) @@ -546,7 +672,8 @@ gre_transmit(struct ifnet *ifp, struct mbuf *m) GRE_RLOCK_TRACKER; struct gre_softc *sc; struct grehdr *gh; - uint32_t af; + struct udphdr *uh; + uint32_t af, flowid; int error, len; uint16_t proto; @@ -573,6 +700,7 @@ gre_transmit(struct ifnet *ifp, struct mbuf *m) af = m->m_pkthdr.csum_data; BPF_MTAP2(ifp, &af, sizeof(af), m); m->m_flags &= ~(M_BCAST|M_MCAST); + flowid = gre_flowid(sc, m, af); M_SETFIB(m, sc->gre_fibnum); M_PREPEND(m, sc->gre_hlen, M_NOWAIT); if (m == NULL) { @@ -614,6 +742,19 @@ gre_transmit(struct ifnet *ifp, struct mbuf *m) error = ENETDOWN; goto drop; } + if (sc->gre_options & GRE_UDPENCAP) { + uh = (struct udphdr *)mtodo(m, len); + uh->uh_sport |= htons(V_ipport_hifirstauto) | + (flowid >> 16) | (flowid & 0xFFFF); + uh->uh_sport = htons(ntohs(uh->uh_sport) % + V_ipport_hilastauto); + uh->uh_ulen = htons(m->m_pkthdr.len - len); + uh->uh_sum = gre_cksum_add(uh->uh_sum, + htons(m->m_pkthdr.len - len + IPPROTO_UDP)); + m->m_pkthdr.csum_flags = sc->gre_csumflags; + m->m_pkthdr.csum_data = offsetof(struct udphdr, uh_sum); + len += sizeof(struct udphdr); + } gh = (struct grehdr *)mtodo(m, len); gh->gre_proto = proto; if (sc->gre_options & GRE_ENABLE_SEQ) @@ -631,7 +772,7 @@ gre_transmit(struct ifnet *ifp, struct mbuf *m) #endif #ifdef INET6 case AF_INET6: - error = in6_gre_output(m, af, sc->gre_hlen); + error = in6_gre_output(m, af, sc->gre_hlen, flowid); break; #endif default: Modified: stable/12/sys/net/if_gre.h ============================================================================== --- stable/12/sys/net/if_gre.h Fri May 24 08:40:37 2019 (r348232) +++ stable/12/sys/net/if_gre.h Fri May 24 08:42:34 2019 (r348233) @@ -53,15 +53,36 @@ struct greip { struct ip gi_ip; struct grehdr gi_gre; } __packed; -#endif +struct greudp { + struct ip gi_ip; + struct udphdr gi_udp; + struct grehdr gi_gre; +} __packed; +#endif /* INET */ + #ifdef INET6 struct greip6 { struct ip6_hdr gi6_ip6; struct grehdr gi6_gre; } __packed; -#endif +struct greudp6 { + struct ip6_hdr gi6_ip6; + struct udphdr gi6_udp; + struct grehdr gi6_gre; +} __packed; +#endif /* INET6 */ + +CK_LIST_HEAD(gre_list, gre_softc); +CK_LIST_HEAD(gre_sockets, gre_socket); +struct gre_socket { + struct socket *so; + struct gre_list list; + CK_LIST_ENTRY(gre_socket) chain; + struct epoch_context epoch_ctx; +}; + struct gre_softc { struct ifnet *gre_ifp; int gre_family; /* AF of delivery header */ @@ -69,22 +90,26 @@ struct gre_softc { uint32_t gre_oseq; uint32_t gre_key; uint32_t gre_options; + uint32_t gre_csumflags; + uint32_t gre_port; u_int gre_fibnum; u_int gre_hlen; /* header size */ union { void *hdr; #ifdef INET - struct greip *gihdr; + struct greip *iphdr; + struct greudp *udphdr; #endif #ifdef INET6 - struct greip6 *gi6hdr; + struct greip6 *ip6hdr; + struct greudp6 *udp6hdr; #endif } gre_uhdr; + struct gre_socket *gre_so; CK_LIST_ENTRY(gre_softc) chain; CK_LIST_ENTRY(gre_softc) srchash; }; -CK_LIST_HEAD(gre_list, gre_softc); MALLOC_DECLARE(M_GRE); #ifndef GRE_HASH_SIZE @@ -98,28 +123,35 @@ MALLOC_DECLARE(M_GRE); #define GRE_WAIT() epoch_wait_preempt(net_epoch_preempt) #define gre_hdr gre_uhdr.hdr -#define gre_gihdr gre_uhdr.gihdr -#define gre_gi6hdr gre_uhdr.gi6hdr -#define gre_oip gre_gihdr->gi_ip -#define gre_oip6 gre_gi6hdr->gi6_ip6 +#define gre_iphdr gre_uhdr.iphdr +#define gre_ip6hdr gre_uhdr.ip6hdr +#define gre_udphdr gre_uhdr.udphdr +#define gre_udp6hdr gre_uhdr.udp6hdr +#define gre_oip gre_iphdr->gi_ip +#define gre_udp gre_udphdr->gi_udp +#define gre_oip6 gre_ip6hdr->gi6_ip6 +#define gre_udp6 gre_udp6hdr->gi6_udp + struct gre_list *gre_hashinit(void); void gre_hashdestroy(struct gre_list *); int gre_input(struct mbuf *, int, int, void *); -void gre_updatehdr(struct gre_softc *, struct grehdr *); +void gre_update_hdr(struct gre_softc *, struct grehdr *); +void gre_update_udphdr(struct gre_softc *, struct udphdr *, uint16_t); +void gre_sofree(epoch_context_t); void in_gre_init(void); void in_gre_uninit(void); -void in_gre_setopts(struct gre_softc *, u_long, uint32_t); +int in_gre_setopts(struct gre_softc *, u_long, uint32_t); int in_gre_ioctl(struct gre_softc *, u_long, caddr_t); int in_gre_output(struct mbuf *, int, int); void in6_gre_init(void); void in6_gre_uninit(void); -void in6_gre_setopts(struct gre_softc *, u_long, uint32_t); +int in6_gre_setopts(struct gre_softc *, u_long, uint32_t); int in6_gre_ioctl(struct gre_softc *, u_long, caddr_t); -int in6_gre_output(struct mbuf *, int, int); +int in6_gre_output(struct mbuf *, int, int, uint32_t); /* * CISCO uses special type for GRE tunnel created as part of WCCP * connection, while in fact those packets are just IPv4 encapsulated @@ -139,9 +171,15 @@ int in6_gre_output(struct mbuf *, int, int); #define GRESKEY _IOW('i', 108, struct ifreq) #define GREGOPTS _IOWR('i', 109, struct ifreq) #define GRESOPTS _IOW('i', 110, struct ifreq) +#define GREGPORT _IOWR('i', 111, struct ifreq) +#define GRESPORT _IOW('i', 112, struct ifreq) +/* GRE-in-UDP encapsulation destination port as defined in RFC8086 */ +#define GRE_UDPPORT 4754 + #define GRE_ENABLE_CSUM 0x0001 #define GRE_ENABLE_SEQ 0x0002 -#define GRE_OPTMASK (GRE_ENABLE_CSUM|GRE_ENABLE_SEQ) +#define GRE_UDPENCAP 0x0004 +#define GRE_OPTMASK (GRE_ENABLE_CSUM|GRE_ENABLE_SEQ|GRE_UDPENCAP) #endif /* _NET_IF_GRE_H_ */ Modified: stable/12/sys/netinet/ip_gre.c ============================================================================== --- stable/12/sys/netinet/ip_gre.c Fri May 24 08:40:37 2019 (r348232) +++ stable/12/sys/netinet/ip_gre.c Fri May 24 08:42:34 2019 (r348233) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -58,15 +59,19 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include +#include +#include #ifdef INET6 #include #endif #include +#include #define GRE_TTL 30 VNET_DEFINE(int, ip_gre_ttl) = GRE_TTL; @@ -74,14 +79,22 @@ VNET_DEFINE(int, ip_gre_ttl) = GRE_TTL; SYSCTL_INT(_net_inet_ip, OID_AUTO, grettl, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip_gre_ttl), 0, "Default TTL value for encapsulated packets"); +struct in_gre_socket { + struct gre_socket base; + in_addr_t addr; +}; +VNET_DEFINE_STATIC(struct gre_sockets *, ipv4_sockets) = NULL; VNET_DEFINE_STATIC(struct gre_list *, ipv4_hashtbl) = NULL; VNET_DEFINE_STATIC(struct gre_list *, ipv4_srchashtbl) = NULL; +#define V_ipv4_sockets VNET(ipv4_sockets) #define V_ipv4_hashtbl VNET(ipv4_hashtbl) #define V_ipv4_srchashtbl VNET(ipv4_srchashtbl) #define GRE_HASH(src, dst) (V_ipv4_hashtbl[\ in_gre_hashval((src), (dst)) & (GRE_HASH_SIZE - 1)]) #define GRE_SRCHASH(src) (V_ipv4_srchashtbl[\ fnv_32_buf(&(src), sizeof(src), FNV1_32_INIT) & (GRE_HASH_SIZE - 1)]) +#define GRE_SOCKHASH(src) (V_ipv4_sockets[\ + fnv_32_buf(&(src), sizeof(src), FNV1_32_INIT) & (GRE_HASH_SIZE - 1)]) #define GRE_HASH_SC(sc) GRE_HASH((sc)->gre_oip.ip_src.s_addr,\ (sc)->gre_oip.ip_dst.s_addr) @@ -94,17 +107,43 @@ in_gre_hashval(in_addr_t src, in_addr_t dst) return (fnv_32_buf(&dst, sizeof(dst), ret)); } +static struct gre_socket* +in_gre_lookup_socket(in_addr_t addr) +{ + struct gre_socket *gs; + struct in_gre_socket *s; + + CK_LIST_FOREACH(gs, &GRE_SOCKHASH(addr), chain) { + s = __containerof(gs, struct in_gre_socket, base); + if (s->addr == addr) + break; + } + return (gs); +} + static int -in_gre_checkdup(const struct gre_softc *sc, in_addr_t src, in_addr_t dst) +in_gre_checkdup(const struct gre_softc *sc, in_addr_t src, in_addr_t dst, + uint32_t opts) { + struct gre_list *head; struct gre_softc *tmp; + struct gre_socket *gs; if (sc->gre_family == AF_INET && sc->gre_oip.ip_src.s_addr == src && - sc->gre_oip.ip_dst.s_addr == dst) + sc->gre_oip.ip_dst.s_addr == dst && + (sc->gre_options & GRE_UDPENCAP) == (opts & GRE_UDPENCAP)) return (EEXIST); - CK_LIST_FOREACH(tmp, &GRE_HASH(src, dst), chain) { + if (opts & GRE_UDPENCAP) { + gs = in_gre_lookup_socket(src); + if (gs == NULL) + return (0); + head = &gs->list; + } else + head = &GRE_HASH(src, dst); + + CK_LIST_FOREACH(tmp, head, chain) { if (tmp == sc) continue; if (tmp->gre_oip.ip_src.s_addr == src && @@ -181,35 +220,228 @@ in_gre_srcaddr(void *arg __unused, const struct sockad } static void +in_gre_udp_input(struct mbuf *m, int off, struct inpcb *inp, + const struct sockaddr *sa, void *ctx) +{ + struct epoch_tracker et; + struct gre_socket *gs; + struct gre_softc *sc; + in_addr_t dst; + + NET_EPOCH_ENTER(et); + /* + * udp_append() holds reference to inp, it is safe to check + * inp_flags2 without INP_RLOCK(). + * If socket was closed before we have entered NET_EPOCH section, + * INP_FREED flag should be set. Otherwise it should be safe to + * make access to ctx data, because gre_so will be freed by + * gre_sofree() via epoch_call(). + */ + if (__predict_false(inp->inp_flags2 & INP_FREED)) { + NET_EPOCH_EXIT(et); + m_freem(m); + return; + } + + gs = (struct gre_socket *)ctx; + dst = ((const struct sockaddr_in *)sa)->sin_addr.s_addr; + CK_LIST_FOREACH(sc, &gs->list, chain) { + if (sc->gre_oip.ip_dst.s_addr == dst) + break; + } + if (sc != NULL && (GRE2IFP(sc)->if_flags & IFF_UP) != 0){ + gre_input(m, off + sizeof(struct udphdr), IPPROTO_UDP, sc); + NET_EPOCH_EXIT(et); + return; + } + m_freem(m); + NET_EPOCH_EXIT(et); +} + +static int +in_gre_setup_socket(struct gre_softc *sc) +{ + struct sockopt sopt; + struct sockaddr_in sin; + struct in_gre_socket *s; + struct gre_socket *gs; + in_addr_t addr; + int error, value; + + /* + * NOTE: we are protected with gre_ioctl_sx lock. + * + * First check that socket is already configured. + * If so, check that source addres was not changed. + * If address is different, check that there are no other tunnels + * and close socket. + */ + addr = sc->gre_oip.ip_src.s_addr; + gs = sc->gre_so; + if (gs != NULL) { + s = __containerof(gs, struct in_gre_socket, base); + if (s->addr != addr) { + if (CK_LIST_EMPTY(&gs->list)) { + CK_LIST_REMOVE(gs, chain); + soclose(gs->so); + epoch_call(net_epoch_preempt, &gs->epoch_ctx, + gre_sofree); + } + gs = sc->gre_so = NULL; + } + } + + if (gs == NULL) { + /* + * Check that socket for given address is already + * configured. + */ + gs = in_gre_lookup_socket(addr); + if (gs == NULL) { + s = malloc(sizeof(*s), M_GRE, M_WAITOK | M_ZERO); + s->addr = addr; + gs = &s->base; + + error = socreate(sc->gre_family, &gs->so, + SOCK_DGRAM, IPPROTO_UDP, curthread->td_ucred, + curthread); + if (error != 0) { + if_printf(GRE2IFP(sc), + "cannot create socket: %d\n", error); + free(s, M_GRE); + return (error); + } + + error = udp_set_kernel_tunneling(gs->so, + in_gre_udp_input, NULL, gs); + if (error != 0) { + if_printf(GRE2IFP(sc), + "cannot set UDP tunneling: %d\n", error); + goto fail; + } + + memset(&sopt, 0, sizeof(sopt)); + sopt.sopt_dir = SOPT_SET; + sopt.sopt_level = IPPROTO_IP; + sopt.sopt_name = IP_BINDANY; + sopt.sopt_val = &value; + sopt.sopt_valsize = sizeof(value); + value = 1; + error = sosetopt(gs->so, &sopt); + if (error != 0) { + if_printf(GRE2IFP(sc), + "cannot set IP_BINDANY opt: %d\n", error); + goto fail; + } + + memset(&sin, 0, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_len = sizeof(sin); + sin.sin_addr.s_addr = addr; + sin.sin_port = htons(GRE_UDPPORT); + error = sobind(gs->so, (struct sockaddr *)&sin, + curthread); + if (error != 0) { + if_printf(GRE2IFP(sc), + "cannot bind socket: %d\n", error); + goto fail; + } + /* Add socket to the chain */ + CK_LIST_INSERT_HEAD(&GRE_SOCKHASH(addr), gs, chain); + } + } + + /* Add softc to the socket's list */ + CK_LIST_INSERT_HEAD(&gs->list, sc, chain); + sc->gre_so = gs; + return (0); +fail: + soclose(gs->so); + free(s, M_GRE); + return (error); +} + +static int in_gre_attach(struct gre_softc *sc) { + struct grehdr *gh; + int error; - sc->gre_hlen = sizeof(struct greip); + if (sc->gre_options & GRE_UDPENCAP) { + sc->gre_csumflags = CSUM_UDP; + sc->gre_hlen = sizeof(struct greudp); + sc->gre_oip.ip_p = IPPROTO_UDP; + gh = &sc->gre_udphdr->gi_gre; + gre_update_udphdr(sc, &sc->gre_udp, + in_pseudo(sc->gre_oip.ip_src.s_addr, + sc->gre_oip.ip_dst.s_addr, 0)); + } else { + sc->gre_hlen = sizeof(struct greip); + sc->gre_oip.ip_p = IPPROTO_GRE; + gh = &sc->gre_iphdr->gi_gre; + } sc->gre_oip.ip_v = IPVERSION; sc->gre_oip.ip_hl = sizeof(struct ip) >> 2; - sc->gre_oip.ip_p = IPPROTO_GRE; - gre_updatehdr(sc, &sc->gre_gihdr->gi_gre); - CK_LIST_INSERT_HEAD(&GRE_HASH_SC(sc), sc, chain); + gre_update_hdr(sc, gh); + + /* + * If we return error, this means that sc is not linked, + * and caller should reset gre_family and free(sc->gre_hdr). + */ + if (sc->gre_options & GRE_UDPENCAP) { + error = in_gre_setup_socket(sc); + if (error != 0) + return (error); + } else + CK_LIST_INSERT_HEAD(&GRE_HASH_SC(sc), sc, chain); CK_LIST_INSERT_HEAD(&GRE_SRCHASH(sc->gre_oip.ip_src.s_addr), sc, srchash); + + /* Set IFF_DRV_RUNNING if interface is ready */ + in_gre_set_running(sc); + return (0); } -void +int in_gre_setopts(struct gre_softc *sc, u_long cmd, uint32_t value) { + int error; - MPASS(cmd == GRESKEY || cmd == GRESOPTS); - /* NOTE: we are protected with gre_ioctl_sx lock */ + MPASS(cmd == GRESKEY || cmd == GRESOPTS || cmd == GRESPORT); MPASS(sc->gre_family == AF_INET); + + /* + * If we are going to change encapsulation protocol, do check + * for duplicate tunnels. Return EEXIST here to do not confuse + * user. + */ + if (cmd == GRESOPTS && + (sc->gre_options & GRE_UDPENCAP) != (value & GRE_UDPENCAP) && + in_gre_checkdup(sc, sc->gre_oip.ip_src.s_addr, + sc->gre_oip.ip_dst.s_addr, value) == EADDRNOTAVAIL) + return (EEXIST); + CK_LIST_REMOVE(sc, chain); CK_LIST_REMOVE(sc, srchash); GRE_WAIT(); - if (cmd == GRESKEY) + switch (cmd) { + case GRESKEY: sc->gre_key = value; - else + break; + case GRESOPTS: sc->gre_options = value; - in_gre_attach(sc); + break; + case GRESPORT: + sc->gre_port = value; + break; + } + error = in_gre_attach(sc); + if (error != 0) { + sc->gre_family = 0; + free(sc->gre_hdr, M_GRE); + } + return (error); } int @@ -241,9 +473,10 @@ in_gre_ioctl(struct gre_softc *sc, u_long cmd, caddr_t if (V_ipv4_hashtbl == NULL) { V_ipv4_hashtbl = gre_hashinit(); V_ipv4_srchashtbl = gre_hashinit(); + V_ipv4_sockets = (struct gre_sockets *)gre_hashinit(); } error = in_gre_checkdup(sc, src->sin_addr.s_addr, - dst->sin_addr.s_addr); + dst->sin_addr.s_addr, sc->gre_options); if (error == EADDRNOTAVAIL) break; if (error == EEXIST) { @@ -251,7 +484,7 @@ in_gre_ioctl(struct gre_softc *sc, u_long cmd, caddr_t error = 0; break; } - ip = malloc(sizeof(struct greip) + 3 * sizeof(uint32_t), + ip = malloc(sizeof(struct greudp) + 3 * sizeof(uint32_t), M_GRE, M_WAITOK | M_ZERO); ip->ip_src.s_addr = src->sin_addr.s_addr; ip->ip_dst.s_addr = dst->sin_addr.s_addr; @@ -267,8 +500,11 @@ in_gre_ioctl(struct gre_softc *sc, u_long cmd, caddr_t sc->gre_hdr = ip; sc->gre_oseq = 0; sc->gre_iseq = UINT32_MAX; - in_gre_attach(sc); - in_gre_set_running(sc); + error = in_gre_attach(sc); + if (error != 0) { + sc->gre_family = 0; + free(sc->gre_hdr, M_GRE); + } break; case SIOCGIFPSRCADDR: case SIOCGIFPDSTADDR: @@ -354,5 +590,6 @@ in_gre_uninit(void) V_ipv4_hashtbl = NULL; GRE_WAIT(); gre_hashdestroy(V_ipv4_srchashtbl); + gre_hashdestroy((struct gre_list *)V_ipv4_sockets); } } Modified: stable/12/sys/netinet6/ip6_gre.c ============================================================================== --- stable/12/sys/netinet6/ip6_gre.c Fri May 24 08:40:37 2019 (r348232) +++ stable/12/sys/netinet6/ip6_gre.c Fri May 24 08:42:34 2019 (r348233) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -51,8 +52,12 @@ __FBSDID("$FreeBSD$"); #include #include #endif +#include #include +#include #include +#include +#include #include #include #include @@ -65,14 +70,22 @@ SYSCTL_DECL(_net_inet6_ip6); SYSCTL_INT(_net_inet6_ip6, OID_AUTO, grehlim, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip6_gre_hlim), 0, "Default hop limit for encapsulated packets"); +struct in6_gre_socket { + struct gre_socket base; + struct in6_addr addr; /* scope zone id is embedded */ +}; +VNET_DEFINE_STATIC(struct gre_sockets *, ipv6_sockets) = NULL; VNET_DEFINE_STATIC(struct gre_list *, ipv6_hashtbl) = NULL; VNET_DEFINE_STATIC(struct gre_list *, ipv6_srchashtbl) = NULL; +#define V_ipv6_sockets VNET(ipv6_sockets) #define V_ipv6_hashtbl VNET(ipv6_hashtbl) #define V_ipv6_srchashtbl VNET(ipv6_srchashtbl) #define GRE_HASH(src, dst) (V_ipv6_hashtbl[\ in6_gre_hashval((src), (dst)) & (GRE_HASH_SIZE - 1)]) #define GRE_SRCHASH(src) (V_ipv6_srchashtbl[\ fnv_32_buf((src), sizeof(*src), FNV1_32_INIT) & (GRE_HASH_SIZE - 1)]) +#define GRE_SOCKHASH(src) (V_ipv6_sockets[\ + fnv_32_buf((src), sizeof(*src), FNV1_32_INIT) & (GRE_HASH_SIZE - 1)]) #define GRE_HASH_SC(sc) GRE_HASH(&(sc)->gre_oip6.ip6_src,\ &(sc)->gre_oip6.ip6_dst) @@ -85,18 +98,43 @@ in6_gre_hashval(const struct in6_addr *src, const stru return (fnv_32_buf(dst, sizeof(*dst), ret)); } +static struct gre_socket* +in6_gre_lookup_socket(const struct in6_addr *addr) +{ + struct gre_socket *gs; + struct in6_gre_socket *s; + + CK_LIST_FOREACH(gs, &GRE_SOCKHASH(addr), chain) { + s = __containerof(gs, struct in6_gre_socket, base); + if (IN6_ARE_ADDR_EQUAL(&s->addr, addr)) + break; + } + return (gs); +} + static int *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Fri May 24 09:01:56 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 80AEC15A4764; Fri, 24 May 2019 09:01:56 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 224F283F13; Fri, 24 May 2019 09:01:56 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 489DC1A918; Fri, 24 May 2019 09:01:55 +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 x4O91thX035191; Fri, 24 May 2019 09:01:55 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4O91sqx035190; Fri, 24 May 2019 09:01:54 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201905240901.x4O91sqx035190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 24 May 2019 09:01:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348234 - in stable/12/sys: netinet netinet6 X-SVN-Group: stable-12 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in stable/12/sys: netinet netinet6 X-SVN-Commit-Revision: 348234 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 224F283F13 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2019 09:01:56 -0000 Author: ae Date: Fri May 24 09:01:54 2019 New Revision: 348234 URL: https://svnweb.freebsd.org/changeset/base/348234 Log: Fix the build. Use NET_EPOCH_ENTER_ET() and NET_EPOCH_EXIT_ET(). This is direct commit to stable/12, since macros are different in stable/12 and head/ branches. Modified: stable/12/sys/netinet/ip_gre.c stable/12/sys/netinet6/ip6_gre.c Modified: stable/12/sys/netinet/ip_gre.c ============================================================================== --- stable/12/sys/netinet/ip_gre.c Fri May 24 08:42:34 2019 (r348233) +++ stable/12/sys/netinet/ip_gre.c Fri May 24 09:01:54 2019 (r348234) @@ -228,7 +228,7 @@ in_gre_udp_input(struct mbuf *m, int off, struct inpcb struct gre_softc *sc; in_addr_t dst; - NET_EPOCH_ENTER(et); + NET_EPOCH_ENTER_ET(et); /* * udp_append() holds reference to inp, it is safe to check * inp_flags2 without INP_RLOCK(). @@ -238,7 +238,7 @@ in_gre_udp_input(struct mbuf *m, int off, struct inpcb * gre_sofree() via epoch_call(). */ if (__predict_false(inp->inp_flags2 & INP_FREED)) { - NET_EPOCH_EXIT(et); + NET_EPOCH_EXIT_ET(et); m_freem(m); return; } @@ -251,11 +251,11 @@ in_gre_udp_input(struct mbuf *m, int off, struct inpcb } if (sc != NULL && (GRE2IFP(sc)->if_flags & IFF_UP) != 0){ gre_input(m, off + sizeof(struct udphdr), IPPROTO_UDP, sc); - NET_EPOCH_EXIT(et); + NET_EPOCH_EXIT_ET(et); return; } m_freem(m); - NET_EPOCH_EXIT(et); + NET_EPOCH_EXIT_ET(et); } static int Modified: stable/12/sys/netinet6/ip6_gre.c ============================================================================== --- stable/12/sys/netinet6/ip6_gre.c Fri May 24 08:42:34 2019 (r348233) +++ stable/12/sys/netinet6/ip6_gre.c Fri May 24 09:01:54 2019 (r348234) @@ -221,7 +221,7 @@ in6_gre_udp_input(struct mbuf *m, int off, struct inpc struct gre_softc *sc; struct sockaddr_in6 dst; - NET_EPOCH_ENTER(et); + NET_EPOCH_ENTER_ET(et); /* * udp_append() holds reference to inp, it is safe to check * inp_flags2 without INP_RLOCK(). @@ -231,7 +231,7 @@ in6_gre_udp_input(struct mbuf *m, int off, struct inpc * gre_sofree() via epoch_call(). */ if (__predict_false(inp->inp_flags2 & INP_FREED)) { - NET_EPOCH_EXIT(et); + NET_EPOCH_EXIT_ET(et); m_freem(m); return; } @@ -239,7 +239,7 @@ in6_gre_udp_input(struct mbuf *m, int off, struct inpc gs = (struct gre_socket *)ctx; dst = *(const struct sockaddr_in6 *)sa; if (sa6_embedscope(&dst, 0)) { - NET_EPOCH_EXIT(et); + NET_EPOCH_EXIT_ET(et); m_freem(m); return; } @@ -249,11 +249,11 @@ in6_gre_udp_input(struct mbuf *m, int off, struct inpc } if (sc != NULL && (GRE2IFP(sc)->if_flags & IFF_UP) != 0){ gre_input(m, off + sizeof(struct udphdr), IPPROTO_UDP, sc); - NET_EPOCH_EXIT(et); + NET_EPOCH_EXIT_ET(et); return; } m_freem(m); - NET_EPOCH_EXIT(et); + NET_EPOCH_EXIT_ET(et); } static int From owner-svn-src-stable@freebsd.org Fri May 24 13:39:57 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7537A15AC29C; Fri, 24 May 2019 13:39:57 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1AADB8E4B9; Fri, 24 May 2019 13:39:57 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0A2A51D728; Fri, 24 May 2019 13:39:57 +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 x4ODduJP087992; Fri, 24 May 2019 13:39:56 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4ODduju087991; Fri, 24 May 2019 13:39:56 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201905241339.x4ODduju087991@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 24 May 2019 13:39:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348237 - stable/12/sys/modules X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/sys/modules X-SVN-Commit-Revision: 348237 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1AADB8E4B9 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2019 13:39:57 -0000 Author: emaste Date: Fri May 24 13:39:56 2019 New Revision: 348237 URL: https://svnweb.freebsd.org/changeset/base/348237 Log: MFC r346598: Enable Mellanox drivers (modules) on AArch64 PR: 237055 Submitted by: Greg V Modified: stable/12/sys/modules/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/modules/Makefile ============================================================================== --- stable/12/sys/modules/Makefile Fri May 24 11:45:32 2019 (r348236) +++ stable/12/sys/modules/Makefile Fri May 24 13:39:56 2019 (r348237) @@ -498,7 +498,24 @@ SUBDIR+= fdt SUBDIR+= linprocfs SUBDIR+= linsysfs _ena= ena +.if ${MK_OFED} != "no" || defined(ALL_MODULES) +_ibcore= ibcore +_ipoib= ipoib +_iser= iser .endif +_mlx4= mlx4 +_mlx5= mlx5 +.if (${MK_INET_SUPPORT} != "no" && ${MK_INET6_SUPPORT} != "no") || \ + defined(ALL_MODULES) +_mlx4en= mlx4en +_mlx5en= mlx5en +.endif +.if ${MK_OFED} != "no" || defined(ALL_MODULES) +_mthca= mthca +_mlx4ib= mlx4ib +_mlx5ib= mlx5ib +.endif +.endif .if ${MK_NAND} != "no" || defined(ALL_MODULES) _nandfs= nandfs @@ -606,15 +623,8 @@ _ep= ep _et= et _exca= exca _fe= fe -.if ${MK_OFED} != "no" || defined(ALL_MODULES) -_ibcore= ibcore -.endif _if_ndis= if_ndis _io= io -.if ${MK_OFED} != "no" || defined(ALL_MODULES) -_ipoib= ipoib -_iser= iser -.endif _ix= ix _ixv= ixv _linux= linux @@ -687,18 +697,6 @@ _ipwfw= ipwfw _iwifw= iwifw _iwmfw= iwmfw _iwnfw= iwnfw -.endif -_mlx4= mlx4 -_mlx5= mlx5 -.if (${MK_INET_SUPPORT} != "no" && ${MK_INET6_SUPPORT} != "no") || \ - defined(ALL_MODULES) -_mlx4en= mlx4en -_mlx5en= mlx5en -.endif -.if ${MK_OFED} != "no" || defined(ALL_MODULES) -_mthca= mthca -_mlx4ib= mlx4ib -_mlx5ib= mlx5ib .endif _mly= mly _nfe= nfe From owner-svn-src-stable@freebsd.org Fri May 24 14:38:32 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A046E15ACF86; Fri, 24 May 2019 14:38:32 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 37D278FEC7; Fri, 24 May 2019 14:38:32 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1BDAF1E121; Fri, 24 May 2019 14:38:32 +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 x4OEcVAv019191; Fri, 24 May 2019 14:38:31 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4OEcV46019190; Fri, 24 May 2019 14:38:31 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201905241438.x4OEcV46019190@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 24 May 2019 14:38:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348238 - stable/12/share/man/man9 X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/share/man/man9 X-SVN-Commit-Revision: 348238 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 37D278FEC7 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.97)[-0.968,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2019 14:38:32 -0000 Author: markj Date: Fri May 24 14:38:31 2019 New Revision: 348238 URL: https://svnweb.freebsd.org/changeset/base/348238 Log: MFC r348002: Typo. Modified: stable/12/share/man/man9/DRIVER_MODULE.9 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man9/DRIVER_MODULE.9 ============================================================================== --- stable/12/share/man/man9/DRIVER_MODULE.9 Fri May 24 13:39:56 2019 (r348237) +++ stable/12/share/man/man9/DRIVER_MODULE.9 Fri May 24 14:38:31 2019 (r348238) @@ -125,7 +125,7 @@ macro allows a driver to be registered for a specific The boot time probe and attach process makes multiple passes over the device tree. Certain critical drivers that provide basic services needed by other -devices are attach during earlier passes. +devices are attached during earlier passes. Most drivers are attached in a final general pass. A driver that attaches during an early pass must register for a specific pass level From owner-svn-src-stable@freebsd.org Fri May 24 15:37:56 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5C21815AE925; Fri, 24 May 2019 15:37:56 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9897E6C269; Fri, 24 May 2019 15:37:55 +0000 (UTC) (envelope-from johalun@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 75EB31EC0E; Fri, 24 May 2019 15:37:55 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4OFbtB5052289; Fri, 24 May 2019 15:37:55 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4OFbtLN052287; Fri, 24 May 2019 15:37:55 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201905241537.x4OFbtLN052287@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Fri, 24 May 2019 15:37:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348240 - in stable/12/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: in stable/12/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 348240 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9897E6C269 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2019 15:37:56 -0000 Author: johalun Date: Fri May 24 15:37:54 2019 New Revision: 348240 URL: https://svnweb.freebsd.org/changeset/base/348240 Log: MFC r347837: LinuxKPI: Update access_ok macro for v5.0. Check LINUXKPI_VERSION macro for backwards compatibility. It's recommended to update any drivers that depend on the older KPI so we can deprecate < 5.0 code as we update to newer Linux version. This patch is part of D19565 Reviewed by: hps Approved by: imp (mentor), hps Modified: stable/12/sys/compat/linuxkpi/common/include/linux/uaccess.h stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/uaccess.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/uaccess.h Fri May 24 15:21:23 2019 (r348239) +++ stable/12/sys/compat/linuxkpi/common/include/linux/uaccess.h Fri May 24 15:37:54 2019 (r348240) @@ -60,12 +60,17 @@ #define get_user(_x, _p) linux_copyin((_p), &(_x), sizeof(*(_p))) #define put_user(_x, _p) __put_user(_x, _p) #define clear_user(...) linux_clear_user(__VA_ARGS__) -#define access_ok(...) linux_access_ok(__VA_ARGS__) +#if defined(LINUXKPI_VERSION) && LINUXKPI_VERSION >= 50000 +#define access_ok(a,b) linux_access_ok(a,b) +#else +#define access_ok(a,b,c) linux_access_ok(b,c) +#endif + extern int linux_copyin(const void *uaddr, void *kaddr, size_t len); extern int linux_copyout(const void *kaddr, void *uaddr, size_t len); extern size_t linux_clear_user(void *uaddr, size_t len); -extern int linux_access_ok(int rw, const void *uaddr, size_t len); +extern int linux_access_ok(const void *uaddr, size_t len); /* * NOTE: Each pagefault_disable() call must have a corresponding Modified: stable/12/sys/compat/linuxkpi/common/src/linux_compat.c ============================================================================== --- stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Fri May 24 15:21:23 2019 (r348239) +++ stable/12/sys/compat/linuxkpi/common/src/linux_compat.c Fri May 24 15:37:54 2019 (r348240) @@ -897,7 +897,7 @@ linux_clear_user(void *_uaddr, size_t _len) } int -linux_access_ok(int rw, const void *uaddr, size_t len) +linux_access_ok(const void *uaddr, size_t len) { uintptr_t saddr; uintptr_t eaddr; From owner-svn-src-stable@freebsd.org Fri May 24 17:01:07 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E60E015B025F; Fri, 24 May 2019 17:01:06 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 89E2F6EDD0; Fri, 24 May 2019 17:01:06 +0000 (UTC) (envelope-from johalun@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4ABED1FB15; Fri, 24 May 2019 17:01:06 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4OH16VM095141; Fri, 24 May 2019 17:01:06 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4OH15dA095138; Fri, 24 May 2019 17:01:05 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201905241701.x4OH15dA095138@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Fri, 24 May 2019 17:01:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348242 - in stable/12/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: in stable/12/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 348242 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 89E2F6EDD0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2019 17:01:07 -0000 Author: johalun Date: Fri May 24 17:01:05 2019 New Revision: 348242 URL: https://svnweb.freebsd.org/changeset/base/348242 Log: MFC r347852: LinuxKPI: Updates to tasklets for Linux 5.0. DRM drivers expect tasklets to have a counter for enable/disable calls. Also, add a few more tasklet locking functions. MFC also includes powerpc build fix from r347889. This patch is part of D19565 Reviewed by: hps Approved by: imp (mentor), hps Modified: stable/12/sys/compat/linuxkpi/common/include/linux/interrupt.h stable/12/sys/compat/linuxkpi/common/src/linux_tasklet.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/interrupt.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/interrupt.h Fri May 24 15:45:43 2019 (r348241) +++ stable/12/sys/compat/linuxkpi/common/include/linux/interrupt.h Fri May 24 17:01:05 2019 (r348242) @@ -189,11 +189,14 @@ typedef void tasklet_func_t(unsigned long); struct tasklet_struct { TAILQ_ENTRY(tasklet_struct) entry; tasklet_func_t *func; + /* Our "state" implementation is different. Avoid same name as Linux. */ + volatile u_int tasklet_state; + atomic_t count; unsigned long data; }; #define DECLARE_TASKLET(name, func, data) \ -struct tasklet_struct name = { { NULL, NULL }, func, data } +struct tasklet_struct name = { { NULL, NULL }, func, ATOMIC_INIT(0), data } #define tasklet_hi_schedule(t) tasklet_schedule(t) @@ -203,5 +206,8 @@ extern void tasklet_init(struct tasklet_struct *, task unsigned long data); extern void tasklet_enable(struct tasklet_struct *); extern void tasklet_disable(struct tasklet_struct *); +extern int tasklet_trylock(struct tasklet_struct *); +extern void tasklet_unlock(struct tasklet_struct *); +extern void tasklet_unlock_wait(struct tasklet_struct *ts); #endif /* _LINUX_INTERRUPT_H_ */ Modified: stable/12/sys/compat/linuxkpi/common/src/linux_tasklet.c ============================================================================== --- stable/12/sys/compat/linuxkpi/common/src/linux_tasklet.c Fri May 24 15:45:43 2019 (r348241) +++ stable/12/sys/compat/linuxkpi/common/src/linux_tasklet.c Fri May 24 17:01:05 2019 (r348242) @@ -41,20 +41,19 @@ __FBSDID("$FreeBSD$"); #define TASKLET_ST_BUSY 1 #define TASKLET_ST_EXEC 2 #define TASKLET_ST_LOOP 3 -#define TASKLET_ST_PAUSED 4 #define TASKLET_ST_CMPSET(ts, old, new) \ - atomic_cmpset_ptr((volatile uintptr_t *)&(ts)->entry.tqe_prev, old, new) + atomic_cmpset_int((volatile u_int *)&(ts)->tasklet_state, old, new) #define TASKLET_ST_SET(ts, new) \ - WRITE_ONCE(*(volatile uintptr_t *)&(ts)->entry.tqe_prev, new) + WRITE_ONCE(*(volatile u_int *)&(ts)->tasklet_state, new) #define TASKLET_ST_GET(ts) \ - READ_ONCE(*(volatile uintptr_t *)&(ts)->entry.tqe_prev) + READ_ONCE(*(volatile u_int *)&(ts)->tasklet_state) struct tasklet_worker { struct mtx mtx; - TAILQ_HEAD(, tasklet_struct) head; + TAILQ_HEAD(tasklet_list, tasklet_struct) head; struct grouptask gtask; } __aligned(CACHE_LINE_SIZE); @@ -68,25 +67,34 @@ tasklet_handler(void *arg) { struct tasklet_worker *tw = (struct tasklet_worker *)arg; struct tasklet_struct *ts; + struct tasklet_struct *last; linux_set_current(curthread); TASKLET_WORKER_LOCK(tw); + last = TAILQ_LAST(&tw->head, tasklet_list); while (1) { ts = TAILQ_FIRST(&tw->head); if (ts == NULL) break; TAILQ_REMOVE(&tw->head, ts, entry); - TASKLET_WORKER_UNLOCK(tw); - do { - /* reset executing state */ - TASKLET_ST_SET(ts, TASKLET_ST_EXEC); + if (!atomic_read(&ts->count)) { + TASKLET_WORKER_UNLOCK(tw); + do { + /* reset executing state */ + TASKLET_ST_SET(ts, TASKLET_ST_EXEC); - ts->func(ts->data); + ts->func(ts->data); - } while (TASKLET_ST_CMPSET(ts, TASKLET_ST_EXEC, TASKLET_ST_IDLE) == 0); - TASKLET_WORKER_LOCK(tw); + } while (TASKLET_ST_CMPSET(ts, TASKLET_ST_EXEC, + TASKLET_ST_IDLE) == 0); + TASKLET_WORKER_LOCK(tw); + } else { + TAILQ_INSERT_TAIL(&tw->head, ts, entry); + } + if (ts == last) + break; } TASKLET_WORKER_UNLOCK(tw); } @@ -140,6 +148,8 @@ tasklet_init(struct tasklet_struct *ts, ts->entry.tqe_next = NULL; ts->func = func; ts->data = data; + atomic_set_int(&ts->tasklet_state, TASKLET_ST_IDLE); + atomic_set(&ts->count, 0); } void @@ -158,6 +168,10 @@ void tasklet_schedule(struct tasklet_struct *ts) { + /* tasklet is paused */ + if (atomic_read(&ts->count)) + return; + if (TASKLET_ST_CMPSET(ts, TASKLET_ST_EXEC, TASKLET_ST_LOOP)) { /* tasklet_handler() will loop */ } else if (TASKLET_ST_CMPSET(ts, TASKLET_ST_IDLE, TASKLET_ST_BUSY)) { @@ -201,17 +215,39 @@ tasklet_kill(struct tasklet_struct *ts) void tasklet_enable(struct tasklet_struct *ts) { - (void) TASKLET_ST_CMPSET(ts, TASKLET_ST_PAUSED, TASKLET_ST_IDLE); + + atomic_dec(&ts->count); } void tasklet_disable(struct tasklet_struct *ts) { - while (1) { - if (TASKLET_ST_GET(ts) == TASKLET_ST_PAUSED) - break; - if (TASKLET_ST_CMPSET(ts, TASKLET_ST_IDLE, TASKLET_ST_PAUSED)) - break; + + atomic_inc(&ts->count); + tasklet_unlock_wait(ts); +} + +int +tasklet_trylock(struct tasklet_struct *ts) +{ + + return (TASKLET_ST_CMPSET(ts, TASKLET_ST_IDLE, TASKLET_ST_BUSY)); +} + +void +tasklet_unlock(struct tasklet_struct *ts) +{ + + TASKLET_ST_SET(ts, TASKLET_ST_IDLE); +} + +void +tasklet_unlock_wait(struct tasklet_struct *ts) +{ + + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "tasklet_kill() can sleep"); + + /* wait until tasklet is no longer busy */ + while (TASKLET_ST_GET(ts) != TASKLET_ST_IDLE) pause("W", 1); - } } From owner-svn-src-stable@freebsd.org Fri May 24 17:04:29 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4860415B04C0; Fri, 24 May 2019 17:04:29 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DF89F6F09D; Fri, 24 May 2019 17:04:28 +0000 (UTC) (envelope-from johalun@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D61FB1FB8F; Fri, 24 May 2019 17:04:28 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4OH4SCI099096; Fri, 24 May 2019 17:04:28 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4OH4SMV099093; Fri, 24 May 2019 17:04:28 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201905241704.x4OH4SMV099093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Fri, 24 May 2019 17:04:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348243 - in stable/12/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src sys X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: in stable/12/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src sys X-SVN-Commit-Revision: 348243 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DF89F6F09D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2019 17:04:29 -0000 Author: johalun Date: Fri May 24 17:04:27 2019 New Revision: 348243 URL: https://svnweb.freebsd.org/changeset/base/348243 Log: MFC r347843: LinuxKPI: Add group_leader member to struct task_struct. Assign self as group leader at creation to act as the only member of a new process group. Bump FreeBSD version. This patch is part of D19565 Reviewed by: hps Approved by: imp (mentor), hps Modified: stable/12/sys/compat/linuxkpi/common/include/linux/sched.h stable/12/sys/compat/linuxkpi/common/src/linux_current.c stable/12/sys/sys/param.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/sched.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/sched.h Fri May 24 17:01:05 2019 (r348242) +++ stable/12/sys/compat/linuxkpi/common/include/linux/sched.h Fri May 24 17:04:27 2019 (r348243) @@ -80,6 +80,7 @@ struct task_struct { int rcu_recurse; int bsd_interrupt_value; struct work_struct *work; /* current work struct, if set */ + struct task_struct *group_leader; }; #define current ({ \ Modified: stable/12/sys/compat/linuxkpi/common/src/linux_current.c ============================================================================== --- stable/12/sys/compat/linuxkpi/common/src/linux_current.c Fri May 24 17:01:05 2019 (r348242) +++ stable/12/sys/compat/linuxkpi/common/src/linux_current.c Fri May 24 17:04:27 2019 (r348243) @@ -67,6 +67,7 @@ linux_alloc_current(struct thread *td, int flags) ts->task_thread = td; ts->comm = td->td_name; ts->pid = td->td_tid; + ts->group_leader = ts; atomic_set(&ts->usage, 1); atomic_set(&ts->state, TASK_RUNNING); init_completion(&ts->parked); Modified: stable/12/sys/sys/param.h ============================================================================== --- stable/12/sys/sys/param.h Fri May 24 17:01:05 2019 (r348242) +++ stable/12/sys/sys/param.h Fri May 24 17:04:27 2019 (r348243) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200510 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200511 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable@freebsd.org Fri May 24 17:06:11 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3EBAB15B0700; Fri, 24 May 2019 17:06:11 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DA4106F294; Fri, 24 May 2019 17:06:10 +0000 (UTC) (envelope-from johalun@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B41CA1FB91; Fri, 24 May 2019 17:06:10 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4OH6AQW099234; Fri, 24 May 2019 17:06:10 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4OH6AWf099233; Fri, 24 May 2019 17:06:10 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201905241706.x4OH6AWf099233@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Fri, 24 May 2019 17:06:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348244 - stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: stable/12/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 348244 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DA4106F294 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2019 17:06:11 -0000 Author: johalun Date: Fri May 24 17:06:10 2019 New Revision: 348244 URL: https://svnweb.freebsd.org/changeset/base/348244 Log: MFC r347891: LinuxKPI: Add in_task macro. This patch is part of D19565 Reviewed by: hps, bwidawsk Approved by: imp (mentor), hps Obtained from: bwidawsk Modified: stable/12/sys/compat/linuxkpi/common/include/linux/preempt.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/preempt.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/preempt.h Fri May 24 17:04:27 2019 (r348243) +++ stable/12/sys/compat/linuxkpi/common/include/linux/preempt.h Fri May 24 17:06:10 2019 (r348244) @@ -34,6 +34,8 @@ #define in_interrupt() \ (curthread->td_intr_nesting_level || curthread->td_critnest) +#define in_task() (curthread->td_priority >= PI_SOFT) + #define preempt_disable() critical_enter() #define preempt_enable() critical_exit() From owner-svn-src-stable@freebsd.org Fri May 24 17:14:08 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9070115B09ED; Fri, 24 May 2019 17:14:08 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 267C76F93B; Fri, 24 May 2019 17:14:08 +0000 (UTC) (envelope-from johalun@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 152CE1FD4A; Fri, 24 May 2019 17:14:08 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4OHE72b004498; Fri, 24 May 2019 17:14:07 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4OHE7iv004497; Fri, 24 May 2019 17:14:07 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201905241714.x4OHE7iv004497@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Fri, 24 May 2019 17:14:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348245 - in stable/12/sys: compat/linuxkpi/common/include/linux sys X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: in stable/12/sys: compat/linuxkpi/common/include/linux sys X-SVN-Commit-Revision: 348245 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 267C76F93B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2019 17:14:08 -0000 Author: johalun Date: Fri May 24 17:14:07 2019 New Revision: 348245 URL: https://svnweb.freebsd.org/changeset/base/348245 Log: MFC r347596: LinuxKPI: Add context member to ww_mutex and bump FreeBSD version. This patch is part of https://reviews.freebsd.org/D19565. Reviewed by: hps Approved by: imp (mentor), hps Modified: stable/12/sys/compat/linuxkpi/common/include/linux/ww_mutex.h stable/12/sys/sys/param.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/ww_mutex.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/ww_mutex.h Fri May 24 17:06:10 2019 (r348244) +++ stable/12/sys/compat/linuxkpi/common/include/linux/ww_mutex.h Fri May 24 17:14:07 2019 (r348245) @@ -45,6 +45,7 @@ struct ww_acquire_ctx { struct ww_mutex { struct mutex base; struct cv condvar; + struct ww_acquire_ctx *ctx; }; #define DEFINE_WW_CLASS(name) \ Modified: stable/12/sys/sys/param.h ============================================================================== --- stable/12/sys/sys/param.h Fri May 24 17:06:10 2019 (r348244) +++ stable/12/sys/sys/param.h Fri May 24 17:14:07 2019 (r348245) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1200511 /* Master, propagated to newvers */ +#define __FreeBSD_version 1200512 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-stable@freebsd.org Fri May 24 23:07:33 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D4AB15B769C; Fri, 24 May 2019 23:07:33 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AFF5783C80; Fri, 24 May 2019 23:07:32 +0000 (UTC) (envelope-from mckusick@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D38323960; Fri, 24 May 2019 23:07:32 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4ON7WYg087712; Fri, 24 May 2019 23:07:32 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4ON7WXo087711; Fri, 24 May 2019 23:07:32 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201905242307.x4ON7WXo087711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Fri, 24 May 2019 23:07:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348256 - stable/12/sbin/fsck_ffs X-SVN-Group: stable-12 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: stable/12/sbin/fsck_ffs X-SVN-Commit-Revision: 348256 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: AFF5783C80 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 May 2019 23:07:33 -0000 Author: mckusick Date: Fri May 24 23:07:32 2019 New Revision: 348256 URL: https://svnweb.freebsd.org/changeset/base/348256 Log: MFC of 348074 Rewrite fsck_readdir() and dircheck() for clarity and correctness. Modified: stable/12/sbin/fsck_ffs/dir.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/fsck_ffs/dir.c ============================================================================== --- stable/12/sbin/fsck_ffs/dir.c Fri May 24 22:33:14 2019 (r348255) +++ stable/12/sbin/fsck_ffs/dir.c Fri May 24 23:07:32 2019 (r348256) @@ -61,7 +61,7 @@ static struct dirtemplate dirhead = { }; static int chgino(struct inodesc *); -static int dircheck(struct inodesc *, struct direct *); +static int dircheck(struct inodesc *, struct bufarea *, struct direct *); static int expanddir(union dinode *dp, char *name); static void freedir(ino_t ino, ino_t parent); static struct direct *fsck_readdir(struct inodesc *); @@ -139,78 +139,70 @@ dirscan(struct inodesc *idesc) } /* - * get next entry in a directory. + * Get and verify the next entry in a directory. + * We also verify that if there is another entry in the block that it is + * valid, so if it is not valid it can be subsumed into the current entry. */ static struct direct * fsck_readdir(struct inodesc *idesc) { struct direct *dp, *ndp; struct bufarea *bp; - long size, blksiz, fix, dploc; - int dc; + long size, blksiz, subsume_ndp; + subsume_ndp = 0; blksiz = idesc->id_numfrags * sblock.fs_fsize; + if (idesc->id_filesize <= 0 || idesc->id_loc >= blksiz) + return (NULL); bp = getdirblk(idesc->id_blkno, blksiz); - if (idesc->id_loc % DIRBLKSIZ == 0 && idesc->id_filesize > 0 && - idesc->id_loc < blksiz) { - dp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc); - if ((dc = dircheck(idesc, dp)) > 0) { - if (dc == 2) { - /* - * dircheck() cleared unused directory space. - * Mark the buffer as dirty to write it out. - */ - dirty(bp); - } - goto dpok; - } - if (idesc->id_fix == IGNORE) - return (0); - fix = dofix(idesc, "DIRECTORY CORRUPTED"); - bp = getdirblk(idesc->id_blkno, blksiz); - dp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc); - dp->d_reclen = DIRBLKSIZ; - dp->d_ino = 0; - dp->d_type = 0; - dp->d_namlen = 0; - dp->d_name[0] = '\0'; - if (fix) - dirty(bp); - idesc->id_loc += DIRBLKSIZ; - idesc->id_filesize -= DIRBLKSIZ; - return (dp); + dp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc); + /* + * Only need to check current entry if it is the first in the + * the block, as later entries will have been checked in the + * previous call to this function. + */ + if (idesc->id_loc % DIRBLKSIZ != 0 || dircheck(idesc, bp, dp) != 0) { + /* + * Current entry is good, update to point at next. + */ + idesc->id_loc += dp->d_reclen; + idesc->id_filesize -= dp->d_reclen; + /* + * If at end of directory block, just return this entry. + */ + if (idesc->id_filesize <= 0 || idesc->id_loc >= blksiz || + idesc->id_loc % DIRBLKSIZ == 0) + return (dp); + /* + * If the next entry good, return this entry. + */ + ndp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc); + if (dircheck(idesc, bp, ndp) != 0) + return (dp); + /* + * The next entry is bad, so subsume it and the remainder + * of this directory block into this entry. + */ + subsume_ndp = 1; } -dpok: - if (idesc->id_filesize <= 0 || idesc->id_loc >= blksiz) - return NULL; - dploc = idesc->id_loc; - dp = (struct direct *)(bp->b_un.b_buf + dploc); - idesc->id_loc += dp->d_reclen; - idesc->id_filesize -= dp->d_reclen; - if ((idesc->id_loc % DIRBLKSIZ) == 0) - return (dp); - ndp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc); - if (idesc->id_loc < blksiz && idesc->id_filesize > 0) { - if ((dc = dircheck(idesc, ndp)) == 0) { - size = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ); - idesc->id_loc += size; - idesc->id_filesize -= size; - if (idesc->id_fix == IGNORE) - return (0); - fix = dofix(idesc, "DIRECTORY CORRUPTED"); - bp = getdirblk(idesc->id_blkno, blksiz); - dp = (struct direct *)(bp->b_un.b_buf + dploc); - dp->d_reclen += size; - if (fix) - dirty(bp); - } else if (dc == 2) { - /* - * dircheck() cleared unused directory space. - * Mark the buffer as dirty to write it out. - */ - dirty(bp); - } + /* + * Current or next entry is bad. Zap current entry or + * subsume next entry into current entry as appropriate. + */ + size = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ); + idesc->id_loc += size; + idesc->id_filesize -= size; + if (idesc->id_fix == IGNORE) + return (NULL); + if (subsume_ndp) { + memset(ndp, 0, size); + dp->d_reclen += size; + } else { + memset(dp, 0, size); + dp->d_reclen = size; } + if (dofix(idesc, "DIRECTORY CORRUPTED")) + dirty(bp); return (dp); } @@ -219,65 +211,80 @@ dpok: * This is a superset of the checks made in the kernel. * Also optionally clears padding and unused directory space. * - * Returns 0 if the entry is bad, 1 if the entry is good and no changes - * were made, and 2 if the entry is good but modified to clear out padding - * and unused space and needs to be written back to disk. + * Returns 0 if the entry is bad, 1 if the entry is good. */ static int -dircheck(struct inodesc *idesc, struct direct *dp) +dircheck(struct inodesc *idesc, struct bufarea *bp, struct direct *dp) { size_t size; char *cp; - u_char type; u_int8_t namlen; int spaceleft, modified, unused; - modified = 0; spaceleft = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ); + size = DIRSIZ(0, dp); if (dp->d_reclen == 0 || dp->d_reclen > spaceleft || + dp->d_reclen < size || + idesc->id_filesize < size || (dp->d_reclen & (DIR_ROUNDUP - 1)) != 0) goto bad; + modified = 0; if (dp->d_ino == 0) { + if (!zflag || fswritefd < 0) + return (1); /* - * Special case of an unused directory entry. Normally - * the kernel would coalesce unused space with the previous - * entry by extending its d_reclen, but there are situations - * (e.g. fsck) where that doesn't occur. - * If we're clearing out directory cruft (-z flag), then make - * sure this entry gets fully cleared as well. + * Special case of an unused directory entry. Normally only + * occurs at the beginning of a directory block when the block + * contains no entries. Other than the first entry in a + * directory block, the kernel coalesces unused space with + * the previous entry by extending its d_reclen. However, + * when cleaning up a directory, fsck may set d_ino to zero + * in the middle of a directory block. If we're clearing out + * directory cruft (-z flag), then make sure that all directory + * space in entries with d_ino == 0 gets fully cleared. */ - if (zflag && fswritefd >= 0) { - if (dp->d_type != 0) { - dp->d_type = 0; + if (dp->d_type != 0) { + dp->d_type = 0; + modified = 1; + } + if (dp->d_namlen != 0) { + dp->d_namlen = 0; + modified = 1; + } + unused = dp->d_reclen - __offsetof(struct direct, d_name); + for (cp = dp->d_name; unused > 0; unused--, cp++) { + if (*cp != '\0') { + *cp = '\0'; modified = 1; } - if (dp->d_namlen != 0) { - dp->d_namlen = 0; - modified = 1; - } - if (dp->d_name[0] != '\0') { - dp->d_name[0] = '\0'; - modified = 1; - } } - goto good; + if (modified) + dirty(bp); + return (1); } - size = DIRSIZ(0, dp); + /* + * The d_type field should not be tested here. A bad type is an error + * in the entry itself but is not a corruption of the directory + * structure itself. So blowing away all the remaining entries in the + * directory block is inappropriate. Rather the type error should be + * checked in pass1 and fixed there. + * + * The name validation should also be done in pass1 although the + * check to see if the name is longer than fits in the space + * allocated for it (i.e., the *cp != '\0' fails after exiting the + * loop below) then it really is a structural error that requires + * the stronger action taken here. + */ namlen = dp->d_namlen; - type = dp->d_type; - if (dp->d_reclen < size || - idesc->id_filesize < size || - namlen == 0 || - type > 15) + if (namlen == 0 || dp->d_type > 15) goto bad; - for (cp = dp->d_name, size = 0; size < namlen; size++) - if (*cp == '\0' || (*cp++ == '/')) + for (cp = dp->d_name, size = 0; size < namlen; size++) { + if (*cp == '\0' || *cp++ == '/') goto bad; + } if (*cp != '\0') goto bad; - -good: if (zflag && fswritefd >= 0) { /* * Clear unused directory entry space, including the d_name @@ -300,11 +307,9 @@ good: } } - if (modified) { - return 2; - } + if (modified) + dirty(bp); } - return (1); bad: From owner-svn-src-stable@freebsd.org Sat May 25 00:22:08 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8FA5215B8C5D; Sat, 25 May 2019 00:22:08 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2AF7586080; Sat, 25 May 2019 00:22:08 +0000 (UTC) (envelope-from mckusick@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 04489246E1; Sat, 25 May 2019 00:22:08 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4P0M7i2027599; Sat, 25 May 2019 00:22:07 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4P0M77A027598; Sat, 25 May 2019 00:22:07 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201905250022.x4P0M77A027598@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Sat, 25 May 2019 00:22:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r348260 - stable/11/sbin/fsck_ffs X-SVN-Group: stable-11 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: stable/11/sbin/fsck_ffs X-SVN-Commit-Revision: 348260 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2AF7586080 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 May 2019 00:22:08 -0000 Author: mckusick Date: Sat May 25 00:22:07 2019 New Revision: 348260 URL: https://svnweb.freebsd.org/changeset/base/348260 Log: MFC of 348074 Rewrite fsck_readdir() and dircheck() for clarity and correctness. Approved by: re (gjb) Modified: stable/11/sbin/fsck_ffs/dir.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/fsck_ffs/dir.c ============================================================================== --- stable/11/sbin/fsck_ffs/dir.c Sat May 25 00:07:49 2019 (r348259) +++ stable/11/sbin/fsck_ffs/dir.c Sat May 25 00:22:07 2019 (r348260) @@ -59,7 +59,7 @@ static struct dirtemplate dirhead = { }; static int chgino(struct inodesc *); -static int dircheck(struct inodesc *, struct direct *); +static int dircheck(struct inodesc *, struct bufarea *, struct direct *); static int expanddir(union dinode *dp, char *name); static void freedir(ino_t ino, ino_t parent); static struct direct *fsck_readdir(struct inodesc *); @@ -137,78 +137,70 @@ dirscan(struct inodesc *idesc) } /* - * get next entry in a directory. + * Get and verify the next entry in a directory. + * We also verify that if there is another entry in the block that it is + * valid, so if it is not valid it can be subsumed into the current entry. */ static struct direct * fsck_readdir(struct inodesc *idesc) { struct direct *dp, *ndp; struct bufarea *bp; - long size, blksiz, fix, dploc; - int dc; + long size, blksiz, subsume_ndp; + subsume_ndp = 0; blksiz = idesc->id_numfrags * sblock.fs_fsize; + if (idesc->id_filesize <= 0 || idesc->id_loc >= blksiz) + return (NULL); bp = getdirblk(idesc->id_blkno, blksiz); - if (idesc->id_loc % DIRBLKSIZ == 0 && idesc->id_filesize > 0 && - idesc->id_loc < blksiz) { - dp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc); - if ((dc = dircheck(idesc, dp)) > 0) { - if (dc == 2) { - /* - * dircheck() cleared unused directory space. - * Mark the buffer as dirty to write it out. - */ - dirty(bp); - } - goto dpok; - } - if (idesc->id_fix == IGNORE) - return (0); - fix = dofix(idesc, "DIRECTORY CORRUPTED"); - bp = getdirblk(idesc->id_blkno, blksiz); - dp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc); - dp->d_reclen = DIRBLKSIZ; - dp->d_ino = 0; - dp->d_type = 0; - dp->d_namlen = 0; - dp->d_name[0] = '\0'; - if (fix) - dirty(bp); - idesc->id_loc += DIRBLKSIZ; - idesc->id_filesize -= DIRBLKSIZ; - return (dp); + dp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc); + /* + * Only need to check current entry if it is the first in the + * the block, as later entries will have been checked in the + * previous call to this function. + */ + if (idesc->id_loc % DIRBLKSIZ != 0 || dircheck(idesc, bp, dp) != 0) { + /* + * Current entry is good, update to point at next. + */ + idesc->id_loc += dp->d_reclen; + idesc->id_filesize -= dp->d_reclen; + /* + * If at end of directory block, just return this entry. + */ + if (idesc->id_filesize <= 0 || idesc->id_loc >= blksiz || + idesc->id_loc % DIRBLKSIZ == 0) + return (dp); + /* + * If the next entry good, return this entry. + */ + ndp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc); + if (dircheck(idesc, bp, ndp) != 0) + return (dp); + /* + * The next entry is bad, so subsume it and the remainder + * of this directory block into this entry. + */ + subsume_ndp = 1; } -dpok: - if (idesc->id_filesize <= 0 || idesc->id_loc >= blksiz) - return NULL; - dploc = idesc->id_loc; - dp = (struct direct *)(bp->b_un.b_buf + dploc); - idesc->id_loc += dp->d_reclen; - idesc->id_filesize -= dp->d_reclen; - if ((idesc->id_loc % DIRBLKSIZ) == 0) - return (dp); - ndp = (struct direct *)(bp->b_un.b_buf + idesc->id_loc); - if (idesc->id_loc < blksiz && idesc->id_filesize > 0) { - if ((dc = dircheck(idesc, ndp)) == 0) { - size = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ); - idesc->id_loc += size; - idesc->id_filesize -= size; - if (idesc->id_fix == IGNORE) - return (0); - fix = dofix(idesc, "DIRECTORY CORRUPTED"); - bp = getdirblk(idesc->id_blkno, blksiz); - dp = (struct direct *)(bp->b_un.b_buf + dploc); - dp->d_reclen += size; - if (fix) - dirty(bp); - } else if (dc == 2) { - /* - * dircheck() cleared unused directory space. - * Mark the buffer as dirty to write it out. - */ - dirty(bp); - } + /* + * Current or next entry is bad. Zap current entry or + * subsume next entry into current entry as appropriate. + */ + size = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ); + idesc->id_loc += size; + idesc->id_filesize -= size; + if (idesc->id_fix == IGNORE) + return (NULL); + if (subsume_ndp) { + memset(ndp, 0, size); + dp->d_reclen += size; + } else { + memset(dp, 0, size); + dp->d_reclen = size; } + if (dofix(idesc, "DIRECTORY CORRUPTED")) + dirty(bp); return (dp); } @@ -217,65 +209,80 @@ dpok: * This is a superset of the checks made in the kernel. * Also optionally clears padding and unused directory space. * - * Returns 0 if the entry is bad, 1 if the entry is good and no changes - * were made, and 2 if the entry is good but modified to clear out padding - * and unused space and needs to be written back to disk. + * Returns 0 if the entry is bad, 1 if the entry is good. */ static int -dircheck(struct inodesc *idesc, struct direct *dp) +dircheck(struct inodesc *idesc, struct bufarea *bp, struct direct *dp) { size_t size; char *cp; - u_char type; u_int8_t namlen; int spaceleft, modified, unused; - modified = 0; spaceleft = DIRBLKSIZ - (idesc->id_loc % DIRBLKSIZ); + size = DIRSIZ(0, dp); if (dp->d_reclen == 0 || dp->d_reclen > spaceleft || + dp->d_reclen < size || + idesc->id_filesize < size || (dp->d_reclen & (DIR_ROUNDUP - 1)) != 0) goto bad; + modified = 0; if (dp->d_ino == 0) { + if (!zflag || fswritefd < 0) + return (1); /* - * Special case of an unused directory entry. Normally - * the kernel would coalesce unused space with the previous - * entry by extending its d_reclen, but there are situations - * (e.g. fsck) where that doesn't occur. - * If we're clearing out directory cruft (-z flag), then make - * sure this entry gets fully cleared as well. + * Special case of an unused directory entry. Normally only + * occurs at the beginning of a directory block when the block + * contains no entries. Other than the first entry in a + * directory block, the kernel coalesces unused space with + * the previous entry by extending its d_reclen. However, + * when cleaning up a directory, fsck may set d_ino to zero + * in the middle of a directory block. If we're clearing out + * directory cruft (-z flag), then make sure that all directory + * space in entries with d_ino == 0 gets fully cleared. */ - if (zflag && fswritefd >= 0) { - if (dp->d_type != 0) { - dp->d_type = 0; + if (dp->d_type != 0) { + dp->d_type = 0; + modified = 1; + } + if (dp->d_namlen != 0) { + dp->d_namlen = 0; + modified = 1; + } + unused = dp->d_reclen - __offsetof(struct direct, d_name); + for (cp = dp->d_name; unused > 0; unused--, cp++) { + if (*cp != '\0') { + *cp = '\0'; modified = 1; } - if (dp->d_namlen != 0) { - dp->d_namlen = 0; - modified = 1; - } - if (dp->d_name[0] != '\0') { - dp->d_name[0] = '\0'; - modified = 1; - } } - goto good; + if (modified) + dirty(bp); + return (1); } - size = DIRSIZ(0, dp); + /* + * The d_type field should not be tested here. A bad type is an error + * in the entry itself but is not a corruption of the directory + * structure itself. So blowing away all the remaining entries in the + * directory block is inappropriate. Rather the type error should be + * checked in pass1 and fixed there. + * + * The name validation should also be done in pass1 although the + * check to see if the name is longer than fits in the space + * allocated for it (i.e., the *cp != '\0' fails after exiting the + * loop below) then it really is a structural error that requires + * the stronger action taken here. + */ namlen = dp->d_namlen; - type = dp->d_type; - if (dp->d_reclen < size || - idesc->id_filesize < size || - namlen == 0 || - type > 15) + if (namlen == 0 || dp->d_type > 15) goto bad; - for (cp = dp->d_name, size = 0; size < namlen; size++) - if (*cp == '\0' || (*cp++ == '/')) + for (cp = dp->d_name, size = 0; size < namlen; size++) { + if (*cp == '\0' || *cp++ == '/') goto bad; + } if (*cp != '\0') goto bad; - -good: if (zflag && fswritefd >= 0) { /* * Clear unused directory entry space, including the d_name @@ -298,11 +305,9 @@ good: } } - if (modified) { - return 2; - } + if (modified) + dirty(bp); } - return (1); bad: From owner-svn-src-stable@freebsd.org Sat May 25 01:58:02 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F0CC315BA64E; Sat, 25 May 2019 01:58:01 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9347988CAB; Sat, 25 May 2019 01:58:01 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 547D82562A; Sat, 25 May 2019 01:58:01 +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 x4P1w1Es077029; Sat, 25 May 2019 01:58:01 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4P1w0L6077023; Sat, 25 May 2019 01:58:00 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201905250158.x4P1w0L6077023@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Sat, 25 May 2019 01:58:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r348261 - in stable/11: contrib/zlib lib/libz stand/libsa usr.bin/minigzip X-SVN-Group: stable-11 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: in stable/11: contrib/zlib lib/libz stand/libsa usr.bin/minigzip X-SVN-Commit-Revision: 348261 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9347988CAB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.984,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 May 2019 01:58:02 -0000 Author: delphij Date: Sat May 25 01:58:00 2019 New Revision: 348261 URL: https://svnweb.freebsd.org/changeset/base/348261 Log: MFC r347244: Move contrib/zlib to sys/contrib/zlib so that we can use it in kernel. This is a prerequisite of unifying kernel zlib instances. Submitted by: Yoshihiro Ota Approved by: re (kib) Added: - copied from r347244, head/sys/contrib/zlib/ Directory Properties: stable/11/sys/contrib/zlib/ (props changed) Deleted: stable/11/contrib/zlib/ Modified: stable/11/lib/libz/FREEBSD-upgrade stable/11/lib/libz/Makefile stable/11/stand/libsa/Makefile stable/11/usr.bin/minigzip/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libz/FREEBSD-upgrade ============================================================================== --- stable/11/lib/libz/FREEBSD-upgrade Sat May 25 00:22:07 2019 (r348260) +++ stable/11/lib/libz/FREEBSD-upgrade Sat May 25 01:58:00 2019 (r348261) @@ -8,7 +8,7 @@ benefit other consumers. To Update: 1) Unpack vendor sources into a clean directory. 2) Import onto the vendor area. - 3) Merge the vendor tree to contrib/zlib, which contains a stripped down + 3) Merge the vendor tree to sys/contrib/zlib, which contains a stripped down version of upstream source, resolve any conflicts. 4) Double check zconf.h, zlib.pc, and Symbol.map to make sure that we have the required changes. Test universe and commit them. Modified: stable/11/lib/libz/Makefile ============================================================================== --- stable/11/lib/libz/Makefile Sat May 25 00:22:07 2019 (r348260) +++ stable/11/lib/libz/Makefile Sat May 25 01:58:00 2019 (r348261) @@ -8,7 +8,7 @@ SHLIBDIR?= /lib SHLIB_MAJOR= 6 MAN= zlib.3 zopen.3 -ZLIBSRC= ${SRCTOP}/contrib/zlib +ZLIBSRC= ${SRCTOP}/sys/contrib/zlib .PATH: ${ZLIBSRC} Modified: stable/11/stand/libsa/Makefile ============================================================================== --- stable/11/stand/libsa/Makefile Sat May 25 00:22:07 2019 (r348260) +++ stable/11/stand/libsa/Makefile Sat May 25 01:58:00 2019 (r348261) @@ -99,8 +99,8 @@ CFLAGS+= -DBZ_NO_STDIO -DBZ_NO_COMPRESS SRCS+=bzlib.c crctable.c decompress.c huffman.c randtable.c # decompression functionality from zlib -.PATH: ${SRCTOP}/contrib/zlib -CFLAGS+=-DHAVE_MEMCPY -I${SRCTOP}/contrib/zlib +.PATH: ${SRCTOP}/sys/contrib/zlib +CFLAGS+=-DHAVE_MEMCPY -I${SRCTOP}/sys/contrib/zlib SRCS+= adler32.c crc32.c SRCS+= infback.c inffast.c inflate.c inftrees.c zutil.c Modified: stable/11/usr.bin/minigzip/Makefile ============================================================================== --- stable/11/usr.bin/minigzip/Makefile Sat May 25 00:22:07 2019 (r348260) +++ stable/11/usr.bin/minigzip/Makefile Sat May 25 01:58:00 2019 (r348261) @@ -1,6 +1,6 @@ # $FreeBSD$ -SRCDIR= ${SRCTOP}/contrib/zlib/test +SRCDIR= ${SRCTOP}/sys/contrib/zlib/test .PATH: ${SRCDIR} PROG= minigzip From owner-svn-src-stable@freebsd.org Sat May 25 10:17:05 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E662015A8855; Sat, 25 May 2019 10:17:04 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7DE7C6AD8B; Sat, 25 May 2019 10:17:04 +0000 (UTC) (envelope-from rgrimes@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 53D622BF8; Sat, 25 May 2019 10:17:04 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4PAH4sb045315; Sat, 25 May 2019 10:17:04 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4PAH3dR045312; Sat, 25 May 2019 10:17:03 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201905251017.x4PAH3dR045312@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Sat, 25 May 2019 10:17:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r348269 - stable/11/usr.sbin/bhyve X-SVN-Group: stable-11 X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: stable/11/usr.sbin/bhyve X-SVN-Commit-Revision: 348269 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7DE7C6AD8B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 May 2019 10:17:05 -0000 Author: rgrimes Date: Sat May 25 10:17:03 2019 New Revision: 348269 URL: https://svnweb.freebsd.org/changeset/base/348269 Log: MFC: r346717: Make bhyve SMBIOS table topology aware When the CPU Topology was added to bhyve in r332298 the SMBIOS table was missed, this table passes topology information to the system and was still using the old concept of each vCPU is a socket with 1 core and 1 thread. This code did not even try to use the old sysctl information to adjust this data. Correct that by building a proper SMBios table, mapping the > 254 cases to 0 per the SMBios 2.6 specification that is claimed by the structure. Approved by: re (kib) Modified: stable/11/usr.sbin/bhyve/bhyverun.h stable/11/usr.sbin/bhyve/smbiostbl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bhyve/bhyverun.h ============================================================================== --- stable/11/usr.sbin/bhyve/bhyverun.h Sat May 25 07:26:30 2019 (r348268) +++ stable/11/usr.sbin/bhyve/bhyverun.h Sat May 25 10:17:03 2019 (r348269) @@ -36,6 +36,7 @@ struct vmctx; extern int guest_ncpus; +extern uint16_t cores, sockets, threads; extern char *guest_uuid_str; extern char *vmname; Modified: stable/11/usr.sbin/bhyve/smbiostbl.c ============================================================================== --- stable/11/usr.sbin/bhyve/smbiostbl.c Sat May 25 07:26:30 2019 (r348268) +++ stable/11/usr.sbin/bhyve/smbiostbl.c Sat May 25 10:17:03 2019 (r348269) @@ -636,7 +636,7 @@ smbios_type4_initializer(struct smbios_structure *temp { int i; - for (i = 0; i < guest_ncpus; i++) { + for (i = 0; i < sockets; i++) { struct smbios_table_type4 *type4; char *p; int nstrings, len; @@ -655,6 +655,16 @@ smbios_type4_initializer(struct smbios_structure *temp *(*endaddr) = '\0'; (*endaddr)++; type4->socket = nstrings + 1; + /* Revise cores and threads after update to smbios 3.0 */ + if (cores > 254) + type4->cores = 0; + else + type4->cores = cores; + /* This threads is total threads in a socket */ + if ((cores * threads) > 254) + type4->threads = 0; + else + type4->threads = (cores * threads); curaddr = *endaddr; } From owner-svn-src-stable@freebsd.org Sat May 25 11:27:58 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9444C15AA1A2; Sat, 25 May 2019 11:27:58 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 393506D371; Sat, 25 May 2019 11:27:58 +0000 (UTC) (envelope-from rgrimes@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1914539A7; Sat, 25 May 2019 11:27:58 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4PBRvad082945; Sat, 25 May 2019 11:27:57 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4PBRuYu082936; Sat, 25 May 2019 11:27:56 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201905251127.x4PBRuYu082936@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Sat, 25 May 2019 11:27:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r348271 - in stable/11/sys/amd64: include vmm vmm/amd vmm/intel vmm/io X-SVN-Group: stable-11 X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: in stable/11/sys/amd64: include vmm vmm/amd vmm/intel vmm/io X-SVN-Commit-Revision: 348271 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 393506D371 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.948,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 May 2019 11:27:58 -0000 Author: rgrimes Date: Sat May 25 11:27:56 2019 New Revision: 348271 URL: https://svnweb.freebsd.org/changeset/base/348271 Log: MFC: r346714: Add accessor function for vm->maxcpus Replace most VM_MAXCPU constant useses with an accessor function to vm->maxcpus which for now is initialized and kept at the value of VM_MAXCPUS. This is a rework of Fabian Freyer (fabian.freyer_physik.tu-berlin.de) work from D10070 to adjust it for the cpu topology changes that occured in r332298 Approved by: re (kib) Modified: stable/11/sys/amd64/include/vmm.h stable/11/sys/amd64/vmm/amd/svm.c stable/11/sys/amd64/vmm/intel/vmx.c stable/11/sys/amd64/vmm/io/vlapic.c stable/11/sys/amd64/vmm/vmm.c stable/11/sys/amd64/vmm/vmm_dev.c stable/11/sys/amd64/vmm/vmm_lapic.c stable/11/sys/amd64/vmm/vmm_stat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/include/vmm.h ============================================================================== --- stable/11/sys/amd64/include/vmm.h Sat May 25 11:22:49 2019 (r348270) +++ stable/11/sys/amd64/include/vmm.h Sat May 25 11:27:56 2019 (r348271) @@ -184,6 +184,7 @@ int vm_create(const char *name, struct vm **retvm); void vm_destroy(struct vm *vm); int vm_reinit(struct vm *vm); const char *vm_name(struct vm *vm); +uint16_t vm_get_maxcpus(struct vm *vm); void vm_get_topology(struct vm *vm, uint16_t *sockets, uint16_t *cores, uint16_t *threads, uint16_t *maxcpus); int vm_set_topology(struct vm *vm, uint16_t sockets, uint16_t cores, Modified: stable/11/sys/amd64/vmm/amd/svm.c ============================================================================== --- stable/11/sys/amd64/vmm/amd/svm.c Sat May 25 11:22:49 2019 (r348270) +++ stable/11/sys/amd64/vmm/amd/svm.c Sat May 25 11:27:56 2019 (r348271) @@ -524,6 +524,7 @@ svm_vminit(struct vm *vm, pmap_t pmap) struct svm_vcpu *vcpu; vm_paddr_t msrpm_pa, iopm_pa, pml4_pa; int i; + uint16_t maxcpus; svm_sc = malloc(sizeof (*svm_sc), M_SVM, M_WAITOK | M_ZERO); if (((uintptr_t)svm_sc & PAGE_MASK) != 0) @@ -577,7 +578,8 @@ svm_vminit(struct vm *vm, pmap_t pmap) iopm_pa = vtophys(svm_sc->iopm_bitmap); msrpm_pa = vtophys(svm_sc->msr_bitmap); pml4_pa = svm_sc->nptp; - for (i = 0; i < VM_MAXCPU; i++) { + maxcpus = vm_get_maxcpus(svm_sc->vm); + for (i = 0; i < maxcpus; i++) { vcpu = svm_get_vcpu(svm_sc, i); vcpu->nextrip = ~0; vcpu->lastcpu = NOCPU; Modified: stable/11/sys/amd64/vmm/intel/vmx.c ============================================================================== --- stable/11/sys/amd64/vmm/intel/vmx.c Sat May 25 11:22:49 2019 (r348270) +++ stable/11/sys/amd64/vmm/intel/vmx.c Sat May 25 11:27:56 2019 (r348271) @@ -941,6 +941,7 @@ vmx_vminit(struct vm *vm, pmap_t pmap) struct vmx *vmx; struct vmcs *vmcs; uint32_t exc_bitmap; + uint16_t maxcpus; vmx = malloc(sizeof(struct vmx), M_VMX, M_WAITOK | M_ZERO); if ((uintptr_t)vmx & PAGE_MASK) { @@ -1002,7 +1003,8 @@ vmx_vminit(struct vm *vm, pmap_t pmap) KASSERT(error == 0, ("vm_map_mmio(apicbase) error %d", error)); } - for (i = 0; i < VM_MAXCPU; i++) { + maxcpus = vm_get_maxcpus(vm); + for (i = 0; i < maxcpus; i++) { vmcs = &vmx->vmcs[i]; vmcs->identifier = vmx_revision(); error = vmclear(vmcs); @@ -2994,11 +2996,13 @@ vmx_vmcleanup(void *arg) { int i; struct vmx *vmx = arg; + uint16_t maxcpus; if (apic_access_virtualization(vmx, 0)) vm_unmap_mmio(vmx->vm, DEFAULT_APIC_BASE, PAGE_SIZE); - for (i = 0; i < VM_MAXCPU; i++) + maxcpus = vm_get_maxcpus(vmx->vm); + for (i = 0; i < maxcpus; i++) vpid_free(vmx->state[i].vpid); free(vmx, M_VMX); Modified: stable/11/sys/amd64/vmm/io/vlapic.c ============================================================================== --- stable/11/sys/amd64/vmm/io/vlapic.c Sat May 25 11:22:49 2019 (r348270) +++ stable/11/sys/amd64/vmm/io/vlapic.c Sat May 25 11:27:56 2019 (r348271) @@ -836,7 +836,7 @@ vlapic_calcdest(struct vm *vm, cpuset_t *dmask, uint32 */ CPU_ZERO(dmask); vcpuid = vm_apicid2vcpuid(vm, dest); - if (vcpuid < VM_MAXCPU) + if (vcpuid < vm_get_maxcpus(vm)) CPU_SET(vcpuid, dmask); } else { /* @@ -963,6 +963,7 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic, bool struct vlapic *vlapic2; struct vm_exit *vmexit; struct LAPIC *lapic; + uint16_t maxcpus; lapic = vlapic->apic_page; lapic->icr_lo &= ~APIC_DELSTAT_PEND; @@ -1024,11 +1025,12 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic, bool return (0); /* handled completely in the kernel */ } + maxcpus = vm_get_maxcpus(vlapic->vm); if (mode == APIC_DELMODE_INIT) { if ((icrval & APIC_LEVEL_MASK) == APIC_LEVEL_DEASSERT) return (0); - if (vlapic->vcpuid == 0 && dest != 0 && dest < VM_MAXCPU) { + if (vlapic->vcpuid == 0 && dest != 0 && dest < maxcpus) { vlapic2 = vm_lapic(vlapic->vm, dest); /* move from INIT to waiting-for-SIPI state */ @@ -1041,7 +1043,7 @@ vlapic_icrlo_write_handler(struct vlapic *vlapic, bool } if (mode == APIC_DELMODE_STARTUP) { - if (vlapic->vcpuid == 0 && dest != 0 && dest < VM_MAXCPU) { + if (vlapic->vcpuid == 0 && dest != 0 && dest < maxcpus) { vlapic2 = vm_lapic(vlapic->vm, dest); /* @@ -1445,7 +1447,8 @@ void vlapic_init(struct vlapic *vlapic) { KASSERT(vlapic->vm != NULL, ("vlapic_init: vm is not initialized")); - KASSERT(vlapic->vcpuid >= 0 && vlapic->vcpuid < VM_MAXCPU, + KASSERT(vlapic->vcpuid >= 0 && + vlapic->vcpuid < vm_get_maxcpus(vlapic->vm), ("vlapic_init: vcpuid is not initialized")); KASSERT(vlapic->apic_page != NULL, ("vlapic_init: apic_page is not " "initialized")); Modified: stable/11/sys/amd64/vmm/vmm.c ============================================================================== --- stable/11/sys/amd64/vmm/vmm.c Sat May 25 11:22:49 2019 (r348270) +++ stable/11/sys/amd64/vmm/vmm.c Sat May 25 11:27:56 2019 (r348271) @@ -273,7 +273,7 @@ vcpu_init(struct vm *vm, int vcpu_id, bool create) { struct vcpu *vcpu; - KASSERT(vcpu_id >= 0 && vcpu_id < VM_MAXCPU, + KASSERT(vcpu_id >= 0 && vcpu_id < vm->maxcpus, ("vcpu_init: invalid vcpu %d", vcpu_id)); vcpu = &vm->vcpu[vcpu_id]; @@ -312,7 +312,7 @@ vm_exitinfo(struct vm *vm, int cpuid) { struct vcpu *vcpu; - if (cpuid < 0 || cpuid >= VM_MAXCPU) + if (cpuid < 0 || cpuid >= vm->maxcpus) panic("vm_exitinfo: invalid cpuid %d", cpuid); vcpu = &vm->vcpu[cpuid]; @@ -424,7 +424,7 @@ vm_init(struct vm *vm, bool create) vm->suspend = 0; CPU_ZERO(&vm->suspended_cpus); - for (i = 0; i < VM_MAXCPU; i++) + for (i = 0; i < vm->maxcpus; i++) vcpu_init(vm, i, create); } @@ -462,7 +462,7 @@ vm_create(const char *name, struct vm **retvm) vm->sockets = 1; vm->cores = cores_per_package; /* XXX backwards compatibility */ vm->threads = threads_per_core; /* XXX backwards compatibility */ - vm->maxcpus = 0; /* XXX not implemented */ + vm->maxcpus = VM_MAXCPU; /* XXX temp to keep code working */ vm_init(vm, true); @@ -480,19 +480,25 @@ vm_get_topology(struct vm *vm, uint16_t *sockets, uint *maxcpus = vm->maxcpus; } +uint16_t +vm_get_maxcpus(struct vm *vm) +{ + return (vm->maxcpus); +} + int vm_set_topology(struct vm *vm, uint16_t sockets, uint16_t cores, uint16_t threads, uint16_t maxcpus) { if (maxcpus != 0) return (EINVAL); /* XXX remove when supported */ - if ((sockets * cores * threads) > VM_MAXCPU) + if ((sockets * cores * threads) > vm->maxcpus) return (EINVAL); /* XXX need to check sockets * cores * threads == vCPU, how? */ vm->sockets = sockets; vm->cores = cores; vm->threads = threads; - vm->maxcpus = maxcpus; + vm->maxcpus = VM_MAXCPU; /* XXX temp to keep code working */ return(0); } @@ -517,7 +523,7 @@ vm_cleanup(struct vm *vm, bool destroy) vatpic_cleanup(vm->vatpic); vioapic_cleanup(vm->vioapic); - for (i = 0; i < VM_MAXCPU; i++) + for (i = 0; i < vm->maxcpus; i++) vcpu_cleanup(vm, i, destroy); VMCLEANUP(vm->cookie); @@ -952,9 +958,9 @@ vm_gpa_hold(struct vm *vm, int vcpuid, vm_paddr_t gpa, * guaranteed if at least one vcpu is in the VCPU_FROZEN state. */ int state; - KASSERT(vcpuid >= -1 && vcpuid < VM_MAXCPU, ("%s: invalid vcpuid %d", + KASSERT(vcpuid >= -1 && vcpuid < vm->maxcpus, ("%s: invalid vcpuid %d", __func__, vcpuid)); - for (i = 0; i < VM_MAXCPU; i++) { + for (i = 0; i < vm->maxcpus; i++) { if (vcpuid != -1 && vcpuid != i) continue; state = vcpu_get_state(vm, i, NULL); @@ -1000,7 +1006,7 @@ int vm_get_register(struct vm *vm, int vcpu, int reg, uint64_t *retval) { - if (vcpu < 0 || vcpu >= VM_MAXCPU) + if (vcpu < 0 || vcpu >= vm->maxcpus) return (EINVAL); if (reg >= VM_REG_LAST) @@ -1015,7 +1021,7 @@ vm_set_register(struct vm *vm, int vcpuid, int reg, ui struct vcpu *vcpu; int error; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); if (reg >= VM_REG_LAST) @@ -1069,7 +1075,7 @@ vm_get_seg_desc(struct vm *vm, int vcpu, int reg, struct seg_desc *desc) { - if (vcpu < 0 || vcpu >= VM_MAXCPU) + if (vcpu < 0 || vcpu >= vm->maxcpus) return (EINVAL); if (!is_segment_register(reg) && !is_descriptor_table(reg)) @@ -1082,7 +1088,7 @@ int vm_set_seg_desc(struct vm *vm, int vcpu, int reg, struct seg_desc *desc) { - if (vcpu < 0 || vcpu >= VM_MAXCPU) + if (vcpu < 0 || vcpu >= vm->maxcpus) return (EINVAL); if (!is_segment_register(reg) && !is_descriptor_table(reg)) @@ -1254,7 +1260,7 @@ static void vm_handle_rendezvous(struct vm *vm, int vcpuid) { - KASSERT(vcpuid == -1 || (vcpuid >= 0 && vcpuid < VM_MAXCPU), + KASSERT(vcpuid == -1 || (vcpuid >= 0 && vcpuid < vm->maxcpus), ("vm_handle_rendezvous: invalid vcpuid %d", vcpuid)); mtx_lock(&vm->rendezvous_mtx); @@ -1530,7 +1536,7 @@ vm_handle_suspend(struct vm *vm, int vcpuid, bool *ret /* * Wakeup the other sleeping vcpus and return to userspace. */ - for (i = 0; i < VM_MAXCPU; i++) { + for (i = 0; i < vm->maxcpus; i++) { if (CPU_ISSET(i, &vm->suspended_cpus)) { vcpu_notify_event(vm, i, false); } @@ -1572,7 +1578,7 @@ vm_suspend(struct vm *vm, enum vm_suspend_how how) /* * Notify all active vcpus that they are now suspended. */ - for (i = 0; i < VM_MAXCPU; i++) { + for (i = 0; i < vm->maxcpus; i++) { if (CPU_ISSET(i, &vm->active_cpus)) vcpu_notify_event(vm, i, false); } @@ -1647,7 +1653,7 @@ vm_run(struct vm *vm, struct vm_run *vmrun) vcpuid = vmrun->cpuid; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); if (!CPU_ISSET(vcpuid, &vm->active_cpus)) @@ -1748,7 +1754,7 @@ vm_restart_instruction(void *arg, int vcpuid) int error; vm = arg; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); vcpu = &vm->vcpu[vcpuid]; @@ -1787,7 +1793,7 @@ vm_exit_intinfo(struct vm *vm, int vcpuid, uint64_t in struct vcpu *vcpu; int type, vector; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); vcpu = &vm->vcpu[vcpuid]; @@ -1928,7 +1934,8 @@ vm_entry_intinfo(struct vm *vm, int vcpuid, uint64_t * uint64_t info1, info2; int valid; - KASSERT(vcpuid >= 0 && vcpuid < VM_MAXCPU, ("invalid vcpu %d", vcpuid)); + KASSERT(vcpuid >= 0 && + vcpuid < vm->maxcpus, ("invalid vcpu %d", vcpuid)); vcpu = &vm->vcpu[vcpuid]; @@ -1968,7 +1975,7 @@ vm_get_intinfo(struct vm *vm, int vcpuid, uint64_t *in { struct vcpu *vcpu; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); vcpu = &vm->vcpu[vcpuid]; @@ -1985,7 +1992,7 @@ vm_inject_exception(struct vm *vm, int vcpuid, int vec uint64_t regval; int error; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); if (vector < 0 || vector >= 32) @@ -2076,7 +2083,7 @@ vm_inject_nmi(struct vm *vm, int vcpuid) { struct vcpu *vcpu; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); vcpu = &vm->vcpu[vcpuid]; @@ -2091,7 +2098,7 @@ vm_nmi_pending(struct vm *vm, int vcpuid) { struct vcpu *vcpu; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) panic("vm_nmi_pending: invalid vcpuid %d", vcpuid); vcpu = &vm->vcpu[vcpuid]; @@ -2104,7 +2111,7 @@ vm_nmi_clear(struct vm *vm, int vcpuid) { struct vcpu *vcpu; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) panic("vm_nmi_pending: invalid vcpuid %d", vcpuid); vcpu = &vm->vcpu[vcpuid]; @@ -2123,7 +2130,7 @@ vm_inject_extint(struct vm *vm, int vcpuid) { struct vcpu *vcpu; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); vcpu = &vm->vcpu[vcpuid]; @@ -2138,7 +2145,7 @@ vm_extint_pending(struct vm *vm, int vcpuid) { struct vcpu *vcpu; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) panic("vm_extint_pending: invalid vcpuid %d", vcpuid); vcpu = &vm->vcpu[vcpuid]; @@ -2151,7 +2158,7 @@ vm_extint_clear(struct vm *vm, int vcpuid) { struct vcpu *vcpu; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) panic("vm_extint_pending: invalid vcpuid %d", vcpuid); vcpu = &vm->vcpu[vcpuid]; @@ -2166,7 +2173,7 @@ vm_extint_clear(struct vm *vm, int vcpuid) int vm_get_capability(struct vm *vm, int vcpu, int type, int *retval) { - if (vcpu < 0 || vcpu >= VM_MAXCPU) + if (vcpu < 0 || vcpu >= vm->maxcpus) return (EINVAL); if (type < 0 || type >= VM_CAP_MAX) @@ -2178,7 +2185,7 @@ vm_get_capability(struct vm *vm, int vcpu, int type, i int vm_set_capability(struct vm *vm, int vcpu, int type, int val) { - if (vcpu < 0 || vcpu >= VM_MAXCPU) + if (vcpu < 0 || vcpu >= vm->maxcpus) return (EINVAL); if (type < 0 || type >= VM_CAP_MAX) @@ -2263,7 +2270,7 @@ vcpu_set_state(struct vm *vm, int vcpuid, enum vcpu_st int error; struct vcpu *vcpu; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) panic("vm_set_run_state: invalid vcpuid %d", vcpuid); vcpu = &vm->vcpu[vcpuid]; @@ -2281,7 +2288,7 @@ vcpu_get_state(struct vm *vm, int vcpuid, int *hostcpu struct vcpu *vcpu; enum vcpu_state state; - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) panic("vm_get_run_state: invalid vcpuid %d", vcpuid); vcpu = &vm->vcpu[vcpuid]; @@ -2299,7 +2306,7 @@ int vm_activate_cpu(struct vm *vm, int vcpuid) { - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); if (CPU_ISSET(vcpuid, &vm->active_cpus)) @@ -2334,7 +2341,7 @@ vcpu_stats(struct vm *vm, int vcpuid) int vm_get_x2apic_state(struct vm *vm, int vcpuid, enum x2apic_state *state) { - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); *state = vm->vcpu[vcpuid].x2apic_state; @@ -2345,7 +2352,7 @@ vm_get_x2apic_state(struct vm *vm, int vcpuid, enum x2 int vm_set_x2apic_state(struct vm *vm, int vcpuid, enum x2apic_state state) { - if (vcpuid < 0 || vcpuid >= VM_MAXCPU) + if (vcpuid < 0 || vcpuid >= vm->maxcpus) return (EINVAL); if (state >= X2APIC_STATE_LAST) @@ -2432,7 +2439,7 @@ vm_smp_rendezvous(struct vm *vm, int vcpuid, cpuset_t * Enforce that this function is called without any locks */ WITNESS_WARN(WARN_PANIC, NULL, "vm_smp_rendezvous"); - KASSERT(vcpuid == -1 || (vcpuid >= 0 && vcpuid < VM_MAXCPU), + KASSERT(vcpuid == -1 || (vcpuid >= 0 && vcpuid < vm->maxcpus), ("vm_smp_rendezvous: invalid vcpuid %d", vcpuid)); restart: @@ -2462,7 +2469,7 @@ restart: * Wake up any sleeping vcpus and trigger a VM-exit in any running * vcpus so they handle the rendezvous as soon as possible. */ - for (i = 0; i < VM_MAXCPU; i++) { + for (i = 0; i < vm->maxcpus; i++) { if (CPU_ISSET(i, &dest)) vcpu_notify_event(vm, i, false); } Modified: stable/11/sys/amd64/vmm/vmm_dev.c ============================================================================== --- stable/11/sys/amd64/vmm/vmm_dev.c Sat May 25 11:22:49 2019 (r348270) +++ stable/11/sys/amd64/vmm/vmm_dev.c Sat May 25 11:27:56 2019 (r348271) @@ -94,7 +94,7 @@ vcpu_lock_one(struct vmmdev_softc *sc, int vcpu) { int error; - if (vcpu < 0 || vcpu >= VM_MAXCPU) + if (vcpu < 0 || vcpu >= vm_get_maxcpus(sc->vm)) return (EINVAL); error = vcpu_set_state(sc->vm, vcpu, VCPU_FROZEN, true); @@ -119,8 +119,10 @@ static int vcpu_lock_all(struct vmmdev_softc *sc) { int error, vcpu; + uint16_t maxcpus; - for (vcpu = 0; vcpu < VM_MAXCPU; vcpu++) { + maxcpus = vm_get_maxcpus(sc->vm); + for (vcpu = 0; vcpu < maxcpus; vcpu++) { error = vcpu_lock_one(sc, vcpu); if (error) break; @@ -138,8 +140,10 @@ static void vcpu_unlock_all(struct vmmdev_softc *sc) { int vcpu; + uint16_t maxcpus; - for (vcpu = 0; vcpu < VM_MAXCPU; vcpu++) + maxcpus = vm_get_maxcpus(sc->vm); + for (vcpu = 0; vcpu < maxcpus; vcpu++) vcpu_unlock_one(sc, vcpu); } @@ -174,6 +178,7 @@ vmmdev_rw(struct cdev *cdev, struct uio *uio, int flag vm_paddr_t gpa, maxaddr; void *hpa, *cookie; struct vmmdev_softc *sc; + uint16_t lastcpu; sc = vmmdev_lookup2(cdev); if (sc == NULL) @@ -182,7 +187,8 @@ vmmdev_rw(struct cdev *cdev, struct uio *uio, int flag /* * Get a read lock on the guest memory map by freezing any vcpu. */ - error = vcpu_lock_one(sc, VM_MAXCPU - 1); + lastcpu = vm_get_maxcpus(sc->vm) - 1; + error = vcpu_lock_one(sc, lastcpu); if (error) return (error); @@ -201,7 +207,8 @@ vmmdev_rw(struct cdev *cdev, struct uio *uio, int flag * Since this device does not support lseek(2), dd(1) will * read(2) blocks of data to simulate the lseek(2). */ - hpa = vm_gpa_hold(sc->vm, VM_MAXCPU - 1, gpa, c, prot, &cookie); + hpa = vm_gpa_hold(sc->vm, lastcpu, gpa, c, + prot, &cookie); if (hpa == NULL) { if (uio->uio_rw == UIO_READ && gpa < maxaddr) error = uiomove(__DECONST(void *, zero_region), @@ -213,7 +220,7 @@ vmmdev_rw(struct cdev *cdev, struct uio *uio, int flag vm_gpa_release(cookie); } } - vcpu_unlock_one(sc, VM_MAXCPU - 1); + vcpu_unlock_one(sc, lastcpu); return (error); } @@ -377,7 +384,7 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t da * Lock a vcpu to make sure that the memory map cannot be * modified while it is being inspected. */ - vcpu = VM_MAXCPU - 1; + vcpu = vm_get_maxcpus(sc->vm) - 1; error = vcpu_lock_one(sc, vcpu); if (error) goto done; @@ -678,6 +685,7 @@ vmmdev_mmap_single(struct cdev *cdev, vm_ooffset_t *of size_t len; vm_ooffset_t segoff, first, last; int error, found, segid; + uint16_t lastcpu; bool sysmem; first = *offset; @@ -694,7 +702,8 @@ vmmdev_mmap_single(struct cdev *cdev, vm_ooffset_t *of /* * Get a read lock on the guest memory map by freezing any vcpu. */ - error = vcpu_lock_one(sc, VM_MAXCPU - 1); + lastcpu = vm_get_maxcpus(sc->vm) - 1; + error = vcpu_lock_one(sc, lastcpu); if (error) return (error); @@ -723,7 +732,7 @@ vmmdev_mmap_single(struct cdev *cdev, vm_ooffset_t *of error = EINVAL; } } - vcpu_unlock_one(sc, VM_MAXCPU - 1); + vcpu_unlock_one(sc, lastcpu); return (error); } @@ -910,6 +919,7 @@ devmem_mmap_single(struct cdev *cdev, vm_ooffset_t *of vm_ooffset_t first, last; size_t seglen; int error; + uint16_t lastcpu; bool sysmem; dsc = cdev->si_drv1; @@ -923,7 +933,8 @@ devmem_mmap_single(struct cdev *cdev, vm_ooffset_t *of if ((nprot & PROT_EXEC) || first < 0 || first >= last) return (EINVAL); - error = vcpu_lock_one(dsc->sc, VM_MAXCPU - 1); + lastcpu = vm_get_maxcpus(dsc->sc->vm) - 1; + error = vcpu_lock_one(dsc->sc, lastcpu); if (error) return (error); @@ -931,7 +942,7 @@ devmem_mmap_single(struct cdev *cdev, vm_ooffset_t *of KASSERT(error == 0 && !sysmem && *objp != NULL, ("%s: invalid devmem segment %d", __func__, dsc->segid)); - vcpu_unlock_one(dsc->sc, VM_MAXCPU - 1); + vcpu_unlock_one(dsc->sc, lastcpu); if (seglen >= last) { vm_object_reference(*objp); Modified: stable/11/sys/amd64/vmm/vmm_lapic.c ============================================================================== --- stable/11/sys/amd64/vmm/vmm_lapic.c Sat May 25 11:22:49 2019 (r348270) +++ stable/11/sys/amd64/vmm/vmm_lapic.c Sat May 25 11:27:56 2019 (r348271) @@ -54,7 +54,7 @@ lapic_set_intr(struct vm *vm, int cpu, int vector, boo { struct vlapic *vlapic; - if (cpu < 0 || cpu >= VM_MAXCPU) + if (cpu < 0 || cpu >= vm_get_maxcpus(vm)) return (EINVAL); /* @@ -77,7 +77,7 @@ lapic_set_local_intr(struct vm *vm, int cpu, int vecto cpuset_t dmask; int error; - if (cpu < -1 || cpu >= VM_MAXCPU) + if (cpu < -1 || cpu >= vm_get_maxcpus(vm)) return (EINVAL); if (cpu == -1) Modified: stable/11/sys/amd64/vmm/vmm_stat.c ============================================================================== --- stable/11/sys/amd64/vmm/vmm_stat.c Sat May 25 11:22:49 2019 (r348270) +++ stable/11/sys/amd64/vmm/vmm_stat.c Sat May 25 11:27:56 2019 (r348271) @@ -86,7 +86,7 @@ vmm_stat_copy(struct vm *vm, int vcpu, int *num_stats, uint64_t *stats; int i; - if (vcpu < 0 || vcpu >= VM_MAXCPU) + if (vcpu < 0 || vcpu >= vm_get_maxcpus(vm)) return (EINVAL); /* Let stats functions update their counters */ From owner-svn-src-stable@freebsd.org Sat May 25 17:17:10 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6105E15B181F; Sat, 25 May 2019 17:17:10 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 00F238085E; Sat, 25 May 2019 17:17:10 +0000 (UTC) (envelope-from johalun@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C9AB475A5; Sat, 25 May 2019 17:17:09 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4PHH9mi069232; Sat, 25 May 2019 17:17:09 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4PHH9Ol069230; Sat, 25 May 2019 17:17:09 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201905251717.x4PHH9Ol069230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Sat, 25 May 2019 17:17:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348273 - in stable/12/sys/compat: lindebugfs linuxkpi/common/include/linux linuxkpi/common/src X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: in stable/12/sys/compat: lindebugfs linuxkpi/common/include/linux linuxkpi/common/src X-SVN-Commit-Revision: 348273 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 00F238085E X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 May 2019 17:17:10 -0000 Author: johalun Date: Sat May 25 17:17:08 2019 New Revision: 348273 URL: https://svnweb.freebsd.org/changeset/base/348273 Log: MFC r344485: import linux debugfs support Reviewed by: hps@ Sponsored by: iX Systems Differential Revision: https://reviews.freebsd.org/D19258 Added: stable/12/sys/compat/lindebugfs/ - copied from r344485, head/sys/compat/lindebugfs/ stable/12/sys/compat/linuxkpi/common/include/linux/debugfs.h - copied unchanged from r344485, head/sys/compat/linuxkpi/common/include/linux/debugfs.h stable/12/sys/compat/linuxkpi/common/include/linux/seq_file.h - copied unchanged from r344485, head/sys/compat/linuxkpi/common/include/linux/seq_file.h stable/12/sys/compat/linuxkpi/common/src/linux_seq_file.c - copied unchanged from r344485, head/sys/compat/linuxkpi/common/src/linux_seq_file.c Modified: Directory Properties: stable/12/ (props changed) Copied: stable/12/sys/compat/linuxkpi/common/include/linux/debugfs.h (from r344485, head/sys/compat/linuxkpi/common/include/linux/debugfs.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/compat/linuxkpi/common/include/linux/debugfs.h Sat May 25 17:17:08 2019 (r348273, copy of r344485, head/sys/compat/linuxkpi/common/include/linux/debugfs.h) @@ -0,0 +1,51 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2016-2018, Matthew Macy + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _LINUX_DEBUGFS_H_ +#define _LINUX_DEBUGFS_H_ + +#include +#include + +#include + +void debugfs_remove(struct dentry *dentry); + +struct dentry *debugfs_create_file(const char *name, umode_t mode, + struct dentry *parent, void *data, + const struct file_operations *fops); + +struct dentry *debugfs_create_dir(const char *name, struct dentry *parent); + +struct dentry *debugfs_create_symlink(const char *name, struct dentry *parent, + const char *dest); + +void debugfs_remove_recursive(struct dentry *dentry); + +#endif Copied: stable/12/sys/compat/linuxkpi/common/include/linux/seq_file.h (from r344485, head/sys/compat/linuxkpi/common/include/linux/seq_file.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/compat/linuxkpi/common/include/linux/seq_file.h Sat May 25 17:17:08 2019 (r348273, copy of r344485, head/sys/compat/linuxkpi/common/include/linux/seq_file.h) @@ -0,0 +1,71 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2016-2018, Matthew Macy + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _LINUX_SEQ_FILE_H_ +#define _LINUX_SEQ_FILE_H_ + +#include + +struct seq_operations; +struct linux_file; + +#define inode vnode + +struct seq_file { + struct sbuf *buf; + + const struct seq_operations *op; + const struct linux_file *file; + void *private; +}; + +struct seq_operations { + void * (*start) (struct seq_file *m, off_t *pos); + void (*stop) (struct seq_file *m, void *v); + void * (*next) (struct seq_file *m, void *v, off_t *pos); + int (*show) (struct seq_file *m, void *v); +}; + +ssize_t seq_read(struct linux_file *, char *, size_t, off_t *); +int seq_write(struct seq_file *seq, const void *data, size_t len); + +int seq_open(struct linux_file *f, const struct seq_operations *op); +int seq_release(struct inode *inode, struct linux_file *file); + +off_t seq_lseek(struct linux_file *file, off_t offset, int whence); +int single_open(struct linux_file *, int (*)(struct seq_file *, void *), void *); +int single_release(struct inode *, struct linux_file *); + +#define seq_printf(m, fmt, ...) sbuf_printf((m)->buf, (fmt), ##__VA_ARGS__) + +#define seq_puts(m, str) sbuf_printf((m)->buf, str) +#define seq_putc(m, str) sbuf_putc((m)->buf, str) + + +#endif /* _LINUX_SEQ_FILE_H_ */ Copied: stable/12/sys/compat/linuxkpi/common/src/linux_seq_file.c (from r344485, head/sys/compat/linuxkpi/common/src/linux_seq_file.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/compat/linuxkpi/common/src/linux_seq_file.c Sat May 25 17:17:08 2019 (r348273, copy of r344485, head/sys/compat/linuxkpi/common/src/linux_seq_file.c) @@ -0,0 +1,157 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2016-2018, Matthew Macy + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include +#include + +#undef file +MALLOC_DEFINE(M_LSEQ, "seq_file", "seq_file"); + +ssize_t +seq_read(struct linux_file *f, char *ubuf, size_t size, off_t *ppos) +{ + struct seq_file *m = f->private_data; + void *p; + int rc; + off_t pos = 0; + + p = m->op->start(m, &pos); + rc = m->op->show(m, p); + if (rc) + return (rc); + return (size); +} + +int +seq_write(struct seq_file *seq, const void *data, size_t len) +{ + + return (sbuf_bcpy(seq->buf, data, len)); +} + +/* + * This only needs to be a valid address for lkpi + * drivers it should never actually be called + */ +off_t +seq_lseek(struct linux_file *file, off_t offset, int whence) +{ + + panic("%s not supported\n", __FUNCTION__); + return (0); +} + +static void * +single_start(struct seq_file *p, off_t *pos) +{ + + return ((void *)(uintptr_t)(*pos == 0)); +} + +static void * +single_next(struct seq_file *p, void *v, off_t *pos) +{ + + ++*pos; + return (NULL); +} + +static void +single_stop(struct seq_file *p, void *v) +{ +} + +int +seq_open(struct linux_file *f, const struct seq_operations *op) +{ + struct seq_file *p; + + if (f->private_data != NULL) + log(LOG_WARNING, "%s private_data not NULL", __func__); + + if ((p = malloc(sizeof(*p), M_LSEQ, M_NOWAIT|M_ZERO)) == NULL) + return (-ENOMEM); + + f->private_data = p; + p->op = op; + p->file = f; + return (0); +} + +int +single_open(struct linux_file *f, int (*show)(struct seq_file *, void *), void *d) +{ + struct seq_operations *op; + int rc = -ENOMEM; + + op = malloc(sizeof(*op), M_LSEQ, M_NOWAIT); + if (op) { + op->start = single_start; + op->next = single_next; + op->stop = single_stop; + op->show = show; + rc = seq_open(f, op); + if (rc) + free(op, M_LSEQ); + else + ((struct seq_file *)f->private_data)->private = d; + + } + return (rc); +} + +int +seq_release(struct inode *inode __unused, struct linux_file *file) +{ + struct seq_file *m; + + m = file->private_data; + free(m, M_LSEQ); + return (0); +} + +int +single_release(struct vnode *v, struct linux_file *f) +{ + const struct seq_operations *op = ((struct seq_file *)f->private_data)->op; + int rc; + + rc = seq_release(v, f); + free(__DECONST(void *, op), M_LSEQ); + return (rc); +} From owner-svn-src-stable@freebsd.org Sat May 25 18:03:18 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E959515B2726; Sat, 25 May 2019 18:03:17 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 88B22830A8; Sat, 25 May 2019 18:03:17 +0000 (UTC) (envelope-from johalun@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 723CF7E0C; Sat, 25 May 2019 18:03:17 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4PI3HWH096338; Sat, 25 May 2019 18:03:17 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4PI3Hen096337; Sat, 25 May 2019 18:03:17 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201905251803.x4PI3Hen096337@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Sat, 25 May 2019 18:03:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348275 - stable/12/sys/conf X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: stable/12/sys/conf X-SVN-Commit-Revision: 348275 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 88B22830A8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 May 2019 18:03:18 -0000 Author: johalun Date: Sat May 25 18:03:17 2019 New Revision: 348275 URL: https://svnweb.freebsd.org/changeset/base/348275 Log: LinuxKPI: Register new linuxkpi and lindebugfs source files. This change is a partial MFC of r344487. Reviewed by: hps Approved by: imp (mentor), hps Obtained from: mmacy Modified: stable/12/sys/conf/files Modified: stable/12/sys/conf/files ============================================================================== --- stable/12/sys/conf/files Sat May 25 17:37:28 2019 (r348274) +++ stable/12/sys/conf/files Sat May 25 18:03:17 2019 (r348275) @@ -4529,6 +4529,11 @@ compat/linuxkpi/common/src/linux_usb.c optional compa compile-with "${LINUXKPI_C}" compat/linuxkpi/common/src/linux_work.c optional compat_linuxkpi \ compile-with "${LINUXKPI_C}" +compat/linuxkpi/common/src/linux_seq_file.c optional compat_linuxkpi | lindebugfs \ + compile-with "${LINUXKPI_C}" + +compat/lindebugfs/lindebugfs.c optional lindebugfs \ + compile-with "${LINUXKPI_C}" # OpenFabrics Enterprise Distribution (Infiniband) ofed/drivers/infiniband/core/ib_addr.c optional ofed \ From owner-svn-src-stable@freebsd.org Sat May 25 18:23:34 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E9B9A15B3092; Sat, 25 May 2019 18:23:33 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8795884128; Sat, 25 May 2019 18:23:33 +0000 (UTC) (envelope-from johalun@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6DB978180; Sat, 25 May 2019 18:23:33 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4PINXrI007312; Sat, 25 May 2019 18:23:33 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4PINXPn007310; Sat, 25 May 2019 18:23:33 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201905251823.x4PINXPn007310@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Sat, 25 May 2019 18:23:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348276 - in stable/12/sys: kern sys X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: in stable/12/sys: kern sys X-SVN-Commit-Revision: 348276 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8795884128 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.97)[-0.966,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 May 2019 18:23:34 -0000 Author: johalun Date: Sat May 25 18:23:32 2019 New Revision: 348276 URL: https://svnweb.freebsd.org/changeset/base/348276 Log: MFC r344486: Change seq_read to seq_load to avoid namespace conflicts with lkpi Sponsored by: iX Systems Modified: stable/12/sys/kern/kern_descrip.c stable/12/sys/sys/seq.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_descrip.c ============================================================================== --- stable/12/sys/kern/kern_descrip.c Sat May 25 18:03:17 2019 (r348275) +++ stable/12/sys/kern/kern_descrip.c Sat May 25 18:23:32 2019 (r348276) @@ -2647,7 +2647,7 @@ fget_unlocked(struct filedesc *fdp, int fd, cap_rights */ for (;;) { #ifdef CAPABILITIES - seq = seq_read(fd_seq(fdt, fd)); + seq = seq_load(fd_seq(fdt, fd)); fde = &fdt->fdt_ofiles[fd]; haverights = *cap_rights_fde_inline(fde); fp = fde->fde_file; Modified: stable/12/sys/sys/seq.h ============================================================================== --- stable/12/sys/sys/seq.h Sat May 25 18:03:17 2019 (r348275) +++ stable/12/sys/sys/seq.h Sat May 25 18:23:32 2019 (r348276) @@ -121,7 +121,7 @@ seq_write_end(seq_t *seqp) } static __inline seq_t -seq_read(const seq_t *seqp) +seq_load(const seq_t *seqp) { seq_t ret; From owner-svn-src-stable@freebsd.org Sat May 25 18:36:40 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21CB815B3381; Sat, 25 May 2019 18:36:40 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BA05A847D4; Sat, 25 May 2019 18:36:39 +0000 (UTC) (envelope-from johalun@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 94CAB8328; Sat, 25 May 2019 18:36:39 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4PIade2013257; Sat, 25 May 2019 18:36:39 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4PIadKg013256; Sat, 25 May 2019 18:36:39 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201905251836.x4PIadKg013256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Sat, 25 May 2019 18:36:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348277 - in stable/12/sys: compat/linuxkpi/common/include/linux modules/linuxkpi X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: in stable/12/sys: compat/linuxkpi/common/include/linux modules/linuxkpi X-SVN-Commit-Revision: 348277 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BA05A847D4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.967,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 May 2019 18:36:40 -0000 Author: johalun Date: Sat May 25 18:36:38 2019 New Revision: 348277 URL: https://svnweb.freebsd.org/changeset/base/348277 Log: MFC r347892: LinuxKPI: Finalize import of seq_file. seq_file.h and linux_seq_file.c was imported form ports earlier but linux_seq_file.c was never compiled in with the module. With this commit base seq_file will replace ports seq_file and it required a few modifications to not break functionality and build. Reviewed by: hps Approved by: imp (mentor), hps Modified: stable/12/sys/compat/linuxkpi/common/include/linux/seq_file.h stable/12/sys/modules/linuxkpi/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/seq_file.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/seq_file.h Sat May 25 18:23:32 2019 (r348276) +++ stable/12/sys/compat/linuxkpi/common/include/linux/seq_file.h Sat May 25 18:36:38 2019 (r348277) @@ -30,13 +30,29 @@ #ifndef _LINUX_SEQ_FILE_H_ #define _LINUX_SEQ_FILE_H_ +#include +#include #include -struct seq_operations; -struct linux_file; - +#undef file #define inode vnode +#define DEFINE_SHOW_ATTRIBUTE(__name) \ +static int __name ## _open(struct inode *inode, struct linux_file *file) \ +{ \ + return single_open(file, __name ## _show, inode->i_private); \ +} \ + \ +static const struct file_operations __name ## _fops = { \ + .owner = THIS_MODULE, \ + .open = __name ## _open, \ + .read = seq_read, \ + .llseek = seq_lseek, \ + .release = single_release, \ +} + +struct seq_operations; + struct seq_file { struct sbuf *buf; @@ -67,5 +83,6 @@ int single_release(struct inode *, struct linux_file * #define seq_puts(m, str) sbuf_printf((m)->buf, str) #define seq_putc(m, str) sbuf_putc((m)->buf, str) +#define file linux_file #endif /* _LINUX_SEQ_FILE_H_ */ Modified: stable/12/sys/modules/linuxkpi/Makefile ============================================================================== --- stable/12/sys/modules/linuxkpi/Makefile Sat May 25 18:23:32 2019 (r348276) +++ stable/12/sys/modules/linuxkpi/Makefile Sat May 25 18:36:38 2019 (r348277) @@ -13,6 +13,7 @@ SRCS= linux_compat.c \ linux_pci.c \ linux_radix.c \ linux_rcu.c \ + linux_seq_file.c \ linux_schedule.c \ linux_slab.c \ linux_tasklet.c \ From owner-svn-src-stable@freebsd.org Sat May 25 20:00:00 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A821A15B4ED5; Sat, 25 May 2019 20:00:00 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4804786F8A; Sat, 25 May 2019 20:00:00 +0000 (UTC) (envelope-from johalun@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA46B90B1; Sat, 25 May 2019 19:59:59 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4PJxxbG055395; Sat, 25 May 2019 19:59:59 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4PJxx9I055394; Sat, 25 May 2019 19:59:59 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201905251959.x4PJxx9I055394@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Sat, 25 May 2019 19:59:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348278 - in stable/12/sys: libkern sys X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: in stable/12/sys: libkern sys X-SVN-Commit-Revision: 348278 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4804786F8A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.984,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 May 2019 20:00:00 -0000 Author: johalun Date: Sat May 25 19:59:59 2019 New Revision: 348278 URL: https://svnweb.freebsd.org/changeset/base/348278 Log: MFC r344384: Add non-sleepable strdup variant strdup_flags debugfs expects to do non-sleepable allocations Reviewed by: hps@ Sponsored by: iX Systems Differential Revision: https://reviews.freebsd.org/D19259 Modified: stable/12/sys/libkern/strdup.c stable/12/sys/sys/libkern.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/libkern/strdup.c ============================================================================== --- stable/12/sys/libkern/strdup.c Sat May 25 18:36:38 2019 (r348277) +++ stable/12/sys/libkern/strdup.c Sat May 25 19:59:59 2019 (r348278) @@ -40,13 +40,22 @@ __FBSDID("$FreeBSD$"); #include char * -strdup(const char *string, struct malloc_type *type) +strdup_flags(const char *string, struct malloc_type *type, int flags) { size_t len; char *copy; len = strlen(string) + 1; - copy = malloc(len, type, M_WAITOK); + copy = malloc(len, type, flags); + if (copy == NULL) + return (NULL); bcopy(string, copy, len); return (copy); +} + +char * +strdup(const char *string, struct malloc_type *type) +{ + + return (strdup_flags(string, type, M_WAITOK)); } Modified: stable/12/sys/sys/libkern.h ============================================================================== --- stable/12/sys/sys/libkern.h Sat May 25 18:36:38 2019 (r348277) +++ stable/12/sys/sys/libkern.h Sat May 25 19:59:59 2019 (r348278) @@ -173,6 +173,7 @@ char *strchr(const char *, int); int strcmp(const char *, const char *); char *strcpy(char * __restrict, const char * __restrict); size_t strcspn(const char * __restrict, const char * __restrict) __pure; +char *strdup_flags(const char *__restrict, struct malloc_type *, int); char *strdup(const char *__restrict, struct malloc_type *); char *strncat(char *, const char *, size_t); char *strndup(const char *__restrict, size_t, struct malloc_type *); From owner-svn-src-stable@freebsd.org Sat May 25 20:24:53 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3C01F15B5747; Sat, 25 May 2019 20:24:53 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CE4F788027; Sat, 25 May 2019 20:24:52 +0000 (UTC) (envelope-from johalun@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 995CC959C; Sat, 25 May 2019 20:24:52 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4PKOqDf071353; Sat, 25 May 2019 20:24:52 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4PKOqCC071351; Sat, 25 May 2019 20:24:52 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201905252024.x4PKOqCC071351@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Sat, 25 May 2019 20:24:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348279 - stable/12/sys/fs/pseudofs X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: stable/12/sys/fs/pseudofs X-SVN-Commit-Revision: 348279 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CE4F788027 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.985,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 May 2019 20:24:53 -0000 Author: johalun Date: Sat May 25 20:24:51 2019 New Revision: 348279 URL: https://svnweb.freebsd.org/changeset/base/348279 Log: MFC r344385: PFS: Bump NAMELEN and don't require clients to be sleepable - debugfs consumers expect to be able to export names more than 48 characters - debugfs consumers expect to be able to hold locks across calls and are able to handle allocation failures Reviewed by: hps@ Sponsored by: iX Systems Differential Revision: https://reviews.freebsd.org/D19256 Modified: stable/12/sys/fs/pseudofs/pseudofs.c stable/12/sys/fs/pseudofs/pseudofs.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/fs/pseudofs/pseudofs.c ============================================================================== --- stable/12/sys/fs/pseudofs/pseudofs.c Sat May 25 19:59:59 2019 (r348278) +++ stable/12/sys/fs/pseudofs/pseudofs.c Sat May 25 20:24:51 2019 (r348279) @@ -68,15 +68,20 @@ SYSCTL_INT(_vfs_pfs, OID_AUTO, trace, CTLFLAG_RW, &pfs * Allocate and initialize a node */ static struct pfs_node * -pfs_alloc_node(struct pfs_info *pi, const char *name, pfs_type_t type) +pfs_alloc_node_flags(struct pfs_info *pi, const char *name, pfs_type_t type, int flags) { struct pfs_node *pn; + int malloc_flags; KASSERT(strlen(name) < PFS_NAMELEN, ("%s(): node name is too long", __func__)); - - pn = malloc(sizeof *pn, - M_PFSNODES, M_WAITOK|M_ZERO); + if (flags & PFS_NOWAIT) + malloc_flags = M_NOWAIT | M_ZERO; + else + malloc_flags = M_WAITOK | M_ZERO; + pn = malloc(sizeof *pn, M_PFSNODES, malloc_flags); + if (pn == NULL) + return (NULL); mtx_init(&pn->pn_mutex, "pfs_node", NULL, MTX_DEF | MTX_DUPOK); strlcpy(pn->pn_name, name, sizeof pn->pn_name); pn->pn_type = type; @@ -84,6 +89,12 @@ pfs_alloc_node(struct pfs_info *pi, const char *name, return (pn); } +static struct pfs_node * +pfs_alloc_node(struct pfs_info *pi, const char *name, pfs_type_t type) +{ + return (pfs_alloc_node_flags(pi, name, type, 0)); +} + /* * Add a node to a directory */ @@ -160,15 +171,29 @@ pfs_detach_node(struct pfs_node *pn) /* * Add . and .. to a directory */ +static int +pfs_fixup_dir_flags(struct pfs_node *parent, int flags) +{ + struct pfs_node *dot, *dotdot; + + dot = pfs_alloc_node_flags(parent->pn_info, ".", pfstype_this, flags); + if (dot == NULL) + return (ENOMEM); + dotdot = pfs_alloc_node_flags(parent->pn_info, "..", pfstype_parent, flags); + if (dotdot == NULL) { + pfs_destroy(dot); + return (ENOMEM); + } + pfs_add_node(parent, dot); + pfs_add_node(parent, dotdot); + return (0); +} + static void pfs_fixup_dir(struct pfs_node *parent) { - struct pfs_node *pn; - pn = pfs_alloc_node(parent->pn_info, ".", pfstype_this); - pfs_add_node(parent, pn); - pn = pfs_alloc_node(parent->pn_info, "..", pfstype_parent); - pfs_add_node(parent, pn); + pfs_fixup_dir_flags(parent, 0); } /* @@ -180,16 +205,22 @@ pfs_create_dir(struct pfs_node *parent, const char *na int flags) { struct pfs_node *pn; + int rc; - pn = pfs_alloc_node(parent->pn_info, name, - (flags & PFS_PROCDEP) ? pfstype_procdir : pfstype_dir); + pn = pfs_alloc_node_flags(parent->pn_info, name, + (flags & PFS_PROCDEP) ? pfstype_procdir : pfstype_dir, flags); + if (pn == NULL) + return (NULL); pn->pn_attr = attr; pn->pn_vis = vis; pn->pn_destroy = destroy; pn->pn_flags = flags; pfs_add_node(parent, pn); - pfs_fixup_dir(pn); - + rc = pfs_fixup_dir_flags(pn, flags); + if (rc) { + pfs_destroy(pn); + return (NULL); + } return (pn); } @@ -203,7 +234,9 @@ pfs_create_file(struct pfs_node *parent, const char *n { struct pfs_node *pn; - pn = pfs_alloc_node(parent->pn_info, name, pfstype_file); + pn = pfs_alloc_node_flags(parent->pn_info, name, pfstype_file, flags); + if (pn == NULL) + return (NULL); pn->pn_fill = fill; pn->pn_attr = attr; pn->pn_vis = vis; @@ -224,7 +257,9 @@ pfs_create_link(struct pfs_node *parent, const char *n { struct pfs_node *pn; - pn = pfs_alloc_node(parent->pn_info, name, pfstype_symlink); + pn = pfs_alloc_node_flags(parent->pn_info, name, pfstype_symlink, flags); + if (pn == NULL) + return (NULL); pn->pn_fill = fill; pn->pn_attr = attr; pn->pn_vis = vis; Modified: stable/12/sys/fs/pseudofs/pseudofs.h ============================================================================== --- stable/12/sys/fs/pseudofs/pseudofs.h Sat May 25 19:59:59 2019 (r348278) +++ stable/12/sys/fs/pseudofs/pseudofs.h Sat May 25 20:24:51 2019 (r348279) @@ -52,7 +52,7 @@ struct vnode; /* * Limits and constants */ -#define PFS_NAMELEN 48 +#define PFS_NAMELEN 128 #define PFS_FSNAMELEN 16 /* equal to MFSNAMELEN */ #define PFS_DELEN (offsetof(struct dirent, d_name) + PFS_NAMELEN) @@ -77,6 +77,7 @@ typedef enum { #define PFS_RAWWR 0x0008 /* raw writer */ #define PFS_RAW (PFS_RAWRD|PFS_RAWWR) #define PFS_PROCDEP 0x0010 /* process-dependent */ +#define PFS_NOWAIT 0x0020 /* allow malloc to fail */ /* * Data structures From owner-svn-src-stable@freebsd.org Sat May 25 20:53:25 2019 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3607C15B60C5; Sat, 25 May 2019 20:53:25 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CBC5A88F6D; Sat, 25 May 2019 20:53:24 +0000 (UTC) (envelope-from johalun@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8DA8C9AA6; Sat, 25 May 2019 20:53:24 +0000 (UTC) (envelope-from johalun@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x4PKrOlt087743; Sat, 25 May 2019 20:53:24 GMT (envelope-from johalun@FreeBSD.org) Received: (from johalun@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x4PKrOB0087741; Sat, 25 May 2019 20:53:24 GMT (envelope-from johalun@FreeBSD.org) Message-Id: <201905252053.x4PKrOB0087741@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: johalun set sender to johalun@FreeBSD.org using -f From: Johannes Lundberg Date: Sat, 25 May 2019 20:53:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r348280 - in stable/12/sys: compat/linuxkpi/common/include/linux modules/linuxkpi X-SVN-Group: stable-12 X-SVN-Commit-Author: johalun X-SVN-Commit-Paths: in stable/12/sys: compat/linuxkpi/common/include/linux modules/linuxkpi X-SVN-Commit-Revision: 348280 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CBC5A88F6D X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.984,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 May 2019 20:53:25 -0000 Author: johalun Date: Sat May 25 20:53:23 2019 New Revision: 348280 URL: https://svnweb.freebsd.org/changeset/base/348280 Log: LinuxKPI: Revert MFC of r347892 Revert until we can figure out how to keep compatibility with drm-kmod ports between 12.0 and 12-STABLE/12.1. Modified: stable/12/sys/compat/linuxkpi/common/include/linux/seq_file.h stable/12/sys/modules/linuxkpi/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/seq_file.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/seq_file.h Sat May 25 20:24:51 2019 (r348279) +++ stable/12/sys/compat/linuxkpi/common/include/linux/seq_file.h Sat May 25 20:53:23 2019 (r348280) @@ -30,29 +30,13 @@ #ifndef _LINUX_SEQ_FILE_H_ #define _LINUX_SEQ_FILE_H_ -#include -#include #include -#undef file -#define inode vnode - -#define DEFINE_SHOW_ATTRIBUTE(__name) \ -static int __name ## _open(struct inode *inode, struct linux_file *file) \ -{ \ - return single_open(file, __name ## _show, inode->i_private); \ -} \ - \ -static const struct file_operations __name ## _fops = { \ - .owner = THIS_MODULE, \ - .open = __name ## _open, \ - .read = seq_read, \ - .llseek = seq_lseek, \ - .release = single_release, \ -} - struct seq_operations; +struct linux_file; +#define inode vnode + struct seq_file { struct sbuf *buf; @@ -83,6 +67,5 @@ int single_release(struct inode *, struct linux_file * #define seq_puts(m, str) sbuf_printf((m)->buf, str) #define seq_putc(m, str) sbuf_putc((m)->buf, str) -#define file linux_file #endif /* _LINUX_SEQ_FILE_H_ */ Modified: stable/12/sys/modules/linuxkpi/Makefile ============================================================================== --- stable/12/sys/modules/linuxkpi/Makefile Sat May 25 20:24:51 2019 (r348279) +++ stable/12/sys/modules/linuxkpi/Makefile Sat May 25 20:53:23 2019 (r348280) @@ -13,7 +13,6 @@ SRCS= linux_compat.c \ linux_pci.c \ linux_radix.c \ linux_rcu.c \ - linux_seq_file.c \ linux_schedule.c \ linux_slab.c \ linux_tasklet.c \