From owner-svn-src-head@freebsd.org Sun Mar 17 04:33:18 2019 Return-Path: Delivered-To: svn-src-head@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 C775F154BC53; Sun, 17 Mar 2019 04:33:18 +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 6032A8C4C7; Sun, 17 Mar 2019 04:33:18 +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 4B5A14C49; Sun, 17 Mar 2019 04:33:18 +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 x2H4XITW091525; Sun, 17 Mar 2019 04:33:18 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2H4XIYa091524; Sun, 17 Mar 2019 04:33:18 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201903170433.x2H4XIYa091524@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 17 Mar 2019 04:33:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345239 - head/sys/dev/fdt X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/dev/fdt X-SVN-Commit-Revision: 345239 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6032A8C4C7 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.998,0]; NEURAL_HAM_SHORT(-0.94)[-0.945,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2019 04:33:19 -0000 Author: jhibbits Date: Sun Mar 17 04:33:17 2019 New Revision: 345239 URL: https://svnweb.freebsd.org/changeset/base/345239 Log: fdt: Explicitly mark fdt_slicer as dependent on geom_flashmap Without this dependency relationship, the linker doesn't find the flash_register_slicer() function, so kldload fails to load fdt_slicer.ko. Discussed with: ian@ Modified: head/sys/dev/fdt/fdt_slicer.c Modified: head/sys/dev/fdt/fdt_slicer.c ============================================================================== --- head/sys/dev/fdt/fdt_slicer.c Sat Mar 16 20:02:57 2019 (r345238) +++ head/sys/dev/fdt/fdt_slicer.c Sun Mar 17 04:33:17 2019 (r345239) @@ -182,4 +182,5 @@ static moduledata_t fdt_slicer_mod = { }; DECLARE_MODULE(fdt_slicer, fdt_slicer_mod, SI_SUB_DRIVERS, SI_ORDER_SECOND); +MODULE_DEPEND(fdt_slicer, g_flashmap, 0, 0, 0); MODULE_VERSION(fdt_slicer, 1); From owner-svn-src-head@freebsd.org Sun Mar 17 09:31:10 2019 Return-Path: Delivered-To: svn-src-head@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 7171015301E0; Sun, 17 Mar 2019 09:31:10 +0000 (UTC) (envelope-from bz@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 12E1E6F0B5; Sun, 17 Mar 2019 09:31:10 +0000 (UTC) (envelope-from bz@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 08BD17DAC; Sun, 17 Mar 2019 09:31:10 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2H9V9do045298; Sun, 17 Mar 2019 09:31:09 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2H9V96d045297; Sun, 17 Mar 2019 09:31:09 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201903170931.x2H9V96d045297@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sun, 17 Mar 2019 09:31:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345241 - head/libexec/rc X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/libexec/rc X-SVN-Commit-Revision: 345241 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 12E1E6F0B5 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_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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2019 09:31:10 -0000 Author: bz Date: Sun Mar 17 09:31:09 2019 New Revision: 345241 URL: https://svnweb.freebsd.org/changeset/base/345241 Log: Fix legacy IP autoconfiguration. It seems my subconcious plan in r345088 to not only prefer IPv6 autoconf but to also slowly deteriorate legacy IP auto-configuration was uncovered way too early. In case IPv6 is a thing yet ipv6_autoconfif was not true, we would not bring up the interface yet tell the follow-up DHCPv4 configuration in ifconfig_up() that we did. So unless you were doing SYNCDHCP or IPv6 you would not get legacy-IP DHCPv4 configuration. I see multiple problems here: (a) people not yet using IPv6 (obviously a problem), and (b) the dhclient startup script not running dhclient in that case despite configured to do so (needs to be investigated seperately). Reported by: Pawel Biernacki (pawel.biernacki gmail.com) Tested by: Pawel Biernacki Differential Revision: https://reviews.freebsd.org/D19488 Pointyhat to: bz (not sure if it is for breaking or for letting them notice it so easily) Modified: head/libexec/rc/network.subr Modified: head/libexec/rc/network.subr ============================================================================== --- head/libexec/rc/network.subr Sun Mar 17 06:05:19 2019 (r345240) +++ head/libexec/rc/network.subr Sun Mar 17 09:31:09 2019 (r345241) @@ -230,8 +230,7 @@ ifconfig_up() fi if ! noafif $1 && afexists inet6; then - ipv6_accept_rtadv_up $1 - _cfg=0 + ipv6_accept_rtadv_up $1 && _cfg=0 fi if dhcpif $1; then @@ -1205,7 +1204,9 @@ ipv6_accept_rtadv_up() if [ -x /sbin/rtsol ]; then /sbin/rtsol ${rtsol_flags} $1 fi + return 0 fi + return 1 } # ipv6_accept_rtadv_down if From owner-svn-src-head@freebsd.org Sun Mar 17 11:27:28 2019 Return-Path: Delivered-To: svn-src-head@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 12EFF1535AA4; Sun, 17 Mar 2019 11:27:28 +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 9EC76731A2; Sun, 17 Mar 2019 11:27:27 +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 94C7E9246; Sun, 17 Mar 2019 11:27:27 +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 x2HBRRHP006728; Sun, 17 Mar 2019 11:27:27 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2HBRRcs006727; Sun, 17 Mar 2019 11:27:27 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201903171127.x2HBRRcs006727@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 17 Mar 2019 11:27:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345242 - head/lib/libomp X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/lib/libomp X-SVN-Commit-Revision: 345242 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9EC76731A2 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.947,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2019 11:27:28 -0000 Author: dim Date: Sun Mar 17 11:27:27 2019 New Revision: 345242 URL: https://svnweb.freebsd.org/changeset/base/345242 Log: Explicitly link libomp.so against -lpthread, as it depends on pthread functionality. This should make example OpenMP programs work out of the box. Reported by: jbeich PR: 236062, 236581 MFC after: 1 month X-MFC-With: r344779 Modified: head/lib/libomp/Makefile Modified: head/lib/libomp/Makefile ============================================================================== --- head/lib/libomp/Makefile Sun Mar 17 09:31:09 2019 (r345241) +++ head/lib/libomp/Makefile Sun Mar 17 11:27:27 2019 (r345242) @@ -66,4 +66,6 @@ LDFLAGS+= -Wl,-soname,libomp.so VERSION_MAP= ${OMPSRC}/exports_so.txt +LIBADD+= pthread + .include From owner-svn-src-head@freebsd.org Sun Mar 17 15:02:30 2019 Return-Path: Delivered-To: svn-src-head@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 7B211153E27D; Sun, 17 Mar 2019 15:02:30 +0000 (UTC) (envelope-from wschnr@googlemail.com) Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F1C438381F; Sun, 17 Mar 2019 15:02:29 +0000 (UTC) (envelope-from wschnr@googlemail.com) Received: by mail-wm1-f54.google.com with SMTP id z6so340205wmi.0; Sun, 17 Mar 2019 08:02:29 -0700 (PDT) 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=PkTfOthMDm/7b+oztWXOpETLCaQvWpOeGb6xfZUUz0E=; b=fpY6xPfd99Y/3d1yIt0SgpDflCph8G2BK+sCMiJfRnTeqyYFF0yAS5B+TEYs9zQDcR Ezx712GDHr4mZb7awLNMXlpAoYBW2wkWclz0bth0g6miI+jEhVqZZ426/E8MG5Q1Ox+Q MZzgKEcLzuNpQPqpnxFimxkjMljTliOJGlXvSsaafZGeZ38asaYNCxEsvnyBhsXvnMM3 snDWSRguYqLFw0Id+5eNXnyrOp6RobizagCoHC5IBPmmlGnzCHHBgLTt7qqkka9981Pf vdgiuXx9fXZ5eMqvACwBsSFN0EySPL44RWlFy2wH2vOs9g85bjkn0hqafz6nD983rW4k jh4Q== X-Gm-Message-State: APjAAAUat+8DQjTmdzfR6PNEbVmzeABfL0BopzwLNzK6p/HpF2p7TOdj xOq7seVgx7vcGzowcLWBZ8Gfcd2ExXt+rhi169rVs7LS X-Google-Smtp-Source: APXvYqx1Bm7EQ7l/g/Rgew3CK3h784xRrAaQSjaycRLhE7ubuLTo/DH0VfESjYT0OTLw3GrbAGa3whhPAAxQObGDj14= X-Received: by 2002:a1c:99c2:: with SMTP id b185mr7485360wme.149.1552815150852; Sun, 17 Mar 2019 02:32:30 -0700 (PDT) MIME-Version: 1.0 References: <201903162002.x2GK2vmA013275@repo.freebsd.org> <0ea3a53f64016afa9dbc6f1b2d2ee25f09df00b8.camel@freebsd.org> In-Reply-To: <0ea3a53f64016afa9dbc6f1b2d2ee25f09df00b8.camel@freebsd.org> From: Wolfram Schneider Date: Sun, 17 Mar 2019 10:32:20 +0100 Message-ID: Subject: Re: svn commit: r345238 - head To: Ian Lepore , Wolfram Schneider Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: F1C438381F X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.92 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.92)[-0.923,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2019 15:02:30 -0000 On Sat, 16 Mar 2019 at 23:37, Ian Lepore wrote: > > On Sat, 2019-03-16 at 20:02 +0000, Wolfram Schneider wrote: > > Author: wosch > > Date: Sat Mar 16 20:02:57 2019 > > New Revision: 345238 > > URL: https://svnweb.freebsd.org/changeset/base/345238 > > > > Log: > > `make buildkernel' should display the build time in seconds > > > > PR: 224433 > > Approved by: cem > > Differential Revision: https://reviews.freebsd.org/D13910 > > > > Modified: > > head/Makefile.inc1 > > > > Modified: head/Makefile.inc1 > > ===================================================================== > > ========= > > --- head/Makefile.inc1 Sat Mar 16 17:55:22 2019 (r345237) > > +++ head/Makefile.inc1 Sat Mar 16 20:02:57 2019 (r345238) > > @@ -1584,6 +1584,11 @@ _cleankernobj_fast_depend_hack: .PHONY > > > > ${WMAKE_TGTS:N_worldtmp:Nbuild${libcompat}} > > ${.ALLTARGETS:M_*:N_worldtmp}: .MAKE .PHONY > > > > +# record kernel(s) build time in seconds > > +.if make(buildkernel) > > +_BUILDKERNEL_START!= date '+%s' > > +.endif > > + > > # > > # buildkernel > > # > > @@ -1640,7 +1645,12 @@ buildkernel: .MAKE .PHONY > > @echo "------------------------------------------------------ > > --------" > > @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C > > date`" > > @echo "------------------------------------------------------ > > --------" > > + > > .endfor > > + @seconds=$$(($$(date '+%s') - ${_BUILDKERNEL_START})); \ > > + echo -n ">>> Kernel(s) build for${BUILDKERNELS} in $$seconds > > seconds, "; \ > > + echo "ncpu: $$(sysctl -n hw.ncpu)${.MAKE.JOBS:S/^/, make > > -j/}" > > + @echo "------------------------------------------------------ > > --------" > > > > NO_INSTALLEXTRAKERNELS?= yes > > > > > > Does this really report the buildkernel time, or the time from when > make starts until when the kernel portion of the make finishes? Will > the result be right when you do "make buildworld buildkernel"? Good point, I didn't checked this yet. The handbook at https://www.freebsd.org/doc/handbook/makeworld.html recommends to run buildworld and buildkernel in 2 steps: make -j4 buildworld ; make -j4 kernel PS: it seems to work fine. The time will be recorded when the make target is called, not when make is called. $ grep ncpu build.log >>> World build in 2004 seconds, ncpu: 32, make -j33 >>> Kernel(s) build for GENERIC in 138 seconds, ncpu: 32, make -j33 -Wolfram -- Wolfram Schneider https://wolfram.schneider.org From owner-svn-src-head@freebsd.org Sun Mar 17 17:05:12 2019 Return-Path: Delivered-To: svn-src-head@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 CFA221543538 for ; Sun, 17 Mar 2019 17:05:12 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1.eu.mailhop.org (outbound1.eu.mailhop.org [52.28.251.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4581F87B92 for ; Sun, 17 Mar 2019 17:05:12 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1552842308; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=G8KIsd19kvp/l6zsCg0pcAnS0O9QQ229qqfvUN9yEuBAHDCVhQ62wVtIGOoUtm6t8ytF5kQK2OBOt zYk2Z1q8ZdmyzKXDN1yZydbZmnnRQityPXIW5RfZiAjqCg0nuWCGPW3oDZ/klMvkh4iYq4k010g1rD kOvkCfyGvazbalq4KvhkCzpNbechYNz/oHkDOgDR7KGOhdomgfqdnN6Wh+ogYeLEST3M14hsVCrTWh MAFCAlE3Pn7qmPZeaQNXAcU7VxdoD3bOE7ZZFTQ+PthnaOAaldpeVm47qll7aOe7sZlz82UWMAvChC iOUuSQygx+7Lt7EZ/ZbdDVAEknpp22g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=0z1LFyENhbnaxRv1AY4726QDg4uJqiGEfcSjFVF9K10=; b=emdsEBEVdTO+LG2X8951ny1koE+rCvufAkZHLz7z3DOqKt9xMQAqLY4q9Z5eHnQmL4AgXxq3o3HBW FwLeQ4N44efzSlcutau9BcBtD8oMlNf3Tve4J3RrCBY+JSLA3jvkvAVnj8BBIT2R/V7H9ckpDkYCvo S/VHhuPTn36D838YmhSN/HxFpENPcleqtDYdKjMMsyk6VF6SyE85z6yQULfCd2BtvQEj/0x2++x48+ 2YFuGkKIALYY3bF6g3BbFR/PomissuCmc+0iwxgF06gdw3q8kumEcsYud2ON83cwige3uxY03OsqjR NRuZCHeh91nnGORcsPxsWUwrGx/UA0A== ARC-Authentication-Results: i=1; outbound3.eu.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=0z1LFyENhbnaxRv1AY4726QDg4uJqiGEfcSjFVF9K10=; b=VxK7Ul++fs236F+Itw8hJ/ulBiwqFbtooYXw7qne4RPRm2flPPVFo0MhaCaMfmBPuqoEQPNJWbsKq 7fT4Mwt7tXHJisqgyOxKq1ve/Bhf5U+VXlrCKyK4yxgy9xJlYzpEf8E6mZUk7+x1hP4IF0iC2TSTU8 yyPFR6T8JMR5wdtaMjYhNDSCNeFTXl+rInMo3LiZR/5SmaUiWqEsmeXkpbF10zR/cisMtQadoLfat/ i87Lti8jiJqCmEtLlJy2iWO1GzrB2PRWQEFEBzxLKTVIC048KseapE4opPWxCDjA+fI7RupdF3gEg2 pkrcfF180t3svfPmvLya7VijT0gNwlw== X-MHO-RoutePath: aGlwcGll X-MHO-User: cf59b65b-48d6-11e9-908b-352056dbf2de X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.eu.mailhop.org (Halon) with ESMTPSA id cf59b65b-48d6-11e9-908b-352056dbf2de; Sun, 17 Mar 2019 17:05:06 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x2HH544o059783; Sun, 17 Mar 2019 11:05:04 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <69b2f7e10f7cc3db29432e6bf90214e2f297312d.camel@freebsd.org> Subject: Re: svn commit: r345238 - head From: Ian Lepore To: Wolfram Schneider Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Sun, 17 Mar 2019 11:05:04 -0600 In-Reply-To: References: <201903162002.x2GK2vmA013275@repo.freebsd.org> <0ea3a53f64016afa9dbc6f1b2d2ee25f09df00b8.camel@freebsd.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4581F87B92 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.99 / 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.99)[-0.989,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2019 17:05:13 -0000 On Sun, 2019-03-17 at 10:32 +0100, Wolfram Schneider wrote: > On Sat, 16 Mar 2019 at 23:37, Ian Lepore wrote: > > > > On Sat, 2019-03-16 at 20:02 +0000, Wolfram Schneider wrote: > > > Author: wosch > > > Date: Sat Mar 16 20:02:57 2019 > > > New Revision: 345238 > > > URL: https://svnweb.freebsd.org/changeset/base/345238 > > > > > > Log: > > > `make buildkernel' should display the build time in seconds > > > > > > PR: 224433 > > > Approved by: cem > > > Differential Revision: https://reviews.freebsd.org/D13910 > > > > > > Modified: > > > head/Makefile.inc1 > > > > > > Modified: head/Makefile.inc1 > > > ================================================================= > > > CMSG==== > > > ========= > > > --- head/Makefile.inc1 Sat Mar 16 17:55:22 > > > 2019 (r345237) > > > +++ head/Makefile.inc1 Sat Mar 16 20:02:57 > > > 2019 (r345238) > > > @@ -1584,6 +1584,11 @@ _cleankernobj_fast_depend_hack: .PHONY > > > > > > ${WMAKE_TGTS:N_worldtmp:Nbuild${libcompat}} > > > ${.ALLTARGETS:M_*:N_worldtmp}: .MAKE .PHONY > > > > > > +# record kernel(s) build time in seconds > > > +.if make(buildkernel) > > > +_BUILDKERNEL_START!= date '+%s' > > > +.endif > > > + > > > # > > > # buildkernel > > > # > > > @@ -1640,7 +1645,12 @@ buildkernel: .MAKE .PHONY > > > @echo "-------------------------------------------------- > > > ---- > > > --------" > > > @echo ">>> Kernel build for ${_kernel} completed on > > > `LC_ALL=C > > > date`" > > > @echo "-------------------------------------------------- > > > ---- > > > --------" > > > + > > > .endfor > > > + @seconds=$$(($$(date '+%s') - ${_BUILDKERNEL_START})); \ > > > + echo -n ">>> Kernel(s) build for${BUILDKERNELS} in > > > $$seconds > > > seconds, "; \ > > > + echo "ncpu: $$(sysctl -n hw.ncpu)${.MAKE.JOBS:S/^/, make > > > -j/}" > > > + @echo "-------------------------------------------------- > > > ---- > > > --------" > > > > > > NO_INSTALLEXTRAKERNELS?= yes > > > > > > > > > > Does this really report the buildkernel time, or the time from when > > make starts until when the kernel portion of the make > > finishes? Will > > the result be right when you do "make buildworld buildkernel"? > > Good point, I didn't checked this yet. The handbook at > https://www.freebsd.org/doc/handbook/makeworld.html > > recommends to run buildworld and buildkernel in 2 steps: > > make -j4 buildworld ; make -j4 kernel > > > > PS: it seems to work fine. The time will be recorded when the make > target is called, not when make is called. > _BUILDKERNEL_START will be set to the time when the makefile is parsed, before any target is run. My questions were basically rhetorical; what you've done is make it report the time from when make is launched until when various targets complete, and each report will include the cumulative time of any targets that ran before that point. If the goal is to time the entire run of make (which is effectively what this is doing), then that is probably best addressed with .BEGIN and .END targets in Makefile, rather than multiple duplicated entries in Makefile.inc1. -- Ian > $ grep ncpu build.log > > > > World build in 2004 seconds, ncpu: 32, make -j33 > > > > Kernel(s) build for GENERIC in 138 seconds, ncpu: 32, make -j33 > > -Wolfram > From owner-svn-src-head@freebsd.org Sun Mar 17 17:34:08 2019 Return-Path: Delivered-To: svn-src-head@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 ECD9D154473E; Sun, 17 Mar 2019 17:34:07 +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 8C49688E5D; Sun, 17 Mar 2019 17:34:07 +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 67FE7D37D; Sun, 17 Mar 2019 17:34:07 +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 x2HHY71h004908; Sun, 17 Mar 2019 17:34:07 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2HHY6FM004905; Sun, 17 Mar 2019 17:34:06 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201903171734.x2HHY6FM004905@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 17 Mar 2019 17:34:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345244 - head/sys/ufs/ufs X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/ufs/ufs X-SVN-Commit-Revision: 345244 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8C49688E5D 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.963,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2019 17:34:08 -0000 Author: markj Date: Sun Mar 17 17:34:06 2019 New Revision: 345244 URL: https://svnweb.freebsd.org/changeset/base/345244 Log: Optimize lseek(SEEK_DATA) on UFS. The old implementation, at the VFS layer, would map the entire range of logical blocks between the starting offset and the first data block following that offset. With large sparse files this is very inefficient. The VFS currently doesn't provide an interface to improve upon the current implementation in a generic way. Add ufs_bmap_seekdata(), which uses the obvious algorithm of scanning indirect blocks to look for data blocks. Use it instead of vn_bmap_seekhole() to implement SEEK_DATA. Reviewed by: kib, mckusick MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D19598 Modified: head/sys/ufs/ufs/ufs_bmap.c head/sys/ufs/ufs/ufs_extern.h head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/ufs/ufs/ufs_bmap.c ============================================================================== --- head/sys/ufs/ufs/ufs_bmap.c Sun Mar 17 13:02:24 2019 (r345243) +++ head/sys/ufs/ufs/ufs_bmap.c Sun Mar 17 17:34:06 2019 (r345244) @@ -90,6 +90,51 @@ ufs_bmap(ap) return (error); } +static int +ufs_readindir(vp, lbn, daddr, bpp) + struct vnode *vp; + ufs_lbn_t lbn; + ufs2_daddr_t daddr; + struct buf **bpp; +{ + struct buf *bp; + struct mount *mp; + struct ufsmount *ump; + int error; + + mp = vp->v_mount; + ump = VFSTOUFS(mp); + + bp = getblk(vp, lbn, mp->mnt_stat.f_iosize, 0, 0, 0); + if ((bp->b_flags & B_CACHE) == 0) { + KASSERT(daddr != 0, + ("ufs_readindir: indirect block not in cache")); + + bp->b_blkno = blkptrtodb(ump, daddr); + bp->b_iocmd = BIO_READ; + bp->b_flags &= ~B_INVAL; + bp->b_ioflags &= ~BIO_ERROR; + vfs_busy_pages(bp, 0); + bp->b_iooffset = dbtob(bp->b_blkno); + bstrategy(bp); +#ifdef RACCT + if (racct_enable) { + PROC_LOCK(curproc); + racct_add_buf(curproc, bp, 0); + PROC_UNLOCK(curproc); + } +#endif + curthread->td_ru.ru_inblock++; + error = bufwait(bp); + if (error != 0) { + brelse(bp); + return (error); + } + } + *bpp = bp; + return (0); +} + /* * Indirect blocks are now on the vnode for the file. They are given negative * logical block numbers. Indirect blocks are addressed by the negative @@ -212,35 +257,10 @@ ufs_bmaparray(vp, bn, bnp, nbp, runp, runb) */ if (bp) bqrelse(bp); + error = ufs_readindir(vp, metalbn, daddr, &bp); + if (error != 0) + return (error); - bp = getblk(vp, metalbn, mp->mnt_stat.f_iosize, 0, 0, 0); - if ((bp->b_flags & B_CACHE) == 0) { -#ifdef INVARIANTS - if (!daddr) - panic("ufs_bmaparray: indirect block not in cache"); -#endif - bp->b_blkno = blkptrtodb(ump, daddr); - bp->b_iocmd = BIO_READ; - bp->b_flags &= ~B_INVAL; - bp->b_ioflags &= ~BIO_ERROR; - vfs_busy_pages(bp, 0); - bp->b_iooffset = dbtob(bp->b_blkno); - bstrategy(bp); -#ifdef RACCT - if (racct_enable) { - PROC_LOCK(curproc); - racct_add_buf(curproc, bp, 0); - PROC_UNLOCK(curproc); - } -#endif /* RACCT */ - curthread->td_ru.ru_inblock++; - error = bufwait(bp); - if (error) { - brelse(bp); - return (error); - } - } - if (I_IS_UFS1(ip)) { daddr = ((ufs1_daddr_t *)bp->b_data)[ap->in_off]; if (num == 1 && daddr && runp) { @@ -301,6 +321,93 @@ ufs_bmaparray(vp, bn, bnp, nbp, runp, runb) *bnp = -1; } return (0); +} + +int +ufs_bmap_seekdata(vp, offp) + struct vnode *vp; + off_t *offp; +{ + struct buf *bp; + struct indir a[UFS_NIADDR + 1], *ap; + struct inode *ip; + struct mount *mp; + struct ufsmount *ump; + ufs2_daddr_t blockcnt, bn, daddr; + uint64_t bsize; + off_t numblks; + int error, num, num1; + + bp = NULL; + ip = VTOI(vp); + mp = vp->v_mount; + ump = VFSTOUFS(mp); + + if (vp->v_type != VREG || (ip->i_flags & SF_SNAPSHOT) != 0) + return (EINVAL); + if (*offp < 0) + return (ENXIO); + + bsize = mp->mnt_stat.f_iosize; + for (bn = *offp / bsize, numblks = howmany(ip->i_size, bsize); + bn < numblks;) { + if (bn < UFS_NDADDR) { + daddr = DIP(ip, i_db[bn]); + if (daddr != 0) + break; + bn++; + continue; + } + + ap = a; + error = ufs_getlbns(vp, bn, ap, &num); + if (error != 0) + break; + MPASS(num >= 2); + daddr = DIP(ip, i_ib[ap->in_off]); + ap++, num--; + if (daddr == 0) { + for (blockcnt = 1; num > 0; num--) + blockcnt *= MNINDIR(ump); + bn += blockcnt; + continue; + } + + for (; num > 0 && daddr != 0; ap++, num--) { + if (bp != NULL) + bqrelse(bp); + error = ufs_readindir(vp, ap->in_lbn, daddr, &bp); + if (error != 0) + return (error); + + /* + * Precompute the number of blocks addressed by an entry + * of the current indirect block. + */ + for (blockcnt = 1, num1 = num; num1 > 1; num1--) + blockcnt *= MNINDIR(ump); + + for (; ap->in_off < MNINDIR(ump); ap->in_off++, + bn += blockcnt) { + daddr = I_IS_UFS1(ip) ? + ((ufs1_daddr_t *)bp->b_data)[ap->in_off] : + ((ufs2_daddr_t *)bp->b_data)[ap->in_off]; + if (daddr != 0) + break; + } + } + if (daddr != 0) { + MPASS(num == 0); + break; + } + } + if (bp != NULL) + bqrelse(bp); + if (bn >= numblks) + error = ENXIO; + if (error == 0) + *offp = bn * bsize; + return (error); } /* Modified: head/sys/ufs/ufs/ufs_extern.h ============================================================================== --- head/sys/ufs/ufs/ufs_extern.h Sun Mar 17 13:02:24 2019 (r345243) +++ head/sys/ufs/ufs/ufs_extern.h Sun Mar 17 17:34:06 2019 (r345244) @@ -58,6 +58,7 @@ extern struct vop_vector ufs_vnodeops; int ufs_bmap(struct vop_bmap_args *); int ufs_bmaparray(struct vnode *, ufs2_daddr_t, ufs2_daddr_t *, struct buf *, int *, int *); +int ufs_bmap_seekdata(struct vnode *, off_t *); int ufs_fhtovp(struct mount *, struct ufid *, int, struct vnode **); int ufs_checkpath(ino_t, ino_t, struct inode *, struct ucred *, ino_t *); void ufs_dirbad(struct inode *, doff_t, char *); Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Sun Mar 17 13:02:24 2019 (r345243) +++ head/sys/ufs/ufs/ufs_vnops.c Sun Mar 17 17:34:06 2019 (r345244) @@ -2701,12 +2701,15 @@ bad: static int ufs_ioctl(struct vop_ioctl_args *ap) { + struct vnode *vp; + vp = ap->a_vp; switch (ap->a_command) { case FIOSEEKDATA: + return (ufs_bmap_seekdata(vp, (off_t *)ap->a_data)); case FIOSEEKHOLE: - return (vn_bmap_seekhole(ap->a_vp, ap->a_command, - (off_t *)ap->a_data, ap->a_cred)); + return (vn_bmap_seekhole(vp, ap->a_command, (off_t *)ap->a_data, + ap->a_cred)); default: return (ENOTTY); } From owner-svn-src-head@freebsd.org Sun Mar 17 17:59:06 2019 Return-Path: Delivered-To: svn-src-head@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 E49051545187; Sun, 17 Mar 2019 17:59:05 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-it1-x130.google.com (mail-it1-x130.google.com [IPv6:2607:f8b0:4864:20::130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 770B889BE0; Sun, 17 Mar 2019 17:59:05 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-it1-x130.google.com with SMTP id f186so14777079ita.0; Sun, 17 Mar 2019 10:59:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=78ioTPPr7qLPyAmHW45dMpxh3qXdXujQ+/5xkwJRcm4=; b=lL50oau6A9/T2c5EY0ijJo1mof/jw+Pap+QOC710dqw3wlWtzT5yN5U2ALboiAyjfs kVeymyEI1oCY9/SgpnY6SrVlvhKlYfBkqI5OTVbC3uk334Cd0tyN43nfxYPZtFusm5Cl 0soqF2eimk1FV7dC0T9GkstGmkdJAkFc9KXSVHQJV0rmHACbxSFrhRhQQhuMb8nML3cT P09XKnjTaWCcPB/fAWjvtjeyLc7Bf1j00Ns1BDWlBJHue9AX1RFdbNbZAxw5BwlzpVXo THnf3H7wlgEAyIPivJTqbjwvrYw4w4ZgBY4sebBIx4x+qOastuPuWgY0n1lL8it4oE2X 23vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=78ioTPPr7qLPyAmHW45dMpxh3qXdXujQ+/5xkwJRcm4=; b=eqZM3O6L5iZ2oMiLl7NoXlHlBbzBeK5BMVZ2rMcNRx9ZsYdxTPf3+Nq69fR2p/5tPV 8rSyasBl8oQR1o4SGHp6j4560eqM5eFfNWAEd0tfIFnTnyBOTqwkLWeCj5CFfWfwoeRb nsS/l54YcqQxXZri8tYLSWqIgivDC4aAX1H7UmwvJgW/+wdAX4/0n40p7u8Xz3r5cWBp 0Mxa2wskn8agUCi+bP7BZVHnXF9AmAQQKcHJqVaDm3E0sSiplOs7VMJd7zByfCS68xdh H8yBeEQQydahMMRV+R8Qdpw+OPgvG5EnTg5BFgNtQF1ilRVCpitdi57e9CVboQ6ncQ6D /sWQ== X-Gm-Message-State: APjAAAWuv/V9NZXXMtSM+YzxSHNWpLu8wVyvOwoOxzon1/oo1U1X/yLO OWDAZp1csaBdKnm/+imiEOY8jbtx X-Google-Smtp-Source: APXvYqzK3JkSiu32zYlGfsEVV5OUWcTsMGQAayssUMnofLbscOYzBr0T13ujdwWED/KrfPd+74oLtw== X-Received: by 2002:a02:700f:: with SMTP id f15mr6057011jac.139.1552845544295; Sun, 17 Mar 2019 10:59:04 -0700 (PDT) Received: from raichu (toroon0560w-lp140-01-69-159-36-102.dsl.bell.ca. [69.159.36.102]) by smtp.gmail.com with ESMTPSA id g186sm4191937iof.41.2019.03.17.10.59.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 17 Mar 2019 10:59:03 -0700 (PDT) Sender: Mark Johnston Date: Sun, 17 Mar 2019 13:58:59 -0400 From: Mark Johnston To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r345244 - head/sys/ufs/ufs Message-ID: <20190317175858.GA16331@raichu> References: <201903171734.x2HHY6FM004905@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201903171734.x2HHY6FM004905@repo.freebsd.org> User-Agent: Mutt/1.11.3 (2019-02-01) X-Rspamd-Queue-Id: 770B889BE0 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.975,0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2019 17:59:06 -0000 On Sun, Mar 17, 2019 at 05:34:06PM +0000, Mark Johnston wrote: > Author: markj > Date: Sun Mar 17 17:34:06 2019 > New Revision: 345244 > URL: https://svnweb.freebsd.org/changeset/base/345244 > > Log: > Optimize lseek(SEEK_DATA) on UFS. > > The old implementation, at the VFS layer, would map the entire range of > logical blocks between the starting offset and the first data block > following that offset. With large sparse files this is very > inefficient. The VFS currently doesn't provide an interface to improve > upon the current implementation in a generic way. > > Add ufs_bmap_seekdata(), which uses the obvious algorithm of scanning > indirect blocks to look for data blocks. Use it instead of > vn_bmap_seekhole() to implement SEEK_DATA. > > Reviewed by: kib, mckusick > MFC after: 2 weeks > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D19598 This should have been: https://reviews.freebsd.org/D19599 From owner-svn-src-head@freebsd.org Sun Mar 17 18:06:14 2019 Return-Path: Delivered-To: svn-src-head@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 C55D615455AF; Sun, 17 Mar 2019 18:06:14 +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 676EC8A321; Sun, 17 Mar 2019 18:06:14 +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 43FAFD8B7; Sun, 17 Mar 2019 18:06:14 +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 x2HI6EDY021090; Sun, 17 Mar 2019 18:06:14 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2HI6EV4021089; Sun, 17 Mar 2019 18:06:14 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201903171806.x2HI6EV4021089@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Sun, 17 Mar 2019 18:06:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345245 - head/sys/ufs/ufs X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/ufs/ufs X-SVN-Commit-Revision: 345245 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 676EC8A321 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.96)[-0.961,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2019 18:06:14 -0000 Author: markj Date: Sun Mar 17 18:06:13 2019 New Revision: 345245 URL: https://svnweb.freebsd.org/changeset/base/345245 Log: Fix the gcc build (-Wstrict-prototypes) after r345244. Reported by: jenkins MFC with: r345244 Modified: head/sys/ufs/ufs/ufs_bmap.c Modified: head/sys/ufs/ufs/ufs_bmap.c ============================================================================== --- head/sys/ufs/ufs/ufs_bmap.c Sun Mar 17 17:34:06 2019 (r345244) +++ head/sys/ufs/ufs/ufs_bmap.c Sun Mar 17 18:06:13 2019 (r345245) @@ -56,6 +56,9 @@ __FBSDID("$FreeBSD$"); #include #include +static int ufs_readindir(struct vnode *, ufs_lbn_t, ufs2_daddr_t, + struct buf **); + /* * Bmap converts the logical block number of a file to its physical block * number on the disk. The conversion is done by using the logical block From owner-svn-src-head@freebsd.org Sun Mar 17 18:31:49 2019 Return-Path: Delivered-To: svn-src-head@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 9ED391546799; Sun, 17 Mar 2019 18:31: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 41BAC8B645; Sun, 17 Mar 2019 18:31: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 CD860DC9E; Sun, 17 Mar 2019 18:31:48 +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 x2HIVm53035865; Sun, 17 Mar 2019 18:31:48 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2HIVmbD035864; Sun, 17 Mar 2019 18:31:48 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201903171831.x2HIVmbD035864@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 17 Mar 2019 18:31:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345246 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 345246 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 41BAC8B645 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.96)[-0.961,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2019 18:31:49 -0000 Author: kib Date: Sun Mar 17 18:31:48 2019 New Revision: 345246 URL: https://svnweb.freebsd.org/changeset/base/345246 Log: i386: improve detection of the fast page fault assist. In particular, check that we are assisting the page fault from kernel mode. Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/sys/i386/i386/exception.s Modified: head/sys/i386/i386/exception.s ============================================================================== --- head/sys/i386/i386/exception.s Sun Mar 17 18:06:13 2019 (r345245) +++ head/sys/i386/i386/exception.s Sun Mar 17 18:31:48 2019 (r345246) @@ -131,6 +131,10 @@ IDTVEC(prot) pushl $T_PROTFLT jmp irettraps IDTVEC(page) + testl $PSL_VM, TF_EFLAGS-TF_ERR(%esp) + jnz 1f + testb $SEL_RPL_MASK, TF_CS-TF_ERR(%esp) + jnz 1f cmpl $PMAP_TRM_MIN_ADDRESS, TF_EIP-TF_ERR(%esp) jb 1f movl %ebx, %cr3 From owner-svn-src-head@freebsd.org Sun Mar 17 22:26:51 2019 Return-Path: Delivered-To: svn-src-head@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 DF185154D087; Sun, 17 Mar 2019 22:26:51 +0000 (UTC) (envelope-from grog@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 7C8CE93CD6; Sun, 17 Mar 2019 22:26:51 +0000 (UTC) (envelope-from grog@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 5580918589; Sun, 17 Mar 2019 22:26:51 +0000 (UTC) (envelope-from grog@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2HMQpCe059834; Sun, 17 Mar 2019 22:26:51 GMT (envelope-from grog@FreeBSD.org) Received: (from grog@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2HMQpqq059833; Sun, 17 Mar 2019 22:26:51 GMT (envelope-from grog@FreeBSD.org) Message-Id: <201903172226.x2HMQpqq059833@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grog set sender to grog@FreeBSD.org using -f From: Greg Lehey Date: Sun, 17 Mar 2019 22:26:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345251 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: grog X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 345251 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7C8CE93CD6 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.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Mar 2019 22:26:52 -0000 Author: grog Date: Sun Mar 17 22:26:50 2019 New Revision: 345251 URL: https://svnweb.freebsd.org/changeset/base/345251 Log: Change date of Canberra Day, now on second Monday in March. https://en.wikipedia.org/wiki/Canberra_Day Modified: head/usr.bin/calendar/calendars/calendar.australia Modified: head/usr.bin/calendar/calendars/calendar.australia ============================================================================== --- head/usr.bin/calendar/calendars/calendar.australia Sun Mar 17 20:43:31 2019 (r345250) +++ head/usr.bin/calendar/calendars/calendar.australia Sun Mar 17 22:26:50 2019 (r345251) @@ -17,7 +17,7 @@ Jun/MonSecond Queen's Birthday Holiday (Australia, exc Oct/SunFirst Daylight Savings Time starts in ACT, NSW, SA and VIC. /* ACT, NSW, common */ -Mar 18 Canberra Day (ACT) +Mar/MonSecond Canberra Day (ACT) Sep/MonLast Family & Community Day (ACT) Aug/MonFirst Bank Holiday (ACT, NSW) Oct/MonFirst Labour Day (ACT, NSW, SA) From owner-svn-src-head@freebsd.org Mon Mar 18 02:40:23 2019 Return-Path: Delivered-To: svn-src-head@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 BCCAA152A415; Mon, 18 Mar 2019 02:40:23 +0000 (UTC) (envelope-from avos@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 606CD6C077; Mon, 18 Mar 2019 02:40:23 +0000 (UTC) (envelope-from avos@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 537F81B048; Mon, 18 Mar 2019 02:40:23 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2I2eN66089803; Mon, 18 Mar 2019 02:40:23 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2I2eN7b089802; Mon, 18 Mar 2019 02:40:23 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201903180240.x2I2eN7b089802@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Mon, 18 Mar 2019 02:40:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345252 - head/sys/net80211 X-SVN-Group: head X-SVN-Commit-Author: avos X-SVN-Commit-Paths: head/sys/net80211 X-SVN-Commit-Revision: 345252 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 606CD6C077 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_SHORT(-0.97)[-0.971,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2019 02:40:23 -0000 Author: avos Date: Mon Mar 18 02:40:22 2019 New Revision: 345252 URL: https://svnweb.freebsd.org/changeset/base/345252 Log: net80211: correct check for SMPS node flags updates Update node flags when driver supports SMPS, not when it is disabled or in dynamic mode ((iv_htcaps & HTCAP_SMPS) != 0). Checked with RTL8188EE (1T1R), STA mode - 'smps' word should disappear from 'ifconfig wlan0' output. MFC after: 2 weeks Modified: head/sys/net80211/ieee80211_ht.c Modified: head/sys/net80211/ieee80211_ht.c ============================================================================== --- head/sys/net80211/ieee80211_ht.c Sun Mar 17 22:26:50 2019 (r345251) +++ head/sys/net80211/ieee80211_ht.c Mon Mar 18 02:40:22 2019 (r345252) @@ -1727,7 +1727,7 @@ ieee80211_ht_updateparams(struct ieee80211_node *ni, const struct ieee80211_ie_htinfo *htinfo; ieee80211_parse_htcap(ni, htcapie); - if (vap->iv_htcaps & IEEE80211_HTCAP_SMPS) + if (vap->iv_htcaps & IEEE80211_HTC_SMPS) htcap_update_mimo_ps(ni); htcap_update_shortgi(ni); htcap_update_ldpc(ni); @@ -1880,7 +1880,7 @@ ieee80211_ht_updatehtcap(struct ieee80211_node *ni, co struct ieee80211vap *vap = ni->ni_vap; ieee80211_parse_htcap(ni, htcapie); - if (vap->iv_htcaps & IEEE80211_HTCAP_SMPS) + if (vap->iv_htcaps & IEEE80211_HTC_SMPS) htcap_update_mimo_ps(ni); htcap_update_shortgi(ni); htcap_update_ldpc(ni); From owner-svn-src-head@freebsd.org Mon Mar 18 05:03:57 2019 Return-Path: Delivered-To: svn-src-head@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 DDF53152F4E8; Mon, 18 Mar 2019 05:03:56 +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 80D84703BE; Mon, 18 Mar 2019 05:03:56 +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 6E1371CA95; Mon, 18 Mar 2019 05:03:56 +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 x2I53uoR068300; Mon, 18 Mar 2019 05:03:56 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2I53tCL068298; Mon, 18 Mar 2019 05:03:55 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201903180503.x2I53tCL068298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 18 Mar 2019 05:03:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345255 - head/sys/ufs/ufs X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/ufs/ufs X-SVN-Commit-Revision: 345255 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 80D84703BE 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.998,0]; NEURAL_HAM_SHORT(-0.94)[-0.937,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2019 05:03:57 -0000 Author: markj Date: Mon Mar 18 05:03:55 2019 New Revision: 345255 URL: https://svnweb.freebsd.org/changeset/base/345255 Log: Revert r345244 for now. The code which advances the block number is simplistic and is not correct when the starting offset is non-zero. Revert the change until this is fixed. Modified: head/sys/ufs/ufs/ufs_bmap.c head/sys/ufs/ufs/ufs_extern.h head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/ufs/ufs/ufs_bmap.c ============================================================================== --- head/sys/ufs/ufs/ufs_bmap.c Mon Mar 18 02:58:34 2019 (r345254) +++ head/sys/ufs/ufs/ufs_bmap.c Mon Mar 18 05:03:55 2019 (r345255) @@ -56,9 +56,6 @@ __FBSDID("$FreeBSD$"); #include #include -static int ufs_readindir(struct vnode *, ufs_lbn_t, ufs2_daddr_t, - struct buf **); - /* * Bmap converts the logical block number of a file to its physical block * number on the disk. The conversion is done by using the logical block @@ -93,51 +90,6 @@ ufs_bmap(ap) return (error); } -static int -ufs_readindir(vp, lbn, daddr, bpp) - struct vnode *vp; - ufs_lbn_t lbn; - ufs2_daddr_t daddr; - struct buf **bpp; -{ - struct buf *bp; - struct mount *mp; - struct ufsmount *ump; - int error; - - mp = vp->v_mount; - ump = VFSTOUFS(mp); - - bp = getblk(vp, lbn, mp->mnt_stat.f_iosize, 0, 0, 0); - if ((bp->b_flags & B_CACHE) == 0) { - KASSERT(daddr != 0, - ("ufs_readindir: indirect block not in cache")); - - bp->b_blkno = blkptrtodb(ump, daddr); - bp->b_iocmd = BIO_READ; - bp->b_flags &= ~B_INVAL; - bp->b_ioflags &= ~BIO_ERROR; - vfs_busy_pages(bp, 0); - bp->b_iooffset = dbtob(bp->b_blkno); - bstrategy(bp); -#ifdef RACCT - if (racct_enable) { - PROC_LOCK(curproc); - racct_add_buf(curproc, bp, 0); - PROC_UNLOCK(curproc); - } -#endif - curthread->td_ru.ru_inblock++; - error = bufwait(bp); - if (error != 0) { - brelse(bp); - return (error); - } - } - *bpp = bp; - return (0); -} - /* * Indirect blocks are now on the vnode for the file. They are given negative * logical block numbers. Indirect blocks are addressed by the negative @@ -260,10 +212,35 @@ ufs_bmaparray(vp, bn, bnp, nbp, runp, runb) */ if (bp) bqrelse(bp); - error = ufs_readindir(vp, metalbn, daddr, &bp); - if (error != 0) - return (error); + bp = getblk(vp, metalbn, mp->mnt_stat.f_iosize, 0, 0, 0); + if ((bp->b_flags & B_CACHE) == 0) { +#ifdef INVARIANTS + if (!daddr) + panic("ufs_bmaparray: indirect block not in cache"); +#endif + bp->b_blkno = blkptrtodb(ump, daddr); + bp->b_iocmd = BIO_READ; + bp->b_flags &= ~B_INVAL; + bp->b_ioflags &= ~BIO_ERROR; + vfs_busy_pages(bp, 0); + bp->b_iooffset = dbtob(bp->b_blkno); + bstrategy(bp); +#ifdef RACCT + if (racct_enable) { + PROC_LOCK(curproc); + racct_add_buf(curproc, bp, 0); + PROC_UNLOCK(curproc); + } +#endif /* RACCT */ + curthread->td_ru.ru_inblock++; + error = bufwait(bp); + if (error) { + brelse(bp); + return (error); + } + } + if (I_IS_UFS1(ip)) { daddr = ((ufs1_daddr_t *)bp->b_data)[ap->in_off]; if (num == 1 && daddr && runp) { @@ -324,93 +301,6 @@ ufs_bmaparray(vp, bn, bnp, nbp, runp, runb) *bnp = -1; } return (0); -} - -int -ufs_bmap_seekdata(vp, offp) - struct vnode *vp; - off_t *offp; -{ - struct buf *bp; - struct indir a[UFS_NIADDR + 1], *ap; - struct inode *ip; - struct mount *mp; - struct ufsmount *ump; - ufs2_daddr_t blockcnt, bn, daddr; - uint64_t bsize; - off_t numblks; - int error, num, num1; - - bp = NULL; - ip = VTOI(vp); - mp = vp->v_mount; - ump = VFSTOUFS(mp); - - if (vp->v_type != VREG || (ip->i_flags & SF_SNAPSHOT) != 0) - return (EINVAL); - if (*offp < 0) - return (ENXIO); - - bsize = mp->mnt_stat.f_iosize; - for (bn = *offp / bsize, numblks = howmany(ip->i_size, bsize); - bn < numblks;) { - if (bn < UFS_NDADDR) { - daddr = DIP(ip, i_db[bn]); - if (daddr != 0) - break; - bn++; - continue; - } - - ap = a; - error = ufs_getlbns(vp, bn, ap, &num); - if (error != 0) - break; - MPASS(num >= 2); - daddr = DIP(ip, i_ib[ap->in_off]); - ap++, num--; - if (daddr == 0) { - for (blockcnt = 1; num > 0; num--) - blockcnt *= MNINDIR(ump); - bn += blockcnt; - continue; - } - - for (; num > 0 && daddr != 0; ap++, num--) { - if (bp != NULL) - bqrelse(bp); - error = ufs_readindir(vp, ap->in_lbn, daddr, &bp); - if (error != 0) - return (error); - - /* - * Precompute the number of blocks addressed by an entry - * of the current indirect block. - */ - for (blockcnt = 1, num1 = num; num1 > 1; num1--) - blockcnt *= MNINDIR(ump); - - for (; ap->in_off < MNINDIR(ump); ap->in_off++, - bn += blockcnt) { - daddr = I_IS_UFS1(ip) ? - ((ufs1_daddr_t *)bp->b_data)[ap->in_off] : - ((ufs2_daddr_t *)bp->b_data)[ap->in_off]; - if (daddr != 0) - break; - } - } - if (daddr != 0) { - MPASS(num == 0); - break; - } - } - if (bp != NULL) - bqrelse(bp); - if (bn >= numblks) - error = ENXIO; - if (error == 0) - *offp = bn * bsize; - return (error); } /* Modified: head/sys/ufs/ufs/ufs_extern.h ============================================================================== --- head/sys/ufs/ufs/ufs_extern.h Mon Mar 18 02:58:34 2019 (r345254) +++ head/sys/ufs/ufs/ufs_extern.h Mon Mar 18 05:03:55 2019 (r345255) @@ -58,7 +58,6 @@ extern struct vop_vector ufs_vnodeops; int ufs_bmap(struct vop_bmap_args *); int ufs_bmaparray(struct vnode *, ufs2_daddr_t, ufs2_daddr_t *, struct buf *, int *, int *); -int ufs_bmap_seekdata(struct vnode *, off_t *); int ufs_fhtovp(struct mount *, struct ufid *, int, struct vnode **); int ufs_checkpath(ino_t, ino_t, struct inode *, struct ucred *, ino_t *); void ufs_dirbad(struct inode *, doff_t, char *); Modified: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Mon Mar 18 02:58:34 2019 (r345254) +++ head/sys/ufs/ufs/ufs_vnops.c Mon Mar 18 05:03:55 2019 (r345255) @@ -2701,15 +2701,12 @@ bad: static int ufs_ioctl(struct vop_ioctl_args *ap) { - struct vnode *vp; - vp = ap->a_vp; switch (ap->a_command) { case FIOSEEKDATA: - return (ufs_bmap_seekdata(vp, (off_t *)ap->a_data)); case FIOSEEKHOLE: - return (vn_bmap_seekhole(vp, ap->a_command, (off_t *)ap->a_data, - ap->a_cred)); + return (vn_bmap_seekhole(ap->a_vp, ap->a_command, + (off_t *)ap->a_data, ap->a_cred)); default: return (ENOTTY); } From owner-svn-src-head@freebsd.org Mon Mar 18 10:39:19 2019 Return-Path: Delivered-To: svn-src-head@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 BD49D15395A6; Mon, 18 Mar 2019 10:39:18 +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 68A2B82C3D; Mon, 18 Mar 2019 10:39:18 +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 3B88120242; Mon, 18 Mar 2019 10:39:18 +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 x2IAdIlt040101; Mon, 18 Mar 2019 10:39:18 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2IAdE95040085; Mon, 18 Mar 2019 10:39:14 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201903181039.x2IAdE95040085@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 18 Mar 2019 10:39:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345262 - in head: sbin/ipfw sys/netinet6 sys/netpfil/ipfw sys/netpfil/ipfw/nat64 X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in head: sbin/ipfw sys/netinet6 sys/netpfil/ipfw sys/netpfil/ipfw/nat64 X-SVN-Commit-Revision: 345262 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 68A2B82C3D 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.959,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2019 10:39:19 -0000 Author: ae Date: Mon Mar 18 10:39:14 2019 New Revision: 345262 URL: https://svnweb.freebsd.org/changeset/base/345262 Log: Modify struct nat64_config. Add second IPv6 prefix to generic config structure and rename another fields to conform to RFC6877. Now it contains two prefixes and length: PLAT is provider-side translator that translates N:1 global IPv6 addresses to global IPv4 addresses. CLAT is customer-side translator (XLAT) that algorithmically translates 1:1 IPv4 addresses to global IPv6 addresses. Use PLAT prefix in stateless (nat64stl) and stateful (nat64lsn) translators. Modify nat64_extract_ip4() and nat64_embed_ip4() functions to accept prefix length and use plat_plen to specify prefix length. Retire net.inet.ip.fw.nat64_allow_private sysctl variable. Add NAT64_ALLOW_PRIVATE flag and use "allow_private" config option to configure this ability separately for each NAT64 instance. Obtained from: Yandex LLC MFC after: 1 month Sponsored by: Yandex LLC Modified: head/sbin/ipfw/ipfw.8 head/sbin/ipfw/ipfw2.h head/sbin/ipfw/nat64lsn.c head/sbin/ipfw/nat64stl.c head/sys/netinet6/ip_fw_nat64.h head/sys/netpfil/ipfw/ip_fw_pfil.c head/sys/netpfil/ipfw/nat64/ip_fw_nat64.c head/sys/netpfil/ipfw/nat64/ip_fw_nat64.h head/sys/netpfil/ipfw/nat64/nat64_translate.c head/sys/netpfil/ipfw/nat64/nat64_translate.h head/sys/netpfil/ipfw/nat64/nat64lsn.c head/sys/netpfil/ipfw/nat64/nat64lsn.h head/sys/netpfil/ipfw/nat64/nat64lsn_control.c head/sys/netpfil/ipfw/nat64/nat64stl.c head/sys/netpfil/ipfw/nat64/nat64stl.h head/sys/netpfil/ipfw/nat64/nat64stl_control.c Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Mon Mar 18 10:28:40 2019 (r345261) +++ head/sbin/ipfw/ipfw.8 Mon Mar 18 10:39:14 2019 (r345262) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 1, 2019 +.Dd March 18, 2019 .Dt IPFW 8 .Os .Sh NAME @@ -3413,6 +3413,14 @@ With you are able to see each handled packet before and after translation. .It Cm -log Turn off logging of all handled packets via BPF. +.It Cm allow_private +Turn on processing private IPv4 addresses. By default IPv6 packets with +destinations mapped to private address ranges defined by RFC1918 are not +processed. +.It Cm -allow_private +Turn off private address handling in +.Nm nat64 +instance. .El .Pp To inspect a states table of stateful NAT64 the following command can be used: @@ -3460,6 +3468,14 @@ Turn on logging of all handled packets via BPF through interface. .It Cm -log Turn off logging of all handled packets via BPF. +.It Cm allow_private +Turn on processing private IPv4 addresses. By default IPv6 packets with +destinations mapped to private address ranges defined by RFC1918 are not +processed. +.It Cm -allow_private +Turn off private address handling in +.Nm nat64 +instance. .El .Pp Note that the behavior of stateless translator with respect to not matched @@ -3948,16 +3964,6 @@ Default is no. Controls whether bridged packets are passed to .Nm . Default is no. -.It Va net.inet.ip.fw.nat64_allow_private : No 0 -Defines how -.Nm nat64 -handles private IPv4 addresses: -.Bl -tag -width indent -.It Cm 0 -Packets with private IPv4 will not be handled by translator -.It Cm 1 -Translator will accept and process packets with private IPv4 addresses. -.El .It Va net.inet.ip.fw.nat64_debug : No 0 Controls debugging messages produced by .Nm ipfw_nat64 Modified: head/sbin/ipfw/ipfw2.h ============================================================================== --- head/sbin/ipfw/ipfw2.h Mon Mar 18 10:28:40 2019 (r345261) +++ head/sbin/ipfw/ipfw2.h Mon Mar 18 10:39:14 2019 (r345262) @@ -288,6 +288,8 @@ enum tokens { TOK_UDP_AGE, TOK_ICMP_AGE, TOK_LOGOFF, + TOK_PRIVATE, + TOK_PRIVATEOFF, /* NPTv6 tokens */ TOK_NPTV6, Modified: head/sbin/ipfw/nat64lsn.c ============================================================================== --- head/sbin/ipfw/nat64lsn.c Mon Mar 18 10:28:40 2019 (r345261) +++ head/sbin/ipfw/nat64lsn.c Mon Mar 18 10:39:14 2019 (r345262) @@ -377,6 +377,8 @@ static struct _s_x nat64newcmds[] = { { "icmp_age", TOK_ICMP_AGE }, { "log", TOK_LOG }, { "-log", TOK_LOGOFF }, + { "allow_private", TOK_PRIVATE }, + { "-allow_private", TOK_PRIVATEOFF }, { NULL, 0 } }; @@ -522,6 +524,12 @@ nat64lsn_create(const char *name, uint8_t set, int ac, case TOK_LOGOFF: cfg->flags &= ~NAT64_LOG; break; + case TOK_PRIVATE: + cfg->flags |= NAT64_ALLOW_PRIVATE; + break; + case TOK_PRIVATEOFF: + cfg->flags &= ~NAT64_ALLOW_PRIVATE; + break; } } @@ -627,6 +635,12 @@ nat64lsn_config(const char *name, uint8_t set, int ac, case TOK_LOGOFF: cfg->flags &= ~NAT64_LOG; break; + case TOK_PRIVATE: + cfg->flags |= NAT64_ALLOW_PRIVATE; + break; + case TOK_PRIVATEOFF: + cfg->flags &= ~NAT64_ALLOW_PRIVATE; + break; default: errx(EX_USAGE, "Can't change %s option", opt); } @@ -801,6 +815,8 @@ nat64lsn_show_cb(ipfw_nat64lsn_cfg *cfg, const char *n printf(" icmp_age %u", cfg->st_icmp_ttl); if (cfg->flags & NAT64_LOG) printf(" log"); + if (cfg->flags & NAT64_ALLOW_PRIVATE) + printf(" allow_private"); printf("\n"); return (0); } Modified: head/sbin/ipfw/nat64stl.c ============================================================================== --- head/sbin/ipfw/nat64stl.c Mon Mar 18 10:28:40 2019 (r345261) +++ head/sbin/ipfw/nat64stl.c Mon Mar 18 10:39:14 2019 (r345262) @@ -196,6 +196,8 @@ static struct _s_x nat64newcmds[] = { { "prefix6", TOK_PREFIX6 }, { "log", TOK_LOG }, { "-log", TOK_LOGOFF }, + { "allow_private", TOK_PRIVATE }, + { "-allow_private", TOK_PRIVATEOFF }, { NULL, 0 } }; @@ -263,6 +265,12 @@ nat64stl_create(const char *name, uint8_t set, int ac, case TOK_LOGOFF: cfg->flags &= ~NAT64_LOG; break; + case TOK_PRIVATE: + cfg->flags |= NAT64_ALLOW_PRIVATE; + break; + case TOK_PRIVATEOFF: + cfg->flags &= ~NAT64_ALLOW_PRIVATE; + break; } } @@ -332,6 +340,12 @@ nat64stl_config(const char *name, uint8_t set, int ac, case TOK_LOGOFF: cfg->flags &= ~NAT64_LOG; break; + case TOK_PRIVATE: + cfg->flags |= NAT64_ALLOW_PRIVATE; + break; + case TOK_PRIVATEOFF: + cfg->flags &= ~NAT64_ALLOW_PRIVATE; + break; default: errx(EX_USAGE, "Can't change %s option", opt); } @@ -451,6 +465,8 @@ nat64stl_show_cb(ipfw_nat64stl_cfg *cfg, const char *n printf(" prefix6 %s/%u", abuf, cfg->plen6); if (cfg->flags & NAT64_LOG) printf(" log"); + if (cfg->flags & NAT64_ALLOW_PRIVATE) + printf(" allow_private"); printf("\n"); return (0); } Modified: head/sys/netinet6/ip_fw_nat64.h ============================================================================== --- head/sys/netinet6/ip_fw_nat64.h Mon Mar 18 10:28:40 2019 (r345261) +++ head/sys/netinet6/ip_fw_nat64.h Mon Mar 18 10:39:14 2019 (r345262) @@ -40,7 +40,7 @@ struct ipfw_nat64stl_stats { uint64_t noroute4; uint64_t noroute6; uint64_t noproto; /* Protocol not supported */ - uint64_t nomem; /* mbuf allocation filed */ + uint64_t nomem; /* mbuf allocation failed */ uint64_t dropped; /* dropped due to some errors */ }; @@ -53,7 +53,7 @@ struct ipfw_nat64lsn_stats { uint64_t noroute4; uint64_t noroute6; uint64_t noproto; /* Protocol not supported */ - uint64_t nomem; /* mbuf allocation filed */ + uint64_t nomem; /* mbuf allocation failed */ uint64_t dropped; /* dropped due to some errors */ uint64_t nomatch4; /* No addr/port match */ @@ -79,8 +79,10 @@ struct ipfw_nat64lsn_stats { uint64_t _reserved[4]; }; -#define NAT64_LOG 0x0001 /* Enable logging via BPF */ - +#define NAT64_LOG 0x0001 /* Enable logging via BPF */ +#define NAT64_ALLOW_PRIVATE 0x0002 /* Allow private IPv4 address + * translation + */ typedef struct _ipfw_nat64stl_cfg { char name[64]; /* NAT name */ ipfw_obj_ntlv ntlv6; /* object name tlv */ Modified: head/sys/netpfil/ipfw/ip_fw_pfil.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_pfil.c Mon Mar 18 10:28:40 2019 (r345261) +++ head/sys/netpfil/ipfw/ip_fw_pfil.c Mon Mar 18 10:39:14 2019 (r345262) @@ -148,8 +148,8 @@ again: ipfw = ipfw_chk(&args); *m0 = args.m; - KASSERT(*m0 != NULL || ipfw == IP_FW_DENY, ("%s: m0 is NULL", - __func__)); + KASSERT(*m0 != NULL || ipfw == IP_FW_DENY || + ipfw == IP_FW_NAT64, ("%s: m0 is NULL", __func__)); ret = PFIL_PASS; switch (ipfw) { Modified: head/sys/netpfil/ipfw/nat64/ip_fw_nat64.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/ip_fw_nat64.c Mon Mar 18 10:28:40 2019 (r345261) +++ head/sys/netpfil/ipfw/nat64/ip_fw_nat64.c Mon Mar 18 10:39:14 2019 (r345262) @@ -51,14 +51,10 @@ __FBSDID("$FreeBSD$"); #include "nat64_translate.h" VNET_DEFINE(int, nat64_debug) = 0; -VNET_DEFINE(int, nat64_allow_private) = 0; SYSCTL_DECL(_net_inet_ip_fw); SYSCTL_INT(_net_inet_ip_fw, OID_AUTO, nat64_debug, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(nat64_debug), 0, "Debug level for NAT64 module"); -SYSCTL_INT(_net_inet_ip_fw, OID_AUTO, nat64_allow_private, - CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(nat64_allow_private), 0, - "Allow use of non-global IPv4 addresses with NAT64"); static int sysctl_direct_output(SYSCTL_HANDLER_ARGS) Modified: head/sys/netpfil/ipfw/nat64/ip_fw_nat64.h ============================================================================== --- head/sys/netpfil/ipfw/nat64/ip_fw_nat64.h Mon Mar 18 10:28:40 2019 (r345261) +++ head/sys/netpfil/ipfw/nat64/ip_fw_nat64.h Mon Mar 18 10:39:14 2019 (r345262) @@ -41,9 +41,7 @@ #define DP_ALL 0xFFFF VNET_DECLARE(int, nat64_debug); -VNET_DECLARE(int, nat64_allow_private); #define V_nat64_debug VNET(nat64_debug) -#define V_nat64_allow_private VNET(nat64_allow_private) #if 0 #define NAT64NOINLINE __noinline Modified: head/sys/netpfil/ipfw/nat64/nat64_translate.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64_translate.c Mon Mar 18 10:28:40 2019 (r345261) +++ head/sys/netpfil/ipfw/nat64/nat64_translate.c Mon Mar 18 10:39:14 2019 (r345262) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -241,7 +242,7 @@ nat64_output_one(struct mbuf *m, struct nat64_counters * Returns zero on success, otherwise EINVAL. */ int -nat64_check_prefix6(const struct in6_addr *prefix, int length) +nat64_check_prefixlen(int length) { switch (length) { @@ -250,29 +251,40 @@ nat64_check_prefix6(const struct in6_addr *prefix, int case 48: case 56: case 64: - /* Well-known prefix has 96 prefix length */ - if (IN6_IS_ADDR_WKPFX(prefix)) - return (EINVAL); - /* FALLTHROUGH */ case 96: - /* Bits 64 to 71 must be set to zero */ - if (prefix->__u6_addr.__u6_addr8[8] != 0) - return (EINVAL); - /* Some extra checks */ - if (IN6_IS_ADDR_MULTICAST(prefix) || - IN6_IS_ADDR_UNSPECIFIED(prefix) || - IN6_IS_ADDR_LOOPBACK(prefix)) - return (EINVAL); return (0); } return (EINVAL); } int +nat64_check_prefix6(const struct in6_addr *prefix, int length) +{ + + if (nat64_check_prefixlen(length) != 0) + return (EINVAL); + + /* Well-known prefix has 96 prefix length */ + if (IN6_IS_ADDR_WKPFX(prefix) && length != 96) + return (EINVAL); + + /* Bits 64 to 71 must be set to zero */ + if (prefix->__u6_addr.__u6_addr8[8] != 0) + return (EINVAL); + + /* Some extra checks */ + if (IN6_IS_ADDR_MULTICAST(prefix) || + IN6_IS_ADDR_UNSPECIFIED(prefix) || + IN6_IS_ADDR_LOOPBACK(prefix)) + return (EINVAL); + return (0); +} + +int nat64_check_private_ip4(const struct nat64_config *cfg, in_addr_t ia) { - if (V_nat64_allow_private) + if (cfg->flags & NAT64_ALLOW_PRIVATE) return (0); /* WKPFX must not be used to represent non-global IPv4 addresses */ @@ -301,29 +313,34 @@ nat64_check_private_ip4(const struct nat64_config *cfg return (0); } +/* + * Embed @ia IPv4 address into @ip6 IPv6 address. + * Place to embedding determined from prefix length @plen. + */ void -nat64_embed_ip4(const struct nat64_config *cfg, in_addr_t ia, - struct in6_addr *ip6) +nat64_embed_ip4(struct in6_addr *ip6, int plen, in_addr_t ia) { - /* assume the prefix6 is properly filled with zeros */ - bcopy(&cfg->prefix6, ip6, sizeof(*ip6)); - switch (cfg->plen6) { + switch (plen) { case 32: case 96: - ip6->s6_addr32[cfg->plen6 / 32] = ia; + ip6->s6_addr32[plen / 32] = ia; break; case 40: case 48: case 56: + /* + * Preserve prefix bits. + * Since suffix bits should be zero and reserved for future + * use, we just overwrite the whole word, where they are. + */ + ip6->s6_addr32[1] &= 0xffffffff << (32 - plen % 32); #if BYTE_ORDER == BIG_ENDIAN - ip6->s6_addr32[1] = cfg->prefix6.s6_addr32[1] | - (ia >> (cfg->plen6 % 32)); - ip6->s6_addr32[2] = ia << (24 - cfg->plen6 % 32); + ip6->s6_addr32[1] |= ia >> (plen % 32); + ip6->s6_addr32[2] = ia << (24 - plen % 32); #elif BYTE_ORDER == LITTLE_ENDIAN - ip6->s6_addr32[1] = cfg->prefix6.s6_addr32[1] | - (ia << (cfg->plen6 % 32)); - ip6->s6_addr32[2] = ia >> (24 - cfg->plen6 % 32); + ip6->s6_addr32[1] |= ia << (plen % 32); + ip6->s6_addr32[2] = ia >> (24 - plen % 32); #endif break; case 64: @@ -336,13 +353,18 @@ nat64_embed_ip4(const struct nat64_config *cfg, in_add #endif break; default: - panic("Wrong plen6"); + panic("Wrong plen: %d", plen); }; + /* + * Bits 64 to 71 of the address are reserved for compatibility + * with the host identifier format defined in the IPv6 addressing + * architecture [RFC4291]. These bits MUST be set to zero. + */ ip6->s6_addr8[8] = 0; } in_addr_t -nat64_extract_ip4(const struct nat64_config *cfg, const struct in6_addr *ip6) +nat64_extract_ip4(const struct in6_addr *ip6, int plen) { in_addr_t ia; @@ -353,7 +375,7 @@ nat64_extract_ip4(const struct nat64_config *cfg, cons * The suffix bits are reserved for future extensions and SHOULD * be set to zero. */ - switch (cfg->plen6) { + switch (plen) { case 32: if (ip6->s6_addr32[3] != 0 || ip6->s6_addr32[2] != 0) goto badip6; @@ -377,20 +399,20 @@ nat64_extract_ip4(const struct nat64_config *cfg, cons (ip6->s6_addr32[3] & htonl(0x00ffffff)) != 0) goto badip6; }; - switch (cfg->plen6) { + switch (plen) { case 32: case 96: - ia = ip6->s6_addr32[cfg->plen6 / 32]; + ia = ip6->s6_addr32[plen / 32]; break; case 40: case 48: case 56: #if BYTE_ORDER == BIG_ENDIAN - ia = (ip6->s6_addr32[1] << (cfg->plen6 % 32)) | - (ip6->s6_addr32[2] >> (24 - cfg->plen6 % 32)); + ia = (ip6->s6_addr32[1] << (plen % 32)) | + (ip6->s6_addr32[2] >> (24 - plen % 32)); #elif BYTE_ORDER == LITTLE_ENDIAN - ia = (ip6->s6_addr32[1] >> (cfg->plen6 % 32)) | - (ip6->s6_addr32[2] << (24 - cfg->plen6 % 32)); + ia = (ip6->s6_addr32[1] >> (plen % 32)) | + (ip6->s6_addr32[2] << (24 - plen % 32)); #endif break; case 64: @@ -403,12 +425,9 @@ nat64_extract_ip4(const struct nat64_config *cfg, cons default: return (0); }; - if (nat64_check_ip4(ia) != 0 || - nat64_check_private_ip4(cfg, ia) != 0) - goto badip4; + if (nat64_check_ip4(ia) == 0) + return (ia); - return (ia); -badip4: DPRINTF(DP_GENERIC | DP_DROPS, "invalid destination address: %08x", ia); return (0); @@ -435,7 +454,7 @@ badip6: * IPv6 to IPv4: HC' = cksum_add(HC, result) * IPv4 to IPv6: HC' = cksum_add(HC, ~result) */ -static NAT64NOINLINE uint16_t +static uint16_t nat64_cksum_convert(struct ip6_hdr *ip6, struct ip *ip) { uint32_t sum; @@ -455,7 +474,7 @@ nat64_cksum_convert(struct ip6_hdr *ip6, struct ip *ip return (sum); } -static NAT64NOINLINE void +static void nat64_init_ip4hdr(const struct ip6_hdr *ip6, const struct ip6_frag *frag, uint16_t plen, uint8_t proto, struct ip *ip) { @@ -1025,9 +1044,11 @@ nat64_icmp_translate(struct mbuf *m, struct ip6_hdr *i /* Construct new inner IPv6 header */ eip6 = mtodo(n, offset + sizeof(struct icmp6_hdr)); eip6->ip6_src = ip6->ip6_dst; - /* Use the fact that we have single /96 prefix for IPv4 map */ + + /* Use the same prefix that we have in outer header */ eip6->ip6_dst = ip6->ip6_src; - nat64_embed_ip4(cfg, ip.ip_dst.s_addr, &eip6->ip6_dst); + MPASS(cfg->flags & NAT64_PLATPFX); + nat64_embed_ip4(&eip6->ip6_dst, cfg->plat_plen, ip.ip_dst.s_addr); eip6->ip6_flow = htonl(ip.ip_tos << 20); eip6->ip6_vfc |= IPV6_VERSION; @@ -1450,7 +1471,9 @@ nat64_handle_icmp6(struct mbuf *m, int hlen, uint32_t /* Now we need to make a fake IPv4 packet to generate ICMP message */ ip.ip_dst.s_addr = aaddr; - ip.ip_src.s_addr = nat64_extract_ip4(cfg, &ip6i->ip6_src); + ip.ip_src.s_addr = nat64_extract_ip4(&ip6i->ip6_src, cfg->plat_plen); + if (ip.ip_src.s_addr == 0) + goto fail; /* XXX: Make fake ulp header */ if (V_nat64out == &nat64_direct) /* init_ip4hdr will decrement it */ ip6i->ip6_hlim += IPV6_HLIMDEC; @@ -1503,7 +1526,7 @@ nat64_do_handle_ip6(struct mbuf *m, uint32_t aaddr, ui return (NAT64MFREE); } - ip.ip_dst.s_addr = nat64_extract_ip4(cfg, &ip6->ip6_dst); + ip.ip_dst.s_addr = nat64_extract_ip4(&ip6->ip6_dst, cfg->plat_plen); if (ip.ip_dst.s_addr == 0) { NAT64STAT_INC(&cfg->stats, dropped); return (NAT64MFREE); Modified: head/sys/netpfil/ipfw/nat64/nat64_translate.h ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64_translate.h Mon Mar 18 10:28:40 2019 (r345261) +++ head/sys/netpfil/ipfw/nat64/nat64_translate.h Mon Mar 18 10:39:14 2019 (r345262) @@ -46,12 +46,12 @@ struct nat64_stats { * unsupported/etc. */ - uint64_t jrequests; /* number of jobs requests queued */ - uint64_t jcalls; /* number of jobs handler calls */ - uint64_t jhostsreq; /* number of hosts requests */ - uint64_t jportreq; - uint64_t jhostfails; - uint64_t jportfails; + uint64_t jrequests; /* jobs requests queued */ + uint64_t jcalls; /* jobs handler calls */ + uint64_t jhostsreq; /* hosts requests */ + uint64_t jportreq; /* PG allocation requests */ + uint64_t jhostfails; /* hosts requests failed */ + uint64_t jportfails; /* PG allocation failed */ uint64_t jmaxlen; uint64_t jnomem; uint64_t jreinjected; @@ -85,11 +85,24 @@ struct nat64_counters { #define NAT64RETURN 1 #define NAT64MFREE -1 +/* + * According to RFC6877: + * PLAT is provider-side translator (XLAT) that translates N:1 global + * IPv6 addresses to global IPv4 addresses, and vice versa. + * + * CLAT is customer-side translator (XLAT) that algorithmically + * translates 1:1 private IPv4 addresses to global IPv6 addresses, + * and vice versa. + */ struct nat64_config { + struct in6_addr clat_prefix; + struct in6_addr plat_prefix; uint32_t flags; -#define NAT64_WKPFX 0x00010000 /* prefix6 is WKPFX */ - struct in6_addr prefix6; - uint8_t plen6; +#define NAT64_WKPFX 0x00010000 /* prefix is well-known */ +#define NAT64_CLATPFX 0x00020000 /* dst prefix is configured */ +#define NAT64_PLATPFX 0x00040000 /* src prefix is configured */ + uint8_t clat_plen; + uint8_t plat_plen; struct nat64_counters stats; }; @@ -128,6 +141,7 @@ nat64_check_ip4(in_addr_t ia) (a)->s6_addr32[1] == 0 && (a)->s6_addr32[2] == 0) int nat64_check_private_ip4(const struct nat64_config *cfg, in_addr_t ia); +int nat64_check_prefixlen(int length); int nat64_check_prefix6(const struct in6_addr *prefix, int length); int nat64_getlasthdr(struct mbuf *m, int *offset); int nat64_do_handle_ip4(struct mbuf *m, struct in6_addr *saddr, @@ -137,10 +151,8 @@ int nat64_do_handle_ip6(struct mbuf *m, uint32_t aaddr struct nat64_config *cfg, void *logdata); int nat64_handle_icmp6(struct mbuf *m, int hlen, uint32_t aaddr, uint16_t aport, struct nat64_config *cfg, void *logdata); -void nat64_embed_ip4(const struct nat64_config *cfg, in_addr_t ia, - struct in6_addr *ip6); -in_addr_t nat64_extract_ip4(const struct nat64_config *cfg, - const struct in6_addr *ip6); +void nat64_embed_ip4(struct in6_addr *ip6, int plen, in_addr_t ia); +in_addr_t nat64_extract_ip4(const struct in6_addr *ip6, int plen); void nat64_set_output_method(int); int nat64_get_output_method(void); Modified: head/sys/netpfil/ipfw/nat64/nat64lsn.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64lsn.c Mon Mar 18 10:28:40 2019 (r345261) +++ head/sys/netpfil/ipfw/nat64/nat64lsn.c Mon Mar 18 10:39:14 2019 (r345262) @@ -407,7 +407,7 @@ nat64lsn_translate4(struct nat64lsn_cfg *cfg, const st } else logdata = NULL; - nat64_embed_ip4(&cfg->base, htonl(f_id->src_ip), &src6); + nat64_embed_ip4(&src6, cfg->base.plat_plen, htonl(f_id->src_ip)); ret = nat64_do_handle_ip4(*pm, &src6, &nh->addr, lport, &cfg->base, logdata); @@ -1481,8 +1481,10 @@ nat64lsn_translate6(struct nat64lsn_cfg *cfg, struct i return (nat64lsn_request_host(cfg, f_id, pm)); /* Fill-in on-stack state structure */ - kst.u.s.faddr = nat64_extract_ip4(&cfg->base, &f_id->dst_ip6); - if (kst.u.s.faddr == 0) { + kst.u.s.faddr = nat64_extract_ip4(&f_id->dst_ip6, + cfg->base.plat_plen); + if (kst.u.s.faddr == 0 || + nat64_check_private_ip4(&cfg->base, kst.u.s.faddr) != 0) { NAT64STAT_INC(&cfg->base.stats, dropped); goto drop; } Modified: head/sys/netpfil/ipfw/nat64/nat64lsn.h ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64lsn.h Mon Mar 18 10:28:40 2019 (r345261) +++ head/sys/netpfil/ipfw/nat64/nat64lsn.h Mon Mar 18 10:39:14 2019 (r345262) @@ -216,7 +216,7 @@ struct nat64lsn_cfg { uint16_t st_icmp_ttl; /* ICMP expire */ uint32_t protochunks[NAT_MAX_PROTO];/* Number of chunks used */ struct nat64_config base; -#define NAT64LSN_FLAGSMASK (NAT64_LOG) +#define NAT64LSN_FLAGSMASK (NAT64_LOG | NAT64_ALLOW_PRIVATE) struct callout periodic; struct callout jcallout; Modified: head/sys/netpfil/ipfw/nat64/nat64lsn_control.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64lsn_control.c Mon Mar 18 10:28:40 2019 (r345261) +++ head/sys/netpfil/ipfw/nat64/nat64lsn_control.c Mon Mar 18 10:39:14 2019 (r345262) @@ -164,10 +164,10 @@ nat64lsn_create(struct ip_fw_chain *ch, ip_fw3_opheade cfg->no.etlv = IPFW_TLV_NAT64LSN_NAME; cfg->no.set = uc->set; - cfg->base.prefix6 = uc->prefix6; - cfg->base.plen6 = uc->plen6; - cfg->base.flags = uc->flags & NAT64LSN_FLAGSMASK; - if (IN6_IS_ADDR_WKPFX(&cfg->base.prefix6)) + cfg->base.plat_prefix = uc->prefix6; + cfg->base.plat_plen = uc->plen6; + cfg->base.flags = (uc->flags & NAT64LSN_FLAGSMASK) | NAT64_PLATPFX; + if (IN6_IS_ADDR_WKPFX(&cfg->base.plat_prefix)) cfg->base.flags |= NAT64_WKPFX; cfg->prefix4 = addr4; @@ -324,9 +324,9 @@ nat64lsn_export_config(struct ip_fw_chain *ch, struct uc->st_udp_ttl = cfg->st_udp_ttl; uc->st_icmp_ttl = cfg->st_icmp_ttl; uc->prefix4.s_addr = htonl(cfg->prefix4); - uc->prefix6 = cfg->base.prefix6; + uc->prefix6 = cfg->base.plat_prefix; uc->plen4 = cfg->plen4; - uc->plen6 = cfg->base.plen6; + uc->plen6 = cfg->base.plat_plen; uc->set = cfg->no.set; strlcpy(uc->name, cfg->no.name, sizeof(uc->name)); } Modified: head/sys/netpfil/ipfw/nat64/nat64stl.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64stl.c Mon Mar 18 10:28:40 2019 (r345261) +++ head/sys/netpfil/ipfw/nat64/nat64stl.c Mon Mar 18 10:39:14 2019 (r345262) @@ -99,7 +99,9 @@ nat64stl_handle_ip4(struct ip_fw_chain *chain, struct daddr = TARG_VAL(chain, tablearg, nh6); if (nat64_check_ip6(&daddr) != 0) return (NAT64MFREE); - nat64_embed_ip4(&cfg->base, ip->ip_src.s_addr, &saddr); + + saddr = cfg->base.plat_prefix; + nat64_embed_ip4(&saddr, cfg->base.plat_plen, ip->ip_src.s_addr); if (cfg->base.flags & NAT64_LOG) { logdata = &loghdr; nat64stl_log(logdata, m, AF_INET, cfg->no.kidx); @@ -118,7 +120,10 @@ nat64stl_handle_ip6(struct ip_fw_chain *chain, struct uint32_t aaddr; aaddr = htonl(TARG_VAL(chain, tablearg, nh4)); - + if (nat64_check_private_ip4(&cfg->base, aaddr) != 0) { + NAT64STAT_INC(&cfg->base.stats, dropped); + return (NAT64MFREE); + } /* * NOTE: we expect ipfw_chk() did m_pullup() up to upper level * protocol's headers. Also we skip some checks, that ip6_input(), @@ -126,7 +131,8 @@ nat64stl_handle_ip6(struct ip_fw_chain *chain, struct */ ip6 = mtod(m, struct ip6_hdr *); /* Check ip6_dst matches configured prefix */ - if (bcmp(&ip6->ip6_dst, &cfg->base.prefix6, cfg->base.plen6 / 8) != 0) + if (memcmp(&ip6->ip6_dst, &cfg->base.plat_prefix, + cfg->base.plat_plen / 8) != 0) return (NAT64SKIP); if (cfg->base.flags & NAT64_LOG) { @@ -254,7 +260,7 @@ ipfw_nat64stl(struct ip_fw_chain *chain, struct ip_fw_ if (ret == NAT64MFREE) m_freem(args->m); args->m = NULL; - return (IP_FW_DENY); + return (IP_FW_NAT64); } Modified: head/sys/netpfil/ipfw/nat64/nat64stl.h ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64stl.h Mon Mar 18 10:28:40 2019 (r345261) +++ head/sys/netpfil/ipfw/nat64/nat64stl.h Mon Mar 18 10:39:14 2019 (r345262) @@ -43,7 +43,8 @@ struct nat64stl_cfg { #define NAT64STL_KIDX 0x0100 #define NAT64STL_46T 0x0200 #define NAT64STL_64T 0x0400 -#define NAT64STL_FLAGSMASK (NAT64_LOG) /* flags to pass to userland */ + /* flags to pass to userland */ +#define NAT64STL_FLAGSMASK (NAT64_LOG | NAT64_ALLOW_PRIVATE) char name[64]; }; Modified: head/sys/netpfil/ipfw/nat64/nat64stl_control.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64stl_control.c Mon Mar 18 10:28:40 2019 (r345261) +++ head/sys/netpfil/ipfw/nat64/nat64stl_control.c Mon Mar 18 10:39:14 2019 (r345262) @@ -99,8 +99,8 @@ nat64stl_export_config(struct ip_fw_chain *ch, struct { struct named_object *no; - uc->prefix6 = cfg->base.prefix6; - uc->plen6 = cfg->base.plen6; + uc->prefix6 = cfg->base.plat_prefix; + uc->plen6 = cfg->base.plat_plen; uc->flags = cfg->base.flags & NAT64STL_FLAGSMASK; uc->set = cfg->no.set; strlcpy(uc->name, cfg->no.name, sizeof(uc->name)); @@ -206,10 +206,10 @@ nat64stl_create(struct ip_fw_chain *ch, ip_fw3_opheade IPFW_UH_RUNLOCK(ch); cfg = nat64stl_alloc_config(uc->name, uc->set); - cfg->base.prefix6 = uc->prefix6; - cfg->base.plen6 = uc->plen6; - cfg->base.flags = uc->flags & NAT64STL_FLAGSMASK; - if (IN6_IS_ADDR_WKPFX(&cfg->base.prefix6)) + cfg->base.plat_prefix = uc->prefix6; + cfg->base.plat_plen = uc->plen6; + cfg->base.flags = (uc->flags & NAT64STL_FLAGSMASK) | NAT64_PLATPFX; + if (IN6_IS_ADDR_WKPFX(&cfg->base.plat_prefix)) cfg->base.flags |= NAT64_WKPFX; IPFW_UH_WLOCK(ch); From owner-svn-src-head@freebsd.org Mon Mar 18 10:50:36 2019 Return-Path: Delivered-To: svn-src-head@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 55DD71539B74; Mon, 18 Mar 2019 10:50: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 E6CBD832AD; Mon, 18 Mar 2019 10:50:35 +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 A675720412; Mon, 18 Mar 2019 10:50:35 +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 x2IAoZh3045511; Mon, 18 Mar 2019 10:50:35 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2IAoXI2045498; Mon, 18 Mar 2019 10:50:33 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201903181050.x2IAoXI2045498@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 18 Mar 2019 10:50:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345263 - in head: sbin/ipfw sys/netinet6 sys/netpfil/ipfw/nat64 X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in head: sbin/ipfw sys/netinet6 sys/netpfil/ipfw/nat64 X-SVN-Commit-Revision: 345263 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E6CBD832AD 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_SHORT(-0.96)[-0.956,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2019 10:50:36 -0000 Author: ae Date: Mon Mar 18 10:50:32 2019 New Revision: 345263 URL: https://svnweb.freebsd.org/changeset/base/345263 Log: Add SPDX-License-Identifier and update year in copyright. MFC after: 1 month Modified: head/sbin/ipfw/nat64lsn.c head/sbin/ipfw/nat64stl.c head/sys/netinet6/ip_fw_nat64.h head/sys/netpfil/ipfw/nat64/ip_fw_nat64.c head/sys/netpfil/ipfw/nat64/ip_fw_nat64.h head/sys/netpfil/ipfw/nat64/nat64_translate.c head/sys/netpfil/ipfw/nat64/nat64_translate.h head/sys/netpfil/ipfw/nat64/nat64lsn.c head/sys/netpfil/ipfw/nat64/nat64lsn.h head/sys/netpfil/ipfw/nat64/nat64lsn_control.c head/sys/netpfil/ipfw/nat64/nat64stl.c head/sys/netpfil/ipfw/nat64/nat64stl.h head/sys/netpfil/ipfw/nat64/nat64stl_control.c Modified: head/sbin/ipfw/nat64lsn.c ============================================================================== --- head/sbin/ipfw/nat64lsn.c Mon Mar 18 10:39:14 2019 (r345262) +++ head/sbin/ipfw/nat64lsn.c Mon Mar 18 10:50:32 2019 (r345263) @@ -1,8 +1,9 @@ /*- - * Copyright (c) 2015-2016 Yandex LLC + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2015-2019 Yandex LLC * Copyright (c) 2015-2016 Alexander V. Chernikov - * Copyright (c) 2015-2016 Andrey V. Elsukov - * All rights reserved. + * Copyright (c) 2015-2019 Andrey V. Elsukov * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sbin/ipfw/nat64stl.c ============================================================================== --- head/sbin/ipfw/nat64stl.c Mon Mar 18 10:39:14 2019 (r345262) +++ head/sbin/ipfw/nat64stl.c Mon Mar 18 10:50:32 2019 (r345263) @@ -1,7 +1,8 @@ /*- - * Copyright (c) 2015-2016 Yandex LLC - * Copyright (c) 2015-2016 Andrey V. Elsukov - * All rights reserved. + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2015-2019 Yandex LLC + * Copyright (c) 2015-2019 Andrey V. Elsukov * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/netinet6/ip_fw_nat64.h ============================================================================== --- head/sys/netinet6/ip_fw_nat64.h Mon Mar 18 10:39:14 2019 (r345262) +++ head/sys/netinet6/ip_fw_nat64.h Mon Mar 18 10:50:32 2019 (r345263) @@ -1,8 +1,9 @@ /*- - * Copyright (c) 2015 Yandex LLC + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2015-2019 Yandex LLC * Copyright (c) 2015 Alexander V. Chernikov - * Copyright (c) 2016 Andrey V. Elsukov - * All rights reserved. + * Copyright (c) 2015-2019 Andrey V. Elsukov * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/netpfil/ipfw/nat64/ip_fw_nat64.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/ip_fw_nat64.c Mon Mar 18 10:39:14 2019 (r345262) +++ head/sys/netpfil/ipfw/nat64/ip_fw_nat64.c Mon Mar 18 10:50:32 2019 (r345263) @@ -1,7 +1,8 @@ /*- - * Copyright (c) 2015-2018 Yandex LLC - * Copyright (c) 2015-2018 Andrey V. Elsukov - * All rights reserved. + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2015-2019 Yandex LLC + * Copyright (c) 2015-2019 Andrey V. Elsukov * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/netpfil/ipfw/nat64/ip_fw_nat64.h ============================================================================== --- head/sys/netpfil/ipfw/nat64/ip_fw_nat64.h Mon Mar 18 10:39:14 2019 (r345262) +++ head/sys/netpfil/ipfw/nat64/ip_fw_nat64.h Mon Mar 18 10:50:32 2019 (r345263) @@ -1,7 +1,8 @@ /*- - * Copyright (c) 2015-2018 Yandex LLC - * Copyright (c) 2015-2018 Andrey V. Elsukov - * All rights reserved. + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2015-2019 Yandex LLC + * Copyright (c) 2015-2019 Andrey V. Elsukov * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/netpfil/ipfw/nat64/nat64_translate.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64_translate.c Mon Mar 18 10:39:14 2019 (r345262) +++ head/sys/netpfil/ipfw/nat64/nat64_translate.c Mon Mar 18 10:50:32 2019 (r345263) @@ -1,7 +1,8 @@ /*- - * Copyright (c) 2015-2018 Yandex LLC - * Copyright (c) 2015-2018 Andrey V. Elsukov - * All rights reserved. + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2015-2019 Yandex LLC + * Copyright (c) 2015-2019 Andrey V. Elsukov * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/netpfil/ipfw/nat64/nat64_translate.h ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64_translate.h Mon Mar 18 10:39:14 2019 (r345262) +++ head/sys/netpfil/ipfw/nat64/nat64_translate.h Mon Mar 18 10:50:32 2019 (r345263) @@ -1,7 +1,8 @@ /*- - * Copyright (c) 2015-2018 Yandex LLC - * Copyright (c) 2015-2018 Andrey V. Elsukov - * All rights reserved. + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2015-2019 Yandex LLC + * Copyright (c) 2015-2019 Andrey V. Elsukov * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/netpfil/ipfw/nat64/nat64lsn.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64lsn.c Mon Mar 18 10:39:14 2019 (r345262) +++ head/sys/netpfil/ipfw/nat64/nat64lsn.c Mon Mar 18 10:50:32 2019 (r345263) @@ -1,8 +1,9 @@ /*- - * Copyright (c) 2015-2016 Yandex LLC + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2015-2019 Yandex LLC * Copyright (c) 2015 Alexander V. Chernikov - * Copyright (c) 2016 Andrey V. Elsukov - * All rights reserved. + * Copyright (c) 2016-2019 Andrey V. Elsukov * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/netpfil/ipfw/nat64/nat64lsn.h ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64lsn.h Mon Mar 18 10:39:14 2019 (r345262) +++ head/sys/netpfil/ipfw/nat64/nat64lsn.h Mon Mar 18 10:50:32 2019 (r345263) @@ -1,8 +1,9 @@ /*- - * Copyright (c) 2015 Yandex LLC + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2015-2019 Yandex LLC * Copyright (c) 2015 Alexander V. Chernikov - * Copyright (c) 2016 Andrey V. Elsukov - * All rights reserved. + * Copyright (c) 2015-2019 Andrey V. Elsukov * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/netpfil/ipfw/nat64/nat64lsn_control.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64lsn_control.c Mon Mar 18 10:39:14 2019 (r345262) +++ head/sys/netpfil/ipfw/nat64/nat64lsn_control.c Mon Mar 18 10:50:32 2019 (r345263) @@ -1,8 +1,9 @@ /*- - * Copyright (c) 2015 Yandex LLC + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2015-2019 Yandex LLC * Copyright (c) 2015 Alexander V. Chernikov - * Copyright (c) 2016 Andrey V. Elsukov - * All rights reserved. + * Copyright (c) 2015-2019 Andrey V. Elsukov * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/netpfil/ipfw/nat64/nat64stl.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64stl.c Mon Mar 18 10:39:14 2019 (r345262) +++ head/sys/netpfil/ipfw/nat64/nat64stl.c Mon Mar 18 10:50:32 2019 (r345263) @@ -1,7 +1,8 @@ /*- - * Copyright (c) 2015-2016 Yandex LLC - * Copyright (c) 2015-2016 Andrey V. Elsukov - * All rights reserved. + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2015-2019 Yandex LLC + * Copyright (c) 2015-2019 Andrey V. Elsukov * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/netpfil/ipfw/nat64/nat64stl.h ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64stl.h Mon Mar 18 10:39:14 2019 (r345262) +++ head/sys/netpfil/ipfw/nat64/nat64stl.h Mon Mar 18 10:50:32 2019 (r345263) @@ -1,7 +1,8 @@ /*- - * Copyright (c) 2015-2016 Yandex LLC - * Copyright (c) 2015-2016 Andrey V. Elsukov - * All rights reserved. + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2015-2019 Yandex LLC + * Copyright (c) 2015-2019 Andrey V. Elsukov * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions Modified: head/sys/netpfil/ipfw/nat64/nat64stl_control.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64stl_control.c Mon Mar 18 10:39:14 2019 (r345262) +++ head/sys/netpfil/ipfw/nat64/nat64stl_control.c Mon Mar 18 10:50:32 2019 (r345263) @@ -1,8 +1,9 @@ /*- - * Copyright (c) 2015-2016 Yandex LLC - * Copyright (c) 2015-2016 Andrey V. Elsukov + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2015-2019 Yandex LLC * Copyright (c) 2015 Alexander V. Chernikov - * All rights reserved. + * Copyright (c) 2015-2019 Andrey V. Elsukov * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From owner-svn-src-head@freebsd.org Mon Mar 18 11:44:57 2019 Return-Path: Delivered-To: svn-src-head@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 35452153B4FA; Mon, 18 Mar 2019 11:44:57 +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 C489585082; Mon, 18 Mar 2019 11:44: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 98A9A20E3E; Mon, 18 Mar 2019 11:44:56 +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 x2IBiuvR076645; Mon, 18 Mar 2019 11:44:56 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2IBis4Q076628; Mon, 18 Mar 2019 11:44:54 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201903181144.x2IBis4Q076628@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 18 Mar 2019 11:44:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345264 - in head: sbin/ipfw sys/conf sys/modules/ipfw_nat64 sys/netinet sys/netinet6 sys/netpfil/ipfw/nat64 X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in head: sbin/ipfw sys/conf sys/modules/ipfw_nat64 sys/netinet sys/netinet6 sys/netpfil/ipfw/nat64 X-SVN-Commit-Revision: 345264 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C489585082 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.997,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2019 11:44:57 -0000 Author: ae Date: Mon Mar 18 11:44:53 2019 New Revision: 345264 URL: https://svnweb.freebsd.org/changeset/base/345264 Log: Add NAT64 CLAT implementation as defined in RFC6877. CLAT is customer-side translator that algorithmically translates 1:1 private IPv4 addresses to global IPv6 addresses, and vice versa. It is implemented as part of ipfw_nat64 kernel module. When module is loaded or compiled into the kernel, it registers "nat64clat" external action. External action named instance can be created using `create` command and then used in ipfw rules. The create command accepts two IPv6 prefixes `plat_prefix` and `clat_prefix`. If plat_prefix is ommitted, IPv6 NAT64 Well-Known prefix 64:ff9b::/96 will be used. # ipfw nat64clat CLAT create clat_prefix SRC_PFX plat_prefix DST_PFX # ipfw add nat64clat CLAT ip4 from IPv4_PFX to any out # ipfw add nat64clat CLAT ip6 from DST_PFX to SRC_PFX in Obtained from: Yandex LLC Submitted by: Boris N. Lytochkin MFC after: 1 month Relnotes: yes Sponsored by: Yandex LLC Added: head/sbin/ipfw/nat64clat.c (contents, props changed) head/sys/netpfil/ipfw/nat64/nat64clat.c (contents, props changed) head/sys/netpfil/ipfw/nat64/nat64clat.h (contents, props changed) head/sys/netpfil/ipfw/nat64/nat64clat_control.c (contents, props changed) Modified: head/sbin/ipfw/Makefile head/sbin/ipfw/ipfw.8 head/sbin/ipfw/ipfw2.c head/sbin/ipfw/ipfw2.h head/sbin/ipfw/main.c head/sys/conf/files head/sys/modules/ipfw_nat64/Makefile head/sys/netinet/ip_fw.h head/sys/netinet6/ip_fw_nat64.h head/sys/netpfil/ipfw/nat64/ip_fw_nat64.c head/sys/netpfil/ipfw/nat64/ip_fw_nat64.h Modified: head/sbin/ipfw/Makefile ============================================================================== --- head/sbin/ipfw/Makefile Mon Mar 18 10:50:32 2019 (r345263) +++ head/sbin/ipfw/Makefile Mon Mar 18 11:44:53 2019 (r345264) @@ -5,7 +5,7 @@ PACKAGE=ipfw PROG= ipfw SRCS= ipfw2.c dummynet.c ipv6.c main.c nat.c tables.c -SRCS+= nat64lsn.c nat64stl.c nptv6.c +SRCS+= nat64clat.c nat64lsn.c nat64stl.c nptv6.c WARNS?= 2 .if ${MK_PF} != "no" Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Mon Mar 18 10:50:32 2019 (r345263) +++ head/sbin/ipfw/ipfw.8 Mon Mar 18 11:44:53 2019 (r345264) @@ -136,6 +136,21 @@ in-kernel NAT. .Cm destroy .Nm .Oo Cm set Ar N Oc Cm nat64stl Ar name Cm stats Op Cm reset +.Ss XLAT464 CLAT IPv6/IPv4 NETWORK ADDRESS AND PROTOCOL TRANSLATION +.Nm +.Oo Cm set Ar N Oc Cm nat64clat Ar name Cm create Ar create-options +.Nm +.Oo Cm set Ar N Oc Cm nat64clat Ar name Cm config Ar config-options +.Nm +.Oo Cm set Ar N Oc Cm nat64clat +.Brq Ar name | all +.Brq Cm list | show +.Nm +.Oo Cm set Ar N Oc Cm nat64clat +.Brq Ar name | all +.Cm destroy +.Nm +.Oo Cm set Ar N Oc Cm nat64clat Ar name Cm stats Op Cm reset .Ss IPv6-to-IPv6 NETWORK PREFIX TRANSLATION .Nm .Oo Cm set Ar N Oc Cm nptv6 Ar name Cm create Ar create-options @@ -924,6 +939,11 @@ Pass packet to a stateless NAT64 instance (for IPv6/IP protocol translation): see the .Sx IPv6/IPv4 NETWORK ADDRESS AND PROTOCOL TRANSLATION Section for further information. +.It Cm nat64clat Ar name +Pass packet to a CLAT NAT64 instance (for client-side IPv6/IPv4 network address and +protocol translation): see the +.Sx IPv6/IPv4 NETWORK ADDRESS AND PROTOCOL TRANSLATION +Section for further information. .It Cm nptv6 Ar name Pass packet to a NPTv6 instance (for IPv6-to-IPv6 network prefix translation): see the @@ -3482,6 +3502,57 @@ Note that the behavior of stateless translator with re packets differs from stateful translator. If corresponding addresses was not found in the lookup tables, the packet will not be dropped and the search continues. +.Pp +.Pp +.Ss XLAT464 CLAT translation +XLAT464 CLAT NAT64 translator implements client-side stateless translation as +defined in RFC6877 and is very similar to statless NAT64 translator +explained above. Instead of lookup tables it uses one-to-one mapping +between IPv4 and IPv6 addresses using configured prefixes. +This mode can be used as a replacement of DNS64 service for applications +that are not using it (e.g. VoIP) allowing them to access IPv4-only Internet +over IPv6-only networks with help of remote NAT64 translator. +.Pp +The CLAT NAT64 configuration command is the following: +.Bd -ragged -offset indent +.Bk -words +.Cm nat64clat +.Ar name +.Cm create +.Ar create-options +.Ek +.Ed +.Pp +The following parameters can be configured: +.Bl -tag -width indent +.It Cm clat_prefix Ar ipv6_prefix/length +The IPv6 prefix defines IPv4-embedded IPv6 addresses used by translator +to represent source IPv4 addresses. +.It Cm plat_prefix Ar ipv6_prefix/length +The IPv6 prefix defines IPv4-embedded IPv6 addresses used by translator +to represent destination IPv4 addresses. This IPv6 prefix should be configured +on a remote NAT64 translator. +.It Cm log +Turn on logging of all handled packets via BPF through +.Ar ipfwlog0 +interface. +.It Cm -log +Turn off logging of all handled packets via BPF. +.It Cm allow_private +Turn on processing private IPv4 addresses. By default +.Nm nat64clat +instance will not process IPv4 packets with destination address from private +ranges as defined in RFC1918. +.It Cm -allow_private +Turn off private address handling in +.Nm nat64clat +instance. +.El +.Pp +Note that the behavior of CLAT translator with respect to not matched +packets differs from stateful translator. +If corresponding addresses were not matched against prefixes configured, +the packet will not be dropped and the search continues. .Sh IPv6-to-IPv6 NETWORK PREFIX TRANSLATION (NPTv6) .Nm supports in-kernel IPv6-to-IPv6 network prefix translation as described Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Mon Mar 18 10:50:32 2019 (r345263) +++ head/sbin/ipfw/ipfw2.c Mon Mar 18 11:44:53 2019 (r345264) @@ -237,6 +237,7 @@ static struct _s_x ether_types[] = { }; static struct _s_x rule_eactions[] = { + { "nat64clat", TOK_NAT64CLAT }, { "nat64lsn", TOK_NAT64LSN }, { "nat64stl", TOK_NAT64STL }, { "nptv6", TOK_NPTV6 }, Modified: head/sbin/ipfw/ipfw2.h ============================================================================== --- head/sbin/ipfw/ipfw2.h Mon Mar 18 10:50:32 2019 (r345263) +++ head/sbin/ipfw/ipfw2.h Mon Mar 18 11:44:53 2019 (r345264) @@ -291,6 +291,11 @@ enum tokens { TOK_PRIVATE, TOK_PRIVATEOFF, + /* NAT64 CLAT tokens */ + TOK_NAT64CLAT, + TOK_PLAT_PREFIX, + TOK_CLAT_PREFIX, + /* NPTv6 tokens */ TOK_NPTV6, TOK_INTPREFIX, @@ -387,6 +392,7 @@ void ipfw_flush(int force); void ipfw_zero(int ac, char *av[], int optname); void ipfw_list(int ac, char *av[], int show_counters); void ipfw_internal_handler(int ac, char *av[]); +void ipfw_nat64clat_handler(int ac, char *av[]); void ipfw_nat64lsn_handler(int ac, char *av[]); void ipfw_nat64stl_handler(int ac, char *av[]); void ipfw_nptv6_handler(int ac, char *av[]); Modified: head/sbin/ipfw/main.c ============================================================================== --- head/sbin/ipfw/main.c Mon Mar 18 10:50:32 2019 (r345263) +++ head/sbin/ipfw/main.c Mon Mar 18 11:44:53 2019 (r345264) @@ -429,6 +429,8 @@ ipfw_main(int oldac, char **oldav) if (co.use_set || try_next) { if (_substrcmp(*av, "delete") == 0) ipfw_delete(av); + else if (!strncmp(*av, "nat64clat", strlen(*av))) + ipfw_nat64clat_handler(ac, av); else if (!strncmp(*av, "nat64stl", strlen(*av))) ipfw_nat64stl_handler(ac, av); else if (!strncmp(*av, "nat64lsn", strlen(*av))) Added: head/sbin/ipfw/nat64clat.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/ipfw/nat64clat.c Mon Mar 18 11:44:53 2019 (r345264) @@ -0,0 +1,535 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Yandex LLC + * Copyright (c) 2019 Andrey V. Elsukov + * Copyright (c) 2019 Boris N. Lytochkin + * + * 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 ``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 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 "ipfw2.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +typedef int (nat64clat_cb_t)(ipfw_nat64clat_cfg *i, const char *name, + uint8_t set); +static int nat64clat_foreach(nat64clat_cb_t *f, const char *name, uint8_t set, + int sort); + +static void nat64clat_create(const char *name, uint8_t set, int ac, char **av); +static void nat64clat_config(const char *name, uint8_t set, int ac, char **av); +static void nat64clat_destroy(const char *name, uint8_t set); +static void nat64clat_stats(const char *name, uint8_t set); +static void nat64clat_reset_stats(const char *name, uint8_t set); +static int nat64clat_show_cb(ipfw_nat64clat_cfg *cfg, const char *name, + uint8_t set); +static int nat64clat_destroy_cb(ipfw_nat64clat_cfg *cfg, const char *name, + uint8_t set); + +static struct _s_x nat64cmds[] = { + { "create", TOK_CREATE }, + { "config", TOK_CONFIG }, + { "destroy", TOK_DESTROY }, + { "list", TOK_LIST }, + { "show", TOK_LIST }, + { "stats", TOK_STATS }, + { NULL, 0 } +}; + +static struct _s_x nat64statscmds[] = { + { "reset", TOK_RESET }, + { NULL, 0 } +}; + +/* + * This one handles all nat64clat-related commands + * ipfw [set N] nat64clat NAME {create | config} ... + * ipfw [set N] nat64clat NAME stats [reset] + * ipfw [set N] nat64clat {NAME | all} destroy + * ipfw [set N] nat64clat {NAME | all} {list | show} + */ +#define nat64clat_check_name table_check_name +void +ipfw_nat64clat_handler(int ac, char *av[]) +{ + const char *name; + int tcmd; + uint8_t set; + + if (co.use_set != 0) + set = co.use_set - 1; + else + set = 0; + ac--; av++; + + NEED1("nat64clat needs instance name"); + name = *av; + if (nat64clat_check_name(name) != 0) { + if (strcmp(name, "all") == 0) + name = NULL; + else + errx(EX_USAGE, "nat64clat instance name %s is invalid", + name); + } + ac--; av++; + NEED1("nat64clat needs command"); + + tcmd = get_token(nat64cmds, *av, "nat64clat command"); + if (name == NULL && tcmd != TOK_DESTROY && tcmd != TOK_LIST) + errx(EX_USAGE, "nat64clat instance name required"); + switch (tcmd) { + case TOK_CREATE: + ac--; av++; + nat64clat_create(name, set, ac, av); + break; + case TOK_CONFIG: + ac--; av++; + nat64clat_config(name, set, ac, av); + break; + case TOK_LIST: + nat64clat_foreach(nat64clat_show_cb, name, set, 1); + break; + case TOK_DESTROY: + if (name == NULL) + nat64clat_foreach(nat64clat_destroy_cb, NULL, set, 0); + else + nat64clat_destroy(name, set); + break; + case TOK_STATS: + ac--; av++; + if (ac == 0) { + nat64clat_stats(name, set); + break; + } + tcmd = get_token(nat64statscmds, *av, "stats command"); + if (tcmd == TOK_RESET) + nat64clat_reset_stats(name, set); + } +} + + +static void +nat64clat_fill_ntlv(ipfw_obj_ntlv *ntlv, const char *name, uint8_t set) +{ + + ntlv->head.type = IPFW_TLV_EACTION_NAME(1); /* it doesn't matter */ + ntlv->head.length = sizeof(ipfw_obj_ntlv); + ntlv->idx = 1; + ntlv->set = set; + strlcpy(ntlv->name, name, sizeof(ntlv->name)); +} + +static struct _s_x nat64newcmds[] = { + { "plat_prefix", TOK_PLAT_PREFIX }, + { "clat_prefix", TOK_CLAT_PREFIX }, + { "log", TOK_LOG }, + { "-log", TOK_LOGOFF }, + { "allow_private", TOK_PRIVATE }, + { "-allow_private", TOK_PRIVATEOFF }, + { NULL, 0 } +}; + +/* + * Creates new nat64clat instance + * ipfw nat64clat create clat_prefix plat_prefix + * Request: [ ipfw_obj_lheader ipfw_nat64clat_cfg ] + */ +#define NAT64CLAT_HAS_CLAT_PREFIX 0x01 +#define NAT64CLAT_HAS_PLAT_PREFIX 0x02 +static void +nat64clat_create(const char *name, uint8_t set, int ac, char *av[]) +{ + char buf[sizeof(ipfw_obj_lheader) + sizeof(ipfw_nat64clat_cfg)]; + ipfw_nat64clat_cfg *cfg; + ipfw_obj_lheader *olh; + int tcmd, flags; + char *p; + struct in6_addr prefix; + uint8_t plen; + + memset(buf, 0, sizeof(buf)); + olh = (ipfw_obj_lheader *)buf; + cfg = (ipfw_nat64clat_cfg *)(olh + 1); + + /* Some reasonable defaults */ + inet_pton(AF_INET6, "64:ff9b::", &cfg->plat_prefix); + cfg->plat_plen = 96; + cfg->set = set; + flags = NAT64CLAT_HAS_PLAT_PREFIX; + while (ac > 0) { + tcmd = get_token(nat64newcmds, *av, "option"); + ac--; av++; + + switch (tcmd) { + case TOK_PLAT_PREFIX: + case TOK_CLAT_PREFIX: + if (tcmd == TOK_PLAT_PREFIX) { + NEED1("IPv6 plat_prefix required"); + } else { + NEED1("IPv6 clat_prefix required"); + } + + if ((p = strchr(*av, '/')) != NULL) + *p++ = '\0'; + if (inet_pton(AF_INET6, *av, &prefix) != 1) + errx(EX_USAGE, + "Bad prefix: %s", *av); + plen = strtol(p, NULL, 10); + if (ipfw_check_nat64prefix(&prefix, plen) != 0) + errx(EX_USAGE, + "Bad prefix length: %s", p); + if (tcmd == TOK_PLAT_PREFIX) { + flags |= NAT64CLAT_HAS_PLAT_PREFIX; + cfg->plat_prefix = prefix; + cfg->plat_plen = plen; + } else { + flags |= NAT64CLAT_HAS_CLAT_PREFIX; + cfg->clat_prefix = prefix; + cfg->clat_plen = plen; + } + ac--; av++; + break; + case TOK_LOG: + cfg->flags |= NAT64_LOG; + break; + case TOK_LOGOFF: + cfg->flags &= ~NAT64_LOG; + break; + case TOK_PRIVATE: + cfg->flags |= NAT64_ALLOW_PRIVATE; + break; + case TOK_PRIVATEOFF: + cfg->flags &= ~NAT64_ALLOW_PRIVATE; + break; + } + } + + /* Check validness */ + if ((flags & NAT64CLAT_HAS_PLAT_PREFIX) != NAT64CLAT_HAS_PLAT_PREFIX) + errx(EX_USAGE, "plat_prefix required"); + if ((flags & NAT64CLAT_HAS_CLAT_PREFIX) != NAT64CLAT_HAS_CLAT_PREFIX) + errx(EX_USAGE, "clat_prefix required"); + + olh->count = 1; + olh->objsize = sizeof(*cfg); + olh->size = sizeof(buf); + strlcpy(cfg->name, name, sizeof(cfg->name)); + if (do_set3(IP_FW_NAT64CLAT_CREATE, &olh->opheader, sizeof(buf)) != 0) + err(EX_OSERR, "nat64clat instance creation failed"); +} + +/* + * Configures existing nat64clat instance + * ipfw nat64clat config + * Request: [ ipfw_obj_header ipfw_nat64clat_cfg ] + */ +static void +nat64clat_config(const char *name, uint8_t set, int ac, char **av) +{ + char buf[sizeof(ipfw_obj_header) + sizeof(ipfw_nat64clat_cfg)]; + ipfw_nat64clat_cfg *cfg; + ipfw_obj_header *oh; + char *opt; + char *p; + size_t sz; + int tcmd; + struct in6_addr prefix; + uint8_t plen; + + if (ac == 0) + errx(EX_USAGE, "config options required"); + memset(&buf, 0, sizeof(buf)); + oh = (ipfw_obj_header *)buf; + cfg = (ipfw_nat64clat_cfg *)(oh + 1); + sz = sizeof(buf); + + nat64clat_fill_ntlv(&oh->ntlv, name, set); + if (do_get3(IP_FW_NAT64CLAT_CONFIG, &oh->opheader, &sz) != 0) + err(EX_OSERR, "failed to get config for instance %s", name); + + while (ac > 0) { + tcmd = get_token(nat64newcmds, *av, "option"); + opt = *av; + ac--; av++; + + switch (tcmd) { + case TOK_PLAT_PREFIX: + case TOK_CLAT_PREFIX: + if (tcmd == TOK_PLAT_PREFIX) { + NEED1("IPv6 plat_prefix required"); + } else { + NEED1("IPv6 clat_prefix required"); + } + + if ((p = strchr(*av, '/')) != NULL) + *p++ = '\0'; + if (inet_pton(AF_INET6, *av, &prefix) != 1) + errx(EX_USAGE, + "Bad prefix: %s", *av); + plen = strtol(p, NULL, 10); + if (ipfw_check_nat64prefix(&prefix, plen) != 0) + errx(EX_USAGE, + "Bad prefix length: %s", p); + if (tcmd == TOK_PLAT_PREFIX) { + cfg->plat_prefix = prefix; + cfg->plat_plen = plen; + } else { + cfg->clat_prefix = prefix; + cfg->clat_plen = plen; + } + ac--; av++; + break; + case TOK_LOG: + cfg->flags |= NAT64_LOG; + break; + case TOK_LOGOFF: + cfg->flags &= ~NAT64_LOG; + break; + case TOK_PRIVATE: + cfg->flags |= NAT64_ALLOW_PRIVATE; + break; + case TOK_PRIVATEOFF: + cfg->flags &= ~NAT64_ALLOW_PRIVATE; + break; + default: + errx(EX_USAGE, "Can't change %s option", opt); + } + } + + if (do_set3(IP_FW_NAT64CLAT_CONFIG, &oh->opheader, sizeof(buf)) != 0) + err(EX_OSERR, "nat64clat instance configuration failed"); +} + +/* + * Destroys nat64clat instance. + * Request: [ ipfw_obj_header ] + */ +static void +nat64clat_destroy(const char *name, uint8_t set) +{ + ipfw_obj_header oh; + + memset(&oh, 0, sizeof(oh)); + nat64clat_fill_ntlv(&oh.ntlv, name, set); + if (do_set3(IP_FW_NAT64CLAT_DESTROY, &oh.opheader, sizeof(oh)) != 0) + err(EX_OSERR, "failed to destroy nat instance %s", name); +} + +/* + * Get nat64clat instance statistics. + * Request: [ ipfw_obj_header ] + * Reply: [ ipfw_obj_header ipfw_obj_ctlv [ uint64_t x N ] ] + */ +static int +nat64clat_get_stats(const char *name, uint8_t set, + struct ipfw_nat64clat_stats *stats) +{ + ipfw_obj_header *oh; + ipfw_obj_ctlv *oc; + size_t sz; + + sz = sizeof(*oh) + sizeof(*oc) + sizeof(*stats); + oh = calloc(1, sz); + nat64clat_fill_ntlv(&oh->ntlv, name, set); + if (do_get3(IP_FW_NAT64CLAT_STATS, &oh->opheader, &sz) == 0) { + oc = (ipfw_obj_ctlv *)(oh + 1); + memcpy(stats, oc + 1, sizeof(*stats)); + free(oh); + return (0); + } + free(oh); + return (-1); +} + +static void +nat64clat_stats(const char *name, uint8_t set) +{ + struct ipfw_nat64clat_stats stats; + + if (nat64clat_get_stats(name, set, &stats) != 0) + err(EX_OSERR, "Error retrieving stats"); + + if (co.use_set != 0 || set != 0) + printf("set %u ", set); + printf("nat64clat %s\n", name); + + printf("\t%ju packets translated from IPv6 to IPv4\n", + (uintmax_t)stats.opcnt64); + printf("\t%ju packets translated from IPv4 to IPv6\n", + (uintmax_t)stats.opcnt46); + printf("\t%ju IPv6 fragments created\n", + (uintmax_t)stats.ofrags); + printf("\t%ju IPv4 fragments received\n", + (uintmax_t)stats.ifrags); + printf("\t%ju output packets dropped due to no bufs, etc.\n", + (uintmax_t)stats.oerrors); + printf("\t%ju output packets discarded due to no IPv4 route\n", + (uintmax_t)stats.noroute4); + printf("\t%ju output packets discarded due to no IPv6 route\n", + (uintmax_t)stats.noroute6); + printf("\t%ju packets discarded due to unsupported protocol\n", + (uintmax_t)stats.noproto); + printf("\t%ju packets discarded due to memory allocation problems\n", + (uintmax_t)stats.nomem); + printf("\t%ju packets discarded due to some errors\n", + (uintmax_t)stats.dropped); +} + +/* + * Reset nat64clat instance statistics specified by @oh->ntlv. + * Request: [ ipfw_obj_header ] + */ +static void +nat64clat_reset_stats(const char *name, uint8_t set) +{ + ipfw_obj_header oh; + + memset(&oh, 0, sizeof(oh)); + nat64clat_fill_ntlv(&oh.ntlv, name, set); + if (do_set3(IP_FW_NAT64CLAT_RESET_STATS, &oh.opheader, sizeof(oh)) != 0) + err(EX_OSERR, "failed to reset stats for instance %s", name); +} + +static int +nat64clat_show_cb(ipfw_nat64clat_cfg *cfg, const char *name, uint8_t set) +{ + char plat_buf[INET6_ADDRSTRLEN], clat_buf[INET6_ADDRSTRLEN]; + + if (name != NULL && strcmp(cfg->name, name) != 0) + return (ESRCH); + + if (co.use_set != 0 && cfg->set != set) + return (ESRCH); + + if (co.use_set != 0 || cfg->set != 0) + printf("set %u ", cfg->set); + + inet_ntop(AF_INET6, &cfg->clat_prefix, clat_buf, sizeof(clat_buf)); + inet_ntop(AF_INET6, &cfg->plat_prefix, plat_buf, sizeof(plat_buf)); + printf("nat64clat %s clat_prefix %s/%u plat_prefix %s/%u", + cfg->name, clat_buf, cfg->clat_plen, plat_buf, cfg->plat_plen); + if (cfg->flags & NAT64_LOG) + printf(" log"); + if (cfg->flags & NAT64_ALLOW_PRIVATE) + printf(" allow_private"); + printf("\n"); + return (0); +} + +static int +nat64clat_destroy_cb(ipfw_nat64clat_cfg *cfg, const char *name, uint8_t set) +{ + + if (co.use_set != 0 && cfg->set != set) + return (ESRCH); + + nat64clat_destroy(cfg->name, cfg->set); + return (0); +} + + +/* + * Compare nat64clat instances names. + * Honor number comparison. + */ +static int +nat64name_cmp(const void *a, const void *b) +{ + ipfw_nat64clat_cfg *ca, *cb; + + ca = (ipfw_nat64clat_cfg *)a; + cb = (ipfw_nat64clat_cfg *)b; + + if (ca->set > cb->set) + return (1); + else if (ca->set < cb->set) + return (-1); + return (stringnum_cmp(ca->name, cb->name)); +} + +/* + * Retrieves nat64clat instance list from kernel, + * optionally sorts it and calls requested function for each instance. + * + * Request: [ ipfw_obj_lheader ] + * Reply: [ ipfw_obj_lheader ipfw_nat64clat_cfg x N ] + */ +static int +nat64clat_foreach(nat64clat_cb_t *f, const char *name, uint8_t set, int sort) +{ + ipfw_obj_lheader *olh; + ipfw_nat64clat_cfg *cfg; + size_t sz; + int i, error; + + /* Start with reasonable default */ + sz = sizeof(*olh) + 16 * sizeof(*cfg); + for (;;) { + if ((olh = calloc(1, sz)) == NULL) + return (ENOMEM); + + olh->size = sz; + if (do_get3(IP_FW_NAT64CLAT_LIST, &olh->opheader, &sz) != 0) { + sz = olh->size; + free(olh); + if (errno != ENOMEM) + return (errno); + continue; + } + + if (sort != 0) + qsort(olh + 1, olh->count, olh->objsize, + nat64name_cmp); + + cfg = (ipfw_nat64clat_cfg *)(olh + 1); + for (i = 0; i < olh->count; i++) { + error = f(cfg, name, set); /* Ignore errors for now */ + cfg = (ipfw_nat64clat_cfg *)((caddr_t)cfg + + olh->objsize); + } + free(olh); + break; + } + return (0); +} + Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Mar 18 10:50:32 2019 (r345263) +++ head/sys/conf/files Mon Mar 18 11:44:53 2019 (r345264) @@ -4393,6 +4393,10 @@ netpfil/ipfw/ip_fw_iface.c optional inet ipfirewall netpfil/ipfw/ip_fw_nat.c optional inet ipfirewall_nat netpfil/ipfw/nat64/ip_fw_nat64.c optional inet inet6 ipfirewall \ ipfirewall_nat64 +netpfil/ipfw/nat64/nat64clat.c optional inet inet6 ipfirewall \ + ipfirewall_nat64 +netpfil/ipfw/nat64/nat64clat_control.c optional inet inet6 ipfirewall \ + ipfirewall_nat64 netpfil/ipfw/nat64/nat64lsn.c optional inet inet6 ipfirewall \ ipfirewall_nat64 netpfil/ipfw/nat64/nat64lsn_control.c optional inet inet6 ipfirewall \ Modified: head/sys/modules/ipfw_nat64/Makefile ============================================================================== --- head/sys/modules/ipfw_nat64/Makefile Mon Mar 18 10:50:32 2019 (r345263) +++ head/sys/modules/ipfw_nat64/Makefile Mon Mar 18 11:44:53 2019 (r345264) @@ -4,6 +4,7 @@ KMOD= ipfw_nat64 SRCS= ip_fw_nat64.c nat64_translate.c +SRCS+= nat64clat.c nat64clat_control.c SRCS+= nat64lsn.c nat64lsn_control.c SRCS+= nat64stl.c nat64stl_control.c Modified: head/sys/netinet/ip_fw.h ============================================================================== --- head/sys/netinet/ip_fw.h Mon Mar 18 10:50:32 2019 (r345263) +++ head/sys/netinet/ip_fw.h Mon Mar 18 11:44:53 2019 (r345264) @@ -134,6 +134,13 @@ typedef struct _ip_fw3_opheader { #define IP_FW_NPTV6_STATS 154 /* Get NPTv6 instance statistics */ #define IP_FW_NPTV6_RESET_STATS 155 /* Reset NPTv6 instance statistics */ +#define IP_FW_NAT64CLAT_CREATE 160 /* Create clat NAT64 instance */ +#define IP_FW_NAT64CLAT_DESTROY 161 /* Destroy clat NAT64 instance */ +#define IP_FW_NAT64CLAT_CONFIG 162 /* Modify clat NAT64 instance */ +#define IP_FW_NAT64CLAT_LIST 163 /* List clat NAT64 instances */ +#define IP_FW_NAT64CLAT_STATS 164 /* Get NAT64CLAT instance statistics */ +#define IP_FW_NAT64CLAT_RESET_STATS 165 /* Reset NAT64CLAT instance statistics */ + /* * The kernel representation of ipfw rules is made of a list of * 'instructions' (for all practical purposes equivalent to BPF Modified: head/sys/netinet6/ip_fw_nat64.h ============================================================================== --- head/sys/netinet6/ip_fw_nat64.h Mon Mar 18 10:50:32 2019 (r345263) +++ head/sys/netinet6/ip_fw_nat64.h Mon Mar 18 11:44:53 2019 (r345264) @@ -45,6 +45,19 @@ struct ipfw_nat64stl_stats { uint64_t dropped; /* dropped due to some errors */ }; +struct ipfw_nat64clat_stats { + uint64_t opcnt64; /* 6to4 of packets translated */ + uint64_t opcnt46; /* 4to6 of packets translated */ + uint64_t ofrags; /* number of fragments generated */ + uint64_t ifrags; /* number of fragments received */ + uint64_t oerrors; /* number of output errors */ + uint64_t noroute4; + uint64_t noroute6; + uint64_t noproto; /* Protocol not supported */ + uint64_t nomem; /* mbuf allocation failed */ + uint64_t dropped; /* dropped due to some errors */ +}; + struct ipfw_nat64lsn_stats { uint64_t opcnt64; /* 6to4 of packets translated */ uint64_t opcnt46; /* 4to6 of packets translated */ @@ -94,6 +107,17 @@ typedef struct _ipfw_nat64stl_cfg { uint8_t spare[2]; uint32_t flags; } ipfw_nat64stl_cfg; + +typedef struct _ipfw_nat64clat_cfg { + char name[64]; /* NAT name */ + struct in6_addr plat_prefix; /* NAT64 (PLAT) prefix */ + struct in6_addr clat_prefix; /* Client (CLAT) prefix */ + uint8_t plat_plen; /* PLAT Prefix length */ + uint8_t clat_plen; /* CLAT Prefix length */ + uint8_t set; /* Named instance set [0..31] */ + uint8_t spare; + uint32_t flags; +} ipfw_nat64clat_cfg; /* * NAT64LSN default configuration values Modified: head/sys/netpfil/ipfw/nat64/ip_fw_nat64.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/ip_fw_nat64.c Mon Mar 18 10:50:32 2019 (r345263) +++ head/sys/netpfil/ipfw/nat64/ip_fw_nat64.c Mon Mar 18 11:44:53 2019 (r345264) @@ -86,9 +86,15 @@ vnet_ipfw_nat64_init(const void *arg __unused) error = nat64stl_init(ch, first); if (error != 0) return (error); + error = nat64clat_init(ch, first); + if (error != 0) { + nat64stl_uninit(ch, first); + return (error); + } error = nat64lsn_init(ch, first); if (error != 0) { nat64stl_uninit(ch, first); + nat64clat_uninit(ch, first); return (error); } return (0); @@ -103,6 +109,7 @@ vnet_ipfw_nat64_uninit(const void *arg __unused) ch = &V_layer3_chain; last = IS_DEFAULT_VNET(curvnet) ? 1: 0; nat64stl_uninit(ch, last); + nat64clat_uninit(ch, last); nat64lsn_uninit(ch, last); return (0); } Modified: head/sys/netpfil/ipfw/nat64/ip_fw_nat64.h ============================================================================== --- head/sys/netpfil/ipfw/nat64/ip_fw_nat64.h Mon Mar 18 10:50:32 2019 (r345263) +++ head/sys/netpfil/ipfw/nat64/ip_fw_nat64.h Mon Mar 18 11:44:53 2019 (r345264) @@ -54,5 +54,7 @@ int nat64stl_init(struct ip_fw_chain *ch, int first); void nat64stl_uninit(struct ip_fw_chain *ch, int last); int nat64lsn_init(struct ip_fw_chain *ch, int first); void nat64lsn_uninit(struct ip_fw_chain *ch, int last); +int nat64clat_init(struct ip_fw_chain *ch, int first); +void nat64clat_uninit(struct ip_fw_chain *ch, int last); #endif /* _IP_FW_NAT64_H_ */ Added: head/sys/netpfil/ipfw/nat64/nat64clat.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/netpfil/ipfw/nat64/nat64clat.c Mon Mar 18 11:44:53 2019 (r345264) @@ -0,0 +1,255 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Yandex LLC + * Copyright (c) 2019 Andrey V. Elsukov + * Copyright (c) 2019 Boris N. Lytochkin + * + * 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "nat64clat.h" + +#define NAT64_LOOKUP(chain, cmd) \ + (struct nat64clat_cfg *)SRV_OBJECT((chain), (cmd)->arg1) + +static void +nat64clat_log(struct pfloghdr *plog, struct mbuf *m, sa_family_t family, + uint32_t kidx) +{ + static uint32_t pktid = 0; + + memset(plog, 0, sizeof(*plog)); + plog->length = PFLOG_REAL_HDRLEN; + plog->af = family; + plog->action = PF_NAT; + plog->dir = PF_IN; + plog->rulenr = htonl(kidx); + pktid++; + plog->subrulenr = htonl(pktid); + plog->ruleset[0] = '\0'; + strlcpy(plog->ifname, "NAT64CLAT", sizeof(plog->ifname)); + ipfw_bpf_mtap2(plog, PFLOG_HDRLEN, m); +} + +static int +nat64clat_handle_ip4(struct ip_fw_chain *chain, struct nat64clat_cfg *cfg, + struct mbuf *m) +{ + struct pfloghdr loghdr, *logdata; + struct in6_addr saddr, daddr; + struct ip *ip; + + ip = mtod(m, struct ip*); + /* source address for CLAT may be private with no harm */ + if (nat64_check_ip4(ip->ip_src.s_addr) != 0 || + nat64_check_ip4(ip->ip_dst.s_addr) != 0 || + nat64_check_private_ip4(&cfg->base, ip->ip_dst.s_addr) != 0) + return (NAT64SKIP); + + memcpy(&saddr, &cfg->base.clat_prefix, sizeof(saddr)); + nat64_embed_ip4(&saddr, cfg->base.clat_plen, ip->ip_src.s_addr); + memcpy(&daddr, &cfg->base.plat_prefix, sizeof(daddr)); + nat64_embed_ip4(&daddr, cfg->base.plat_plen, ip->ip_dst.s_addr); + if (cfg->base.flags & NAT64_LOG) { + logdata = &loghdr; + nat64clat_log(logdata, m, AF_INET, cfg->no.kidx); + } else + logdata = NULL; + return (nat64_do_handle_ip4(m, &saddr, &daddr, 0, &cfg->base, + logdata)); +} + +static int +nat64clat_handle_ip6(struct ip_fw_chain *chain, struct nat64clat_cfg *cfg, + struct mbuf *m) +{ + struct pfloghdr loghdr, *logdata; + struct ip6_hdr *ip6; + uint32_t aaddr; + + /* + * NOTE: we expect ipfw_chk() did m_pullup() up to upper level + * protocol's headers. Also we skip some checks, that ip6_input(), + * ip6_forward(), ip6_fastfwd() and ipfw_chk() already did. + */ + ip6 = mtod(m, struct ip6_hdr *); + /* Check ip6_dst matches configured prefix */ + if (memcmp(&ip6->ip6_dst, &cfg->base.clat_prefix, + cfg->base.clat_plen / 8) != 0) + return (NAT64SKIP); + /* Check ip6_src matches configured prefix */ + if (memcmp(&ip6->ip6_src, &cfg->base.plat_prefix, + cfg->base.plat_plen / 8) != 0) + return (NAT64SKIP); + + if (cfg->base.flags & NAT64_LOG) { + logdata = &loghdr; + nat64clat_log(logdata, m, AF_INET6, cfg->no.kidx); + } else + logdata = NULL; + + aaddr = nat64_extract_ip4(&ip6->ip6_src, cfg->base.plat_plen); + return (nat64_do_handle_ip6(m, aaddr, 0, &cfg->base, logdata)); +} + +static int +nat64clat_handle_icmp6(struct ip_fw_chain *chain, struct nat64clat_cfg *cfg, + struct mbuf *m) +{ + struct pfloghdr loghdr, *logdata; + struct nat64_counters *stats; + struct ip6_hdr *ip6i; + struct icmp6_hdr *icmp6; + uint32_t daddr; + int hlen, proto; + + hlen = 0; + stats = &cfg->base.stats; + proto = nat64_getlasthdr(m, &hlen); + if (proto != IPPROTO_ICMPV6) { + NAT64STAT_INC(stats, dropped); + return (NAT64MFREE); + } + icmp6 = mtodo(m, hlen); + switch (icmp6->icmp6_type) { + case ICMP6_DST_UNREACH: + case ICMP6_PACKET_TOO_BIG: + case ICMP6_TIME_EXCEED_TRANSIT: + case ICMP6_PARAM_PROB: + break; + default: + NAT64STAT_INC(stats, dropped); + return (NAT64MFREE); + } + hlen += sizeof(struct icmp6_hdr); + if (m->m_pkthdr.len < hlen + sizeof(struct ip6_hdr) + ICMP_MINLEN) { + NAT64STAT_INC(stats, dropped); + return (NAT64MFREE); + } + if (m->m_len < hlen + sizeof(struct ip6_hdr) + ICMP_MINLEN) + m = m_pullup(m, hlen + sizeof(struct ip6_hdr) + ICMP_MINLEN); + if (m == NULL) { + NAT64STAT_INC(stats, nomem); + return (NAT64RETURN); + } + /* + * Use destination address from inner IPv6 header to determine + * IPv4 mapped address. + */ + ip6i = mtodo(m, hlen); + daddr = nat64_extract_ip4(&ip6i->ip6_dst, cfg->base.clat_plen); + if (daddr == 0) { + NAT64STAT_INC(stats, dropped); + return (NAT64MFREE); + } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Mon Mar 18 12:22:25 2019 Return-Path: Delivered-To: svn-src-head@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 5F81F153D29F; Mon, 18 Mar 2019 12:22:25 +0000 (UTC) (envelope-from vmaffione@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 0F74686BBD; Mon, 18 Mar 2019 12:22:25 +0000 (UTC) (envelope-from vmaffione@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 DEA77214F2; Mon, 18 Mar 2019 12:22:24 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2ICMOmT097626; Mon, 18 Mar 2019 12:22:24 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2ICMNNb097620; Mon, 18 Mar 2019 12:22:23 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201903181222.x2ICMNNb097620@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Mon, 18 Mar 2019 12:22:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345269 - in head/sys: dev/netmap net X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: in head/sys: dev/netmap net X-SVN-Commit-Revision: 345269 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0F74686BBD 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.96)[-0.958,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2019 12:22:25 -0000 Author: vmaffione Date: Mon Mar 18 12:22:23 2019 New Revision: 345269 URL: https://svnweb.freebsd.org/changeset/base/345269 Log: netmap: add support for multiple host rings Some applications forward from/to host rings most or all the traffic received or sent on a physical interface. In this cases it is desirable to have more than a pair of RX/TX host rings, and use multiple threads to speed up forwarding. This change adds support for multiple host rings. On registering a netmap port, the user can specify the number of desired receive and transmit host rings in the nr_host_tx_rings and nr_host_rx_rings fields of the nmreq_register structure. MFC after: 2 weeks Modified: head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_legacy.c head/sys/dev/netmap/netmap_mem2.c head/sys/net/netmap.h head/sys/net/netmap_legacy.h head/sys/net/netmap_user.h Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Mon Mar 18 12:22:04 2019 (r345268) +++ head/sys/dev/netmap/netmap.c Mon Mar 18 12:22:23 2019 (r345269) @@ -1035,6 +1035,10 @@ netmap_do_unregif(struct netmap_priv_d *priv) } na->nm_krings_delete(na); + + /* restore the default number of host tx and rx rings */ + na->num_host_tx_rings = 1; + na->num_host_rx_rings = 1; } /* possibily decrement counter of tx_si/rx_si users */ @@ -1575,6 +1579,19 @@ netmap_get_na(struct nmreq_header *hdr, *na = ret; netmap_adapter_get(ret); + /* + * if the adapter supports the host rings and it is not alread open, + * try to set the number of host rings as requested by the user + */ + if (((*na)->na_flags & NAF_HOST_RINGS) && (*na)->active_fds == 0) { + if (req->nr_host_tx_rings) + (*na)->num_host_tx_rings = req->nr_host_tx_rings; + if (req->nr_host_rx_rings) + (*na)->num_host_rx_rings = req->nr_host_rx_rings; + } + nm_prdis("%s: host tx %d rx %u", (*na)->name, (*na)->num_host_tx_rings, + (*na)->num_host_rx_rings); + out: if (error) { if (ret) @@ -1856,6 +1873,25 @@ netmap_interp_ringid(struct netmap_priv_d *priv, uint3 nm_prdis("ONE_NIC: %s %d %d", nm_txrx2str(t), priv->np_qfirst[t], priv->np_qlast[t]); break; + case NR_REG_ONE_SW: + if (!(na->na_flags & NAF_HOST_RINGS)) { + nm_prerr("host rings not supported"); + return EINVAL; + } + if (nr_ringid >= na->num_host_tx_rings && + nr_ringid >= na->num_host_rx_rings) { + nm_prerr("invalid ring id %d", nr_ringid); + return EINVAL; + } + /* if not enough rings, use the first one */ + j = nr_ringid; + if (j >= nma_get_host_nrings(na, t)) + j = 0; + priv->np_qfirst[t] = nma_get_nrings(na, t) + j; + priv->np_qlast[t] = nma_get_nrings(na, t) + j + 1; + nm_prdis("ONE_SW: %s %d %d", nm_txrx2str(t), + priv->np_qfirst[t], priv->np_qlast[t]); + break; default: nm_prerr("invalid regif type %d", nr_mode); return EINVAL; @@ -2546,6 +2582,8 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, c req->nr_tx_rings = na->num_tx_rings; req->nr_rx_slots = na->num_rx_desc; req->nr_tx_slots = na->num_tx_desc; + req->nr_host_tx_rings = na->num_host_tx_rings; + req->nr_host_rx_rings = na->num_host_rx_rings; error = netmap_mem_get_info(na->nm_mem, &req->nr_memsize, &memflags, &req->nr_mem_id); if (error) { @@ -2610,6 +2648,8 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, c regreq.nr_rx_slots = req->nr_rx_slots; regreq.nr_tx_rings = req->nr_tx_rings; regreq.nr_rx_rings = req->nr_rx_rings; + regreq.nr_host_tx_rings = req->nr_host_tx_rings; + regreq.nr_host_rx_rings = req->nr_host_rx_rings; regreq.nr_mem_id = req->nr_mem_id; /* get a refcount */ @@ -2647,6 +2687,8 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, c req->nr_tx_rings = na->num_tx_rings; req->nr_rx_slots = na->num_rx_desc; req->nr_tx_slots = na->num_tx_desc; + req->nr_host_tx_rings = na->num_host_tx_rings; + req->nr_host_rx_rings = na->num_host_rx_rings; } while (0); netmap_unget_na(na, ifp); NMG_UNLOCK(); Modified: head/sys/dev/netmap/netmap_legacy.c ============================================================================== --- head/sys/dev/netmap/netmap_legacy.c Mon Mar 18 12:22:04 2019 (r345268) +++ head/sys/dev/netmap/netmap_legacy.c Mon Mar 18 12:22:23 2019 (r345269) @@ -68,6 +68,8 @@ nmreq_register_from_legacy(struct nmreq *nmr, struct n req->nr_rx_slots = nmr->nr_rx_slots; req->nr_tx_rings = nmr->nr_tx_rings; req->nr_rx_rings = nmr->nr_rx_rings; + req->nr_host_tx_rings = 0; + req->nr_host_rx_rings = 0; req->nr_mem_id = nmr->nr_arg2; req->nr_ringid = nmr->nr_ringid & NETMAP_RING_MASK; if ((nmr->nr_flags & NR_REG_MASK) == NR_REG_DEFAULT) { @@ -249,6 +251,8 @@ nmreq_from_legacy(struct nmreq *nmr, u_long ioctl_cmd) req->nr_rx_slots = nmr->nr_rx_slots; req->nr_tx_rings = nmr->nr_tx_rings; req->nr_rx_rings = nmr->nr_rx_rings; + req->nr_host_tx_rings = 0; + req->nr_host_rx_rings = 0; req->nr_mem_id = nmr->nr_arg2; } break; @@ -367,8 +371,8 @@ netmap_ioctl_legacy(struct netmap_priv_d *priv, u_long struct nmreq *nmr = (struct nmreq *) data; struct nmreq_header *hdr; - if (nmr->nr_version < 11) { - nm_prerr("Minimum supported API is 11 (requested %u)", + if (nmr->nr_version < 14) { + nm_prerr("Minimum supported API is 14 (requested %u)", nmr->nr_version); return EINVAL; } Modified: head/sys/dev/netmap/netmap_mem2.c ============================================================================== --- head/sys/dev/netmap/netmap_mem2.c Mon Mar 18 12:22:04 2019 (r345268) +++ head/sys/dev/netmap/netmap_mem2.c Mon Mar 18 12:22:23 2019 (r345269) @@ -2012,6 +2012,10 @@ netmap_mem2_if_new(struct netmap_adapter *na, struct n /* initialize base fields -- override const */ *(u_int *)(uintptr_t)&nifp->ni_tx_rings = na->num_tx_rings; *(u_int *)(uintptr_t)&nifp->ni_rx_rings = na->num_rx_rings; + *(u_int *)(uintptr_t)&nifp->ni_host_tx_rings = + (na->num_host_tx_rings ? na->num_host_tx_rings : 1); + *(u_int *)(uintptr_t)&nifp->ni_host_rx_rings = + (na->num_host_rx_rings ? na->num_host_rx_rings : 1); strlcpy(nifp->ni_name, na->name, sizeof(nifp->ni_name)); /* Modified: head/sys/net/netmap.h ============================================================================== --- head/sys/net/netmap.h Mon Mar 18 12:22:04 2019 (r345268) +++ head/sys/net/netmap.h Mon Mar 18 12:22:23 2019 (r345269) @@ -41,9 +41,9 @@ #ifndef _NET_NETMAP_H_ #define _NET_NETMAP_H_ -#define NETMAP_API 13 /* current API version */ +#define NETMAP_API 14 /* current API version */ -#define NETMAP_MIN_API 13 /* min and max versions accepted */ +#define NETMAP_MIN_API 14 /* min and max versions accepted */ #define NETMAP_MAX_API 15 /* * Some fields should be cache-aligned to reduce contention. @@ -64,34 +64,34 @@ KERNEL (opaque, obviously) ==================================================================== - | - USERSPACE | struct netmap_ring - +---->+---------------+ - / | head,cur,tail | - struct netmap_if (nifp, 1 per fd) / | buf_ofs | - +---------------+ / | other fields | - | ni_tx_rings | / +===============+ - | ni_rx_rings | / | buf_idx, len | slot[0] - | | / | flags, ptr | - | | / +---------------+ - +===============+ / | buf_idx, len | slot[1] - | txring_ofs[0] | (rel.to nifp)--' | flags, ptr | - | txring_ofs[1] | +---------------+ - (tx+1 entries) (num_slots entries) - | txring_ofs[t] | | buf_idx, len | slot[n-1] - +---------------+ | flags, ptr | - | rxring_ofs[0] | +---------------+ - | rxring_ofs[1] | - (rx+1 entries) - | rxring_ofs[r] | - +---------------+ + | + USERSPACE | struct netmap_ring + +---->+---------------+ + / | head,cur,tail | + struct netmap_if (nifp, 1 per fd) / | buf_ofs | + +----------------+ / | other fields | + | ni_tx_rings | / +===============+ + | ni_rx_rings | / | buf_idx, len | slot[0] + | | / | flags, ptr | + | | / +---------------+ + +================+ / | buf_idx, len | slot[1] + | txring_ofs[0] | (rel.to nifp)--' | flags, ptr | + | txring_ofs[1] | +---------------+ + (tx+htx entries) (num_slots entries) + | txring_ofs[t] | | buf_idx, len | slot[n-1] + +----------------+ | flags, ptr | + | rxring_ofs[0] | +---------------+ + | rxring_ofs[1] | + (rx+hrx entries) + | rxring_ofs[r] | + +----------------+ * For each "interface" (NIC, host stack, PIPE, VALE switch port) bound to * a file descriptor, the mmap()ed region contains a (logically readonly) * struct netmap_if pointing to struct netmap_ring's. * - * There is one netmap_ring per physical NIC ring, plus one tx/rx ring - * pair attached to the host stack (this pair is unused for non-NIC ports). + * There is one netmap_ring per physical NIC ring, plus at least one tx/rx ring + * pair attached to the host stack (these pairs are unused for non-NIC ports). * * All physical/host stack ports share the same memory region, * so that zero-copy can be implemented between them. @@ -117,11 +117,6 @@ * as the index. On close, ni_bufs_head must point to the list of * buffers to be released. * - * + NIOCREGIF can request space for extra rings (and buffers) - * allocated in the same memory space. The number of extra rings - * is in nr_arg1, and is advisory. This is a no-op on NICs where - * the size of the memory space is fixed. - * * + NIOCREGIF can attach to PIPE rings sharing the same memory * space with a parent device. The ifname indicates the parent device, * which must already exist. Flags in nr_flags indicate if we want to @@ -133,21 +128,22 @@ * * Extra flags in nr_flags support the above functions. * Application libraries may use the following naming scheme: - * netmap:foo all NIC ring pairs - * netmap:foo^ only host ring pair - * netmap:foo+ all NIC ring + host ring pairs - * netmap:foo-k the k-th NIC ring pair - * netmap:foo{k PIPE ring pair k, master side - * netmap:foo}k PIPE ring pair k, slave side + * netmap:foo all NIC rings pairs + * netmap:foo^ only host rings pairs + * netmap:foo^k the k-th host rings pair + * netmap:foo+ all NIC rings + host rings pairs + * netmap:foo-k the k-th NIC rings pair + * netmap:foo{k PIPE rings pair k, master side + * netmap:foo}k PIPE rings pair k, slave side * * Some notes about host rings: * - * + The RX host ring is used to store those packets that the host network + * + The RX host rings are used to store those packets that the host network * stack is trying to transmit through a NIC queue, but only if that queue * is currently in netmap mode. Netmap will not intercept host stack mbufs * designated to NIC queues that are not in netmap mode. As a consequence, * registering a netmap port with netmap:foo^ is not enough to intercept - * mbufs in the RX host ring; the netmap port should be registered with + * mbufs in the RX host rings; the netmap port should be registered with * netmap:foo*, or another registration should be done to open at least a * NIC TX queue in netmap mode. * @@ -157,7 +153,7 @@ * ifconfig on FreeBSD or ethtool -K on Linux) for an interface that is being * used in netmap mode. If the offloadings are not disabled, GSO and/or * unchecksummed packets may be dropped immediately or end up in the host RX - * ring, and will be dropped as soon as the packet reaches another netmap + * rings, and will be dropped as soon as the packet reaches another netmap * adapter. */ @@ -366,7 +362,7 @@ struct netmap_if { /* * The number of packet rings available in netmap mode. * Physical NICs can have different numbers of tx and rx rings. - * Physical NICs also have a 'host' ring pair. + * Physical NICs also have at least a 'host' rings pair. * Additionally, clients can request additional ring pairs to * be used for internal communication. */ @@ -374,14 +370,18 @@ struct netmap_if { const uint32_t ni_rx_rings; /* number of HW rx rings */ uint32_t ni_bufs_head; /* head index for extra bufs */ - uint32_t ni_spare1[5]; + const uint32_t ni_host_tx_rings; /* number of SW tx rings */ + const uint32_t ni_host_rx_rings; /* number of SW rx rings */ + uint32_t ni_spare1[3]; /* * The following array contains the offset of each netmap ring * from this structure, in the following order: - * NIC tx rings (ni_tx_rings); host tx ring (1); extra tx rings; - * NIC rx rings (ni_rx_rings); host tx ring (1); extra rx rings. + * - NIC tx rings (ni_tx_rings); + * - host tx rings (ni_host_tx_rings); + * - NIC rx rings (ni_rx_rings); + * - host rx ring (ni_host_rx_rings); * - * The area is filled up by the kernel on NIOCREGIF, + * The area is filled up by the kernel on NETMAP_REQ_REGISTER, * and then only read by userspace code. */ const ssize_t ring_ofs[0]; @@ -422,7 +422,8 @@ struct netmap_if { * The request body (struct nmreq_register) has several arguments to * specify how the port is to be registered. * - * nr_tx_slots, nr_tx_slots, nr_tx_rings, nr_rx_rings (in/out) + * nr_tx_slots, nr_tx_slots, nr_tx_rings, nr_rx_rings, + * nr_host_tx_rings, nr_host_rx_rings (in/out) * On input, non-zero values may be used to reconfigure the port * according to the requested values, but this is not guaranteed. * On output the actual values in use are reported. @@ -574,6 +575,8 @@ struct nmreq_register { uint32_t nr_rx_slots; /* slots in rx rings */ uint16_t nr_tx_rings; /* number of tx rings */ uint16_t nr_rx_rings; /* number of rx rings */ + uint16_t nr_host_tx_rings; /* number of host tx rings */ + uint16_t nr_host_rx_rings; /* number of host rx rings */ uint16_t nr_mem_id; /* id of the memory allocator */ uint16_t nr_ringid; /* ring(s) we care about */ @@ -592,9 +595,9 @@ struct nmreq_register { #define NR_TX_RINGS_ONLY 0x4000 /* Applications set this flag if they are able to deal with virtio-net headers, * that is send/receive frames that start with a virtio-net header. - * If not set, NIOCREGIF will fail with netmap ports that require applications - * to use those headers. If the flag is set, the application can use the - * NETMAP_VNET_HDR_GET command to figure out the header length. */ + * If not set, NETMAP_REQ_REGISTER will fail with netmap ports that require + * applications to use those headers. If the flag is set, the application can + * use the NETMAP_VNET_HDR_GET command to figure out the header length. */ #define NR_ACCEPT_VNET_HDR 0x8000 /* The following two have the same meaning of NETMAP_NO_TX_POLL and * NETMAP_DO_RX_POLL. */ @@ -611,6 +614,7 @@ enum { NR_REG_DEFAULT = 0, /* backward compat, should NR_REG_PIPE_MASTER = 5, /* deprecated, use "x{y" port name syntax */ NR_REG_PIPE_SLAVE = 6, /* deprecated, use "x}y" port name syntax */ NR_REG_NULL = 7, + NR_REG_ONE_SW = 8, }; /* A single ioctl number is shared by all the new API command. @@ -622,7 +626,7 @@ enum { NR_REG_DEFAULT = 0, /* backward compat, should /* The ioctl commands to sync TX/RX netmap rings. * NIOCTXSYNC, NIOCRXSYNC synchronize tx or rx queues, - * whose identity is set in NIOCREGIF through nr_ringid. + * whose identity is set in NETMAP_REQ_REGISTER through nr_ringid. * These are non blocking and take no argument. */ #define NIOCTXSYNC _IO('i', 148) /* sync tx queues */ #define NIOCRXSYNC _IO('i', 149) /* sync rx queues */ @@ -640,8 +644,10 @@ struct nmreq_port_info_get { uint32_t nr_rx_slots; /* slots in rx rings */ uint16_t nr_tx_rings; /* number of tx rings */ uint16_t nr_rx_rings; /* number of rx rings */ + uint16_t nr_host_tx_rings; /* number of host tx rings */ + uint16_t nr_host_rx_rings; /* number of host rx rings */ uint16_t nr_mem_id; /* memory allocator id (in/out) */ - uint16_t pad1; + uint16_t pad[3]; }; #define NM_BDG_NAME "vale" /* prefix for bridge port name */ Modified: head/sys/net/netmap_legacy.h ============================================================================== --- head/sys/net/netmap_legacy.h Mon Mar 18 12:22:04 2019 (r345268) +++ head/sys/net/netmap_legacy.h Mon Mar 18 12:22:23 2019 (r345269) @@ -99,14 +99,7 @@ * nr_flags is the recommended mode to indicate which rings should * be bound to a file descriptor. Values are NR_REG_* * - * nr_arg1 (in) The number of extra rings to be reserved. - * Especially when allocating a VALE port the system only - * allocates the amount of memory needed for the port. - * If more shared memory rings are desired (e.g. for pipes), - * the first invocation for the same basename/allocator - * should specify a suitable number. Memory cannot be - * extended after the first allocation without closing - * all ports on the same region. + * nr_arg1 (in) Reserved. * * nr_arg2 (in/out) The identity of the memory region used. * On input, 0 means the system decides autonomously, @@ -188,7 +181,7 @@ struct nmreq { #define NETMAP_BDG_POLLING_ON 10 /* delete polling kthread */ #define NETMAP_BDG_POLLING_OFF 11 /* delete polling kthread */ #define NETMAP_VNET_HDR_GET 12 /* get the port virtio-net-hdr length */ - uint16_t nr_arg1; /* reserve extra rings in NIOCREGIF */ + uint16_t nr_arg1; /* extra arguments */ #define NETMAP_BDG_HOST 1 /* nr_arg1 value for NETMAP_BDG_ATTACH */ uint16_t nr_arg2; /* id of the memory allocator */ Modified: head/sys/net/netmap_user.h ============================================================================== --- head/sys/net/netmap_user.h Mon Mar 18 12:22:04 2019 (r345268) +++ head/sys/net/netmap_user.h Mon Mar 18 12:22:23 2019 (r345269) @@ -93,6 +93,8 @@ #include /* apple needs sockaddr */ #include /* IFNAMSIZ */ #include +#include /* memset */ +#include /* gettimeofday */ #ifndef likely #define likely(x) __builtin_expect(!!(x), 1) @@ -111,7 +113,8 @@ nifp, (nifp)->ring_ofs[index] ) #define NETMAP_RXRING(nifp, index) _NETMAP_OFFSET(struct netmap_ring *, \ - nifp, (nifp)->ring_ofs[index + (nifp)->ni_tx_rings + 1] ) + nifp, (nifp)->ring_ofs[index + (nifp)->ni_tx_rings + \ + (nifp)->ni_host_tx_rings] ) #define NETMAP_BUF(ring, index) \ ((char *)(ring) + (ring)->buf_ofs + ((index)*(ring)->nr_buf_size)) @@ -149,27 +152,6 @@ nm_ring_space(struct netmap_ring *ring) return ret; } - -#ifdef NETMAP_WITH_LIBS -/* - * Support for simple I/O libraries. - * Include other system headers required for compiling this. - */ - -#ifndef HAVE_NETMAP_WITH_LIBS -#define HAVE_NETMAP_WITH_LIBS - -#include -#include -#include -#include /* memset */ -#include -#include /* EINVAL */ -#include /* O_RDWR */ -#include /* close() */ -#include -#include - #ifndef ND /* debug macros */ /* debug support */ #define ND(_fmt, ...) do {} while(0) @@ -198,6 +180,53 @@ nm_ring_space(struct netmap_ring *ring) } while (0) #endif +/* + * this is a slightly optimized copy routine which rounds + * to multiple of 64 bytes and is often faster than dealing + * with other odd sizes. We assume there is enough room + * in the source and destination buffers. + */ +static inline void +nm_pkt_copy(const void *_src, void *_dst, int l) +{ + const uint64_t *src = (const uint64_t *)_src; + uint64_t *dst = (uint64_t *)_dst; + + if (unlikely(l >= 1024 || l % 64)) { + memcpy(dst, src, l); + return; + } + for (; likely(l > 0); l-=64) { + *dst++ = *src++; + *dst++ = *src++; + *dst++ = *src++; + *dst++ = *src++; + *dst++ = *src++; + *dst++ = *src++; + *dst++ = *src++; + *dst++ = *src++; + } +} + +#ifdef NETMAP_WITH_LIBS +/* + * Support for simple I/O libraries. + * Include other system headers required for compiling this. + */ + +#ifndef HAVE_NETMAP_WITH_LIBS +#define HAVE_NETMAP_WITH_LIBS + +#include +#include +#include +#include +#include /* EINVAL */ +#include /* O_RDWR */ +#include /* close() */ +#include +#include + struct nm_pkthdr { /* first part is the same as pcap_pkthdr */ struct timeval ts; uint32_t caplen; @@ -268,33 +297,6 @@ struct nm_desc { #define NETMAP_FD(d) (P2NMD(d)->fd) -/* - * this is a slightly optimized copy routine which rounds - * to multiple of 64 bytes and is often faster than dealing - * with other odd sizes. We assume there is enough room - * in the source and destination buffers. - */ -static inline void -nm_pkt_copy(const void *_src, void *_dst, int l) -{ - const uint64_t *src = (const uint64_t *)_src; - uint64_t *dst = (uint64_t *)_dst; - - if (unlikely(l >= 1024 || l % 64)) { - memcpy(dst, src, l); - return; - } - for (; likely(l > 0); l-=64) { - *dst++ = *src++; - *dst++ = *src++; - *dst++ = *src++; - *dst++ = *src++; - *dst++ = *src++; - *dst++ = *src++; - *dst++ = *src++; - *dst++ = *src++; - } -} /* From owner-svn-src-head@freebsd.org Mon Mar 18 12:41:43 2019 Return-Path: Delivered-To: svn-src-head@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 8B0E6153E39E; Mon, 18 Mar 2019 12:41:43 +0000 (UTC) (envelope-from gallatin@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 306A087C58; Mon, 18 Mar 2019 12:41:43 +0000 (UTC) (envelope-from gallatin@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 05E742181E; Mon, 18 Mar 2019 12:41:43 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2ICfg5I005276; Mon, 18 Mar 2019 12:41:42 GMT (envelope-from gallatin@FreeBSD.org) Received: (from gallatin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2ICfgZY005275; Mon, 18 Mar 2019 12:41:42 GMT (envelope-from gallatin@FreeBSD.org) Message-Id: <201903181241.x2ICfgZY005275@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gallatin set sender to gallatin@FreeBSD.org using -f From: Andrew Gallatin Date: Mon, 18 Mar 2019 12:41:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345273 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: gallatin X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 345273 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 306A087C58 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_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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2019 12:41:43 -0000 Author: gallatin Date: Mon Mar 18 12:41:42 2019 New Revision: 345273 URL: https://svnweb.freebsd.org/changeset/base/345273 Log: Fix a typo introduced in r344133 The line was misedited to change tt to st instead of changing ut to st. The use of st as the denominator in mul64_by_fraction() will lead to an integer divide fault in the intr proc (the process holding ithreads) where st will be 0. This divide by 0 happens after the total runtime for all ithreads exceeds 76 hours. Submitted by: bde Modified: head/sys/kern/kern_resource.c Modified: head/sys/kern/kern_resource.c ============================================================================== --- head/sys/kern/kern_resource.c Mon Mar 18 12:34:13 2019 (r345272) +++ head/sys/kern/kern_resource.c Mon Mar 18 12:41:42 2019 (r345273) @@ -978,7 +978,7 @@ calcru1(struct proc *p, struct rusage_ext *ruxp, struc su = (tu * st) / tt; } else { uu = mul64_by_fraction(tu, ut, tt); - su = mul64_by_fraction(tu, ut, st); + su = mul64_by_fraction(tu, st, tt); } if (tu >= ruxp->rux_tu) { From owner-svn-src-head@freebsd.org Mon Mar 18 12:59:11 2019 Return-Path: Delivered-To: svn-src-head@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 2522A153E884; Mon, 18 Mar 2019 12:59:11 +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 C100388559; Mon, 18 Mar 2019 12:59:10 +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 A8FC821A10; Mon, 18 Mar 2019 12:59:10 +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 x2ICxAMS013957; Mon, 18 Mar 2019 12:59:10 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2ICx94D013948; Mon, 18 Mar 2019 12:59:09 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201903181259.x2ICx94D013948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 18 Mar 2019 12:59:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345274 - in head: sbin/ipfw sys/conf sys/modules/ipfw_nat64 sys/netinet6 sys/netpfil/ipfw/nat64 X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in head: sbin/ipfw sys/conf sys/modules/ipfw_nat64 sys/netinet6 sys/netpfil/ipfw/nat64 X-SVN-Commit-Revision: 345274 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C100388559 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_SHORT(-0.96)[-0.960,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2019 12:59:11 -0000 Author: ae Date: Mon Mar 18 12:59:08 2019 New Revision: 345274 URL: https://svnweb.freebsd.org/changeset/base/345274 Log: Update NAT64LSN implementation: o most of data structures and relations were modified to be able support large number of translation states. Now each supported protocol can use full ports range. Ports groups now are belongs to IPv4 alias addresses, not hosts. Each ports group can keep several states chunks. This is controlled with new `states_chunks` config option. States chunks allow to have several translation states for single alias address and port, but for different destination addresses. o by default all hash tables now use jenkins hash. o ConcurrencyKit and epoch(9) is used to make NAT64LSN lockless on fast path. o one NAT64LSN instance now can be used to handle several IPv6 prefixes, special prefix "::" value should be used for this purpose when instance is created. o due to modified internal data structures relations, the socket opcode that does states listing was changed. Obtained from: Yandex LLC MFC after: 1 month Sponsored by: Yandex LLC Modified: head/sbin/ipfw/ipfw.8 head/sbin/ipfw/ipfw2.h head/sbin/ipfw/nat64lsn.c head/sys/conf/files head/sys/modules/ipfw_nat64/Makefile head/sys/netinet6/ip_fw_nat64.h head/sys/netpfil/ipfw/nat64/nat64lsn.c head/sys/netpfil/ipfw/nat64/nat64lsn.h head/sys/netpfil/ipfw/nat64/nat64lsn_control.c Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Mon Mar 18 12:41:42 2019 (r345273) +++ head/sbin/ipfw/ipfw.8 Mon Mar 18 12:59:08 2019 (r345274) @@ -3300,6 +3300,7 @@ See .Sx SYSCTL VARIABLES for more info. .Sh IPv6/IPv4 NETWORK ADDRESS AND PROTOCOL TRANSLATION +.Ss Stateful translation .Nm supports in-kernel IPv6/IPv4 network address and protocol translation. Stateful NAT64 translation allows IPv6-only clients to contact IPv4 servers @@ -3317,7 +3318,8 @@ to be able use stateful NAT64 translator. Stateful NAT64 uses a bunch of memory for several types of objects. When IPv6 client initiates connection, NAT64 translator creates a host entry in the states table. -Each host entry has a number of ports group entries allocated on demand. +Each host entry uses preallocated IPv4 alias entry. +Each alias entry has a number of ports group entries allocated on demand. Ports group entries contains connection state entries. There are several options to control limits and lifetime for these objects. .Pp @@ -3337,6 +3339,11 @@ First time an original packet is handled and consumed and then it is handled again as translated packet. This behavior can be changed by sysctl variable .Va net.inet.ip.fw.nat64_direct_output . +Also translated packet can be tagged using +.Cm tag +rule action, and then matched by +.Cm tagged +opcode to avoid loops and extra overhead. .Pp The stateful NAT64 configuration command is the following: .Bd -ragged -offset indent @@ -3364,15 +3371,16 @@ to represent IPv4 addresses. This IPv6 prefix should b The translator implementation follows RFC6052, that restricts the length of prefixes to one of following: 32, 40, 48, 56, 64, or 96. The Well-Known IPv6 Prefix 64:ff9b:: must be 96 bits long. -.It Cm max_ports Ar number -Maximum number of ports reserved for upper level protocols to one IPv6 client. -All reserved ports are divided into chunks between supported protocols. -The number of connections from one IPv6 client is limited by this option. -Note that closed TCP connections still remain in the list of connections until -.Cm tcp_close_age -interval will not expire. -Default value is -.Ar 2048 . +The special +.Ar ::/length +prefix can be used to handle several IPv6 prefixes with one NAT64 instance. +The NAT64 instance will determine a destination IPv4 address from prefix +.Ar length . +.It Cm states_chunks Ar number +The number of states chunks in single ports group. +Each ports group by default can keep 64 state entries in single chunk. +The above value affects the maximum number of states that can be associated with single IPv4 alias address and port. +The value must be power of 2, and up to 128. .It Cm host_del_age Ar seconds The number of seconds until the host entry for a IPv6 client will be deleted and all its resources will be released due to inactivity. Modified: head/sbin/ipfw/ipfw2.h ============================================================================== --- head/sbin/ipfw/ipfw2.h Mon Mar 18 12:41:42 2019 (r345273) +++ head/sbin/ipfw/ipfw2.h Mon Mar 18 12:59:08 2019 (r345274) @@ -278,6 +278,7 @@ enum tokens { TOK_AGG_LEN, TOK_AGG_COUNT, TOK_MAX_PORTS, + TOK_STATES_CHUNKS, TOK_JMAXLEN, TOK_PORT_RANGE, TOK_HOST_DEL_AGE, Modified: head/sbin/ipfw/nat64lsn.c ============================================================================== --- head/sbin/ipfw/nat64lsn.c Mon Mar 18 12:41:42 2019 (r345273) +++ head/sbin/ipfw/nat64lsn.c Mon Mar 18 12:59:08 2019 (r345274) @@ -87,68 +87,70 @@ nat64lsn_print_states(void *buf) char sflags[4], *sf, *proto; ipfw_obj_header *oh; ipfw_obj_data *od; - ipfw_nat64lsn_stg *stg; - ipfw_nat64lsn_state *ste; + ipfw_nat64lsn_stg_v1 *stg; + ipfw_nat64lsn_state_v1 *ste; uint64_t next_idx; int i, sz; oh = (ipfw_obj_header *)buf; od = (ipfw_obj_data *)(oh + 1); - stg = (ipfw_nat64lsn_stg *)(od + 1); + stg = (ipfw_nat64lsn_stg_v1 *)(od + 1); sz = od->head.length - sizeof(*od); next_idx = 0; while (sz > 0 && next_idx != 0xFF) { - next_idx = stg->next_idx; + next_idx = stg->next.index; sz -= sizeof(*stg); if (stg->count == 0) { stg++; continue; } - switch (stg->proto) { - case IPPROTO_TCP: - proto = "TCP"; - break; - case IPPROTO_UDP: - proto = "UDP"; - break; - case IPPROTO_ICMPV6: - proto = "ICMPv6"; - break; - } - inet_ntop(AF_INET6, &stg->host6, s, sizeof(s)); + /* + * NOTE: addresses are in network byte order, + * ports are in host byte order. + */ inet_ntop(AF_INET, &stg->alias4, a, sizeof(a)); - ste = (ipfw_nat64lsn_state *)(stg + 1); + ste = (ipfw_nat64lsn_state_v1 *)(stg + 1); for (i = 0; i < stg->count && sz > 0; i++) { sf = sflags; + inet_ntop(AF_INET6, &ste->host6, s, sizeof(s)); inet_ntop(AF_INET, &ste->daddr, f, sizeof(f)); - if (stg->proto == IPPROTO_TCP) { + switch (ste->proto) { + case IPPROTO_TCP: + proto = "TCP"; if (ste->flags & 0x02) *sf++ = 'S'; if (ste->flags & 0x04) *sf++ = 'E'; if (ste->flags & 0x01) *sf++ = 'F'; + break; + case IPPROTO_UDP: + proto = "UDP"; + break; + case IPPROTO_ICMP: + proto = "ICMPv6"; + break; } *sf = '\0'; - switch (stg->proto) { + switch (ste->proto) { case IPPROTO_TCP: case IPPROTO_UDP: printf("%s:%d\t%s:%d\t%s\t%s\t%d\t%s:%d\n", s, ste->sport, a, ste->aport, proto, sflags, ste->idle, f, ste->dport); break; - case IPPROTO_ICMPV6: + case IPPROTO_ICMP: printf("%s\t%s\t%s\t\t%d\t%s\n", s, a, proto, ste->idle, f); break; default: printf("%s\t%s\t%d\t\t%d\t%s\n", - s, a, stg->proto, ste->idle, f); + s, a, ste->proto, ste->idle, f); } ste++; sz -= sizeof(*ste); } - stg = (ipfw_nat64lsn_stg *)ste; + stg = (ipfw_nat64lsn_stg_v1 *)ste; } return (next_idx); } @@ -174,6 +176,7 @@ nat64lsn_states_cb(ipfw_nat64lsn_cfg *cfg, const char err(EX_OSERR, NULL); do { oh = (ipfw_obj_header *)buf; + oh->opheader.version = 1; /* Force using ov new API */ od = (ipfw_obj_data *)(oh + 1); nat64lsn_fill_ntlv(&oh->ntlv, cfg->name, set); od->head.type = IPFW_TLV_OBJDATA; @@ -363,12 +366,8 @@ nat64lsn_parse_int(const char *arg, const char *desc) static struct _s_x nat64newcmds[] = { { "prefix6", TOK_PREFIX6 }, - { "agg_len", TOK_AGG_LEN }, /* not yet */ - { "agg_count", TOK_AGG_COUNT }, /* not yet */ - { "port_range", TOK_PORT_RANGE }, /* not yet */ { "jmaxlen", TOK_JMAXLEN }, { "prefix4", TOK_PREFIX4 }, - { "max_ports", TOK_MAX_PORTS }, { "host_del_age", TOK_HOST_DEL_AGE }, { "pg_del_age", TOK_PG_DEL_AGE }, { "tcp_syn_age", TOK_TCP_SYN_AGE }, @@ -376,10 +375,13 @@ static struct _s_x nat64newcmds[] = { { "tcp_est_age", TOK_TCP_EST_AGE }, { "udp_age", TOK_UDP_AGE }, { "icmp_age", TOK_ICMP_AGE }, + { "states_chunks",TOK_STATES_CHUNKS }, { "log", TOK_LOG }, { "-log", TOK_LOGOFF }, { "allow_private", TOK_PRIVATE }, { "-allow_private", TOK_PRIVATEOFF }, + /* for compatibility with old configurations */ + { "max_ports", TOK_MAX_PORTS }, /* unused */ { NULL, 0 } }; @@ -436,42 +438,17 @@ nat64lsn_create(const char *name, uint8_t set, int ac, nat64lsn_parse_prefix(*av, AF_INET6, &cfg->prefix6, &cfg->plen6); if (ipfw_check_nat64prefix(&cfg->prefix6, - cfg->plen6) != 0) + cfg->plen6) != 0 && + !IN6_IS_ADDR_UNSPECIFIED(&cfg->prefix6)) errx(EX_USAGE, "Bad prefix6 %s", *av); ac--; av++; break; -#if 0 - case TOK_AGG_LEN: - NEED1("Aggregation prefix len required"); - cfg->agg_prefix_len = nat64lsn_parse_int(*av, opt); - ac--; av++; - break; - case TOK_AGG_COUNT: - NEED1("Max per-prefix count required"); - cfg->agg_prefix_max = nat64lsn_parse_int(*av, opt); - ac--; av++; - break; - case TOK_PORT_RANGE: - NEED1("port range x[:y] required"); - if ((p = strchr(*av, ':')) == NULL) - cfg->min_port = (uint16_t)nat64lsn_parse_int( - *av, opt); - else { - *p++ = '\0'; - cfg->min_port = (uint16_t)nat64lsn_parse_int( - *av, opt); - cfg->max_port = (uint16_t)nat64lsn_parse_int( - p, opt); - } - ac--; av++; - break; case TOK_JMAXLEN: NEED1("job queue length required"); cfg->jmaxlen = nat64lsn_parse_int(*av, opt); ac--; av++; break; -#endif case TOK_MAX_PORTS: NEED1("Max per-user ports required"); cfg->max_ports = nat64lsn_parse_int(*av, opt); @@ -519,6 +496,12 @@ nat64lsn_create(const char *name, uint8_t set, int ac, *av, opt); ac--; av++; break; + case TOK_STATES_CHUNKS: + NEED1("number of chunks required"); + cfg->states_chunks = (uint8_t)nat64lsn_parse_int( + *av, opt); + ac--; av++; + break; case TOK_LOG: cfg->flags |= NAT64_LOG; break; @@ -630,6 +613,12 @@ nat64lsn_config(const char *name, uint8_t set, int ac, *av, opt); ac--; av++; break; + case TOK_STATES_CHUNKS: + NEED1("number of chunks required"); + cfg->states_chunks = (uint8_t)nat64lsn_parse_int( + *av, opt); + ac--; av++; + break; case TOK_LOG: cfg->flags |= NAT64_LOG; break; @@ -789,31 +778,24 @@ nat64lsn_show_cb(ipfw_nat64lsn_cfg *cfg, const char *n printf("nat64lsn %s prefix4 %s/%u", cfg->name, abuf, cfg->plen4); inet_ntop(AF_INET6, &cfg->prefix6, abuf, sizeof(abuf)); printf(" prefix6 %s/%u", abuf, cfg->plen6); -#if 0 - printf("agg_len %u agg_count %u ", cfg->agg_prefix_len, - cfg->agg_prefix_max); - if (cfg->min_port != NAT64LSN_PORT_MIN || - cfg->max_port != NAT64LSN_PORT_MAX) - printf(" port_range %u:%u", cfg->min_port, cfg->max_port); - if (cfg->jmaxlen != NAT64LSN_JMAXLEN) - printf(" jmaxlen %u ", cfg->jmaxlen); -#endif - if (cfg->max_ports != NAT64LSN_MAX_PORTS) - printf(" max_ports %u", cfg->max_ports); - if (cfg->nh_delete_delay != NAT64LSN_HOST_AGE) + if (co.verbose || cfg->states_chunks > 1) + printf(" states_chunks %u", cfg->states_chunks); + if (co.verbose || cfg->nh_delete_delay != NAT64LSN_HOST_AGE) printf(" host_del_age %u", cfg->nh_delete_delay); - if (cfg->pg_delete_delay != NAT64LSN_PG_AGE) + if (co.verbose || cfg->pg_delete_delay != NAT64LSN_PG_AGE) printf(" pg_del_age %u ", cfg->pg_delete_delay); - if (cfg->st_syn_ttl != NAT64LSN_TCP_SYN_AGE) + if (co.verbose || cfg->st_syn_ttl != NAT64LSN_TCP_SYN_AGE) printf(" tcp_syn_age %u", cfg->st_syn_ttl); - if (cfg->st_close_ttl != NAT64LSN_TCP_FIN_AGE) + if (co.verbose || cfg->st_close_ttl != NAT64LSN_TCP_FIN_AGE) printf(" tcp_close_age %u", cfg->st_close_ttl); - if (cfg->st_estab_ttl != NAT64LSN_TCP_EST_AGE) + if (co.verbose || cfg->st_estab_ttl != NAT64LSN_TCP_EST_AGE) printf(" tcp_est_age %u", cfg->st_estab_ttl); - if (cfg->st_udp_ttl != NAT64LSN_UDP_AGE) + if (co.verbose || cfg->st_udp_ttl != NAT64LSN_UDP_AGE) printf(" udp_age %u", cfg->st_udp_ttl); - if (cfg->st_icmp_ttl != NAT64LSN_ICMP_AGE) + if (co.verbose || cfg->st_icmp_ttl != NAT64LSN_ICMP_AGE) printf(" icmp_age %u", cfg->st_icmp_ttl); + if (co.verbose || cfg->jmaxlen != NAT64LSN_JMAXLEN) + printf(" jmaxlen %u ", cfg->jmaxlen); if (cfg->flags & NAT64_LOG) printf(" log"); if (cfg->flags & NAT64_ALLOW_PRIVATE) Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Mar 18 12:41:42 2019 (r345273) +++ head/sys/conf/files Mon Mar 18 12:59:08 2019 (r345274) @@ -4398,9 +4398,9 @@ netpfil/ipfw/nat64/nat64clat.c optional inet inet6 ipf netpfil/ipfw/nat64/nat64clat_control.c optional inet inet6 ipfirewall \ ipfirewall_nat64 netpfil/ipfw/nat64/nat64lsn.c optional inet inet6 ipfirewall \ - ipfirewall_nat64 + ipfirewall_nat64 compile-with "${NORMAL_C} -I$S/contrib/ck/include" netpfil/ipfw/nat64/nat64lsn_control.c optional inet inet6 ipfirewall \ - ipfirewall_nat64 + ipfirewall_nat64 compile-with "${NORMAL_C} -I$S/contrib/ck/include" netpfil/ipfw/nat64/nat64stl.c optional inet inet6 ipfirewall \ ipfirewall_nat64 netpfil/ipfw/nat64/nat64stl_control.c optional inet inet6 ipfirewall \ Modified: head/sys/modules/ipfw_nat64/Makefile ============================================================================== --- head/sys/modules/ipfw_nat64/Makefile Mon Mar 18 12:41:42 2019 (r345273) +++ head/sys/modules/ipfw_nat64/Makefile Mon Mar 18 12:59:08 2019 (r345274) @@ -8,4 +8,6 @@ SRCS+= nat64clat.c nat64clat_control.c SRCS+= nat64lsn.c nat64lsn_control.c SRCS+= nat64stl.c nat64stl_control.c +CFLAGS+= -I${SRCTOP}/sys/contrib/ck/include + .include Modified: head/sys/netinet6/ip_fw_nat64.h ============================================================================== --- head/sys/netinet6/ip_fw_nat64.h Mon Mar 18 12:41:42 2019 (r345273) +++ head/sys/netinet6/ip_fw_nat64.h Mon Mar 18 12:59:08 2019 (r345274) @@ -122,7 +122,7 @@ typedef struct _ipfw_nat64clat_cfg { /* * NAT64LSN default configuration values */ -#define NAT64LSN_MAX_PORTS 2048 /* Max number of ports per host */ +#define NAT64LSN_MAX_PORTS 2048 /* Unused */ #define NAT64LSN_JMAXLEN 2048 /* Max outstanding requests. */ #define NAT64LSN_TCP_SYN_AGE 10 /* State's TTL after SYN received. */ #define NAT64LSN_TCP_EST_AGE (2 * 3600) /* TTL for established connection */ @@ -135,16 +135,20 @@ typedef struct _ipfw_nat64clat_cfg { typedef struct _ipfw_nat64lsn_cfg { char name[64]; /* NAT name */ uint32_t flags; - uint32_t max_ports; /* Max ports per client */ - uint32_t agg_prefix_len; /* Prefix length to count */ - uint32_t agg_prefix_max; /* Max hosts per agg prefix */ + + uint32_t max_ports; /* Unused */ + uint32_t agg_prefix_len; /* Unused */ + uint32_t agg_prefix_max; /* Unused */ + struct in_addr prefix4; uint16_t plen4; /* Prefix length */ uint16_t plen6; /* Prefix length */ struct in6_addr prefix6; /* NAT64 prefix */ uint32_t jmaxlen; /* Max jobqueue length */ - uint16_t min_port; /* Min port group # to use */ - uint16_t max_port; /* Max port group # to use */ + + uint16_t min_port; /* Unused */ + uint16_t max_port; /* Unused */ + uint16_t nh_delete_delay;/* Stale host delete delay */ uint16_t pg_delete_delay;/* Stale portgroup delete delay */ uint16_t st_syn_ttl; /* TCP syn expire */ @@ -153,7 +157,7 @@ typedef struct _ipfw_nat64lsn_cfg { uint16_t st_udp_ttl; /* UDP expire */ uint16_t st_icmp_ttl; /* ICMP expire */ uint8_t set; /* Named instance set [0..31] */ - uint8_t spare; + uint8_t states_chunks; /* Number of states chunks per PG */ } ipfw_nat64lsn_cfg; typedef struct _ipfw_nat64lsn_state { @@ -177,5 +181,30 @@ typedef struct _ipfw_nat64lsn_stg { uint32_t spare2; } ipfw_nat64lsn_stg; -#endif /* _NETINET6_IP_FW_NAT64_H_ */ +typedef struct _ipfw_nat64lsn_state_v1 { + struct in6_addr host6; /* Bound IPv6 host */ + struct in_addr daddr; /* Remote IPv4 address */ + uint16_t dport; /* Remote destination port */ + uint16_t aport; /* Local alias port */ + uint16_t sport; /* Source port */ + uint16_t spare; + uint16_t idle; /* Last used time */ + uint8_t flags; /* State flags */ + uint8_t proto; /* protocol */ +} ipfw_nat64lsn_state_v1; +typedef struct _ipfw_nat64lsn_stg_v1 { + union nat64lsn_pgidx { + uint64_t index; + struct { + uint8_t chunk; /* states chunk */ + uint8_t proto; /* protocol */ + uint16_t port; /* base port */ + in_addr_t addr; /* alias address */ + }; + } next; /* next state index */ + struct in_addr alias4; /* IPv4 alias address */ + uint32_t count; /* Number of states */ +} ipfw_nat64lsn_stg_v1; + +#endif /* _NETINET6_IP_FW_NAT64_H_ */ Modified: head/sys/netpfil/ipfw/nat64/nat64lsn.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64lsn.c Mon Mar 18 12:41:42 2019 (r345273) +++ head/sys/netpfil/ipfw/nat64/nat64lsn.c Mon Mar 18 12:59:08 2019 (r345274) @@ -33,16 +33,17 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include +#include #include #include #include #include #include #include -#include #include -#include #include #include @@ -71,17 +72,22 @@ __FBSDID("$FreeBSD$"); MALLOC_DEFINE(M_NAT64LSN, "NAT64LSN", "NAT64LSN"); -static void nat64lsn_periodic(void *data); -#define PERIODIC_DELAY 4 -static uint8_t nat64lsn_proto_map[256]; -uint8_t nat64lsn_rproto_map[NAT_MAX_PROTO]; +static epoch_t nat64lsn_epoch; +#define NAT64LSN_EPOCH_ENTER(et) epoch_enter_preempt(nat64lsn_epoch, &(et)) +#define NAT64LSN_EPOCH_EXIT(et) epoch_exit_preempt(nat64lsn_epoch, &(et)) +#define NAT64LSN_EPOCH_WAIT() epoch_wait_preempt(nat64lsn_epoch) +#define NAT64LSN_EPOCH_ASSERT() MPASS(in_epoch(nat64lsn_epoch)) +#define NAT64LSN_EPOCH_CALL(c, f) epoch_call(nat64lsn_epoch, (c), (f)) -#define NAT64_FLAG_FIN 0x01 /* FIN was seen */ -#define NAT64_FLAG_SYN 0x02 /* First syn in->out */ -#define NAT64_FLAG_ESTAB 0x04 /* Packet with Ack */ -#define NAT64_FLAGS_TCP (NAT64_FLAG_SYN|NAT64_FLAG_ESTAB|NAT64_FLAG_FIN) +static uma_zone_t nat64lsn_host_zone; +static uma_zone_t nat64lsn_pgchunk_zone; +static uma_zone_t nat64lsn_pg_zone; +static uma_zone_t nat64lsn_aliaslink_zone; +static uma_zone_t nat64lsn_state_zone; +static uma_zone_t nat64lsn_job_zone; -#define NAT64_FLAG_RDR 0x80 /* Port redirect */ +static void nat64lsn_periodic(void *data); +#define PERIODIC_DELAY 4 #define NAT64_LOOKUP(chain, cmd) \ (struct nat64lsn_cfg *)SRV_OBJECT((chain), (cmd)->arg1) /* @@ -91,25 +97,33 @@ uint8_t nat64lsn_rproto_map[NAT_MAX_PROTO]; enum nat64lsn_jtype { JTYPE_NEWHOST = 1, JTYPE_NEWPORTGROUP, - JTYPE_DELPORTGROUP, + JTYPE_DESTROY, }; struct nat64lsn_job_item { - TAILQ_ENTRY(nat64lsn_job_item) next; + STAILQ_ENTRY(nat64lsn_job_item) entries; enum nat64lsn_jtype jtype; - struct nat64lsn_host *nh; - struct nat64lsn_portgroup *pg; - void *spare_idx; - struct in6_addr haddr; - uint8_t nat_proto; - uint8_t done; - int needs_idx; - int delcount; - unsigned int fhash; /* Flow hash */ - uint32_t aaddr; /* Last used address (net) */ - struct mbuf *m; - struct ipfw_flow_id f_id; - uint64_t delmask[NAT64LSN_PGPTRNMASK]; + + union { + struct { /* used by JTYPE_NEWHOST, JTYPE_NEWPORTGROUP */ + struct mbuf *m; + struct nat64lsn_host *host; + struct nat64lsn_state *state; + uint32_t src6_hval; + uint32_t state_hval; + struct ipfw_flow_id f_id; + in_addr_t faddr; + uint16_t port; + uint8_t proto; + uint8_t done; + }; + struct { /* used by JTYPE_DESTROY */ + struct nat64lsn_hosts_slist hosts; + struct nat64lsn_pg_slist portgroups; + struct nat64lsn_pgchunk *pgchunk; + struct epoch_context epoch_ctx; + }; + }; }; static struct mtx jmtx; @@ -118,143 +132,278 @@ static struct mtx jmtx; #define JQUEUE_LOCK() mtx_lock(&jmtx) #define JQUEUE_UNLOCK() mtx_unlock(&jmtx) +static int nat64lsn_alloc_host(struct nat64lsn_cfg *cfg, + struct nat64lsn_job_item *ji); +static int nat64lsn_alloc_pg(struct nat64lsn_cfg *cfg, + struct nat64lsn_job_item *ji); +static struct nat64lsn_job_item *nat64lsn_create_job( + struct nat64lsn_cfg *cfg, int jtype); static void nat64lsn_enqueue_job(struct nat64lsn_cfg *cfg, struct nat64lsn_job_item *ji); -static void nat64lsn_enqueue_jobs(struct nat64lsn_cfg *cfg, - struct nat64lsn_job_head *jhead, int jlen); +static void nat64lsn_job_destroy(epoch_context_t ctx); +static void nat64lsn_destroy_host(struct nat64lsn_host *host); +static void nat64lsn_destroy_pg(struct nat64lsn_pg *pg); -static struct nat64lsn_job_item *nat64lsn_create_job(struct nat64lsn_cfg *cfg, - const struct ipfw_flow_id *f_id, int jtype); -static int nat64lsn_request_portgroup(struct nat64lsn_cfg *cfg, - const struct ipfw_flow_id *f_id, struct mbuf **pm, uint32_t aaddr, - int needs_idx); -static int nat64lsn_request_host(struct nat64lsn_cfg *cfg, - const struct ipfw_flow_id *f_id, struct mbuf **pm); static int nat64lsn_translate4(struct nat64lsn_cfg *cfg, - const struct ipfw_flow_id *f_id, struct mbuf **pm); + const struct ipfw_flow_id *f_id, struct mbuf **mp); static int nat64lsn_translate6(struct nat64lsn_cfg *cfg, - struct ipfw_flow_id *f_id, struct mbuf **pm); + struct ipfw_flow_id *f_id, struct mbuf **mp); +static int nat64lsn_translate6_internal(struct nat64lsn_cfg *cfg, + struct mbuf **mp, struct nat64lsn_state *state, uint8_t flags); -static int alloc_portgroup(struct nat64lsn_job_item *ji); -static void destroy_portgroup(struct nat64lsn_portgroup *pg); -static void destroy_host6(struct nat64lsn_host *nh); -static int alloc_host6(struct nat64lsn_cfg *cfg, struct nat64lsn_job_item *ji); +#define NAT64_BIT_TCP_FIN 0 /* FIN was seen */ +#define NAT64_BIT_TCP_SYN 1 /* First syn in->out */ +#define NAT64_BIT_TCP_ESTAB 2 /* Packet with Ack */ +#define NAT64_BIT_READY_IPV4 6 /* state is ready for translate4 */ +#define NAT64_BIT_STALE 7 /* state is going to be expired */ -static int attach_portgroup(struct nat64lsn_cfg *cfg, - struct nat64lsn_job_item *ji); -static int attach_host6(struct nat64lsn_cfg *cfg, struct nat64lsn_job_item *ji); +#define NAT64_FLAG_FIN (1 << NAT64_BIT_TCP_FIN) +#define NAT64_FLAG_SYN (1 << NAT64_BIT_TCP_SYN) +#define NAT64_FLAG_ESTAB (1 << NAT64_BIT_TCP_ESTAB) +#define NAT64_FLAGS_TCP (NAT64_FLAG_SYN|NAT64_FLAG_ESTAB|NAT64_FLAG_FIN) +#define NAT64_FLAG_READY (1 << NAT64_BIT_READY_IPV4) +#define NAT64_FLAG_STALE (1 << NAT64_BIT_STALE) -/* XXX tmp */ -static uma_zone_t nat64lsn_host_zone; -static uma_zone_t nat64lsn_pg_zone; -static uma_zone_t nat64lsn_pgidx_zone; +static inline uint8_t +convert_tcp_flags(uint8_t flags) +{ + uint8_t result; -static unsigned int nat64lsn_periodic_chkstates(struct nat64lsn_cfg *cfg, - struct nat64lsn_host *nh); + result = flags & (TH_FIN|TH_SYN); + result |= (flags & TH_RST) >> 2; /* Treat RST as FIN */ + result |= (flags & TH_ACK) >> 2; /* Treat ACK as estab */ -#define I6_hash(x) (djb_hash((const unsigned char *)(x), 16)) -#define I6_first(_ph, h) (_ph)[h] -#define I6_next(x) (x)->next -#define I6_val(x) (&(x)->addr) -#define I6_cmp(a, b) IN6_ARE_ADDR_EQUAL(a, b) -#define I6_lock(a, b) -#define I6_unlock(a, b) + return (result); +} -#define I6HASH_FIND(_cfg, _res, _a) \ - CHT_FIND(_cfg->ih, _cfg->ihsize, I6_, _res, _a) -#define I6HASH_INSERT(_cfg, _i) \ - CHT_INSERT_HEAD(_cfg->ih, _cfg->ihsize, I6_, _i) -#define I6HASH_REMOVE(_cfg, _res, _tmp, _a) \ - CHT_REMOVE(_cfg->ih, _cfg->ihsize, I6_, _res, _tmp, _a) +static void +nat64lsn_log(struct pfloghdr *plog, struct mbuf *m, sa_family_t family, + uintptr_t state) +{ -#define I6HASH_FOREACH_SAFE(_cfg, _x, _tmp, _cb, _arg) \ - CHT_FOREACH_SAFE(_cfg->ih, _cfg->ihsize, I6_, _x, _tmp, _cb, _arg) + memset(plog, 0, sizeof(*plog)); + plog->length = PFLOG_REAL_HDRLEN; + plog->af = family; + plog->action = PF_NAT; + plog->dir = PF_IN; + plog->rulenr = htonl(state >> 32); + plog->subrulenr = htonl(state & 0xffffffff); + plog->ruleset[0] = '\0'; + strlcpy(plog->ifname, "NAT64LSN", sizeof(plog->ifname)); + ipfw_bpf_mtap2(plog, PFLOG_HDRLEN, m); +} -#define HASH_IN4(x) djb_hash((const unsigned char *)(x), 8) +#define HVAL(p, n, s) jenkins_hash32((const uint32_t *)(p), (n), (s)) +#define HOST_HVAL(c, a) HVAL((a),\ + sizeof(struct in6_addr) / sizeof(uint32_t), (c)->hash_seed) +#define HOSTS(c, v) ((c)->hosts_hash[(v) & ((c)->hosts_hashsize - 1)]) -static unsigned -djb_hash(const unsigned char *h, const int len) +#define ALIASLINK_HVAL(c, f) HVAL(&(f)->dst_ip6,\ + sizeof(struct in6_addr) * 2 / sizeof(uint32_t), (c)->hash_seed) +#define ALIAS_BYHASH(c, v) \ + ((c)->aliases[(v) & ((1 << (32 - (c)->plen4)) - 1)]) +static struct nat64lsn_aliaslink* +nat64lsn_get_aliaslink(struct nat64lsn_cfg *cfg __unused, + struct nat64lsn_host *host, const struct ipfw_flow_id *f_id __unused) { - unsigned int result = 0; - int i; - for (i = 0; i < len; i++) - result = 33 * result ^ h[i]; - - return (result); + /* + * We can implement some different algorithms how + * select an alias address. + * XXX: for now we use first available. + */ + return (CK_SLIST_FIRST(&host->aliases)); } -/* -static size_t -bitmask_size(size_t num, int *level) +#define FADDR_CHUNK(p, a) ((a) & ((p)->chunks_count - 1)) +#define FREEMASK_CHUNK(p, v) \ + ((p)->chunks_count == 1 ? &(p)->freemask : \ + &((p)->freemask_chunk[FADDR_CHUNK(p, v)])) +#define STATES_CHUNK(p, v) \ + ((p)->chunks_count == 1 ? (p)->states : \ + ((p)->states_chunk[FADDR_CHUNK(p, v)])) +#define STATE_HVAL(c, d) HVAL((d), 2, (c)->hash_seed) +#define STATE_HASH(h, v) \ + ((h)->states_hash[(v) & ((h)->states_hashsize - 1)]) + +#define NAT64LSN_TRY_PGCNT 32 +static struct nat64lsn_pg* +nat64lsn_get_pg(uint32_t *chunkmask, uint32_t *pgmask, + struct nat64lsn_pgchunk **chunks, struct nat64lsn_pg **pgptr, + uint32_t *pgidx, in_addr_t faddr) { - size_t x; - int c; + struct nat64lsn_pg *pg, *oldpg; + uint32_t idx, oldidx; + int cnt; - for (c = 0, x = num; num > 1; num /= 64, c++) - ; + cnt = 0; + /* First try last used PG */ + oldpg = pg = ck_pr_load_ptr(pgptr); + idx = oldidx = ck_pr_load_32(pgidx); + /* If pgidx is out of range, reset it to the first pgchunk */ + if (!ISSET32(*chunkmask, idx / 32)) + idx = 0; + do { + ck_pr_fence_load(); + if (pg != NULL && + bitcount64(*FREEMASK_CHUNK(pg, faddr)) > 0) { + /* + * If last used PG has not free states, + * try to update pointer. + * NOTE: it can be already updated by jobs handler, + * thus we use CAS operation. + */ + if (cnt > 0) + ck_pr_cas_ptr(pgptr, oldpg, pg); + return (pg); + } + /* Stop if idx is out of range */ + if (!ISSET32(*chunkmask, idx / 32)) + break; - return (x); -} + if (ISSET32(pgmask[idx / 32], idx % 32)) + pg = ck_pr_load_ptr( + &chunks[idx / 32]->pgptr[idx % 32]); + else + pg = NULL; -static void -bitmask_prepare(uint64_t *pmask, size_t bufsize, int level) -{ - size_t x, z; + idx++; + } while (++cnt < NAT64LSN_TRY_PGCNT); - memset(pmask, 0xFF, bufsize); - for (x = 0, z = 1; level > 1; x += z, z *= 64, level--) - ; - pmask[x] ~= 0x01; + /* If pgidx is out of range, reset it to the first pgchunk */ + if (!ISSET32(*chunkmask, idx / 32)) + idx = 0; + ck_pr_cas_32(pgidx, oldidx, idx); + return (NULL); } -*/ -static void -nat64lsn_log(struct pfloghdr *plog, struct mbuf *m, sa_family_t family, - uint32_t n, uint32_t sn) +static struct nat64lsn_state* +nat64lsn_get_state6to4(struct nat64lsn_cfg *cfg, struct nat64lsn_host *host, + const struct ipfw_flow_id *f_id, uint32_t hval, in_addr_t faddr, + uint16_t port, uint8_t proto) { + struct nat64lsn_aliaslink *link; + struct nat64lsn_state *state; + struct nat64lsn_pg *pg; + int i, offset; - memset(plog, 0, sizeof(*plog)); - plog->length = PFLOG_REAL_HDRLEN; - plog->af = family; - plog->action = PF_NAT; - plog->dir = PF_IN; - plog->rulenr = htonl(n); - plog->subrulenr = htonl(sn); - plog->ruleset[0] = '\0'; - strlcpy(plog->ifname, "NAT64LSN", sizeof(plog->ifname)); - ipfw_bpf_mtap2(plog, PFLOG_HDRLEN, m); + NAT64LSN_EPOCH_ASSERT(); + + /* Check that we already have state for given arguments */ + CK_SLIST_FOREACH(state, &STATE_HASH(host, hval), entries) { + if (state->proto == proto && state->ip_dst == faddr && + state->sport == port && state->dport == f_id->dst_port) + return (state); + } + + link = nat64lsn_get_aliaslink(cfg, host, f_id); + if (link == NULL) + return (NULL); + + switch (proto) { + case IPPROTO_TCP: + pg = nat64lsn_get_pg( + &link->alias->tcp_chunkmask, link->alias->tcp_pgmask, + link->alias->tcp, &link->alias->tcp_pg, + &link->alias->tcp_pgidx, faddr); + break; + case IPPROTO_UDP: + pg = nat64lsn_get_pg( + &link->alias->udp_chunkmask, link->alias->udp_pgmask, + link->alias->udp, &link->alias->udp_pg, + &link->alias->udp_pgidx, faddr); + break; + case IPPROTO_ICMP: + pg = nat64lsn_get_pg( + &link->alias->icmp_chunkmask, link->alias->icmp_pgmask, + link->alias->icmp, &link->alias->icmp_pg, + &link->alias->icmp_pgidx, faddr); + break; + default: + panic("%s: wrong proto %d", __func__, proto); + } + if (pg == NULL) + return (NULL); + + /* Check that PG has some free states */ + state = NULL; + i = bitcount64(*FREEMASK_CHUNK(pg, faddr)); + while (i-- > 0) { + offset = ffsll(*FREEMASK_CHUNK(pg, faddr)); + if (offset == 0) { + /* + * We lost the race. + * No more free states in this PG. + */ + break; + } + + /* Lets try to atomically grab the state */ + if (ck_pr_btr_64(FREEMASK_CHUNK(pg, faddr), offset - 1)) { + state = &STATES_CHUNK(pg, faddr)->state[offset - 1]; + /* Initialize */ + state->flags = proto != IPPROTO_TCP ? 0 : + convert_tcp_flags(f_id->_flags); + state->proto = proto; + state->aport = pg->base_port + offset - 1; + state->dport = f_id->dst_port; + state->sport = port; + state->ip6_dst = f_id->dst_ip6; + state->ip_dst = faddr; + state->ip_src = link->alias->addr; + state->hval = hval; + state->host = host; + SET_AGE(state->timestamp); + + /* Insert new state into host's hash table */ + HOST_LOCK(host); + CK_SLIST_INSERT_HEAD(&STATE_HASH(host, hval), + state, entries); + host->states_count++; + /* + * XXX: In case if host is going to be expired, + * reset NAT64LSN_DEADHOST flag. + */ + host->flags &= ~NAT64LSN_DEADHOST; + HOST_UNLOCK(host); + NAT64STAT_INC(&cfg->base.stats, screated); + /* Mark the state as ready for translate4 */ + ck_pr_fence_store(); + ck_pr_bts_32(&state->flags, NAT64_BIT_READY_IPV4); + break; + } + } + return (state); } + /* * Inspects icmp packets to see if the message contains different * packet header so we need to alter @addr and @port. */ static int -inspect_icmp_mbuf(struct mbuf **m, uint8_t *nat_proto, uint32_t *addr, +inspect_icmp_mbuf(struct mbuf **mp, uint8_t *proto, uint32_t *addr, uint16_t *port) { + struct icmp *icmp; struct ip *ip; - struct tcphdr *tcp; - struct udphdr *udp; - struct icmphdr *icmp; int off; - uint8_t proto; + uint8_t inner_proto; - ip = mtod(*m, struct ip *); /* Outer IP header */ + ip = mtod(*mp, struct ip *); /* Outer IP header */ off = (ip->ip_hl << 2) + ICMP_MINLEN; - if ((*m)->m_len < off) - *m = m_pullup(*m, off); - if (*m == NULL) + if ((*mp)->m_len < off) + *mp = m_pullup(*mp, off); + if (*mp == NULL) return (ENOMEM); - ip = mtod(*m, struct ip *); /* Outer IP header */ - icmp = L3HDR(ip, struct icmphdr *); + ip = mtod(*mp, struct ip *); /* Outer IP header */ + icmp = L3HDR(ip, struct icmp *); switch (icmp->icmp_type) { case ICMP_ECHO: case ICMP_ECHOREPLY: /* Use icmp ID as distinguisher */ - *port = ntohs(*((uint16_t *)(icmp + 1))); + *port = ntohs(icmp->icmp_id); return (0); case ICMP_UNREACH: case ICMP_TIMXCEED: @@ -266,90 +415,133 @@ inspect_icmp_mbuf(struct mbuf **m, uint8_t *nat_proto, * ICMP_UNREACH and ICMP_TIMXCEED contains IP header + 64 bits * of ULP header. */ - if ((*m)->m_pkthdr.len < off + sizeof(struct ip) + ICMP_MINLEN) + if ((*mp)->m_pkthdr.len < off + sizeof(struct ip) + ICMP_MINLEN) return (EINVAL); - if ((*m)->m_len < off + sizeof(struct ip) + ICMP_MINLEN) - *m = m_pullup(*m, off + sizeof(struct ip) + ICMP_MINLEN); - if (*m == NULL) + if ((*mp)->m_len < off + sizeof(struct ip) + ICMP_MINLEN) + *mp = m_pullup(*mp, off + sizeof(struct ip) + ICMP_MINLEN); + if (*mp == NULL) return (ENOMEM); - ip = mtodo(*m, off); /* Inner IP header */ - proto = ip->ip_p; + ip = mtodo(*mp, off); /* Inner IP header */ + inner_proto = ip->ip_p; off += ip->ip_hl << 2; /* Skip inner IP header */ *addr = ntohl(ip->ip_src.s_addr); - if ((*m)->m_len < off + ICMP_MINLEN) - *m = m_pullup(*m, off + ICMP_MINLEN); - if (*m == NULL) + if ((*mp)->m_len < off + ICMP_MINLEN) + *mp = m_pullup(*mp, off + ICMP_MINLEN); + if (*mp == NULL) return (ENOMEM); - switch (proto) { + switch (inner_proto) { case IPPROTO_TCP: - tcp = mtodo(*m, off); - *nat_proto = NAT_PROTO_TCP; - *port = ntohs(tcp->th_sport); - return (0); case IPPROTO_UDP: - udp = mtodo(*m, off); - *nat_proto = NAT_PROTO_UDP; - *port = ntohs(udp->uh_sport); + /* Copy source port from the header */ + *port = ntohs(*((uint16_t *)mtodo(*mp, off))); + *proto = inner_proto; return (0); case IPPROTO_ICMP: /* * We will translate only ICMP errors for our ICMP * echo requests. */ - icmp = mtodo(*m, off); + icmp = mtodo(*mp, off); if (icmp->icmp_type != ICMP_ECHO) return (EOPNOTSUPP); - *port = ntohs(*((uint16_t *)(icmp + 1))); + *port = ntohs(icmp->icmp_id); return (0); }; return (EOPNOTSUPP); } -static inline uint8_t -convert_tcp_flags(uint8_t flags) +static struct nat64lsn_state* +nat64lsn_get_state4to6(struct nat64lsn_cfg *cfg, struct nat64lsn_alias *alias, + in_addr_t faddr, uint16_t port, uint8_t proto) { - uint8_t result; + struct nat64lsn_state *state; + struct nat64lsn_pg *pg; + int chunk_idx, pg_idx, state_idx; - result = flags & (TH_FIN|TH_SYN); - result |= (flags & TH_RST) >> 2; /* Treat RST as FIN */ - result |= (flags & TH_ACK) >> 2; /* Treat ACK as estab */ + NAT64LSN_EPOCH_ASSERT(); - return (result); + if (port < NAT64_MIN_PORT) + return (NULL); + /* + * Alias keeps 32 pgchunks for each protocol. + * Each pgchunk has 32 pointers to portgroup. + * Each portgroup has 64 states for ports. + */ + port -= NAT64_MIN_PORT; + chunk_idx = port / 2048; + + port -= chunk_idx * 2048; + pg_idx = port / 64; + state_idx = port % 64; + + /* + * First check in proto_chunkmask that we have allocated PG chunk. + * Then check in proto_pgmask that we have valid PG pointer. + */ + pg = NULL; + switch (proto) { + case IPPROTO_TCP: + if (ISSET32(alias->tcp_chunkmask, chunk_idx) && + ISSET32(alias->tcp_pgmask[chunk_idx], pg_idx)) { + pg = alias->tcp[chunk_idx]->pgptr[pg_idx]; + break; + } + return (NULL); + case IPPROTO_UDP: + if (ISSET32(alias->udp_chunkmask, chunk_idx) && + ISSET32(alias->udp_pgmask[chunk_idx], pg_idx)) { + pg = alias->udp[chunk_idx]->pgptr[pg_idx]; + break; + } + return (NULL); + case IPPROTO_ICMP: + if (ISSET32(alias->icmp_chunkmask, chunk_idx) && + ISSET32(alias->icmp_pgmask[chunk_idx], pg_idx)) { + pg = alias->icmp[chunk_idx]->pgptr[pg_idx]; + break; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Mon Mar 18 14:00:21 2019 Return-Path: Delivered-To: svn-src-head@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 A1C251540294; Mon, 18 Mar 2019 14:00:21 +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 4D66A8A673; Mon, 18 Mar 2019 14:00:21 +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 23E1A22497; Mon, 18 Mar 2019 14:00:21 +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 x2IE0LLM049090; Mon, 18 Mar 2019 14:00:21 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2IE0JiD049079; Mon, 18 Mar 2019 14:00:19 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201903181400.x2IE0JiD049079@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 18 Mar 2019 14:00:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345275 - in head: sbin/ipfw sys/conf sys/modules/ipfw_nat64 sys/netinet6 sys/netpfil/ipfw/nat64 X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in head: sbin/ipfw sys/conf sys/modules/ipfw_nat64 sys/netinet6 sys/netpfil/ipfw/nat64 X-SVN-Commit-Revision: 345275 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4D66A8A673 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.949,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2019 14:00:22 -0000 Author: ae Date: Mon Mar 18 14:00:19 2019 New Revision: 345275 URL: https://svnweb.freebsd.org/changeset/base/345275 Log: Revert r345274. It appears that not all 32-bit architectures have necessary CK primitives. Modified: head/sbin/ipfw/ipfw.8 head/sbin/ipfw/ipfw2.h head/sbin/ipfw/nat64lsn.c head/sys/conf/files head/sys/modules/ipfw_nat64/Makefile head/sys/netinet6/ip_fw_nat64.h head/sys/netpfil/ipfw/nat64/nat64lsn.c head/sys/netpfil/ipfw/nat64/nat64lsn.h head/sys/netpfil/ipfw/nat64/nat64lsn_control.c Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Mon Mar 18 12:59:08 2019 (r345274) +++ head/sbin/ipfw/ipfw.8 Mon Mar 18 14:00:19 2019 (r345275) @@ -3300,7 +3300,6 @@ See .Sx SYSCTL VARIABLES for more info. .Sh IPv6/IPv4 NETWORK ADDRESS AND PROTOCOL TRANSLATION -.Ss Stateful translation .Nm supports in-kernel IPv6/IPv4 network address and protocol translation. Stateful NAT64 translation allows IPv6-only clients to contact IPv4 servers @@ -3318,8 +3317,7 @@ to be able use stateful NAT64 translator. Stateful NAT64 uses a bunch of memory for several types of objects. When IPv6 client initiates connection, NAT64 translator creates a host entry in the states table. -Each host entry uses preallocated IPv4 alias entry. -Each alias entry has a number of ports group entries allocated on demand. +Each host entry has a number of ports group entries allocated on demand. Ports group entries contains connection state entries. There are several options to control limits and lifetime for these objects. .Pp @@ -3339,11 +3337,6 @@ First time an original packet is handled and consumed and then it is handled again as translated packet. This behavior can be changed by sysctl variable .Va net.inet.ip.fw.nat64_direct_output . -Also translated packet can be tagged using -.Cm tag -rule action, and then matched by -.Cm tagged -opcode to avoid loops and extra overhead. .Pp The stateful NAT64 configuration command is the following: .Bd -ragged -offset indent @@ -3371,16 +3364,15 @@ to represent IPv4 addresses. This IPv6 prefix should b The translator implementation follows RFC6052, that restricts the length of prefixes to one of following: 32, 40, 48, 56, 64, or 96. The Well-Known IPv6 Prefix 64:ff9b:: must be 96 bits long. -The special -.Ar ::/length -prefix can be used to handle several IPv6 prefixes with one NAT64 instance. -The NAT64 instance will determine a destination IPv4 address from prefix -.Ar length . -.It Cm states_chunks Ar number -The number of states chunks in single ports group. -Each ports group by default can keep 64 state entries in single chunk. -The above value affects the maximum number of states that can be associated with single IPv4 alias address and port. -The value must be power of 2, and up to 128. +.It Cm max_ports Ar number +Maximum number of ports reserved for upper level protocols to one IPv6 client. +All reserved ports are divided into chunks between supported protocols. +The number of connections from one IPv6 client is limited by this option. +Note that closed TCP connections still remain in the list of connections until +.Cm tcp_close_age +interval will not expire. +Default value is +.Ar 2048 . .It Cm host_del_age Ar seconds The number of seconds until the host entry for a IPv6 client will be deleted and all its resources will be released due to inactivity. Modified: head/sbin/ipfw/ipfw2.h ============================================================================== --- head/sbin/ipfw/ipfw2.h Mon Mar 18 12:59:08 2019 (r345274) +++ head/sbin/ipfw/ipfw2.h Mon Mar 18 14:00:19 2019 (r345275) @@ -278,7 +278,6 @@ enum tokens { TOK_AGG_LEN, TOK_AGG_COUNT, TOK_MAX_PORTS, - TOK_STATES_CHUNKS, TOK_JMAXLEN, TOK_PORT_RANGE, TOK_HOST_DEL_AGE, Modified: head/sbin/ipfw/nat64lsn.c ============================================================================== --- head/sbin/ipfw/nat64lsn.c Mon Mar 18 12:59:08 2019 (r345274) +++ head/sbin/ipfw/nat64lsn.c Mon Mar 18 14:00:19 2019 (r345275) @@ -87,70 +87,68 @@ nat64lsn_print_states(void *buf) char sflags[4], *sf, *proto; ipfw_obj_header *oh; ipfw_obj_data *od; - ipfw_nat64lsn_stg_v1 *stg; - ipfw_nat64lsn_state_v1 *ste; + ipfw_nat64lsn_stg *stg; + ipfw_nat64lsn_state *ste; uint64_t next_idx; int i, sz; oh = (ipfw_obj_header *)buf; od = (ipfw_obj_data *)(oh + 1); - stg = (ipfw_nat64lsn_stg_v1 *)(od + 1); + stg = (ipfw_nat64lsn_stg *)(od + 1); sz = od->head.length - sizeof(*od); next_idx = 0; while (sz > 0 && next_idx != 0xFF) { - next_idx = stg->next.index; + next_idx = stg->next_idx; sz -= sizeof(*stg); if (stg->count == 0) { stg++; continue; } - /* - * NOTE: addresses are in network byte order, - * ports are in host byte order. - */ + switch (stg->proto) { + case IPPROTO_TCP: + proto = "TCP"; + break; + case IPPROTO_UDP: + proto = "UDP"; + break; + case IPPROTO_ICMPV6: + proto = "ICMPv6"; + break; + } + inet_ntop(AF_INET6, &stg->host6, s, sizeof(s)); inet_ntop(AF_INET, &stg->alias4, a, sizeof(a)); - ste = (ipfw_nat64lsn_state_v1 *)(stg + 1); + ste = (ipfw_nat64lsn_state *)(stg + 1); for (i = 0; i < stg->count && sz > 0; i++) { sf = sflags; - inet_ntop(AF_INET6, &ste->host6, s, sizeof(s)); inet_ntop(AF_INET, &ste->daddr, f, sizeof(f)); - switch (ste->proto) { - case IPPROTO_TCP: - proto = "TCP"; + if (stg->proto == IPPROTO_TCP) { if (ste->flags & 0x02) *sf++ = 'S'; if (ste->flags & 0x04) *sf++ = 'E'; if (ste->flags & 0x01) *sf++ = 'F'; - break; - case IPPROTO_UDP: - proto = "UDP"; - break; - case IPPROTO_ICMP: - proto = "ICMPv6"; - break; } *sf = '\0'; - switch (ste->proto) { + switch (stg->proto) { case IPPROTO_TCP: case IPPROTO_UDP: printf("%s:%d\t%s:%d\t%s\t%s\t%d\t%s:%d\n", s, ste->sport, a, ste->aport, proto, sflags, ste->idle, f, ste->dport); break; - case IPPROTO_ICMP: + case IPPROTO_ICMPV6: printf("%s\t%s\t%s\t\t%d\t%s\n", s, a, proto, ste->idle, f); break; default: printf("%s\t%s\t%d\t\t%d\t%s\n", - s, a, ste->proto, ste->idle, f); + s, a, stg->proto, ste->idle, f); } ste++; sz -= sizeof(*ste); } - stg = (ipfw_nat64lsn_stg_v1 *)ste; + stg = (ipfw_nat64lsn_stg *)ste; } return (next_idx); } @@ -176,7 +174,6 @@ nat64lsn_states_cb(ipfw_nat64lsn_cfg *cfg, const char err(EX_OSERR, NULL); do { oh = (ipfw_obj_header *)buf; - oh->opheader.version = 1; /* Force using ov new API */ od = (ipfw_obj_data *)(oh + 1); nat64lsn_fill_ntlv(&oh->ntlv, cfg->name, set); od->head.type = IPFW_TLV_OBJDATA; @@ -366,8 +363,12 @@ nat64lsn_parse_int(const char *arg, const char *desc) static struct _s_x nat64newcmds[] = { { "prefix6", TOK_PREFIX6 }, + { "agg_len", TOK_AGG_LEN }, /* not yet */ + { "agg_count", TOK_AGG_COUNT }, /* not yet */ + { "port_range", TOK_PORT_RANGE }, /* not yet */ { "jmaxlen", TOK_JMAXLEN }, { "prefix4", TOK_PREFIX4 }, + { "max_ports", TOK_MAX_PORTS }, { "host_del_age", TOK_HOST_DEL_AGE }, { "pg_del_age", TOK_PG_DEL_AGE }, { "tcp_syn_age", TOK_TCP_SYN_AGE }, @@ -375,13 +376,10 @@ static struct _s_x nat64newcmds[] = { { "tcp_est_age", TOK_TCP_EST_AGE }, { "udp_age", TOK_UDP_AGE }, { "icmp_age", TOK_ICMP_AGE }, - { "states_chunks",TOK_STATES_CHUNKS }, { "log", TOK_LOG }, { "-log", TOK_LOGOFF }, { "allow_private", TOK_PRIVATE }, { "-allow_private", TOK_PRIVATEOFF }, - /* for compatibility with old configurations */ - { "max_ports", TOK_MAX_PORTS }, /* unused */ { NULL, 0 } }; @@ -438,17 +436,42 @@ nat64lsn_create(const char *name, uint8_t set, int ac, nat64lsn_parse_prefix(*av, AF_INET6, &cfg->prefix6, &cfg->plen6); if (ipfw_check_nat64prefix(&cfg->prefix6, - cfg->plen6) != 0 && - !IN6_IS_ADDR_UNSPECIFIED(&cfg->prefix6)) + cfg->plen6) != 0) errx(EX_USAGE, "Bad prefix6 %s", *av); ac--; av++; break; +#if 0 + case TOK_AGG_LEN: + NEED1("Aggregation prefix len required"); + cfg->agg_prefix_len = nat64lsn_parse_int(*av, opt); + ac--; av++; + break; + case TOK_AGG_COUNT: + NEED1("Max per-prefix count required"); + cfg->agg_prefix_max = nat64lsn_parse_int(*av, opt); + ac--; av++; + break; + case TOK_PORT_RANGE: + NEED1("port range x[:y] required"); + if ((p = strchr(*av, ':')) == NULL) + cfg->min_port = (uint16_t)nat64lsn_parse_int( + *av, opt); + else { + *p++ = '\0'; + cfg->min_port = (uint16_t)nat64lsn_parse_int( + *av, opt); + cfg->max_port = (uint16_t)nat64lsn_parse_int( + p, opt); + } + ac--; av++; + break; case TOK_JMAXLEN: NEED1("job queue length required"); cfg->jmaxlen = nat64lsn_parse_int(*av, opt); ac--; av++; break; +#endif case TOK_MAX_PORTS: NEED1("Max per-user ports required"); cfg->max_ports = nat64lsn_parse_int(*av, opt); @@ -496,12 +519,6 @@ nat64lsn_create(const char *name, uint8_t set, int ac, *av, opt); ac--; av++; break; - case TOK_STATES_CHUNKS: - NEED1("number of chunks required"); - cfg->states_chunks = (uint8_t)nat64lsn_parse_int( - *av, opt); - ac--; av++; - break; case TOK_LOG: cfg->flags |= NAT64_LOG; break; @@ -613,12 +630,6 @@ nat64lsn_config(const char *name, uint8_t set, int ac, *av, opt); ac--; av++; break; - case TOK_STATES_CHUNKS: - NEED1("number of chunks required"); - cfg->states_chunks = (uint8_t)nat64lsn_parse_int( - *av, opt); - ac--; av++; - break; case TOK_LOG: cfg->flags |= NAT64_LOG; break; @@ -778,24 +789,31 @@ nat64lsn_show_cb(ipfw_nat64lsn_cfg *cfg, const char *n printf("nat64lsn %s prefix4 %s/%u", cfg->name, abuf, cfg->plen4); inet_ntop(AF_INET6, &cfg->prefix6, abuf, sizeof(abuf)); printf(" prefix6 %s/%u", abuf, cfg->plen6); - if (co.verbose || cfg->states_chunks > 1) - printf(" states_chunks %u", cfg->states_chunks); - if (co.verbose || cfg->nh_delete_delay != NAT64LSN_HOST_AGE) +#if 0 + printf("agg_len %u agg_count %u ", cfg->agg_prefix_len, + cfg->agg_prefix_max); + if (cfg->min_port != NAT64LSN_PORT_MIN || + cfg->max_port != NAT64LSN_PORT_MAX) + printf(" port_range %u:%u", cfg->min_port, cfg->max_port); + if (cfg->jmaxlen != NAT64LSN_JMAXLEN) + printf(" jmaxlen %u ", cfg->jmaxlen); +#endif + if (cfg->max_ports != NAT64LSN_MAX_PORTS) + printf(" max_ports %u", cfg->max_ports); + if (cfg->nh_delete_delay != NAT64LSN_HOST_AGE) printf(" host_del_age %u", cfg->nh_delete_delay); - if (co.verbose || cfg->pg_delete_delay != NAT64LSN_PG_AGE) + if (cfg->pg_delete_delay != NAT64LSN_PG_AGE) printf(" pg_del_age %u ", cfg->pg_delete_delay); - if (co.verbose || cfg->st_syn_ttl != NAT64LSN_TCP_SYN_AGE) + if (cfg->st_syn_ttl != NAT64LSN_TCP_SYN_AGE) printf(" tcp_syn_age %u", cfg->st_syn_ttl); - if (co.verbose || cfg->st_close_ttl != NAT64LSN_TCP_FIN_AGE) + if (cfg->st_close_ttl != NAT64LSN_TCP_FIN_AGE) printf(" tcp_close_age %u", cfg->st_close_ttl); - if (co.verbose || cfg->st_estab_ttl != NAT64LSN_TCP_EST_AGE) + if (cfg->st_estab_ttl != NAT64LSN_TCP_EST_AGE) printf(" tcp_est_age %u", cfg->st_estab_ttl); - if (co.verbose || cfg->st_udp_ttl != NAT64LSN_UDP_AGE) + if (cfg->st_udp_ttl != NAT64LSN_UDP_AGE) printf(" udp_age %u", cfg->st_udp_ttl); - if (co.verbose || cfg->st_icmp_ttl != NAT64LSN_ICMP_AGE) + if (cfg->st_icmp_ttl != NAT64LSN_ICMP_AGE) printf(" icmp_age %u", cfg->st_icmp_ttl); - if (co.verbose || cfg->jmaxlen != NAT64LSN_JMAXLEN) - printf(" jmaxlen %u ", cfg->jmaxlen); if (cfg->flags & NAT64_LOG) printf(" log"); if (cfg->flags & NAT64_ALLOW_PRIVATE) Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Mar 18 12:59:08 2019 (r345274) +++ head/sys/conf/files Mon Mar 18 14:00:19 2019 (r345275) @@ -4398,9 +4398,9 @@ netpfil/ipfw/nat64/nat64clat.c optional inet inet6 ipf netpfil/ipfw/nat64/nat64clat_control.c optional inet inet6 ipfirewall \ ipfirewall_nat64 netpfil/ipfw/nat64/nat64lsn.c optional inet inet6 ipfirewall \ - ipfirewall_nat64 compile-with "${NORMAL_C} -I$S/contrib/ck/include" + ipfirewall_nat64 netpfil/ipfw/nat64/nat64lsn_control.c optional inet inet6 ipfirewall \ - ipfirewall_nat64 compile-with "${NORMAL_C} -I$S/contrib/ck/include" + ipfirewall_nat64 netpfil/ipfw/nat64/nat64stl.c optional inet inet6 ipfirewall \ ipfirewall_nat64 netpfil/ipfw/nat64/nat64stl_control.c optional inet inet6 ipfirewall \ Modified: head/sys/modules/ipfw_nat64/Makefile ============================================================================== --- head/sys/modules/ipfw_nat64/Makefile Mon Mar 18 12:59:08 2019 (r345274) +++ head/sys/modules/ipfw_nat64/Makefile Mon Mar 18 14:00:19 2019 (r345275) @@ -8,6 +8,4 @@ SRCS+= nat64clat.c nat64clat_control.c SRCS+= nat64lsn.c nat64lsn_control.c SRCS+= nat64stl.c nat64stl_control.c -CFLAGS+= -I${SRCTOP}/sys/contrib/ck/include - .include Modified: head/sys/netinet6/ip_fw_nat64.h ============================================================================== --- head/sys/netinet6/ip_fw_nat64.h Mon Mar 18 12:59:08 2019 (r345274) +++ head/sys/netinet6/ip_fw_nat64.h Mon Mar 18 14:00:19 2019 (r345275) @@ -122,7 +122,7 @@ typedef struct _ipfw_nat64clat_cfg { /* * NAT64LSN default configuration values */ -#define NAT64LSN_MAX_PORTS 2048 /* Unused */ +#define NAT64LSN_MAX_PORTS 2048 /* Max number of ports per host */ #define NAT64LSN_JMAXLEN 2048 /* Max outstanding requests. */ #define NAT64LSN_TCP_SYN_AGE 10 /* State's TTL after SYN received. */ #define NAT64LSN_TCP_EST_AGE (2 * 3600) /* TTL for established connection */ @@ -135,20 +135,16 @@ typedef struct _ipfw_nat64clat_cfg { typedef struct _ipfw_nat64lsn_cfg { char name[64]; /* NAT name */ uint32_t flags; - - uint32_t max_ports; /* Unused */ - uint32_t agg_prefix_len; /* Unused */ - uint32_t agg_prefix_max; /* Unused */ - + uint32_t max_ports; /* Max ports per client */ + uint32_t agg_prefix_len; /* Prefix length to count */ + uint32_t agg_prefix_max; /* Max hosts per agg prefix */ struct in_addr prefix4; uint16_t plen4; /* Prefix length */ uint16_t plen6; /* Prefix length */ struct in6_addr prefix6; /* NAT64 prefix */ uint32_t jmaxlen; /* Max jobqueue length */ - - uint16_t min_port; /* Unused */ - uint16_t max_port; /* Unused */ - + uint16_t min_port; /* Min port group # to use */ + uint16_t max_port; /* Max port group # to use */ uint16_t nh_delete_delay;/* Stale host delete delay */ uint16_t pg_delete_delay;/* Stale portgroup delete delay */ uint16_t st_syn_ttl; /* TCP syn expire */ @@ -157,7 +153,7 @@ typedef struct _ipfw_nat64lsn_cfg { uint16_t st_udp_ttl; /* UDP expire */ uint16_t st_icmp_ttl; /* ICMP expire */ uint8_t set; /* Named instance set [0..31] */ - uint8_t states_chunks; /* Number of states chunks per PG */ + uint8_t spare; } ipfw_nat64lsn_cfg; typedef struct _ipfw_nat64lsn_state { @@ -181,30 +177,5 @@ typedef struct _ipfw_nat64lsn_stg { uint32_t spare2; } ipfw_nat64lsn_stg; -typedef struct _ipfw_nat64lsn_state_v1 { - struct in6_addr host6; /* Bound IPv6 host */ - struct in_addr daddr; /* Remote IPv4 address */ - uint16_t dport; /* Remote destination port */ - uint16_t aport; /* Local alias port */ - uint16_t sport; /* Source port */ - uint16_t spare; - uint16_t idle; /* Last used time */ - uint8_t flags; /* State flags */ - uint8_t proto; /* protocol */ -} ipfw_nat64lsn_state_v1; - -typedef struct _ipfw_nat64lsn_stg_v1 { - union nat64lsn_pgidx { - uint64_t index; - struct { - uint8_t chunk; /* states chunk */ - uint8_t proto; /* protocol */ - uint16_t port; /* base port */ - in_addr_t addr; /* alias address */ - }; - } next; /* next state index */ - struct in_addr alias4; /* IPv4 alias address */ - uint32_t count; /* Number of states */ -} ipfw_nat64lsn_stg_v1; - #endif /* _NETINET6_IP_FW_NAT64_H_ */ + Modified: head/sys/netpfil/ipfw/nat64/nat64lsn.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64lsn.c Mon Mar 18 12:59:08 2019 (r345274) +++ head/sys/netpfil/ipfw/nat64/nat64lsn.c Mon Mar 18 14:00:19 2019 (r345275) @@ -33,17 +33,16 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include #include -#include #include #include #include #include #include #include +#include #include +#include #include #include @@ -72,22 +71,17 @@ __FBSDID("$FreeBSD$"); MALLOC_DEFINE(M_NAT64LSN, "NAT64LSN", "NAT64LSN"); -static epoch_t nat64lsn_epoch; -#define NAT64LSN_EPOCH_ENTER(et) epoch_enter_preempt(nat64lsn_epoch, &(et)) -#define NAT64LSN_EPOCH_EXIT(et) epoch_exit_preempt(nat64lsn_epoch, &(et)) -#define NAT64LSN_EPOCH_WAIT() epoch_wait_preempt(nat64lsn_epoch) -#define NAT64LSN_EPOCH_ASSERT() MPASS(in_epoch(nat64lsn_epoch)) -#define NAT64LSN_EPOCH_CALL(c, f) epoch_call(nat64lsn_epoch, (c), (f)) +static void nat64lsn_periodic(void *data); +#define PERIODIC_DELAY 4 +static uint8_t nat64lsn_proto_map[256]; +uint8_t nat64lsn_rproto_map[NAT_MAX_PROTO]; -static uma_zone_t nat64lsn_host_zone; -static uma_zone_t nat64lsn_pgchunk_zone; -static uma_zone_t nat64lsn_pg_zone; -static uma_zone_t nat64lsn_aliaslink_zone; -static uma_zone_t nat64lsn_state_zone; -static uma_zone_t nat64lsn_job_zone; +#define NAT64_FLAG_FIN 0x01 /* FIN was seen */ +#define NAT64_FLAG_SYN 0x02 /* First syn in->out */ +#define NAT64_FLAG_ESTAB 0x04 /* Packet with Ack */ +#define NAT64_FLAGS_TCP (NAT64_FLAG_SYN|NAT64_FLAG_ESTAB|NAT64_FLAG_FIN) -static void nat64lsn_periodic(void *data); -#define PERIODIC_DELAY 4 +#define NAT64_FLAG_RDR 0x80 /* Port redirect */ #define NAT64_LOOKUP(chain, cmd) \ (struct nat64lsn_cfg *)SRV_OBJECT((chain), (cmd)->arg1) /* @@ -97,33 +91,25 @@ static void nat64lsn_periodic(void *data); enum nat64lsn_jtype { JTYPE_NEWHOST = 1, JTYPE_NEWPORTGROUP, - JTYPE_DESTROY, + JTYPE_DELPORTGROUP, }; struct nat64lsn_job_item { - STAILQ_ENTRY(nat64lsn_job_item) entries; + TAILQ_ENTRY(nat64lsn_job_item) next; enum nat64lsn_jtype jtype; - - union { - struct { /* used by JTYPE_NEWHOST, JTYPE_NEWPORTGROUP */ - struct mbuf *m; - struct nat64lsn_host *host; - struct nat64lsn_state *state; - uint32_t src6_hval; - uint32_t state_hval; - struct ipfw_flow_id f_id; - in_addr_t faddr; - uint16_t port; - uint8_t proto; - uint8_t done; - }; - struct { /* used by JTYPE_DESTROY */ - struct nat64lsn_hosts_slist hosts; - struct nat64lsn_pg_slist portgroups; - struct nat64lsn_pgchunk *pgchunk; - struct epoch_context epoch_ctx; - }; - }; + struct nat64lsn_host *nh; + struct nat64lsn_portgroup *pg; + void *spare_idx; + struct in6_addr haddr; + uint8_t nat_proto; + uint8_t done; + int needs_idx; + int delcount; + unsigned int fhash; /* Flow hash */ + uint32_t aaddr; /* Last used address (net) */ + struct mbuf *m; + struct ipfw_flow_id f_id; + uint64_t delmask[NAT64LSN_PGPTRNMASK]; }; static struct mtx jmtx; @@ -132,278 +118,143 @@ static struct mtx jmtx; #define JQUEUE_LOCK() mtx_lock(&jmtx) #define JQUEUE_UNLOCK() mtx_unlock(&jmtx) -static int nat64lsn_alloc_host(struct nat64lsn_cfg *cfg, - struct nat64lsn_job_item *ji); -static int nat64lsn_alloc_pg(struct nat64lsn_cfg *cfg, - struct nat64lsn_job_item *ji); -static struct nat64lsn_job_item *nat64lsn_create_job( - struct nat64lsn_cfg *cfg, int jtype); static void nat64lsn_enqueue_job(struct nat64lsn_cfg *cfg, struct nat64lsn_job_item *ji); -static void nat64lsn_job_destroy(epoch_context_t ctx); -static void nat64lsn_destroy_host(struct nat64lsn_host *host); -static void nat64lsn_destroy_pg(struct nat64lsn_pg *pg); +static void nat64lsn_enqueue_jobs(struct nat64lsn_cfg *cfg, + struct nat64lsn_job_head *jhead, int jlen); +static struct nat64lsn_job_item *nat64lsn_create_job(struct nat64lsn_cfg *cfg, + const struct ipfw_flow_id *f_id, int jtype); +static int nat64lsn_request_portgroup(struct nat64lsn_cfg *cfg, + const struct ipfw_flow_id *f_id, struct mbuf **pm, uint32_t aaddr, + int needs_idx); +static int nat64lsn_request_host(struct nat64lsn_cfg *cfg, + const struct ipfw_flow_id *f_id, struct mbuf **pm); static int nat64lsn_translate4(struct nat64lsn_cfg *cfg, - const struct ipfw_flow_id *f_id, struct mbuf **mp); + const struct ipfw_flow_id *f_id, struct mbuf **pm); static int nat64lsn_translate6(struct nat64lsn_cfg *cfg, - struct ipfw_flow_id *f_id, struct mbuf **mp); -static int nat64lsn_translate6_internal(struct nat64lsn_cfg *cfg, - struct mbuf **mp, struct nat64lsn_state *state, uint8_t flags); + struct ipfw_flow_id *f_id, struct mbuf **pm); -#define NAT64_BIT_TCP_FIN 0 /* FIN was seen */ -#define NAT64_BIT_TCP_SYN 1 /* First syn in->out */ -#define NAT64_BIT_TCP_ESTAB 2 /* Packet with Ack */ -#define NAT64_BIT_READY_IPV4 6 /* state is ready for translate4 */ -#define NAT64_BIT_STALE 7 /* state is going to be expired */ +static int alloc_portgroup(struct nat64lsn_job_item *ji); +static void destroy_portgroup(struct nat64lsn_portgroup *pg); +static void destroy_host6(struct nat64lsn_host *nh); +static int alloc_host6(struct nat64lsn_cfg *cfg, struct nat64lsn_job_item *ji); -#define NAT64_FLAG_FIN (1 << NAT64_BIT_TCP_FIN) -#define NAT64_FLAG_SYN (1 << NAT64_BIT_TCP_SYN) -#define NAT64_FLAG_ESTAB (1 << NAT64_BIT_TCP_ESTAB) -#define NAT64_FLAGS_TCP (NAT64_FLAG_SYN|NAT64_FLAG_ESTAB|NAT64_FLAG_FIN) +static int attach_portgroup(struct nat64lsn_cfg *cfg, + struct nat64lsn_job_item *ji); +static int attach_host6(struct nat64lsn_cfg *cfg, struct nat64lsn_job_item *ji); -#define NAT64_FLAG_READY (1 << NAT64_BIT_READY_IPV4) -#define NAT64_FLAG_STALE (1 << NAT64_BIT_STALE) -static inline uint8_t -convert_tcp_flags(uint8_t flags) -{ - uint8_t result; +/* XXX tmp */ +static uma_zone_t nat64lsn_host_zone; +static uma_zone_t nat64lsn_pg_zone; +static uma_zone_t nat64lsn_pgidx_zone; - result = flags & (TH_FIN|TH_SYN); - result |= (flags & TH_RST) >> 2; /* Treat RST as FIN */ - result |= (flags & TH_ACK) >> 2; /* Treat ACK as estab */ +static unsigned int nat64lsn_periodic_chkstates(struct nat64lsn_cfg *cfg, + struct nat64lsn_host *nh); - return (result); -} +#define I6_hash(x) (djb_hash((const unsigned char *)(x), 16)) +#define I6_first(_ph, h) (_ph)[h] +#define I6_next(x) (x)->next +#define I6_val(x) (&(x)->addr) +#define I6_cmp(a, b) IN6_ARE_ADDR_EQUAL(a, b) +#define I6_lock(a, b) +#define I6_unlock(a, b) -static void -nat64lsn_log(struct pfloghdr *plog, struct mbuf *m, sa_family_t family, - uintptr_t state) -{ +#define I6HASH_FIND(_cfg, _res, _a) \ + CHT_FIND(_cfg->ih, _cfg->ihsize, I6_, _res, _a) +#define I6HASH_INSERT(_cfg, _i) \ + CHT_INSERT_HEAD(_cfg->ih, _cfg->ihsize, I6_, _i) +#define I6HASH_REMOVE(_cfg, _res, _tmp, _a) \ + CHT_REMOVE(_cfg->ih, _cfg->ihsize, I6_, _res, _tmp, _a) - memset(plog, 0, sizeof(*plog)); - plog->length = PFLOG_REAL_HDRLEN; - plog->af = family; - plog->action = PF_NAT; - plog->dir = PF_IN; - plog->rulenr = htonl(state >> 32); - plog->subrulenr = htonl(state & 0xffffffff); - plog->ruleset[0] = '\0'; - strlcpy(plog->ifname, "NAT64LSN", sizeof(plog->ifname)); - ipfw_bpf_mtap2(plog, PFLOG_HDRLEN, m); -} +#define I6HASH_FOREACH_SAFE(_cfg, _x, _tmp, _cb, _arg) \ + CHT_FOREACH_SAFE(_cfg->ih, _cfg->ihsize, I6_, _x, _tmp, _cb, _arg) -#define HVAL(p, n, s) jenkins_hash32((const uint32_t *)(p), (n), (s)) -#define HOST_HVAL(c, a) HVAL((a),\ - sizeof(struct in6_addr) / sizeof(uint32_t), (c)->hash_seed) -#define HOSTS(c, v) ((c)->hosts_hash[(v) & ((c)->hosts_hashsize - 1)]) +#define HASH_IN4(x) djb_hash((const unsigned char *)(x), 8) -#define ALIASLINK_HVAL(c, f) HVAL(&(f)->dst_ip6,\ - sizeof(struct in6_addr) * 2 / sizeof(uint32_t), (c)->hash_seed) -#define ALIAS_BYHASH(c, v) \ - ((c)->aliases[(v) & ((1 << (32 - (c)->plen4)) - 1)]) -static struct nat64lsn_aliaslink* -nat64lsn_get_aliaslink(struct nat64lsn_cfg *cfg __unused, - struct nat64lsn_host *host, const struct ipfw_flow_id *f_id __unused) +static unsigned +djb_hash(const unsigned char *h, const int len) { + unsigned int result = 0; + int i; - /* - * We can implement some different algorithms how - * select an alias address. - * XXX: for now we use first available. - */ - return (CK_SLIST_FIRST(&host->aliases)); + for (i = 0; i < len; i++) + result = 33 * result ^ h[i]; + + return (result); } -#define FADDR_CHUNK(p, a) ((a) & ((p)->chunks_count - 1)) -#define FREEMASK_CHUNK(p, v) \ - ((p)->chunks_count == 1 ? &(p)->freemask : \ - &((p)->freemask_chunk[FADDR_CHUNK(p, v)])) -#define STATES_CHUNK(p, v) \ - ((p)->chunks_count == 1 ? (p)->states : \ - ((p)->states_chunk[FADDR_CHUNK(p, v)])) -#define STATE_HVAL(c, d) HVAL((d), 2, (c)->hash_seed) -#define STATE_HASH(h, v) \ - ((h)->states_hash[(v) & ((h)->states_hashsize - 1)]) - -#define NAT64LSN_TRY_PGCNT 32 -static struct nat64lsn_pg* -nat64lsn_get_pg(uint32_t *chunkmask, uint32_t *pgmask, - struct nat64lsn_pgchunk **chunks, struct nat64lsn_pg **pgptr, - uint32_t *pgidx, in_addr_t faddr) +/* +static size_t +bitmask_size(size_t num, int *level) { - struct nat64lsn_pg *pg, *oldpg; - uint32_t idx, oldidx; - int cnt; + size_t x; + int c; - cnt = 0; - /* First try last used PG */ - oldpg = pg = ck_pr_load_ptr(pgptr); - idx = oldidx = ck_pr_load_32(pgidx); - /* If pgidx is out of range, reset it to the first pgchunk */ - if (!ISSET32(*chunkmask, idx / 32)) - idx = 0; - do { - ck_pr_fence_load(); - if (pg != NULL && - bitcount64(*FREEMASK_CHUNK(pg, faddr)) > 0) { - /* - * If last used PG has not free states, - * try to update pointer. - * NOTE: it can be already updated by jobs handler, - * thus we use CAS operation. - */ - if (cnt > 0) - ck_pr_cas_ptr(pgptr, oldpg, pg); - return (pg); - } - /* Stop if idx is out of range */ - if (!ISSET32(*chunkmask, idx / 32)) - break; + for (c = 0, x = num; num > 1; num /= 64, c++) + ; - if (ISSET32(pgmask[idx / 32], idx % 32)) - pg = ck_pr_load_ptr( - &chunks[idx / 32]->pgptr[idx % 32]); - else - pg = NULL; + return (x); +} - idx++; - } while (++cnt < NAT64LSN_TRY_PGCNT); +static void +bitmask_prepare(uint64_t *pmask, size_t bufsize, int level) +{ + size_t x, z; - /* If pgidx is out of range, reset it to the first pgchunk */ - if (!ISSET32(*chunkmask, idx / 32)) - idx = 0; - ck_pr_cas_32(pgidx, oldidx, idx); - return (NULL); + memset(pmask, 0xFF, bufsize); + for (x = 0, z = 1; level > 1; x += z, z *= 64, level--) + ; + pmask[x] ~= 0x01; } +*/ -static struct nat64lsn_state* -nat64lsn_get_state6to4(struct nat64lsn_cfg *cfg, struct nat64lsn_host *host, - const struct ipfw_flow_id *f_id, uint32_t hval, in_addr_t faddr, - uint16_t port, uint8_t proto) +static void +nat64lsn_log(struct pfloghdr *plog, struct mbuf *m, sa_family_t family, + uint32_t n, uint32_t sn) { - struct nat64lsn_aliaslink *link; - struct nat64lsn_state *state; - struct nat64lsn_pg *pg; - int i, offset; - NAT64LSN_EPOCH_ASSERT(); - - /* Check that we already have state for given arguments */ - CK_SLIST_FOREACH(state, &STATE_HASH(host, hval), entries) { - if (state->proto == proto && state->ip_dst == faddr && - state->sport == port && state->dport == f_id->dst_port) - return (state); - } - - link = nat64lsn_get_aliaslink(cfg, host, f_id); - if (link == NULL) - return (NULL); - - switch (proto) { - case IPPROTO_TCP: - pg = nat64lsn_get_pg( - &link->alias->tcp_chunkmask, link->alias->tcp_pgmask, - link->alias->tcp, &link->alias->tcp_pg, - &link->alias->tcp_pgidx, faddr); - break; - case IPPROTO_UDP: - pg = nat64lsn_get_pg( - &link->alias->udp_chunkmask, link->alias->udp_pgmask, - link->alias->udp, &link->alias->udp_pg, - &link->alias->udp_pgidx, faddr); - break; - case IPPROTO_ICMP: - pg = nat64lsn_get_pg( - &link->alias->icmp_chunkmask, link->alias->icmp_pgmask, - link->alias->icmp, &link->alias->icmp_pg, - &link->alias->icmp_pgidx, faddr); - break; - default: - panic("%s: wrong proto %d", __func__, proto); - } - if (pg == NULL) - return (NULL); - - /* Check that PG has some free states */ - state = NULL; - i = bitcount64(*FREEMASK_CHUNK(pg, faddr)); - while (i-- > 0) { - offset = ffsll(*FREEMASK_CHUNK(pg, faddr)); - if (offset == 0) { - /* - * We lost the race. - * No more free states in this PG. - */ - break; - } - - /* Lets try to atomically grab the state */ - if (ck_pr_btr_64(FREEMASK_CHUNK(pg, faddr), offset - 1)) { - state = &STATES_CHUNK(pg, faddr)->state[offset - 1]; - /* Initialize */ - state->flags = proto != IPPROTO_TCP ? 0 : - convert_tcp_flags(f_id->_flags); - state->proto = proto; - state->aport = pg->base_port + offset - 1; - state->dport = f_id->dst_port; - state->sport = port; - state->ip6_dst = f_id->dst_ip6; - state->ip_dst = faddr; - state->ip_src = link->alias->addr; - state->hval = hval; - state->host = host; - SET_AGE(state->timestamp); - - /* Insert new state into host's hash table */ - HOST_LOCK(host); - CK_SLIST_INSERT_HEAD(&STATE_HASH(host, hval), - state, entries); - host->states_count++; - /* - * XXX: In case if host is going to be expired, - * reset NAT64LSN_DEADHOST flag. - */ - host->flags &= ~NAT64LSN_DEADHOST; - HOST_UNLOCK(host); - NAT64STAT_INC(&cfg->base.stats, screated); - /* Mark the state as ready for translate4 */ - ck_pr_fence_store(); - ck_pr_bts_32(&state->flags, NAT64_BIT_READY_IPV4); - break; - } - } - return (state); + memset(plog, 0, sizeof(*plog)); + plog->length = PFLOG_REAL_HDRLEN; + plog->af = family; + plog->action = PF_NAT; + plog->dir = PF_IN; + plog->rulenr = htonl(n); + plog->subrulenr = htonl(sn); + plog->ruleset[0] = '\0'; + strlcpy(plog->ifname, "NAT64LSN", sizeof(plog->ifname)); + ipfw_bpf_mtap2(plog, PFLOG_HDRLEN, m); } - /* * Inspects icmp packets to see if the message contains different * packet header so we need to alter @addr and @port. */ static int -inspect_icmp_mbuf(struct mbuf **mp, uint8_t *proto, uint32_t *addr, +inspect_icmp_mbuf(struct mbuf **m, uint8_t *nat_proto, uint32_t *addr, uint16_t *port) { - struct icmp *icmp; struct ip *ip; + struct tcphdr *tcp; + struct udphdr *udp; + struct icmphdr *icmp; int off; - uint8_t inner_proto; + uint8_t proto; - ip = mtod(*mp, struct ip *); /* Outer IP header */ + ip = mtod(*m, struct ip *); /* Outer IP header */ off = (ip->ip_hl << 2) + ICMP_MINLEN; - if ((*mp)->m_len < off) - *mp = m_pullup(*mp, off); - if (*mp == NULL) + if ((*m)->m_len < off) + *m = m_pullup(*m, off); + if (*m == NULL) return (ENOMEM); - ip = mtod(*mp, struct ip *); /* Outer IP header */ - icmp = L3HDR(ip, struct icmp *); + ip = mtod(*m, struct ip *); /* Outer IP header */ + icmp = L3HDR(ip, struct icmphdr *); switch (icmp->icmp_type) { case ICMP_ECHO: case ICMP_ECHOREPLY: /* Use icmp ID as distinguisher */ - *port = ntohs(icmp->icmp_id); + *port = ntohs(*((uint16_t *)(icmp + 1))); return (0); case ICMP_UNREACH: case ICMP_TIMXCEED: @@ -415,133 +266,90 @@ inspect_icmp_mbuf(struct mbuf **mp, uint8_t *proto, ui * ICMP_UNREACH and ICMP_TIMXCEED contains IP header + 64 bits * of ULP header. */ - if ((*mp)->m_pkthdr.len < off + sizeof(struct ip) + ICMP_MINLEN) + if ((*m)->m_pkthdr.len < off + sizeof(struct ip) + ICMP_MINLEN) return (EINVAL); - if ((*mp)->m_len < off + sizeof(struct ip) + ICMP_MINLEN) - *mp = m_pullup(*mp, off + sizeof(struct ip) + ICMP_MINLEN); - if (*mp == NULL) + if ((*m)->m_len < off + sizeof(struct ip) + ICMP_MINLEN) + *m = m_pullup(*m, off + sizeof(struct ip) + ICMP_MINLEN); + if (*m == NULL) return (ENOMEM); - ip = mtodo(*mp, off); /* Inner IP header */ - inner_proto = ip->ip_p; + ip = mtodo(*m, off); /* Inner IP header */ + proto = ip->ip_p; off += ip->ip_hl << 2; /* Skip inner IP header */ *addr = ntohl(ip->ip_src.s_addr); - if ((*mp)->m_len < off + ICMP_MINLEN) - *mp = m_pullup(*mp, off + ICMP_MINLEN); - if (*mp == NULL) + if ((*m)->m_len < off + ICMP_MINLEN) + *m = m_pullup(*m, off + ICMP_MINLEN); + if (*m == NULL) return (ENOMEM); - switch (inner_proto) { + switch (proto) { case IPPROTO_TCP: + tcp = mtodo(*m, off); + *nat_proto = NAT_PROTO_TCP; + *port = ntohs(tcp->th_sport); + return (0); case IPPROTO_UDP: - /* Copy source port from the header */ - *port = ntohs(*((uint16_t *)mtodo(*mp, off))); - *proto = inner_proto; + udp = mtodo(*m, off); + *nat_proto = NAT_PROTO_UDP; + *port = ntohs(udp->uh_sport); return (0); case IPPROTO_ICMP: /* * We will translate only ICMP errors for our ICMP * echo requests. */ - icmp = mtodo(*mp, off); + icmp = mtodo(*m, off); if (icmp->icmp_type != ICMP_ECHO) return (EOPNOTSUPP); - *port = ntohs(icmp->icmp_id); + *port = ntohs(*((uint16_t *)(icmp + 1))); return (0); }; return (EOPNOTSUPP); } -static struct nat64lsn_state* -nat64lsn_get_state4to6(struct nat64lsn_cfg *cfg, struct nat64lsn_alias *alias, - in_addr_t faddr, uint16_t port, uint8_t proto) +static inline uint8_t +convert_tcp_flags(uint8_t flags) { - struct nat64lsn_state *state; - struct nat64lsn_pg *pg; - int chunk_idx, pg_idx, state_idx; + uint8_t result; - NAT64LSN_EPOCH_ASSERT(); + result = flags & (TH_FIN|TH_SYN); + result |= (flags & TH_RST) >> 2; /* Treat RST as FIN */ + result |= (flags & TH_ACK) >> 2; /* Treat ACK as estab */ - if (port < NAT64_MIN_PORT) - return (NULL); - /* - * Alias keeps 32 pgchunks for each protocol. - * Each pgchunk has 32 pointers to portgroup. - * Each portgroup has 64 states for ports. - */ - port -= NAT64_MIN_PORT; - chunk_idx = port / 2048; - - port -= chunk_idx * 2048; - pg_idx = port / 64; - state_idx = port % 64; - - /* - * First check in proto_chunkmask that we have allocated PG chunk. - * Then check in proto_pgmask that we have valid PG pointer. - */ - pg = NULL; - switch (proto) { - case IPPROTO_TCP: - if (ISSET32(alias->tcp_chunkmask, chunk_idx) && - ISSET32(alias->tcp_pgmask[chunk_idx], pg_idx)) { - pg = alias->tcp[chunk_idx]->pgptr[pg_idx]; - break; - } - return (NULL); - case IPPROTO_UDP: - if (ISSET32(alias->udp_chunkmask, chunk_idx) && - ISSET32(alias->udp_pgmask[chunk_idx], pg_idx)) { - pg = alias->udp[chunk_idx]->pgptr[pg_idx]; - break; - } - return (NULL); - case IPPROTO_ICMP: - if (ISSET32(alias->icmp_chunkmask, chunk_idx) && - ISSET32(alias->icmp_pgmask[chunk_idx], pg_idx)) { - pg = alias->icmp[chunk_idx]->pgptr[pg_idx]; - break; - } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Mon Mar 18 15:45:08 2019 Return-Path: Delivered-To: svn-src-head@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 E9C73154494A; Mon, 18 Mar 2019 15:45:07 +0000 (UTC) (envelope-from lidl@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 8C48D8E98C; Mon, 18 Mar 2019 15:45:07 +0000 (UTC) (envelope-from lidl@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 6294F23777; Mon, 18 Mar 2019 15:45:07 +0000 (UTC) (envelope-from lidl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2IFj7wG018086; Mon, 18 Mar 2019 15:45:07 GMT (envelope-from lidl@FreeBSD.org) Received: (from lidl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2IFj7GH018085; Mon, 18 Mar 2019 15:45:07 GMT (envelope-from lidl@FreeBSD.org) Message-Id: <201903181545.x2IFj7GH018085@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lidl set sender to lidl@FreeBSD.org using -f From: Kurt Lidl Date: Mon, 18 Mar 2019 15:45:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345276 - head/contrib/blacklist/bin X-SVN-Group: head X-SVN-Commit-Author: lidl X-SVN-Commit-Paths: head/contrib/blacklist/bin X-SVN-Commit-Revision: 345276 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8C48D8E98C 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.969,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2019 15:45:08 -0000 Author: lidl Date: Mon Mar 18 15:45:06 2019 New Revision: 345276 URL: https://svnweb.freebsd.org/changeset/base/345276 Log: Fixup syslog() call that should have used logging function pointer PR: 236614 Submitted by: Helge Oldach Modified: head/contrib/blacklist/bin/blacklistd.c Modified: head/contrib/blacklist/bin/blacklistd.c ============================================================================== --- head/contrib/blacklist/bin/blacklistd.c Mon Mar 18 14:00:19 2019 (r345275) +++ head/contrib/blacklist/bin/blacklistd.c Mon Mar 18 15:45:06 2019 (r345276) @@ -328,7 +328,7 @@ again: if (dbi.id[0]) { run_change("rem", &c, dbi.id, 0); sockaddr_snprintf(buf, sizeof(buf), "%a", ss); - syslog(LOG_INFO, "released %s/%d:%d after %d seconds", + (*lfun)(LOG_INFO, "released %s/%d:%d after %d seconds", buf, c.c_lmask, c.c_port, c.c_duration); } state_del(state, &c); From owner-svn-src-head@freebsd.org Mon Mar 18 16:35:26 2019 Return-Path: Delivered-To: svn-src-head@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 C9C471546384; Mon, 18 Mar 2019 16:35:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 6BDCB69CE8; Mon, 18 Mar 2019 16:35:26 +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 B11A21B24F; Mon, 18 Mar 2019 16:35:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r345238 - head To: Wolfram Schneider , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201903162002.x2GK2vmA013275@repo.freebsd.org> 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: <87798c27-8546-2c3b-0f23-83beca25ee7e@FreeBSD.org> Date: Mon, 18 Mar 2019 09:35:27 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.5.3 MIME-Version: 1.0 In-Reply-To: <201903162002.x2GK2vmA013275@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 6BDCB69CE8 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.85 / 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.85)[-0.850,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2019 16:35:27 -0000 On 3/16/19 1:02 PM, Wolfram Schneider wrote: > Author: wosch > Date: Sat Mar 16 20:02:57 2019 > New Revision: 345238 > URL: https://svnweb.freebsd.org/changeset/base/345238 > > Log: > `make buildkernel' should display the build time in seconds > > PR: 224433 > Approved by: cem > Differential Revision: https://reviews.freebsd.org/D13910 > > Modified: > head/Makefile.inc1 > > Modified: head/Makefile.inc1 > ============================================================================== > --- head/Makefile.inc1 Sat Mar 16 17:55:22 2019 (r345237) > +++ head/Makefile.inc1 Sat Mar 16 20:02:57 2019 (r345238) > @@ -1584,6 +1584,11 @@ _cleankernobj_fast_depend_hack: .PHONY > > ${WMAKE_TGTS:N_worldtmp:Nbuild${libcompat}} ${.ALLTARGETS:M_*:N_worldtmp}: .MAKE .PHONY > > +# record kernel(s) build time in seconds > +.if make(buildkernel) > +_BUILDKERNEL_START!= date '+%s' > +.endif > + > # > # buildkernel > # > @@ -1640,7 +1645,12 @@ buildkernel: .MAKE .PHONY > @echo "--------------------------------------------------------------" > @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" > @echo "--------------------------------------------------------------" > + > .endfor > + @seconds=$$(($$(date '+%s') - ${_BUILDKERNEL_START})); \ > + echo -n ">>> Kernel(s) build for${BUILDKERNELS} in $$seconds seconds, "; \ > + echo "ncpu: $$(sysctl -n hw.ncpu)${.MAKE.JOBS:S/^/, make -j/}" > + @echo "--------------------------------------------------------------" Both this and the previous message for buildworld should use 'built' instead of 'build' so that the message is something like "World built in 47 seconds" rather than "World build in 47 seconds". This sentence is also somewhat odd: "Kernel(s) build for FOO BAR BAZ in 47 seconds" Even with 'built' fixed, I feel like it should be more like: "FOO BAR BAZ kernel(s) built in 47 seconds" by moving ${BUILDKERNELS} to the start of the message? -- John Baldwin From owner-svn-src-head@freebsd.org Mon Mar 18 19:11:12 2019 Return-Path: Delivered-To: svn-src-head@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 BE9C7154AC96; Mon, 18 Mar 2019 19:11:12 +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 60DDC717BE; Mon, 18 Mar 2019 19:11:12 +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 3D863259F0; Mon, 18 Mar 2019 19:11:12 +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 x2IJBCum046223; Mon, 18 Mar 2019 19:11:12 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2IJBCRE046222; Mon, 18 Mar 2019 19:11:12 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201903181911.x2IJBCRE046222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 18 Mar 2019 19:11:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345278 - head/lib/libomp X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/lib/libomp X-SVN-Commit-Revision: 345278 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 60DDC717BE 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_SHORT(-0.95)[-0.950,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2019 19:11:12 -0000 Author: dim Date: Mon Mar 18 19:11:11 2019 New Revision: 345278 URL: https://svnweb.freebsd.org/changeset/base/345278 Log: Also explicitly link libomp.so against -lm, as it transitively depends on scalbn and a few other math functions, via libcompiler-rt. This should allow OpenMP programs to link with BFD linkers too. Reported by: jbeich PR: 236062, 236581 MFC after: 1 month X-MFC-With: r344779 Modified: head/lib/libomp/Makefile Modified: head/lib/libomp/Makefile ============================================================================== --- head/lib/libomp/Makefile Mon Mar 18 18:05:19 2019 (r345277) +++ head/lib/libomp/Makefile Mon Mar 18 19:11:11 2019 (r345278) @@ -67,5 +67,6 @@ LDFLAGS+= -Wl,-soname,libomp.so VERSION_MAP= ${OMPSRC}/exports_so.txt LIBADD+= pthread +LIBADD+= m .include From owner-svn-src-head@freebsd.org Mon Mar 18 19:23:20 2019 Return-Path: Delivered-To: svn-src-head@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 8E5DC154B24C; Mon, 18 Mar 2019 19:23:20 +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 32E38721D2; Mon, 18 Mar 2019 19:23:20 +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 0FB3025D13; Mon, 18 Mar 2019 19:23:20 +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 x2IJNJ97054605; Mon, 18 Mar 2019 19:23:19 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2IJNJsm054604; Mon, 18 Mar 2019 19:23:19 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201903181923.x2IJNJsm054604@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 18 Mar 2019 19:23:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345280 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 345280 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 32E38721D2 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.96)[-0.963,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2019 19:23:20 -0000 Author: emaste Date: Mon Mar 18 19:23:19 2019 New Revision: 345280 URL: https://svnweb.freebsd.org/changeset/base/345280 Log: sys/stat.h: Improve timespec compatibility with other BSDs OpenBSD and NetBSD provide macros to directly reference the underlying struct timespec's tv_nsec member. While FreeBSD has such macros for tv_sec, the others are missing. Add the following macros: st->st_atimensec st->st_mtimensec st->st_ctimensec st->st_birthtimensec Adding these fields will provide programs which reference them better portability to FreeBSD. An example of such a program is makefs(8), which has unused support for subseconds that it has inherited from NetBSD. Submitted by: Mitchell Horne Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D19626 Modified: head/sys/sys/stat.h Modified: head/sys/sys/stat.h ============================================================================== --- head/sys/sys/stat.h Mon Mar 18 19:21:53 2019 (r345279) +++ head/sys/sys/stat.h Mon Mar 18 19:23:19 2019 (r345280) @@ -224,6 +224,10 @@ struct nstat { #define st_ctime st_ctim.tv_sec #if __BSD_VISIBLE #define st_birthtime st_birthtim.tv_sec +#define st_atimensec st_atim.tv_nsec +#define st_mtimensec st_mtim.tv_nsec +#define st_ctimensec st_ctim.tv_nsec +#define st_birthtimensec st_birthtim.tv_nsec #endif /* For compatibility. */ From owner-svn-src-head@freebsd.org Mon Mar 18 19:26:37 2019 Return-Path: Delivered-To: svn-src-head@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 D0950154B617; Mon, 18 Mar 2019 19:26:37 +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 77D4A7250D; Mon, 18 Mar 2019 19:26:37 +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 0749825D19; Mon, 18 Mar 2019 19:26:37 +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 x2IJQaxg054780; Mon, 18 Mar 2019 19:26:36 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2IJQaRh054778; Mon, 18 Mar 2019 19:26:36 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201903181926.x2IJQaRh054778@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 18 Mar 2019 19:26:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345281 - in head/usr.sbin/makefs: . tests X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/usr.sbin/makefs: . tests X-SVN-Commit-Revision: 345281 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 77D4A7250D 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.963,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2019 19:26:38 -0000 Author: emaste Date: Mon Mar 18 19:26:36 2019 New Revision: 345281 URL: https://svnweb.freebsd.org/changeset/base/345281 Log: makefs: Fix "time" mtree attribute handling When processing mtree(5) MANIFEST files, makefs(8) previously threw an error if it encountered an entry whose "time" attribute contained a non-zero subsecond component (e.g. time=1551620152.987220000). Update the handling logic to properly assign the subsecond component if built with nanosecond support, or silently discard it otherwise. Also, re-enable the time attribute for the kyua tests. PR: 194703 Submitted by: Mitchell Horne Differential Revision: https://reviews.freebsd.org/D19627 Modified: head/usr.sbin/makefs/mtree.c head/usr.sbin/makefs/tests/makefs_tests_common.sh Modified: head/usr.sbin/makefs/mtree.c ============================================================================== --- head/usr.sbin/makefs/mtree.c Mon Mar 18 19:23:19 2019 (r345280) +++ head/usr.sbin/makefs/mtree.c Mon Mar 18 19:26:36 2019 (r345281) @@ -644,14 +644,17 @@ read_mtree_keywords(FILE *fp, fsnode *node) st->st_atime = num; st->st_ctime = num; st->st_mtime = num; +#if HAVE_STRUCT_STAT_ST_MTIMENSEC if (p == NULL) break; error = read_number(p, 10, &num, 0, INTMAX_MAX); if (error) break; - if (num != 0) - error = EINVAL; + st->st_atimensec = num; + st->st_ctimensec = num; + st->st_mtimensec = num; +#endif } else if (strcmp(keyword, "type") == 0) { if (value == NULL) { error = ENOATTR; Modified: head/usr.sbin/makefs/tests/makefs_tests_common.sh ============================================================================== --- head/usr.sbin/makefs/tests/makefs_tests_common.sh Mon Mar 18 19:23:19 2019 (r345280) +++ head/usr.sbin/makefs/tests/makefs_tests_common.sh Mon Mar 18 19:26:36 2019 (r345281) @@ -29,13 +29,7 @@ KB=1024 : ${TMPDIR=/tmp} -# TODO: add mtree `time` support; get a lot of errors like this right now when -# passing generating disk images with keyword mtree support, like: -# -# `[...]/mtree.spec:8: error: time: invalid value '1446458503'` -# -#DEFAULT_MTREE_KEYWORDS="type,mode,gid,uid,size,link,time" -DEFAULT_MTREE_KEYWORDS="type,mode,gid,uid,size,link" +DEFAULT_MTREE_KEYWORDS="type,mode,gid,uid,size,link,time" TEST_IMAGE="$TMPDIR/test.img" TEST_INPUTS_DIR="$TMPDIR/inputs" TEST_MD_DEVICE_FILE="$TMPDIR/md.output" From owner-svn-src-head@freebsd.org Mon Mar 18 19:56:01 2019 Return-Path: Delivered-To: svn-src-head@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 08EB0154C438; Mon, 18 Mar 2019 19:56:01 +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 A286473818; Mon, 18 Mar 2019 19:56:00 +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 7B6C526226; Mon, 18 Mar 2019 19:56:00 +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 x2IJu0Y5070320; Mon, 18 Mar 2019 19:56:00 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2IJu0XG070319; Mon, 18 Mar 2019 19:56:00 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201903181956.x2IJu0XG070319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 18 Mar 2019 19:56:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345282 - head/lib/libomp X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/lib/libomp X-SVN-Commit-Revision: 345282 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A286473818 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.963,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2019 19:56:01 -0000 Author: dim Date: Mon Mar 18 19:56:00 2019 New Revision: 345282 URL: https://svnweb.freebsd.org/changeset/base/345282 Log: Remove --as-needed from the linker flags for libomp.so, as these actually prevent the transitive dependency on libm. Reported by: jbeich PR: 236062, 236581 MFC after: 1 month X-MFC-With: r344779 Modified: head/lib/libomp/Makefile Modified: head/lib/libomp/Makefile ============================================================================== --- head/lib/libomp/Makefile Mon Mar 18 19:26:36 2019 (r345281) +++ head/lib/libomp/Makefile Mon Mar 18 19:56:00 2019 (r345282) @@ -58,7 +58,6 @@ CXXFLAGS+= -fno-exceptions CXXFLAGS+= -fno-rtti LDFLAGS+= -Wl,--warn-shared-textrel -LDFLAGS+= -Wl,--as-needed LDFLAGS+= -Wl,--gc-sections LDFLAGS+= -Wl,-z,noexecstack LDFLAGS+= -Wl,-fini=__kmp_internal_end_fini From owner-svn-src-head@freebsd.org Mon Mar 18 21:04:30 2019 Return-Path: Delivered-To: svn-src-head@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 451DC154E17C; Mon, 18 Mar 2019 21:04:30 +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 E130276AA6; Mon, 18 Mar 2019 21:04:29 +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 BD35426E23; Mon, 18 Mar 2019 21:04:29 +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 x2IL4TBB007902; Mon, 18 Mar 2019 21:04:29 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2IL4T83007900; Mon, 18 Mar 2019 21:04:29 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201903182104.x2IL4T83007900@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 18 Mar 2019 21:04:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345283 - in head: contrib/openmp/runtime/src lib X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head: contrib/openmp/runtime/src lib X-SVN-Commit-Revision: 345283 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E130276AA6 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_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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2019 21:04:30 -0000 Author: dim Date: Mon Mar 18 21:04:28 2019 New Revision: 345283 URL: https://svnweb.freebsd.org/changeset/base/345283 Log: Enable building libomp.so for 32-bit x86. This is done by selectively enabling the functions that save and restore MXCSR, since access to this register requires SSE support. Note that you may run into other issues with OpenMP on i386, since this *not* yet supported upstream, and certainly not extensively tested. PR: 236062, 236582 MFC after: 1 month X-MFC-With: r344779 Modified: head/contrib/openmp/runtime/src/kmp.h head/contrib/openmp/runtime/src/kmp_runtime.cpp head/lib/Makefile Modified: head/contrib/openmp/runtime/src/kmp.h ============================================================================== --- head/contrib/openmp/runtime/src/kmp.h Mon Mar 18 19:56:00 2019 (r345282) +++ head/contrib/openmp/runtime/src/kmp.h Mon Mar 18 21:04:28 2019 (r345283) @@ -3666,8 +3666,13 @@ extern int __kmp_read_from_file(char const *path, char extern void __kmp_query_cpuid(kmp_cpuinfo_t *p); -#define __kmp_load_mxcsr(p) _mm_setcsr(*(p)) +#if __SSE__ +static inline void __kmp_load_mxcsr(const kmp_uint32 *p) { _mm_setcsr(*(p)); } static inline void __kmp_store_mxcsr(kmp_uint32 *p) { *p = _mm_getcsr(); } +#else +static inline void __kmp_load_mxcsr(const kmp_uint32 *) {} +static inline void __kmp_store_mxcsr(kmp_uint32 *) {} +#endif extern void __kmp_load_x87_fpu_control_word(kmp_int16 *p); extern void __kmp_store_x87_fpu_control_word(kmp_int16 *p); Modified: head/contrib/openmp/runtime/src/kmp_runtime.cpp ============================================================================== --- head/contrib/openmp/runtime/src/kmp_runtime.cpp Mon Mar 18 19:56:00 2019 (r345282) +++ head/contrib/openmp/runtime/src/kmp_runtime.cpp Mon Mar 18 21:04:28 2019 (r345283) @@ -8104,7 +8104,7 @@ __kmp_determine_reduction_method( #elif KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_AARCH || KMP_ARCH_MIPS -#if KMP_OS_LINUX || KMP_OS_WINDOWS || KMP_OS_HURD +#if KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_WINDOWS || KMP_OS_HURD // basic tuning Modified: head/lib/Makefile ============================================================================== --- head/lib/Makefile Mon Mar 18 19:56:00 2019 (r345282) +++ head/lib/Makefile Mon Mar 18 21:04:28 2019 (r345283) @@ -196,9 +196,7 @@ _libproc= libproc _librtld_db= librtld_db .endif -.if !defined(COMPAT_32BIT) SUBDIR.${MK_OPENMP}+= libomp -.endif SUBDIR.${MK_OPENSSL}+= libmp SUBDIR.${MK_PMC}+= libpmc libpmcstat SUBDIR.${MK_RADIUS_SUPPORT}+= libradius From owner-svn-src-head@freebsd.org Mon Mar 18 21:40:04 2019 Return-Path: Delivered-To: svn-src-head@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 A59BE154EB54; Mon, 18 Mar 2019 21:40:04 +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 F18AF77F6E; Mon, 18 Mar 2019 21:40:03 +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 x2ILe2FD047247; Mon, 18 Mar 2019 14:40:02 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x2ILe2ve047246; Mon, 18 Mar 2019 14:40:02 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201903182140.x2ILe2ve047246@gndrsh.dnsmgr.net> Subject: Re: svn commit: r345238 - head In-Reply-To: <87798c27-8546-2c3b-0f23-83beca25ee7e@FreeBSD.org> To: John Baldwin Date: Mon, 18 Mar 2019 14:40:02 -0700 (PDT) CC: Wolfram Schneider , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@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: F18AF77F6E 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]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2019 21:40:04 -0000 [ Charset UTF-8 unsupported, converting... ] > On 3/16/19 1:02 PM, Wolfram Schneider wrote: > > Author: wosch > > Date: Sat Mar 16 20:02:57 2019 > > New Revision: 345238 > > URL: https://svnweb.freebsd.org/changeset/base/345238 > > > > Log: > > `make buildkernel' should display the build time in seconds > > > > PR: 224433 > > Approved by: cem > > Differential Revision: https://reviews.freebsd.org/D13910 > > > > Modified: > > head/Makefile.inc1 > > > > Modified: head/Makefile.inc1 > > ============================================================================== > > --- head/Makefile.inc1 Sat Mar 16 17:55:22 2019 (r345237) > > +++ head/Makefile.inc1 Sat Mar 16 20:02:57 2019 (r345238) > > @@ -1584,6 +1584,11 @@ _cleankernobj_fast_depend_hack: .PHONY > > > > ${WMAKE_TGTS:N_worldtmp:Nbuild${libcompat}} ${.ALLTARGETS:M_*:N_worldtmp}: .MAKE .PHONY > > > > +# record kernel(s) build time in seconds > > +.if make(buildkernel) > > +_BUILDKERNEL_START!= date '+%s' > > +.endif > > + > > # > > # buildkernel > > # > > @@ -1640,7 +1645,12 @@ buildkernel: .MAKE .PHONY > > @echo "--------------------------------------------------------------" > > @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" > > @echo "--------------------------------------------------------------" > > + > > .endfor > > + @seconds=$$(($$(date '+%s') - ${_BUILDKERNEL_START})); \ > > + echo -n ">>> Kernel(s) build for${BUILDKERNELS} in $$seconds seconds, "; \ > > + echo "ncpu: $$(sysctl -n hw.ncpu)${.MAKE.JOBS:S/^/, make -j/}" > > + @echo "--------------------------------------------------------------" > > Both this and the previous message for buildworld should use 'built' instead > of 'build' so that the message is something like "World built in 47 seconds" > rather than "World build in 47 seconds". > > This sentence is also somewhat odd: > > "Kernel(s) build for FOO BAR BAZ in 47 seconds" > > Even with 'built' fixed, I feel like it should be more like: > > "FOO BAR BAZ kernel(s) built in 47 seconds" by moving ${BUILDKERNELS} to the > start of the message? "Kernel(s) ${BUILDKERNELS} built in 47 seconds" reads better for me. > John Baldwin -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Mon Mar 18 23:09:52 2019 Return-Path: Delivered-To: svn-src-head@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 C8FB5155046F; Mon, 18 Mar 2019 23:09:52 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (162-251-186-162.surfnetc.com [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 3D05A82F53; Mon, 18 Mar 2019 23:09:51 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id x2IN9hs3094417 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 18 Mar 2019 16:09:44 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id x2IN9hWG094416; Mon, 18 Mar 2019 16:09:43 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Mon, 18 Mar 2019 16:09:43 -0700 From: Gleb Smirnoff To: "Andrey V. Elsukov" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r345274 - in head: sbin/ipfw sys/conf sys/modules/ipfw_nat64 sys/netinet6 sys/netpfil/ipfw/nat64 Message-ID: <20190318230943.GR3562@FreeBSD.org> References: <201903181259.x2ICx94D013948@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201903181259.x2ICx94D013948@repo.freebsd.org> User-Agent: Mutt/1.11.2 (2019-01-07) X-Rspamd-Queue-Id: 3D05A82F53 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.991,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Mar 2019 23:09:53 -0000 Hi, On Mon, Mar 18, 2019 at 12:59:09PM +0000, Andrey V. Elsukov wrote: A> Author: ae A> Date: Mon Mar 18 12:59:08 2019 A> New Revision: 345274 A> URL: https://svnweb.freebsd.org/changeset/base/345274 A> A> Log: A> Update NAT64LSN implementation: ... A> o ConcurrencyKit and epoch(9) is used to make NAT64LSN lockless on fast path. Why did you create a separate epoch? All the pfil hooks already run at network epoch. -- Gleb Smirnoff From owner-svn-src-head@freebsd.org Tue Mar 19 00:07:13 2019 Return-Path: Delivered-To: svn-src-head@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 7E57615518D0; Tue, 19 Mar 2019 00:07:13 +0000 (UTC) (envelope-from adrian@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 E16798510A; Tue, 19 Mar 2019 00:07:12 +0000 (UTC) (envelope-from adrian@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 AFDE8D04; Tue, 19 Mar 2019 00:07:12 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2J07CvT004621; Tue, 19 Mar 2019 00:07:12 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2J07C4O004620; Tue, 19 Mar 2019 00:07:12 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201903190007.x2J07C4O004620@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Tue, 19 Mar 2019 00:07:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345284 - head/sys/contrib/dev/ath/ath_hal/ar9300 X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/contrib/dev/ath/ath_hal/ar9300 X-SVN-Commit-Revision: 345284 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E16798510A 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_SHORT(-0.95)[-0.954,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2019 00:07:13 -0000 Author: adrian Date: Tue Mar 19 00:07:12 2019 New Revision: 345284 URL: https://svnweb.freebsd.org/changeset/base/345284 Log: [ath_hal_ar9300] Add some comments around the AR9300 ANI code. I'm refamiliarising myself with the behaviour of the ANI code and I thought I'd drop some comments to remind myself. Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.c Modified: head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.c ============================================================================== --- head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.c Mon Mar 18 21:04:28 2019 (r345283) +++ head/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_ani.c Tue Mar 19 00:07:12 2019 (r345284) @@ -1217,6 +1217,7 @@ ar9300_ani_ar_poll(struct ath_hal *ah, const HAL_NODE_ cck_phy_err_cnt = OS_REG_READ(ah, AR_PHY_ERR_2); /* Populate HAL_ANISTATS */ + /* XXX TODO: are these correct? */ if (ani_stats) { ani_stats->cckphyerr_cnt = cck_phy_err_cnt - ani_state->cck_phy_err_count; @@ -1257,18 +1258,32 @@ ar9300_ani_ar_poll(struct ath_hal *ah, const HAL_NODE_ return; } + /* + * Calculate the OFDM/CCK phy error rate over the listen time interval. + * This is used in subsequent math to see if the OFDM/CCK phy error rate + * is above or below the threshold checks. + */ + ofdm_phy_err_rate = ani_state->ofdm_phy_err_count * 1000 / ani_state->listen_time; cck_phy_err_rate = ani_state->cck_phy_err_count * 1000 / ani_state->listen_time; HALDEBUG(ah, HAL_DEBUG_ANI, - "%s: listen_time=%d OFDM:%d errs=%d/s CCK:%d errs=%d/s ofdm_turn=%d\n", + "%s: listen_time=%d (total: %d) OFDM:%d errs=%d/s CCK:%d errs=%d/s ofdm_turn=%d\n", __func__, listen_time, + ani_state->listen_time, ani_state->ofdm_noise_immunity_level, ofdm_phy_err_rate, ani_state->cck_noise_immunity_level, cck_phy_err_rate, ani_state->ofdms_turn); + /* + * Check for temporary noise spurs. This is intended to be used by + * rate control to check if we should try higher packet rates or not. + * If the noise period is short enough then we shouldn't avoid trying + * higher rates but if the noise is high/sustained then it's likely + * not a great idea to try the higher MCS rates. + */ if (ani_state->listen_time >= HAL_NOISE_DETECT_PERIOD) { old_phy_noise_spur = ani_state->phy_noise_spur; if (ofdm_phy_err_rate <= ani_state->ofdm_trig_low && @@ -1281,7 +1296,7 @@ ar9300_ani_ar_poll(struct ath_hal *ah, const HAL_NODE_ } if (old_phy_noise_spur != ani_state->phy_noise_spur) { HALDEBUG(ah, HAL_DEBUG_ANI, - "%s: enviroment change from %d to %d\n", + "%s: environment change from %d to %d\n", __func__, old_phy_noise_spur, ani_state->phy_noise_spur); } } @@ -1304,6 +1319,10 @@ ar9300_ani_ar_poll(struct ath_hal *ah, const HAL_NODE_ ar9300_ani_lower_immunity(ah); ani_state->ofdms_turn = !ani_state->ofdms_turn; } + /* + * Force an ANI restart regardless of whether the lower immunity + * level was met. + */ HALDEBUG(ah, HAL_DEBUG_ANI, "%s: 1 listen_time=%d ofdm=%d/s cck=%d/s - " "calling ar9300_ani_restart\n", @@ -1337,6 +1356,13 @@ ar9300_ani_ar_poll(struct ath_hal *ah, const HAL_NODE_ ani_state->ofdms_turn = AH_TRUE; } } + + /* + * Note that currently this poll function doesn't reset the listen + * time after it accumulates a second worth of error samples. + * It will continue to accumulate samples until a counter overflows, + * or a raise threshold is met, or 5 seconds passes. + */ } /* From owner-svn-src-head@freebsd.org Tue Mar 19 02:34:00 2019 Return-Path: Delivered-To: svn-src-head@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 E06B01538E20; Tue, 19 Mar 2019 02:33:59 +0000 (UTC) (envelope-from mw@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 713BC8DC49; Tue, 19 Mar 2019 02:33:59 +0000 (UTC) (envelope-from mw@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 40FE92A09; Tue, 19 Mar 2019 02:33:59 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2J2Xxb7084478; Tue, 19 Mar 2019 02:33:59 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2J2Xxu2084477; Tue, 19 Mar 2019 02:33:59 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201903190233.x2J2Xxu2084477@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Tue, 19 Mar 2019 02:33:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345288 - head/sys/amd64/sgx X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/amd64/sgx X-SVN-Commit-Revision: 345288 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 713BC8DC49 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.951,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2019 02:34:00 -0000 Author: mw Date: Tue Mar 19 02:33:58 2019 New Revision: 345288 URL: https://svnweb.freebsd.org/changeset/base/345288 Log: Prevent loading SGX with incorrect EPC data It may happen on some machines, that even if SGX is disabled in firmware, the driver would still attach despite EPC base and size equal zero. Such behaviour causes a kernel panic when the module is unloaded. Add a simple check to make sure we only attach when these values are correctly set. Submitted by: Kornel Duleba Reviewed by: br Obtained from: Semihalf Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D19595 Modified: head/sys/amd64/sgx/sgx.c Modified: head/sys/amd64/sgx/sgx.c ============================================================================== --- head/sys/amd64/sgx/sgx.c Tue Mar 19 00:29:18 2019 (r345287) +++ head/sys/amd64/sgx/sgx.c Tue Mar 19 02:33:58 2019 (r345288) @@ -1075,6 +1075,12 @@ sgx_get_epc_area(struct sgx_softc *sc) (cp[2] & 0xfffff000); sc->npages = sc->epc_size / SGX_PAGE_SIZE; + if (sc->epc_size == 0 || sc->epc_base == 0) { + printf("%s: Incorrect EPC data: EPC base %lx, size %lu\n", + __func__, sc->epc_base, sc->epc_size); + return (EINVAL); + } + if (cp[3] & 0xffff) sc->enclave_size_max = (1 << ((cp[3] >> 8) & 0xff)); else From owner-svn-src-head@freebsd.org Tue Mar 19 02:45:33 2019 Return-Path: Delivered-To: svn-src-head@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 5D364153A569; Tue, 19 Mar 2019 02:45:33 +0000 (UTC) (envelope-from mw@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 F1C848E324; Tue, 19 Mar 2019 02:45:32 +0000 (UTC) (envelope-from mw@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 CAC392BDB; Tue, 19 Mar 2019 02:45:32 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2J2jWk8089995; Tue, 19 Mar 2019 02:45:32 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2J2jWex089994; Tue, 19 Mar 2019 02:45:32 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201903190245.x2J2jWex089994@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Tue, 19 Mar 2019 02:45:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345289 - head/stand/common X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/stand/common X-SVN-Commit-Revision: 345289 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F1C848E324 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.951,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2019 02:45:33 -0000 Author: mw Date: Tue Mar 19 02:45:32 2019 New Revision: 345289 URL: https://svnweb.freebsd.org/changeset/base/345289 Log: Add missing boot.4th verification During initialization of the forth interpreter the loader looks for "/boot/boot.4th" and executes any code found there. That file was loaded bypassing verification. Add a call to verify_file to change that. Submitted by: Kornel Duleba Reviewed by: sjg Obtained from: Semihalf Sponsored by: Stormshield Modified: head/stand/common/interp_forth.c Modified: head/stand/common/interp_forth.c ============================================================================== --- head/stand/common/interp_forth.c Tue Mar 19 02:33:58 2019 (r345288) +++ head/stand/common/interp_forth.c Tue Mar 19 02:45:32 2019 (r345289) @@ -283,6 +283,12 @@ bf_init(void) /* try to load and run init file if present */ if ((fd = open("/boot/boot.4th", O_RDONLY)) != -1) { +#ifdef LOADER_VERIEXEC + if (verify_file(fd, "/boot/boot.4th", 0, VE_GUESS) < 0) { + close(fd); + return; + } +#endif (void)ficlExecFD(bf_vm, fd); close(fd); } From owner-svn-src-head@freebsd.org Tue Mar 19 06:58:29 2019 Return-Path: Delivered-To: svn-src-head@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 5005F1543BF8; Tue, 19 Mar 2019 06:58:29 +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 D37366F061; Tue, 19 Mar 2019 06:58:28 +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 BB6C65A2C; Tue, 19 Mar 2019 06:58:28 +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 x2J6wSKq022593; Tue, 19 Mar 2019 06:58:28 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2J6wSQC022592; Tue, 19 Mar 2019 06:58:28 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201903190658.x2J6wSQC022592@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 19 Mar 2019 06:58:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345291 - head/share/mk X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/share/mk X-SVN-Commit-Revision: 345291 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D37366F061 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_SHORT(-0.97)[-0.969,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2019 06:58:29 -0000 Author: dim Date: Tue Mar 19 06:58:28 2019 New Revision: 345291 URL: https://svnweb.freebsd.org/changeset/base/345291 Log: Turn on MK_OPENMP for i386 by default, now that it can build. Noticed by: jbeich PR: 236062, 236582 MFC after: 1 month X-MFC-With: r344779 Modified: head/share/mk/src.opts.mk Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Tue Mar 19 03:10:13 2019 (r345290) +++ head/share/mk/src.opts.mk Tue Mar 19 06:58:28 2019 (r345291) @@ -399,7 +399,7 @@ BROKEN_OPTIONS+=NVME BROKEN_OPTIONS+=BSD_CRTBEGIN .endif -.if ${COMPILER_FEATURES:Mc++11} && ${__T} == "amd64" +.if ${COMPILER_FEATURES:Mc++11} && (${__T} == "amd64" || ${__T} == "i386") __DEFAULT_YES_OPTIONS+=OPENMP .else __DEFAULT_NO_OPTIONS+=OPENMP From owner-svn-src-head@freebsd.org Tue Mar 19 07:46:15 2019 Return-Path: Delivered-To: svn-src-head@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 108DB1544EC9; Tue, 19 Mar 2019 07:46:15 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from butcher-nb.yandex.net (unknown [IPv6:2a02:6b8:0:3712::1:7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "butcher-nb.yandex.net", Issuer "butcher-nb.yandex.net" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 54467706BA; Tue, 19 Mar 2019 07:46:14 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from butcher-nb.yandex.net (localhost [127.0.0.1]) by butcher-nb.yandex.net (8.15.2/8.15.2) with ESMTP id x2J7jFCu083708; Tue, 19 Mar 2019 10:45:15 +0300 (MSK) (envelope-from ae@FreeBSD.org) Subject: Re: svn commit: r345274 - in head: sbin/ipfw sys/conf sys/modules/ipfw_nat64 sys/netinet6 sys/netpfil/ipfw/nat64 To: Gleb Smirnoff Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201903181259.x2ICx94D013948@repo.freebsd.org> <20190318230943.GR3562@FreeBSD.org> From: "Andrey V. Elsukov" Openpgp: id=E6591E1B41DA1516F0C9BC0001C5EA0410C8A17A Autocrypt: addr=ae@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBEwBF1kBCADB9sXFhBEUy8qQ4X63Y8eBatYMHGEFWN9ypS5lI3RE6qQW2EYbxNk7qUC5 21YIIS1mMFVBEfvR7J9uc7yaYgFCEb6Sce1RSO4ULN2mRKGHP3/Sl0ijZEjWHV91hY1YTHEF ZW/0GYinDf56sYpDDehaBF5wkWIo1+QK5nmj3vl0DIDCMNd7QEiWpyLVwECgLX2eOAXByT8B bCqVhJGcG6iFP7/B9Ll6uX5gb8thM9LM+ibwErDBVDGiOgvfxqidab7fdkh893IBCXa82H9N CNwnEtcgzh+BSKK5BgvPohFMgRwjti37TSxwLu63QejRGbZWSz3OK3jMOoF63tCgn7FvABEB AAG0IkFuZHJleSBWLiBFbHN1a292IDxhZUBmcmVlYnNkLm9yZz6JATsEEwECACUCGwMGCwkI BwMCBhUIAgkKCwQWAgMBAh4BAheABQJMB/ruAhkBAAoJEAHF6gQQyKF6MLwH/3Ri/TZl9uo0 SepYWXOnxL6EaDVXDA+dLb1eLKC4PRBBjX29ttQ0KaWapiE6y5/AfzOPmRtHLrHYHjd/aiHX GMLHcYRXD+5GvdkK8iMALrZ28X0JXyuuZa8rAxWIWmCbYHNSBy2unqWgTI04Erodk90IALgM 9JeHN9sFqTM6zalrMnTzlcmel4kcjT3lyYw3vOKgoYLtsLhKZSbJoVVVlvRlGBpHFJI5AoYJ SyfXoN0rcX6k9X7Isp2K50YjqxV4v78xluh1puhwZyC0p8IShPrmrp9Oy9JkMX90o6UAXdGU KfdExJuGJfUZOFBTtNIMNIAKfMTjhpRhxONIr0emxxC5AQ0ETAEXWQEIAJ2p6l9LBoqdH/0J PEFDY2t2gTvAuzz+8zs3R03dFuHcNbOwjvWCG0aOmVpAzkRa8egn5JB4sZaFUtKPYJEQ1Iu+ LUBwgvtXf4vWpzC67zs2dDuiW4LamH5p6xkTD61aHR7mCB3bg2TUjrDWn2Jt44cvoYxj3dz4 S49U1rc9ZPgD5axCNv45j72tggWlZvpefThP7xT1OlNTUqye2gAwQravXpZkl5JG4eOqJVIU X316iE3qso0iXRUtO7OseBf0PiVmk+wCahdreHOeOxK5jMhYkPKVn7z1sZiB7W2H2TojbmcK HZC22sz7Z/H36Lhg1+/RCnGzdEcjGc8oFHXHCxUAEQEAAYkBHwQYAQIACQUCTAEXWQIbDAAK CRABxeoEEMihegkYCAC3ivGYNe2taNm/4Nx5GPdzuaAJGKWksV+w9mo7dQvU+NmI2az5w8vw 98OmX7G0OV9snxMW+6cyNqBrVFTu33VVNzz9pnqNCHxGvj5dL5ltP160JV2zw2bUwJBYsgYQ WfyJJIM7l3gv5ZS3DGqaGIm9gOK1ANxfrR5PgPzvI9VxDhlr2juEVMZYAqPLEJe+SSxbwLoz BcFCNdDAyXcaAzXsx/E02YWm1hIWNRxanAe7Vlg7OL+gvLpdtrYCMg28PNqKNyrQ87LQ49O9 50IIZDOtNFeR0FGucjcLPdS9PiEqCoH7/waJxWp6ydJ+g4OYRBYNM0EmMgy1N85JJrV1mi5i Message-ID: <2eb41483-24b5-0711-3798-7bf53dd5e716@FreeBSD.org> Date: Tue, 19 Mar 2019 10:45:11 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190318230943.GR3562@FreeBSD.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="8ZkoIsvINOSdECITwBG2mwnfjS9vDTq1z" X-Rspamd-Queue-Id: 54467706BA 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.923,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2019 07:46:15 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --8ZkoIsvINOSdECITwBG2mwnfjS9vDTq1z Content-Type: multipart/mixed; boundary="XeGgpSFS96LiEHpTxrZUsCSe7m7lIkNfQ"; protected-headers="v1" From: "Andrey V. Elsukov" To: Gleb Smirnoff Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <2eb41483-24b5-0711-3798-7bf53dd5e716@FreeBSD.org> Subject: Re: svn commit: r345274 - in head: sbin/ipfw sys/conf sys/modules/ipfw_nat64 sys/netinet6 sys/netpfil/ipfw/nat64 References: <201903181259.x2ICx94D013948@repo.freebsd.org> <20190318230943.GR3562@FreeBSD.org> In-Reply-To: <20190318230943.GR3562@FreeBSD.org> --XeGgpSFS96LiEHpTxrZUsCSe7m7lIkNfQ Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 19.03.2019 02:09, Gleb Smirnoff wrote: > Hi, >=20 > On Mon, Mar 18, 2019 at 12:59:09PM +0000, Andrey V. Elsukov wrote: > A> Author: ae > A> Date: Mon Mar 18 12:59:08 2019 > A> New Revision: 345274 > A> URL: https://svnweb.freebsd.org/changeset/base/345274 > A>=20 > A> Log: > A> Update NAT64LSN implementation: > ... > A> o ConcurrencyKit and epoch(9) is used to make NAT64LSN lockless on= fast path. >=20 > Why did you create a separate epoch? All the pfil hooks already run at = network > epoch. Hi, You did not specified, when you plan to merge you changes. I assume that you didn't plan to do that. :) --=20 WBR, Andrey V. Elsukov --XeGgpSFS96LiEHpTxrZUsCSe7m7lIkNfQ-- --8ZkoIsvINOSdECITwBG2mwnfjS9vDTq1z Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/ iQEzBAEBCAAdFiEE5lkeG0HaFRbwybwAAcXqBBDIoXoFAlyQngcACgkQAcXqBBDI oXphoAgAm6B6cqqcbnF94Gyna+XAwtOYqQXKsmkrxGdVfr4ML9DYQ6BkxEkPFBaV 26d4KJulQtCpAvsMUUXYeCymafvmfDSfoES6q0NWB8ZYqgjOUdYHMSBh+qD+GYuM wIo5ryxdngWav7EbUHJhdD5A00vrfZKoF/Bf11g/FBHJKzO+wZ0qvLXLElOahh2P h6wnX3BU44nBH5X+9cwOV5J+P9RUwfrCFxujGF8zsuz70fTaaw02sCFLdSjfBVcG /lRZjMhZ8tHe0eoBjA34NTojwBr7lqfPfENUxKRLS+nCRZ9yOeTrQvjmJqJfkZP1 jHM/H3qAXAOmLzaD2GvF/rQAip8mTw== =XWWn -----END PGP SIGNATURE----- --8ZkoIsvINOSdECITwBG2mwnfjS9vDTq1z-- From owner-svn-src-head@freebsd.org Tue Mar 19 10:29:33 2019 Return-Path: Delivered-To: svn-src-head@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 A2EB6154B54B; Tue, 19 Mar 2019 10:29:33 +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 4598176B2D; Tue, 19 Mar 2019 10:29:33 +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 181F87E96; Tue, 19 Mar 2019 10:29:33 +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 x2JATWTk031548; Tue, 19 Mar 2019 10:29:32 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2JATW1u031547; Tue, 19 Mar 2019 10:29:32 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201903191029.x2JATW1u031547@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 19 Mar 2019 10:29:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345292 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 345292 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4598176B2D 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.998,0]; NEURAL_HAM_SHORT(-0.93)[-0.929,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2019 10:29:33 -0000 Author: ae Date: Tue Mar 19 10:29:32 2019 New Revision: 345292 URL: https://svnweb.freebsd.org/changeset/base/345292 Log: Convert allocation of bpf_if in bpfattach2 from M_NOWAIT to M_WAITOK and remove possible panic condition. It is already allowed to sleep in bpfattach[2], since BPF_LOCK was converted to SX lock in r332388. Also move KASSERT() to the top of function and make full initialization before bpf_if will be linked to BPF's list of interfaces. MFC after: 2 weeks Modified: head/sys/net/bpf.c Modified: head/sys/net/bpf.c ============================================================================== --- head/sys/net/bpf.c Tue Mar 19 06:58:28 2019 (r345291) +++ head/sys/net/bpf.c Tue Mar 19 10:29:32 2019 (r345292) @@ -2592,24 +2592,22 @@ bpfattach2(struct ifnet *ifp, u_int dlt, u_int hdrlen, { struct bpf_if *bp; - bp = malloc(sizeof(*bp), M_BPF, M_NOWAIT | M_ZERO); - if (bp == NULL) - panic("bpfattach"); + KASSERT(*driverp == NULL, ("bpfattach2: driverp already initialized")); + bp = malloc(sizeof(*bp), M_BPF, M_WAITOK | M_ZERO); + + rw_init(&bp->bif_lock, "bpf interface lock"); LIST_INIT(&bp->bif_dlist); LIST_INIT(&bp->bif_wlist); bp->bif_ifp = ifp; bp->bif_dlt = dlt; - rw_init(&bp->bif_lock, "bpf interface lock"); - KASSERT(*driverp == NULL, ("bpfattach2: driverp already initialized")); + bp->bif_hdrlen = hdrlen; bp->bif_bpf = driverp; *driverp = bp; BPF_LOCK(); LIST_INSERT_HEAD(&bpf_iflist, bp, bif_next); BPF_UNLOCK(); - - bp->bif_hdrlen = hdrlen; if (bootverbose && IS_DEFAULT_VNET(curvnet)) if_printf(ifp, "bpf attached\n"); From owner-svn-src-head@freebsd.org Tue Mar 19 10:57:05 2019 Return-Path: Delivered-To: svn-src-head@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 66D38154CC1D; Tue, 19 Mar 2019 10:57:05 +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 17F97800BF; Tue, 19 Mar 2019 10:57:05 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E3A2383F1; Tue, 19 Mar 2019 10:57:04 +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 x2JAv4pL047514; Tue, 19 Mar 2019 10:57:04 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2JAv3k4047506; Tue, 19 Mar 2019 10:57:03 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201903191057.x2JAv3k4047506@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 19 Mar 2019 10:57:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345293 - in head: sbin/ipfw sys/conf sys/modules/ipfw_nat64 sys/netinet6 sys/netpfil/ipfw/nat64 X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in head: sbin/ipfw sys/conf sys/modules/ipfw_nat64 sys/netinet6 sys/netpfil/ipfw/nat64 X-SVN-Commit-Revision: 345293 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 17F97800BF 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.998,0]; NEURAL_HAM_SHORT(-0.94)[-0.937,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2019 10:57:05 -0000 Author: ae Date: Tue Mar 19 10:57:03 2019 New Revision: 345293 URL: https://svnweb.freebsd.org/changeset/base/345293 Log: Reapply r345274 with build fixes for 32-bit architectures. Update NAT64LSN implementation: o most of data structures and relations were modified to be able support large number of translation states. Now each supported protocol can use full ports range. Ports groups now are belongs to IPv4 alias addresses, not hosts. Each ports group can keep several states chunks. This is controlled with new `states_chunks` config option. States chunks allow to have several translation states for single alias address and port, but for different destination addresses. o by default all hash tables now use jenkins hash. o ConcurrencyKit and epoch(9) is used to make NAT64LSN lockless on fast path. o one NAT64LSN instance now can be used to handle several IPv6 prefixes, special prefix "::" value should be used for this purpose when instance is created. o due to modified internal data structures relations, the socket opcode that does states listing was changed. Obtained from: Yandex LLC MFC after: 1 month Sponsored by: Yandex LLC Modified: head/sbin/ipfw/ipfw.8 head/sbin/ipfw/ipfw2.h head/sbin/ipfw/nat64lsn.c head/sys/conf/files head/sys/modules/ipfw_nat64/Makefile head/sys/netinet6/ip_fw_nat64.h head/sys/netpfil/ipfw/nat64/nat64lsn.c head/sys/netpfil/ipfw/nat64/nat64lsn.h head/sys/netpfil/ipfw/nat64/nat64lsn_control.c Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Tue Mar 19 10:29:32 2019 (r345292) +++ head/sbin/ipfw/ipfw.8 Tue Mar 19 10:57:03 2019 (r345293) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 18, 2019 +.Dd March 19, 2019 .Dt IPFW 8 .Os .Sh NAME @@ -3300,6 +3300,7 @@ See .Sx SYSCTL VARIABLES for more info. .Sh IPv6/IPv4 NETWORK ADDRESS AND PROTOCOL TRANSLATION +.Ss Stateful translation .Nm supports in-kernel IPv6/IPv4 network address and protocol translation. Stateful NAT64 translation allows IPv6-only clients to contact IPv4 servers @@ -3317,7 +3318,8 @@ to be able use stateful NAT64 translator. Stateful NAT64 uses a bunch of memory for several types of objects. When IPv6 client initiates connection, NAT64 translator creates a host entry in the states table. -Each host entry has a number of ports group entries allocated on demand. +Each host entry uses preallocated IPv4 alias entry. +Each alias entry has a number of ports group entries allocated on demand. Ports group entries contains connection state entries. There are several options to control limits and lifetime for these objects. .Pp @@ -3337,6 +3339,11 @@ First time an original packet is handled and consumed and then it is handled again as translated packet. This behavior can be changed by sysctl variable .Va net.inet.ip.fw.nat64_direct_output . +Also translated packet can be tagged using +.Cm tag +rule action, and then matched by +.Cm tagged +opcode to avoid loops and extra overhead. .Pp The stateful NAT64 configuration command is the following: .Bd -ragged -offset indent @@ -3364,15 +3371,16 @@ to represent IPv4 addresses. This IPv6 prefix should b The translator implementation follows RFC6052, that restricts the length of prefixes to one of following: 32, 40, 48, 56, 64, or 96. The Well-Known IPv6 Prefix 64:ff9b:: must be 96 bits long. -.It Cm max_ports Ar number -Maximum number of ports reserved for upper level protocols to one IPv6 client. -All reserved ports are divided into chunks between supported protocols. -The number of connections from one IPv6 client is limited by this option. -Note that closed TCP connections still remain in the list of connections until -.Cm tcp_close_age -interval will not expire. -Default value is -.Ar 2048 . +The special +.Ar ::/length +prefix can be used to handle several IPv6 prefixes with one NAT64 instance. +The NAT64 instance will determine a destination IPv4 address from prefix +.Ar length . +.It Cm states_chunks Ar number +The number of states chunks in single ports group. +Each ports group by default can keep 64 state entries in single chunk. +The above value affects the maximum number of states that can be associated with single IPv4 alias address and port. +The value must be power of 2, and up to 128. .It Cm host_del_age Ar seconds The number of seconds until the host entry for a IPv6 client will be deleted and all its resources will be released due to inactivity. Modified: head/sbin/ipfw/ipfw2.h ============================================================================== --- head/sbin/ipfw/ipfw2.h Tue Mar 19 10:29:32 2019 (r345292) +++ head/sbin/ipfw/ipfw2.h Tue Mar 19 10:57:03 2019 (r345293) @@ -278,6 +278,7 @@ enum tokens { TOK_AGG_LEN, TOK_AGG_COUNT, TOK_MAX_PORTS, + TOK_STATES_CHUNKS, TOK_JMAXLEN, TOK_PORT_RANGE, TOK_HOST_DEL_AGE, Modified: head/sbin/ipfw/nat64lsn.c ============================================================================== --- head/sbin/ipfw/nat64lsn.c Tue Mar 19 10:29:32 2019 (r345292) +++ head/sbin/ipfw/nat64lsn.c Tue Mar 19 10:57:03 2019 (r345293) @@ -87,68 +87,70 @@ nat64lsn_print_states(void *buf) char sflags[4], *sf, *proto; ipfw_obj_header *oh; ipfw_obj_data *od; - ipfw_nat64lsn_stg *stg; - ipfw_nat64lsn_state *ste; + ipfw_nat64lsn_stg_v1 *stg; + ipfw_nat64lsn_state_v1 *ste; uint64_t next_idx; int i, sz; oh = (ipfw_obj_header *)buf; od = (ipfw_obj_data *)(oh + 1); - stg = (ipfw_nat64lsn_stg *)(od + 1); + stg = (ipfw_nat64lsn_stg_v1 *)(od + 1); sz = od->head.length - sizeof(*od); next_idx = 0; while (sz > 0 && next_idx != 0xFF) { - next_idx = stg->next_idx; + next_idx = stg->next.index; sz -= sizeof(*stg); if (stg->count == 0) { stg++; continue; } - switch (stg->proto) { - case IPPROTO_TCP: - proto = "TCP"; - break; - case IPPROTO_UDP: - proto = "UDP"; - break; - case IPPROTO_ICMPV6: - proto = "ICMPv6"; - break; - } - inet_ntop(AF_INET6, &stg->host6, s, sizeof(s)); + /* + * NOTE: addresses are in network byte order, + * ports are in host byte order. + */ inet_ntop(AF_INET, &stg->alias4, a, sizeof(a)); - ste = (ipfw_nat64lsn_state *)(stg + 1); + ste = (ipfw_nat64lsn_state_v1 *)(stg + 1); for (i = 0; i < stg->count && sz > 0; i++) { sf = sflags; + inet_ntop(AF_INET6, &ste->host6, s, sizeof(s)); inet_ntop(AF_INET, &ste->daddr, f, sizeof(f)); - if (stg->proto == IPPROTO_TCP) { + switch (ste->proto) { + case IPPROTO_TCP: + proto = "TCP"; if (ste->flags & 0x02) *sf++ = 'S'; if (ste->flags & 0x04) *sf++ = 'E'; if (ste->flags & 0x01) *sf++ = 'F'; + break; + case IPPROTO_UDP: + proto = "UDP"; + break; + case IPPROTO_ICMP: + proto = "ICMPv6"; + break; } *sf = '\0'; - switch (stg->proto) { + switch (ste->proto) { case IPPROTO_TCP: case IPPROTO_UDP: printf("%s:%d\t%s:%d\t%s\t%s\t%d\t%s:%d\n", s, ste->sport, a, ste->aport, proto, sflags, ste->idle, f, ste->dport); break; - case IPPROTO_ICMPV6: + case IPPROTO_ICMP: printf("%s\t%s\t%s\t\t%d\t%s\n", s, a, proto, ste->idle, f); break; default: printf("%s\t%s\t%d\t\t%d\t%s\n", - s, a, stg->proto, ste->idle, f); + s, a, ste->proto, ste->idle, f); } ste++; sz -= sizeof(*ste); } - stg = (ipfw_nat64lsn_stg *)ste; + stg = (ipfw_nat64lsn_stg_v1 *)ste; } return (next_idx); } @@ -174,6 +176,7 @@ nat64lsn_states_cb(ipfw_nat64lsn_cfg *cfg, const char err(EX_OSERR, NULL); do { oh = (ipfw_obj_header *)buf; + oh->opheader.version = 1; /* Force using ov new API */ od = (ipfw_obj_data *)(oh + 1); nat64lsn_fill_ntlv(&oh->ntlv, cfg->name, set); od->head.type = IPFW_TLV_OBJDATA; @@ -363,12 +366,8 @@ nat64lsn_parse_int(const char *arg, const char *desc) static struct _s_x nat64newcmds[] = { { "prefix6", TOK_PREFIX6 }, - { "agg_len", TOK_AGG_LEN }, /* not yet */ - { "agg_count", TOK_AGG_COUNT }, /* not yet */ - { "port_range", TOK_PORT_RANGE }, /* not yet */ { "jmaxlen", TOK_JMAXLEN }, { "prefix4", TOK_PREFIX4 }, - { "max_ports", TOK_MAX_PORTS }, { "host_del_age", TOK_HOST_DEL_AGE }, { "pg_del_age", TOK_PG_DEL_AGE }, { "tcp_syn_age", TOK_TCP_SYN_AGE }, @@ -376,10 +375,13 @@ static struct _s_x nat64newcmds[] = { { "tcp_est_age", TOK_TCP_EST_AGE }, { "udp_age", TOK_UDP_AGE }, { "icmp_age", TOK_ICMP_AGE }, + { "states_chunks",TOK_STATES_CHUNKS }, { "log", TOK_LOG }, { "-log", TOK_LOGOFF }, { "allow_private", TOK_PRIVATE }, { "-allow_private", TOK_PRIVATEOFF }, + /* for compatibility with old configurations */ + { "max_ports", TOK_MAX_PORTS }, /* unused */ { NULL, 0 } }; @@ -436,42 +438,17 @@ nat64lsn_create(const char *name, uint8_t set, int ac, nat64lsn_parse_prefix(*av, AF_INET6, &cfg->prefix6, &cfg->plen6); if (ipfw_check_nat64prefix(&cfg->prefix6, - cfg->plen6) != 0) + cfg->plen6) != 0 && + !IN6_IS_ADDR_UNSPECIFIED(&cfg->prefix6)) errx(EX_USAGE, "Bad prefix6 %s", *av); ac--; av++; break; -#if 0 - case TOK_AGG_LEN: - NEED1("Aggregation prefix len required"); - cfg->agg_prefix_len = nat64lsn_parse_int(*av, opt); - ac--; av++; - break; - case TOK_AGG_COUNT: - NEED1("Max per-prefix count required"); - cfg->agg_prefix_max = nat64lsn_parse_int(*av, opt); - ac--; av++; - break; - case TOK_PORT_RANGE: - NEED1("port range x[:y] required"); - if ((p = strchr(*av, ':')) == NULL) - cfg->min_port = (uint16_t)nat64lsn_parse_int( - *av, opt); - else { - *p++ = '\0'; - cfg->min_port = (uint16_t)nat64lsn_parse_int( - *av, opt); - cfg->max_port = (uint16_t)nat64lsn_parse_int( - p, opt); - } - ac--; av++; - break; case TOK_JMAXLEN: NEED1("job queue length required"); cfg->jmaxlen = nat64lsn_parse_int(*av, opt); ac--; av++; break; -#endif case TOK_MAX_PORTS: NEED1("Max per-user ports required"); cfg->max_ports = nat64lsn_parse_int(*av, opt); @@ -519,6 +496,12 @@ nat64lsn_create(const char *name, uint8_t set, int ac, *av, opt); ac--; av++; break; + case TOK_STATES_CHUNKS: + NEED1("number of chunks required"); + cfg->states_chunks = (uint8_t)nat64lsn_parse_int( + *av, opt); + ac--; av++; + break; case TOK_LOG: cfg->flags |= NAT64_LOG; break; @@ -630,6 +613,12 @@ nat64lsn_config(const char *name, uint8_t set, int ac, *av, opt); ac--; av++; break; + case TOK_STATES_CHUNKS: + NEED1("number of chunks required"); + cfg->states_chunks = (uint8_t)nat64lsn_parse_int( + *av, opt); + ac--; av++; + break; case TOK_LOG: cfg->flags |= NAT64_LOG; break; @@ -789,31 +778,24 @@ nat64lsn_show_cb(ipfw_nat64lsn_cfg *cfg, const char *n printf("nat64lsn %s prefix4 %s/%u", cfg->name, abuf, cfg->plen4); inet_ntop(AF_INET6, &cfg->prefix6, abuf, sizeof(abuf)); printf(" prefix6 %s/%u", abuf, cfg->plen6); -#if 0 - printf("agg_len %u agg_count %u ", cfg->agg_prefix_len, - cfg->agg_prefix_max); - if (cfg->min_port != NAT64LSN_PORT_MIN || - cfg->max_port != NAT64LSN_PORT_MAX) - printf(" port_range %u:%u", cfg->min_port, cfg->max_port); - if (cfg->jmaxlen != NAT64LSN_JMAXLEN) - printf(" jmaxlen %u ", cfg->jmaxlen); -#endif - if (cfg->max_ports != NAT64LSN_MAX_PORTS) - printf(" max_ports %u", cfg->max_ports); - if (cfg->nh_delete_delay != NAT64LSN_HOST_AGE) + if (co.verbose || cfg->states_chunks > 1) + printf(" states_chunks %u", cfg->states_chunks); + if (co.verbose || cfg->nh_delete_delay != NAT64LSN_HOST_AGE) printf(" host_del_age %u", cfg->nh_delete_delay); - if (cfg->pg_delete_delay != NAT64LSN_PG_AGE) + if (co.verbose || cfg->pg_delete_delay != NAT64LSN_PG_AGE) printf(" pg_del_age %u ", cfg->pg_delete_delay); - if (cfg->st_syn_ttl != NAT64LSN_TCP_SYN_AGE) + if (co.verbose || cfg->st_syn_ttl != NAT64LSN_TCP_SYN_AGE) printf(" tcp_syn_age %u", cfg->st_syn_ttl); - if (cfg->st_close_ttl != NAT64LSN_TCP_FIN_AGE) + if (co.verbose || cfg->st_close_ttl != NAT64LSN_TCP_FIN_AGE) printf(" tcp_close_age %u", cfg->st_close_ttl); - if (cfg->st_estab_ttl != NAT64LSN_TCP_EST_AGE) + if (co.verbose || cfg->st_estab_ttl != NAT64LSN_TCP_EST_AGE) printf(" tcp_est_age %u", cfg->st_estab_ttl); - if (cfg->st_udp_ttl != NAT64LSN_UDP_AGE) + if (co.verbose || cfg->st_udp_ttl != NAT64LSN_UDP_AGE) printf(" udp_age %u", cfg->st_udp_ttl); - if (cfg->st_icmp_ttl != NAT64LSN_ICMP_AGE) + if (co.verbose || cfg->st_icmp_ttl != NAT64LSN_ICMP_AGE) printf(" icmp_age %u", cfg->st_icmp_ttl); + if (co.verbose || cfg->jmaxlen != NAT64LSN_JMAXLEN) + printf(" jmaxlen %u ", cfg->jmaxlen); if (cfg->flags & NAT64_LOG) printf(" log"); if (cfg->flags & NAT64_ALLOW_PRIVATE) Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Tue Mar 19 10:29:32 2019 (r345292) +++ head/sys/conf/files Tue Mar 19 10:57:03 2019 (r345293) @@ -4398,9 +4398,9 @@ netpfil/ipfw/nat64/nat64clat.c optional inet inet6 ipf netpfil/ipfw/nat64/nat64clat_control.c optional inet inet6 ipfirewall \ ipfirewall_nat64 netpfil/ipfw/nat64/nat64lsn.c optional inet inet6 ipfirewall \ - ipfirewall_nat64 + ipfirewall_nat64 compile-with "${NORMAL_C} -I$S/contrib/ck/include" netpfil/ipfw/nat64/nat64lsn_control.c optional inet inet6 ipfirewall \ - ipfirewall_nat64 + ipfirewall_nat64 compile-with "${NORMAL_C} -I$S/contrib/ck/include" netpfil/ipfw/nat64/nat64stl.c optional inet inet6 ipfirewall \ ipfirewall_nat64 netpfil/ipfw/nat64/nat64stl_control.c optional inet inet6 ipfirewall \ Modified: head/sys/modules/ipfw_nat64/Makefile ============================================================================== --- head/sys/modules/ipfw_nat64/Makefile Tue Mar 19 10:29:32 2019 (r345292) +++ head/sys/modules/ipfw_nat64/Makefile Tue Mar 19 10:57:03 2019 (r345293) @@ -8,4 +8,6 @@ SRCS+= nat64clat.c nat64clat_control.c SRCS+= nat64lsn.c nat64lsn_control.c SRCS+= nat64stl.c nat64stl_control.c +CFLAGS+= -I${SRCTOP}/sys/contrib/ck/include + .include Modified: head/sys/netinet6/ip_fw_nat64.h ============================================================================== --- head/sys/netinet6/ip_fw_nat64.h Tue Mar 19 10:29:32 2019 (r345292) +++ head/sys/netinet6/ip_fw_nat64.h Tue Mar 19 10:57:03 2019 (r345293) @@ -122,7 +122,7 @@ typedef struct _ipfw_nat64clat_cfg { /* * NAT64LSN default configuration values */ -#define NAT64LSN_MAX_PORTS 2048 /* Max number of ports per host */ +#define NAT64LSN_MAX_PORTS 2048 /* Unused */ #define NAT64LSN_JMAXLEN 2048 /* Max outstanding requests. */ #define NAT64LSN_TCP_SYN_AGE 10 /* State's TTL after SYN received. */ #define NAT64LSN_TCP_EST_AGE (2 * 3600) /* TTL for established connection */ @@ -135,16 +135,20 @@ typedef struct _ipfw_nat64clat_cfg { typedef struct _ipfw_nat64lsn_cfg { char name[64]; /* NAT name */ uint32_t flags; - uint32_t max_ports; /* Max ports per client */ - uint32_t agg_prefix_len; /* Prefix length to count */ - uint32_t agg_prefix_max; /* Max hosts per agg prefix */ + + uint32_t max_ports; /* Unused */ + uint32_t agg_prefix_len; /* Unused */ + uint32_t agg_prefix_max; /* Unused */ + struct in_addr prefix4; uint16_t plen4; /* Prefix length */ uint16_t plen6; /* Prefix length */ struct in6_addr prefix6; /* NAT64 prefix */ uint32_t jmaxlen; /* Max jobqueue length */ - uint16_t min_port; /* Min port group # to use */ - uint16_t max_port; /* Max port group # to use */ + + uint16_t min_port; /* Unused */ + uint16_t max_port; /* Unused */ + uint16_t nh_delete_delay;/* Stale host delete delay */ uint16_t pg_delete_delay;/* Stale portgroup delete delay */ uint16_t st_syn_ttl; /* TCP syn expire */ @@ -153,7 +157,7 @@ typedef struct _ipfw_nat64lsn_cfg { uint16_t st_udp_ttl; /* UDP expire */ uint16_t st_icmp_ttl; /* ICMP expire */ uint8_t set; /* Named instance set [0..31] */ - uint8_t spare; + uint8_t states_chunks; /* Number of states chunks per PG */ } ipfw_nat64lsn_cfg; typedef struct _ipfw_nat64lsn_state { @@ -177,5 +181,30 @@ typedef struct _ipfw_nat64lsn_stg { uint32_t spare2; } ipfw_nat64lsn_stg; -#endif /* _NETINET6_IP_FW_NAT64_H_ */ +typedef struct _ipfw_nat64lsn_state_v1 { + struct in6_addr host6; /* Bound IPv6 host */ + struct in_addr daddr; /* Remote IPv4 address */ + uint16_t dport; /* Remote destination port */ + uint16_t aport; /* Local alias port */ + uint16_t sport; /* Source port */ + uint16_t spare; + uint16_t idle; /* Last used time */ + uint8_t flags; /* State flags */ + uint8_t proto; /* protocol */ +} ipfw_nat64lsn_state_v1; +typedef struct _ipfw_nat64lsn_stg_v1 { + union nat64lsn_pgidx { + uint64_t index; + struct { + uint8_t chunk; /* states chunk */ + uint8_t proto; /* protocol */ + uint16_t port; /* base port */ + in_addr_t addr; /* alias address */ + }; + } next; /* next state index */ + struct in_addr alias4; /* IPv4 alias address */ + uint32_t count; /* Number of states */ +} ipfw_nat64lsn_stg_v1; + +#endif /* _NETINET6_IP_FW_NAT64_H_ */ Modified: head/sys/netpfil/ipfw/nat64/nat64lsn.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64lsn.c Tue Mar 19 10:29:32 2019 (r345292) +++ head/sys/netpfil/ipfw/nat64/nat64lsn.c Tue Mar 19 10:57:03 2019 (r345293) @@ -33,16 +33,17 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include +#include #include #include #include #include #include #include -#include #include -#include #include #include @@ -71,17 +72,22 @@ __FBSDID("$FreeBSD$"); MALLOC_DEFINE(M_NAT64LSN, "NAT64LSN", "NAT64LSN"); -static void nat64lsn_periodic(void *data); -#define PERIODIC_DELAY 4 -static uint8_t nat64lsn_proto_map[256]; -uint8_t nat64lsn_rproto_map[NAT_MAX_PROTO]; +static epoch_t nat64lsn_epoch; +#define NAT64LSN_EPOCH_ENTER(et) epoch_enter_preempt(nat64lsn_epoch, &(et)) +#define NAT64LSN_EPOCH_EXIT(et) epoch_exit_preempt(nat64lsn_epoch, &(et)) +#define NAT64LSN_EPOCH_WAIT() epoch_wait_preempt(nat64lsn_epoch) +#define NAT64LSN_EPOCH_ASSERT() MPASS(in_epoch(nat64lsn_epoch)) +#define NAT64LSN_EPOCH_CALL(c, f) epoch_call(nat64lsn_epoch, (c), (f)) -#define NAT64_FLAG_FIN 0x01 /* FIN was seen */ -#define NAT64_FLAG_SYN 0x02 /* First syn in->out */ -#define NAT64_FLAG_ESTAB 0x04 /* Packet with Ack */ -#define NAT64_FLAGS_TCP (NAT64_FLAG_SYN|NAT64_FLAG_ESTAB|NAT64_FLAG_FIN) +static uma_zone_t nat64lsn_host_zone; +static uma_zone_t nat64lsn_pgchunk_zone; +static uma_zone_t nat64lsn_pg_zone; +static uma_zone_t nat64lsn_aliaslink_zone; +static uma_zone_t nat64lsn_state_zone; +static uma_zone_t nat64lsn_job_zone; -#define NAT64_FLAG_RDR 0x80 /* Port redirect */ +static void nat64lsn_periodic(void *data); +#define PERIODIC_DELAY 4 #define NAT64_LOOKUP(chain, cmd) \ (struct nat64lsn_cfg *)SRV_OBJECT((chain), (cmd)->arg1) /* @@ -91,25 +97,33 @@ uint8_t nat64lsn_rproto_map[NAT_MAX_PROTO]; enum nat64lsn_jtype { JTYPE_NEWHOST = 1, JTYPE_NEWPORTGROUP, - JTYPE_DELPORTGROUP, + JTYPE_DESTROY, }; struct nat64lsn_job_item { - TAILQ_ENTRY(nat64lsn_job_item) next; + STAILQ_ENTRY(nat64lsn_job_item) entries; enum nat64lsn_jtype jtype; - struct nat64lsn_host *nh; - struct nat64lsn_portgroup *pg; - void *spare_idx; - struct in6_addr haddr; - uint8_t nat_proto; - uint8_t done; - int needs_idx; - int delcount; - unsigned int fhash; /* Flow hash */ - uint32_t aaddr; /* Last used address (net) */ - struct mbuf *m; - struct ipfw_flow_id f_id; - uint64_t delmask[NAT64LSN_PGPTRNMASK]; + + union { + struct { /* used by JTYPE_NEWHOST, JTYPE_NEWPORTGROUP */ + struct mbuf *m; + struct nat64lsn_host *host; + struct nat64lsn_state *state; + uint32_t src6_hval; + uint32_t state_hval; + struct ipfw_flow_id f_id; + in_addr_t faddr; + uint16_t port; + uint8_t proto; + uint8_t done; + }; + struct { /* used by JTYPE_DESTROY */ + struct nat64lsn_hosts_slist hosts; + struct nat64lsn_pg_slist portgroups; + struct nat64lsn_pgchunk *pgchunk; + struct epoch_context epoch_ctx; + }; + }; }; static struct mtx jmtx; @@ -118,143 +132,311 @@ static struct mtx jmtx; #define JQUEUE_LOCK() mtx_lock(&jmtx) #define JQUEUE_UNLOCK() mtx_unlock(&jmtx) +static int nat64lsn_alloc_host(struct nat64lsn_cfg *cfg, + struct nat64lsn_job_item *ji); +static int nat64lsn_alloc_pg(struct nat64lsn_cfg *cfg, + struct nat64lsn_job_item *ji); +static struct nat64lsn_job_item *nat64lsn_create_job( + struct nat64lsn_cfg *cfg, int jtype); static void nat64lsn_enqueue_job(struct nat64lsn_cfg *cfg, struct nat64lsn_job_item *ji); -static void nat64lsn_enqueue_jobs(struct nat64lsn_cfg *cfg, - struct nat64lsn_job_head *jhead, int jlen); +static void nat64lsn_job_destroy(epoch_context_t ctx); +static void nat64lsn_destroy_host(struct nat64lsn_host *host); +static void nat64lsn_destroy_pg(struct nat64lsn_pg *pg); -static struct nat64lsn_job_item *nat64lsn_create_job(struct nat64lsn_cfg *cfg, - const struct ipfw_flow_id *f_id, int jtype); -static int nat64lsn_request_portgroup(struct nat64lsn_cfg *cfg, - const struct ipfw_flow_id *f_id, struct mbuf **pm, uint32_t aaddr, - int needs_idx); -static int nat64lsn_request_host(struct nat64lsn_cfg *cfg, - const struct ipfw_flow_id *f_id, struct mbuf **pm); static int nat64lsn_translate4(struct nat64lsn_cfg *cfg, - const struct ipfw_flow_id *f_id, struct mbuf **pm); + const struct ipfw_flow_id *f_id, struct mbuf **mp); static int nat64lsn_translate6(struct nat64lsn_cfg *cfg, - struct ipfw_flow_id *f_id, struct mbuf **pm); + struct ipfw_flow_id *f_id, struct mbuf **mp); +static int nat64lsn_translate6_internal(struct nat64lsn_cfg *cfg, + struct mbuf **mp, struct nat64lsn_state *state, uint8_t flags); -static int alloc_portgroup(struct nat64lsn_job_item *ji); -static void destroy_portgroup(struct nat64lsn_portgroup *pg); -static void destroy_host6(struct nat64lsn_host *nh); -static int alloc_host6(struct nat64lsn_cfg *cfg, struct nat64lsn_job_item *ji); +#define NAT64_BIT_TCP_FIN 0 /* FIN was seen */ +#define NAT64_BIT_TCP_SYN 1 /* First syn in->out */ +#define NAT64_BIT_TCP_ESTAB 2 /* Packet with Ack */ +#define NAT64_BIT_READY_IPV4 6 /* state is ready for translate4 */ +#define NAT64_BIT_STALE 7 /* state is going to be expired */ -static int attach_portgroup(struct nat64lsn_cfg *cfg, - struct nat64lsn_job_item *ji); -static int attach_host6(struct nat64lsn_cfg *cfg, struct nat64lsn_job_item *ji); +#define NAT64_FLAG_FIN (1 << NAT64_BIT_TCP_FIN) +#define NAT64_FLAG_SYN (1 << NAT64_BIT_TCP_SYN) +#define NAT64_FLAG_ESTAB (1 << NAT64_BIT_TCP_ESTAB) +#define NAT64_FLAGS_TCP (NAT64_FLAG_SYN|NAT64_FLAG_ESTAB|NAT64_FLAG_FIN) +#define NAT64_FLAG_READY (1 << NAT64_BIT_READY_IPV4) +#define NAT64_FLAG_STALE (1 << NAT64_BIT_STALE) -/* XXX tmp */ -static uma_zone_t nat64lsn_host_zone; -static uma_zone_t nat64lsn_pg_zone; -static uma_zone_t nat64lsn_pgidx_zone; +static inline uint8_t +convert_tcp_flags(uint8_t flags) +{ + uint8_t result; -static unsigned int nat64lsn_periodic_chkstates(struct nat64lsn_cfg *cfg, - struct nat64lsn_host *nh); + result = flags & (TH_FIN|TH_SYN); + result |= (flags & TH_RST) >> 2; /* Treat RST as FIN */ + result |= (flags & TH_ACK) >> 2; /* Treat ACK as estab */ -#define I6_hash(x) (djb_hash((const unsigned char *)(x), 16)) -#define I6_first(_ph, h) (_ph)[h] -#define I6_next(x) (x)->next -#define I6_val(x) (&(x)->addr) -#define I6_cmp(a, b) IN6_ARE_ADDR_EQUAL(a, b) -#define I6_lock(a, b) -#define I6_unlock(a, b) + return (result); +} -#define I6HASH_FIND(_cfg, _res, _a) \ - CHT_FIND(_cfg->ih, _cfg->ihsize, I6_, _res, _a) -#define I6HASH_INSERT(_cfg, _i) \ - CHT_INSERT_HEAD(_cfg->ih, _cfg->ihsize, I6_, _i) -#define I6HASH_REMOVE(_cfg, _res, _tmp, _a) \ - CHT_REMOVE(_cfg->ih, _cfg->ihsize, I6_, _res, _tmp, _a) +static void +nat64lsn_log(struct pfloghdr *plog, struct mbuf *m, sa_family_t family, + struct nat64lsn_state *state) +{ -#define I6HASH_FOREACH_SAFE(_cfg, _x, _tmp, _cb, _arg) \ - CHT_FOREACH_SAFE(_cfg->ih, _cfg->ihsize, I6_, _x, _tmp, _cb, _arg) + memset(plog, 0, sizeof(*plog)); + plog->length = PFLOG_REAL_HDRLEN; + plog->af = family; + plog->action = PF_NAT; + plog->dir = PF_IN; + plog->rulenr = htonl(state->ip_src); + plog->subrulenr = htonl((uint32_t)(state->aport << 16) | + (state->proto << 8) | (state->ip_dst & 0xff)); + plog->ruleset[0] = '\0'; + strlcpy(plog->ifname, "NAT64LSN", sizeof(plog->ifname)); + ipfw_bpf_mtap2(plog, PFLOG_HDRLEN, m); +} -#define HASH_IN4(x) djb_hash((const unsigned char *)(x), 8) +#define HVAL(p, n, s) jenkins_hash32((const uint32_t *)(p), (n), (s)) +#define HOST_HVAL(c, a) HVAL((a),\ + sizeof(struct in6_addr) / sizeof(uint32_t), (c)->hash_seed) +#define HOSTS(c, v) ((c)->hosts_hash[(v) & ((c)->hosts_hashsize - 1)]) -static unsigned -djb_hash(const unsigned char *h, const int len) +#define ALIASLINK_HVAL(c, f) HVAL(&(f)->dst_ip6,\ + sizeof(struct in6_addr) * 2 / sizeof(uint32_t), (c)->hash_seed) +#define ALIAS_BYHASH(c, v) \ + ((c)->aliases[(v) & ((1 << (32 - (c)->plen4)) - 1)]) +static struct nat64lsn_aliaslink* +nat64lsn_get_aliaslink(struct nat64lsn_cfg *cfg __unused, + struct nat64lsn_host *host, const struct ipfw_flow_id *f_id __unused) { - unsigned int result = 0; - int i; - for (i = 0; i < len; i++) - result = 33 * result ^ h[i]; - - return (result); + /* + * We can implement some different algorithms how + * select an alias address. + * XXX: for now we use first available. + */ + return (CK_SLIST_FIRST(&host->aliases)); } -/* -static size_t -bitmask_size(size_t num, int *level) +#define STATE_HVAL(c, d) HVAL((d), 2, (c)->hash_seed) +#define STATE_HASH(h, v) \ + ((h)->states_hash[(v) & ((h)->states_hashsize - 1)]) +#define STATES_CHUNK(p, v) \ + ((p)->chunks_count == 1 ? (p)->states : \ + ((p)->states_chunk[CHUNK_BY_FADDR(p, v)])) + +#ifdef __LP64__ +#define FREEMASK_FFSLL(pg, faddr) \ + ffsll(*FREEMASK_CHUNK((pg), (faddr))) +#define FREEMASK_BTR(pg, faddr, bit) \ + ck_pr_btr_64(FREEMASK_CHUNK((pg), (faddr)), (bit)) +#define FREEMASK_BTS(pg, faddr, bit) \ + ck_pr_bts_64(FREEMASK_CHUNK((pg), (faddr)), (bit)) +#define FREEMASK_ISSET(pg, faddr, bit) \ + ISSET64(*FREEMASK_CHUNK((pg), (faddr)), (bit)) +#define FREEMASK_COPY(pg, n, out) \ + (out) = ck_pr_load_64(FREEMASK_CHUNK((pg), (n))) +#else +static inline int +freemask_ffsll(uint32_t *freemask) { - size_t x; - int c; + int i; - for (c = 0, x = num; num > 1; num /= 64, c++) - ; - - return (x); + if ((i = ffsl(freemask[0])) != 0) + return (i); + if ((i = ffsl(freemask[1])) != 0) + return (i + 32); + return (0); } +#define FREEMASK_FFSLL(pg, faddr) \ + freemask_ffsll(FREEMASK_CHUNK((pg), (faddr))) +#define FREEMASK_BTR(pg, faddr, bit) \ + ck_pr_btr_32(FREEMASK_CHUNK((pg), (faddr)) + (bit) / 32, (bit) % 32) +#define FREEMASK_BTS(pg, faddr, bit) \ + ck_pr_bts_32(FREEMASK_CHUNK((pg), (faddr)) + (bit) / 32, (bit) % 32) +#define FREEMASK_ISSET(pg, faddr, bit) \ + ISSET32(*(FREEMASK_CHUNK((pg), (faddr)) + (bit) / 32), (bit) % 32) +#define FREEMASK_COPY(pg, n, out) \ + (out) = ck_pr_load_32(FREEMASK_CHUNK((pg), (n))) | \ + ((uint64_t)ck_pr_load_32(FREEMASK_CHUNK((pg), (n)) + 1) << 32) +#endif /* !__LP64__ */ -static void -bitmask_prepare(uint64_t *pmask, size_t bufsize, int level) + +#define NAT64LSN_TRY_PGCNT 32 +static struct nat64lsn_pg* +nat64lsn_get_pg(uint32_t *chunkmask, uint32_t *pgmask, + struct nat64lsn_pgchunk **chunks, struct nat64lsn_pg **pgptr, + uint32_t *pgidx, in_addr_t faddr) { - size_t x, z; + struct nat64lsn_pg *pg, *oldpg; + uint32_t idx, oldidx; + int cnt; - memset(pmask, 0xFF, bufsize); - for (x = 0, z = 1; level > 1; x += z, z *= 64, level--) - ; - pmask[x] ~= 0x01; + cnt = 0; + /* First try last used PG */ + oldpg = pg = ck_pr_load_ptr(pgptr); + idx = oldidx = ck_pr_load_32(pgidx); + /* If pgidx is out of range, reset it to the first pgchunk */ + if (!ISSET32(*chunkmask, idx / 32)) + idx = 0; + do { + ck_pr_fence_load(); + if (pg != NULL && FREEMASK_BITCOUNT(pg, faddr) > 0) { + /* + * If last used PG has not free states, + * try to update pointer. + * NOTE: it can be already updated by jobs handler, + * thus we use CAS operation. + */ + if (cnt > 0) + ck_pr_cas_ptr(pgptr, oldpg, pg); + return (pg); + } + /* Stop if idx is out of range */ + if (!ISSET32(*chunkmask, idx / 32)) + break; + + if (ISSET32(pgmask[idx / 32], idx % 32)) + pg = ck_pr_load_ptr( + &chunks[idx / 32]->pgptr[idx % 32]); + else + pg = NULL; + + idx++; + } while (++cnt < NAT64LSN_TRY_PGCNT); + + /* If pgidx is out of range, reset it to the first pgchunk */ + if (!ISSET32(*chunkmask, idx / 32)) + idx = 0; + ck_pr_cas_32(pgidx, oldidx, idx); + return (NULL); } -*/ -static void -nat64lsn_log(struct pfloghdr *plog, struct mbuf *m, sa_family_t family, - uint32_t n, uint32_t sn) +static struct nat64lsn_state* +nat64lsn_get_state6to4(struct nat64lsn_cfg *cfg, struct nat64lsn_host *host, + const struct ipfw_flow_id *f_id, uint32_t hval, in_addr_t faddr, + uint16_t port, uint8_t proto) { + struct nat64lsn_aliaslink *link; + struct nat64lsn_state *state; + struct nat64lsn_pg *pg; + int i, offset; - memset(plog, 0, sizeof(*plog)); - plog->length = PFLOG_REAL_HDRLEN; - plog->af = family; - plog->action = PF_NAT; - plog->dir = PF_IN; - plog->rulenr = htonl(n); - plog->subrulenr = htonl(sn); - plog->ruleset[0] = '\0'; - strlcpy(plog->ifname, "NAT64LSN", sizeof(plog->ifname)); - ipfw_bpf_mtap2(plog, PFLOG_HDRLEN, m); + NAT64LSN_EPOCH_ASSERT(); + + /* Check that we already have state for given arguments */ + CK_SLIST_FOREACH(state, &STATE_HASH(host, hval), entries) { + if (state->proto == proto && state->ip_dst == faddr && + state->sport == port && state->dport == f_id->dst_port) + return (state); + } + + link = nat64lsn_get_aliaslink(cfg, host, f_id); + if (link == NULL) + return (NULL); + + switch (proto) { + case IPPROTO_TCP: + pg = nat64lsn_get_pg( + &link->alias->tcp_chunkmask, link->alias->tcp_pgmask, + link->alias->tcp, &link->alias->tcp_pg, + &link->alias->tcp_pgidx, faddr); + break; + case IPPROTO_UDP: + pg = nat64lsn_get_pg( + &link->alias->udp_chunkmask, link->alias->udp_pgmask, + link->alias->udp, &link->alias->udp_pg, + &link->alias->udp_pgidx, faddr); + break; + case IPPROTO_ICMP: + pg = nat64lsn_get_pg( + &link->alias->icmp_chunkmask, link->alias->icmp_pgmask, + link->alias->icmp, &link->alias->icmp_pg, + &link->alias->icmp_pgidx, faddr); + break; + default: + panic("%s: wrong proto %d", __func__, proto); + } + if (pg == NULL) + return (NULL); + + /* Check that PG has some free states */ + state = NULL; + i = FREEMASK_BITCOUNT(pg, faddr); + while (i-- > 0) { + offset = FREEMASK_FFSLL(pg, faddr); + if (offset == 0) { + /* + * We lost the race. + * No more free states in this PG. + */ + break; + } + + /* Lets try to atomically grab the state */ + if (FREEMASK_BTR(pg, faddr, offset - 1)) { + state = &STATES_CHUNK(pg, faddr)->state[offset - 1]; + /* Initialize */ + state->flags = proto != IPPROTO_TCP ? 0 : + convert_tcp_flags(f_id->_flags); + state->proto = proto; + state->aport = pg->base_port + offset - 1; + state->dport = f_id->dst_port; + state->sport = port; + state->ip6_dst = f_id->dst_ip6; + state->ip_dst = faddr; + state->ip_src = link->alias->addr; + state->hval = hval; + state->host = host; + SET_AGE(state->timestamp); + + /* Insert new state into host's hash table */ + HOST_LOCK(host); + CK_SLIST_INSERT_HEAD(&STATE_HASH(host, hval), + state, entries); + host->states_count++; + /* + * XXX: In case if host is going to be expired, + * reset NAT64LSN_DEADHOST flag. + */ + host->flags &= ~NAT64LSN_DEADHOST; + HOST_UNLOCK(host); + NAT64STAT_INC(&cfg->base.stats, screated); + /* Mark the state as ready for translate4 */ + ck_pr_fence_store(); + ck_pr_bts_32(&state->flags, NAT64_BIT_READY_IPV4); + break; + } + } + return (state); } + /* * Inspects icmp packets to see if the message contains different * packet header so we need to alter @addr and @port. */ static int -inspect_icmp_mbuf(struct mbuf **m, uint8_t *nat_proto, uint32_t *addr, +inspect_icmp_mbuf(struct mbuf **mp, uint8_t *proto, uint32_t *addr, uint16_t *port) { + struct icmp *icmp; struct ip *ip; - struct tcphdr *tcp; - struct udphdr *udp; - struct icmphdr *icmp; int off; - uint8_t proto; + uint8_t inner_proto; - ip = mtod(*m, struct ip *); /* Outer IP header */ + ip = mtod(*mp, struct ip *); /* Outer IP header */ off = (ip->ip_hl << 2) + ICMP_MINLEN; - if ((*m)->m_len < off) - *m = m_pullup(*m, off); - if (*m == NULL) + if ((*mp)->m_len < off) + *mp = m_pullup(*mp, off); + if (*mp == NULL) return (ENOMEM); - ip = mtod(*m, struct ip *); /* Outer IP header */ - icmp = L3HDR(ip, struct icmphdr *); + ip = mtod(*mp, struct ip *); /* Outer IP header */ + icmp = L3HDR(ip, struct icmp *); switch (icmp->icmp_type) { case ICMP_ECHO: case ICMP_ECHOREPLY: /* Use icmp ID as distinguisher */ - *port = ntohs(*((uint16_t *)(icmp + 1))); + *port = ntohs(icmp->icmp_id); return (0); case ICMP_UNREACH: case ICMP_TIMXCEED: @@ -266,90 +448,133 @@ inspect_icmp_mbuf(struct mbuf **m, uint8_t *nat_proto, * ICMP_UNREACH and ICMP_TIMXCEED contains IP header + 64 bits * of ULP header. */ - if ((*m)->m_pkthdr.len < off + sizeof(struct ip) + ICMP_MINLEN) + if ((*mp)->m_pkthdr.len < off + sizeof(struct ip) + ICMP_MINLEN) return (EINVAL); - if ((*m)->m_len < off + sizeof(struct ip) + ICMP_MINLEN) - *m = m_pullup(*m, off + sizeof(struct ip) + ICMP_MINLEN); - if (*m == NULL) + if ((*mp)->m_len < off + sizeof(struct ip) + ICMP_MINLEN) + *mp = m_pullup(*mp, off + sizeof(struct ip) + ICMP_MINLEN); + if (*mp == NULL) return (ENOMEM); - ip = mtodo(*m, off); /* Inner IP header */ - proto = ip->ip_p; + ip = mtodo(*mp, off); /* Inner IP header */ + inner_proto = ip->ip_p; off += ip->ip_hl << 2; /* Skip inner IP header */ *addr = ntohl(ip->ip_src.s_addr); - if ((*m)->m_len < off + ICMP_MINLEN) - *m = m_pullup(*m, off + ICMP_MINLEN); - if (*m == NULL) + if ((*mp)->m_len < off + ICMP_MINLEN) + *mp = m_pullup(*mp, off + ICMP_MINLEN); + if (*mp == NULL) return (ENOMEM); - switch (proto) { + switch (inner_proto) { case IPPROTO_TCP: - tcp = mtodo(*m, off); - *nat_proto = NAT_PROTO_TCP; - *port = ntohs(tcp->th_sport); - return (0); case IPPROTO_UDP: - udp = mtodo(*m, off); - *nat_proto = NAT_PROTO_UDP; - *port = ntohs(udp->uh_sport); + /* Copy source port from the header */ + *port = ntohs(*((uint16_t *)mtodo(*mp, off))); + *proto = inner_proto; return (0); case IPPROTO_ICMP: /* * We will translate only ICMP errors for our ICMP * echo requests. */ - icmp = mtodo(*m, off); + icmp = mtodo(*mp, off); if (icmp->icmp_type != ICMP_ECHO) return (EOPNOTSUPP); - *port = ntohs(*((uint16_t *)(icmp + 1))); + *port = ntohs(icmp->icmp_id); return (0); }; return (EOPNOTSUPP); } -static inline uint8_t -convert_tcp_flags(uint8_t flags) +static struct nat64lsn_state* +nat64lsn_get_state4to6(struct nat64lsn_cfg *cfg, struct nat64lsn_alias *alias, + in_addr_t faddr, uint16_t port, uint8_t proto) { - uint8_t result; + struct nat64lsn_state *state; + struct nat64lsn_pg *pg; + int chunk_idx, pg_idx, state_idx; - result = flags & (TH_FIN|TH_SYN); - result |= (flags & TH_RST) >> 2; /* Treat RST as FIN */ - result |= (flags & TH_ACK) >> 2; /* Treat ACK as estab */ + NAT64LSN_EPOCH_ASSERT(); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Mar 19 11:16:44 2019 Return-Path: Delivered-To: svn-src-head@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 E1511154D2E9; Tue, 19 Mar 2019 11:16:43 +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 7B1CF80A14; Tue, 19 Mar 2019 11:16:43 +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 10F88874A; Tue, 19 Mar 2019 11:16:43 +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 x2JBGgI8057953; Tue, 19 Mar 2019 11:16:42 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2JBGgMQ057952; Tue, 19 Mar 2019 11:16:42 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201903191116.x2JBGgMQ057952@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 19 Mar 2019 11:16:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345294 - head/sbin/ipfw X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sbin/ipfw X-SVN-Commit-Revision: 345294 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7B1CF80A14 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.96)[-0.962,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2019 11:16:44 -0000 Author: ae Date: Tue Mar 19 11:16:42 2019 New Revision: 345294 URL: https://svnweb.freebsd.org/changeset/base/345294 Log: Remove extra spaces. MFC after: 1 month Modified: head/sbin/ipfw/nat64lsn.c Modified: head/sbin/ipfw/nat64lsn.c ============================================================================== --- head/sbin/ipfw/nat64lsn.c Tue Mar 19 10:57:03 2019 (r345293) +++ head/sbin/ipfw/nat64lsn.c Tue Mar 19 11:16:42 2019 (r345294) @@ -783,7 +783,7 @@ nat64lsn_show_cb(ipfw_nat64lsn_cfg *cfg, const char *n if (co.verbose || cfg->nh_delete_delay != NAT64LSN_HOST_AGE) printf(" host_del_age %u", cfg->nh_delete_delay); if (co.verbose || cfg->pg_delete_delay != NAT64LSN_PG_AGE) - printf(" pg_del_age %u ", cfg->pg_delete_delay); + printf(" pg_del_age %u", cfg->pg_delete_delay); if (co.verbose || cfg->st_syn_ttl != NAT64LSN_TCP_SYN_AGE) printf(" tcp_syn_age %u", cfg->st_syn_ttl); if (co.verbose || cfg->st_close_ttl != NAT64LSN_TCP_FIN_AGE) @@ -795,7 +795,7 @@ nat64lsn_show_cb(ipfw_nat64lsn_cfg *cfg, const char *n if (co.verbose || cfg->st_icmp_ttl != NAT64LSN_ICMP_AGE) printf(" icmp_age %u", cfg->st_icmp_ttl); if (co.verbose || cfg->jmaxlen != NAT64LSN_JMAXLEN) - printf(" jmaxlen %u ", cfg->jmaxlen); + printf(" jmaxlen %u", cfg->jmaxlen); if (cfg->flags & NAT64_LOG) printf(" log"); if (cfg->flags & NAT64_ALLOW_PRIVATE) From owner-svn-src-head@freebsd.org Tue Mar 19 14:30:55 2019 Return-Path: Delivered-To: svn-src-head@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 6D938155254A; Tue, 19 Mar 2019 14:30:55 +0000 (UTC) (envelope-from mmel@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 0D6E08732D; Tue, 19 Mar 2019 14:30:55 +0000 (UTC) (envelope-from mmel@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 D4B59A793; Tue, 19 Mar 2019 14:30:54 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2JEUsBE056234; Tue, 19 Mar 2019 14:30:54 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2JEUsbR056231; Tue, 19 Mar 2019 14:30:54 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201903191430.x2JEUsbR056231@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Tue, 19 Mar 2019 14:30:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345295 - in head/sys/dev/extres: phy regulator syscon X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: in head/sys/dev/extres: phy regulator syscon X-SVN-Commit-Revision: 345295 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0D6E08732D 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.998,0]; NEURAL_HAM_SHORT(-0.94)[-0.942,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2019 14:30:55 -0000 Author: mmel Date: Tue Mar 19 14:30:54 2019 New Revision: 345295 URL: https://svnweb.freebsd.org/changeset/base/345295 Log: extres: Unify error codes for _get_by_ofw_property() methods. Return: - ENOENT if requested property doesn't exist - ENODEV if producer device is not (yet) attached - ENXIO otherwise MFC after: 2 weeks Modified: head/sys/dev/extres/phy/phy.c head/sys/dev/extres/regulator/regulator.c head/sys/dev/extres/syscon/syscon.c Modified: head/sys/dev/extres/phy/phy.c ============================================================================== --- head/sys/dev/extres/phy/phy.c Tue Mar 19 11:16:42 2019 (r345294) +++ head/sys/dev/extres/phy/phy.c Tue Mar 19 14:30:54 2019 (r345295) @@ -517,7 +517,7 @@ phy_get_by_ofw_property(device_t consumer_dev, phandle ncells = OF_getencprop_alloc_multi(cnode, name, sizeof(pcell_t), (void **)&cells); if (ncells < 1) - return (ENXIO); + return (ENOENT); /* Tranlate provider to device. */ phydev = OF_device_from_xref(cells[0]); Modified: head/sys/dev/extres/regulator/regulator.c ============================================================================== --- head/sys/dev/extres/regulator/regulator.c Tue Mar 19 11:16:42 2019 (r345294) +++ head/sys/dev/extres/regulator/regulator.c Tue Mar 19 14:30:54 2019 (r345295) @@ -1091,7 +1091,7 @@ regulator_get_by_ofw_property(device_t cdev, phandle_t ncells = OF_getencprop_alloc_multi(cnode, name, sizeof(*cells), (void **)&cells); if (ncells <= 0) - return (ENXIO); + return (ENOENT); /* Translate xref to device */ regdev = OF_device_from_xref(cells[0]); Modified: head/sys/dev/extres/syscon/syscon.c ============================================================================== --- head/sys/dev/extres/syscon/syscon.c Tue Mar 19 11:16:42 2019 (r345294) +++ head/sys/dev/extres/syscon/syscon.c Tue Mar 19 14:30:54 2019 (r345295) @@ -238,7 +238,7 @@ syscon_get_by_ofw_property(device_t cdev, phandle_t cn ncells = OF_getencprop_alloc_multi(cnode, name, sizeof(pcell_t), (void **)&cells); if (ncells < 1) - return (ENXIO); + return (ENOENT); /* Translate to syscon node. */ SYSCON_TOPO_SLOCK(); From owner-svn-src-head@freebsd.org Tue Mar 19 14:32:55 2019 Return-Path: Delivered-To: svn-src-head@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 1FD1A15526FA; Tue, 19 Mar 2019 14:32:55 +0000 (UTC) (envelope-from mmel@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 B735F87722; Tue, 19 Mar 2019 14:32:54 +0000 (UTC) (envelope-from mmel@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 899E5A911; Tue, 19 Mar 2019 14:32:54 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2JEWs4l061055; Tue, 19 Mar 2019 14:32:54 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2JEWsJa061054; Tue, 19 Mar 2019 14:32:54 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201903191432.x2JEWsJa061054@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Tue, 19 Mar 2019 14:32:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345296 - head/sys/arm/include X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm/include X-SVN-Commit-Revision: 345296 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B735F87722 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.998,0]; NEURAL_HAM_SHORT(-0.94)[-0.942,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2019 14:32:55 -0000 Author: mmel Date: Tue Mar 19 14:32:54 2019 New Revision: 345296 URL: https://svnweb.freebsd.org/changeset/base/345296 Log: Use named field's initializer when constructing _platform structure. In current code, the delay argument in FDT_PLATFORM_DEF(2) improperly initialize refs field from kobj_class structure instead of delay_count field. This causes not working DELAY() function (due to never initialized delay_count) in earlier boot stages, until the first timer was attached. MFC after: 2 weeks Modified: head/sys/arm/include/platformvar.h Modified: head/sys/arm/include/platformvar.h ============================================================================== --- head/sys/arm/include/platformvar.h Tue Mar 19 14:30:54 2019 (r345295) +++ head/sys/arm/include/platformvar.h Tue Mar 19 14:32:54 2019 (r345296) @@ -90,22 +90,22 @@ typedef struct fdt_platform_class fdt_platform_def_t; extern platform_method_t fdt_platform_methods[]; -#define FDT_PLATFORM_DEF2(NAME, VAR_NAME, NAME_STR, size, compatible, \ - delay) \ -CTASSERT(delay > 0); \ +#define FDT_PLATFORM_DEF2(NAME, VAR_NAME, NAME_STR, _size, _compatible, \ + _delay) \ +CTASSERT(_delay > 0); \ static fdt_platform_def_t VAR_NAME ## _fdt_platform = { \ .name = NAME_STR, \ .methods = fdt_platform_methods, \ - .fdt_compatible = compatible, \ + .fdt_compatible = _compatible, \ }; \ static kobj_class_t VAR_NAME ## _baseclasses[] = \ { (kobj_class_t)&VAR_NAME ## _fdt_platform, NULL }; \ static platform_def_t VAR_NAME ## _platform = { \ - NAME_STR, \ - NAME ## _methods, \ - size, \ - VAR_NAME ## _baseclasses, \ - delay, \ + .name = NAME_STR, \ + .methods = NAME ## _methods, \ + .size = _size, \ + .baseclasses = VAR_NAME ## _baseclasses, \ + .delay_count = _delay, \ }; \ DATA_SET(platform_set, VAR_NAME ## _platform) From owner-svn-src-head@freebsd.org Tue Mar 19 14:34:54 2019 Return-Path: Delivered-To: svn-src-head@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 BBA2B155277D; Tue, 19 Mar 2019 14:34:54 +0000 (UTC) (envelope-from mmel@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 58755878BD; Tue, 19 Mar 2019 14:34:54 +0000 (UTC) (envelope-from mmel@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 45729A912; Tue, 19 Mar 2019 14:34:54 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2JEYsTS061195; Tue, 19 Mar 2019 14:34:54 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2JEYsRQ061194; Tue, 19 Mar 2019 14:34:54 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201903191434.x2JEYsRQ061194@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Tue, 19 Mar 2019 14:34:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345297 - head/sys/dev/cpufreq X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/dev/cpufreq X-SVN-Commit-Revision: 345297 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 58755878BD 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_SHORT(-0.94)[-0.943,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2019 14:34:55 -0000 Author: mmel Date: Tue Mar 19 14:34:53 2019 New Revision: 345297 URL: https://svnweb.freebsd.org/changeset/base/345297 Log: Improve cpufreq_dt. - older DT can use 'cpu0-supply' property for power supply binding. - don't expect that actual CPU frequency is contained in CPU operational point table, but read current CPU voltage directly from reguator. Typically, u-boot can set starting CPU frequency to any value. MFC after: 2 weeks Modified: head/sys/dev/cpufreq/cpufreq_dt.c Modified: head/sys/dev/cpufreq/cpufreq_dt.c ============================================================================== --- head/sys/dev/cpufreq/cpufreq_dt.c Tue Mar 19 14:32:54 2019 (r345296) +++ head/sys/dev/cpufreq/cpufreq_dt.c Tue Mar 19 14:34:53 2019 (r345297) @@ -166,7 +166,7 @@ cpufreq_dt_set(device_t dev, const struct cf_setting * struct cpufreq_dt_softc *sc; const struct cpufreq_dt_opp *opp, *copp; uint64_t freq; - int error = 0; + int uvolt, error; sc = device_get_softc(dev); @@ -174,23 +174,38 @@ cpufreq_dt_set(device_t dev, const struct cf_setting * device_printf(dev, "Can't get current clk freq\n"); return (ENXIO); } + /* Try to get current valtage by using regulator first. */ + error = regulator_get_voltage(sc->reg, &uvolt); + if (error != 0) { + /* + * Try oppoints table as backup way. However, + * this is insufficient because the actual processor + * frequency may not be in the table. PLL frequency + * granularity can be different that granularity of + * oppoint table. + */ + copp = cpufreq_dt_find_opp(sc->dev, freq); + if (copp == NULL) { + device_printf(dev, + "Can't find the current freq in opp\n"); + return (ENOENT); + } + uvolt = copp->uvolt_target; - DEBUG(sc->dev, "Current freq %ju\n", freq); - DEBUG(sc->dev, "Target freq %ju\n", (uint64_t)set->freq * 1000000); - copp = cpufreq_dt_find_opp(sc->dev, freq); - if (copp == NULL) { - device_printf(dev, "Can't find the current freq in opp\n"); - return (ENOENT); } + opp = cpufreq_dt_find_opp(sc->dev, set->freq * 1000000); if (opp == NULL) { device_printf(dev, "Couldn't find an opp for this freq\n"); return (EINVAL); } + DEBUG(sc->dev, "Current freq %ju, uvolt: %d\n", freq, uvolt); + DEBUG(sc->dev, "Target freq %ju, , uvolt: %d\n", + opp->freq, opp->uvolt_target); - if (copp->uvolt_target < opp->uvolt_target) { + if (uvolt < opp->uvolt_target) { DEBUG(dev, "Changing regulator from %u to %u\n", - copp->uvolt_target, opp->uvolt_target); + uvolt, opp->uvolt_target); error = regulator_set_voltage(sc->reg, opp->uvolt_min, opp->uvolt_max); @@ -201,7 +216,7 @@ cpufreq_dt_set(device_t dev, const struct cf_setting * } DEBUG(dev, "Setting clk to %ju\n", opp->freq); - error = clk_set_freq(sc->clk, opp->freq, 0); + error = clk_set_freq(sc->clk, opp->freq, CLK_SET_ROUND_DOWN); if (error != 0) { DEBUG(dev, "Failed, backout\n"); /* Restore previous voltage (best effort) */ @@ -211,7 +226,9 @@ cpufreq_dt_set(device_t dev, const struct cf_setting * return (ENXIO); } - if (copp->uvolt_target > opp->uvolt_target) { + if (uvolt > opp->uvolt_target) { + DEBUG(dev, "Changing regulator from %u to %u\n", + uvolt, opp->uvolt_target); error = regulator_set_voltage(sc->reg, opp->uvolt_min, opp->uvolt_max); @@ -219,8 +236,7 @@ cpufreq_dt_set(device_t dev, const struct cf_setting * DEBUG(dev, "Failed to switch regulator to %d\n", opp->uvolt_target); /* Restore previous CPU frequency (best effort) */ - (void)clk_set_freq(sc->clk, - copp->freq, 0); + (void)clk_set_freq(sc->clk, copp->freq, 0); return (ENXIO); } } @@ -277,7 +293,8 @@ cpufreq_dt_identify(driver_t *driver, device_t parent) /* The cpu@0 node must have the following properties */ if (!OF_hasprop(node, "clocks") || - !OF_hasprop(node, "cpu-supply")) + (!OF_hasprop(node, "cpu-supply") && + !OF_hasprop(node, "cpu0-supply"))) return; if (!OF_hasprop(node, "operating-points") && @@ -299,7 +316,9 @@ cpufreq_dt_probe(device_t dev) node = ofw_bus_get_node(device_get_parent(dev)); if (!OF_hasprop(node, "clocks") || - !OF_hasprop(node, "cpu-supply")) + (!OF_hasprop(node, "cpu-supply") && + !OF_hasprop(node, "cpu0-supply"))) + return (ENXIO); if (!OF_hasprop(node, "operating-points") && @@ -439,9 +458,12 @@ cpufreq_dt_attach(device_t dev) if (regulator_get_by_ofw_property(dev, node, "cpu-supply", &sc->reg) != 0) { - device_printf(dev, "no regulator for %s\n", - ofw_bus_get_name(device_get_parent(dev))); - return (ENXIO); + if (regulator_get_by_ofw_property(dev, node, + "cpu0-supply", &sc->reg) != 0) { + device_printf(dev, "no regulator for %s\n", + ofw_bus_get_name(device_get_parent(dev))); + return (ENXIO); + } } if (clk_get_by_ofw_index(dev, node, 0, &sc->clk) != 0) { From owner-svn-src-head@freebsd.org Tue Mar 19 15:03:21 2019 Return-Path: Delivered-To: svn-src-head@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 9F7BF1553271; Tue, 19 Mar 2019 15:03:21 +0000 (UTC) (envelope-from imp@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 3DCD088CAB; Tue, 19 Mar 2019 15:03:21 +0000 (UTC) (envelope-from imp@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 0DE81AE38; Tue, 19 Mar 2019 15:03:21 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2JF3KhI077036; Tue, 19 Mar 2019 15:03:20 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2JF3KZL077035; Tue, 19 Mar 2019 15:03:20 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201903191503.x2JF3KZL077035@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 19 Mar 2019 15:03:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345298 - head/sys/dev/pci X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/pci X-SVN-Commit-Revision: 345298 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3DCD088CAB 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.998,0]; NEURAL_HAM_SHORT(-0.94)[-0.942,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2019 15:03:21 -0000 Author: imp Date: Tue Mar 19 15:03:20 2019 New Revision: 345298 URL: https://svnweb.freebsd.org/changeset/base/345298 Log: Add comment about why we bother to use endian macros here, and why we must use bitfields. Modified: head/sys/dev/pci/pcivar.h Modified: head/sys/dev/pci/pcivar.h ============================================================================== --- head/sys/dev/pci/pcivar.h Tue Mar 19 14:34:53 2019 (r345297) +++ head/sys/dev/pci/pcivar.h Tue Mar 19 15:03:20 2019 (r345298) @@ -259,6 +259,14 @@ typedef struct { extern uint32_t pci_numdevs; +/* + * The bitfield has to be stable an match the fields below (so that + * match_flag_vendor must be bit 0) so we have to do the endian + * dance. We can't use enums or #define constants because then the + * the macros for subsetting matches wouldn't work. These tables + * are parsed by devmatch and others to connect modules with + * devices on the PCI bus. + */ struct pci_device_table { #if BYTE_ORDER == LITTLE_ENDIAN uint16_t From owner-svn-src-head@freebsd.org Tue Mar 19 15:42:13 2019 Return-Path: Delivered-To: svn-src-head@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 3280F1553EC5; Tue, 19 Mar 2019 15:42:13 +0000 (UTC) (envelope-from mmel@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 C30E68A363; Tue, 19 Mar 2019 15:42:12 +0000 (UTC) (envelope-from mmel@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 917A7B3F8; Tue, 19 Mar 2019 15:42:12 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2JFgCa1096003; Tue, 19 Mar 2019 15:42:12 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2JFgCQZ096002; Tue, 19 Mar 2019 15:42:12 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201903191542.x2JFgCQZ096002@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Tue, 19 Mar 2019 15:42:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345299 - head/sys/dev/psci X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/dev/psci X-SVN-Commit-Revision: 345299 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C30E68A363 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.96)[-0.963,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2019 15:42:13 -0000 Author: mmel Date: Tue Mar 19 15:42:11 2019 New Revision: 345299 URL: https://svnweb.freebsd.org/changeset/base/345299 Log: PSCI: Don't take missing implementation of psci get_version() as fatal. Minimalistic PSCI implementation in U-Boot doesn't implement get_version() method for some SoC. In this case, use PSCI version declared by 'psci' node in DT as fallback. MFC after: 2 weeks Modified: head/sys/dev/psci/psci.c head/sys/dev/psci/psci.h Modified: head/sys/dev/psci/psci.c ============================================================================== --- head/sys/dev/psci/psci.c Tue Mar 19 15:03:20 2019 (r345298) +++ head/sys/dev/psci/psci.c Tue Mar 19 15:42:11 2019 (r345299) @@ -79,9 +79,9 @@ struct psci_softc { }; #ifdef FDT -static int psci_v0_1_init(device_t dev); +static int psci_v0_1_init(device_t dev, int default_version); #endif -static int psci_v0_2_init(device_t dev); +static int psci_v0_2_init(device_t dev, int default_version); struct psci_softc *psci_softc = NULL; @@ -96,15 +96,35 @@ struct psci_softc *psci_softc = NULL; #endif #ifdef FDT +struct psci_init_def { + int default_version; + psci_initfn_t psci_init; +}; + +static struct psci_init_def psci_v1_0_init_def = { + .default_version = (1 << 16) | 0, + .psci_init = psci_v0_2_init +}; + +static struct psci_init_def psci_v0_2_init_def = { + .default_version = (0 << 16) | 2, + .psci_init = psci_v0_2_init +}; + +static struct psci_init_def psci_v0_1_init_def = { + .default_version = (0 << 16) | 1, + .psci_init = psci_v0_1_init +}; + static struct ofw_compat_data compat_data[] = { - {"arm,psci-1.0", (uintptr_t)psci_v0_2_init}, - {"arm,psci-0.2", (uintptr_t)psci_v0_2_init}, - {"arm,psci", (uintptr_t)psci_v0_1_init}, + {"arm,psci-1.0", (uintptr_t)&psci_v1_0_init_def}, + {"arm,psci-0.2", (uintptr_t)&psci_v0_2_init_def}, + {"arm,psci", (uintptr_t)&psci_v0_1_init_def}, {NULL, 0} }; #endif -static int psci_attach(device_t, psci_initfn_t); +static int psci_attach(device_t, psci_initfn_t, int); static void psci_shutdown(void *, int); static int psci_find_callfn(psci_callfn_t *); @@ -198,12 +218,13 @@ static int psci_fdt_attach(device_t dev) { const struct ofw_compat_data *ocd; - psci_initfn_t psci_init; + struct psci_init_def *psci_init_def; ocd = ofw_bus_search_compatible(dev, compat_data); - psci_init = (psci_initfn_t)ocd->ocd_data; + psci_init_def = (struct psci_init_def *)ocd->ocd_data; - return (psci_attach(dev, psci_init)); + return (psci_attach(dev, psci_init_def->psci_init, + psci_init_def->default_version)); } #endif @@ -304,12 +325,12 @@ static int psci_acpi_attach(device_t dev) { - return (psci_attach(dev, psci_v0_2_init)); + return (psci_attach(dev, psci_v0_2_init, PSCI_RETVAL_NOT_SUPPORTED)); } #endif static int -psci_attach(device_t dev, psci_initfn_t psci_init) +psci_attach(device_t dev, psci_initfn_t psci_init, int default_version) { struct psci_softc *sc = device_get_softc(dev); @@ -317,7 +338,7 @@ psci_attach(device_t dev, psci_initfn_t psci_init) return (ENXIO); KASSERT(psci_init != NULL, ("PSCI init function cannot be NULL")); - if (psci_init(dev)) + if (psci_init(dev, default_version)) return (ENXIO); psci_softc = sc; @@ -464,7 +485,7 @@ psci_reset(void) #ifdef FDT /* Only support PSCI 0.1 on FDT */ static int -psci_v0_1_init(device_t dev) +psci_v0_1_init(device_t dev, int default_version __unused) { struct psci_softc *sc = device_get_softc(dev); int psci_fn; @@ -510,7 +531,7 @@ psci_v0_1_init(device_t dev) #endif static int -psci_v0_2_init(device_t dev) +psci_v0_2_init(device_t dev, int default_version) { struct psci_softc *sc = device_get_softc(dev); int version; @@ -529,8 +550,20 @@ psci_v0_2_init(device_t dev) version = _psci_get_version(sc); - if (version == PSCI_RETVAL_NOT_SUPPORTED) - return (1); + /* + * U-Boot PSCI implementation doesn't have psci_get_version() + * method implemented for many boards. In this case, use the version + * readed from FDT as fallback. No fallback method for ACPI. + */ + if (version == PSCI_RETVAL_NOT_SUPPORTED) { + if (default_version == PSCI_RETVAL_NOT_SUPPORTED) + return (1); + + version = default_version; + printf("PSCI get_version() function is not implemented, " + " assuming v%d.%d\n", PSCI_VER_MAJOR(version), + PSCI_VER_MINOR(version)); + } sc->psci_version = version; if ((PSCI_VER_MAJOR(version) == 0 && PSCI_VER_MINOR(version) == 2) || Modified: head/sys/dev/psci/psci.h ============================================================================== --- head/sys/dev/psci/psci.h Tue Mar 19 15:03:20 2019 (r345298) +++ head/sys/dev/psci/psci.h Tue Mar 19 15:42:11 2019 (r345299) @@ -31,7 +31,7 @@ #include -typedef int (*psci_initfn_t)(device_t dev); +typedef int (*psci_initfn_t)(device_t dev, int default_version); typedef int (*psci_callfn_t)(register_t, register_t, register_t, register_t); extern int psci_present; From owner-svn-src-head@freebsd.org Tue Mar 19 17:38:56 2019 Return-Path: Delivered-To: svn-src-head@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 18E0F152CA05; Tue, 19 Mar 2019 17:38:56 +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 98BF58E206; Tue, 19 Mar 2019 17:38:55 +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 7DE01C9BC; Tue, 19 Mar 2019 17:38:55 +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 x2JHcte3058062; Tue, 19 Mar 2019 17:38:55 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2JHctd3058061; Tue, 19 Mar 2019 17:38:55 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201903191738.x2JHctd3058061@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 19 Mar 2019 17:38:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345302 - head/sbin/bectl X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sbin/bectl X-SVN-Commit-Revision: 345302 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 98BF58E206 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.964,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2019 17:38:56 -0000 Author: kevans Date: Tue Mar 19 17:38:54 2019 New Revision: 345302 URL: https://svnweb.freebsd.org/changeset/base/345302 Log: bectl(8): change jail command to execute jail(8) The jail(8) command provides a variety of jail pseudo-parameters that are useful to consumers of bectl, mount.devfs being the most-often-requested paramater by bectl users. command, exec.start, nopersist, and persist may not be specified via -o to bectl. The command/exec.start remains passed as it always has at the end of bectl, and persistence is dictated by -b/-U bectl jail arguments. Submitted by: Wes Maag MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D19282 Modified: head/sbin/bectl/bectl_jail.c Modified: head/sbin/bectl/bectl_jail.c ============================================================================== --- head/sbin/bectl/bectl_jail.c Tue Mar 19 17:16:37 2019 (r345301) +++ head/sbin/bectl/bectl_jail.c Tue Mar 19 17:38:54 2019 (r345302) @@ -40,10 +40,10 @@ __FBSDID("$FreeBSD$"); #include #include - #include "bectl.h" -static void jailparam_grow(void); +#define MNTTYPE_ZFS 222 + static void jailparam_add(const char *name, const char *val); static int jailparam_del(const char *name); static bool jailparam_addarg(char *arg); @@ -51,84 +51,28 @@ static int jailparam_delarg(char *arg); static int bectl_search_jail_paths(const char *mnt); static int bectl_locate_jail(const char *ident); +static int bectl_jail_cleanup(char *mountpoint, int jid); -/* We'll start with 8 parameters initially and grow as needed. */ -#define INIT_PARAMCOUNT 8 - -static struct jailparam *jp; -static int jpcnt; -static int jpused; static char mnt_loc[BE_MAXPATHLEN]; +static nvlist_t *jailparams; -static void -jailparam_grow(void) -{ +static const char *disabled_params[] = { + "command", "exec.start", "nopersist", "persist", NULL +}; - jpcnt *= 2; - jp = realloc(jp, jpcnt * sizeof(*jp)); - if (jp == NULL) - err(2, "realloc"); -} static void jailparam_add(const char *name, const char *val) { - int i; - for (i = 0; i < jpused; ++i) { - if (strcmp(name, jp[i].jp_name) == 0) - break; - } - - if (i < jpused) - jailparam_free(&jp[i], 1); - else if (jpused == jpcnt) - /* The next slot isn't allocated yet */ - jailparam_grow(); - - if (jailparam_init(&jp[i], name) != 0) - return; - if (jailparam_import(&jp[i], val) != 0) - return; - ++jpused; + nvlist_add_string(jailparams, name, val); } static int jailparam_del(const char *name) { - int i; - char *val; - for (i = 0; i < jpused; ++i) { - if (strcmp(name, jp[i].jp_name) == 0) - break; - } - - if (i == jpused) - return (ENOENT); - - for (; i < jpused - 1; ++i) { - val = jailparam_export(&jp[i + 1]); - - jailparam_free(&jp[i], 1); - /* - * Given the context, the following will really only fail if - * they can't allocate the copy of the name or value. - */ - if (jailparam_init(&jp[i], jp[i + 1].jp_name) != 0) { - free(val); - return (ENOMEM); - } - if (jailparam_import(&jp[i], val) != 0) { - jailparam_free(&jp[i], 1); - free(val); - return (ENOMEM); - } - free(val); - } - - jailparam_free(&jp[i], 1); - --jpused; + nvlist_remove_all(jailparams, name); return (0); } @@ -136,6 +80,7 @@ static bool jailparam_addarg(char *arg) { char *name, *val; + size_t i, len; if (arg == NULL) return (false); @@ -156,6 +101,15 @@ jailparam_addarg(char *arg) } strlcpy(mnt_loc, val, sizeof(mnt_loc)); } + + for (i = 0; disabled_params[i] != NULL; i++) { + len = strlen(disabled_params[i]); + if (strncmp(disabled_params[i], name, len) == 0) { + fprintf(stderr, "invalid jail parameter: %s\n", name); + return (false); + } + } + jailparam_add(name, val); return (true); } @@ -176,22 +130,128 @@ jailparam_delarg(char *arg) return (jailparam_del(name)); } +static int +build_jailcmd(char ***argvp, bool interactive, int argc, char *argv[]) +{ + char *cmd, **jargv, *name, *val; + nvpair_t *nvp; + size_t i, iarg, nargv; + + cmd = NULL; + nvp = NULL; + iarg = i = 0; + if (nvlist_size(jailparams, &nargv, NV_ENCODE_NATIVE) != 0) + return (1); + + /* + * Number of args + "/usr/sbin/jail", "-c", and ending NULL. + * If interactive also include command. + */ + nargv += 3; + if (interactive) { + if (argc == 0) + nargv++; + else + nargv += argc; + } + + jargv = *argvp = calloc(nargv, sizeof(jargv)); + if (jargv == NULL) + err(2, "calloc"); + + jargv[iarg++] = strdup("/usr/sbin/jail"); + jargv[iarg++] = strdup("-c"); + while ((nvp = nvlist_next_nvpair(jailparams, nvp)) != NULL) { + name = nvpair_name(nvp); + if (nvpair_value_string(nvp, &val) != 0) + continue; + + if (asprintf(&jargv[iarg++], "%s=%s", name, val) < 0) + goto error; + } + if (interactive) { + if (argc < 1) + cmd = strdup("/bin/sh"); + else { + cmd = argv[0]; + argc--; + argv++; + } + + if (asprintf(&jargv[iarg++], "command=%s", cmd) < 0) { + goto error; + } + if (argc < 1) { + free(cmd); + cmd = NULL; + } + + for (; argc > 0; argc--) { + if (asprintf(&jargv[iarg++], "%s", argv[0]) < 0) + goto error; + argv++; + } + } + + return (0); + +error: + if (interactive && argc < 1) + free(cmd); + for (; i < iarg - 1; i++) { + free(jargv[i]); + } + free(jargv); + return (1); +} + +/* Remove jail and cleanup any non zfs mounts. */ +static int +bectl_jail_cleanup(char *mountpoint, int jid) +{ + struct statfs *mntbuf; + size_t i, searchlen, mntsize; + + if (jid >= 0 && jail_remove(jid) != 0) { + fprintf(stderr, "unable to remove jail"); + return (1); + } + + searchlen = strnlen(mountpoint, MAXPATHLEN); + mntsize = getmntinfo(&mntbuf, MNT_NOWAIT); + for (i = 0; i < mntsize; i++) { + if (strncmp(mountpoint, mntbuf[i].f_mntonname, searchlen) == 0 && + mntbuf[i].f_type != MNTTYPE_ZFS) { + + if (unmount(mntbuf[i].f_mntonname, 0) != 0) { + fprintf(stderr, "bectl jail: unable to unmount filesystem %s", + mntbuf[i].f_mntonname); + return (1); + } + } + } + + return (0); +} + int bectl_cmd_jail(int argc, char *argv[]) { - char *bootenv, *mountpoint; - int jid, mntflags, opt, ret; + char *bootenv, **jargv, *mountpoint; + int i, jid, mntflags, opt, ret; bool default_hostname, interactive, unjail; pid_t pid; + /* XXX TODO: Allow shallow */ mntflags = BE_MNT_DEEP; default_hostname = interactive = unjail = true; - jpcnt = INIT_PARAMCOUNT; - jp = malloc(jpcnt * sizeof(*jp)); - if (jp == NULL) - err(2, "malloc"); + if ((nvlist_alloc(&jailparams, NV_UNIQUE_NAME, 0)) != 0) { + fprintf(stderr, "nvlist_alloc() failed\n"); + return (1); + } + jailparam_add("persist", "true"); jailparam_add("allow.mount", "true"); jailparam_add("allow.mount.devfs", "true"); @@ -210,6 +270,8 @@ bectl_cmd_jail(int argc, char *argv[]) */ if (strcmp(optarg, "host.hostname") == 0) default_hostname = false; + } else { + return (1); } break; case 'U': @@ -236,13 +298,14 @@ bectl_cmd_jail(int argc, char *argv[]) argc -= optind; argv += optind; - /* struct jail be_jail = { 0 }; */ if (argc < 1) { fprintf(stderr, "bectl jail: missing boot environment name\n"); return (usage(false)); } bootenv = argv[0]; + argc--; + argv++; /* * XXX TODO: if its already mounted, perhaps there should be a flag to @@ -264,45 +327,46 @@ bectl_cmd_jail(int argc, char *argv[]) * This is our indicator that path was not set by the user, so we'll use * the path that libbe generated for us. */ - if (mountpoint == NULL) + if (mountpoint == NULL) { jailparam_add("path", mnt_loc); - /* Create the jail for now, attach later as-needed */ - jid = jailparam_set(jp, jpused, JAIL_CREATE); - if (jid == -1) { - fprintf(stderr, "unable to create jail. error: %d\n", errno); + mountpoint = mnt_loc; + } + + if ((build_jailcmd(&jargv, interactive, argc, argv)) != 0) { + fprintf(stderr, "unable to build argument list for jail command\n"); return (1); } - jailparam_free(jp, jpused); - free(jp); - - /* We're not interactive, nothing more to do here. */ - if (!interactive) - return (0); - pid = fork(); - switch(pid) { + + switch (pid) { case -1: perror("fork"); return (1); case 0: - jail_attach(jid); - /* We're attached within the jail... good bye! */ - chdir("/"); - if (argc > 1) - execve(argv[1], &argv[1], NULL); - else - execl("/bin/sh", "/bin/sh", NULL); - fprintf(stderr, "bectl jail: failed to execute %s\n", - (argc > 1 ? argv[1] : "/bin/sh")); - _exit(1); + execv("/usr/sbin/jail", jargv); + fprintf(stderr, "bectl jail: failed to execute\n"); default: - /* Wait for the child to get back, see if we need to unjail */ waitpid(pid, NULL, 0); } + for (i = 0; jargv[i] != NULL; i++) { + free(jargv[i]); + } + free(jargv); + + if (!interactive) + return (0); + if (unjail) { - jail_remove(jid); + /* + * We're not checking the jail id result here because in the + * case of invalid param, or last command in jail was an error + * the jail will not exist upon exit. bectl_jail_cleanup will + * only jail_remove if the jid is >= 0. + */ + jid = bectl_locate_jail(bootenv); + bectl_jail_cleanup(mountpoint, jid); be_unmount(be, bootenv, 0); } @@ -319,7 +383,6 @@ bectl_search_jail_paths(const char *mnt) /* jail_getv expects name/value strings */ snprintf(lastjid, sizeof(lastjid), "%d", 0); - jid = 0; while ((jid = jail_getv(0, "lastjid", lastjid, "path", &jailpath, NULL)) != -1) { @@ -416,7 +479,7 @@ bectl_cmd_unjail(int argc, char *argv[]) return (1); } - jail_remove(jid); + bectl_jail_cleanup(path, jid); be_unmount(be, target, 0); return (0); From owner-svn-src-head@freebsd.org Tue Mar 19 17:49:06 2019 Return-Path: Delivered-To: svn-src-head@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 D7D4D152E287; Tue, 19 Mar 2019 17:49:05 +0000 (UTC) (envelope-from erj@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 78B5A8EC59; Tue, 19 Mar 2019 17:49:05 +0000 (UTC) (envelope-from erj@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 545A0CB70; Tue, 19 Mar 2019 17:49:04 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2JHn4Mg064585; Tue, 19 Mar 2019 17:49:04 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2JHn4f8064584; Tue, 19 Mar 2019 17:49:04 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201903191749.x2JHn4f8064584@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Tue, 19 Mar 2019 17:49:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345303 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 345303 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 78B5A8EC59 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.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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2019 17:49:06 -0000 Author: erj Date: Tue Mar 19 17:49:03 2019 New Revision: 345303 URL: https://svnweb.freebsd.org/changeset/base/345303 Log: iflib: prevent possible infinite loop in iflib_encap From Jake: iflib_encap calls bus_dmamap_load_mbuf_sg. Upon it returning EFBIG, an m_collapse and an m_defrag are attempted to shrink the mbuf cluster to fit within the DMA segment limitations. However, if we call m_defrag, and then bus_dmamap_load_mbuf_sg returns EFBIG on the now defragmented mbuf, we will continuously re-call bus_dmamap_load_mbuf_sg over and over. This happens because m_head isn't NULL, and remap is >1, so we don't try to m_collapse or m_defrag again. The only way we exit the loop is if m_head is NULL. However, m_head can't be modified by the call to bus_dmamap_load_mbuf_sg, because we don't pass it as a double pointer. I believe this will be an incredibly rare occurrence, because it is unlikely that bus_dmamap_load_mbuf_sg will actually fail on the second defragment with an EFBIG error. However, it still seems like a possibility that we should account for. Fix the exit check to ensure that if remap is >1, we will also exit, even if m_head is not NULL. Submitted by: Jacob Keller Reviewed by: shurd@, gallatin@ MFC after: 1 week Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D19468 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Tue Mar 19 17:38:54 2019 (r345302) +++ head/sys/net/iflib.c Tue Mar 19 17:49:03 2019 (r345303) @@ -3276,9 +3276,14 @@ defrag: txq->ift_mbuf_defrag++; m_head = m_defrag(*m_headp, M_NOWAIT); } - remap++; - if (__predict_false(m_head == NULL)) + /* + * remap should never be >1 unless bus_dmamap_load_mbuf_sg + * failed to map an mbuf that was run through m_defrag + */ + MPASS(remap <= 1); + if (__predict_false(m_head == NULL || remap > 1)) goto defrag_failed; + remap++; *m_headp = m_head; goto retry; break; From owner-svn-src-head@freebsd.org Tue Mar 19 17:59:59 2019 Return-Path: Delivered-To: svn-src-head@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 BA793152E99C; Tue, 19 Mar 2019 17:59:58 +0000 (UTC) (envelope-from erj@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 5F19D8FB60; Tue, 19 Mar 2019 17:59:58 +0000 (UTC) (envelope-from erj@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 2D15BCD75; Tue, 19 Mar 2019 17:59:58 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2JHxwTi070858; Tue, 19 Mar 2019 17:59:58 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2JHxusD070850; Tue, 19 Mar 2019 17:59:56 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201903191759.x2JHxusD070850@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Tue, 19 Mar 2019 17:59:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345305 - in head/sys: dev/e1000 dev/ixgbe dev/ixl net sys X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: in head/sys: dev/e1000 dev/ixgbe dev/ixl net sys X-SVN-Commit-Revision: 345305 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5F19D8FB60 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_SHORT(-0.97)[-0.970,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2019 17:59:59 -0000 Author: erj Date: Tue Mar 19 17:59:56 2019 New Revision: 345305 URL: https://svnweb.freebsd.org/changeset/base/345305 Log: iflib: expose the Rx mbuf buffer size to drivers From Jake: iflib_fl_setup calculates a suitable buffer size for the Rx mbufs based on the isc_max_frame_size value that drivers setup. This calculation is repeated by drivers when programming their hardware with the size of each Rx buffer. This can lead to a mismatch where the iflib mbuf size is different from the expected size of the buffer as programmed by the hardware. This can lead to unexpected results. If iflib ever wants to support mbuf sizes larger than one page, every driver must be updated to account for the new possible buffer sizes. Fix this by calculating the mbuf size prior to calling IFDI_INIT, and adding the iflib_get_rx_mbuf_sz function which will expose this value to drivers, so that they do not repeat the same calculation. Submitted by: Jacob Keller Reviewed by: shurd@, erj@ MFC after: 1 week Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D19489 Modified: head/sys/dev/e1000/if_em.c head/sys/dev/ixgbe/if_ix.c head/sys/dev/ixgbe/if_ixv.c head/sys/dev/ixl/if_iavf.c head/sys/dev/ixl/ixl_pf_main.c head/sys/net/iflib.c head/sys/net/iflib.h head/sys/sys/param.h Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Tue Mar 19 17:49:15 2019 (r345304) +++ head/sys/dev/e1000/if_em.c Tue Mar 19 17:59:56 2019 (r345305) @@ -1270,14 +1270,7 @@ em_if_init(if_ctx_t ctx) /* Setup Multicast table */ em_if_multi_set(ctx); - /* - * Figure out the desired mbuf - * pool for doing jumbos - */ - if (adapter->hw.mac.max_frame_size <= 2048) - adapter->rx_mbuf_sz = MCLBYTES; - else - adapter->rx_mbuf_sz = MJUMPAGESIZE; + adapter->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx); em_initialize_receive_unit(ctx); /* Use real VLAN Filter support? */ Modified: head/sys/dev/ixgbe/if_ix.c ============================================================================== --- head/sys/dev/ixgbe/if_ix.c Tue Mar 19 17:49:15 2019 (r345304) +++ head/sys/dev/ixgbe/if_ix.c Tue Mar 19 17:59:56 2019 (r345305) @@ -2880,10 +2880,7 @@ ixgbe_if_init(if_ctx_t ctx) ixgbe_if_multi_set(ctx); /* Determine the correct mbuf pool, based on frame size */ - if (adapter->max_frame_size <= MCLBYTES) - adapter->rx_mbuf_sz = MCLBYTES; - else - adapter->rx_mbuf_sz = MJUMPAGESIZE; + adapter->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx); /* Configure RX settings */ ixgbe_initialize_receive_units(ctx); Modified: head/sys/dev/ixgbe/if_ixv.c ============================================================================== --- head/sys/dev/ixgbe/if_ixv.c Tue Mar 19 17:49:15 2019 (r345304) +++ head/sys/dev/ixgbe/if_ixv.c Tue Mar 19 17:59:56 2019 (r345305) @@ -629,14 +629,7 @@ ixv_if_init(if_ctx_t ctx) /* Setup Multicast table */ ixv_if_multi_set(ctx); - /* - * Determine the correct mbuf pool - * for doing jumbo/headersplit - */ - if (ifp->if_mtu > ETHERMTU) - adapter->rx_mbuf_sz = MJUMPAGESIZE; - else - adapter->rx_mbuf_sz = MCLBYTES; + adapter->rx_mbuf_sz = iflib_get_rx_mbuf_sz(ctx); /* Configure RX settings */ ixv_initialize_receive_units(ctx); Modified: head/sys/dev/ixl/if_iavf.c ============================================================================== --- head/sys/dev/ixl/if_iavf.c Tue Mar 19 17:49:15 2019 (r345304) +++ head/sys/dev/ixl/if_iavf.c Tue Mar 19 17:59:56 2019 (r345305) @@ -614,7 +614,6 @@ iavf_send_vc_msg(struct iavf_sc *sc, u32 op) static void iavf_init_queues(struct ixl_vsi *vsi) { - if_softc_ctx_t scctx = vsi->shared; struct ixl_tx_queue *tx_que = vsi->tx_queues; struct ixl_rx_queue *rx_que = vsi->rx_queues; struct rx_ring *rxr; @@ -625,10 +624,7 @@ iavf_init_queues(struct ixl_vsi *vsi) for (int i = 0; i < vsi->num_rx_queues; i++, rx_que++) { rxr = &rx_que->rxr; - if (scctx->isc_max_frame_size <= MCLBYTES) - rxr->mbuf_sz = MCLBYTES; - else - rxr->mbuf_sz = MJUMPAGESIZE; + rxr->mbuf_sz = iflib_get_rx_mbuf_sz(vsi->ctx); wr32(vsi->hw, rxr->tail, 0); } Modified: head/sys/dev/ixl/ixl_pf_main.c ============================================================================== --- head/sys/dev/ixl/ixl_pf_main.c Tue Mar 19 17:49:15 2019 (r345304) +++ head/sys/dev/ixl/ixl_pf_main.c Tue Mar 19 17:59:56 2019 (r345305) @@ -1300,10 +1300,7 @@ ixl_initialize_vsi(struct ixl_vsi *vsi) struct i40e_hmc_obj_rxq rctx; /* Next setup the HMC RX Context */ - if (scctx->isc_max_frame_size <= MCLBYTES) - rxr->mbuf_sz = MCLBYTES; - else - rxr->mbuf_sz = MJUMPAGESIZE; + rxr->mbuf_sz = iflib_get_rx_mbuf_sz(vsi->ctx); u16 max_rxmax = rxr->mbuf_sz * hw->func_caps.rx_buf_chain_len; Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Tue Mar 19 17:49:15 2019 (r345304) +++ head/sys/net/iflib.c Tue Mar 19 17:59:56 2019 (r345305) @@ -171,6 +171,7 @@ struct iflib_ctx { uint32_t ifc_if_flags; uint32_t ifc_flags; uint32_t ifc_max_fl_buf_size; + uint32_t ifc_rx_mbuf_sz; int ifc_link_state; int ifc_link_irq; @@ -2172,7 +2173,6 @@ iflib_fl_setup(iflib_fl_t fl) { iflib_rxq_t rxq = fl->ifl_rxq; if_ctx_t ctx = rxq->ifr_ctx; - if_softc_ctx_t sctx = &ctx->ifc_softc_ctx; bit_nclear(fl->ifl_rx_bitmap, 0, fl->ifl_size - 1); /* @@ -2181,14 +2181,7 @@ iflib_fl_setup(iflib_fl_t fl) iflib_fl_bufs_free(fl); /* Now replenish the mbufs */ MPASS(fl->ifl_credits == 0); - /* - * XXX don't set the max_frame_size to larger - * than the hardware can handle - */ - if (sctx->isc_max_frame_size <= 2048) - fl->ifl_buf_size = MCLBYTES; - else - fl->ifl_buf_size = MJUMPAGESIZE; + fl->ifl_buf_size = ctx->ifc_rx_mbuf_sz; if (fl->ifl_buf_size > ctx->ifc_max_fl_buf_size) ctx->ifc_max_fl_buf_size = fl->ifl_buf_size; fl->ifl_cltype = m_gettype(fl->ifl_buf_size); @@ -2314,6 +2307,27 @@ iflib_timer(void *arg) } static void +iflib_calc_rx_mbuf_sz(if_ctx_t ctx) +{ + if_softc_ctx_t sctx = &ctx->ifc_softc_ctx; + + /* + * XXX don't set the max_frame_size to larger + * than the hardware can handle + */ + if (sctx->isc_max_frame_size <= MCLBYTES) + ctx->ifc_rx_mbuf_sz = MCLBYTES; + else + ctx->ifc_rx_mbuf_sz = MJUMPAGESIZE; +} + +uint32_t +iflib_get_rx_mbuf_sz(if_ctx_t ctx) +{ + return (ctx->ifc_rx_mbuf_sz); +} + +static void iflib_init_locked(if_ctx_t ctx) { if_softc_ctx_t sctx = &ctx->ifc_softc_ctx; @@ -2347,6 +2361,14 @@ iflib_init_locked(if_ctx_t ctx) CALLOUT_UNLOCK(txq); iflib_netmap_txq_init(ctx, txq); } + + /* + * Calculate a suitable Rx mbuf size prior to calling IFDI_INIT, so + * that drivers can use the value when setting up the hardware receive + * buffers. + */ + iflib_calc_rx_mbuf_sz(ctx); + #ifdef INVARIANTS i = if_getdrvflags(ifp); #endif Modified: head/sys/net/iflib.h ============================================================================== --- head/sys/net/iflib.h Tue Mar 19 17:49:15 2019 (r345304) +++ head/sys/net/iflib.h Tue Mar 19 17:59:56 2019 (r345305) @@ -381,6 +381,8 @@ void iflib_set_mac(if_ctx_t ctx, uint8_t mac[ETHER_ADD void iflib_request_reset(if_ctx_t ctx); uint8_t iflib_in_detach(if_ctx_t ctx); +uint32_t iflib_get_rx_mbuf_sz(if_ctx_t ctx); + /* * If the driver can plug cleanly in to newbus use these */ Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Tue Mar 19 17:49:15 2019 (r345304) +++ head/sys/sys/param.h Tue Mar 19 17:59:56 2019 (r345305) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300016 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300017 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-head@freebsd.org Tue Mar 19 18:07:45 2019 Return-Path: Delivered-To: svn-src-head@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 7BA25152EDAA; Tue, 19 Mar 2019 18:07:45 +0000 (UTC) (envelope-from erj@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 21FD4680FA; Tue, 19 Mar 2019 18:07:45 +0000 (UTC) (envelope-from erj@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 DEA1ECF56; Tue, 19 Mar 2019 18:07:44 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2JI7iEi075954; Tue, 19 Mar 2019 18:07:44 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2JI7ikY075953; Tue, 19 Mar 2019 18:07:44 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201903191807.x2JI7ikY075953@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Tue, 19 Mar 2019 18:07:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345306 - head/sys/dev/ixgbe X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: head/sys/dev/ixgbe X-SVN-Commit-Revision: 345306 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 21FD4680FA 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.968,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2019 18:07:45 -0000 Author: erj Date: Tue Mar 19 18:07:44 2019 New Revision: 345306 URL: https://svnweb.freebsd.org/changeset/base/345306 Log: ixv(4): Add missing IFLIB_IS_VF flag in iflib shared ctx From Krzysztof: The driver built as KLD cannot be unloaded, if this flag is not set. Submitted by: Krzysztof Galazka Reviewed by: shurd@, erj@ MFC after: 1 week Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D19402 Modified: head/sys/dev/ixgbe/if_ixv.c Modified: head/sys/dev/ixgbe/if_ixv.c ============================================================================== --- head/sys/dev/ixgbe/if_ixv.c Tue Mar 19 17:59:56 2019 (r345305) +++ head/sys/dev/ixgbe/if_ixv.c Tue Mar 19 18:07:44 2019 (r345306) @@ -220,7 +220,7 @@ static struct if_shared_ctx ixv_sctx_init = { .isc_vendor_info = ixv_vendor_info_array, .isc_driver_version = ixv_driver_version, .isc_driver = &ixv_if_driver, - .isc_flags = IFLIB_TSO_INIT_IP, + .isc_flags = IFLIB_IS_VF | IFLIB_TSO_INIT_IP, .isc_nrxd_min = {MIN_RXD}, .isc_ntxd_min = {MIN_TXD}, From owner-svn-src-head@freebsd.org Tue Mar 19 19:11:45 2019 Return-Path: Delivered-To: svn-src-head@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 2716B1532B13; Tue, 19 Mar 2019 19:11:45 +0000 (UTC) (envelope-from np@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 BF89E6B9B3; Tue, 19 Mar 2019 19:11:44 +0000 (UTC) (envelope-from np@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 99EE7DB12; Tue, 19 Mar 2019 19:11:44 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2JJBioU009534; Tue, 19 Mar 2019 19:11:44 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2JJBi6E009533; Tue, 19 Mar 2019 19:11:44 GMT (envelope-from np@FreeBSD.org) Message-Id: <201903191911.x2JJBi6E009533@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Tue, 19 Mar 2019 19:11:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345307 - head/sys/dev/cxgbe/iw_cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe/iw_cxgbe X-SVN-Commit-Revision: 345307 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BF89E6B9B3 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.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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2019 19:11:45 -0000 Author: np Date: Tue Mar 19 19:11:44 2019 New Revision: 345307 URL: https://svnweb.freebsd.org/changeset/base/345307 Log: iw_cxgbe: Remove unused smac_idx from the ep structure. Submitted by: Krishnamraju Eraparaju @ Chelsio Modified: head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Modified: head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h ============================================================================== --- head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Tue Mar 19 18:07:44 2019 (r345306) +++ head/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Tue Mar 19 19:11:44 2019 (r345307) @@ -859,7 +859,6 @@ struct c4iw_ep { unsigned int mpa_pkt_len; u32 ird; u32 ord; - u32 smac_idx; u32 tx_chan; u32 mtu; u16 mss; From owner-svn-src-head@freebsd.org Tue Mar 19 19:58:41 2019 Return-Path: Delivered-To: svn-src-head@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 523431534F03; Tue, 19 Mar 2019 19:58:41 +0000 (UTC) (envelope-from wosch@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 EABEB6D21D; Tue, 19 Mar 2019 19:58:40 +0000 (UTC) (envelope-from wosch@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 C40B2E21E; Tue, 19 Mar 2019 19:58:40 +0000 (UTC) (envelope-from wosch@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2JJwe2V034404; Tue, 19 Mar 2019 19:58:40 GMT (envelope-from wosch@FreeBSD.org) Received: (from wosch@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2JJweEQ034403; Tue, 19 Mar 2019 19:58:40 GMT (envelope-from wosch@FreeBSD.org) Message-Id: <201903191958.x2JJweEQ034403@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wosch set sender to wosch@FreeBSD.org using -f From: Wolfram Schneider Date: Tue, 19 Mar 2019 19:58:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345310 - head X-SVN-Group: head X-SVN-Commit-Author: wosch X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 345310 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EABEB6D21D 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.981,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2019 19:58:41 -0000 Author: wosch Date: Tue Mar 19 19:58:40 2019 New Revision: 345310 URL: https://svnweb.freebsd.org/changeset/base/345310 Log: Improve english grammar for kernel built time PR: 224433 Approved by: jhb Differential Revision: https://reviews.freebsd.org/D19636 Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Mar 19 19:57:37 2019 (r345309) +++ head/Makefile.inc1 Tue Mar 19 19:58:40 2019 (r345310) @@ -1162,7 +1162,7 @@ buildworld_epilogue: .PHONY @echo "--------------------------------------------------------------" @echo ">>> World build completed on `LC_ALL=C date`" @seconds=$$(($$(date '+%s') - ${_BUILDWORLD_START})); \ - echo -n ">>> World build in $$seconds seconds, "; \ + echo -n ">>> World built in $$seconds seconds, "; \ echo "ncpu: $$(sysctl -n hw.ncpu)${.MAKE.JOBS:S/^/, make -j/}" @echo "--------------------------------------------------------------" @@ -1648,7 +1648,7 @@ buildkernel: .MAKE .PHONY .endfor @seconds=$$(($$(date '+%s') - ${_BUILDKERNEL_START})); \ - echo -n ">>> Kernel(s) build for${BUILDKERNELS} in $$seconds seconds, "; \ + echo -n ">>> Kernel(s) ${BUILDKERNELS} built in $$seconds seconds, "; \ echo "ncpu: $$(sysctl -n hw.ncpu)${.MAKE.JOBS:S/^/, make -j/}" @echo "--------------------------------------------------------------" From owner-svn-src-head@freebsd.org Tue Mar 19 21:46:22 2019 Return-Path: Delivered-To: svn-src-head@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 28FBB153D1B6; Tue, 19 Mar 2019 21:46:22 +0000 (UTC) (envelope-from imp@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 C10A5709F3; Tue, 19 Mar 2019 21:46:21 +0000 (UTC) (envelope-from imp@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 98E2CF543; Tue, 19 Mar 2019 21:46:21 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2JLkLtw092564; Tue, 19 Mar 2019 21:46:21 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2JLkLpP092563; Tue, 19 Mar 2019 21:46:21 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201903192146.x2JLkLpP092563@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Tue, 19 Mar 2019 21:46:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345311 - head/sys/dev/pci X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/pci X-SVN-Commit-Revision: 345311 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C10A5709F3 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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2019 21:46:22 -0000 Author: imp Date: Tue Mar 19 21:46:21 2019 New Revision: 345311 URL: https://svnweb.freebsd.org/changeset/base/345311 Log: Fix two typos: an -> and; the the -> the And justify the paragraph after the change (and set fill column to 80 instead of 70). Noticed by: rpokala@, vangyzen@ Modified: head/sys/dev/pci/pcivar.h Modified: head/sys/dev/pci/pcivar.h ============================================================================== --- head/sys/dev/pci/pcivar.h Tue Mar 19 19:58:40 2019 (r345310) +++ head/sys/dev/pci/pcivar.h Tue Mar 19 21:46:21 2019 (r345311) @@ -260,12 +260,11 @@ typedef struct { extern uint32_t pci_numdevs; /* - * The bitfield has to be stable an match the fields below (so that - * match_flag_vendor must be bit 0) so we have to do the endian - * dance. We can't use enums or #define constants because then the - * the macros for subsetting matches wouldn't work. These tables - * are parsed by devmatch and others to connect modules with - * devices on the PCI bus. + * The bitfield has to be stable and match the fields below (so that + * match_flag_vendor must be bit 0) so we have to do the endian dance. We can't + * use enums or #define constants because then the macros for subsetting matches + * wouldn't work. These tables are parsed by devmatch and others to connect + * modules with devices on the PCI bus. */ struct pci_device_table { #if BYTE_ORDER == LITTLE_ENDIAN From owner-svn-src-head@freebsd.org Tue Mar 19 22:52:45 2019 Return-Path: Delivered-To: svn-src-head@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 E7586153E9B2; Tue, 19 Mar 2019 22:52:44 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (162-251-186-162.surfnetc.com [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 554FA72BBA; Tue, 19 Mar 2019 22:52:43 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id x2JMqfnl000196 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 19 Mar 2019 15:52:41 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id x2JMqfeg000195; Tue, 19 Mar 2019 15:52:41 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Tue, 19 Mar 2019 15:52:41 -0700 From: Gleb Smirnoff To: "Andrey V. Elsukov" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r345274 - in head: sbin/ipfw sys/conf sys/modules/ipfw_nat64 sys/netinet6 sys/netpfil/ipfw/nat64 Message-ID: <20190319225241.GS3562@FreeBSD.org> References: <201903181259.x2ICx94D013948@repo.freebsd.org> <20190318230943.GR3562@FreeBSD.org> <2eb41483-24b5-0711-3798-7bf53dd5e716@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2eb41483-24b5-0711-3798-7bf53dd5e716@FreeBSD.org> User-Agent: Mutt/1.11.2 (2019-01-07) X-Rspamd-Queue-Id: 554FA72BBA 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.98)[-0.975,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2019 22:52:45 -0000 On Tue, Mar 19, 2019 at 10:45:11AM +0300, Andrey V. Elsukov wrote: A> > On Mon, Mar 18, 2019 at 12:59:09PM +0000, Andrey V. Elsukov wrote: A> > A> Author: ae A> > A> Date: Mon Mar 18 12:59:08 2019 A> > A> New Revision: 345274 A> > A> URL: https://svnweb.freebsd.org/changeset/base/345274 A> > A> A> > A> Log: A> > A> Update NAT64LSN implementation: A> > ... A> > A> o ConcurrencyKit and epoch(9) is used to make NAT64LSN lockless on fast path. A> > A> > Why did you create a separate epoch? All the pfil hooks already run at network A> > epoch. A> A> Hi, A> A> You did not specified, when you plan to merge you changes. I assume that A> you didn't plan to do that. :) Do you mean to stable/12? In that case better to add epochs with the merge rather than to head. -- Gleb Smirnoff From owner-svn-src-head@freebsd.org Tue Mar 19 23:44:28 2019 Return-Path: Delivered-To: svn-src-head@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 51B30154038F; Tue, 19 Mar 2019 23:44:28 +0000 (UTC) (envelope-from erj@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 E4EC274BEB; Tue, 19 Mar 2019 23:44:27 +0000 (UTC) (envelope-from erj@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 B384218A3B; Tue, 19 Mar 2019 23:44:27 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2JNiRrL055858; Tue, 19 Mar 2019 23:44:27 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2JNiQrn055852; Tue, 19 Mar 2019 23:44:26 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201903192344.x2JNiQrn055852@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Tue, 19 Mar 2019 23:44:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345312 - in head: share/man/man9 sys/net sys/sys X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: in head: share/man/man9 sys/net sys/sys X-SVN-Commit-Revision: 345312 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E4EC274BEB 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_SHORT(-0.97)[-0.968,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2019 23:44:28 -0000 Author: erj Date: Tue Mar 19 23:44:26 2019 New Revision: 345312 URL: https://svnweb.freebsd.org/changeset/base/345312 Log: iflib: mark isc_driver_version as constant From Jake: The iflib core never modifies the isc_driver_version string. Allow drivers to safely assign pointers to constant buffers by marking this parameter const. Submitted by: Jacob Keller Reviewed by: erj@, gallatin@, jhb@ MFC after: 1 week Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D19577 Modified: head/share/man/man9/sysctl.9 head/sys/net/iflib.c head/sys/net/iflib.h head/sys/sys/sysctl.h Modified: head/share/man/man9/sysctl.9 ============================================================================== --- head/share/man/man9/sysctl.9 Tue Mar 19 21:46:21 2019 (r345311) +++ head/share/man/man9/sysctl.9 Tue Mar 19 23:44:26 2019 (r345312) @@ -48,6 +48,7 @@ .Nm SYSCTL_ADD_SBINTIME_MSEC , .Nm SYSCTL_ADD_SBINTIME_USEC , .Nm SYSCTL_ADD_STRING , +.Nm SYSCTL_ADD_CONST_STRING , .Nm SYSCTL_ADD_STRUCT , .Nm SYSCTL_ADD_U8 , .Nm SYSCTL_ADD_U16 , @@ -82,6 +83,7 @@ .Nm SYSCTL_SBINTIME_MSEC , .Nm SYSCTL_SBINTIME_USEC , .Nm SYSCTL_STRING , +.Nm SYSCTL_CONST_STRING , .Nm SYSCTL_STRUCT , .Nm SYSCTL_U8 , .Nm SYSCTL_U16 , @@ -291,6 +293,16 @@ .Fa "const char *descr" .Fc .Ft struct sysctl_oid * +.Fo SYSCTL_ADD_CONST_STRING +.Fa "struct sysctl_ctx_list *ctx" +.Fa "struct sysctl_oid_list *parent" +.Fa "int number" +.Fa "const char *name" +.Fa "int ctlflags" +.Fa "const char *ptr" +.Fa "const char *descr" +.Fc +.Ft struct sysctl_oid * .Fo SYSCTL_ADD_STRUCT .Fa "struct sysctl_ctx_list *ctx" .Fa "struct sysctl_oid_list *parent" @@ -443,6 +455,7 @@ .Fn SYSCTL_SBINTIME_MSEC parent number name ctlflags ptr descr .Fn SYSCTL_SBINTIME_USEC parent number name ctlflags ptr descr .Fn SYSCTL_STRING parent number name ctlflags arg len descr +.Fn SYSCTL_CONST_STRING parent number name ctlflags arg descr .Fn SYSCTL_STRUCT parent number name ctlflags ptr struct_type descr .Fn SYSCTL_U8 parent number name ctlflags ptr val descr .Fn SYSCTL_U16 parent number name ctlflags ptr val descr @@ -607,6 +620,11 @@ If the .Fa len argument in zero, the string length is computed at every access to the OID using .Xr strlen 3 . +Use the +.Fn SYSCTL_CONST_STRING +macro or the +.Fn SYSCTL_ADD_CONST_STRING +function to add a sysctl for a constant string. .Sh CREATING OPAQUE SYSCTLS The .Fn SYSCTL_OPAQUE @@ -658,6 +676,7 @@ Static sysctls are declared using one of the .Fn SYSCTL_SBINTIME_MSEC , .Fn SYSCTL_SBINTIME_USEC , .Fn SYSCTL_STRING , +.Fn SYSCTL_CONST_STRING , .Fn SYSCTL_STRUCT , .Fn SYSCTL_U8 , .Fn SYSCTL_U16 , @@ -690,6 +709,7 @@ Dynamic nodes are created using one of the .Fn SYSCTL_ADD_SBINTIME_MSEC , .Fn SYSCTL_ADD_SBINTIME_USEC , .Fn SYSCTL_ADD_STRING , +.Fn SYSCTL_ADD_CONST_STRING , .Fn SYSCTL_ADD_STRUCT , .Fn SYSCTL_ADD_U8 , .Fn SYSCTL_ADD_U16 , Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Tue Mar 19 21:46:21 2019 (r345311) +++ head/sys/net/iflib.c Tue Mar 19 23:44:26 2019 (r345312) @@ -6257,8 +6257,8 @@ iflib_add_device_sysctl_pre(if_ctx_t ctx) CTLFLAG_RD, NULL, "IFLIB fields"); oid_list = SYSCTL_CHILDREN(node); - SYSCTL_ADD_STRING(ctx_list, oid_list, OID_AUTO, "driver_version", - CTLFLAG_RD, ctx->ifc_sctx->isc_driver_version, 0, + SYSCTL_ADD_CONST_STRING(ctx_list, oid_list, OID_AUTO, "driver_version", + CTLFLAG_RD, ctx->ifc_sctx->isc_driver_version, "driver version"); SYSCTL_ADD_U16(ctx_list, oid_list, OID_AUTO, "override_ntxqs", Modified: head/sys/net/iflib.h ============================================================================== --- head/sys/net/iflib.h Tue Mar 19 21:46:21 2019 (r345311) +++ head/sys/net/iflib.h Tue Mar 19 23:44:26 2019 (r345312) @@ -248,7 +248,7 @@ struct if_shared_ctx { /* fields necessary for probe */ pci_vendor_info_t *isc_vendor_info; - char *isc_driver_version; + const char *isc_driver_version; /* optional function to transform the read values to match the table*/ void (*isc_parse_devinfo) (uint16_t *device_id, uint16_t *subvendor_id, uint16_t *subdevice_id, uint16_t *rev_id); Modified: head/sys/sys/sysctl.h ============================================================================== --- head/sys/sys/sysctl.h Tue Mar 19 21:46:21 2019 (r345311) +++ head/sys/sys/sysctl.h Tue Mar 19 23:44:26 2019 (r345312) @@ -354,6 +354,25 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); NULL); \ }) +/* Oid for a constant '\0' terminated string. */ +#define SYSCTL_CONST_STRING(parent, nbr, name, access, arg, descr) \ + SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|(access), \ + __DECONST(char *, arg), 0, sysctl_handle_string, "A", descr); \ + CTASSERT(!(access & CTLFLAG_WR)); \ + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_STRING) + +#define SYSCTL_ADD_CONST_STRING(ctx, parent, nbr, name, access, arg, descr) \ +({ \ + char *__arg = __DECONST(char *, arg); \ + CTASSERT(!(access & CTLFLAG_WR)); \ + CTASSERT(((access) & CTLTYPE) == 0 || \ + ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_STRING); \ + sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_STRING|(access), \ + __arg, 0, sysctl_handle_string, "A", __DESCR(descr), \ + NULL); \ +}) + /* Oid for a bool. If ptr is NULL, val is returned. */ #define SYSCTL_NULL_BOOL_PTR ((bool *)NULL) #define SYSCTL_BOOL(parent, nbr, name, access, ptr, val, descr) \ From owner-svn-src-head@freebsd.org Wed Mar 20 00:12:18 2019 Return-Path: Delivered-To: svn-src-head@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 736DD1540C87; Wed, 20 Mar 2019 00:12:18 +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 159E6756EF; Wed, 20 Mar 2019 00:12:18 +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 5A8298644; Wed, 20 Mar 2019 00:12:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r345312 - in head: share/man/man9 sys/net sys/sys To: Eric Joyner , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201903192344.x2JNiQrn055852@repo.freebsd.org> 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: Date: Tue, 19 Mar 2019 17:12:15 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.5.3 MIME-Version: 1.0 In-Reply-To: <201903192344.x2JNiQrn055852@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 159E6756EF 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.984,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 00:12:18 -0000 On 3/19/19 4:44 PM, Eric Joyner wrote: > Author: erj > Date: Tue Mar 19 23:44:26 2019 > New Revision: 345312 > URL: https://svnweb.freebsd.org/changeset/base/345312 > > Log: > iflib: mark isc_driver_version as constant > > From Jake: > The iflib core never modifies the isc_driver_version string. Allow > drivers to safely assign pointers to constant buffers by marking this > parameter const. I didn't say it in the review, but FWIW, I probably would have added SYSCTL_CONST_STRING as its own commit first (so it can be MFC'd standalone, etc.) with its own message and then committed the iflib change that uses it second. Just something to consider for the future. -- John Baldwin From owner-svn-src-head@freebsd.org Wed Mar 20 07:19:10 2019 Return-Path: Delivered-To: svn-src-head@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 73CAB154A4F0; Wed, 20 Mar 2019 07:19:10 +0000 (UTC) (envelope-from cperciva@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 114F0890DD; Wed, 20 Mar 2019 07:19:10 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D076B1D6B6; Wed, 20 Mar 2019 07:19:09 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2K7J9h3093516; Wed, 20 Mar 2019 07:19:09 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2K7J9fZ093515; Wed, 20 Mar 2019 07:19:09 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201903200719.x2K7J9fZ093515@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Wed, 20 Mar 2019 07:19:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345316 - head/release X-SVN-Group: head X-SVN-Commit-Author: cperciva X-SVN-Commit-Paths: head/release X-SVN-Commit-Revision: 345316 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 114F0890DD 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.998,0]; NEURAL_HAM_SHORT(-0.94)[-0.940,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 07:19:10 -0000 Author: cperciva Date: Wed Mar 20 07:19:09 2019 New Revision: 345316 URL: https://svnweb.freebsd.org/changeset/base/345316 Log: Pass --arm64 to bsdec2-image-upload when building ARM64 AMIs. Future commits will allow the resulting EC2 AMIs to actually boot and be usable. Modified: head/release/Makefile.ec2 Modified: head/release/Makefile.ec2 ============================================================================== --- head/release/Makefile.ec2 Wed Mar 20 03:50:45 2019 (r345315) +++ head/release/Makefile.ec2 Wed Mar 20 07:19:09 2019 (r345316) @@ -42,6 +42,9 @@ PUBLICSNAP= --publicsnap EC2SNSREL= ${REVISION}-${BRANCH} EC2SNSVERS= ${EC2_SVNBRANCH}@${EC2_SVNREV} .endif +.if ${TARGET_ARCH} != "amd64" +EC2ARCH= --${TARGET_ARCH:S/aarch64/arm64/} +.endif CLEANFILES+= ec2ami @@ -82,7 +85,8 @@ ec2ami: cw-ec2 ${CW_EC2_PORTINSTALL} @echo "--------------------------------------------------------------" @false .endif - /usr/local/bin/bsdec2-image-upload ${PUBLISH} ${PUBLICSNAP} --sriov --ena \ + /usr/local/bin/bsdec2-image-upload ${PUBLISH} ${PUBLICSNAP} \ + ${EC2ARCH} --sriov --ena \ ${.OBJDIR}/ec2.raw \ "${TYPE} ${REVISION}-${BRANCH}-${TARGET}${AMINAMESUFFIX}" \ "${TYPE}/${TARGET} ${EC2_SVNBRANCH}@${EC2_SVNREV}" \ From owner-svn-src-head@freebsd.org Wed Mar 20 07:24:22 2019 Return-Path: Delivered-To: svn-src-head@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 DE5CF154A742; Wed, 20 Mar 2019 07:24:22 +0000 (UTC) (envelope-from cperciva@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 8518C89530; Wed, 20 Mar 2019 07:24:22 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58FBD1D85A; Wed, 20 Mar 2019 07:24:22 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2K7OM2o098740; Wed, 20 Mar 2019 07:24:22 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2K7OMCU098739; Wed, 20 Mar 2019 07:24:22 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201903200724.x2K7OMCU098739@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Wed, 20 Mar 2019 07:24:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345317 - head/release/tools X-SVN-Group: head X-SVN-Commit-Author: cperciva X-SVN-Commit-Paths: head/release/tools X-SVN-Commit-Revision: 345317 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8518C89530 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_SHORT(-0.94)[-0.940,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 07:24:23 -0000 Author: cperciva Date: Wed Mar 20 07:24:21 2019 New Revision: 345317 URL: https://svnweb.freebsd.org/changeset/base/345317 Log: Only install amazon-ssm-agent into amd64 AMIs. This package does not exist on aarch64 at present. Modified: head/release/tools/ec2.conf Modified: head/release/tools/ec2.conf ============================================================================== --- head/release/tools/ec2.conf Wed Mar 20 07:19:09 2019 (r345316) +++ head/release/tools/ec2.conf Wed Mar 20 07:24:21 2019 (r345317) @@ -6,7 +6,15 @@ # Packages to install into the image we're creating. This is a deliberately # minimalist set, providing only the packages necessary to bootstrap further # package installation as specified via EC2 user-data. -export VM_EXTRA_PACKAGES="ec2-scripts firstboot-freebsd-update firstboot-pkgs dual-dhclient amazon-ssm-agent" +export VM_EXTRA_PACKAGES="ec2-scripts firstboot-freebsd-update firstboot-pkgs dual-dhclient" + +# Include the amazon-ssm-agent package in amd64 images, since some users want +# to be able to use it on systems which are not connected to the Internet. +# (It is not enabled by default, however.) This package does not exist for +# aarch64, so we have to be selective about when we install it. +if [ "${TARGET_ARCH}" = "amd64" ]; then + export VM_EXTRA_PACKAGES="${VM_EXTRA_PACKAGES} amazon-ssm-agent" +fi # Set to a list of third-party software to enable in rc.conf(5). export VM_RC_LIST="ec2_configinit ec2_fetchkey ec2_loghostkey firstboot_freebsd_update firstboot_pkgs ntpd" From owner-svn-src-head@freebsd.org Wed Mar 20 07:40:39 2019 Return-Path: Delivered-To: svn-src-head@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 86120154ACC4; Wed, 20 Mar 2019 07:40:39 +0000 (UTC) (envelope-from avos@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 2CB1C89F68; Wed, 20 Mar 2019 07:40:39 +0000 (UTC) (envelope-from avos@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 07F9F1DA0A; Wed, 20 Mar 2019 07:40:39 +0000 (UTC) (envelope-from avos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2K7ecAH004453; Wed, 20 Mar 2019 07:40:38 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2K7ecWq004452; Wed, 20 Mar 2019 07:40:38 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201903200740.x2K7ecWq004452@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Wed, 20 Mar 2019 07:40:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345318 - head/usr.bin/lockf X-SVN-Group: head X-SVN-Commit-Author: avos X-SVN-Commit-Paths: head/usr.bin/lockf X-SVN-Commit-Revision: 345318 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2CB1C89F68 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_SHORT(-0.97)[-0.968,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 07:40:39 -0000 Author: avos Date: Wed Mar 20 07:40:38 2019 New Revision: 345318 URL: https://svnweb.freebsd.org/changeset/base/345318 Log: lockf(1): return EX_UNAVAILABLE if -n is used and the lock file does not exist Apply EX_UNAVAILABLE patch part from PR 170775 to match the documentation. Checked with a command from PR 210770: lockf -n /tmp/doesnotexist echo; echo $? PR: 210770 MFC after: 1 week Modified: head/usr.bin/lockf/lockf.c Modified: head/usr.bin/lockf/lockf.c ============================================================================== --- head/usr.bin/lockf/lockf.c Wed Mar 20 07:24:21 2019 (r345317) +++ head/usr.bin/lockf/lockf.c Wed Mar 20 07:40:38 2019 (r345318) @@ -174,6 +174,8 @@ acquire_lock(const char *name, int flags) if ((fd = open(name, O_RDONLY|O_EXLOCK|flags, 0666)) == -1) { if (errno == EAGAIN || errno == EINTR) return (-1); + else if (errno == ENOENT && (flags & O_CREAT) == 0) + err(EX_UNAVAILABLE, "%s", name); err(EX_CANTCREAT, "cannot open %s", name); } return (fd); From owner-svn-src-head@freebsd.org Wed Mar 20 10:06:45 2019 Return-Path: Delivered-To: svn-src-head@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 3A324154E645; Wed, 20 Mar 2019 10:06:45 +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 D399E8E853; Wed, 20 Mar 2019 10:06:44 +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 AEFF61F32D; Wed, 20 Mar 2019 10:06:44 +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 x2KA6ixX083119; Wed, 20 Mar 2019 10:06:44 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2KA6isJ083118; Wed, 20 Mar 2019 10:06:44 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201903201006.x2KA6isJ083118@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 20 Mar 2019 10:06:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345319 - head/sys/netpfil/ipfw/nat64 X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netpfil/ipfw/nat64 X-SVN-Commit-Revision: 345319 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D399E8E853 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.979,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 10:06:45 -0000 Author: ae Date: Wed Mar 20 10:06:44 2019 New Revision: 345319 URL: https://svnweb.freebsd.org/changeset/base/345319 Log: Use NET_EPOCH instead of allocating separate one. MFC after: 1 month Modified: head/sys/netpfil/ipfw/nat64/nat64lsn.c Modified: head/sys/netpfil/ipfw/nat64/nat64lsn.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64lsn.c Wed Mar 20 07:40:38 2019 (r345318) +++ head/sys/netpfil/ipfw/nat64/nat64lsn.c Wed Mar 20 10:06:44 2019 (r345319) @@ -72,12 +72,10 @@ __FBSDID("$FreeBSD$"); MALLOC_DEFINE(M_NAT64LSN, "NAT64LSN", "NAT64LSN"); -static epoch_t nat64lsn_epoch; -#define NAT64LSN_EPOCH_ENTER(et) epoch_enter_preempt(nat64lsn_epoch, &(et)) -#define NAT64LSN_EPOCH_EXIT(et) epoch_exit_preempt(nat64lsn_epoch, &(et)) -#define NAT64LSN_EPOCH_WAIT() epoch_wait_preempt(nat64lsn_epoch) -#define NAT64LSN_EPOCH_ASSERT() MPASS(in_epoch(nat64lsn_epoch)) -#define NAT64LSN_EPOCH_CALL(c, f) epoch_call(nat64lsn_epoch, (c), (f)) +#define NAT64LSN_EPOCH_ENTER(et) NET_EPOCH_ENTER(et) +#define NAT64LSN_EPOCH_EXIT(et) NET_EPOCH_EXIT(et) +#define NAT64LSN_EPOCH_ASSERT() NET_EPOCH_ASSERT() +#define NAT64LSN_EPOCH_CALL(c, f) epoch_call(net_epoch_preempt, (c), (f)) static uma_zone_t nat64lsn_host_zone; static uma_zone_t nat64lsn_pgchunk_zone; @@ -1578,8 +1576,6 @@ void nat64lsn_init_internal(void) { - nat64lsn_epoch = epoch_alloc(EPOCH_PREEMPT); - nat64lsn_host_zone = uma_zcreate("NAT64LSN hosts", sizeof(struct nat64lsn_host), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); @@ -1606,8 +1602,6 @@ nat64lsn_uninit_internal(void) { /* XXX: epoch_task drain */ - epoch_free(nat64lsn_epoch); - JQUEUE_LOCK_DESTROY(); uma_zdestroy(nat64lsn_host_zone); uma_zdestroy(nat64lsn_pgchunk_zone); From owner-svn-src-head@freebsd.org Wed Mar 20 10:11:22 2019 Return-Path: Delivered-To: svn-src-head@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 663C9154E9C7; Wed, 20 Mar 2019 10:11:22 +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 0A9CA8EF9E; Wed, 20 Mar 2019 10:11:22 +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 D9A891F371; Wed, 20 Mar 2019 10:11:21 +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 x2KABLhg086873; Wed, 20 Mar 2019 10:11:21 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2KABLXS086872; Wed, 20 Mar 2019 10:11:21 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201903201011.x2KABLXS086872@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Wed, 20 Mar 2019 10:11:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345321 - head/sys/netpfil/ipfw/nat64 X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netpfil/ipfw/nat64 X-SVN-Commit-Revision: 345321 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0A9CA8EF9E 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_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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 10:11:22 -0000 Author: ae Date: Wed Mar 20 10:11:21 2019 New Revision: 345321 URL: https://svnweb.freebsd.org/changeset/base/345321 Log: Do not enter epoch section recursively. A pfil hook is already invoked in NET_EPOCH section. Modified: head/sys/netpfil/ipfw/nat64/nat64lsn.c Modified: head/sys/netpfil/ipfw/nat64/nat64lsn.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64lsn.c Wed Mar 20 10:09:38 2019 (r345320) +++ head/sys/netpfil/ipfw/nat64/nat64lsn.c Wed Mar 20 10:11:21 2019 (r345321) @@ -1514,7 +1514,6 @@ int ipfw_nat64lsn(struct ip_fw_chain *ch, struct ip_fw_args *args, ipfw_insn *cmd, int *done) { - struct epoch_tracker et; struct nat64lsn_cfg *cfg; ipfw_insn *icmd; int ret; @@ -1531,7 +1530,6 @@ ipfw_nat64lsn(struct ip_fw_chain *ch, struct ip_fw_arg *done = 1; /* terminate the search */ - NAT64LSN_EPOCH_ENTER(et); switch (args->f_id.addr_type) { case 4: ret = nat64lsn_translate4(cfg, &args->f_id, &args->m); @@ -1551,7 +1549,6 @@ ipfw_nat64lsn(struct ip_fw_chain *ch, struct ip_fw_arg default: ret = cfg->nomatch_verdict; } - NAT64LSN_EPOCH_EXIT(et); if (ret != IP_FW_PASS && args->m != NULL) { m_freem(args->m); From owner-svn-src-head@freebsd.org Wed Mar 20 10:36:59 2019 Return-Path: Delivered-To: svn-src-head@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 16E68154F701; Wed, 20 Mar 2019 10:36:59 +0000 (UTC) (envelope-from vmaffione@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 B057A901E6; Wed, 20 Mar 2019 10:36:58 +0000 (UTC) (envelope-from vmaffione@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 8721C1F84A; Wed, 20 Mar 2019 10:36:58 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2KAaw0F099394; Wed, 20 Mar 2019 10:36:58 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2KAawGc099393; Wed, 20 Mar 2019 10:36:58 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201903201036.x2KAawGc099393@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Wed, 20 Mar 2019 10:36:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345323 - head/tests/sys/netmap X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: head/tests/sys/netmap X-SVN-Commit-Revision: 345323 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B057A901E6 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_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.98)[-0.980,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 10:36:59 -0000 Author: vmaffione Date: Wed Mar 20 10:36:58 2019 New Revision: 345323 URL: https://svnweb.freebsd.org/changeset/base/345323 Log: netmap: update unit tests Revision r345269 introduced changes that triggered a regression on netmap unit tests (tests/sys/netmap/ctrl-api-test.c). This change updates the unit tests to remove the regression. Reported by: lwhsu MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D19639 Modified: head/tests/sys/netmap/ctrl-api-test.c Modified: head/tests/sys/netmap/ctrl-api-test.c ============================================================================== --- head/tests/sys/netmap/ctrl-api-test.c Wed Mar 20 10:20:48 2019 (r345322) +++ head/tests/sys/netmap/ctrl-api-test.c Wed Mar 20 10:36:58 2019 (r345323) @@ -146,12 +146,12 @@ struct TestContext { uint32_t nr_hdr_len; /* for PORT_HDR_SET and PORT_HDR_GET */ uint32_t nr_first_cpu_id; /* vale polling */ uint32_t nr_num_polling_cpus; /* vale polling */ + uint32_t sync_kloop_mode; /* sync-kloop */ int fd; /* netmap file descriptor */ void *csb; /* CSB entries (atok and ktoa) */ struct nmreq_option *nr_opt; /* list of options */ sem_t *sem; /* for thread synchronization */ - struct nmport_d *nmport; /* nmport descriptor from libnetmap */ }; static struct TestContext ctx_; @@ -352,8 +352,11 @@ niocregif(struct TestContext *ctx, int netmap_api) /* The 11 ABI is the one right before the introduction of the new NIOCCTRL * ABI. The 11 ABI is useful to perform tests with legacy applications - * (which use the 11 ABI) and new kernel (which uses 12, or higher). */ -#define NETMAP_API_NIOCREGIF 11 + * (which use the 11 ABI) and new kernel (which uses 12, or higher). + * However, version 14 introduced a change in the layout of struct netmap_if, + * so that binary backward compatibility to 11 is not supported anymore. + */ +#define NETMAP_API_NIOCREGIF 14 static int legacy_regif_default(struct TestContext *ctx) @@ -1113,7 +1116,7 @@ bad_extmem_option(struct TestContext *ctx) pools_info_fill(&pools_info); /* Request a large ring size, to make sure that the kernel * rejects our request. */ - pools_info.nr_ring_pool_objsize = (1 << 16); + pools_info.nr_ring_pool_objsize = (1 << 20); return _extmem_option(ctx, &pools_info) < 0 ? 0 : -1; } @@ -1140,6 +1143,10 @@ duplicate_extmem_options(struct TestContext *ctx) save1 = e1; save2 = e2; + strncpy(ctx->ifname_ext, "vale0:0", sizeof(ctx->ifname_ext)); + ctx->nr_tx_slots = 16; + ctx->nr_rx_slots = 16; + ret = port_register_hwall(ctx); if (ret >= 0) { printf("duplicate option not detected\n"); @@ -1322,51 +1329,58 @@ sync_kloop(struct TestContext *ctx) static int sync_kloop_eventfds(struct TestContext *ctx) { - struct nmreq_opt_sync_kloop_eventfds *opt = NULL; - struct nmreq_option save; + struct nmreq_opt_sync_kloop_eventfds *evopt = NULL; + struct nmreq_opt_sync_kloop_mode modeopt; + struct nmreq_option evsave; int num_entries; size_t opt_size; int ret, i; + memset(&modeopt, 0, sizeof(modeopt)); + modeopt.nro_opt.nro_reqtype = NETMAP_REQ_OPT_SYNC_KLOOP_MODE; + modeopt.mode = ctx->sync_kloop_mode; + push_option(&modeopt.nro_opt, ctx); + num_entries = num_registered_rings(ctx); - opt_size = sizeof(*opt) + num_entries * sizeof(opt->eventfds[0]); - opt = calloc(1, opt_size); - opt->nro_opt.nro_next = 0; - opt->nro_opt.nro_reqtype = NETMAP_REQ_OPT_SYNC_KLOOP_EVENTFDS; - opt->nro_opt.nro_status = 0; - opt->nro_opt.nro_size = opt_size; + opt_size = sizeof(*evopt) + num_entries * sizeof(evopt->eventfds[0]); + evopt = calloc(1, opt_size); + evopt->nro_opt.nro_next = 0; + evopt->nro_opt.nro_reqtype = NETMAP_REQ_OPT_SYNC_KLOOP_EVENTFDS; + evopt->nro_opt.nro_status = 0; + evopt->nro_opt.nro_size = opt_size; for (i = 0; i < num_entries; i++) { int efd = eventfd(0, 0); - opt->eventfds[i].ioeventfd = efd; + evopt->eventfds[i].ioeventfd = efd; efd = eventfd(0, 0); - opt->eventfds[i].irqfd = efd; + evopt->eventfds[i].irqfd = efd; } - push_option(&opt->nro_opt, ctx); - save = opt->nro_opt; + push_option(&evopt->nro_opt, ctx); + evsave = evopt->nro_opt; ret = sync_kloop_start_stop(ctx); if (ret != 0) { - free(opt); + free(evopt); clear_options(ctx); return ret; } #ifdef __linux__ - save.nro_status = 0; + evsave.nro_status = 0; #else /* !__linux__ */ - save.nro_status = EOPNOTSUPP; + evsave.nro_status = EOPNOTSUPP; #endif /* !__linux__ */ - ret = checkoption(&opt->nro_opt, &save); - free(opt); + ret = checkoption(&evopt->nro_opt, &evsave); + free(evopt); clear_options(ctx); return ret; } static int -sync_kloop_eventfds_all(struct TestContext *ctx) +sync_kloop_eventfds_all_mode(struct TestContext *ctx, + uint32_t sync_kloop_mode) { int ret; @@ -1375,10 +1389,18 @@ sync_kloop_eventfds_all(struct TestContext *ctx) return ret; } + ctx->sync_kloop_mode = sync_kloop_mode; + return sync_kloop_eventfds(ctx); } static int +sync_kloop_eventfds_all(struct TestContext *ctx) +{ + return sync_kloop_eventfds_all_mode(ctx, 0); +} + +static int sync_kloop_eventfds_all_tx(struct TestContext *ctx) { struct nmreq_opt_csb opt; @@ -1399,6 +1421,27 @@ sync_kloop_eventfds_all_tx(struct TestContext *ctx) } static int +sync_kloop_eventfds_all_direct(struct TestContext *ctx) +{ + return sync_kloop_eventfds_all_mode(ctx, + NM_OPT_SYNC_KLOOP_DIRECT_TX | NM_OPT_SYNC_KLOOP_DIRECT_RX); +} + +static int +sync_kloop_eventfds_all_direct_tx(struct TestContext *ctx) +{ + return sync_kloop_eventfds_all_mode(ctx, + NM_OPT_SYNC_KLOOP_DIRECT_TX); +} + +static int +sync_kloop_eventfds_all_direct_rx(struct TestContext *ctx) +{ + return sync_kloop_eventfds_all_mode(ctx, + NM_OPT_SYNC_KLOOP_DIRECT_RX); +} + +static int sync_kloop_nocsb(struct TestContext *ctx) { int ret; @@ -1677,6 +1720,9 @@ static struct mytest tests[] = { decltest(sync_kloop), decltest(sync_kloop_eventfds_all), decltest(sync_kloop_eventfds_all_tx), + decltest(sync_kloop_eventfds_all_direct), + decltest(sync_kloop_eventfds_all_direct_tx), + decltest(sync_kloop_eventfds_all_direct_rx), decltest(sync_kloop_nocsb), decltest(sync_kloop_csb_enable), decltest(sync_kloop_conflict), From owner-svn-src-head@freebsd.org Wed Mar 20 13:07:58 2019 Return-Path: Delivered-To: svn-src-head@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 F33111553DC7; Wed, 20 Mar 2019 13:07:57 +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 9212A95C0C; Wed, 20 Mar 2019 13:07:57 +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 6D959211A7; Wed, 20 Mar 2019 13:07:57 +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 x2KD7vc8079660; Wed, 20 Mar 2019 13:07:57 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2KD7vHR079659; Wed, 20 Mar 2019 13:07:57 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201903201307.x2KD7vHR079659@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 20 Mar 2019 13:07:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345324 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 345324 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9212A95C0C 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_SHORT(-0.98)[-0.979,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 13:07:58 -0000 Author: kib Date: Wed Mar 20 13:07:57 2019 New Revision: 345324 URL: https://svnweb.freebsd.org/changeset/base/345324 Log: vm_fault_copy_entry: accept invalid source pages. Either msync(MS_INVALIDATE) or the object unlock during vnode truncation can expose invalid pages backing wired entries. Accept them, but do not install them into destrination pmap. We must create copied pages in the copy case, because e.g. vm_object_unwire() expects that the entry is fully backed. Reported by: syzkaller, via emaste Reported by: syzbot+514d40ce757a3f8b15bc@syzkaller.appspotmail.com Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D19615 Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Wed Mar 20 10:36:58 2019 (r345323) +++ head/sys/vm/vm_fault.c Wed Mar 20 13:07:57 2019 (r345324) @@ -1757,8 +1757,7 @@ again: } pmap_copy_page(src_m, dst_m); VM_OBJECT_RUNLOCK(object); - dst_m->valid = VM_PAGE_BITS_ALL; - dst_m->dirty = VM_PAGE_BITS_ALL; + dst_m->dirty = dst_m->valid = src_m->valid; } else { dst_m = src_m; if (vm_page_sleep_if_busy(dst_m, "fltupg")) @@ -1771,8 +1770,6 @@ again: */ break; vm_page_xbusy(dst_m); - KASSERT(dst_m->valid == VM_PAGE_BITS_ALL, - ("invalid dst page %p", dst_m)); } VM_OBJECT_WUNLOCK(dst_object); @@ -1780,9 +1777,18 @@ again: * Enter it in the pmap. If a wired, copy-on-write * mapping is being replaced by a write-enabled * mapping, then wire that new mapping. + * + * The page can be invalid if the user called + * msync(MS_INVALIDATE) or truncated the backing vnode + * or shared memory object. In this case, do not + * insert it into pmap, but still do the copy so that + * all copies of the wired map entry have similar + * backing pages. */ - pmap_enter(dst_map->pmap, vaddr, dst_m, prot, - access | (upgrade ? PMAP_ENTER_WIRED : 0), 0); + if (dst_m->valid == VM_PAGE_BITS_ALL) { + pmap_enter(dst_map->pmap, vaddr, dst_m, prot, + access | (upgrade ? PMAP_ENTER_WIRED : 0), 0); + } /* * Mark it no longer busy, and put it on the active list. From owner-svn-src-head@freebsd.org Wed Mar 20 16:24:48 2019 Return-Path: Delivered-To: svn-src-head@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 C3F501558654; Wed, 20 Mar 2019 16:24:48 +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 689B26E0DA; Wed, 20 Mar 2019 16:24:48 +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 38B41233EE; Wed, 20 Mar 2019 16:24:48 +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 x2KGOmML085338; Wed, 20 Mar 2019 16:24:48 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2KGOmnE085337; Wed, 20 Mar 2019 16:24:48 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201903201624.x2KGOmnE085337@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 20 Mar 2019 16:24:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345330 - head/stand/common X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/stand/common X-SVN-Commit-Revision: 345330 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 689B26E0DA 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.948,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 16:24:48 -0000 Author: emaste Date: Wed Mar 20 16:24:47 2019 New Revision: 345330 URL: https://svnweb.freebsd.org/changeset/base/345330 Log: loader: fix loading of kernels with . in path The loader indended to search the kernel file name (only) for . but instead searched the entire path, so paths like "boot/test.elfv2/kernel" would not work. Submitted by: alfredo.junior_eldorado.org.br Reviewed by: kevans MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D19658 Modified: head/stand/common/load_elf.c Modified: head/stand/common/load_elf.c ============================================================================== --- head/stand/common/load_elf.c Wed Mar 20 16:08:07 2019 (r345329) +++ head/stand/common/load_elf.c Wed Mar 20 16:24:47 2019 (r345330) @@ -868,14 +868,16 @@ fake_modname(const char *name) sp++; else sp = name; - ep = strrchr(name, '.'); - if (ep) { - if (ep == name) { - sp = invalid_name; - ep = invalid_name + sizeof(invalid_name) - 1; - } - } else - ep = name + strlen(name); + + ep = strrchr(sp, '.'); + if (ep == NULL) { + ep = sp + strlen(sp); + } + if (ep == sp) { + sp = invalid_name; + ep = invalid_name + sizeof(invalid_name) - 1; + } + len = ep - sp; fp = malloc(len + 1); if (fp == NULL) From owner-svn-src-head@freebsd.org Wed Mar 20 17:21:18 2019 Return-Path: Delivered-To: svn-src-head@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 63E1B15599EA; Wed, 20 Mar 2019 17:21:18 +0000 (UTC) (envelope-from mav@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 036706FE9B; Wed, 20 Mar 2019 17:21:18 +0000 (UTC) (envelope-from mav@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 D3D2C23CBD; Wed, 20 Mar 2019 17:21:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2KHLHQU013730; Wed, 20 Mar 2019 17:21:17 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2KHLHNK013728; Wed, 20 Mar 2019 17:21:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201903201721.x2KHLHNK013728@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 20 Mar 2019 17:21:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345332 - head/sys/dev/sound/pci/hda X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/sound/pci/hda X-SVN-Commit-Revision: 345332 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 036706FE9B 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.94)[-0.941,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 17:21:18 -0000 Author: mav Date: Wed Mar 20 17:21:17 2019 New Revision: 345332 URL: https://svnweb.freebsd.org/changeset/base/345332 Log: Tune chipset naming. Submitted by: Dmitry Luhtionov MFC after: 2 weeks Modified: head/sys/dev/sound/pci/hda/hdac.c head/sys/dev/sound/pci/hda/hdacc.c Modified: head/sys/dev/sound/pci/hda/hdac.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdac.c Wed Mar 20 17:11:25 2019 (r345331) +++ head/sys/dev/sound/pci/hda/hdac.c Wed Mar 20 17:21:17 2019 (r345332) @@ -97,11 +97,11 @@ static const struct { { HDA_INTEL_LPTLP1, "Intel Lynx Point-LP", 0, 0 }, { HDA_INTEL_LPTLP2, "Intel Lynx Point-LP", 0, 0 }, { HDA_INTEL_SRPTLP, "Intel Sunrise Point-LP", 0, 0 }, - { HDA_INTEL_KBLKLP, "Intel Kabylake-LP", 0, 0 }, + { HDA_INTEL_KBLKLP, "Intel Kaby Lake-LP", 0, 0 }, { HDA_INTEL_SRPT, "Intel Sunrise Point", 0, 0 }, - { HDA_INTEL_KBLK, "Intel Kabylake", 0, 0 }, - { HDA_INTEL_KBLKH, "Intel Kabylake-H", 0, 0 }, - { HDA_INTEL_CFLK, "Intel Coffelake", 0, 0 }, + { HDA_INTEL_KBLK, "Intel Kaby Lake", 0, 0 }, + { HDA_INTEL_KBLKH, "Intel Kaby Lake-H", 0, 0 }, + { HDA_INTEL_CFLK, "Intel Coffee Lake", 0, 0 }, { HDA_INTEL_82801F, "Intel 82801F", 0, 0 }, { HDA_INTEL_63XXESB, "Intel 631x/632xESB", 0, 0 }, { HDA_INTEL_82801G, "Intel 82801G", 0, 0 }, Modified: head/sys/dev/sound/pci/hda/hdacc.c ============================================================================== --- head/sys/dev/sound/pci/hda/hdacc.c Wed Mar 20 17:11:25 2019 (r345331) +++ head/sys/dev/sound/pci/hda/hdacc.c Wed Mar 20 17:21:17 2019 (r345332) @@ -368,7 +368,7 @@ static const struct { { HDA_CODEC_INTELHSW, 0, "Intel Haswell" }, { HDA_CODEC_INTELBDW, 0, "Intel Broadwell" }, { HDA_CODEC_INTELSKLK, 0, "Intel Skylake" }, - { HDA_CODEC_INTELKBLK, 0, "Intel Kabylake" }, + { HDA_CODEC_INTELKBLK, 0, "Intel Kaby Lake" }, { HDA_CODEC_INTELCL, 0, "Intel Crestline" }, { HDA_CODEC_SII1390, 0, "Silicon Image SiI1390" }, { HDA_CODEC_SII1392, 0, "Silicon Image SiI1392" }, From owner-svn-src-head@freebsd.org Wed Mar 20 17:27:02 2019 Return-Path: Delivered-To: svn-src-head@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 5FAE41559D4E; Wed, 20 Mar 2019 17:27:02 +0000 (UTC) (envelope-from mav@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 00EDE70449; Wed, 20 Mar 2019 17:27:02 +0000 (UTC) (envelope-from mav@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 2FFBB23E40; Wed, 20 Mar 2019 17:27:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2KHR1D2017409; Wed, 20 Mar 2019 17:27:01 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2KHR0oA017407; Wed, 20 Mar 2019 17:27:00 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201903201727.x2KHR0oA017407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 20 Mar 2019 17:27:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345333 - in head/sys/dev: ahci ichsmb X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in head/sys/dev: ahci ichsmb X-SVN-Commit-Revision: 345333 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 00EDE70449 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_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.941,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 17:27:02 -0000 Author: mav Date: Wed Mar 20 17:27:00 2019 New Revision: 345333 URL: https://svnweb.freebsd.org/changeset/base/345333 Log: Add some Cannon Lake chipset IDs. Submitted by: Dmitry Luhtionov MFC after: 2 weeks Modified: head/sys/dev/ahci/ahci_pci.c head/sys/dev/ichsmb/ichsmb_pci.c Modified: head/sys/dev/ahci/ahci_pci.c ============================================================================== --- head/sys/dev/ahci/ahci_pci.c Wed Mar 20 17:21:17 2019 (r345332) +++ head/sys/dev/ahci/ahci_pci.c Wed Mar 20 17:27:00 2019 (r345333) @@ -232,6 +232,8 @@ static const struct { {0xa2828086, 0x00, "Intel Union Point", 0}, {0xa2868086, 0x00, "Intel Union Point (RAID)", 0}, {0xa28e8086, 0x00, "Intel Union Point (RAID)", 0}, + {0xa3528086, 0x00, "Intel Cannon Lake", 0}, + {0xa3538086, 0x00, "Intel Cannon Lake", 0}, {0x23238086, 0x00, "Intel DH89xxCC", 0}, {0x2360197b, 0x00, "JMicron JMB360", 0}, {0x2361197b, 0x00, "JMicron JMB361", AHCI_Q_NOFORCE | AHCI_Q_1CH}, Modified: head/sys/dev/ichsmb/ichsmb_pci.c ============================================================================== --- head/sys/dev/ichsmb/ichsmb_pci.c Wed Mar 20 17:21:17 2019 (r345332) +++ head/sys/dev/ichsmb/ichsmb_pci.c Wed Mar 20 17:27:00 2019 (r345333) @@ -104,6 +104,7 @@ __FBSDID("$FreeBSD$"); #define ID_LEWISBURG 0xa1a3 #define ID_LEWISBURG2 0xa223 #define ID_KABYLAKE 0xa2a3 +#define ID_CANNONLAKE 0xa323 static const struct ichsmb_device { uint16_t id; @@ -148,6 +149,7 @@ static const struct ichsmb_device { { ID_LEWISBURG, "Intel Lewisburg SMBus controller" }, { ID_LEWISBURG2,"Intel Lewisburg SMBus controller" }, { ID_KABYLAKE, "Intel Kaby Lake SMBus controller" }, + { ID_CANNONLAKE,"Intel Cannon Lake SMBus controller" }, { 0, NULL }, }; From owner-svn-src-head@freebsd.org Wed Mar 20 17:27:14 2019 Return-Path: Delivered-To: svn-src-head@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 AD3AB1559D70; Wed, 20 Mar 2019 17:27:14 +0000 (UTC) (envelope-from np@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 606B970548; Wed, 20 Mar 2019 17:27:14 +0000 (UTC) (envelope-from np@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 BB64123E41; Wed, 20 Mar 2019 17:27:13 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2KHRDr3017468; Wed, 20 Mar 2019 17:27:13 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2KHRBNi017458; Wed, 20 Mar 2019 17:27:11 GMT (envelope-from np@FreeBSD.org) Message-Id: <201903201727.x2KHRBNi017458@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 20 Mar 2019 17:27:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345334 - in head/sys/dev/cxgbe: . common firmware tom X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head/sys/dev/cxgbe: . common firmware tom X-SVN-Commit-Revision: 345334 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 606B970548 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.947,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 17:27:14 -0000 Author: np Date: Wed Mar 20 17:27:11 2019 New Revision: 345334 URL: https://svnweb.freebsd.org/changeset/base/345334 Log: cxgbe(4): Treat the viid as an opaque identifier. Recent firmwares prefer to use a different format for viid internally and this change allows them to do so. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/firmware/t4fw_interface.h head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sched.c head/sys/dev/cxgbe/t4_sge.c head/sys/dev/cxgbe/tom/t4_cpl_io.c head/sys/dev/cxgbe/tom/t4_listen.c head/sys/dev/cxgbe/tom/t4_tom.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Wed Mar 20 17:27:00 2019 (r345333) +++ head/sys/dev/cxgbe/adapter.h Wed Mar 20 17:27:11 2019 (r345334) @@ -194,8 +194,10 @@ struct vi_info { int if_flags; uint16_t *rss, *nm_rss; - int smt_idx; /* for convenience */ - uint16_t viid; + uint16_t viid; /* opaque VI identifier */ + uint16_t smt_idx; + uint16_t vin; + uint8_t vfvld; int16_t xact_addr_filt;/* index of exact MAC address filter */ uint16_t rss_size; /* size of VI's RSS table slice */ uint16_t rss_base; /* start of VI's RSS table slice */ Modified: head/sys/dev/cxgbe/common/common.h ============================================================================== --- head/sys/dev/cxgbe/common/common.h Wed Mar 20 17:27:00 2019 (r345333) +++ head/sys/dev/cxgbe/common/common.h Wed Mar 20 17:27:11 2019 (r345334) @@ -375,8 +375,9 @@ struct adapter_params { uint32_t mps_bg_map; /* rx buffer group map for all ports (upto 4) */ - bool ulptx_memwrite_dsgl; /* use of T5 DSGL allowed */ - bool fr_nsmr_tpte_wr_support; /* FW support for FR_NSMR_TPTE_WR */ + bool ulptx_memwrite_dsgl; /* use of T5 DSGL allowed */ + bool fr_nsmr_tpte_wr_support; /* FW support for FR_NSMR_TPTE_WR */ + bool viid_smt_extn_support; /* FW returns vin, vfvld & smt index? */ }; #define CHELSIO_T4 0x4 @@ -756,10 +757,11 @@ int t4_cfg_pfvf(struct adapter *adap, unsigned int mbo int t4_alloc_vi_func(struct adapter *adap, unsigned int mbox, unsigned int port, unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac, u16 *rss_size, + uint8_t *vfvld, uint16_t *vin, unsigned int portfunc, unsigned int idstype); int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port, unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac, - u16 *rss_size); + u16 *rss_size, uint8_t *vfvld, uint16_t *vin); int t4_free_vi(struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int viid); @@ -770,7 +772,7 @@ int t4_alloc_mac_filt(struct adapter *adap, unsigned i bool free, unsigned int naddr, const u8 **addr, u16 *idx, u64 *hash, bool sleep_ok); int t4_change_mac(struct adapter *adap, unsigned int mbox, unsigned int viid, - int idx, const u8 *addr, bool persist, bool add_smt); + int idx, const u8 *addr, bool persist, uint16_t *smt_idx); int t4_set_addr_hash(struct adapter *adap, unsigned int mbox, unsigned int viid, bool ucast, u64 vec, bool sleep_ok); int t4_enable_vi_params(struct adapter *adap, unsigned int mbox, Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Wed Mar 20 17:27:00 2019 (r345333) +++ head/sys/dev/cxgbe/common/t4_hw.c Wed Mar 20 17:27:11 2019 (r345334) @@ -7794,6 +7794,7 @@ int t4_cfg_pfvf(struct adapter *adap, unsigned int mbo int t4_alloc_vi_func(struct adapter *adap, unsigned int mbox, unsigned int port, unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac, u16 *rss_size, + uint8_t *vfvld, uint16_t *vin, unsigned int portfunc, unsigned int idstype) { int ret; @@ -7814,6 +7815,7 @@ int t4_alloc_vi_func(struct adapter *adap, unsigned in ret = t4_wr_mbox(adap, mbox, &c, sizeof(c), &c); if (ret) return ret; + ret = G_FW_VI_CMD_VIID(be16_to_cpu(c.type_to_viid)); if (mac) { memcpy(mac, c.mac, sizeof(c.mac)); @@ -7830,7 +7832,18 @@ int t4_alloc_vi_func(struct adapter *adap, unsigned in } if (rss_size) *rss_size = G_FW_VI_CMD_RSSSIZE(be16_to_cpu(c.norss_rsssize)); - return G_FW_VI_CMD_VIID(be16_to_cpu(c.type_to_viid)); + if (vfvld) { + *vfvld = adap->params.viid_smt_extn_support ? + G_FW_VI_CMD_VFVLD(be32_to_cpu(c.alloc_to_len16)) : + G_FW_VIID_VIVLD(ret); + } + if (vin) { + *vin = adap->params.viid_smt_extn_support ? + G_FW_VI_CMD_VIN(be32_to_cpu(c.alloc_to_len16)) : + G_FW_VIID_VIN(ret); + } + + return ret; } /** @@ -7850,10 +7863,10 @@ int t4_alloc_vi_func(struct adapter *adap, unsigned in */ int t4_alloc_vi(struct adapter *adap, unsigned int mbox, unsigned int port, unsigned int pf, unsigned int vf, unsigned int nmac, u8 *mac, - u16 *rss_size) + u16 *rss_size, uint8_t *vfvld, uint16_t *vin) { return t4_alloc_vi_func(adap, mbox, port, pf, vf, nmac, mac, rss_size, - FW_VI_FUNC_ETH, 0); + vfvld, vin, FW_VI_FUNC_ETH, 0); } /** @@ -8030,7 +8043,7 @@ int t4_alloc_mac_filt(struct adapter *adap, unsigned i * @idx: index of existing filter for old value of MAC address, or -1 * @addr: the new MAC address value * @persist: whether a new MAC allocation should be persistent - * @add_smt: if true also add the address to the HW SMT + * @smt_idx: add MAC to SMT and return its index, or NULL * * Modifies an exact-match filter and sets it to the new MAC address if * @idx >= 0, or adds the MAC address to a new filter if @idx < 0. In the @@ -8045,7 +8058,7 @@ int t4_alloc_mac_filt(struct adapter *adap, unsigned i * MAC value. Note that this index may differ from @idx. */ int t4_change_mac(struct adapter *adap, unsigned int mbox, unsigned int viid, - int idx, const u8 *addr, bool persist, bool add_smt) + int idx, const u8 *addr, bool persist, uint16_t *smt_idx) { int ret, mode; struct fw_vi_mac_cmd c; @@ -8054,7 +8067,7 @@ int t4_change_mac(struct adapter *adap, unsigned int m if (idx < 0) /* new allocation */ idx = persist ? FW_VI_MAC_ADD_PERSIST_MAC : FW_VI_MAC_ADD_MAC; - mode = add_smt ? FW_VI_MAC_SMT_AND_MPSTCAM : FW_VI_MAC_MPS_TCAM_ENTRY; + mode = smt_idx ? FW_VI_MAC_SMT_AND_MPSTCAM : FW_VI_MAC_MPS_TCAM_ENTRY; memset(&c, 0, sizeof(c)); c.op_to_viid = cpu_to_be32(V_FW_CMD_OP(FW_VI_MAC_CMD) | @@ -8071,6 +8084,16 @@ int t4_change_mac(struct adapter *adap, unsigned int m ret = G_FW_VI_MAC_CMD_IDX(be16_to_cpu(p->valid_to_idx)); if (ret >= max_mac_addr) ret = -ENOMEM; + if (smt_idx) { + if (adap->params.viid_smt_extn_support) + *smt_idx = G_FW_VI_MAC_CMD_SMTID(be32_to_cpu(c.op_to_viid)); + else { + if (chip_id(adap) <= CHELSIO_T5) + *smt_idx = (viid & M_FW_VIID_VIN) << 1; + else + *smt_idx = viid & M_FW_VIID_VIN; + } + } } return ret; } @@ -9331,9 +9354,9 @@ int t4_port_init(struct adapter *adap, int mbox, int p { u8 addr[6]; int ret, i, j; - u16 rss_size; struct port_info *p = adap2pinfo(adap, port_id); u32 param, val; + struct vi_info *vi = &p->vi[0]; for (i = 0, j = -1; i <= p->port_id; i++) { do { @@ -9351,27 +9374,23 @@ int t4_port_init(struct adapter *adap, int mbox, int p t4_update_port_info(p); } - ret = t4_alloc_vi(adap, mbox, j, pf, vf, 1, addr, &rss_size); + ret = t4_alloc_vi(adap, mbox, j, pf, vf, 1, addr, &vi->rss_size, + &vi->vfvld, &vi->vin); if (ret < 0) return ret; - p->vi[0].viid = ret; - if (chip_id(adap) <= CHELSIO_T5) - p->vi[0].smt_idx = (ret & 0x7f) << 1; - else - p->vi[0].smt_idx = (ret & 0x7f); - p->vi[0].rss_size = rss_size; + vi->viid = ret; t4_os_set_hw_addr(p, addr); param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) | V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_RSSINFO) | - V_FW_PARAMS_PARAM_YZ(p->vi[0].viid); + V_FW_PARAMS_PARAM_YZ(vi->viid); ret = t4_query_params(adap, mbox, pf, vf, 1, ¶m, &val); if (ret) - p->vi[0].rss_base = 0xffff; + vi->rss_base = 0xffff; else { /* MPASS((val >> 16) == rss_size); */ - p->vi[0].rss_base = val & 0xffff; + vi->rss_base = val & 0xffff; } return 0; Modified: head/sys/dev/cxgbe/firmware/t4fw_interface.h ============================================================================== --- head/sys/dev/cxgbe/firmware/t4fw_interface.h Wed Mar 20 17:27:00 2019 (r345333) +++ head/sys/dev/cxgbe/firmware/t4fw_interface.h Wed Mar 20 17:27:11 2019 (r345334) @@ -4798,6 +4798,7 @@ enum fw_params_param_dev { FW_PARAMS_PARAM_DEV_RI_WRITE_CMPL_WR = 0x24, FW_PARAMS_PARAM_DEV_ADD_SMAC = 0x25, FW_PARAMS_PARAM_DEV_HPFILTER_REGION_SUPPORT = 0x26, + FW_PARAMS_PARAM_DEV_OPAQUE_VIID_SMT_EXTN = 0x27, }; /* @@ -6502,6 +6503,19 @@ struct fw_vi_cmd { (((x) >> S_FW_VI_CMD_FREE) & M_FW_VI_CMD_FREE) #define F_FW_VI_CMD_FREE V_FW_VI_CMD_FREE(1U) +#define S_FW_VI_CMD_VFVLD 24 +#define M_FW_VI_CMD_VFVLD 0x1 +#define V_FW_VI_CMD_VFVLD(x) ((x) << S_FW_VI_CMD_VFVLD) +#define G_FW_VI_CMD_VFVLD(x) \ + (((x) >> S_FW_VI_CMD_VFVLD) & M_FW_VI_CMD_VFVLD) +#define F_FW_VI_CMD_VFVLD V_FW_VI_CMD_VFVLD(1U) + +#define S_FW_VI_CMD_VIN 16 +#define M_FW_VI_CMD_VIN 0xff +#define V_FW_VI_CMD_VIN(x) ((x) << S_FW_VI_CMD_VIN) +#define G_FW_VI_CMD_VIN(x) \ + (((x) >> S_FW_VI_CMD_VIN) & M_FW_VI_CMD_VIN) + #define S_FW_VI_CMD_TYPE 15 #define M_FW_VI_CMD_TYPE 0x1 #define V_FW_VI_CMD_TYPE(x) ((x) << S_FW_VI_CMD_TYPE) @@ -6607,6 +6621,12 @@ struct fw_vi_mac_cmd { } exact_vni[2]; } u; }; + +#define S_FW_VI_MAC_CMD_SMTID 12 +#define M_FW_VI_MAC_CMD_SMTID 0xff +#define V_FW_VI_MAC_CMD_SMTID(x) ((x) << S_FW_VI_MAC_CMD_SMTID) +#define G_FW_VI_MAC_CMD_SMTID(x) \ + (((x) >> S_FW_VI_MAC_CMD_SMTID) & M_FW_VI_MAC_CMD_SMTID) #define S_FW_VI_MAC_CMD_VIID 0 #define M_FW_VI_MAC_CMD_VIID 0xfff Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Wed Mar 20 17:27:00 2019 (r345333) +++ head/sys/dev/cxgbe/t4_main.c Wed Mar 20 17:27:11 2019 (r345334) @@ -2486,17 +2486,13 @@ alloc_extra_vi(struct adapter *sc, struct port_info *p device_get_nameunit(vi->dev))); func = vi_mac_funcs[index]; rc = t4_alloc_vi_func(sc, sc->mbox, pi->tx_chan, sc->pf, 0, 1, - vi->hw_addr, &vi->rss_size, func, 0); + vi->hw_addr, &vi->rss_size, &vi->vfvld, &vi->vin, func, 0); if (rc < 0) { device_printf(vi->dev, "failed to allocate virtual interface %d" "for port %d: %d\n", index, pi->port_id, -rc); return (-rc); } vi->viid = rc; - if (chip_id(sc) <= CHELSIO_T5) - vi->smt_idx = (rc & 0x7f) << 1; - else - vi->smt_idx = (rc & 0x7f); if (vi->rss_size == 1) { /* @@ -4113,6 +4109,15 @@ set_params__pre_init(struct adapter *sc) } } + /* Enable opaque VIIDs with firmwares that support it. */ + param = FW_PARAM_DEV(OPAQUE_VIID_SMT_EXTN); + val = 1; + rc = -t4_set_params(sc, sc->mbox, sc->pf, 0, 1, ¶m, &val); + if (rc == 0 && val == 1) + sc->params.viid_smt_extn_support = true; + else + sc->params.viid_smt_extn_support = false; + return (rc); } @@ -4825,7 +4830,7 @@ update_mac_settings(struct ifnet *ifp, int flags) bcopy(IF_LLADDR(ifp), ucaddr, sizeof(ucaddr)); rc = t4_change_mac(sc, sc->mbox, vi->viid, vi->xact_addr_filt, - ucaddr, true, true); + ucaddr, true, &vi->smt_idx); if (rc < 0) { rc = -rc; if_printf(ifp, "change_mac failed: %d\n", rc); @@ -5746,7 +5751,7 @@ get_regs(struct adapter *sc, struct t4_regdump *regs, #define A_PL_INDIR_DATA 0x1fc static uint64_t -read_vf_stat(struct adapter *sc, unsigned int viid, int reg) +read_vf_stat(struct adapter *sc, u_int vin, int reg) { u32 stats[2]; @@ -5756,8 +5761,7 @@ read_vf_stat(struct adapter *sc, unsigned int viid, in stats[1] = t4_read_reg(sc, VF_MPS_REG(reg + 4)); } else { t4_write_reg(sc, A_PL_INDIR_CMD, V_PL_AUTOINC(1) | - V_PL_VFID(G_FW_VIID_VIN(viid)) | - V_PL_ADDR(VF_MPS_REG(reg))); + V_PL_VFID(vin) | V_PL_ADDR(VF_MPS_REG(reg))); stats[0] = t4_read_reg(sc, A_PL_INDIR_DATA); stats[1] = t4_read_reg(sc, A_PL_INDIR_DATA); } @@ -5765,12 +5769,11 @@ read_vf_stat(struct adapter *sc, unsigned int viid, in } static void -t4_get_vi_stats(struct adapter *sc, unsigned int viid, - struct fw_vi_stats_vf *stats) +t4_get_vi_stats(struct adapter *sc, u_int vin, struct fw_vi_stats_vf *stats) { #define GET_STAT(name) \ - read_vf_stat(sc, viid, A_MPS_VF_STAT_##name##_L) + read_vf_stat(sc, vin, A_MPS_VF_STAT_##name##_L) stats->tx_bcast_bytes = GET_STAT(TX_VF_BCAST_BYTES); stats->tx_bcast_frames = GET_STAT(TX_VF_BCAST_FRAMES); @@ -5793,12 +5796,11 @@ t4_get_vi_stats(struct adapter *sc, unsigned int viid, } static void -t4_clr_vi_stats(struct adapter *sc, unsigned int viid) +t4_clr_vi_stats(struct adapter *sc, u_int vin) { int reg; - t4_write_reg(sc, A_PL_INDIR_CMD, V_PL_AUTOINC(1) | - V_PL_VFID(G_FW_VIID_VIN(viid)) | + t4_write_reg(sc, A_PL_INDIR_CMD, V_PL_AUTOINC(1) | V_PL_VFID(vin) | V_PL_ADDR(VF_MPS_REG(A_MPS_VF_STAT_TX_VF_BCAST_BYTES_L))); for (reg = A_MPS_VF_STAT_TX_VF_BCAST_BYTES_L; reg <= A_MPS_VF_STAT_RX_VF_ERR_FRAMES_H; reg += 4) @@ -5820,7 +5822,7 @@ vi_refresh_stats(struct adapter *sc, struct vi_info *v return; mtx_lock(&sc->reg_lock); - t4_get_vi_stats(sc, vi->viid, &vi->stats); + t4_get_vi_stats(sc, vi->vin, &vi->stats); getmicrotime(&vi->last_refreshed); mtx_unlock(&sc->reg_lock); } @@ -10055,7 +10057,7 @@ t4_ioctl(struct cdev *dev, unsigned long cmd, caddr_t mtx_lock(&sc->reg_lock); for_each_vi(pi, v, vi) { if (vi->flags & VI_INIT_DONE) - t4_clr_vi_stats(sc, vi->viid); + t4_clr_vi_stats(sc, vi->vin); } bg_map = pi->mps_bg_map; v = 0; /* reuse */ Modified: head/sys/dev/cxgbe/t4_sched.c ============================================================================== --- head/sys/dev/cxgbe/t4_sched.c Wed Mar 20 17:27:00 2019 (r345333) +++ head/sys/dev/cxgbe/t4_sched.c Wed Mar 20 17:27:11 2019 (r345334) @@ -799,9 +799,8 @@ failed: cst->tx_total = cst->tx_credits; cst->plen = 0; cst->ctrl0 = htobe32(V_TXPKT_OPCODE(CPL_TX_PKT) | - V_TXPKT_INTF(pi->tx_chan) | V_TXPKT_PF(G_FW_VIID_PFN(vi->viid)) | - V_TXPKT_VF(G_FW_VIID_VIN(vi->viid)) | - V_TXPKT_VF_VLD(G_FW_VIID_VIVLD(vi->viid))); + V_TXPKT_INTF(pi->tx_chan) | V_TXPKT_PF(sc->pf) | + V_TXPKT_VF(vi->vin) | V_TXPKT_VF_VLD(vi->vfvld)); /* * Queues will be selected later when the connection flowid is available. Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Wed Mar 20 17:27:00 2019 (r345333) +++ head/sys/dev/cxgbe/t4_sge.c Wed Mar 20 17:27:11 2019 (r345334) @@ -3640,9 +3640,8 @@ alloc_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm nm_txq->nid = idx; nm_txq->iqidx = iqidx; nm_txq->cpl_ctrl0 = htobe32(V_TXPKT_OPCODE(CPL_TX_PKT) | - V_TXPKT_INTF(pi->tx_chan) | V_TXPKT_PF(G_FW_VIID_PFN(vi->viid)) | - V_TXPKT_VF(G_FW_VIID_VIN(vi->viid)) | - V_TXPKT_VF_VLD(G_FW_VIID_VIVLD(vi->viid))); + V_TXPKT_INTF(pi->tx_chan) | V_TXPKT_PF(sc->pf) | + V_TXPKT_VF(vi->vin) | V_TXPKT_VF_VLD(vi->vfvld)); nm_txq->cntxt_id = INVALID_NM_TXQ_CNTXT_ID; snprintf(name, sizeof(name), "%d", idx); @@ -4043,10 +4042,8 @@ alloc_txq(struct vi_info *vi, struct sge_txq *txq, int V_TXPKT_INTF(pi->tx_chan)); else txq->cpl_ctrl0 = htobe32(V_TXPKT_OPCODE(CPL_TX_PKT) | - V_TXPKT_INTF(pi->tx_chan) | - V_TXPKT_PF(G_FW_VIID_PFN(vi->viid)) | - V_TXPKT_VF(G_FW_VIID_VIN(vi->viid)) | - V_TXPKT_VF_VLD(G_FW_VIID_VIVLD(vi->viid))); + V_TXPKT_INTF(pi->tx_chan) | V_TXPKT_PF(sc->pf) | + V_TXPKT_VF(vi->vin) | V_TXPKT_VF_VLD(vi->vfvld)); txq->tc_idx = -1; txq->sdesc = malloc(eq->sidx * sizeof(struct tx_sdesc), M_CXGBE, M_ZERO | M_WAITOK); @@ -5657,7 +5654,7 @@ send_etid_flowc_wr(struct cxgbe_snd_tag *cst, struct p struct vi_info *vi) { struct wrq_cookie cookie; - u_int pfvf = G_FW_VIID_PFN(vi->viid) << S_FW_VIID_PFN; + u_int pfvf = pi->adapter->pf << S_FW_VIID_PFN; struct fw_flowc_wr *flowc; mtx_assert(&cst->lock, MA_OWNED); Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Wed Mar 20 17:27:00 2019 (r345333) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Wed Mar 20 17:27:11 2019 (r345334) @@ -107,7 +107,7 @@ send_flowc_wr(struct toepcb *toep, struct flowc_tx_par struct vi_info *vi = toep->vi; struct port_info *pi = vi->pi; struct adapter *sc = pi->adapter; - unsigned int pfvf = G_FW_VIID_PFN(vi->viid) << S_FW_VIID_PFN; + unsigned int pfvf = sc->pf << S_FW_VIID_PFN; struct ofld_tx_sdesc *txsd = &toep->txsd[toep->txsd_pidx]; KASSERT(!(toep->flags & TPF_FLOWC_WR_SENT), Modified: head/sys/dev/cxgbe/tom/t4_listen.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_listen.c Wed Mar 20 17:27:00 2019 (r345333) +++ head/sys/dev/cxgbe/tom/t4_listen.c Wed Mar 20 17:27:11 2019 (r345334) @@ -356,7 +356,7 @@ send_reset_synqe(struct toedev *tod, struct synq_entry struct sge_wrq *ofld_txq; struct sge_ofld_rxq *ofld_rxq; const int nparams = 6; - unsigned int pfvf = G_FW_VIID_PFN(vi->viid) << S_FW_VIID_PFN; + const u_int pfvf = sc->pf << S_FW_VIID_PFN; INP_WLOCK_ASSERT(synqe->lctx->inp); Modified: head/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.c Wed Mar 20 17:27:00 2019 (r345333) +++ head/sys/dev/cxgbe/tom/t4_tom.c Wed Mar 20 17:27:11 2019 (r345334) @@ -633,7 +633,6 @@ select_ntuple(struct vi_info *vi, struct l2t_entry *e) { struct adapter *sc = vi->pi->adapter; struct tp_params *tp = &sc->params.tp; - uint16_t viid = vi->viid; uint64_t ntuple = 0; /* @@ -650,12 +649,9 @@ select_ntuple(struct vi_info *vi, struct l2t_entry *e) ntuple |= (uint64_t)IPPROTO_TCP << tp->protocol_shift; if (tp->vnic_shift >= 0 && tp->ingress_config & F_VNIC) { - uint32_t vf = G_FW_VIID_VIN(viid); - uint32_t pf = G_FW_VIID_PFN(viid); - uint32_t vld = G_FW_VIID_VIVLD(viid); - - ntuple |= (uint64_t)(V_FT_VNID_ID_VF(vf) | V_FT_VNID_ID_PF(pf) | - V_FT_VNID_ID_VLD(vld)) << tp->vnic_shift; + ntuple |= (uint64_t)(V_FT_VNID_ID_VF(vi->vin) | + V_FT_VNID_ID_PF(sc->pf) | V_FT_VNID_ID_VLD(vi->vfvld)) << + tp->vnic_shift; } if (is_t4(sc)) From owner-svn-src-head@freebsd.org Wed Mar 20 19:18:28 2019 Return-Path: Delivered-To: svn-src-head@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 B04021532522; Wed, 20 Mar 2019 19:18:28 +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 4A51A7603D; Wed, 20 Mar 2019 19:18:28 +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 206982512A; Wed, 20 Mar 2019 19:18:28 +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 x2KJISwV080646; Wed, 20 Mar 2019 19:18:28 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2KJIRv0080641; Wed, 20 Mar 2019 19:18:27 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201903201918.x2KJIRv0080641@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 20 Mar 2019 19:18:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345345 - in head: contrib/llvm/tools/clang/lib/Basic lib/clang/include/clang/Basic lib/clang/include/lld/Common lib/clang/include/llvm/Support X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head: contrib/llvm/tools/clang/lib/Basic lib/clang/include/clang/Basic lib/clang/include/lld/Common lib/clang/include/llvm/Support X-SVN-Commit-Revision: 345345 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4A51A7603D 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.96)[-0.955,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 19:18:28 -0000 Author: dim Date: Wed Mar 20 19:18:26 2019 New Revision: 345345 URL: https://svnweb.freebsd.org/changeset/base/345345 Log: Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp 8.0.0 final release r356365. There were no functional changes since the most recent merge, of 8.0.0 rc5. Release notes for llvm, clang, lld and libc++ 8.0.0 are now available: https://llvm.org/releases/8.0.0/docs/ReleaseNotes.html https://llvm.org/releases/8.0.0/tools/clang/docs/ReleaseNotes.html https://llvm.org/releases/8.0.0/tools/lld/docs/ReleaseNotes.html https://llvm.org/releases/8.0.0/projects/libcxx/docs/ReleaseNotes.html PR: 236062 MFC after: 1 month X-MFC-With: r344779 Modified: head/contrib/llvm/tools/clang/lib/Basic/Version.cpp head/lib/clang/include/clang/Basic/Version.inc head/lib/clang/include/lld/Common/Version.inc head/lib/clang/include/llvm/Support/VCSRevision.h Directory Properties: head/contrib/compiler-rt/ (props changed) head/contrib/libc++/ (props changed) head/contrib/libunwind/ (props changed) head/contrib/llvm/ (props changed) head/contrib/llvm/tools/clang/ (props changed) head/contrib/llvm/tools/lld/ (props changed) head/contrib/llvm/tools/lldb/ (props changed) head/contrib/openmp/ (props changed) Modified: head/contrib/llvm/tools/clang/lib/Basic/Version.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Basic/Version.cpp Wed Mar 20 18:49:45 2019 (r345344) +++ head/contrib/llvm/tools/clang/lib/Basic/Version.cpp Wed Mar 20 19:18:26 2019 (r345345) @@ -36,7 +36,7 @@ std::string getClangRepositoryPath() { // If the SVN_REPOSITORY is empty, try to use the SVN keyword. This helps us // pick up a tag in an SVN export, for example. - StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/branches/release_80/lib/Basic/Version.cpp $"); + StringRef SVNRepository("$URL: https://llvm.org/svn/llvm-project/cfe/tags/RELEASE_800/final/lib/Basic/Version.cpp $"); if (URL.empty()) { URL = SVNRepository.slice(SVNRepository.find(':'), SVNRepository.find("/lib/Basic")); Modified: head/lib/clang/include/clang/Basic/Version.inc ============================================================================== --- head/lib/clang/include/clang/Basic/Version.inc Wed Mar 20 18:49:45 2019 (r345344) +++ head/lib/clang/include/clang/Basic/Version.inc Wed Mar 20 19:18:26 2019 (r345345) @@ -8,4 +8,4 @@ #define CLANG_VENDOR "FreeBSD " -#define SVN_REVISION "356034" +#define SVN_REVISION "356365" Modified: head/lib/clang/include/lld/Common/Version.inc ============================================================================== --- head/lib/clang/include/lld/Common/Version.inc Wed Mar 20 18:49:45 2019 (r345344) +++ head/lib/clang/include/lld/Common/Version.inc Wed Mar 20 19:18:26 2019 (r345345) @@ -7,4 +7,4 @@ #define LLD_REPOSITORY_STRING "FreeBSD" // - -#define LLD_REVISION_STRING "356034-1300002" +#define LLD_REVISION_STRING "356365-1300002" Modified: head/lib/clang/include/llvm/Support/VCSRevision.h ============================================================================== --- head/lib/clang/include/llvm/Support/VCSRevision.h Wed Mar 20 18:49:45 2019 (r345344) +++ head/lib/clang/include/llvm/Support/VCSRevision.h Wed Mar 20 19:18:26 2019 (r345345) @@ -1,2 +1,2 @@ /* $FreeBSD$ */ -#define LLVM_REVISION "svn-r356034" +#define LLVM_REVISION "svn-r356365" From owner-svn-src-head@freebsd.org Wed Mar 20 20:42:46 2019 Return-Path: Delivered-To: svn-src-head@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 C3C541535856; Wed, 20 Mar 2019 20:42:45 +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 5FCCC8100F; Wed, 20 Mar 2019 20:42:45 +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 36843260B4; Wed, 20 Mar 2019 20:42:45 +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 x2KKgjuP027418; Wed, 20 Mar 2019 20:42:45 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2KKgi4m027416; Wed, 20 Mar 2019 20:42:44 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201903202042.x2KKgi4m027416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 20 Mar 2019 20:42:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345348 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 345348 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5FCCC8100F 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.963,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 20:42:46 -0000 Author: markj Date: Wed Mar 20 20:42:44 2019 New Revision: 345348 URL: https://svnweb.freebsd.org/changeset/base/345348 Log: Use -fdebug-prefix-map to map auto-generated kernel build paths. The kernel build uses symlinks to make MD #includes like work. Debug info ends up referencing these symlinks in a relative path, so debuggers generally don't know how to find the corresponding headers. Address this by using -fdebug-prefix-map to map relative paths through the symlinks to their absolute paths in the source tree. This is consistent with how regular source file paths are defined in the kernel's debug info. Also map the current directory to an absolute path to the object directory. This gives debuggers a chance to find auto-generated files like vnode_if.c if the object directory is available. Reviewed by: emaste, jhb (previous version) MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D19633 Modified: head/sys/conf/kern.post.mk head/sys/conf/kmod.mk Modified: head/sys/conf/kern.post.mk ============================================================================== --- head/sys/conf/kern.post.mk Wed Mar 20 20:36:46 2019 (r345347) +++ head/sys/conf/kern.post.mk Wed Mar 20 20:42:44 2019 (r345348) @@ -328,6 +328,11 @@ ${__obj}: ${OBJS_DEPEND_GUESS.${__obj}} .depend: .PRECIOUS ${SRCS} +.if ${COMPILER_TYPE} == "clang" || \ + (${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 60000) +_MAP_DEBUG_PREFIX= yes +.endif + _ILINKS= machine .if ${MACHINE} != ${MACHINE_CPUARCH} && ${MACHINE} != "arm64" _ILINKS+= ${MACHINE_CPUARCH} @@ -337,11 +342,24 @@ _ILINKS+= x86 .endif # Ensure that the link exists without depending on it when it exists. +# Ensure that debug info references the path in the source tree. .for _link in ${_ILINKS} .if !exists(${.OBJDIR}/${_link}) ${SRCS} ${CLEAN:M*.o}: ${_link} .endif +.if defined(_MAP_DEBUG_PREFIX) +.if ${_link} == "machine" +CFLAGS+= -fdebug-prefix-map=./machine=${SYSDIR}/${MACHINE}/include +.else +CFLAGS+= -fdebug-prefix-map=./${_link}=${SYSDIR}/${_link}/include +.endif +.endif .endfor + +.if defined(_MAP_DEBUG_PREFIX) +# Ensure that DWARF info contains a full path for auto-generated headers. +CFLAGS+= -fdebug-prefix-map=.=${.OBJDIR} +.endif ${_ILINKS}: @case ${.TARGET} in \ Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Wed Mar 20 20:36:46 2019 (r345347) +++ head/sys/conf/kmod.mk Wed Mar 20 20:42:44 2019 (r345348) @@ -267,6 +267,11 @@ ${FULLPROG}: ${OBJS} ${OBJCOPY} --strip-debug ${.TARGET} .endif +.if ${COMPILER_TYPE} == "clang" || \ + (${COMPILER_TYPE} == "gcc" && ${COMPILER_VERSION} >= 60000) +_MAP_DEBUG_PREFIX= yes +.endif + _ILINKS=machine .if ${MACHINE} != ${MACHINE_CPUARCH} && ${MACHINE} != "arm64" _ILINKS+=${MACHINE_CPUARCH} @@ -283,11 +288,24 @@ beforebuild: ${_ILINKS} # Ensure that the links exist without depending on it when it exists which # causes all the modules to be rebuilt when the directory pointed to changes. +# Ensure that debug info references the path in the source tree. .for _link in ${_ILINKS} .if !exists(${.OBJDIR}/${_link}) OBJS_DEPEND_GUESS+= ${_link} .endif +.if defined(_MAP_DEBUG_PREFIX) +.if ${_link} == "machine" +CFLAGS+= -fdebug-prefix-map=./machine=${SYSDIR}/${MACHINE}/include +.else +CFLAGS+= -fdebug-prefix-map=./${_link}=${SYSDIR}/${_link}/include +.endif +.endif .endfor + +.if defined(_MAP_DEBUG_PREFIX) +# Ensure that DWARF info contains a full path for auto-generated headers. +CFLAGS+= -fdebug-prefix-map=.=${.OBJDIR} +.endif .NOPATH: ${_ILINKS} From owner-svn-src-head@freebsd.org Wed Mar 20 20:57:14 2019 Return-Path: Delivered-To: svn-src-head@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 3D0AA1535B4D; Wed, 20 Mar 2019 20:57:14 +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 BD8FE8152A; Wed, 20 Mar 2019 20:57:13 +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 914172626E; Wed, 20 Mar 2019 20:57:13 +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 x2KKvD68033018; Wed, 20 Mar 2019 20:57:13 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2KKvBN3033008; Wed, 20 Mar 2019 20:57:11 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201903202057.x2KKvBN3033008@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 20 Mar 2019 20:57:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345349 - in head: contrib/llvm/tools/lld/ELF contrib/llvm/tools/lld/docs lib/clang/include/lld/Common X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head: contrib/llvm/tools/lld/ELF contrib/llvm/tools/lld/docs lib/clang/include/lld/Common X-SVN-Commit-Revision: 345349 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BD8FE8152A 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_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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 20:57:14 -0000 Author: dim Date: Wed Mar 20 20:57:11 2019 New Revision: 345349 URL: https://svnweb.freebsd.org/changeset/base/345349 Log: Pull in r352826 from upstream lld trunk (by Fangrui Song): [ELF] Support --{,no-}allow-shlib-undefined Summary: In ld.bfd/gold, --no-allow-shlib-undefined is the default when linking an executable. This patch implements a check to error on undefined symbols in a shared object, if all of its DT_NEEDED entries are seen. Our approach resembles the one used in gold, achieves a good balance to be useful but not too smart (ld.bfd traces all DSOs and emulates the behavior of a dynamic linker to catch more cases). The error is issued based on the symbol table, different from undefined reference errors issued for relocations. It is most effective when there are DSOs that were not linked with -z defs (e.g. when static sanitizers runtime is used). gold has a comment that some system libraries on GNU/Linux may have spurious undefined references and thus system libraries should be excluded (https://sourceware.org/bugzilla/show_bug.cgi?id=6811). The story may have changed now but we make --allow-shlib-undefined the default for now. Its interaction with -shared can be discussed in the future. Reviewers: ruiu, grimar, pcc, espindola Reviewed By: ruiu Subscribers: joerg, emaste, arichardson, llvm-commits Differential Revision: https://reviews.llvm.org/D57385 Pull in r352943 from upstream lld trunk (by Fangrui Song): [ELF] Default to --no-allow-shlib-undefined for executables Summary: This follows the ld.bfd/gold behavior. The error check is useful as it captures a common type of ld.so undefined symbol errors as link-time errors: // a.cc => a.so (not linked with -z defs) void f(); // f is undefined void g() { f(); } // b.cc => executable with a DT_NEEDED entry on a.so void g(); int main() { g(); } // ld.so errors when g() is executed (lazy binding) or when the program is started (-z now) // symbol lookup error: ... undefined symbol: f Reviewers: ruiu, grimar, pcc, espindola Reviewed By: ruiu Subscribers: llvm-commits, emaste, arichardson Tags: #llvm Differential Revision: https://reviews.llvm.org/D57569 Together, these add support for --no-allow-shlib-undefined, and make it the default for executables, so they will fail to link if any symbols from needed shared libraries are undefined. Reported by: jbeich PR: 236062, 236141 MFC after: 1 month X-MFC-With: r344779 Modified: head/contrib/llvm/tools/lld/ELF/Config.h head/contrib/llvm/tools/lld/ELF/Driver.cpp head/contrib/llvm/tools/lld/ELF/InputFiles.cpp head/contrib/llvm/tools/lld/ELF/InputFiles.h head/contrib/llvm/tools/lld/ELF/Options.td head/contrib/llvm/tools/lld/ELF/SymbolTable.cpp head/contrib/llvm/tools/lld/ELF/SymbolTable.h head/contrib/llvm/tools/lld/ELF/Writer.cpp head/contrib/llvm/tools/lld/docs/ld.lld.1 head/lib/clang/include/lld/Common/Version.inc Modified: head/contrib/llvm/tools/lld/ELF/Config.h ============================================================================== --- head/contrib/llvm/tools/lld/ELF/Config.h Wed Mar 20 20:42:44 2019 (r345348) +++ head/contrib/llvm/tools/lld/ELF/Config.h Wed Mar 20 20:57:11 2019 (r345349) @@ -122,6 +122,7 @@ struct Configuration { uint64_t> CallGraphProfile; bool AllowMultipleDefinition; + bool AllowShlibUndefined; bool AndroidPackDynRelocs; bool ARMHasBlx = false; bool ARMHasMovtMovw = false; Modified: head/contrib/llvm/tools/lld/ELF/Driver.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/Driver.cpp Wed Mar 20 20:42:44 2019 (r345348) +++ head/contrib/llvm/tools/lld/ELF/Driver.cpp Wed Mar 20 20:57:11 2019 (r345349) @@ -758,6 +758,9 @@ void LinkerDriver::readConfigs(opt::InputArgList &Args Args.hasFlag(OPT_allow_multiple_definition, OPT_no_allow_multiple_definition, false) || hasZOption(Args, "muldefs"); + Config->AllowShlibUndefined = + Args.hasFlag(OPT_allow_shlib_undefined, OPT_no_allow_shlib_undefined, + Args.hasArg(OPT_shared)); Config->AuxiliaryList = args::getStrings(Args, OPT_auxiliary); Config->Bsymbolic = Args.hasArg(OPT_Bsymbolic); Config->BsymbolicFunctions = Args.hasArg(OPT_Bsymbolic_functions); Modified: head/contrib/llvm/tools/lld/ELF/InputFiles.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/InputFiles.cpp Wed Mar 20 20:42:44 2019 (r345348) +++ head/contrib/llvm/tools/lld/ELF/InputFiles.cpp Wed Mar 20 20:57:11 2019 (r345349) @@ -865,7 +865,7 @@ SharedFile::SharedFile(MemoryBufferRef M, String // Partially parse the shared object file so that we can call // getSoName on this object. -template void SharedFile::parseSoName() { +template void SharedFile::parseDynamic() { const Elf_Shdr *DynamicSec = nullptr; const ELFFile Obj = this->getObj(); ArrayRef Sections = CHECK(Obj.sections(), this); @@ -902,12 +902,16 @@ template void SharedFile::parseSoNa ArrayRef Arr = CHECK(Obj.template getSectionContentsAsArray(DynamicSec), this); for (const Elf_Dyn &Dyn : Arr) { - if (Dyn.d_tag == DT_SONAME) { + if (Dyn.d_tag == DT_NEEDED) { uint64_t Val = Dyn.getVal(); if (Val >= this->StringTable.size()) + fatal(toString(this) + ": invalid DT_NEEDED entry"); + DtNeeded.push_back(this->StringTable.data() + Val); + } else if (Dyn.d_tag == DT_SONAME) { + uint64_t Val = Dyn.getVal(); + if (Val >= this->StringTable.size()) fatal(toString(this) + ": invalid DT_SONAME entry"); SoName = this->StringTable.data() + Val; - return; } } } @@ -975,7 +979,7 @@ uint32_t SharedFile::getAlignment(ArrayRef UINT32_MAX) ? 0 : Ret; } -// Fully parse the shared object file. This must be called after parseSoName(). +// Fully parse the shared object file. This must be called after parseDynamic(). // // This function parses symbol versions. If a DSO has version information, // the file has a ".gnu.version_d" section which contains symbol version Modified: head/contrib/llvm/tools/lld/ELF/InputFiles.h ============================================================================== --- head/contrib/llvm/tools/lld/ELF/InputFiles.h Wed Mar 20 20:42:44 2019 (r345348) +++ head/contrib/llvm/tools/lld/ELF/InputFiles.h Wed Mar 20 20:57:11 2019 (r345349) @@ -323,6 +323,7 @@ template class SharedFile : public ELFFil public: std::vector Verdefs; + std::vector DtNeeded; std::string SoName; static bool classof(const InputFile *F) { @@ -331,7 +332,7 @@ template class SharedFile : public ELFFil SharedFile(MemoryBufferRef M, StringRef DefaultSoName); - void parseSoName(); + void parseDynamic(); void parseRest(); uint32_t getAlignment(ArrayRef Sections, const Elf_Sym &Sym); std::vector parseVerdefs(); @@ -348,6 +349,9 @@ template class SharedFile : public ELFFil // Mapping from Elf_Verdef data structures to information about Elf_Vernaux // data structures in the output file. std::map VerdefMap; + + // Used for --no-allow-shlib-undefined. + bool AllNeededIsKnown; // Used for --as-needed bool IsNeeded; Modified: head/contrib/llvm/tools/lld/ELF/Options.td ============================================================================== --- head/contrib/llvm/tools/lld/ELF/Options.td Wed Mar 20 20:42:44 2019 (r345348) +++ head/contrib/llvm/tools/lld/ELF/Options.td Wed Mar 20 20:57:11 2019 (r345349) @@ -63,6 +63,10 @@ defm allow_multiple_definition: B<"allow-multiple-defi "Allow multiple definitions", "Do not allow multiple definitions (default)">; +defm allow_shlib_undefined: B<"allow-shlib-undefined", + "Allow unresolved references in shared libraries (default when linking a shared library)", + "Do not allow unresolved references in shared libraries (default when linking an executable)">; + defm apply_dynamic_relocs: B<"apply-dynamic-relocs", "Apply link-time values for dynamic relocations", "Do not apply link-time values for dynamic relocations (default)">; @@ -492,12 +496,10 @@ def plugin_opt_thinlto: J<"plugin-opt=thinlto">; def plugin_opt_slash: J<"plugin-opt=/">; // Options listed below are silently ignored for now for compatibility. -def: F<"allow-shlib-undefined">; def: F<"detect-odr-violations">; def: Flag<["-"], "g">; def: F<"long-plt">; def: F<"no-add-needed">; -def: F<"no-allow-shlib-undefined">; def: F<"no-copy-dt-needed-entries">; def: F<"no-ctors-in-init-array">; def: F<"no-keep-memory">; Modified: head/contrib/llvm/tools/lld/ELF/SymbolTable.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/SymbolTable.cpp Wed Mar 20 20:42:44 2019 (r345348) +++ head/contrib/llvm/tools/lld/ELF/SymbolTable.cpp Wed Mar 20 20:57:11 2019 (r345349) @@ -93,7 +93,7 @@ template void SymbolTable::addFile(InputF // .so file if (auto *F = dyn_cast>(File)) { // DSOs are uniquified not by filename but by soname. - F->parseSoName(); + F->parseDynamic(); if (errorCount()) return; Modified: head/contrib/llvm/tools/lld/ELF/SymbolTable.h ============================================================================== --- head/contrib/llvm/tools/lld/ELF/SymbolTable.h Wed Mar 20 20:42:44 2019 (r345348) +++ head/contrib/llvm/tools/lld/ELF/SymbolTable.h Wed Mar 20 20:57:11 2019 (r345349) @@ -80,6 +80,9 @@ class SymbolTable { (public) void handleDynamicList(); + // Set of .so files to not link the same shared object file more than once. + llvm::DenseMap SoNames; + private: std::pair insertName(StringRef Name); @@ -106,9 +109,6 @@ class SymbolTable { (public) // same name, only one of them is linked, and the other is ignored. This set // is used to uniquify them. llvm::DenseSet ComdatGroups; - - // Set of .so files to not link the same shared object file more than once. - llvm::DenseMap SoNames; // A map from demangled symbol names to their symbol objects. // This mapping is 1:N because two symbols with different versions Modified: head/contrib/llvm/tools/lld/ELF/Writer.cpp ============================================================================== --- head/contrib/llvm/tools/lld/ELF/Writer.cpp Wed Mar 20 20:42:44 2019 (r345348) +++ head/contrib/llvm/tools/lld/ELF/Writer.cpp Wed Mar 20 20:57:11 2019 (r345349) @@ -1668,6 +1668,27 @@ template void Writer::finalizeSecti if (In.Iplt && !In.Iplt->empty()) In.Iplt->addSymbols(); + if (!Config->AllowShlibUndefined) { + // Error on undefined symbols in a shared object, if all of its DT_NEEDED + // entires are seen. These cases would otherwise lead to runtime errors + // reported by the dynamic linker. + // + // ld.bfd traces all DT_NEEDED to emulate the logic of the dynamic linker to + // catch more cases. That is too much for us. Our approach resembles the one + // used in ld.gold, achieves a good balance to be useful but not too smart. + for (InputFile *File : SharedFiles) { + SharedFile *F = cast>(File); + F->AllNeededIsKnown = llvm::all_of(F->DtNeeded, [&](StringRef Needed) { + return Symtab->SoNames.count(Needed); + }); + } + for (Symbol *Sym : Symtab->getSymbols()) + if (Sym->isUndefined() && !Sym->isWeak()) + if (auto *F = dyn_cast_or_null>(Sym->File)) + if (F->AllNeededIsKnown) + error(toString(F) + ": undefined reference to " + toString(*Sym)); + } + // Now that we have defined all possible global symbols including linker- // synthesized ones. Visit all symbols to give the finishing touches. for (Symbol *Sym : Symtab->getSymbols()) { Modified: head/contrib/llvm/tools/lld/docs/ld.lld.1 ============================================================================== --- head/contrib/llvm/tools/lld/docs/ld.lld.1 Wed Mar 20 20:42:44 2019 (r345348) +++ head/contrib/llvm/tools/lld/docs/ld.lld.1 Wed Mar 20 20:57:11 2019 (r345349) @@ -56,6 +56,9 @@ option. .It Fl -allow-multiple-definition Do not error if a symbol is defined multiple times. The first definition will be used. +.It Fl -allow-shlib-undefined +Allow unresolved references in shared libraries. +This option is enabled by default when linking a shared library. .It Fl -apply-dynamic-relocs Apply link-time values for dynamic relocations. .It Fl -as-needed @@ -252,6 +255,9 @@ Set target emulation. .It Fl -Map Ns = Ns Ar file , Fl M Ar file Print a link map to .Ar file . +.It Fl -no-allow-shlib-undefined +Do not allow unresolved references in shared libraries. +This option is enabled by default when linking an executable. .It Fl -no-as-needed Always set .Dv DT_NEEDED Modified: head/lib/clang/include/lld/Common/Version.inc ============================================================================== --- head/lib/clang/include/lld/Common/Version.inc Wed Mar 20 20:42:44 2019 (r345348) +++ head/lib/clang/include/lld/Common/Version.inc Wed Mar 20 20:57:11 2019 (r345349) @@ -7,4 +7,4 @@ #define LLD_REPOSITORY_STRING "FreeBSD" // - -#define LLD_REVISION_STRING "356365-1300002" +#define LLD_REVISION_STRING "356365-1300003" From owner-svn-src-head@freebsd.org Wed Mar 20 21:48:48 2019 Return-Path: Delivered-To: svn-src-head@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 4DB331538C26; Wed, 20 Mar 2019 21:48:48 +0000 (UTC) (envelope-from asomers@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 B249C82E81; Wed, 20 Mar 2019 21:48:47 +0000 (UTC) (envelope-from asomers@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 78FEE26B08; Wed, 20 Mar 2019 21:48:47 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2KLmlCu059300; Wed, 20 Mar 2019 21:48:47 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2KLmiJr059285; Wed, 20 Mar 2019 21:48:44 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201903202148.x2KLmiJr059285@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 20 Mar 2019 21:48:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345350 - in head: . lib/libjail sbin/mount_fusefs sys/conf sys/fs/fuse sys/modules sys/modules/fuse sys/modules/fusefs X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head: . lib/libjail sbin/mount_fusefs sys/conf sys/fs/fuse sys/modules sys/modules/fuse sys/modules/fusefs X-SVN-Commit-Revision: 345350 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B249C82E81 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.96)[-0.961,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 21:48:48 -0000 Author: asomers Date: Wed Mar 20 21:48:43 2019 New Revision: 345350 URL: https://svnweb.freebsd.org/changeset/base/345350 Log: Rename fuse(4) to fusefs(4) This makes it more consistent with other filesystems, which all end in "fs", and more consistent with its mount helper, which is already named "mount_fusefs". Reviewed by: cem, rgrimes MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D19649 Added: head/sys/modules/fusefs/ - copied from r345349, head/sys/modules/fuse/ Deleted: head/sys/modules/fuse/ Modified: head/UPDATING head/lib/libjail/jail.c head/sbin/mount_fusefs/mount_fusefs.c head/sys/conf/NOTES head/sys/conf/files head/sys/conf/options head/sys/fs/fuse/fuse.h head/sys/fs/fuse/fuse_file.c head/sys/fs/fuse/fuse_ipc.c head/sys/fs/fuse/fuse_main.c head/sys/fs/fuse/fuse_node.c head/sys/fs/fuse/fuse_vfsops.c head/sys/fs/fuse/fuse_vnops.c head/sys/modules/Makefile head/sys/modules/fusefs/Makefile Modified: head/UPDATING ============================================================================== --- head/UPDATING Wed Mar 20 20:57:11 2019 (r345349) +++ head/UPDATING Wed Mar 20 21:48:43 2019 (r345350) @@ -31,6 +31,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20190320: + The fuse(4) module has been renamed to fusefs(4) for consistency with + other filesystems. You should update any kld_load="fuse" entries in + /etc/rc.conf, fuse_load="YES" entries in /boot/loader.conf, and + "options FUSE" enties in kernel config files. + 20190304: Clang, llvm, lld, lldb, compiler-rt and libc++ have been upgraded to 8.0.0. Please see the 20141231 entry below for information about Modified: head/lib/libjail/jail.c ============================================================================== --- head/lib/libjail/jail.c Wed Mar 20 20:57:11 2019 (r345349) +++ head/lib/libjail/jail.c Wed Mar 20 21:48:43 2019 (r345350) @@ -1050,14 +1050,8 @@ kldload_param(const char *name) kl = kldload(name); else if (strncmp(name, "allow.mount.", 12) == 0) { /* Load the matching filesystem */ - const char *modname; + const char *modname = name + 12; - if (strcmp("fusefs", name + 12) == 0 || - strcmp("nofusefs", name + 12) == 0) { - modname = "fuse"; - } else { - modname = name + 12; - } kl = kldload(modname); if (kl < 0 && errno == ENOENT && strncmp(modname, "no", 2) == 0) Modified: head/sbin/mount_fusefs/mount_fusefs.c ============================================================================== --- head/sbin/mount_fusefs/mount_fusefs.c Wed Mar 20 20:57:11 2019 (r345349) +++ head/sbin/mount_fusefs/mount_fusefs.c Wed Mar 20 21:48:43 2019 (r345350) @@ -501,7 +501,7 @@ init_backgrounded(void) len = sizeof(ibg); - if (sysctlbyname("vfs.fuse.init_backgrounded", &ibg, &len, NULL, 0)) + if (sysctlbyname("vfs.fusefs.init_backgrounded", &ibg, &len, NULL, 0)) return (0); return (ibg); Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Wed Mar 20 20:57:11 2019 (r345349) +++ head/sys/conf/NOTES Wed Mar 20 21:48:43 2019 (r345350) @@ -1071,7 +1071,7 @@ options NFSCL #Network File System client options AUTOFS #Automounter filesystem options CD9660 #ISO 9660 filesystem options FDESCFS #File descriptor filesystem -options FUSE #FUSE support module +options FUSEFS #FUSEFS support module options MSDOSFS #MS DOS File System (FAT, FAT32) options NFSLOCKD #Network Lock Manager options NFSD #Network Filesystem Server Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Mar 20 20:57:11 2019 (r345349) +++ head/sys/conf/files Wed Mar 20 21:48:43 2019 (r345350) @@ -3494,15 +3494,15 @@ fs/fdescfs/fdesc_vfsops.c optional fdescfs fs/fdescfs/fdesc_vnops.c optional fdescfs fs/fifofs/fifo_vnops.c standard fs/cuse/cuse.c optional cuse -fs/fuse/fuse_device.c optional fuse -fs/fuse/fuse_file.c optional fuse -fs/fuse/fuse_internal.c optional fuse -fs/fuse/fuse_io.c optional fuse -fs/fuse/fuse_ipc.c optional fuse -fs/fuse/fuse_main.c optional fuse -fs/fuse/fuse_node.c optional fuse -fs/fuse/fuse_vfsops.c optional fuse -fs/fuse/fuse_vnops.c optional fuse +fs/fuse/fuse_device.c optional fusefs +fs/fuse/fuse_file.c optional fusefs +fs/fuse/fuse_internal.c optional fusefs +fs/fuse/fuse_io.c optional fusefs +fs/fuse/fuse_ipc.c optional fusefs +fs/fuse/fuse_main.c optional fusefs +fs/fuse/fuse_node.c optional fusefs +fs/fuse/fuse_vfsops.c optional fusefs +fs/fuse/fuse_vnops.c optional fusefs fs/msdosfs/msdosfs_conv.c optional msdosfs fs/msdosfs/msdosfs_denode.c optional msdosfs fs/msdosfs/msdosfs_fat.c optional msdosfs Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Wed Mar 20 20:57:11 2019 (r345349) +++ head/sys/conf/options Wed Mar 20 21:48:43 2019 (r345350) @@ -253,7 +253,7 @@ CD9660 opt_dontuse.h EXT2FS opt_dontuse.h FDESCFS opt_dontuse.h FFS opt_dontuse.h -FUSE opt_dontuse.h +FUSEFS opt_dontuse.h MSDOSFS opt_dontuse.h NANDFS opt_dontuse.h NULLFS opt_dontuse.h Modified: head/sys/fs/fuse/fuse.h ============================================================================== --- head/sys/fs/fuse/fuse.h Wed Mar 20 20:57:11 2019 (r345349) +++ head/sys/fs/fuse/fuse.h Wed Mar 20 21:48:43 2019 (r345350) @@ -143,7 +143,7 @@ /* misc */ -SYSCTL_DECL(_vfs_fuse); +SYSCTL_DECL(_vfs_fusefs); /* Fuse locking */ Modified: head/sys/fs/fuse/fuse_file.c ============================================================================== --- head/sys/fs/fuse/fuse_file.c Wed Mar 20 20:57:11 2019 (r345349) +++ head/sys/fs/fuse/fuse_file.c Wed Mar 20 21:48:43 2019 (r345350) @@ -87,7 +87,7 @@ __FBSDID("$FreeBSD$"); static int fuse_fh_count = 0; -SYSCTL_INT(_vfs_fuse, OID_AUTO, filehandle_count, CTLFLAG_RD, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, filehandle_count, CTLFLAG_RD, &fuse_fh_count, 0, "number of open FUSE filehandles"); int Modified: head/sys/fs/fuse/fuse_ipc.c ============================================================================== --- head/sys/fs/fuse/fuse_ipc.c Wed Mar 20 20:57:11 2019 (r345349) +++ head/sys/fs/fuse/fuse_ipc.c Wed Mar 20 21:48:43 2019 (r345350) @@ -99,21 +99,21 @@ static int fuse_body_audit(struct fuse_ticket *ftick, static fuse_handler_t fuse_standard_handler; -SYSCTL_NODE(_vfs, OID_AUTO, fuse, CTLFLAG_RW, 0, "FUSE tunables"); -SYSCTL_STRING(_vfs_fuse, OID_AUTO, version, CTLFLAG_RD, +SYSCTL_NODE(_vfs, OID_AUTO, fusefs, CTLFLAG_RW, 0, "FUSE tunables"); +SYSCTL_STRING(_vfs_fusefs, OID_AUTO, version, CTLFLAG_RD, FUSE_FREEBSD_VERSION, 0, "fuse-freebsd version"); static int fuse_ticket_count = 0; -SYSCTL_INT(_vfs_fuse, OID_AUTO, ticket_count, CTLFLAG_RW, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, ticket_count, CTLFLAG_RW, &fuse_ticket_count, 0, "number of allocated tickets"); static long fuse_iov_permanent_bufsize = 1 << 19; -SYSCTL_LONG(_vfs_fuse, OID_AUTO, iov_permanent_bufsize, CTLFLAG_RW, +SYSCTL_LONG(_vfs_fusefs, OID_AUTO, iov_permanent_bufsize, CTLFLAG_RW, &fuse_iov_permanent_bufsize, 0, "limit for permanently stored buffer size for fuse_iovs"); static int fuse_iov_credit = 16; -SYSCTL_INT(_vfs_fuse, OID_AUTO, iov_credit, CTLFLAG_RW, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, iov_credit, CTLFLAG_RW, &fuse_iov_credit, 0, "how many times is an oversized fuse_iov tolerated"); Modified: head/sys/fs/fuse/fuse_main.c ============================================================================== --- head/sys/fs/fuse/fuse_main.c Wed Mar 20 20:57:11 2019 (r345349) +++ head/sys/fs/fuse/fuse_main.c Wed Mar 20 21:48:43 2019 (r345350) @@ -94,9 +94,9 @@ static struct vfsconf fuse_vfsconf = { .vfc_flags = VFCF_JAIL | VFCF_SYNTHETIC }; -SYSCTL_INT(_vfs_fuse, OID_AUTO, kernelabi_major, CTLFLAG_RD, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, kernelabi_major, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, FUSE_KERNEL_VERSION, "FUSE kernel abi major version"); -SYSCTL_INT(_vfs_fuse, OID_AUTO, kernelabi_minor, CTLFLAG_RD, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, kernelabi_minor, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, FUSE_KERNEL_MINOR_VERSION, "FUSE kernel abi minor version"); /****************************** @@ -156,10 +156,10 @@ fuse_loader(struct module *m, int what, void *arg) /* Registering the module */ static moduledata_t fuse_moddata = { - "fuse", + "fusefs", fuse_loader, &fuse_vfsconf }; -DECLARE_MODULE(fuse, fuse_moddata, SI_SUB_VFS, SI_ORDER_MIDDLE); -MODULE_VERSION(fuse, 1); +DECLARE_MODULE(fusefs, fuse_moddata, SI_SUB_VFS, SI_ORDER_MIDDLE); +MODULE_VERSION(fusefs, 1); Modified: head/sys/fs/fuse/fuse_node.c ============================================================================== --- head/sys/fs/fuse/fuse_node.c Wed Mar 20 20:57:11 2019 (r345349) +++ head/sys/fs/fuse/fuse_node.c Wed Mar 20 21:48:43 2019 (r345350) @@ -98,47 +98,47 @@ static int sysctl_fuse_cache_mode(SYSCTL_HANDLER_ARGS) static int fuse_node_count = 0; -SYSCTL_INT(_vfs_fuse, OID_AUTO, node_count, CTLFLAG_RD, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, node_count, CTLFLAG_RD, &fuse_node_count, 0, "Count of FUSE vnodes"); int fuse_data_cache_mode = FUSE_CACHE_WT; -SYSCTL_PROC(_vfs_fuse, OID_AUTO, data_cache_mode, CTLTYPE_INT|CTLFLAG_RW, +SYSCTL_PROC(_vfs_fusefs, OID_AUTO, data_cache_mode, CTLTYPE_INT|CTLFLAG_RW, &fuse_data_cache_mode, 0, sysctl_fuse_cache_mode, "I", "Zero: disable caching of FUSE file data; One: write-through caching " "(default); Two: write-back caching (generally unsafe)"); int fuse_data_cache_invalidate = 0; -SYSCTL_INT(_vfs_fuse, OID_AUTO, data_cache_invalidate, CTLFLAG_RW, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, data_cache_invalidate, CTLFLAG_RW, &fuse_data_cache_invalidate, 0, "If non-zero, discard cached clean file data when there are no active file" " users"); int fuse_mmap_enable = 1; -SYSCTL_INT(_vfs_fuse, OID_AUTO, mmap_enable, CTLFLAG_RW, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, mmap_enable, CTLFLAG_RW, &fuse_mmap_enable, 0, "If non-zero, and data_cache_mode is also non-zero, enable mmap(2) of " "FUSE files"); int fuse_refresh_size = 0; -SYSCTL_INT(_vfs_fuse, OID_AUTO, refresh_size, CTLFLAG_RW, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, refresh_size, CTLFLAG_RW, &fuse_refresh_size, 0, "If non-zero, and no dirty file extension data is buffered, fetch file " "size before write operations"); int fuse_sync_resize = 1; -SYSCTL_INT(_vfs_fuse, OID_AUTO, sync_resize, CTLFLAG_RW, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, sync_resize, CTLFLAG_RW, &fuse_sync_resize, 0, "If a cached write extended a file, inform FUSE filesystem of the changed" "size immediately subsequent to the issued writes"); int fuse_fix_broken_io = 0; -SYSCTL_INT(_vfs_fuse, OID_AUTO, fix_broken_io, CTLFLAG_RW, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, fix_broken_io, CTLFLAG_RW, &fuse_fix_broken_io, 0, "If non-zero, print a diagnostic warning if a userspace filesystem returns" " EIO on reads of recently extended portions of files"); Modified: head/sys/fs/fuse/fuse_vfsops.c ============================================================================== --- head/sys/fs/fuse/fuse_vfsops.c Wed Mar 20 20:57:11 2019 (r345349) +++ head/sys/fs/fuse/fuse_vfsops.c Wed Mar 20 21:48:43 2019 (r345350) @@ -115,16 +115,16 @@ struct vfsops fuse_vfsops = { .vfs_statfs = fuse_vfsop_statfs, }; -SYSCTL_INT(_vfs_fuse, OID_AUTO, init_backgrounded, CTLFLAG_RD, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, init_backgrounded, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, 1, "indicate async handshake"); static int fuse_enforce_dev_perms = 0; -SYSCTL_INT(_vfs_fuse, OID_AUTO, enforce_dev_perms, CTLFLAG_RW, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, enforce_dev_perms, CTLFLAG_RW, &fuse_enforce_dev_perms, 0, "enforce fuse device permissions for secondary mounts"); static unsigned sync_unmount = 1; -SYSCTL_UINT(_vfs_fuse, OID_AUTO, sync_unmount, CTLFLAG_RW, +SYSCTL_UINT(_vfs_fusefs, OID_AUTO, sync_unmount, CTLFLAG_RW, &sync_unmount, 0, "specify when to use synchronous unmount"); MALLOC_DEFINE(M_FUSEVFS, "fuse_filesystem", "buffer for fuse vfs layer"); Modified: head/sys/fs/fuse/fuse_vnops.c ============================================================================== --- head/sys/fs/fuse/fuse_vnops.c Wed Mar 20 20:57:11 2019 (r345349) +++ head/sys/fs/fuse/fuse_vnops.c Wed Mar 20 21:48:43 2019 (r345350) @@ -179,17 +179,17 @@ struct vop_vector fuse_vnops = { static u_long fuse_lookup_cache_hits = 0; -SYSCTL_ULONG(_vfs_fuse, OID_AUTO, lookup_cache_hits, CTLFLAG_RD, +SYSCTL_ULONG(_vfs_fusefs, OID_AUTO, lookup_cache_hits, CTLFLAG_RD, &fuse_lookup_cache_hits, 0, "number of positive cache hits in lookup"); static u_long fuse_lookup_cache_misses = 0; -SYSCTL_ULONG(_vfs_fuse, OID_AUTO, lookup_cache_misses, CTLFLAG_RD, +SYSCTL_ULONG(_vfs_fusefs, OID_AUTO, lookup_cache_misses, CTLFLAG_RD, &fuse_lookup_cache_misses, 0, "number of cache misses in lookup"); int fuse_lookup_cache_enable = 1; -SYSCTL_INT(_vfs_fuse, OID_AUTO, lookup_cache_enable, CTLFLAG_RW, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, lookup_cache_enable, CTLFLAG_RW, &fuse_lookup_cache_enable, 0, "if non-zero, enable lookup cache"); /* @@ -198,7 +198,7 @@ SYSCTL_INT(_vfs_fuse, OID_AUTO, lookup_cache_enable, C */ static int fuse_reclaim_revoked = 0; -SYSCTL_INT(_vfs_fuse, OID_AUTO, reclaim_revoked, CTLFLAG_RW, +SYSCTL_INT(_vfs_fusefs, OID_AUTO, reclaim_revoked, CTLFLAG_RW, &fuse_reclaim_revoked, 0, ""); uma_zone_t fuse_pbuf_zone; Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Wed Mar 20 20:57:11 2019 (r345349) +++ head/sys/modules/Makefile Wed Mar 20 21:48:43 2019 (r345350) @@ -129,7 +129,7 @@ SUBDIR= \ filemon \ firewire \ firmware \ - fuse \ + fusefs \ ${_fxp} \ gem \ geom \ Modified: head/sys/modules/fusefs/Makefile ============================================================================== --- head/sys/modules/fuse/Makefile Wed Mar 20 20:57:11 2019 (r345349) +++ head/sys/modules/fusefs/Makefile Wed Mar 20 21:48:43 2019 (r345350) @@ -2,9 +2,12 @@ .PATH: ${SRCTOP}/sys/fs/fuse -KMOD= fuse +KMOD= fusefs SRCS= vnode_if.h \ fuse_node.c fuse_io.c fuse_device.c fuse_ipc.c fuse_file.c \ fuse_vfsops.c fuse_vnops.c fuse_internal.c fuse_main.c + +# Symlink for backwards compatibility with systems installed at 12.0 or older +LINKS= ${KMODDIR}/${KMOD}.ko ${KMODDIR}/fuse.ko .include From owner-svn-src-head@freebsd.org Wed Mar 20 22:01:20 2019 Return-Path: Delivered-To: svn-src-head@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 88FEF153A22E; Wed, 20 Mar 2019 22:01:20 +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 D0B6B835DF; Wed, 20 Mar 2019 22:01:19 +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 x2KM1FdW057609; Wed, 20 Mar 2019 15:01:15 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x2KM1Flm057608; Wed, 20 Mar 2019 15:01:15 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201903202201.x2KM1Flm057608@gndrsh.dnsmgr.net> Subject: Re: svn commit: r345350 - in head: . lib/libjail sbin/mount_fusefs sys/conf sys/fs/fuse sys/modules sys/modules/fuse sys/modules/fusefs In-Reply-To: <201903202148.x2KLmiJr059285@repo.freebsd.org> To: Alan Somers Date: Wed, 20 Mar 2019 15:01:15 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@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: D0B6B835DF 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.950,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 22:01:20 -0000 > Author: asomers > Date: Wed Mar 20 21:48:43 2019 > New Revision: 345350 > URL: https://svnweb.freebsd.org/changeset/base/345350 > > Log: > Rename fuse(4) to fusefs(4) > > This makes it more consistent with other filesystems, which all end in "fs", > and more consistent with its mount helper, which is already named > "mount_fusefs". > > Reviewed by: cem, rgrimes I did not review this code, I made a single comment that it should be discussed on an applicable mail list (arch@) which you did do, and I thank you for that. I would of eventually objected to the "do not rename the source", as that is one of the sighted reasons we use svn, is it is near costless to do moves, and this just trades one missmatch for another, which in my book is a near nop. Reviews are still not being allowed enough world rotates before committing. I am presently abroad, with poor net, and busy. > MFC after: 2 weeks > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D19649 > > Added: > head/sys/modules/fusefs/ > - copied from r345349, head/sys/modules/fuse/ > Deleted: > head/sys/modules/fuse/ > Modified: > head/UPDATING > head/lib/libjail/jail.c > head/sbin/mount_fusefs/mount_fusefs.c > head/sys/conf/NOTES > head/sys/conf/files > head/sys/conf/options > head/sys/fs/fuse/fuse.h > head/sys/fs/fuse/fuse_file.c > head/sys/fs/fuse/fuse_ipc.c > head/sys/fs/fuse/fuse_main.c > head/sys/fs/fuse/fuse_node.c > head/sys/fs/fuse/fuse_vfsops.c > head/sys/fs/fuse/fuse_vnops.c > head/sys/modules/Makefile > head/sys/modules/fusefs/Makefile > > Modified: head/UPDATING > ============================================================================== > --- head/UPDATING Wed Mar 20 20:57:11 2019 (r345349) > +++ head/UPDATING Wed Mar 20 21:48:43 2019 (r345350) > @@ -31,6 +31,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: > disable the most expensive debugging functionality run > "ln -s 'abort:false,junk:false' /etc/malloc.conf".) > > +20190320: > + The fuse(4) module has been renamed to fusefs(4) for consistency with > + other filesystems. You should update any kld_load="fuse" entries in > + /etc/rc.conf, fuse_load="YES" entries in /boot/loader.conf, and > + "options FUSE" enties in kernel config files. > + > 20190304: > Clang, llvm, lld, lldb, compiler-rt and libc++ have been upgraded to > 8.0.0. Please see the 20141231 entry below for information about > > Modified: head/lib/libjail/jail.c > ============================================================================== > --- head/lib/libjail/jail.c Wed Mar 20 20:57:11 2019 (r345349) > +++ head/lib/libjail/jail.c Wed Mar 20 21:48:43 2019 (r345350) > @@ -1050,14 +1050,8 @@ kldload_param(const char *name) > kl = kldload(name); > else if (strncmp(name, "allow.mount.", 12) == 0) { > /* Load the matching filesystem */ > - const char *modname; > + const char *modname = name + 12; > > - if (strcmp("fusefs", name + 12) == 0 || > - strcmp("nofusefs", name + 12) == 0) { > - modname = "fuse"; > - } else { > - modname = name + 12; > - } > kl = kldload(modname); > if (kl < 0 && errno == ENOENT && > strncmp(modname, "no", 2) == 0) > > Modified: head/sbin/mount_fusefs/mount_fusefs.c > ============================================================================== > --- head/sbin/mount_fusefs/mount_fusefs.c Wed Mar 20 20:57:11 2019 (r345349) > +++ head/sbin/mount_fusefs/mount_fusefs.c Wed Mar 20 21:48:43 2019 (r345350) > @@ -501,7 +501,7 @@ init_backgrounded(void) > > len = sizeof(ibg); > > - if (sysctlbyname("vfs.fuse.init_backgrounded", &ibg, &len, NULL, 0)) > + if (sysctlbyname("vfs.fusefs.init_backgrounded", &ibg, &len, NULL, 0)) > return (0); > > return (ibg); > > Modified: head/sys/conf/NOTES > ============================================================================== > --- head/sys/conf/NOTES Wed Mar 20 20:57:11 2019 (r345349) > +++ head/sys/conf/NOTES Wed Mar 20 21:48:43 2019 (r345350) > @@ -1071,7 +1071,7 @@ options NFSCL #Network File System client > options AUTOFS #Automounter filesystem > options CD9660 #ISO 9660 filesystem > options FDESCFS #File descriptor filesystem > -options FUSE #FUSE support module > +options FUSEFS #FUSEFS support module > options MSDOSFS #MS DOS File System (FAT, FAT32) > options NFSLOCKD #Network Lock Manager > options NFSD #Network Filesystem Server > > Modified: head/sys/conf/files > ============================================================================== > --- head/sys/conf/files Wed Mar 20 20:57:11 2019 (r345349) > +++ head/sys/conf/files Wed Mar 20 21:48:43 2019 (r345350) > @@ -3494,15 +3494,15 @@ fs/fdescfs/fdesc_vfsops.c optional fdescfs > fs/fdescfs/fdesc_vnops.c optional fdescfs > fs/fifofs/fifo_vnops.c standard > fs/cuse/cuse.c optional cuse > -fs/fuse/fuse_device.c optional fuse > -fs/fuse/fuse_file.c optional fuse > -fs/fuse/fuse_internal.c optional fuse > -fs/fuse/fuse_io.c optional fuse > -fs/fuse/fuse_ipc.c optional fuse > -fs/fuse/fuse_main.c optional fuse > -fs/fuse/fuse_node.c optional fuse > -fs/fuse/fuse_vfsops.c optional fuse > -fs/fuse/fuse_vnops.c optional fuse > +fs/fuse/fuse_device.c optional fusefs > +fs/fuse/fuse_file.c optional fusefs > +fs/fuse/fuse_internal.c optional fusefs > +fs/fuse/fuse_io.c optional fusefs > +fs/fuse/fuse_ipc.c optional fusefs > +fs/fuse/fuse_main.c optional fusefs > +fs/fuse/fuse_node.c optional fusefs > +fs/fuse/fuse_vfsops.c optional fusefs > +fs/fuse/fuse_vnops.c optional fusefs > fs/msdosfs/msdosfs_conv.c optional msdosfs > fs/msdosfs/msdosfs_denode.c optional msdosfs > fs/msdosfs/msdosfs_fat.c optional msdosfs > > Modified: head/sys/conf/options > ============================================================================== > --- head/sys/conf/options Wed Mar 20 20:57:11 2019 (r345349) > +++ head/sys/conf/options Wed Mar 20 21:48:43 2019 (r345350) > @@ -253,7 +253,7 @@ CD9660 opt_dontuse.h > EXT2FS opt_dontuse.h > FDESCFS opt_dontuse.h > FFS opt_dontuse.h > -FUSE opt_dontuse.h > +FUSEFS opt_dontuse.h > MSDOSFS opt_dontuse.h > NANDFS opt_dontuse.h > NULLFS opt_dontuse.h > > Modified: head/sys/fs/fuse/fuse.h > ============================================================================== > --- head/sys/fs/fuse/fuse.h Wed Mar 20 20:57:11 2019 (r345349) > +++ head/sys/fs/fuse/fuse.h Wed Mar 20 21:48:43 2019 (r345350) > @@ -143,7 +143,7 @@ > > /* misc */ > > -SYSCTL_DECL(_vfs_fuse); > +SYSCTL_DECL(_vfs_fusefs); > > /* Fuse locking */ > > > Modified: head/sys/fs/fuse/fuse_file.c > ============================================================================== > --- head/sys/fs/fuse/fuse_file.c Wed Mar 20 20:57:11 2019 (r345349) > +++ head/sys/fs/fuse/fuse_file.c Wed Mar 20 21:48:43 2019 (r345350) > @@ -87,7 +87,7 @@ __FBSDID("$FreeBSD$"); > > static int fuse_fh_count = 0; > > -SYSCTL_INT(_vfs_fuse, OID_AUTO, filehandle_count, CTLFLAG_RD, > +SYSCTL_INT(_vfs_fusefs, OID_AUTO, filehandle_count, CTLFLAG_RD, > &fuse_fh_count, 0, "number of open FUSE filehandles"); > > int > > Modified: head/sys/fs/fuse/fuse_ipc.c > ============================================================================== > --- head/sys/fs/fuse/fuse_ipc.c Wed Mar 20 20:57:11 2019 (r345349) > +++ head/sys/fs/fuse/fuse_ipc.c Wed Mar 20 21:48:43 2019 (r345350) > @@ -99,21 +99,21 @@ static int fuse_body_audit(struct fuse_ticket *ftick, > > static fuse_handler_t fuse_standard_handler; > > -SYSCTL_NODE(_vfs, OID_AUTO, fuse, CTLFLAG_RW, 0, "FUSE tunables"); > -SYSCTL_STRING(_vfs_fuse, OID_AUTO, version, CTLFLAG_RD, > +SYSCTL_NODE(_vfs, OID_AUTO, fusefs, CTLFLAG_RW, 0, "FUSE tunables"); > +SYSCTL_STRING(_vfs_fusefs, OID_AUTO, version, CTLFLAG_RD, > FUSE_FREEBSD_VERSION, 0, "fuse-freebsd version"); > static int fuse_ticket_count = 0; > > -SYSCTL_INT(_vfs_fuse, OID_AUTO, ticket_count, CTLFLAG_RW, > +SYSCTL_INT(_vfs_fusefs, OID_AUTO, ticket_count, CTLFLAG_RW, > &fuse_ticket_count, 0, "number of allocated tickets"); > static long fuse_iov_permanent_bufsize = 1 << 19; > > -SYSCTL_LONG(_vfs_fuse, OID_AUTO, iov_permanent_bufsize, CTLFLAG_RW, > +SYSCTL_LONG(_vfs_fusefs, OID_AUTO, iov_permanent_bufsize, CTLFLAG_RW, > &fuse_iov_permanent_bufsize, 0, > "limit for permanently stored buffer size for fuse_iovs"); > static int fuse_iov_credit = 16; > > -SYSCTL_INT(_vfs_fuse, OID_AUTO, iov_credit, CTLFLAG_RW, > +SYSCTL_INT(_vfs_fusefs, OID_AUTO, iov_credit, CTLFLAG_RW, > &fuse_iov_credit, 0, > "how many times is an oversized fuse_iov tolerated"); > > > Modified: head/sys/fs/fuse/fuse_main.c > ============================================================================== > --- head/sys/fs/fuse/fuse_main.c Wed Mar 20 20:57:11 2019 (r345349) > +++ head/sys/fs/fuse/fuse_main.c Wed Mar 20 21:48:43 2019 (r345350) > @@ -94,9 +94,9 @@ static struct vfsconf fuse_vfsconf = { > .vfc_flags = VFCF_JAIL | VFCF_SYNTHETIC > }; > > -SYSCTL_INT(_vfs_fuse, OID_AUTO, kernelabi_major, CTLFLAG_RD, > +SYSCTL_INT(_vfs_fusefs, OID_AUTO, kernelabi_major, CTLFLAG_RD, > SYSCTL_NULL_INT_PTR, FUSE_KERNEL_VERSION, "FUSE kernel abi major version"); > -SYSCTL_INT(_vfs_fuse, OID_AUTO, kernelabi_minor, CTLFLAG_RD, > +SYSCTL_INT(_vfs_fusefs, OID_AUTO, kernelabi_minor, CTLFLAG_RD, > SYSCTL_NULL_INT_PTR, FUSE_KERNEL_MINOR_VERSION, "FUSE kernel abi minor version"); > > /****************************** > @@ -156,10 +156,10 @@ fuse_loader(struct module *m, int what, void *arg) > /* Registering the module */ > > static moduledata_t fuse_moddata = { > - "fuse", > + "fusefs", > fuse_loader, > &fuse_vfsconf > }; > > -DECLARE_MODULE(fuse, fuse_moddata, SI_SUB_VFS, SI_ORDER_MIDDLE); > -MODULE_VERSION(fuse, 1); > +DECLARE_MODULE(fusefs, fuse_moddata, SI_SUB_VFS, SI_ORDER_MIDDLE); > +MODULE_VERSION(fusefs, 1); > > Modified: head/sys/fs/fuse/fuse_node.c > ============================================================================== > --- head/sys/fs/fuse/fuse_node.c Wed Mar 20 20:57:11 2019 (r345349) > +++ head/sys/fs/fuse/fuse_node.c Wed Mar 20 21:48:43 2019 (r345350) > @@ -98,47 +98,47 @@ static int sysctl_fuse_cache_mode(SYSCTL_HANDLER_ARGS) > > static int fuse_node_count = 0; > > -SYSCTL_INT(_vfs_fuse, OID_AUTO, node_count, CTLFLAG_RD, > +SYSCTL_INT(_vfs_fusefs, OID_AUTO, node_count, CTLFLAG_RD, > &fuse_node_count, 0, "Count of FUSE vnodes"); > > int fuse_data_cache_mode = FUSE_CACHE_WT; > > -SYSCTL_PROC(_vfs_fuse, OID_AUTO, data_cache_mode, CTLTYPE_INT|CTLFLAG_RW, > +SYSCTL_PROC(_vfs_fusefs, OID_AUTO, data_cache_mode, CTLTYPE_INT|CTLFLAG_RW, > &fuse_data_cache_mode, 0, sysctl_fuse_cache_mode, "I", > "Zero: disable caching of FUSE file data; One: write-through caching " > "(default); Two: write-back caching (generally unsafe)"); > > int fuse_data_cache_invalidate = 0; > > -SYSCTL_INT(_vfs_fuse, OID_AUTO, data_cache_invalidate, CTLFLAG_RW, > +SYSCTL_INT(_vfs_fusefs, OID_AUTO, data_cache_invalidate, CTLFLAG_RW, > &fuse_data_cache_invalidate, 0, > "If non-zero, discard cached clean file data when there are no active file" > " users"); > > int fuse_mmap_enable = 1; > > -SYSCTL_INT(_vfs_fuse, OID_AUTO, mmap_enable, CTLFLAG_RW, > +SYSCTL_INT(_vfs_fusefs, OID_AUTO, mmap_enable, CTLFLAG_RW, > &fuse_mmap_enable, 0, > "If non-zero, and data_cache_mode is also non-zero, enable mmap(2) of " > "FUSE files"); > > int fuse_refresh_size = 0; > > -SYSCTL_INT(_vfs_fuse, OID_AUTO, refresh_size, CTLFLAG_RW, > +SYSCTL_INT(_vfs_fusefs, OID_AUTO, refresh_size, CTLFLAG_RW, > &fuse_refresh_size, 0, > "If non-zero, and no dirty file extension data is buffered, fetch file " > "size before write operations"); > > int fuse_sync_resize = 1; > > -SYSCTL_INT(_vfs_fuse, OID_AUTO, sync_resize, CTLFLAG_RW, > +SYSCTL_INT(_vfs_fusefs, OID_AUTO, sync_resize, CTLFLAG_RW, > &fuse_sync_resize, 0, > "If a cached write extended a file, inform FUSE filesystem of the changed" > "size immediately subsequent to the issued writes"); > > int fuse_fix_broken_io = 0; > > -SYSCTL_INT(_vfs_fuse, OID_AUTO, fix_broken_io, CTLFLAG_RW, > +SYSCTL_INT(_vfs_fusefs, OID_AUTO, fix_broken_io, CTLFLAG_RW, > &fuse_fix_broken_io, 0, > "If non-zero, print a diagnostic warning if a userspace filesystem returns" > " EIO on reads of recently extended portions of files"); > > Modified: head/sys/fs/fuse/fuse_vfsops.c > ============================================================================== > --- head/sys/fs/fuse/fuse_vfsops.c Wed Mar 20 20:57:11 2019 (r345349) > +++ head/sys/fs/fuse/fuse_vfsops.c Wed Mar 20 21:48:43 2019 (r345350) > @@ -115,16 +115,16 @@ struct vfsops fuse_vfsops = { > .vfs_statfs = fuse_vfsop_statfs, > }; > > -SYSCTL_INT(_vfs_fuse, OID_AUTO, init_backgrounded, CTLFLAG_RD, > +SYSCTL_INT(_vfs_fusefs, OID_AUTO, init_backgrounded, CTLFLAG_RD, > SYSCTL_NULL_INT_PTR, 1, "indicate async handshake"); > static int fuse_enforce_dev_perms = 0; > > -SYSCTL_INT(_vfs_fuse, OID_AUTO, enforce_dev_perms, CTLFLAG_RW, > +SYSCTL_INT(_vfs_fusefs, OID_AUTO, enforce_dev_perms, CTLFLAG_RW, > &fuse_enforce_dev_perms, 0, > "enforce fuse device permissions for secondary mounts"); > static unsigned sync_unmount = 1; > > -SYSCTL_UINT(_vfs_fuse, OID_AUTO, sync_unmount, CTLFLAG_RW, > +SYSCTL_UINT(_vfs_fusefs, OID_AUTO, sync_unmount, CTLFLAG_RW, > &sync_unmount, 0, "specify when to use synchronous unmount"); > > MALLOC_DEFINE(M_FUSEVFS, "fuse_filesystem", "buffer for fuse vfs layer"); > > Modified: head/sys/fs/fuse/fuse_vnops.c > ============================================================================== > --- head/sys/fs/fuse/fuse_vnops.c Wed Mar 20 20:57:11 2019 (r345349) > +++ head/sys/fs/fuse/fuse_vnops.c Wed Mar 20 21:48:43 2019 (r345350) > @@ -179,17 +179,17 @@ struct vop_vector fuse_vnops = { > > static u_long fuse_lookup_cache_hits = 0; > > -SYSCTL_ULONG(_vfs_fuse, OID_AUTO, lookup_cache_hits, CTLFLAG_RD, > +SYSCTL_ULONG(_vfs_fusefs, OID_AUTO, lookup_cache_hits, CTLFLAG_RD, > &fuse_lookup_cache_hits, 0, "number of positive cache hits in lookup"); > > static u_long fuse_lookup_cache_misses = 0; > > -SYSCTL_ULONG(_vfs_fuse, OID_AUTO, lookup_cache_misses, CTLFLAG_RD, > +SYSCTL_ULONG(_vfs_fusefs, OID_AUTO, lookup_cache_misses, CTLFLAG_RD, > &fuse_lookup_cache_misses, 0, "number of cache misses in lookup"); > > int fuse_lookup_cache_enable = 1; > > -SYSCTL_INT(_vfs_fuse, OID_AUTO, lookup_cache_enable, CTLFLAG_RW, > +SYSCTL_INT(_vfs_fusefs, OID_AUTO, lookup_cache_enable, CTLFLAG_RW, > &fuse_lookup_cache_enable, 0, "if non-zero, enable lookup cache"); > > /* > @@ -198,7 +198,7 @@ SYSCTL_INT(_vfs_fuse, OID_AUTO, lookup_cache_enable, C > */ > static int fuse_reclaim_revoked = 0; > > -SYSCTL_INT(_vfs_fuse, OID_AUTO, reclaim_revoked, CTLFLAG_RW, > +SYSCTL_INT(_vfs_fusefs, OID_AUTO, reclaim_revoked, CTLFLAG_RW, > &fuse_reclaim_revoked, 0, ""); > > uma_zone_t fuse_pbuf_zone; > > Modified: head/sys/modules/Makefile > ============================================================================== > --- head/sys/modules/Makefile Wed Mar 20 20:57:11 2019 (r345349) > +++ head/sys/modules/Makefile Wed Mar 20 21:48:43 2019 (r345350) > @@ -129,7 +129,7 @@ SUBDIR= \ > filemon \ > firewire \ > firmware \ > - fuse \ > + fusefs \ > ${_fxp} \ > gem \ > geom \ > > Modified: head/sys/modules/fusefs/Makefile > ============================================================================== > --- head/sys/modules/fuse/Makefile Wed Mar 20 20:57:11 2019 (r345349) > +++ head/sys/modules/fusefs/Makefile Wed Mar 20 21:48:43 2019 (r345350) > @@ -2,9 +2,12 @@ > > .PATH: ${SRCTOP}/sys/fs/fuse > > -KMOD= fuse > +KMOD= fusefs > SRCS= vnode_if.h \ > fuse_node.c fuse_io.c fuse_device.c fuse_ipc.c fuse_file.c \ > fuse_vfsops.c fuse_vnops.c fuse_internal.c fuse_main.c > + > +# Symlink for backwards compatibility with systems installed at 12.0 or older > +LINKS= ${KMODDIR}/${KMOD}.ko ${KMODDIR}/fuse.ko > > .include > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Wed Mar 20 22:10:12 2019 Return-Path: Delivered-To: svn-src-head@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 BC6A0153A504; Wed, 20 Mar 2019 22:10:12 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3DDD2839C3; Wed, 20 Mar 2019 22:10:12 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lf1-f53.google.com with SMTP id y18so3137803lfe.1; Wed, 20 Mar 2019 15:10:12 -0700 (PDT) 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=oqEsjvja6F5KVOpYP+FAderVBjpA9DK/VNngrQUFtZk=; b=eHCqae3KFFMYs7sJ0M9g3DPAEb50/hTVAAe+H9i5NgnAIdx2RiOzvwcphoqOMNJRc0 eIeIVmn7QxdlOk1iTv1amnvLzb2T4j9C2to6MfZtn+mtvVsC1KAye/Tklck8fhpmg1c3 2yOvtvLETbTz3GKcwWxp1I4iyFkvXojkrJvuN9p3DY92oQ2g65VqE/6vpsIx4AZvR1hJ FqBadxD0BzqtsC0/azEjyXgLTI4NMzVxlEfwgbbyjEQYbdWiqdoeLC44a6D7LObRDxl1 NHb0mYjGCAXnyiolipuIVc785dpKMSFZP5Hc5NFzw7nebZKp881FDa+jy4sgY7nMfdEg X6Lg== X-Gm-Message-State: APjAAAU8/jEP45o7Rvdk3f1vvr0FBpw1IqStD6UGNIQ9a0gqFavPV16Q 4DUL8Hr1jDynNcZnWBdLduKznTtN+7BXfVCtSoymp2Xh X-Google-Smtp-Source: APXvYqyv9rEA/q7rDHM469eAR9S915aWtU6847Z3fQUbKv2oX2j4uE+oKOrxm1Ckd6aPrZm3al7ox/yDIK9O1zCFXn0= X-Received: by 2002:ac2:424c:: with SMTP id m12mr103654lfl.62.1553119810094; Wed, 20 Mar 2019 15:10:10 -0700 (PDT) MIME-Version: 1.0 References: <201903202148.x2KLmiJr059285@repo.freebsd.org> <201903202201.x2KM1Flm057608@gndrsh.dnsmgr.net> In-Reply-To: <201903202201.x2KM1Flm057608@gndrsh.dnsmgr.net> From: Alan Somers Date: Wed, 20 Mar 2019 16:09:58 -0600 Message-ID: Subject: Re: svn commit: r345350 - in head: . lib/libjail sbin/mount_fusefs sys/conf sys/fs/fuse sys/modules sys/modules/fuse sys/modules/fusefs To: rgrimes@freebsd.org Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 3DDD2839C3 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_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.93)[-0.926,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 22:10:12 -0000 On Wed, Mar 20, 2019 at 4:01 PM Rodney W. Grimes wrote: > > > Author: asomers > > Date: Wed Mar 20 21:48:43 2019 > > New Revision: 345350 > > URL: https://svnweb.freebsd.org/changeset/base/345350 > > > > Log: > > Rename fuse(4) to fusefs(4) > > > > This makes it more consistent with other filesystems, which all end in "fs", > > and more consistent with its mount helper, which is already named > > "mount_fusefs". > > > > Reviewed by: cem, rgrimes > > I did not review this code, I made a single comment that > it should be discussed on an applicable mail list (arch@) > which you did do, and I thank you for that. > > I would of eventually objected to the "do not rename the source", > as that is one of the sighted reasons we use svn, is it is near > costless to do moves, and this just trades one missmatch for > another, which in my book is a near nop. > > Reviews are still not being allowed enough world rotates > before committing. I am presently abroad, with poor net, > and busy. Sorry, I didn't realize you weren't done. But the other great thing about SVN is that we can do stuff, and then do more stuff. Would you like for me to rename the source files as well? I could do that. The one thing that I won't agree to do is to rename fuse_kernel.h => fusefs_kernel.h, because that file comes verbatim from upstream and we should keep the original name to make it easy to find(1). -Alan From owner-svn-src-head@freebsd.org Wed Mar 20 22:23:45 2019 Return-Path: Delivered-To: svn-src-head@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 91056153AB9A; Wed, 20 Mar 2019 22:23:45 +0000 (UTC) (envelope-from pfg@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 370A384385; Wed, 20 Mar 2019 22:23:45 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from [192.168.0.2] (unknown [181.52.72.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: pfg) by smtp.freebsd.org (Postfix) with ESMTPSA id 8F0C61173B; Wed, 20 Mar 2019 22:23:44 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Subject: Re: svn commit: r345350 - in head: . lib/libjail sbin/mount_fusefs sys/conf sys/fs/fuse sys/modules sys/modules/fuse sys/modules/fusefs To: Alan Somers , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201903202148.x2KLmiJr059285@repo.freebsd.org> From: Pedro Giffuni Organization: FreeBSD Message-ID: <605f0e65-3683-7a48-8ef2-fce3eda00449@FreeBSD.org> Date: Wed, 20 Mar 2019 17:23:43 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.3 MIME-Version: 1.0 In-Reply-To: <201903202148.x2KLmiJr059285@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Rspamd-Queue-Id: 370A384385 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_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.96)[-0.957,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 22:23:45 -0000 On 20/03/2019 16:48, Alan Somers wrote: > Author: asomers > Date: Wed Mar 20 21:48:43 2019 > New Revision: 345350 > URL: https://svnweb.freebsd.org/changeset/base/345350 > > Log: > Rename fuse(4) to fusefs(4) > > This makes it more consistent with other filesystems, which all end in "fs", > and more consistent with its mount helper, which is already named > "mount_fusefs". > > Reviewed by: cem, rgrimes > MFC after: 2 weeks > Sponsored by: The FreeBSD Foundation > Differential Revision: https://reviews.freebsd.org/D19649 > > Added: > head/sys/modules/fusefs/ > - copied from r345349, head/sys/modules/fuse/ > Deleted: > head/sys/modules/fuse/ > Modified: > head/UPDATING > head/lib/libjail/jail.c > head/sbin/mount_fusefs/mount_fusefs.c > head/sys/conf/NOTES > head/sys/conf/files > head/sys/conf/options > head/sys/fs/fuse/fuse.h > head/sys/fs/fuse/fuse_file.c > head/sys/fs/fuse/fuse_ipc.c > head/sys/fs/fuse/fuse_main.c > head/sys/fs/fuse/fuse_node.c > head/sys/fs/fuse/fuse_vfsops.c > head/sys/fs/fuse/fuse_vnops.c > head/sys/modules/Makefile > head/sys/modules/fusefs/Makefile Hmm.. Not that it matters but you renamed the module, shouldn't you rename the directory as well? We have sys/fs/{deadfs|devfs|ext2fs|fdescfs|fifofs|msdosfs| ... etcfs}. Cheers, Pedro. From owner-svn-src-head@freebsd.org Wed Mar 20 22:35:03 2019 Return-Path: Delivered-To: svn-src-head@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 BFEF6153AFFF; Wed, 20 Mar 2019 22:35:03 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4465284885; Wed, 20 Mar 2019 22:35:03 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-lj1-f195.google.com with SMTP id y6so3675892ljd.12; Wed, 20 Mar 2019 15:35:03 -0700 (PDT) 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=u114w1oJ2hqouOTQygtOljKjOXX0EcyZOE49Z3sD2GY=; b=sxvHq9AjNTPaj+xCV3ncjcX8TpKsUClC7kOCBNOhrGbys4ewRFDK/si9soc0ow99sp hxg7JVmmDckFUq2eEwmkdGCjN2Kpuc/JnJZU2wkQTiNF1R8Wopmemt1mA1iRSlEIU8dv u85PVy7hypC58gLm4DfvaCeS080W2WOIlkITEIdFkwDaAgYfgAijWIGaqmXbgJ/J1Xyd IP3sTvDYjav3F35Klqfh47YNnMzvBcybfbL0x4ccLlnghWlSuNVN0W0mnV2j4II3YovQ jDoNHizZljkCwpAvE3TTO5GPDJWRu8x+FOEBVHXCHFv4SajIdJ0oKnEjIESR6MsTSP77 fKpQ== X-Gm-Message-State: APjAAAWYIrrh+WrXTvraGtHaF4c28ZNVN8jom9sKbKK+IdWs14myS7Mf xPVitPKcgxrqFneLU1yYrEpD8qeTia3AlNymRAmES13I X-Google-Smtp-Source: APXvYqw0J2eCg1/Ejb2gM3PAog431+q5n4HF63ODMPnNc/BDnko3P3qu7Qvt0c+yQEtsP6oknKNjw9NsdduRYfrnVHQ= X-Received: by 2002:a2e:5c7:: with SMTP id 190mr233786ljf.108.1553120830463; Wed, 20 Mar 2019 15:27:10 -0700 (PDT) MIME-Version: 1.0 References: <201903202148.x2KLmiJr059285@repo.freebsd.org> <605f0e65-3683-7a48-8ef2-fce3eda00449@FreeBSD.org> In-Reply-To: <605f0e65-3683-7a48-8ef2-fce3eda00449@FreeBSD.org> From: Alan Somers Date: Wed, 20 Mar 2019 16:26:59 -0600 Message-ID: Subject: Re: svn commit: r345350 - in head: . lib/libjail sbin/mount_fusefs sys/conf sys/fs/fuse sys/modules sys/modules/fuse sys/modules/fusefs To: Pedro Giffuni Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4465284885 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]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 22:35:04 -0000 On Wed, Mar 20, 2019 at 4:23 PM Pedro Giffuni wrote: > > > On 20/03/2019 16:48, Alan Somers wrote: > > Author: asomers > > Date: Wed Mar 20 21:48:43 2019 > > New Revision: 345350 > > URL: https://svnweb.freebsd.org/changeset/base/345350 > > > > Log: > > Rename fuse(4) to fusefs(4) > > > > This makes it more consistent with other filesystems, which all end in "fs", > > and more consistent with its mount helper, which is already named > > "mount_fusefs". > > > > Reviewed by: cem, rgrimes > > MFC after: 2 weeks > > Sponsored by: The FreeBSD Foundation > > Differential Revision: https://reviews.freebsd.org/D19649 > > > > Added: > > head/sys/modules/fusefs/ > > - copied from r345349, head/sys/modules/fuse/ > > Deleted: > > head/sys/modules/fuse/ > > Modified: > > head/UPDATING > > head/lib/libjail/jail.c > > head/sbin/mount_fusefs/mount_fusefs.c > > head/sys/conf/NOTES > > head/sys/conf/files > > head/sys/conf/options > > head/sys/fs/fuse/fuse.h > > head/sys/fs/fuse/fuse_file.c > > head/sys/fs/fuse/fuse_ipc.c > > head/sys/fs/fuse/fuse_main.c > > head/sys/fs/fuse/fuse_node.c > > head/sys/fs/fuse/fuse_vfsops.c > > head/sys/fs/fuse/fuse_vnops.c > > head/sys/modules/Makefile > > head/sys/modules/fusefs/Makefile > > > Hmm.. > > Not that it matters but you renamed the module, shouldn't you rename the > directory as well? > > We have sys/fs/{deadfs|devfs|ext2fs|fdescfs|fifofs|msdosfs| ... etcfs}. > > Cheers, > > Pedro. Technically it's not a requirement for the build, and my other reviewer requested that I don't just to reduce repo churn. -Alan From owner-svn-src-head@freebsd.org Wed Mar 20 22:49:42 2019 Return-Path: Delivered-To: svn-src-head@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 AB8DF153C427; Wed, 20 Mar 2019 22:49:42 +0000 (UTC) (envelope-from bdrewery@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 47F6284E06; Wed, 20 Mar 2019 22:49:42 +0000 (UTC) (envelope-from bdrewery@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 1D1AA27564; Wed, 20 Mar 2019 22:49:42 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2KMnfAh090750; Wed, 20 Mar 2019 22:49:41 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2KMnfA5090749; Wed, 20 Mar 2019 22:49:41 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201903202249.x2KMnfA5090749@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Wed, 20 Mar 2019 22:49:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345351 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 345351 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 47F6284E06 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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 22:49:42 -0000 Author: bdrewery Date: Wed Mar 20 22:49:41 2019 New Revision: 345351 URL: https://svnweb.freebsd.org/changeset/base/345351 Log: Build common kernel dependencies before modules. This ensures files like genassym.o and awk/mfiles are generated before descending into the modules build. It may also allow some module builds to not recreate files that are already present in the KERNBUILDDIR. This fixes a rare build race where genassym.o is missing and assym.inc is empty. More work is planned around this to reduce some redundant dependency generation in modules. PR: 233339 MFC after: 2 weeks Reported by: markj Modified: head/sys/conf/kern.post.mk Modified: head/sys/conf/kern.post.mk ============================================================================== --- head/sys/conf/kern.post.mk Wed Mar 20 21:48:43 2019 (r345350) +++ head/sys/conf/kern.post.mk Wed Mar 20 22:49:41 2019 (r345351) @@ -140,6 +140,8 @@ kernel-obj: .if !defined(NO_MODULES) modules: modules-all +modules-depend: beforebuild +modules-all: beforebuild .if !defined(NO_MODULES_OBJ) modules-all modules-depend: modules-obj From owner-svn-src-head@freebsd.org Wed Mar 20 23:11:06 2019 Return-Path: Delivered-To: svn-src-head@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 42383153CE3C; Wed, 20 Mar 2019 23:11:06 +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 D8FD185D2B; Wed, 20 Mar 2019 23:11:05 +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 993C1279FC; Wed, 20 Mar 2019 23:11:05 +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 x2KNB5FS002143; Wed, 20 Mar 2019 23:11:05 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2KNB5wX002142; Wed, 20 Mar 2019 23:11:05 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201903202311.x2KNB5wX002142@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Wed, 20 Mar 2019 23:11:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345352 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 345352 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D8FD185D2B 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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 23:11:06 -0000 Author: mckusick Date: Wed Mar 20 23:11:05 2019 New Revision: 345352 URL: https://svnweb.freebsd.org/changeset/base/345352 Log: This is an additional and hopefully final fix for bug report 230962. This bug was introduced with the change to use softdep_bp_to_mp() in January 2018 changes -r327723 and -r327821. The softdep_bp_to_mp() function failed to include VSOCK as one of the valid cases. Although local-domain sockets do not allocate blocks in the filesystem, they will allocate blocks if they use extended attributes (such as ACLs). Thus, softdep_bp_to_mp() needs to return a non-NULL mount pointer when presented with a socket vnode so that the soft updates write complete will properly process the soft updates structures associated with the extended attribute blocks. It was the failure to process these soft updates structures, thus leaving them hanging off the buffer, which lead to the "panic: softdep_deallocate_dependencies: dangling deps" when trying to clean up the buffer after it was written. PR: 230962 Reported by: 2t8mr7kx9f@protonmail.com Reviewed by: kib Tested by: Peter Holm MFC after: 1 week Sponsored by: Netflix Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Wed Mar 20 22:49:41 2019 (r345351) +++ head/sys/ufs/ffs/ffs_softdep.c Wed Mar 20 23:11:05 2019 (r345352) @@ -13970,6 +13970,8 @@ softdep_bp_to_mp(bp) if (LIST_EMPTY(&bp->b_dep)) return (NULL); vp = bp->b_vp; + KASSERT(vp != NULL, + ("%s, buffer with dependencies lacks vnode", __func__)); /* * The ump mount point is stable after we get a correct @@ -13979,17 +13981,33 @@ softdep_bp_to_mp(bp) * workitem might be freed while dereferenced. */ retry: - if (vp->v_type == VCHR) { + switch (vp->v_type) { + case VCHR: VI_LOCK(vp); mp = vp->v_type == VCHR ? vp->v_rdev->si_mountpt : NULL; VI_UNLOCK(vp); if (mp == NULL) goto retry; - } else if (vp->v_type == VREG || vp->v_type == VDIR || - vp->v_type == VLNK || vp->v_type == VFIFO) { + break; + case VREG: + case VDIR: + case VLNK: + case VFIFO: + case VSOCK: mp = vp->v_mount; - } else { - return (NULL); + break; + case VBLK: + vn_printf(vp, "softdep_bp_to_mp: unexpected block device\n"); + /* FALLTHROUGH */ + case VNON: + case VBAD: + case VMARKER: + mp = NULL; + break; + default: + vn_printf(vp, "unknown vnode type"); + mp = NULL; + break; } return (VFSTOUFS(mp)); } From owner-svn-src-head@freebsd.org Wed Mar 20 23:16:02 2019 Return-Path: Delivered-To: svn-src-head@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 04840153E1EA; Wed, 20 Mar 2019 23:16:02 +0000 (UTC) (envelope-from asomers@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 A028E86099; Wed, 20 Mar 2019 23:16:01 +0000 (UTC) (envelope-from asomers@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 76DCB27A74; Wed, 20 Mar 2019 23:16:01 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2KNG1R9006447; Wed, 20 Mar 2019 23:16:01 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2KNFxbw006430; Wed, 20 Mar 2019 23:15:59 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201903202315.x2KNFxbw006430@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 20 Mar 2019 23:15:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345353 - in head: contrib/googletest/googletest contrib/googletest/googletest/include/gtest contrib/googletest/googletest/include/gtest/internal contrib/googletest/googletest/src contr... X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head: contrib/googletest/googletest contrib/googletest/googletest/include/gtest contrib/googletest/googletest/include/gtest/internal contrib/googletest/googletest/src contrib/googletest/googletest/... X-SVN-Commit-Revision: 345353 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A028E86099 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.978,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 23:16:02 -0000 Author: asomers Date: Wed Mar 20 23:15:58 2019 New Revision: 345353 URL: https://svnweb.freebsd.org/changeset/base/345353 Log: 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. Reviewed by: ngie Obtained from: github.com/google/googletest MFC after: 2 months Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/rS345331 Added: head/contrib/googletest/googletest/test/gtest_skip_test.cc - copied unchanged from r345331, projects/fuse2/contrib/googletest/googletest/test/gtest_skip_test.cc Modified: head/contrib/googletest/googletest/CMakeLists.txt head/contrib/googletest/googletest/include/gtest/gtest-test-part.h head/contrib/googletest/googletest/include/gtest/gtest.h head/contrib/googletest/googletest/include/gtest/internal/gtest-internal.h head/contrib/googletest/googletest/src/gtest-internal-inl.h head/contrib/googletest/googletest/src/gtest-test-part.cc head/contrib/googletest/googletest/src/gtest.cc head/contrib/googletest/googletest/test/googletest-test-part-test.cc head/contrib/googletest/googletest/test/gtest_all_test.cc head/lib/googletest/gtest_main/tests/Makefile Directory Properties: head/ (props changed) Modified: head/contrib/googletest/googletest/CMakeLists.txt ============================================================================== --- head/contrib/googletest/googletest/CMakeLists.txt Wed Mar 20 23:11:05 2019 (r345352) +++ head/contrib/googletest/googletest/CMakeLists.txt Wed Mar 20 23:15:58 2019 (r345353) @@ -217,6 +217,7 @@ 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_test gtest_main) ############################################################ # C++ tests built with non-standard compiler flags. Modified: head/contrib/googletest/googletest/include/gtest/gtest-test-part.h ============================================================================== --- head/contrib/googletest/googletest/include/gtest/gtest-test-part.h Wed Mar 20 23:11:05 2019 (r345352) +++ head/contrib/googletest/googletest/include/gtest/gtest-test-part.h Wed Mar 20 23:15:58 2019 (r345353) @@ -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: head/contrib/googletest/googletest/include/gtest/gtest.h ============================================================================== --- head/contrib/googletest/googletest/include/gtest/gtest.h Wed Mar 20 23:11:05 2019 (r345352) +++ head/contrib/googletest/googletest/include/gtest/gtest.h Wed Mar 20 23:15:58 2019 (r345353) @@ -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: head/contrib/googletest/googletest/include/gtest/internal/gtest-internal.h ============================================================================== --- head/contrib/googletest/googletest/include/gtest/internal/gtest-internal.h Wed Mar 20 23:11:05 2019 (r345352) +++ head/contrib/googletest/googletest/include/gtest/internal/gtest-internal.h Wed Mar 20 23:15:58 2019 (r345353) @@ -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: head/contrib/googletest/googletest/src/gtest-internal-inl.h ============================================================================== --- head/contrib/googletest/googletest/src/gtest-internal-inl.h Wed Mar 20 23:11:05 2019 (r345352) +++ head/contrib/googletest/googletest/src/gtest-internal-inl.h Wed Mar 20 23:15:58 2019 (r345353) @@ -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: head/contrib/googletest/googletest/src/gtest-test-part.cc ============================================================================== --- head/contrib/googletest/googletest/src/gtest-test-part.cc Wed Mar 20 23:11:05 2019 (r345352) +++ head/contrib/googletest/googletest/src/gtest-test-part.cc Wed Mar 20 23:15:58 2019 (r345353) @@ -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: head/contrib/googletest/googletest/src/gtest.cc ============================================================================== --- head/contrib/googletest/googletest/src/gtest.cc Wed Mar 20 23:11:05 2019 (r345352) +++ head/contrib/googletest/googletest/src/gtest.cc Wed Mar 20 23:15:58 2019 (r345353) @@ -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 Modified: head/contrib/googletest/googletest/test/googletest-test-part-test.cc ============================================================================== --- head/contrib/googletest/googletest/test/googletest-test-part-test.cc Wed Mar 20 23:11:05 2019 (r345352) +++ head/contrib/googletest/googletest/test/googletest-test-part-test.cc Wed Mar 20 23:15:58 2019 (r345353) @@ -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: head/contrib/googletest/googletest/test/gtest_all_test.cc ============================================================================== --- head/contrib/googletest/googletest/test/gtest_all_test.cc Wed Mar 20 23:11:05 2019 (r345352) +++ head/contrib/googletest/googletest/test/gtest_all_test.cc Wed Mar 20 23:15:58 2019 (r345353) @@ -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: head/contrib/googletest/googletest/test/gtest_skip_test.cc (from r345331, projects/fuse2/contrib/googletest/googletest/test/gtest_skip_test.cc) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/googletest/googletest/test/gtest_skip_test.cc Wed Mar 20 23:15:58 2019 (r345353, copy of r345331, projects/fuse2/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: head/lib/googletest/gtest_main/tests/Makefile ============================================================================== --- head/lib/googletest/gtest_main/tests/Makefile Wed Mar 20 23:11:05 2019 (r345352) +++ head/lib/googletest/gtest_main/tests/Makefile Wed Mar 20 23:15:58 2019 (r345353) @@ -18,6 +18,7 @@ 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_unittest CXXFLAGS+= -I${GOOGLETEST_SRCROOT}/include From owner-svn-src-head@freebsd.org Wed Mar 20 23:35:16 2019 Return-Path: Delivered-To: svn-src-head@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 572CD153EB09; Wed, 20 Mar 2019 23:35:16 +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 EFDC686C9A; Wed, 20 Mar 2019 23:35:15 +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 C788727DDD; Wed, 20 Mar 2019 23:35:15 +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 x2KNZFWx017075; Wed, 20 Mar 2019 23:35:15 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2KNZFvd017074; Wed, 20 Mar 2019 23:35:15 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201903202335.x2KNZFvd017074@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 20 Mar 2019 23:35:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345355 - head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall X-SVN-Commit-Revision: 345355 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EFDC686C9A 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.963,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Mar 2019 23:35:16 -0000 Author: markj Date: Wed Mar 20 23:35:15 2019 New Revision: 345355 URL: https://svnweb.freebsd.org/changeset/base/345355 Log: Ensure that we use a 64-bit value for the last mmap() argument. When using __syscall(2), the offset argument is passed on the stack on amd64. Previously only 32 bits were written, so the upper 32 bits were garbage and could cause the test to fail. MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c Modified: head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c Wed Mar 20 23:32:37 2019 (r345354) +++ head/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c Wed Mar 20 23:35:15 2019 (r345355) @@ -35,7 +35,8 @@ int main(int argc, char **argv) { for (;;) { - (void) __syscall(SYS_mmap, NULL, 1, 2, 3, -1, 0x12345678); + (void) __syscall(SYS_mmap, NULL, (size_t)1, 2, 3, -1, + (off_t)0x12345678); } return (0); From owner-svn-src-head@freebsd.org Thu Mar 21 03:13:15 2019 Return-Path: Delivered-To: svn-src-head@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 9995A154A67D; Thu, 21 Mar 2019 03:13:15 +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 E962B68EE9; Thu, 21 Mar 2019 03:13:14 +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 x2L3DB49058546; Wed, 20 Mar 2019 20:13:11 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x2L3DB25058545; Wed, 20 Mar 2019 20:13:11 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201903210313.x2L3DB25058545@gndrsh.dnsmgr.net> Subject: Re: svn commit: r345350 - in head: . lib/libjail sbin/mount_fusefs sys/conf sys/fs/fuse sys/modules sys/modules/fuse sys/modules/fusefs In-Reply-To: To: Alan Somers Date: Wed, 20 Mar 2019 20:13:11 -0700 (PDT) CC: rgrimes@freebsd.org, src-committers , svn-src-all , svn-src-head 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: E962B68EE9 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.926,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 03:13:15 -0000 > On Wed, Mar 20, 2019 at 4:01 PM Rodney W. Grimes > wrote: > > > > > Author: asomers > > > Date: Wed Mar 20 21:48:43 2019 > > > New Revision: 345350 > > > URL: https://svnweb.freebsd.org/changeset/base/345350 > > > > > > Log: > > > Rename fuse(4) to fusefs(4) > > > > > > This makes it more consistent with other filesystems, which all end in "fs", > > > and more consistent with its mount helper, which is already named > > > "mount_fusefs". > > > > > > Reviewed by: cem, rgrimes > > > > I did not review this code, I made a single comment that > > it should be discussed on an applicable mail list (arch@) > > which you did do, and I thank you for that. > > > > I would of eventually objected to the "do not rename the source", > > as that is one of the sighted reasons we use svn, is it is near > > costless to do moves, and this just trades one missmatch for > > another, which in my book is a near nop. > > > > Reviews are still not being allowed enough world rotates > > before committing. I am presently abroad, with poor net, > > and busy. > > Sorry, I didn't realize you weren't done. What is the current acceptable "wait" time when asking a public list for a review/response to some operation? > But the other great thing > about SVN is that we can do stuff, and then do more stuff. Would you > like for me to rename the source files as well? I could do that. I suspect now that the code is committed, and that others have responded, maybe a proper amount of discussion shall occur and this decision made by more than 3 people. > The > one thing that I won't agree to do is to rename fuse_kernel.h => > fusefs_kernel.h, because that file comes verbatim from upstream and we > should keep the original name to make it easy to find(1). If this code comes from upstream we should try to maintain the same file names, in as many cases as we can. Did the commit made increase or decrease that miss match? Is there only one file from upstream? Does it make any since to set this code up as a vendor branch? Expect >24 hours between my replies from here forward. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Thu Mar 21 03:49:25 2019 Return-Path: Delivered-To: svn-src-head@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 53BA6154BDD0; Thu, 21 Mar 2019 03:49:25 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-it1-x129.google.com (mail-it1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 64D876B255; Thu, 21 Mar 2019 03:49:24 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-it1-x129.google.com with SMTP id w18so2365006itj.4; Wed, 20 Mar 2019 20:49:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=1Q2/g8rRa23IkMhxtQVxShBNK+kqBJWRaSJKPCO2Uow=; b=revQkOoNKLNNffZvpOU9FuHpDve/FDKyTnhE3KReqXcnprZi7J1ykonduNaBkKFghs SuybIF8p+hsdYN2U1+GnIX7O6iB1PFaEtelUjpBUn/S+1OnH7mF6lnmtM1opfOkgLChA gw+7l8kjOgq2YEzPtti6v4764YgAmtkX+GqabGzxzgS2WEFULRVPpSxKkAYPhv5QVaIp evifxuuoyMmOvR/xeDBujlc/nKZqezYUSnKRM7oIRcahh7tIGp0l6GUB4X+GXKwdOILU Dzd2AxpFrLMOQld61rIjHVSCHQbtcqA+YBYr6yPKB0MdkpyDXxAGWaZdt7p+aYGA3al1 93qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=1Q2/g8rRa23IkMhxtQVxShBNK+kqBJWRaSJKPCO2Uow=; b=C9fXsVILm+ToK3oXeGaPVumfNPEsX+3z4punt4jgoj424Yn6CmQa0O7dXJRWfAMIsS gPCh5KFgoD/Cztoaz9ezbmttgTEijDeehbbfmSAyc5/aaiJf4bP5pmkuKKpk2FiValyf 5YBc8I1P6UWayShMgo1+tljyXQu4wRw2WqEi/BHEHMcF6Gex3AzSSLYrbkPkuG9ZQ8Wo 0WfwXS8344/dZ0m4WqEexbyW6/muWVYoHcKX/+8uFOm++WpDOfRUsUyLzIAdqO04Eik2 M6rK5IHUaovlb3UfJsczogNSUL3vODowuerY09X7ZeizWsSVGjnFs5Es9ZjVRbCDaf51 i1iA== X-Gm-Message-State: APjAAAXKOccOKUNqNZJShkAav+dS6tTy/DlmMx8aT+tLEm72uB8S1G09 LaGSfgfe5mt9ZxUsm8FrxwG6cn1E X-Google-Smtp-Source: APXvYqx8tB2I8FongbNelkE3o8j7CULiZdYBt4o+ctJe5yagdYkYEtYbAqmJznqPfRq1+sNVKtVcTw== X-Received: by 2002:a24:9a83:: with SMTP id l125mr1237945ite.59.1553140163302; Wed, 20 Mar 2019 20:49:23 -0700 (PDT) Received: from raichu (toroon0560w-lp140-01-69-159-36-102.dsl.bell.ca. [69.159.36.102]) by smtp.gmail.com with ESMTPSA id a16sm2098155itc.27.2019.03.20.20.49.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 20 Mar 2019 20:49:21 -0700 (PDT) Sender: Mark Johnston Date: Wed, 20 Mar 2019 23:49:17 -0400 From: Mark Johnston To: rgrimes@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r345359 - in head/sys/cddl/dev/dtrace: amd64 i386 Message-ID: <20190321034917.GA8186@raichu> References: <201903210252.x2L2qMSP022374@repo.freebsd.org> <201903210320.x2L3KIjc058579@gndrsh.dnsmgr.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201903210320.x2L3KIjc058579@gndrsh.dnsmgr.net> User-Agent: Mutt/1.11.3 (2019-02-01) X-Rspamd-Queue-Id: 64D876B255 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=revQkOoN; spf=pass (mx1.freebsd.org: domain of markjdb@gmail.com designates 2607:f8b0:4864:20::129 as permitted sender) smtp.mailfrom=markjdb@gmail.com X-Spamd-Result: default: False [-5.43 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; DMARC_NA(0.00)[freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[3]; RCVD_TLS_LAST(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; RCVD_IN_DNSWL_NONE(0.00)[9.2.1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.95)[-0.952,0]; IP_SCORE(-2.77)[ip: (-8.83), ipnet: 2607:f8b0::/32(-2.81), asn: 15169(-2.12), country: US(-0.07)]; FORGED_SENDER(0.30)[markj@freebsd.org,markjdb@gmail.com]; MIME_TRACE(0.00)[0:+]; MID_RHS_NOT_FQDN(0.50)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[markj@freebsd.org,markjdb@gmail.com] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 03:49:25 -0000 On Wed, Mar 20, 2019 at 08:20:18PM -0700, Rodney W. Grimes wrote: > > Author: markj > > Date: Thu Mar 21 02:52:22 2019 > > New Revision: 345359 > > URL: https://svnweb.freebsd.org/changeset/base/345359 > > > > Log: > > Don't attempt to measure TSC skew when running as a VM guest. > > > > It simply doesn't work in general since VCPUs may migrate between > > physical cores. The approach used to measure skew also doesn't > > make much sense in a VM. > > "May" is the important aspect here, and to my knowledge both > bhyve and Vmware provide a way to pin cpus there should be > a way for us to turn this back on if it is desired. Sticking > it under the big knob vm_guest is probably not the most flexiable > solution. > > Could we please have someway to force this back on? Even with pinning the skew computation is bogus in a VM. On an idle host running bhyve with pinned vCPUs it gives offsets that are several orders of magnitude larger than on the host. I would prefer to see a specific reason for wanting the old behaviour before adding a knob. From owner-svn-src-head@freebsd.org Thu Mar 21 03:17:36 2019 Return-Path: Delivered-To: svn-src-head@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 E8F1C154A920; Thu, 21 Mar 2019 03:17:35 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 5D1B369C27; Thu, 21 Mar 2019 03:17:35 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from [192.168.0.2] (unknown [181.52.72.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: pfg) by smtp.freebsd.org (Postfix) with ESMTPSA id 862EE136EA; Thu, 21 Mar 2019 03:17:34 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Subject: Re: svn commit: r345350 - in head: . lib/libjail sbin/mount_fusefs sys/conf sys/fs/fuse sys/modules sys/modules/fuse sys/modules/fusefs To: rgrimes@freebsd.org, Alan Somers Cc: src-committers , svn-src-all , svn-src-head References: <201903210313.x2L3DB25058545@gndrsh.dnsmgr.net> From: Pedro Giffuni Organization: FreeBSD Message-ID: <4813d987-5803-d466-442d-3b6098fcc586@FreeBSD.org> Date: Wed, 20 Mar 2019 22:17:34 -0500 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.3 MIME-Version: 1.0 In-Reply-To: <201903210313.x2L3DB25058545@gndrsh.dnsmgr.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Rspamd-Queue-Id: 5D1B369C27 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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 03:17:36 -0000 On 20/03/2019 22:13, Rodney W. Grimes wrote: >> On Wed, Mar 20, 2019 at 4:01 PM Rodney W. Grimes >> wrote: >>>> Author: asomers >>>> Date: Wed Mar 20 21:48:43 2019 >>>> New Revision: 345350 >>>> URL: https://svnweb.freebsd.org/changeset/base/345350 >>>> >>>> Log: >>>> Rename fuse(4) to fusefs(4) >>>> >>>> This makes it more consistent with other filesystems, which all end in "fs", >>>> and more consistent with its mount helper, which is already named >>>> "mount_fusefs". >>>> >>>> Reviewed by: cem, rgrimes >>> I did not review this code, I made a single comment that >>> it should be discussed on an applicable mail list (arch@) >>> which you did do, and I thank you for that. >>> >>> I would of eventually objected to the "do not rename the source", >>> as that is one of the sighted reasons we use svn, is it is near >>> costless to do moves, and this just trades one missmatch for >>> another, which in my book is a near nop. >>> >>> Reviews are still not being allowed enough world rotates >>> before committing. I am presently abroad, with poor net, >>> and busy. >> Sorry, I didn't realize you weren't done. > What is the current acceptable "wait" time when asking a public > list for a review/response to some operation? > >> But the other great thing >> about SVN is that we can do stuff, and then do more stuff. Would you >> like for me to rename the source files as well? I could do that. > I suspect now that the code is committed, and that others have > responded, maybe a proper amount of discussion shall occur and > this decision made by more than 3 people. > >> The >> one thing that I won't agree to do is to rename fuse_kernel.h => >> fusefs_kernel.h, because that file comes verbatim from upstream and we >> should keep the original name to make it easy to find(1). > If this code comes from upstream we should try to maintain the > same file names, in as many cases as we can. Did the commit > made increase or decrease that miss match? Is there only one > file from upstream? > > Does it make any since to set this code up as a vendor branch? > No: fuse_kernel.h is the only file with a real upstream. Pedro. From owner-svn-src-head@freebsd.org Thu Mar 21 02:52:23 2019 Return-Path: Delivered-To: svn-src-head@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 C0A5D1549695; Thu, 21 Mar 2019 02:52:23 +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 64AAB8F37B; Thu, 21 Mar 2019 02:52:23 +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 3DECC24C3; Thu, 21 Mar 2019 02:52:23 +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 x2L2qNFh022376; Thu, 21 Mar 2019 02:52:23 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2L2qMSP022374; Thu, 21 Mar 2019 02:52:22 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201903210252.x2L2qMSP022374@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 21 Mar 2019 02:52:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345359 - in head/sys/cddl/dev/dtrace: amd64 i386 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys/cddl/dev/dtrace: amd64 i386 X-SVN-Commit-Revision: 345359 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 64AAB8F37B 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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 02:52:23 -0000 Author: markj Date: Thu Mar 21 02:52:22 2019 New Revision: 345359 URL: https://svnweb.freebsd.org/changeset/base/345359 Log: Don't attempt to measure TSC skew when running as a VM guest. It simply doesn't work in general since VCPUs may migrate between physical cores. The approach used to measure skew also doesn't make much sense in a VM. PR: 218452 MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c head/sys/cddl/dev/dtrace/i386/dtrace_subr.c Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c ============================================================================== --- head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Thu Mar 21 01:16:37 2019 (r345358) +++ head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Thu Mar 21 02:52:22 2019 (r345359) @@ -319,6 +319,9 @@ dtrace_gethrtime_init(void *arg) int i; #endif + if (vm_guest) + return; + /* The current CPU is the reference one. */ sched_pin(); tsc_skew[curcpu] = 0; Modified: head/sys/cddl/dev/dtrace/i386/dtrace_subr.c ============================================================================== --- head/sys/cddl/dev/dtrace/i386/dtrace_subr.c Thu Mar 21 01:16:37 2019 (r345358) +++ head/sys/cddl/dev/dtrace/i386/dtrace_subr.c Thu Mar 21 02:52:22 2019 (r345359) @@ -321,6 +321,9 @@ dtrace_gethrtime_init(void *arg) int i; #endif + if (vm_guest) + return; + /* The current CPU is the reference one. */ sched_pin(); tsc_skew[curcpu] = 0; From owner-svn-src-head@freebsd.org Thu Mar 21 03:20:22 2019 Return-Path: Delivered-To: svn-src-head@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 29914154AAB4; Thu, 21 Mar 2019 03:20:22 +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 E7DB069E42; Thu, 21 Mar 2019 03:20:20 +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 x2L3KIDD058580; Wed, 20 Mar 2019 20:20:18 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x2L3KIjc058579; Wed, 20 Mar 2019 20:20:18 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201903210320.x2L3KIjc058579@gndrsh.dnsmgr.net> Subject: Re: svn commit: r345359 - in head/sys/cddl/dev/dtrace: amd64 i386 In-Reply-To: <201903210252.x2L2qMSP022374@repo.freebsd.org> To: Mark Johnston Date: Wed, 20 Mar 2019 20:20:18 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@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: E7DB069E42 X-Spamd-Bar: ++ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [2.28 / 15.00]; ARC_NA(0.00)[]; HAS_REPLYTO(0.00)[rgrimes@freebsd.org]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[dnsmgr.net]; AUTH_NA(1.00)[]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(0.02)[ip: (0.08), ipnet: 69.59.192.0/19(0.04), asn: 13868(0.02), country: US(-0.07)]; NEURAL_SPAM_SHORT(0.31)[0.313,0]; MX_GOOD(-0.01)[cached: gndrsh.dnsmgr.net]; NEURAL_SPAM_LONG(0.38)[0.377,0]; NEURAL_SPAM_MEDIUM(0.69)[0.686,0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:13868, ipnet:69.59.192.0/19, country:US]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 03:20:22 -0000 > Author: markj > Date: Thu Mar 21 02:52:22 2019 > New Revision: 345359 > URL: https://svnweb.freebsd.org/changeset/base/345359 > > Log: > Don't attempt to measure TSC skew when running as a VM guest. > > It simply doesn't work in general since VCPUs may migrate between > physical cores. The approach used to measure skew also doesn't > make much sense in a VM. "May" is the important aspect here, and to my knowledge both bhyve and Vmware provide a way to pin cpus there should be a way for us to turn this back on if it is desired. Sticking it under the big knob vm_guest is probably not the most flexiable solution. Could we please have someway to force this back on? > > PR: 218452 > MFC after: 2 weeks > Sponsored by: The FreeBSD Foundation > > Modified: > head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c > head/sys/cddl/dev/dtrace/i386/dtrace_subr.c > > Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c > ============================================================================== > --- head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Thu Mar 21 01:16:37 2019 (r345358) > +++ head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Thu Mar 21 02:52:22 2019 (r345359) > @@ -319,6 +319,9 @@ dtrace_gethrtime_init(void *arg) > int i; > #endif > > + if (vm_guest) > + return; > + > /* The current CPU is the reference one. */ > sched_pin(); > tsc_skew[curcpu] = 0; > > Modified: head/sys/cddl/dev/dtrace/i386/dtrace_subr.c > ============================================================================== > --- head/sys/cddl/dev/dtrace/i386/dtrace_subr.c Thu Mar 21 01:16:37 2019 (r345358) > +++ head/sys/cddl/dev/dtrace/i386/dtrace_subr.c Thu Mar 21 02:52:22 2019 (r345359) > @@ -321,6 +321,9 @@ dtrace_gethrtime_init(void *arg) > int i; > #endif > > + if (vm_guest) > + return; > + > /* The current CPU is the reference one. */ > sched_pin(); > tsc_skew[curcpu] = 0; > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Thu Mar 21 05:00:25 2019 Return-Path: Delivered-To: svn-src-head@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 254A3154FB67; Thu, 21 Mar 2019 05:00:25 +0000 (UTC) (envelope-from oshogbo@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 B3A106ED12; Thu, 21 Mar 2019 05:00:24 +0000 (UTC) (envelope-from oshogbo@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 8CF593C6B; Thu, 21 Mar 2019 05:00:24 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2L50OSO087177; Thu, 21 Mar 2019 05:00:24 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2L50OqB087176; Thu, 21 Mar 2019 05:00:24 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201903210500.x2L50OqB087176@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Thu, 21 Mar 2019 05:00:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345360 - head/contrib/elftoolchain/strings X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/contrib/elftoolchain/strings X-SVN-Commit-Revision: 345360 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B3A106ED12 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.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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 05:00:25 -0000 Author: oshogbo Date: Thu Mar 21 05:00:24 2019 New Revision: 345360 URL: https://svnweb.freebsd.org/changeset/base/345360 Log: strings: do not depend on stdin Instead of depending on one stdin FILE structure and use freopen(3), pass to the functions appropriate FILE structure. Reviewed by: cem Discussed with: emaste Differential Revision: https://reviews.freebsd.org/D18037 Modified: head/contrib/elftoolchain/strings/strings.c Modified: head/contrib/elftoolchain/strings/strings.c ============================================================================== --- head/contrib/elftoolchain/strings/strings.c Thu Mar 21 02:52:22 2019 (r345359) +++ head/contrib/elftoolchain/strings/strings.c Thu Mar 21 05:00:24 2019 (r345360) @@ -84,11 +84,11 @@ static struct option strings_longopts[] = { { NULL, 0, NULL, 0 } }; -long getcharacter(void); +long getcharacter(FILE *); int handle_file(const char *); -int handle_elf(const char *, int); -int handle_binary(const char *, int); -int find_strings(const char *, off_t, off_t); +int handle_elf(const char *, FILE *); +int handle_binary(const char *, FILE *, size_t); +int find_strings(const char *, FILE *, off_t, off_t); void show_version(void); void usage(void); @@ -190,7 +190,7 @@ main(int argc, char **argv) if (min_len == 0) min_len = 4; if (*argv == NULL) - rc = find_strings("{standard input}", 0, 0); + rc = find_strings("{standard input}", stdin, 0, 0); else while (*argv != NULL) { if (handle_file(*argv) != 0) rc = 1; @@ -202,19 +202,19 @@ main(int argc, char **argv) int handle_file(const char *name) { - int fd, rt; + FILE *pfile; + int rt; if (name == NULL) return (1); - if (freopen(name, "rb", stdin) == NULL) { + pfile = fopen(name, "rb"); + if (pfile == NULL) { warnx("'%s': %s", name, strerror(errno)); return (1); } - fd = fileno(stdin); - if (fd < 0) - return (1); - rt = handle_elf(name, fd); + rt = handle_elf(name, pfile); + fclose(pfile); return (rt); } @@ -223,15 +223,11 @@ handle_file(const char *name) * treated as a binary file. This would include text file, core dumps ... */ int -handle_binary(const char *name, int fd) +handle_binary(const char *name, FILE *pfile, size_t size) { - struct stat buf; - memset(&buf, 0, sizeof(buf)); - (void)lseek(fd, 0, SEEK_SET); - if (!fstat(fd, &buf)) - return (find_strings(name, 0, buf.st_size)); - return (1); + (void)fseeko(pfile, 0, SEEK_SET); + return (find_strings(name, pfile, 0, size)); } /* @@ -241,24 +237,29 @@ handle_binary(const char *name, int fd) * different archs as flat binary files(has to overridden using -a). */ int -handle_elf(const char *name, int fd) +handle_elf(const char *name, FILE *pfile) { + struct stat buf; GElf_Ehdr elfhdr; GElf_Shdr shdr; Elf *elf; Elf_Scn *scn; - int rc; + int rc, fd; rc = 0; + fd = fileno(pfile); + if (fstat(fd, &buf) < 0) + return (1); + /* If entire file is chosen, treat it as a binary file */ if (entire_file) - return (handle_binary(name, fd)); + return (handle_binary(name, pfile, buf.st_size)); (void)lseek(fd, 0, SEEK_SET); elf = elf_begin(fd, ELF_C_READ, NULL); if (elf_kind(elf) != ELF_K_ELF) { (void)elf_end(elf); - return (handle_binary(name, fd)); + return (handle_binary(name, pfile, buf.st_size)); } if (gelf_getehdr(elf, &elfhdr) == NULL) { @@ -269,7 +270,7 @@ handle_elf(const char *name, int fd) if (elfhdr.e_shnum == 0 && elfhdr.e_type == ET_CORE) { (void)elf_end(elf); - return (handle_binary(name, fd)); + return (handle_binary(name, pfile, buf.st_size)); } else { scn = NULL; while ((scn = elf_nextscn(elf, scn)) != NULL) { @@ -277,7 +278,7 @@ handle_elf(const char *name, int fd) continue; if (shdr.sh_type != SHT_NOBITS && (shdr.sh_flags & SHF_ALLOC) != 0) { - rc = find_strings(name, shdr.sh_offset, + rc = find_strings(name, pfile, shdr.sh_offset, shdr.sh_size); } } @@ -291,20 +292,20 @@ handle_elf(const char *name, int fd) * type requested. */ long -getcharacter(void) +getcharacter(FILE *pfile) { long rt; int i; char buf[4], c; - rt = EOF; for(i = 0; i < encoding_size; i++) { - c = getc(stdin); - if (feof(stdin)) + c = getc(pfile); + if (feof(pfile) != 0) return (EOF); buf[i] = c; } + rt = EOF; switch (encoding) { case ENCODING_7BIT: case ENCODING_8BIT: @@ -329,12 +330,12 @@ getcharacter(void) } /* - * Input stream stdin is read until the end of file is reached or until + * Input stream is read until the end of file is reached or until * the section size is reached in case of ELF files. Contiguous * characters of >= min_size(default 4) will be displayed. */ int -find_strings(const char *name, off_t offset, off_t size) +find_strings(const char *name, FILE *pfile, off_t offset, off_t size) { off_t cur_off, start_off; char *obuf; @@ -347,7 +348,7 @@ find_strings(const char *name, off_t offset, off_t siz return (1); } - (void)fseeko(stdin, offset, SEEK_SET); + (void)fseeko(pfile, offset, SEEK_SET); cur_off = offset; start_off = 0; for (;;) { @@ -356,8 +357,8 @@ find_strings(const char *name, off_t offset, off_t siz start_off = cur_off; memset(obuf, 0, min_len + 1); for(i = 0; i < min_len; i++) { - c = getcharacter(); - if (c == EOF && feof(stdin)) + c = getcharacter(pfile); + if (c == EOF && feof(pfile) != 0) goto _exit1; if (PRINTABLE(c)) { obuf[i] = c; @@ -399,7 +400,7 @@ find_strings(const char *name, off_t offset, off_t siz if ((offset + size) && (cur_off >= offset + size)) break; - c = getcharacter(); + c = getcharacter(pfile); cur_off += encoding_size; if (encoding == ENCODING_8BIT && (uint8_t)c > 127) { From owner-svn-src-head@freebsd.org Thu Mar 21 05:24:45 2019 Return-Path: Delivered-To: svn-src-head@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 201FA1551225; Thu, 21 Mar 2019 05:24:45 +0000 (UTC) (envelope-from oshogbo@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 B7C14700B3; Thu, 21 Mar 2019 05:24:44 +0000 (UTC) (envelope-from oshogbo@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 8FBC641F0; Thu, 21 Mar 2019 05:24:44 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2L5OiFG002886; Thu, 21 Mar 2019 05:24:44 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2L5OiKc002885; Thu, 21 Mar 2019 05:24:44 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201903210524.x2L5OiKc002885@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Thu, 21 Mar 2019 05:24:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345361 - head/contrib/elftoolchain/strings X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/contrib/elftoolchain/strings X-SVN-Commit-Revision: 345361 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B7C14700B3 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.962,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 05:24:45 -0000 Author: oshogbo Date: Thu Mar 21 05:24:44 2019 New Revision: 345361 URL: https://svnweb.freebsd.org/changeset/base/345361 Log: strings: do not continue if getc or getcharacter returns EOF Reported by: cem Modified: head/contrib/elftoolchain/strings/strings.c Modified: head/contrib/elftoolchain/strings/strings.c ============================================================================== --- head/contrib/elftoolchain/strings/strings.c Thu Mar 21 05:00:24 2019 (r345360) +++ head/contrib/elftoolchain/strings/strings.c Thu Mar 21 05:24:44 2019 (r345361) @@ -300,7 +300,7 @@ getcharacter(FILE *pfile) for(i = 0; i < encoding_size; i++) { c = getc(pfile); - if (feof(pfile) != 0) + if (c == EOF) return (EOF); buf[i] = c; } @@ -358,7 +358,7 @@ find_strings(const char *name, FILE *pfile, off_t offs memset(obuf, 0, min_len + 1); for(i = 0; i < min_len; i++) { c = getcharacter(pfile); - if (c == EOF && feof(pfile) != 0) + if (c == EOF) goto _exit1; if (PRINTABLE(c)) { obuf[i] = c; From owner-svn-src-head@freebsd.org Thu Mar 21 06:20:34 2019 Return-Path: Delivered-To: svn-src-head@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 724DA15526D0; Thu, 21 Mar 2019 06:20:34 +0000 (UTC) (envelope-from oshogbo@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 1936D71812; Thu, 21 Mar 2019 06:20:34 +0000 (UTC) (envelope-from oshogbo@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 E48574A8F; Thu, 21 Mar 2019 06:20:33 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2L6KXkh029383; Thu, 21 Mar 2019 06:20:33 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2L6KXRN029382; Thu, 21 Mar 2019 06:20:33 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201903210620.x2L6KXRN029382@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Thu, 21 Mar 2019 06:20:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345362 - head/contrib/elftoolchain/strings X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/contrib/elftoolchain/strings X-SVN-Commit-Revision: 345362 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1936D71812 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.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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 06:20:34 -0000 Author: oshogbo Date: Thu Mar 21 06:20:33 2019 New Revision: 345362 URL: https://svnweb.freebsd.org/changeset/base/345362 Log: Fix powerpc and arm builds after r345361. Reported by: jenkins Modified: head/contrib/elftoolchain/strings/strings.c Modified: head/contrib/elftoolchain/strings/strings.c ============================================================================== --- head/contrib/elftoolchain/strings/strings.c Thu Mar 21 05:24:44 2019 (r345361) +++ head/contrib/elftoolchain/strings/strings.c Thu Mar 21 06:20:33 2019 (r345362) @@ -295,8 +295,8 @@ long getcharacter(FILE *pfile) { long rt; - int i; - char buf[4], c; + int i, c; + char buf[4]; for(i = 0; i < encoding_size; i++) { c = getc(pfile); From owner-svn-src-head@freebsd.org Thu Mar 21 06:27:58 2019 Return-Path: Delivered-To: svn-src-head@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 E07F01552AA3; Thu, 21 Mar 2019 06:27:58 +0000 (UTC) (envelope-from imp@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 83A1371E09; Thu, 21 Mar 2019 06:27:58 +0000 (UTC) (envelope-from imp@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 7500E4C35; Thu, 21 Mar 2019 06:27:58 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2L6Rw9b034707; Thu, 21 Mar 2019 06:27:58 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2L6Rwwg034706; Thu, 21 Mar 2019 06:27:58 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201903210627.x2L6Rwwg034706@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 21 Mar 2019 06:27:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345363 - head/sbin/camcontrol X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sbin/camcontrol X-SVN-Commit-Revision: 345363 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 83A1371E09 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_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.962,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 06:27:59 -0000 Author: imp Date: Thu Mar 21 06:27:58 2019 New Revision: 345363 URL: https://svnweb.freebsd.org/changeset/base/345363 Log: Make WD and WDC aliases for HGST. HGST was bought by WDC. Over the years, it has sold different drives branded as HGST, WD or WDC. All of them need the HGST workaround of sending 4k-sized packets (or multiples of 4k). And the ones that don't really need this aren't broken by this change. Submitter is the vendor who has tested these changes on a number of drives. I've simplified it slightly, since we don't need additional vendors for this at this time. Submitted by: JacobBurley via github on behalf of WDC Pull Request: https://github.com/freebsd/freebsd/pull/391 Modified: head/sbin/camcontrol/fwdownload.c Modified: head/sbin/camcontrol/fwdownload.c ============================================================================== --- head/sbin/camcontrol/fwdownload.c Thu Mar 21 06:20:33 2019 (r345362) +++ head/sbin/camcontrol/fwdownload.c Thu Mar 21 06:27:58 2019 (r345363) @@ -212,6 +212,10 @@ static struct fw_vendor vendors_list[] = { 0x8000, 0x07, 0x07, 0, 1, FW_TUR_READY, WB_TIMEOUT, FW_TIMEOUT_DEFAULT}, {VENDOR_SMART, "SmrtStor", T_DIRECT, 0x8000, 0x07, 0x07, 0, 1, FW_TUR_READY, WB_TIMEOUT, FW_TIMEOUT_DEFAULT}, + {VENDOR_HGST, "WD", T_DIRECT, + 0x1000, 0x07, 0x07, 1, 0, FW_TUR_READY, WB_TIMEOUT, FW_TIMEOUT_DEFAULT}, + {VENDOR_HGST, "WDC", T_DIRECT, + 0x1000, 0x07, 0x07, 1, 0, FW_TUR_READY, WB_TIMEOUT, FW_TIMEOUT_DEFAULT}, /* * We match any ATA device. This is really just a placeholder, From owner-svn-src-head@freebsd.org Thu Mar 21 06:31:15 2019 Return-Path: Delivered-To: svn-src-head@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 3B2011552D64; Thu, 21 Mar 2019 06:31:15 +0000 (UTC) (envelope-from oshogbo@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 D2CED720FD; Thu, 21 Mar 2019 06:31:14 +0000 (UTC) (envelope-from oshogbo@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 AB4094C74; Thu, 21 Mar 2019 06:31:14 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2L6VEVO036469; Thu, 21 Mar 2019 06:31:14 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2L6VEmE036468; Thu, 21 Mar 2019 06:31:14 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201903210631.x2L6VEmE036468@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Thu, 21 Mar 2019 06:31:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345364 - head/contrib/elftoolchain/strings X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/contrib/elftoolchain/strings X-SVN-Commit-Revision: 345364 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D2CED720FD 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.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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 06:31:15 -0000 Author: oshogbo Date: Thu Mar 21 06:31:14 2019 New Revision: 345364 URL: https://svnweb.freebsd.org/changeset/base/345364 Log: In case of ENCODING_8BIT the EOF code will be pass to putchar. EOF check should be done before (uint8_t)c > 127 test. Reported by: cem Modified: head/contrib/elftoolchain/strings/strings.c Modified: head/contrib/elftoolchain/strings/strings.c ============================================================================== --- head/contrib/elftoolchain/strings/strings.c Thu Mar 21 06:27:58 2019 (r345363) +++ head/contrib/elftoolchain/strings/strings.c Thu Mar 21 06:31:14 2019 (r345364) @@ -402,13 +402,13 @@ find_strings(const char *name, FILE *pfile, off_t offs break; c = getcharacter(pfile); cur_off += encoding_size; + if (!PRINTABLE(c) || c == EOF) + break; if (encoding == ENCODING_8BIT && (uint8_t)c > 127) { putchar(c); continue; } - if (!PRINTABLE(c) || c == EOF) - break; putchar(c); } putchar('\n'); From owner-svn-src-head@freebsd.org Thu Mar 21 06:47:24 2019 Return-Path: Delivered-To: svn-src-head@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 6DA371553BC4; Thu, 21 Mar 2019 06:47:24 +0000 (UTC) (envelope-from imp@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 E47F673104; Thu, 21 Mar 2019 06:47:23 +0000 (UTC) (envelope-from imp@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 ADB014FD3; Thu, 21 Mar 2019 06:47:23 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2L6lNWt045458; Thu, 21 Mar 2019 06:47:23 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2L6lNb6045456; Thu, 21 Mar 2019 06:47:23 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201903210647.x2L6lNb6045456@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Thu, 21 Mar 2019 06:47:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345365 - head/bin/date X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/bin/date X-SVN-Commit-Revision: 345365 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E47F673104 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_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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 06:47:24 -0000 Author: imp Date: Thu Mar 21 06:47:23 2019 New Revision: 345365 URL: https://svnweb.freebsd.org/changeset/base/345365 Log: Remove -n flag, fix setting date / time r342139 bork setting the date. This fixes it by simply removing the -n flag. Differential Revision: https://reviews.freebsd.org/D19668 Modified: head/bin/date/date.1 head/bin/date/date.c Modified: head/bin/date/date.1 ============================================================================== --- head/bin/date/date.1 Thu Mar 21 06:31:14 2019 (r345364) +++ head/bin/date/date.1 Thu Mar 21 06:47:23 2019 (r345365) @@ -32,7 +32,7 @@ .\" @(#)date.1 8.3 (Berkeley) 4/28/95 .\" $FreeBSD$ .\" -.Dd March 12, 2019 +.Dd March 20, 2019 .Dt DATE 1 .Os .Sh NAME @@ -52,13 +52,13 @@ .Ar ... .Op Cm + Ns Ar output_fmt .Nm -.Op Fl jnu +.Op Fl ju .Sm off .Op Oo Oo Oo Oo Ar cc Oc Ar yy Oc Ar mm Oc Ar dd Oc Ar HH .Ar MM Op Ar .ss .Sm on .Nm -.Op Fl jnRu +.Op Fl jRu .Fl f Ar input_fmt new_date .Op Cm + Ns Ar output_fmt .Nm @@ -142,16 +142,6 @@ This allows you to use the flag in addition to the .Cm + option to convert one date format to another. -.It Fl n -By default, if the -.Xr timed 8 -daemon is running, -.Nm -sets the time on all of the machines in the local group. -The -.Fl n -option suppresses this behavior and causes the time to be set only on the -current machine. .It Fl R Use RFC 2822 date and time output format. This is equivalent to using @@ -431,23 +421,6 @@ can be used to parse the output from .Nm and express it in Epoch time. .Sh DIAGNOSTICS -Occasionally, when -.Xr timed 8 -synchronizes the time on many hosts, the setting of a new time value may -require more than a few seconds. -On these occasions, -.Nm -prints: -.Ql Network time being set . -The message -.Ql Communication error with timed -occurs when the communication -between -.Nm -and -.Xr timed 8 -fails. -.Pp It is invalid to combine the .Fl I flag with either @@ -465,8 +438,7 @@ and exits with an error status. .Xr gettimeofday 2 , .Xr getutxent 3 , .Xr strftime 3 , -.Xr strptime 3 , -.Xr timed 8 +.Xr strptime 3 .Rs .%T "TSP: The Time Synchronization Protocol for UNIX 4.3BSD" .%A R. Gusella @@ -478,7 +450,7 @@ The utility is expected to be compatible with .St -p1003.2 . The -.Fl d , f , I , j , n , r , t , +.Fl d , f , I , j , r , t , and .Fl v options are all extensions to the standard. Modified: head/bin/date/date.c ============================================================================== --- head/bin/date/date.c Thu Mar 21 06:31:14 2019 (r345364) +++ head/bin/date/date.c Thu Mar 21 06:47:23 2019 (r345365) @@ -72,7 +72,7 @@ static void iso8601_usage(const char *); static void multipleformats(void); static void printdate(const char *); static void printisodate(struct tm *); -static void setthetime(const char *, const char *, int, int); +static void setthetime(const char *, const char *, int); static void usage(void); static const struct iso8601_fmt { @@ -92,7 +92,7 @@ int main(int argc, char *argv[]) { int ch, rflag; - bool Iflag, jflag, nflag, Rflag; + bool Iflag, jflag, Rflag; const char *format; char buf[1024]; char *fmt; @@ -107,8 +107,8 @@ main(int argc, char *argv[]) fmt = NULL; (void) setlocale(LC_TIME, ""); rflag = 0; - Iflag = jflag = nflag = Rflag = 0; - while ((ch = getopt(argc, argv, "f:I::jnRr:uv:")) != -1) + Iflag = jflag = Rflag = 0; + while ((ch = getopt(argc, argv, "f:I::jRr:uv:")) != -1) switch((char)ch) { case 'f': fmt = optarg; @@ -132,9 +132,6 @@ main(int argc, char *argv[]) case 'j': jflag = 1; /* don't set time */ break; - case 'n': /* don't set network */ - nflag = 1; - break; case 'R': /* RFC 2822 datetime format */ if (Iflag) multipleformats(); @@ -179,7 +176,7 @@ main(int argc, char *argv[]) } if (*argv) { - setthetime(fmt, *argv, jflag, nflag); + setthetime(fmt, *argv, jflag); ++argv; } else if (fmt != NULL) usage(); @@ -250,7 +247,7 @@ printisodate(struct tm *lt) #define ATOI2(s) ((s) += 2, ((s)[-2] - '0') * 10 + ((s)[-1] - '0')) static void -setthetime(const char *fmt, const char *p, int jflag, int nflag) +setthetime(const char *fmt, const char *p, int jflag) { struct utmpx utx; struct tm *lt; @@ -343,20 +340,17 @@ setthetime(const char *fmt, const char *p, int jflag, errx(1, "nonexistent time"); if (!jflag) { - /* set the time */ - if (nflag) { - utx.ut_type = OLD_TIME; - memset(utx.ut_id, 0, sizeof(utx.ut_id)); - (void)gettimeofday(&utx.ut_tv, NULL); - pututxline(&utx); - tv.tv_sec = tval; - tv.tv_usec = 0; - if (settimeofday(&tv, NULL) != 0) - err(1, "settimeofday (timeval)"); - utx.ut_type = NEW_TIME; - (void)gettimeofday(&utx.ut_tv, NULL); - pututxline(&utx); - } + utx.ut_type = OLD_TIME; + memset(utx.ut_id, 0, sizeof(utx.ut_id)); + (void)gettimeofday(&utx.ut_tv, NULL); + pututxline(&utx); + tv.tv_sec = tval; + tv.tv_usec = 0; + if (settimeofday(&tv, NULL) != 0) + err(1, "settimeofday (timeval)"); + utx.ut_type = NEW_TIME; + (void)gettimeofday(&utx.ut_tv, NULL); + pututxline(&utx); if ((p = getlogin()) == NULL) p = "???"; From owner-svn-src-head@freebsd.org Thu Mar 21 08:09:53 2019 Return-Path: Delivered-To: svn-src-head@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 AA0B11556227; Thu, 21 Mar 2019 08:09:53 +0000 (UTC) (envelope-from kp@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 4DF4A75F56; Thu, 21 Mar 2019 08:09:53 +0000 (UTC) (envelope-from kp@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 26F6E5DCB; Thu, 21 Mar 2019 08:09:53 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2L89rxl088231; Thu, 21 Mar 2019 08:09:53 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2L89r7Q088230; Thu, 21 Mar 2019 08:09:53 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201903210809.x2L89r7Q088230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 21 Mar 2019 08:09:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345366 - head/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/netpfil/pf X-SVN-Commit-Revision: 345366 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4DF4A75F56 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_SHORT(-0.97)[-0.972,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 08:09:53 -0000 Author: kp Date: Thu Mar 21 08:09:52 2019 New Revision: 345366 URL: https://svnweb.freebsd.org/changeset/base/345366 Log: pf: Ensure that IP addresses match in ICMP error packets States in pf(4) let ICMP and ICMP6 packets pass if they have a packet in their payload that matches an exiting connection. It was not checked whether the outer ICMP packet has the same destination IP as the source IP of the inner protocol packet. Enforce that these addresses match, to prevent ICMP packets that do not make sense. Reported by: Nicolas Collignon, Corentin Bayet, Eloi Vanderbeken, Luca Moro at Synacktiv Obtained from: OpenBSD Security: CVE-2019-5598 Modified: head/sys/netpfil/pf/pf.c Modified: head/sys/netpfil/pf/pf.c ============================================================================== --- head/sys/netpfil/pf/pf.c Thu Mar 21 06:47:23 2019 (r345365) +++ head/sys/netpfil/pf/pf.c Thu Mar 21 08:09:52 2019 (r345366) @@ -4594,7 +4594,7 @@ pf_test_state_icmp(struct pf_state **state, int direct { struct pf_addr *saddr = pd->src, *daddr = pd->dst; u_int16_t icmpid = 0, *icmpsum; - u_int8_t icmptype; + u_int8_t icmptype, icmpcode; int state_icmp = 0; struct pf_state_key_cmp key; @@ -4603,6 +4603,7 @@ pf_test_state_icmp(struct pf_state **state, int direct #ifdef INET case IPPROTO_ICMP: icmptype = pd->hdr.icmp->icmp_type; + icmpcode = pd->hdr.icmp->icmp_code; icmpid = pd->hdr.icmp->icmp_id; icmpsum = &pd->hdr.icmp->icmp_cksum; @@ -4617,6 +4618,7 @@ pf_test_state_icmp(struct pf_state **state, int direct #ifdef INET6 case IPPROTO_ICMPV6: icmptype = pd->hdr.icmp6->icmp6_type; + icmpcode = pd->hdr.icmp6->icmp6_code; icmpid = pd->hdr.icmp6->icmp6_id; icmpsum = &pd->hdr.icmp6->icmp6_cksum; @@ -4815,6 +4817,23 @@ pf_test_state_icmp(struct pf_state **state, int direct #endif /* INET6 */ } + if (PF_ANEQ(pd->dst, pd2.src, pd->af)) { + if (V_pf_status.debug >= PF_DEBUG_MISC) { + printf("pf: BAD ICMP %d:%d outer dst: ", + icmptype, icmpcode); + pf_print_host(pd->src, 0, pd->af); + printf(" -> "); + pf_print_host(pd->dst, 0, pd->af); + printf(" inner src: "); + pf_print_host(pd2.src, 0, pd2.af); + printf(" -> "); + pf_print_host(pd2.dst, 0, pd2.af); + printf("\n"); + } + REASON_SET(reason, PFRES_BADSTATE); + return (PF_DROP); + } + switch (pd2.proto) { case IPPROTO_TCP: { struct tcphdr th; @@ -4871,7 +4890,7 @@ pf_test_state_icmp(struct pf_state **state, int direct !SEQ_GEQ(seq, src->seqlo - (dst->max_win << dws)))) { if (V_pf_status.debug >= PF_DEBUG_MISC) { printf("pf: BAD ICMP %d:%d ", - icmptype, pd->hdr.icmp->icmp_code); + icmptype, icmpcode); pf_print_host(pd->src, 0, pd->af); printf(" -> "); pf_print_host(pd->dst, 0, pd->af); @@ -4884,7 +4903,7 @@ pf_test_state_icmp(struct pf_state **state, int direct } else { if (V_pf_status.debug >= PF_DEBUG_MISC) { printf("pf: OK ICMP %d:%d ", - icmptype, pd->hdr.icmp->icmp_code); + icmptype, icmpcode); pf_print_host(pd->src, 0, pd->af); printf(" -> "); pf_print_host(pd->dst, 0, pd->af); From owner-svn-src-head@freebsd.org Thu Mar 21 08:15:47 2019 Return-Path: Delivered-To: svn-src-head@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 9FA79155650B; Thu, 21 Mar 2019 08:15:47 +0000 (UTC) (envelope-from kp@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 3FF11765A8; Thu, 21 Mar 2019 08:15:47 +0000 (UTC) (envelope-from kp@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 EE13D5F70; Thu, 21 Mar 2019 08:15:46 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2L8FkZ0093441; Thu, 21 Mar 2019 08:15:46 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2L8FkI3093438; Thu, 21 Mar 2019 08:15:46 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201903210815.x2L8FkI3093438@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Thu, 21 Mar 2019 08:15:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345367 - head/tests/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/tests/sys/netpfil/pf X-SVN-Commit-Revision: 345367 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3FF11765A8 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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 08:15:48 -0000 Author: kp Date: Thu Mar 21 08:15:46 2019 New Revision: 345367 URL: https://svnweb.freebsd.org/changeset/base/345367 Log: pf tests: Move Sniffer to its own file Make it easier to re-use the sniffer class in other test support scripts. Added: head/tests/sys/netpfil/pf/sniffer.py (contents, props changed) Modified: head/tests/sys/netpfil/pf/Makefile head/tests/sys/netpfil/pf/pft_ping.py Modified: head/tests/sys/netpfil/pf/Makefile ============================================================================== --- head/tests/sys/netpfil/pf/Makefile Thu Mar 21 08:09:52 2019 (r345366) +++ head/tests/sys/netpfil/pf/Makefile Thu Mar 21 08:15:46 2019 (r345367) @@ -20,6 +20,7 @@ ATF_TESTS_SH+= anchor \ ${PACKAGE}FILES+= utils.subr \ echo_inetd.conf \ + sniffer.py \ pft_ping.py \ CVE-2019-5597.py Modified: head/tests/sys/netpfil/pf/pft_ping.py ============================================================================== --- head/tests/sys/netpfil/pf/pft_ping.py Thu Mar 21 08:09:52 2019 (r345366) +++ head/tests/sys/netpfil/pf/pft_ping.py Thu Mar 21 08:15:46 2019 (r345367) @@ -3,30 +3,9 @@ import argparse import scapy.all as sp import sys -import threading +from sniffer import Sniffer PAYLOAD_MAGIC = 0x42c0ffee - -class Sniffer(threading.Thread): - def __init__(self, args, check_function): - threading.Thread.__init__(self) - - self._args = args - self._recvif = args.recvif[0] - self._check_function = check_function - self.foundCorrectPacket = False - - self.start() - - def _checkPacket(self, packet): - ret = self._check_function(self._args, packet) - if ret: - self.foundCorrectPacket = True - return ret - - def run(self): - self.packets = sp.sniff(iface=self._recvif, - stop_filter=self._checkPacket, timeout=3) def check_ping_request(args, packet): if args.ip6: Added: head/tests/sys/netpfil/pf/sniffer.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netpfil/pf/sniffer.py Thu Mar 21 08:15:46 2019 (r345367) @@ -0,0 +1,25 @@ +# $FreeBSD$ + +import threading +import scapy.all as sp + +class Sniffer(threading.Thread): + def __init__(self, args, check_function): + threading.Thread.__init__(self) + + self._args = args + self._recvif = args.recvif[0] + self._check_function = check_function + self.foundCorrectPacket = False + + self.start() + + def _checkPacket(self, packet): + ret = self._check_function(self._args, packet) + if ret: + self.foundCorrectPacket = True + return ret + + def run(self): + self.packets = sp.sniff(iface=self._recvif, + stop_filter=self._checkPacket, timeout=3) From owner-svn-src-head@freebsd.org Thu Mar 21 08:51:33 2019 Return-Path: Delivered-To: svn-src-head@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 4445415576EB; Thu, 21 Mar 2019 08:51:33 +0000 (UTC) (envelope-from trasz@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 DCEB277C6E; Thu, 21 Mar 2019 08:51:32 +0000 (UTC) (envelope-from trasz@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 B6B7C6535; Thu, 21 Mar 2019 08:51:32 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2L8pW2Z012986; Thu, 21 Mar 2019 08:51:32 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2L8pWDr012985; Thu, 21 Mar 2019 08:51:32 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201903210851.x2L8pWDr012985@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 21 Mar 2019 08:51:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345368 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 345368 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DCEB277C6E 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.970,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 08:51:33 -0000 Author: trasz Date: Thu Mar 21 08:51:32 2019 New Revision: 345368 URL: https://svnweb.freebsd.org/changeset/base/345368 Log: Attach the vmci(4) man page to the build. Looks like it's been missed by mistake. MFC after: 2 weeks Sponsored by: DARPA, AFRL Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Thu Mar 21 08:15:46 2019 (r345367) +++ head/share/man/man4/Makefile Thu Mar 21 08:51:32 2019 (r345368) @@ -546,6 +546,7 @@ MAN= aac.4 \ ${_virtio_console.4} \ ${_virtio_random.4} \ ${_virtio_scsi.4} \ + ${_vmci.4} \ vkbd.4 \ vlan.4 \ vxlan.4 \ @@ -821,6 +822,7 @@ _spkr.4= spkr.4 _tpm.4= tpm.4 _urtw.4= urtw.4 _viawd.4= viawd.4 +_vmci.4= vmci.4 _wbwd.4= wbwd.4 _wpi.4= wpi.4 _xen.4= xen.4 From owner-svn-src-head@freebsd.org Thu Mar 21 08:54:35 2019 Return-Path: Delivered-To: svn-src-head@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 09E8F15578DA; Thu, 21 Mar 2019 08:54:35 +0000 (UTC) (envelope-from cperciva@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 9CCEB77F4F; Thu, 21 Mar 2019 08:54:34 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7691466A1; Thu, 21 Mar 2019 08:54:34 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2L8sY3m014852; Thu, 21 Mar 2019 08:54:34 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2L8sYIY014851; Thu, 21 Mar 2019 08:54:34 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201903210854.x2L8sYIY014851@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Thu, 21 Mar 2019 08:54:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345369 - head/sys/dev/uart X-SVN-Group: head X-SVN-Commit-Author: cperciva X-SVN-Commit-Paths: head/sys/dev/uart X-SVN-Commit-Revision: 345369 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9CCEB77F4F 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.970,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 08:54:35 -0000 Author: cperciva Date: Thu Mar 21 08:54:34 2019 New Revision: 345369 URL: https://svnweb.freebsd.org/changeset/base/345369 Log: Recognize the Amazon PCI serial device found in a1.* EC2 instances as an NS8250 UART. This is the same as the UART found in EC2 "bare metal" instances, except that the card vendor shows up as 0x0000 rather than 0x1d0f. This seems like a bug in the EC2 firmware; but we might as well support it anyway. Reported by: Greg V Modified: head/sys/dev/uart/uart_bus_pci.c Modified: head/sys/dev/uart/uart_bus_pci.c ============================================================================== --- head/sys/dev/uart/uart_bus_pci.c Thu Mar 21 08:51:32 2019 (r345368) +++ head/sys/dev/uart/uart_bus_pci.c Thu Mar 21 08:54:34 2019 (r345369) @@ -125,6 +125,7 @@ static const struct pci_id pci_ns8250_ids[] = { 128 * DEFAULT_RCLK, 2}, { 0x14e4, 0x4344, 0xffff, 0, "Sony Ericsson GC89 PC Card", 0x10}, { 0x151f, 0x0000, 0xffff, 0, "TOPIC Semiconductor TP560 56k modem", 0x10 }, +{ 0x1d0f, 0x8250, 0x0000, 0, "Amazon PCI serial device", 0x10 }, { 0x1d0f, 0x8250, 0x1d0f, 0, "Amazon PCI serial device", 0x10 }, { 0x1fd4, 0x1999, 0x1fd4, 0x0001, "Sunix SER5xxxx Serial Port", 0x10, 8 * DEFAULT_RCLK }, From owner-svn-src-head@freebsd.org Thu Mar 21 10:23:03 2019 Return-Path: Delivered-To: svn-src-head@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 274F7155B404; Thu, 21 Mar 2019 10:23:03 +0000 (UTC) (envelope-from bz@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 C2AAA83F60; Thu, 21 Mar 2019 10:23:02 +0000 (UTC) (envelope-from bz@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 9B70876DD; Thu, 21 Mar 2019 10:23:02 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2LAN28k062664; Thu, 21 Mar 2019 10:23:02 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2LAN2iC062663; Thu, 21 Mar 2019 10:23:02 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201903211023.x2LAN2iC062663@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 21 Mar 2019 10:23:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345370 - head/sys/dev/sdhci X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/dev/sdhci X-SVN-Commit-Revision: 345370 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C2AAA83F60 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.955,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 10:23:03 -0000 Author: bz Date: Thu Mar 21 10:23:02 2019 New Revision: 345370 URL: https://svnweb.freebsd.org/changeset/base/345370 Log: Align struct sdhci_slot MMCCAM members. Whitespace only, no functional change. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/sdhci/sdhci.h Modified: head/sys/dev/sdhci/sdhci.h ============================================================================== --- head/sys/dev/sdhci/sdhci.h Thu Mar 21 08:54:34 2019 (r345369) +++ head/sys/dev/sdhci/sdhci.h Thu Mar 21 10:23:02 2019 (r345370) @@ -413,10 +413,10 @@ struct sdhci_slot { #ifdef MMCCAM /* CAM stuff */ union ccb *ccb; - struct cam_devq *devq; - struct cam_sim *sim; - struct mtx sim_mtx; - u_char card_present; /* XXX Maybe derive this from elsewhere? */ + struct cam_devq *devq; + struct cam_sim *sim; + struct mtx sim_mtx; + u_char card_present; /* XXX Maybe derive this from elsewhere? */ #endif }; From owner-svn-src-head@freebsd.org Thu Mar 21 10:46:11 2019 Return-Path: Delivered-To: svn-src-head@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 721BB155BCAC; Thu, 21 Mar 2019 10:46:11 +0000 (UTC) (envelope-from mw@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 15D2C84BB3; Thu, 21 Mar 2019 10:46:11 +0000 (UTC) (envelope-from mw@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 E0E687A53; Thu, 21 Mar 2019 10:46:10 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2LAkAnl073820; Thu, 21 Mar 2019 10:46:10 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2LAkAx5073818; Thu, 21 Mar 2019 10:46:10 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201903211046.x2LAkAx5073818@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Thu, 21 Mar 2019 10:46:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345371 - head/sys/dev/ena X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/dev/ena X-SVN-Commit-Revision: 345371 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 15D2C84BB3 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.955,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 10:46:11 -0000 Author: mw Date: Thu Mar 21 10:46:10 2019 New Revision: 345371 URL: https://svnweb.freebsd.org/changeset/base/345371 Log: Prevent double activation of admin interrupt in ENA The resource is already being activated in the bus_alloc_resource(), because the flag RF_ACTIVE is being passed. Double activation on arm64 is causing kernel panic. Version of the driver was upgraded to 0.8.4. Submitted by: Michal Krawczyk Reported-by: Greg V Tested-by: cperciva, Greg V Obtained from: Semihalf MFC after: 2 weeks Sponsored by: Amazon, Inc. Differential revision: https://reviews.freebsd.org/D19655 Modified: head/sys/dev/ena/ena.c head/sys/dev/ena/ena.h Modified: head/sys/dev/ena/ena.c ============================================================================== --- head/sys/dev/ena/ena.c Thu Mar 21 10:23:02 2019 (r345370) +++ head/sys/dev/ena/ena.c Thu Mar 21 10:46:10 2019 (r345371) @@ -1944,14 +1944,6 @@ ena_request_mgmnt_irq(struct ena_adapter *adapter) return (ENXIO); } - rc = bus_activate_resource(adapter->pdev, SYS_RES_IRQ, - irq->vector, irq->res); - if (unlikely(rc != 0)) { - device_printf(adapter->pdev, "could not activate " - "irq vector: %d\n", irq->vector); - goto err_res_free; - } - rc = bus_setup_intr(adapter->pdev, irq->res, INTR_TYPE_NET | INTR_MPSAFE, NULL, ena_intr_msix_mgmnt, irq->data, &irq->cookie); Modified: head/sys/dev/ena/ena.h ============================================================================== --- head/sys/dev/ena/ena.h Thu Mar 21 10:23:02 2019 (r345370) +++ head/sys/dev/ena/ena.h Thu Mar 21 10:46:10 2019 (r345371) @@ -41,7 +41,7 @@ #define DRV_MODULE_VER_MAJOR 0 #define DRV_MODULE_VER_MINOR 8 -#define DRV_MODULE_VER_SUBMINOR 3 +#define DRV_MODULE_VER_SUBMINOR 4 #define DRV_MODULE_NAME "ena" From owner-svn-src-head@freebsd.org Thu Mar 21 10:50:37 2019 Return-Path: Delivered-To: svn-src-head@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 2061C155BDEC; Thu, 21 Mar 2019 10:50:37 +0000 (UTC) (envelope-from bz@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 B38A784E78; Thu, 21 Mar 2019 10:50:36 +0000 (UTC) (envelope-from bz@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 740107A65; Thu, 21 Mar 2019 10:50:36 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2LAoaCU074928; Thu, 21 Mar 2019 10:50:36 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2LAoaA0074927; Thu, 21 Mar 2019 10:50:36 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201903211050.x2LAoaA0074927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 21 Mar 2019 10:50:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345372 - head/sys/dev/sdhci X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/dev/sdhci X-SVN-Commit-Revision: 345372 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B38A784E78 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.96)[-0.957,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 10:50:37 -0000 Author: bz Date: Thu Mar 21 10:50:36 2019 New Revision: 345372 URL: https://svnweb.freebsd.org/changeset/base/345372 Log: Whitespace cleanup in sdhci.c No functional changes. Replace whitespace by tabs, indent with 4 spaces, coalesce multi-line shorter than 80 characters, MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/sdhci/sdhci.c Modified: head/sys/dev/sdhci/sdhci.c ============================================================================== --- head/sys/dev/sdhci/sdhci.c Thu Mar 21 10:46:10 2019 (r345371) +++ head/sys/dev/sdhci/sdhci.c Thu Mar 21 10:50:36 2019 (r345372) @@ -1553,23 +1553,23 @@ sdhci_retune(void *arg) static void sdhci_req_done(struct sdhci_slot *slot) { - union ccb *ccb; + union ccb *ccb; if (__predict_false(sdhci_debug > 1)) slot_printf(slot, "%s\n", __func__); if (slot->ccb != NULL && slot->curcmd != NULL) { callout_stop(&slot->timeout_callout); - ccb = slot->ccb; - slot->ccb = NULL; + ccb = slot->ccb; + slot->ccb = NULL; slot->curcmd = NULL; - /* Tell CAM the request is finished */ - struct ccb_mmcio *mmcio; - mmcio = &ccb->mmcio; + /* Tell CAM the request is finished */ + struct ccb_mmcio *mmcio; + mmcio = &ccb->mmcio; - ccb->ccb_h.status = - (mmcio->cmd.error == 0 ? CAM_REQ_CMP : CAM_REQ_CMP_ERR); - xpt_done(ccb); + ccb->ccb_h.status = + (mmcio->cmd.error == 0 ? CAM_REQ_CMP : CAM_REQ_CMP_ERR); + xpt_done(ccb); } } #else @@ -2483,47 +2483,45 @@ void sdhci_start_slot(struct sdhci_slot *slot) { - if ((slot->devq = cam_simq_alloc(1)) == NULL) { - goto fail; - } + if ((slot->devq = cam_simq_alloc(1)) == NULL) + goto fail; - mtx_init(&slot->sim_mtx, "sdhcisim", NULL, MTX_DEF); - slot->sim = cam_sim_alloc(sdhci_cam_action, sdhci_cam_poll, - "sdhci_slot", slot, device_get_unit(slot->bus), - &slot->sim_mtx, 1, 1, slot->devq); + mtx_init(&slot->sim_mtx, "sdhcisim", NULL, MTX_DEF); + slot->sim = cam_sim_alloc(sdhci_cam_action, sdhci_cam_poll, + "sdhci_slot", slot, device_get_unit(slot->bus), + &slot->sim_mtx, 1, 1, slot->devq); - if (slot->sim == NULL) { - cam_simq_free(slot->devq); - slot_printf(slot, "cannot allocate CAM SIM\n"); - goto fail; - } + if (slot->sim == NULL) { + cam_simq_free(slot->devq); + slot_printf(slot, "cannot allocate CAM SIM\n"); + goto fail; + } - mtx_lock(&slot->sim_mtx); - if (xpt_bus_register(slot->sim, slot->bus, 0) != 0) { - slot_printf(slot, - "cannot register SCSI pass-through bus\n"); - cam_sim_free(slot->sim, FALSE); - cam_simq_free(slot->devq); - mtx_unlock(&slot->sim_mtx); - goto fail; - } + mtx_lock(&slot->sim_mtx); + if (xpt_bus_register(slot->sim, slot->bus, 0) != 0) { + slot_printf(slot, "cannot register SCSI pass-through bus\n"); + cam_sim_free(slot->sim, FALSE); + cam_simq_free(slot->devq); + mtx_unlock(&slot->sim_mtx); + goto fail; + } + mtx_unlock(&slot->sim_mtx); - mtx_unlock(&slot->sim_mtx); - /* End CAM-specific init */ + /* End CAM-specific init */ slot->card_present = 0; sdhci_card_task(slot, 0); - return; + return; fail: - if (slot->sim != NULL) { - mtx_lock(&slot->sim_mtx); - xpt_bus_deregister(cam_sim_path(slot->sim)); - cam_sim_free(slot->sim, FALSE); - mtx_unlock(&slot->sim_mtx); - } + if (slot->sim != NULL) { + mtx_lock(&slot->sim_mtx); + xpt_bus_deregister(cam_sim_path(slot->sim)); + cam_sim_free(slot->sim, FALSE); + mtx_unlock(&slot->sim_mtx); + } - if (slot->devq != NULL) - cam_simq_free(slot->devq); + if (slot->devq != NULL) + cam_simq_free(slot->devq); } static void @@ -2653,15 +2651,13 @@ sdhci_cam_get_possible_host_clock(const struct sdhci_s clock = max_clock; if (slot->version < SDHCI_SPEC_300) { - for (i = 0; i < SDHCI_200_MAX_DIVIDER; - i <<= 1) { + for (i = 0; i < SDHCI_200_MAX_DIVIDER; i <<= 1) { if (clock <= proposed_clock) break; clock >>= 1; } } else { - for (i = 0; i < SDHCI_300_MAX_DIVIDER; - i += 2) { + for (i = 0; i < SDHCI_300_MAX_DIVIDER; i += 2) { if (clock <= proposed_clock) break; clock = max_clock / (i + 2); @@ -2711,7 +2707,7 @@ sdhci_cam_settran_settings(struct sdhci_slot *slot, un slot_printf(slot, "Bus mode => %d\n", ios->bus_mode); } - /* XXX Provide a way to call a chip-specific IOS update, required for TI */ + /* XXX Provide a way to call a chip-specific IOS update, required for TI */ return (sdhci_cam_update_ios(slot)); } @@ -2779,7 +2775,7 @@ sdhci_cam_request(struct sdhci_slot *slot, union ccb * if (mmcio->cmd.data != NULL) { if (mmcio->cmd.data->len == 0 || mmcio->cmd.data->flags == 0) panic("data->len = %d, data->flags = %d -- something is b0rked", - (int)mmcio->cmd.data->len, mmcio->cmd.data->flags); + (int)mmcio->cmd.data->len, mmcio->cmd.data->flags); } slot->ccb = ccb; slot->flags = 0; From owner-svn-src-head@freebsd.org Thu Mar 21 10:51:37 2019 Return-Path: Delivered-To: svn-src-head@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 5F57B155BEA0; Thu, 21 Mar 2019 10:51:37 +0000 (UTC) (envelope-from mw@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 F2DB1850C4; Thu, 21 Mar 2019 10:51:36 +0000 (UTC) (envelope-from mw@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 CBE117AB4; Thu, 21 Mar 2019 10:51:36 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2LApaSk077984; Thu, 21 Mar 2019 10:51:36 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2LApaTd077983; Thu, 21 Mar 2019 10:51:36 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201903211051.x2LApaTd077983@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Thu, 21 Mar 2019 10:51:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345373 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 345373 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F2DB1850C4 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.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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 10:51:37 -0000 Author: mw Date: Thu Mar 21 10:51:36 2019 New Revision: 345373 URL: https://svnweb.freebsd.org/changeset/base/345373 Log: Add bus_release_resource() method to nexus on arm64 The nexus module was missing method for releasing bus resources. As a result, it couldn't be released and the bus_release_resource() call would return ENXIO. Next call to bus_alloc_resource() for the same resource was returning error, because it wasn't released previously and it was still busy. The implementation of the nexus_release_resource() is the same as for arm architecture. Submitted by: Michal Krawczyk Reported-by: Greg V Tested-by: cperciva, Greg V Obtained from: Semihalf MFC after: 2 weeks Sponsored by: Amazon, Inc. Differential revision: https://reviews.freebsd.org/D19641 Modified: head/sys/arm64/arm64/nexus.c Modified: head/sys/arm64/arm64/nexus.c ============================================================================== --- head/sys/arm64/arm64/nexus.c Thu Mar 21 10:50:36 2019 (r345372) +++ head/sys/arm64/arm64/nexus.c Thu Mar 21 10:51:36 2019 (r345373) @@ -113,6 +113,8 @@ static int nexus_set_resource(device_t, device_t, int, rman_res_t, rman_res_t); static int nexus_deactivate_resource(device_t, device_t, int, int, struct resource *); +static int nexus_release_resource(device_t, device_t, int, int, + struct resource *); static int nexus_setup_intr(device_t dev, device_t child, struct resource *res, int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep); @@ -137,6 +139,7 @@ static device_method_t nexus_methods[] = { DEVMETHOD(bus_get_resource_list, nexus_get_reslist), DEVMETHOD(bus_set_resource, nexus_set_resource), DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource), + DEVMETHOD(bus_release_resource, nexus_release_resource), DEVMETHOD(bus_setup_intr, nexus_setup_intr), DEVMETHOD(bus_teardown_intr, nexus_teardown_intr), DEVMETHOD(bus_get_bus_tag, nexus_get_bus_tag), @@ -268,6 +271,20 @@ nexus_alloc_resource(device_t bus, device_t child, int } return (rv); +} + +static int +nexus_release_resource(device_t bus, device_t child, int type, int rid, + struct resource *res) +{ + int error; + + if (rman_get_flags(res) & RF_ACTIVE) { + error = bus_deactivate_resource(child, type, rid, res); + if (error) + return (error); + } + return (rman_release_resource(res)); } static int From owner-svn-src-head@freebsd.org Thu Mar 21 11:45:02 2019 Return-Path: Delivered-To: svn-src-head@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 1C711153548C; Thu, 21 Mar 2019 11:45:02 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 2C2068763A; Thu, 21 Mar 2019 11:45:00 +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 mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 990C9105BAF7; Thu, 21 Mar 2019 22:44:50 +1100 (AEDT) Date: Thu, 21 Mar 2019 22:44:49 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Mark Johnston cc: rgrimes@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r345359 - in head/sys/cddl/dev/dtrace: amd64 i386 In-Reply-To: <20190321034917.GA8186@raichu> Message-ID: <20190321180738.P1024@besplex.bde.org> References: <201903210252.x2L2qMSP022374@repo.freebsd.org> <201903210320.x2L3KIjc058579@gndrsh.dnsmgr.net> <20190321034917.GA8186@raichu> 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 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=ZectpuNWII6CirRfMfEA:9 a=ADR4nIhWhHMYY5YO:21 a=ILTXBW-eLHiTwD_C:21 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-Rspamd-Queue-Id: 2C2068763A 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.970,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 11:45:02 -0000 On Wed, 20 Mar 2019, Mark Johnston wrote: > On Wed, Mar 20, 2019 at 08:20:18PM -0700, Rodney W. Grimes wrote: >>> Author: markj >>> Date: Thu Mar 21 02:52:22 2019 >>> New Revision: 345359 >>> URL: https://svnweb.freebsd.org/changeset/base/345359 >>> >>> Log: >>> Don't attempt to measure TSC skew when running as a VM guest. >>> >>> It simply doesn't work in general since VCPUs may migrate between >>> physical cores. The approach used to measure skew also doesn't >>> make much sense in a VM. I think it simply doesn't work. jhb's src/tools/tools/tscdrift/tscdrift.c also simply doesn't work for measuring drift. It mostly measures IPC latency and jitter from preemption in attempts to measure skew. It might be possible to determine the current skew using a statistical analysis of the latency and a few more measurements (measure latency between each CPU in a pair instead of only from CPU0 to other CPUs), but it would be better to do more direct measurements. >> "May" is the important aspect here, and to my knowledge both >> bhyve and Vmware provide a way to pin cpus there should be >> a way for us to turn this back on if it is desired. Sticking >> it under the big knob vm_guest is probably not the most flexiable >> solution. >> >> Could we please have someway to force this back on? > > Even with pinning the skew computation is bogus in a VM. On an idle > host running bhyve with pinned vCPUs it gives offsets that are several > orders of magnitude larger than on the host. I would prefer to see a > specific reason for wanting the old behaviour before adding a knob. The method is bogus (buggy) out of a VM. XX static void XX dtrace_gethrtime_init(void *arg) XX { XX struct pcpu *pc; XX cpuset_t map; XX int i; XX #endif XX XX /* The current CPU is the reference one. */ XX sched_pin(); It is also necessary to disable interrupts in hardware. Or maybe better and necessary, detect when they occur and discard related samples. It is impossible to disable NMIs. Then there are SMIs. Not to mention virtualization. At best, it gives delays a bit like for SMIs, but longer. Since this is init code, perhaps interrupts are already masked in hardware, but to detect drift in the skews, it is necessary to run a routine like this quite often. XX tsc_skew[curcpu] = 0; XX CPU_FOREACH(i) { XX if (i == curcpu) XX continue; XX XX pc = pcpu_find(i); XX CPU_SETOF(PCPU_GET(cpuid), &map); XX CPU_SET(pc->pc_cpuid, &map); XX XX smp_rendezvous_cpus(map, NULL, XX dtrace_gethrtime_init_cpu, XX smp_no_rendezvous_barrier, (void *)(uintptr_t) i); Some synchronization is necessary, but this is very heavyweight. Even the lightweight synchronization in tscdrift.c has an average latency of about 150-200 cycles on freefall's Xeon: afer fixing bugs in it: CPU | TSC skew (min/avg/max/stddev) ----+------------------------------ 0 | 0 0 0 0.000 1 | 36 65 47913 101.227 # lower latency on same core 2 | 144 180 52977 139.862 3 | 147 180 34077 113.543 4 | 135 181 49335 228.104 5 | 123 175 33300 91.703 6 | 165 188 129825 166.999 7 | 165 189 248010 278.321 tscdrift measures from CPU0 to CPU_n for each n. After fixing it to read the TSC on CPU0 before doing an IPC to allow reading the TSC on CPU_n, this measures mainly the IPC latency. Actually reading the TSC takes about 24 cycles. The skew appears to be 0 for all CPUs. Anyway, it is so much smaller than the IPC latency that it can be ignored, provided it doesn't drift to become non-small, and applications don't try to be too smart about correcting for the latency. The unfixed tscdrift allows the other CPU to read the TSC before reading it itself. This is more like the above. It still ends up measuring mainly IPC latency and other bugs in the program, since the read of the TSC on the same CPU occurs relatively instantly without the other bugs, and out of order (this possibly earlier than instantly) with the other bugs. The IPC delay is about the same as above, but it takes more complicated statistics to prove this. XX XX tsc_skew[i] = tgt_cpu_tsc - hst_cpu_tsc; This has even more complicated ordering. The IPC delay depends on the internals of smp_rendezvous_cpus(). It should work better to schedule comparisons of 2 CPUs using a third CPU (this is possible except with precisely 2 CPUs). 2 CPUs sit waiting for permission to read their TSC. Another CPU sets a variable to grant permission. I plan to try a variation of this: all CPUs spin reading the TSC and appending the result atomically to a log buffer. Then analyze the results. With no skew or interrupts, it is expected that the results are almost monotonic. Contention causes non-monotonicity only occasionally. The average non-mononicity should be 0. If there is significant skew, then the order for the sameples form each pair of CPUs will reverse on almost every second reading. The skew is the adjustment needed to stop this reversal. Logs of the TSC for a single CPU show that the granularity is about 18 on freefall's Xeon. I don't know yet if this is more closely related to the clock rate or the rdtsc latency. The TSC frequency is 3.3GHz. I recently learned that a common implementation uses a shared clock of frequency only 100 MHz. With no interpolation of this, the granularity is 33 cycles. rdtsc itself takes about 18 cycles, so not much is gained from any interpolation, but some seems to be done. On Haswell i4790K at 4 GHz, IIRC rdtsc seemed to take 24 cycles. I haven't done the test to see if non-multiples of 24 are returned. A 100 MHz clock would have a granularity of 40 cycles, so there is apparently some interpolation. A commit log message by mav@ says that some Skylakes never return odd values for rdtsc, and some appear to have a granularity of about 186 (?) cycles. freefall's Xeon does return odd values for rdtsc. XX } XX sched_unpin(); XX } XX ... XX /* XX * DTrace needs a high resolution time function which can XX * be called from a probe context and guaranteed not to have XX * instrumented with probes itself. XX * XX * Returns nanoseconds since boot. XX */ dtrace does too much hand-rolling here, but it has to do something to handle the 2 problems mentioned in the comment. Other subsystems handle this worse (*). But it shouldn't try harder than the TSC timecounters to handle skew. The TSC timecounter ignores the problem of skew, but does other things more carefully. XX uint64_t XX dtrace_gethrtime(void) XX { XX uint64_t tsc; XX uint32_t lo, hi; XX register_t rflags; XX XX /* XX * We split TSC value into lower and higher 32-bit halves and separately XX * scale them with nsec_scale, then we scale them down by 2^28 XX * (see nsec_scale calculations) taking into account 32-bit shift of XX * the higher half and finally add. XX */ XX rflags = intr_disable(); XX tsc = rdtsc() - tsc_skew[curcpu]; XX intr_restore(rflags); This is missing the fencing needed to serialize rdtsc(). Unfixed tscdrift is missing fencing in one place. Not serializing rdtsc() gives errors of up to about 80 cycles in variations of tscdrift. These errors are larger in the place where the fencing is _not_ missing, due to the details of the synchronization: While spinning waiting for the "gate" to open, without fencing rdtsc() is executed out of order up to about 80 cycles early. But the "master" usually doesn't spin for so long, so its unfenced rdtsc (in the unfixed version is usually not the full 80 cycles early. The "slave" usually spins for more than 80 cycles, but its rdtsc is fenced so it is never early. This gives a bias towards increasing the measured difference slave_tsc - master_tsc. The average difference is over 200 instead of about 180. Disabling interrupts in the above seems to be to prevent curcpu changing. The comment says nothing about this, or about anything in the block of code that it is attached to. XX XX lo = tsc; XX hi = tsc >> 32; XX return (((lo * nsec_scale) >> SCALE_SHIFT) + XX ((hi * nsec_scale) << (32 - SCALE_SHIFT))); The comment applies to this block if code which it is separated from. XX } I think subtracting the skew in the above is worse than useless. It works OK only when the skew is 0. Suppose that the actual skew is 0. It must be 0, else more important things like the TSC timecounter are broken. It is surprising that the TSC timecounter works so well. Since it does seem to work, the skew must be 0 initially and remain 0 on most systems, except probably for jitter in the 1/(100 MHz) range from the common clock and distributing this clock over lareg distances. But by attempting to caclulate the skew, we risk calculating only IPC delays. The rendezvous function wasn't designed for getting the precise timing need to minimize these delays or wven to know what they are. I looked at it a bit. Indeed, it has a master-slave relationship that cannot work as needed: XX /* Pass rendezvous parameters via global variables. */ XX smp_rv_ncpus = ncpus; XX smp_rv_setup_func = setup_func; XX smp_rv_action_func = action_func; XX smp_rv_teardown_func = teardown_func; XX smp_rv_func_arg = arg; XX smp_rv_waiters[1] = 0; XX smp_rv_waiters[2] = 0; XX smp_rv_waiters[3] = 0; XX atomic_store_rel_int(&smp_rv_waiters[0], 0); The slaves are going to have a lot of latency from just parsing this. XX XX /* XX * Signal other processors, which will enter the IPI with XX * interrupts off. XX */ XX curcpumap = CPU_ISSET(curcpu, &map); XX CPU_CLR(curcpu, &map); XX ipi_selected(map, IPI_RENDEZVOUS); IPIs give large, variable latency. XX /* Check if the current CPU is in the map */ XX if (curcpumap != 0) XX smp_rendezvous_action(); We just sent IPIs to the other CPUs. They may have executed the action function already, but more likely they have barely seen the IPI yet (it is not even an NMI). Here we execute the action function for curcpu. It just reads the TSC for the current CPU. At least the execution is complicated enough that the rdtsc in the action function is hard to execute far out of order, so it doesn't really need fencing. XX [...] No problem waiting for the other CPUs. The problem is getting them to call the action function with tiny or at least known delays. I think this ends up caclulating IPC delays much like tscdrift, but larger due to the very heavyweight IPI method (errors in microseconds instead of only of 180/3.3 = 50 nanoseconds?). Other CPUs on the same core are closer, so the errors from the IPC delays for them are smaller, but probably the IPI delays dominate the errors. So attempting to calculate skews seem to turn skews of 0 into large errors: - no error for the reference CPU - an error of approx. -(IPI_delay + memory_IPC_delay + {1 or 2} * rdtsc_latency + rdtsc_nonserialization_errors), where memory_IPC_delays is much larger for CPUs not on the same core as the "master". Such enormous errors might not be too bad. Times read on different CPUs are just incomparable without establishing an order based on something like reference events involving a locked variable. IPCs for establishing an order take about as long as memory_IPC_delay for the IPCs to miscalculate the skews. (*) Other subsystems with worse timestamps: - KTR uses KTR_TIME which defaults to get_cyclecount(). get_cyclecount() is by definition unusable for timestamps. It was intended to work like an x86 TSC, back when the x86 TSC actually was a cycle count of CPU cycles, with possibly-variable frequency and the hardware not trying very hard to make it comparable across CPUs. Since then the TSC has been decoupled from CPU cycles, so it actually counts time cycles like its name indicates. get_cyclecount() is still documented as counting CPU cycles and not guaranteeing anything except per-CPU monotonicity. On x86, get_cyclecount() usually reduces to rdtsc() (with no fencing but a layer or 2 of function calls). But it can reduce to a timecounter, so is unusuable in KTR for another reason -- that KTR needs to be able to timestamp low-level things like timecounters. Since get_cyclecount() can be anything and might have a variable frequency, its current average frequency is unknown. KTR provids no conversion functions to help the user intepret KTR logs with timestamps. - kern_tslog.c:tslog() uses get_cyclecount() without even a macro for replacing it be a usable counter, and spells its variable 'tsc' - get_cyclecount() sometimes uses a timecounter - get_cyclecount() is also misused in: - dev/ocs_fc/ocs_utils.c (like kern_tslog.c) - dev/hwpmc/hwpmc_mod.c (fallback from rdtsc*() for non-x86; also uses rdtscp() if available and is missing fencing if only rdtstc() is available - dev/de/if_devar.h (it wants rdtsc() but that is even less portable. nanouptime() is adequate for NOC drivers). - dev/random/* (this was the reason for the get_cyclecount() mistake. Randomness wants the opposite of a monotonic counter, but there is some noise in the low bits of x86 TSCs) - kern/subr_bus.c (like dev/random but more justified) - netinet/sctp* (like dev/de) - DELAY() is used at low levels where it is assumed to be safe. But sometimes it uses a timecounter. - cpu_ticks() is sometimes used instead of misusing get_cyclecount(). This is better. On x86, cpu_ticks() is the same as rdtsc() if the CPU supports rdtsc(), down to not fencing it, but with only amd64 inlining get_cyclecount() == rdtsc() and neither x86 arch inlining cpu_ticks() as rdtsc(). cpu_ticks() has freqency support. The main problems with it are that the ticks can have a variable rate and no subsystem including the cpu_ticks() subsystem "integrates" this rate to get consistent times in seconds, and cpu_ticks() may also be a timecounter so it may be unsafe to use in low- level contexts. The following subsystems use cpu_ticks() instead of a timecounter or a hack for timestamps: - contrib/ena-com - dev/acpi/acpi_cpu.c. An important use - i386/include/cpu.h. This implements get_cyclecount() as cpu_ticks(), since this is more portable than using rdtsc(). - schedulers use cpu_ticks() since timecounters were too slow when they were the i8254. Now even an HPET is still too slow, and only newer x86 can depend on having timecounters that are not too slow. Schedulers still use stathz ticks at a low frequency for actual scheduling since all hardware timers were too slow and many still are. Other complications for reading TSCs: - rdtscp is not very useful since it is only slightly better than lfence; rdtsc on Intel CPUs and mfence; rdtsc on AMD CPUs. In theory, it could be significantly better since it doesn't use global fences. It also reads a CPU id atomically with reading the TSC. This could be used for avoiding the interrupt masking in the above skew adjustment. - rdtscp and fences before rdtsc only give "release semantics". Another fence may be needed after rdtsc* to give "acquire" semantics -- to prevent moving stores before rdtsc*. I think x86 strong memory ordering works just as well here. E.g.: __asm __volatile("lfence"); volatile uint64_t tsc = rdtsc(); #if 0 /* * Not needed since tsc is volatile to force the memory order of * storing to tsc before storing to gate. Of course, rdtsc() must * be ordered before storing its result, so this prevents moving * the store to gate before rdtsc(). */ __asm __volatile("sfence"); #endif atomic_store_int(&gate, OPEN); For fixing simplistic timing code of the form: start = rdtsc(); do_work(); finish = rdtsc(); diff = finish - start; old references say to use cpuid() to serialize. cpuid() is slow. cpuid() before the first rdtsc() doesn't mess up the result for a simple test like this, but for general use for timestamps it is just slower so we should use a fence. However for timestamps it often doesn't matter if the start timestamp is early so we might be able to avoid the fence too. Then we need serialization something like the above to prevent the second rdtsc() being moved into do_work(). A complete old method using cpuid() is: cpuid(); start = rdtsc(); sfence(); /* maybe the wrong fence type */ do_work(); finish = rdtscp(); sfence(); /* maybe the wrong fence type */ cpuid(); /* just to be safe */ diff = finish - start; and I think this can be improved to: lfence(); /* mfence() on AMD */ start = rdtsc(); /* volatile start for ordering */ do_work(); lfence(); /* perhaps more portable than rdtscp() */ finish = rdtscp(); /* volatile finish for ordering */ diff = finish - start; and this should also make the acquire and release ordering more explicit. It assumes no TSC skew. However, if we only want an upper bound for the time, then we can optimize this by omitting some fences. Omitting the first fence only gives an earlier start and thus a larger diff. The first volatile, or a fence after the first rdtsc() seems to be necessary to prevent the first rdtsc() being moved after loads and stores in do_work(). After do_work(), the reverse applies -- ommitting the second volatile only gives a later finish, while the second fence is needed to prevent the second rdtsc() being moved too early. For free-running timestamps, ordering like the above is neither necessary nor sufficient. The simplistic timing code is now: clock_gettime(CLOCK_MONOTONIC, &start); do_work(); clock_gettime(CLOCK_MONOTONIC, &finish); diff = finish - start; /* actually timespecsub() */ and this needs to work without the user writing any ordering directives. "to work" doesn't seem to mean much in POSIX. Despite clock_gettime() being invented for POSIX.1b realtime extensions and these not becoming very common before 2001, the specifiers apparently didn't dream of relativistic causality problems for times. I think all that is required is for CLOCK_MONOTONIC to give monotonic times. A useul implementation should also guarantee program order for code like the above despite it not having any explicit ordering. This is not easy when the CPUs running the code are separated by many light-seconds and the clock can measure light-seconds. The above is in a single thread. Suppose this thread runs on only 1 CPU. Then skews don't matter, and even fences aren't needed to get monotonicity. Sprinkling fences (both load and store) for each rdtsc() also gives ordering for do_work(). Suppose the critical rdtsc()s in this thread run on different CPUs. Then skews matter. Uncorrected or garbage skews larger than the do_work() plus context switch time give negative or more than doubled differences. Since this problem is rarely noticed, the skews must be usually not that large. I think the garbage skews in dtrace are smaller than normal context switch time since IPIs are faster than switches (except for VM cases). Errors from not using fences are probably small compared with context switch times, thus never cause negative differences. It is necessary to have fences on both sides of rdtsc() to ensure ordering across CPUs. Otherwise, in theory the rdtsc() for 'start' might be so late and the rdtsc() for 'finish' might be so early that finish < start. For 3 timestamps instead of 2, the one in the middle must have fences on both sides; thus for a general API, all cases must have fences on both sides. In practice, context switches won't be done without a lot of stores which will order everything without explicit fences. Similarly for comparing times across threads, except it is skews larger than the IPC time that cause negative differences. Bruce From owner-svn-src-head@freebsd.org Thu Mar 21 13:30:49 2019 Return-Path: Delivered-To: svn-src-head@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 333CE154043F; Thu, 21 Mar 2019 13:30: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 CA1898B47F; Thu, 21 Mar 2019 13:30: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 A477D95E3; Thu, 21 Mar 2019 13:30:48 +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 x2LDUmAi058720; Thu, 21 Mar 2019 13:30:48 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2LDUm3b058719; Thu, 21 Mar 2019 13:30:48 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201903211330.x2LDUm3b058719@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 21 Mar 2019 13:30:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345376 - head/sys/fs/nullfs X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/fs/nullfs X-SVN-Commit-Revision: 345376 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CA1898B47F 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_SHORT(-0.98)[-0.978,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 13:30:49 -0000 Author: kib Date: Thu Mar 21 13:30:48 2019 New Revision: 345376 URL: https://svnweb.freebsd.org/changeset/base/345376 Log: nullfs: fix unmounts when filesystem is active. If vflush() did not completely flushed the mount vnodes queue, either retry for forced unmounts, or give up for non-forced. This situation can occur when new vnodes are instantiated while vflush() worked. Reported and tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/fs/nullfs/null_vfsops.c Modified: head/sys/fs/nullfs/null_vfsops.c ============================================================================== --- head/sys/fs/nullfs/null_vfsops.c Thu Mar 21 11:32:52 2019 (r345375) +++ head/sys/fs/nullfs/null_vfsops.c Thu Mar 21 13:30:48 2019 (r345376) @@ -235,7 +235,7 @@ nullfs_unmount(mp, mntflags) { struct null_mount *mntdata; struct mount *ump; - int error, flags; + int error, flags, rootrefs; NULLFSDEBUG("nullfs_unmount: mp = %p\n", (void *)mp); @@ -244,10 +244,20 @@ nullfs_unmount(mp, mntflags) else flags = 0; - /* There is 1 extra root vnode reference (nullm_rootvp). */ - error = vflush(mp, 1, flags, curthread); - if (error) - return (error); + for (rootrefs = 1;; rootrefs = 0) { + /* There is 1 extra root vnode reference (nullm_rootvp). */ + error = vflush(mp, rootrefs, flags, curthread); + if (error) + return (error); + MNT_ILOCK(mp); + if (mp->mnt_nvnodelistsize == 0) { + MNT_IUNLOCK(mp); + break; + } + MNT_IUNLOCK(mp); + if ((mntflags & MNT_FORCE) == 0) + return (EBUSY); + } /* * Finally, throw away the null_mount structure From owner-svn-src-head@freebsd.org Thu Mar 21 14:17:57 2019 Return-Path: Delivered-To: svn-src-head@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 E8DDA1541DAA; Thu, 21 Mar 2019 14:17:56 +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 8F2C28D5F6; Thu, 21 Mar 2019 14:17:56 +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 69D8C9EB9; Thu, 21 Mar 2019 14:17:56 +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 x2LEHuVO086041; Thu, 21 Mar 2019 14:17:56 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2LEHtAV086037; Thu, 21 Mar 2019 14:17:55 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201903211417.x2LEHtAV086037@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Thu, 21 Mar 2019 14:17:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345379 - head/release/arm64 X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/release/arm64 X-SVN-Commit-Revision: 345379 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8F2C28D5F6 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_SHORT(-0.98)[-0.978,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 14:17:57 -0000 Author: gjb Date: Thu Mar 21 14:17:55 2019 New Revision: 345379 URL: https://svnweb.freebsd.org/changeset/base/345379 Log: Bump the IMAGE_SIZE for arm64 SoC images to prevent failures due to full filesystem. This makes the size of the arm64 SoC images consistent with armv6 and armv7. MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/release/arm64/PINE64-LTS.conf head/release/arm64/PINE64.conf head/release/arm64/PINEBOOK.conf head/release/arm64/RPI3.conf Modified: head/release/arm64/PINE64-LTS.conf ============================================================================== --- head/release/arm64/PINE64-LTS.conf Thu Mar 21 14:17:12 2019 (r345378) +++ head/release/arm64/PINE64-LTS.conf Thu Mar 21 14:17:55 2019 (r345379) @@ -9,7 +9,7 @@ EMBEDDEDBUILD=1 EMBEDDEDPORTS="sysutils/u-boot-pine64-lts" FAT_SIZE="54m -b 1m" FAT_TYPE="16" -IMAGE_SIZE="2560M" +IMAGE_SIZE="3072M" KERNEL="GENERIC" MD_ARGS="-x 63 -y 255" NODOC=1 Modified: head/release/arm64/PINE64.conf ============================================================================== --- head/release/arm64/PINE64.conf Thu Mar 21 14:17:12 2019 (r345378) +++ head/release/arm64/PINE64.conf Thu Mar 21 14:17:55 2019 (r345379) @@ -9,7 +9,7 @@ EMBEDDEDBUILD=1 EMBEDDEDPORTS="sysutils/u-boot-pine64" FAT_SIZE="54m -b 1m" FAT_TYPE="16" -IMAGE_SIZE="2560M" +IMAGE_SIZE="3072M" KERNEL="GENERIC" MD_ARGS="-x 63 -y 255" NODOC=1 Modified: head/release/arm64/PINEBOOK.conf ============================================================================== --- head/release/arm64/PINEBOOK.conf Thu Mar 21 14:17:12 2019 (r345378) +++ head/release/arm64/PINEBOOK.conf Thu Mar 21 14:17:55 2019 (r345379) @@ -9,7 +9,7 @@ EMBEDDEDBUILD=1 EMBEDDEDPORTS="sysutils/u-boot-pinebook" FAT_SIZE="54m -b 1m" FAT_TYPE="16" -IMAGE_SIZE="2560M" +IMAGE_SIZE="3072M" KERNEL="GENERIC" MD_ARGS="-x 63 -y 255" NODOC=1 Modified: head/release/arm64/RPI3.conf ============================================================================== --- head/release/arm64/RPI3.conf Thu Mar 21 14:17:12 2019 (r345378) +++ head/release/arm64/RPI3.conf Thu Mar 21 14:17:55 2019 (r345379) @@ -11,7 +11,7 @@ EMBEDDEDBUILD=1 EMBEDDEDPORTS="sysutils/u-boot-rpi3 sysutils/rpi-firmware" FAT_SIZE="50m -b 1m" FAT_TYPE="16" -IMAGE_SIZE="2560M" +IMAGE_SIZE="3072M" KERNEL="GENERIC" MD_ARGS="-x 63 -y 255" NODOC=1 From owner-svn-src-head@freebsd.org Thu Mar 21 14:31:13 2019 Return-Path: Delivered-To: svn-src-head@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 1E7AA1543432; Thu, 21 Mar 2019 14:31:13 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 6263F8E125; Thu, 21 Mar 2019 14:31:11 +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 mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 3C88B105BBFB; Fri, 22 Mar 2019 01:31:08 +1100 (AEDT) Date: Fri, 22 Mar 2019 01:31:06 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bruce Evans cc: Mark Johnston , rgrimes@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r345359 - in head/sys/cddl/dev/dtrace: amd64 i386 In-Reply-To: <20190321180738.P1024@besplex.bde.org> Message-ID: <20190322005722.S2163@besplex.bde.org> References: <201903210252.x2L2qMSP022374@repo.freebsd.org> <201903210320.x2L3KIjc058579@gndrsh.dnsmgr.net> <20190321034917.GA8186@raichu> <20190321180738.P1024@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=P6RKvmIu c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=Gr1yOpoBqWAdDEyqnqwA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-Rspamd-Queue-Id: 6263F8E125 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.979,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 14:31:13 -0000 On Thu, 21 Mar 2019, Bruce Evans wrote: > On Wed, 20 Mar 2019, Mark Johnston wrote: > >> On Wed, Mar 20, 2019 at 08:20:18PM -0700, Rodney W. Grimes wrote: >>>> Author: markj >>>> Date: Thu Mar 21 02:52:22 2019 >>>> New Revision: 345359 >>>> URL: https://svnweb.freebsd.org/changeset/base/345359 >>>> >>>> Log: >>>> Don't attempt to measure TSC skew when running as a VM guest. >>>> >>>> It simply doesn't work in general since VCPUs may migrate between >>>> physical cores. The approach used to measure skew also doesn't >>>> make much sense in a VM. > > I think it simply doesn't work. > > [... lots] I don't normally use dtrace, but built a kernel with it to test this, and got the expected garbage for skew values on SandyBridge and Haswell systems. First, the build was broken on at least i386: - i386 NOTES only has KTRACE_HOOKS. All other dtrace options (devices) are commented out. This defeats the reason for existence of NOTES. It is not to supply documenation, but to test everything except negative options using LINT. - since dtrace was not tested in LINT, of course it doesn't compile - "device dtrace" doesn't compile, since it depends on the "optional" "module" "device fbt" for 1 symbol - "device fbt" doesn't compile, since kern.pre.mk has an invalid -I path for it, and at least gcc considers invalid -I paths as errors. Fix for the -I path: XX Index: kern.pre.mk XX =================================================================== XX --- kern.pre.mk (revision 345315) XX +++ kern.pre.mk (working copy) XX @@ -202,9 +202,13 @@ XX DTRACE_S= ${CC} -c ${DTRACE_ASM_CFLAGS} ${WERROR} ${.IMPSRC} XX XX # Special flags for managing the compat compiles for DTrace/FBT XX -FBT_CFLAGS= -DBUILDING_DTRACE -nostdinc -I$S/cddl/dev/fbt/${MACHINE_CPUARCH} -I$S/cddl/dev/fbt -I$S/cddl/compat/opensolaris -I$S/cddl/contrib/opensolaris/uts/common -I$S ${CDDL_CFLAGS} XX +FBT_CFLAGS= -DBUILDING_DTRACE -nostdinc -I$S/cddl/dev/fbt \ XX + -I$S/cddl/compat/opensolaris \ XX + -I$S/cddl/contrib/opensolaris/uts/common -I$S ${CDDL_CFLAGS} XX .if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" XX FBT_CFLAGS+= -I$S/cddl/dev/fbt/x86 XX +.else XX +FBT_CFLAGS+= -I$S/cddl/dev/fbt/${MACHINE_CPUARCH} XX .endif XX FBT_C= ${CC} -c ${FBT_CFLAGS} ${WERROR} ${PROF} ${.IMPSRC} XX This also fixes some style bugs (a too-long line). kern.pre.mk has about 12 other too-long lines, with about half of these for cddl. Perhaps the order of the -I paths matters, but this worked for me. I once eliminated almost all -I paths in kernel Makefiles. There are about 100 times as many now as before I removed some :-(. At least the -I maze for FBT doesn't affect other subsystems. Results of calculating skews: On SandyBridge i5-2560M 2 cores * 2 threads: boot1 boot2 boot3 boot4 ----- ----- ----- ----- tsc_skew[0] = 0 0 0 0 tsc_skew[1] = 0x40 0x58 0x5c 0x8c tsc_skew[2] = 0x68 0x68 0x7c 0x7c tsc_skew[3] = 0x118 0x98 0x104 0x104 On Haswell i7-4790K 4 cores * 2 threads: boot1 boot2 boot3 boot4 ----- ----- ----- ----- tsc_skew[0] = 0 0 0 0 tsc_skew[1] = 0x40 0x40 0x40 0x30 tsc_skew[2] = 0x40 -0x40 0x54 0x5c tsc_skew[3] = 0xf0 0xf4 0x74 0x58 tsc_skew[4] = 0xdc 0x60 0x6c 0x138 tsc_skew[5] = 0x38 0x6c 0x38 0x38 tsc_skew[6] = 0x4c 0x38 0xe0 0xb0 tsc_skew[7] = 0x3c 0x3c -0x38 0x38 This looks like IPC delays with jitter from sloppy measurements. Nothing to do with skews, except it approximates 0. Bruce From owner-svn-src-head@freebsd.org Thu Mar 21 14:45:09 2019 Return-Path: Delivered-To: svn-src-head@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 BB7341543C84; Thu, 21 Mar 2019 14:45:09 +0000 (UTC) (envelope-from cem@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 494288EAEC; Thu, 21 Mar 2019 14:45:09 +0000 (UTC) (envelope-from cem@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 26A70A445; Thu, 21 Mar 2019 14:45:09 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2LEj9CN002126; Thu, 21 Mar 2019 14:45:09 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2LEj8U0002125; Thu, 21 Mar 2019 14:45:08 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201903211445.x2LEj8U0002125@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Thu, 21 Mar 2019 14:45:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345380 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 345380 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 494288EAEC 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_SHORT(-0.97)[-0.970,0]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 14:45:09 -0000 Author: cem Date: Thu Mar 21 14:45:08 2019 New Revision: 345380 URL: https://svnweb.freebsd.org/changeset/base/345380 Log: arc4random: Adjust example code to use uniform() API PR: 236678 Reported by: Andras Farkas Modified: head/lib/libc/gen/arc4random.3 Modified: head/lib/libc/gen/arc4random.3 ============================================================================== --- head/lib/libc/gen/arc4random.3 Thu Mar 21 14:17:55 2019 (r345379) +++ head/lib/libc/gen/arc4random.3 Thu Mar 21 14:45:08 2019 (r345380) @@ -31,7 +31,7 @@ .\" Manual page, using -mandoc macros .\" $FreeBSD$ .\" -.Dd July 19, 2014 +.Dd March 21, 2019 .Dt ARC4RANDOM 3 .Os .Sh NAME @@ -116,7 +116,7 @@ and functions using .Fn arc4random : .Pp -.Dl "#define foo4random() (arc4random() % ((unsigned)RAND_MAX + 1))" +.Dl "#define foo4random() (arc4random_uniform(RAND_MAX + 1))" .Sh SEE ALSO .Xr rand 3 , .Xr rand48 3 , From owner-svn-src-head@freebsd.org Thu Mar 21 15:24:11 2019 Return-Path: Delivered-To: svn-src-head@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 79EB31545270 for ; Thu, 21 Mar 2019 15:24:11 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound1.eu.mailhop.org (outbound1.eu.mailhop.org [52.28.251.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C10CB6848E for ; Thu, 21 Mar 2019 15:24:10 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1553181846; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=SwkK4lPvkkikJOYO0aOdA7xhh6TqSW0nTrUn7U9KUfaFvhJXLLCjAzqLLe4782w+B8XOGESGEOSGL BNlDeEwL8oIyp7nFSSGWNQQxwJRxwlnB4lF3mmkzUuYAGEUIr1cktrhQpe56OtH6UXwpgIkuDXr08C Pv/WSiL9R3+38L4lWRRmilV0TWGTNpjlNX4hMUBg5YydMOuzkHng9bleAGNWMKSRxy6u1FARLId/RC FdrxVhqYht773OdfWTrcbnIcwj7EX35+AvD2T1chpdNFBGk3MnfidK/qmsjFjK5h/Vu4pUmrbVo0Gy EABwRW4bzvjxgoy5Pc8H7nJPKnDy7BA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=NUpFY+XYHDrwdys/8YUlxYA2lzrgo0uO2Ud6+MJJnkY=; b=rz/cj8WYSQbV1sTdi12eX2Eu+ekCWVQ7XtJ9+hIJZg9SDFAhF09wLLHOH7gSlUiLR+eLDhRRE4WmP +C4yvI2a7aZipywNkmx5k2/xNP+Cz96RadHh/nv2uYDIs5s7jiHdSpni3vhYLnAKIx4w4eZQU2/lxG alIaWExEzmNaUTkow8qovreK0SGhJWO9flrBBhBs3V28MBnJX6Gi06RcUqF0e0u0YqlVO/dziyh+m9 8I/O9ajsathjQqnrRPzg+aHiCE/KYw9Wpq8w3JKm/uRXJb5SmCevUIO8ngFv1dSjOqCOZEHoa/8qjF uuZ0MiynnLoDYrs2AKOaoXH2A3MMvWQ== ARC-Authentication-Results: i=1; outbound3.eu.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=NUpFY+XYHDrwdys/8YUlxYA2lzrgo0uO2Ud6+MJJnkY=; b=tVoDOnec8HNUR5uaGcKn0YP46uws0av9kKRopmWp/0JTw6XIKH7vAam9KpHr3rvAGABAooGTqQduA MTlhaacwZrKKi+8FHtwfE4RgBzUO75hMBOawnopULHSNyrUbYEhieZrfKPP/V66wB7i73PYbKrJ632 hSc7JCoz1wnlRtFaBlV18SUdJxp01MbESaHDwTWoT8oivcVARkG7UK+Qci6L348fqyN/BwqVd9rvOy v68nZqwg7Bq+u5zmLDoVS8+PVlGZPX+DKwjtAd8uFn2LRhMpoePtEI20WSqlqRnEaR6EJqU9HF1s+H aI4yhvzID5G7M4B91wkIpMEtL8txF5Q== X-MHO-RoutePath: aGlwcGll X-MHO-User: 5bca5090-4bed-11e9-908b-352056dbf2de X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.eu.mailhop.org (Halon) with ESMTPSA id 5bca5090-4bed-11e9-908b-352056dbf2de; Thu, 21 Mar 2019 15:24:04 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x2LFO29R072085; Thu, 21 Mar 2019 09:24:02 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <8cbcb45384bdf9af7f6ac0ba26121efa6a7b5669.camel@freebsd.org> Subject: Re: svn commit: r345365 - head/bin/date From: Ian Lepore To: Warner Losh , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Thu, 21 Mar 2019 09:24:02 -0600 In-Reply-To: <201903210647.x2L6lNb6045456@repo.freebsd.org> References: <201903210647.x2L6lNb6045456@repo.freebsd.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: C10CB6848E X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-7.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-1.00)[-0.995,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 15:24:11 -0000 On Thu, 2019-03-21 at 06:47 +0000, Warner Losh wrote: > Author: imp > Date: Thu Mar 21 06:47:23 2019 > New Revision: 345365 > URL: https://svnweb.freebsd.org/changeset/base/345365 > > Log: > Remove -n flag, fix setting date / time > IMO, the -n flag should still be accepted, but ignored, to provide compatibility with anybody's old scripts or other automation that uses date -n, since the new default behavior is exactly what the old -n flag provided. On the other hand, the fact that date(1) has failed to set the date for about 3 months shows that it isn't a heavily-used command. -- Ian From owner-svn-src-head@freebsd.org Thu Mar 21 16:15:31 2019 Return-Path: Delivered-To: svn-src-head@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 E4424154714B; Thu, 21 Mar 2019 16:15:30 +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 86C4A6BB8A; Thu, 21 Mar 2019 16:15:30 +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 6B0F2B3ED; Thu, 21 Mar 2019 16:15:30 +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 x2LGFU5T049472; Thu, 21 Mar 2019 16:15:30 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2LGFTEk049469; Thu, 21 Mar 2019 16:15:29 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201903211615.x2LGFTEk049469@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 21 Mar 2019 16:15:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345381 - head/sys/netpfil/ipfw X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netpfil/ipfw X-SVN-Commit-Revision: 345381 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 86C4A6BB8A 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.96)[-0.961,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 16:15:31 -0000 Author: glebius Date: Thu Mar 21 16:15:29 2019 New Revision: 345381 URL: https://svnweb.freebsd.org/changeset/base/345381 Log: Always create ipfw(4) hooks as long as module is loaded. Now enabling ipfw(4) with sysctls controls only linkage of hooks to default heads. When module is loaded fetch sysctls as tunables, to make it possible to boot with ipfw(4) in kernel, but not linked to any pfil(9) hooks. Modified: head/sys/netpfil/ipfw/ip_fw2.c head/sys/netpfil/ipfw/ip_fw_pfil.c head/sys/netpfil/ipfw/ip_fw_private.h Modified: head/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw2.c Thu Mar 21 14:45:08 2019 (r345380) +++ head/sys/netpfil/ipfw/ip_fw2.c Thu Mar 21 16:15:29 2019 (r345381) @@ -3360,7 +3360,7 @@ vnet_ipfw_init(const void *unused) * is checked on each packet because there are no pfil hooks. */ V_ip_fw_ctl_ptr = ipfw_ctl3; - error = ipfw_attach_hooks(1); + error = ipfw_attach_hooks(); return (error); } @@ -3380,7 +3380,7 @@ vnet_ipfw_uninit(const void *unused) * Then grab, release and grab again the WLOCK so we make * sure the update is propagated and nobody will be in. */ - (void)ipfw_attach_hooks(0 /* detach */); + ipfw_detach_hooks(); V_ip_fw_ctl_ptr = NULL; last = IS_DEFAULT_VNET(curvnet) ? 1 : 0; Modified: head/sys/netpfil/ipfw/ip_fw_pfil.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_pfil.c Thu Mar 21 14:45:08 2019 (r345380) +++ head/sys/netpfil/ipfw/ip_fw_pfil.c Thu Mar 21 16:15:29 2019 (r345381) @@ -536,29 +536,23 @@ VNET_DEFINE_STATIC(pfil_hook_t, ipfw_inet6_hook); VNET_DEFINE_STATIC(pfil_hook_t, ipfw_link_hook); #define V_ipfw_link_hook VNET(ipfw_link_hook) -static int -ipfw_hook(int onoff, int pf) +static void +ipfw_hook(int pf) { struct pfil_hook_args pha; - struct pfil_link_args pla; pfil_hook_t *h; pha.pa_version = PFIL_VERSION; - pha.pa_flags = PFIL_IN | PFIL_OUT | PFIL_MEMPTR; + pha.pa_flags = PFIL_IN | PFIL_OUT; pha.pa_modname = "ipfw"; pha.pa_ruleset = NULL; - pla.pa_version = PFIL_VERSION; - pla.pa_flags = PFIL_IN | PFIL_OUT | - PFIL_HEADPTR | PFIL_HOOKPTR; - switch (pf) { case AF_INET: pha.pa_func = ipfw_check_packet; pha.pa_type = PFIL_TYPE_IP4; pha.pa_rulname = "default"; h = &V_ipfw_inet_hook; - pla.pa_head = V_inet_pfil_head; break; #ifdef INET6 case AF_INET6: @@ -566,57 +560,103 @@ ipfw_hook(int onoff, int pf) pha.pa_type = PFIL_TYPE_IP6; pha.pa_rulname = "default6"; h = &V_ipfw_inet6_hook; - pla.pa_head = V_inet6_pfil_head; break; #endif case AF_LINK: pha.pa_func = ipfw_check_frame; pha.pa_type = PFIL_TYPE_ETHERNET; pha.pa_rulname = "default-link"; + pha.pa_flags |= PFIL_MEMPTR; h = &V_ipfw_link_hook; - pla.pa_head = V_link_pfil_head; break; } - if (onoff) { - *h = pfil_add_hook(&pha); - pla.pa_hook = *h; - (void)pfil_link(&pla); - } else - if (*h != NULL) - pfil_remove_hook(*h); + *h = pfil_add_hook(&pha); +} - return 0; +static void +ipfw_unhook(int pf) +{ + + switch (pf) { + case AF_INET: + pfil_remove_hook(V_ipfw_inet_hook); + break; +#ifdef INET6 + case AF_INET6: + pfil_remove_hook(V_ipfw_inet6_hook); + break; +#endif + case AF_LINK: + pfil_remove_hook(V_ipfw_link_hook); + break; + } } +static int +ipfw_link(int pf, bool unlink) +{ + struct pfil_link_args pla; + + pla.pa_version = PFIL_VERSION; + pla.pa_flags = PFIL_IN | PFIL_OUT | PFIL_HEADPTR | PFIL_HOOKPTR; + if (unlink) + pla.pa_flags |= PFIL_UNLINK; + + switch (pf) { + case AF_INET: + pla.pa_head = V_inet_pfil_head; + pla.pa_hook = V_ipfw_inet_hook; + break; +#ifdef INET6 + case AF_INET6: + pla.pa_head = V_inet6_pfil_head; + pla.pa_hook = V_ipfw_inet6_hook; + break; +#endif + case AF_LINK: + pla.pa_head = V_link_pfil_head; + pla.pa_hook = V_ipfw_link_hook; + break; + } + + return (pfil_link(&pla)); +} + int -ipfw_attach_hooks(int arg) +ipfw_attach_hooks(void) { int error = 0; - if (arg == 0) /* detach */ - ipfw_hook(0, AF_INET); - else if (V_fw_enable && ipfw_hook(1, AF_INET) != 0) { - error = ENOENT; /* see ip_fw_pfil.c::ipfw_hook() */ + ipfw_hook(AF_INET); + TUNABLE_INT_FETCH("net.inet.ip.fw.enable", &V_fw_enable); + if (V_fw_enable && (error = ipfw_link(AF_INET, false)) != 0) printf("ipfw_hook() error\n"); - } #ifdef INET6 - if (arg == 0) /* detach */ - ipfw_hook(0, AF_INET6); - else if (V_fw6_enable && ipfw_hook(1, AF_INET6) != 0) { - error = ENOENT; + ipfw_hook(AF_INET6); + TUNABLE_INT_FETCH("net.inet6.ip6.fw.enable", &V_fw6_enable); + if (V_fw6_enable && (error = ipfw_link(AF_INET6, false)) != 0) printf("ipfw6_hook() error\n"); - } #endif - if (arg == 0) /* detach */ - ipfw_hook(0, AF_LINK); - else if (V_fwlink_enable && ipfw_hook(1, AF_LINK) != 0) { - error = ENOENT; + ipfw_hook(AF_LINK); + TUNABLE_INT_FETCH("net.link.ether.ipfw", &V_fwlink_enable); + if (V_fwlink_enable && (error = ipfw_link(AF_LINK, false)) != 0) printf("ipfw_link_hook() error\n"); - } - return error; + + return (error); } +void +ipfw_detach_hooks(void) +{ + + ipfw_unhook(AF_INET); +#ifdef INET6 + ipfw_unhook(AF_INET6); +#endif + ipfw_unhook(AF_LINK); +} + int ipfw_chg_hook(SYSCTL_HANDLER_ARGS) { @@ -648,7 +688,7 @@ ipfw_chg_hook(SYSCTL_HANDLER_ARGS) if (*(int *)arg1 == newval) return (0); - error = ipfw_hook(newval, af); + error = ipfw_link(af, newval == 0 ? true : false); if (error) return (error); *(int *)arg1 = newval; Modified: head/sys/netpfil/ipfw/ip_fw_private.h ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_private.h Thu Mar 21 14:45:08 2019 (r345380) +++ head/sys/netpfil/ipfw/ip_fw_private.h Thu Mar 21 16:15:29 2019 (r345381) @@ -151,8 +151,8 @@ int ipfw_chk(struct ip_fw_args *args); struct mbuf *ipfw_send_pkt(struct mbuf *, struct ipfw_flow_id *, u_int32_t, u_int32_t, int); -/* attach (arg = 1) or detach (arg = 0) hooks */ -int ipfw_attach_hooks(int); +int ipfw_attach_hooks(void); +void ipfw_detach_hooks(void); #ifdef NOTYET void ipfw_nat_destroy(void); #endif From owner-svn-src-head@freebsd.org Thu Mar 21 16:25:25 2019 Return-Path: Delivered-To: svn-src-head@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 8B17D15473ED; Thu, 21 Mar 2019 16:25:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (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 27B816C061; Thu, 21 Mar 2019 16:25:25 +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 7EF9E18CAE; Thu, 21 Mar 2019 16:25:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r345359 - in head/sys/cddl/dev/dtrace: amd64 i386 To: Mark Johnston , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201903210252.x2L2qMSP022374@repo.freebsd.org> 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: Date: Thu, 21 Mar 2019 09:25:20 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.5.3 MIME-Version: 1.0 In-Reply-To: <201903210252.x2L2qMSP022374@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 27B816C061 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.95 / 15.00]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.95)[-0.953,0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 16:25:25 -0000 On 3/20/19 7:52 PM, Mark Johnston wrote: > Author: markj > Date: Thu Mar 21 02:52:22 2019 > New Revision: 345359 > URL: https://svnweb.freebsd.org/changeset/base/345359 > > Log: > Don't attempt to measure TSC skew when running as a VM guest. > > It simply doesn't work in general since VCPUs may migrate between > physical cores. The approach used to measure skew also doesn't > make much sense in a VM. > > PR: 218452 > MFC after: 2 weeks > Sponsored by: The FreeBSD Foundation > > Modified: > head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c > head/sys/cddl/dev/dtrace/i386/dtrace_subr.c > > Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c > ============================================================================== > --- head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Thu Mar 21 01:16:37 2019 (r345358) > +++ head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Thu Mar 21 02:52:22 2019 (r345359) > @@ -319,6 +319,9 @@ dtrace_gethrtime_init(void *arg) > int i; > #endif > > + if (vm_guest) > + return; > + > /* The current CPU is the reference one. */ > sched_pin(); > tsc_skew[curcpu] = 0; > > Modified: head/sys/cddl/dev/dtrace/i386/dtrace_subr.c > ============================================================================== > --- head/sys/cddl/dev/dtrace/i386/dtrace_subr.c Thu Mar 21 01:16:37 2019 (r345358) > +++ head/sys/cddl/dev/dtrace/i386/dtrace_subr.c Thu Mar 21 02:52:22 2019 (r345359) > @@ -321,6 +321,9 @@ dtrace_gethrtime_init(void *arg) > int i; > #endif > > + if (vm_guest) > + return; > + > /* The current CPU is the reference one. */ > sched_pin(); > tsc_skew[curcpu] = 0; I do think I would prefer 'if (vm_guest != VM_GUEST_NO)' or some such vs 'if (vm_guest)'. The latter does read well, but it seems like comparisons against enums should always be against an enum value? That seems more consistent with our rule to require pointers to be compared with NULL for example. -- John Baldwin From owner-svn-src-head@freebsd.org Thu Mar 21 17:21:16 2019 Return-Path: Delivered-To: svn-src-head@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 7E3A31548BF5 for ; Thu, 21 Mar 2019 17:21:16 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1A3466E485 for ; Thu, 21 Mar 2019 17:21:16 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x82f.google.com with SMTP id w30so7481641qta.8 for ; Thu, 21 Mar 2019 10:21:16 -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=C3xNOac986fgQDyBpaY1pZEEeg3at4EscBzFWat5t6g=; b=agweMSnrRAapNlGaV30RRXS+zM5RprIHBPwvgyFVHi1xLJmEPLTfvqhM8/b/3fm57i enQR/3RYt5ZpuJl6gx9IFiQV3va1+LfXe0h3NPTH3YYbQhXAbWcKVU8165GT7voUfi4N K7rMmtJD7OVm1hiFYPB44F4QmtWIV1gsx7sY29Xj/0vyImv53P71h89TSqQHNAvl0ZYE TFTTTJSfZ3EZZi9xjTBONzlboqXfHOeoLTPX6DoF2CBFHykC8cY0c5Bio5hM5pANzOxl hqOu4Pjne0id9yfS36gGakEQBTvxc53A9YiHCzwnd9UxPj+3olGMCpN0lLxC/h0Lse+W G2QA== 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=C3xNOac986fgQDyBpaY1pZEEeg3at4EscBzFWat5t6g=; b=lGOl/WPhi/myrRdq6DXUXCikp1zfoghyCkgobAwduymX3ILwrFwV40sveWLLfX7T6E sYbgOKhcedWlZrXWVWg6Qnk6+1jbLPMC8Enbov6J1PQqd7t2KMkIB49who/9+whlFtfK Tg8e/a6tKucvroQ4VE5wD8cMcy0GApfPp6j5+vn+I8ZVMz3V5cDmT4iFwkaeOYibHyMz mAtskxu1jVZqAhGk5m1xQ4DcNJvXSMw4utBLf37V/XbqaH+c8dav41xl3gunKrGlWoKQ hCU2dBPgA8Alu0DjQwRExMjBbP9efI8o4UnPpCNrYY9MwxFE9JJdjvKGUqSfzSorWNl2 4ePg== X-Gm-Message-State: APjAAAVqSDZFQxhp5CRFuAFmDA5unjArwOF1/JyY2hjHYLgjOY6eKXe8 dOy+5Lwk3qjeBggXohjboDxo7u2ICWMH+kWzF4rmWxE6 X-Google-Smtp-Source: APXvYqxALrl9L3BBreI7Box40+FzBf2zhBHqvnSw3FhXG5QvWSI3y3JgbKHDMr0GPMWlgx30P3mNidipTqhkUkwl9wU= X-Received: by 2002:a0c:9e9a:: with SMTP id r26mr4073585qvd.57.1553188875535; Thu, 21 Mar 2019 10:21:15 -0700 (PDT) MIME-Version: 1.0 References: <201903210647.x2L6lNb6045456@repo.freebsd.org> <8cbcb45384bdf9af7f6ac0ba26121efa6a7b5669.camel@freebsd.org> In-Reply-To: <8cbcb45384bdf9af7f6ac0ba26121efa6a7b5669.camel@freebsd.org> From: Warner Losh Date: Thu, 21 Mar 2019 11:21:04 -0600 Message-ID: Subject: Re: svn commit: r345365 - head/bin/date To: Ian Lepore Cc: Warner Losh , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 1A3466E485 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.957,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 17:21:16 -0000 On Thu, Mar 21, 2019 at 9:24 AM Ian Lepore wrote: > On Thu, 2019-03-21 at 06:47 +0000, Warner Losh wrote: > > Author: imp > > Date: Thu Mar 21 06:47:23 2019 > > New Revision: 345365 > > URL: https://svnweb.freebsd.org/changeset/base/345365 > > > > Log: > > Remove -n flag, fix setting date / time > > > > IMO, the -n flag should still be accepted, but ignored, to provide > compatibility with anybody's old scripts or other automation that uses > date -n, since the new default behavior is exactly what the old -n flag > provided. > > On the other hand, the fact that date(1) has failed to set the date for > about 3 months shows that it isn't a heavily-used command. > I read this a few hours ago and thought "nope, well, maybe" and set it aside. I'm still ambivalent. I've never used -n when setting the date in my entire career. I didn't even know what it was when this bug was brought up. so on the one hand it's easy enough to ignore, on the other we have enough ignore for compatibility junk in the tree... Warner From owner-svn-src-head@freebsd.org Thu Mar 21 19:01:33 2019 Return-Path: Delivered-To: svn-src-head@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 62736154B8EE; Thu, 21 Mar 2019 19:01:33 +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 D40057203F; Thu, 21 Mar 2019 19:01:32 +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 20F073D7634; Fri, 22 Mar 2019 06:01:23 +1100 (AEDT) Date: Fri, 22 Mar 2019 06:01:21 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Conrad Meyer cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r345380 - head/lib/libc/gen In-Reply-To: <201903211445.x2LEj8U0002125@repo.freebsd.org> Message-ID: <20190322050731.V3169@besplex.bde.org> References: <201903211445.x2LEj8U0002125@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=FNpr/6gs c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=pGLkceISAAAA:8 a=6DmX9LIiW2cUjavN7RIA:9 a=CjuIK1q_8ugA:10 X-Rspamd-Queue-Id: D40057203F X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.86 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.86)[-0.858,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 19:01:33 -0000 On Thu, 21 Mar 2019, Conrad Meyer wrote: > Log: > arc4random: Adjust example code to use uniform() API This changes the example from correct to broken. I see 4 bugs: 1. The log message says that the example uses uniform(), but it actually uses arc4random_uniform(). > PR: 236678 > Reported by: Andras Farkas > > Modified: > head/lib/libc/gen/arc4random.3 > > Modified: head/lib/libc/gen/arc4random.3 > ============================================================================== > --- head/lib/libc/gen/arc4random.3 Thu Mar 21 14:17:55 2019 (r345379) > +++ head/lib/libc/gen/arc4random.3 Thu Mar 21 14:45:08 2019 (r345380) > @@ -31,7 +31,7 @@ > .\" Manual page, using -mandoc macros > .\" $FreeBSD$ > .\" > -.Dd July 19, 2014 > +.Dd March 21, 2019 > .Dt ARC4RANDOM 3 > .Os > .Sh NAME > @@ -116,7 +116,7 @@ and > functions using > .Fn arc4random : 2. This description still says that the example uses arc4random(), but it actually uses arc4random_uniform(). > .Pp > -.Dl "#define foo4random() (arc4random() % ((unsigned)RAND_MAX + 1))" > +.Dl "#define foo4random() (arc4random_uniform(RAND_MAX + 1))" > .Sh SEE ALSO > .Xr rand 3 , > .Xr rand48 3 , 3. RAND_MAX is usually INT_MAX, so adding 1 to it gives undefined behavior. The previous version carefully converted RAND_MAX to unsigned to get defined behaviour. The PR doesn't have this bug. It gives the different bad example of using (unsigned)RAND_MAX. This doesn't overflow, but is bad in other ways. Its cast to unsigned is bogus without adding 1. Without adding 1, the range is unusual and the example is different. When misemulating rand() using random() it is a common bug to take the result modulo RAND_MAX. This gives the very non-uniform distribution of never returning RAND_MAX. rand() is not specified to have a uniform distribution, but quality of implementation requires this. This was broken in 4.4BSD but is fixed in FreeBSD. The fix involves reducing RAND_MAX by 2 to get a uniform distribution in the supported range. The old version was obviously not uniform since it took values mod 0x7fffffff instead of mod 0x7fffffffU + 1, so it missed 1 value in the full 31-bit range. The it adjusted an intermediate value of 0, which makes it unclear what the final range is. Oops. Since RAND_MAX is now 2 smaller than INT_MAX, adding 1 to it doesn't cause overflow. So the badness in the current example is just a style bug. 4. Another (old) bug in the example is that it says that the #define for foo4random() produces a drop-in replacement for [both] rand() and random(). The maximum value for random() is still 0x7fffffff, so the same #define doesn't work for both, and it only ever worked accidentally if RAND_MAX happens to be 0x7fffffff, but RAND_MAX has been 0x7ffffffd since before this example existed. Bruce From owner-svn-src-head@freebsd.org Thu Mar 21 19:32:41 2019 Return-Path: Delivered-To: svn-src-head@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 5D48D154C898; Thu, 21 Mar 2019 19:32:41 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-it1-x143.google.com (mail-it1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D5329733AC; Thu, 21 Mar 2019 19:32:40 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-it1-x143.google.com with SMTP id w18so50896itj.4; Thu, 21 Mar 2019 12:32:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=+/Jn17IkrjHrdzQA6BDiIsJxVjqIL7jQCGVltHf1gCA=; b=r2GbK6fX952KL2uVlGF6lTHUGVPVApTYlGDheJaqVMyXIUsKBCBqHGxXxTNeph/lBa JP2bXlXk5T4kizLOUxocUs8WvLh6NBLQKg4lrAf0W6CVkpWHAQqIKP3H793O9nfF/kCM p6sAyHnbJbZKMl7QOykE7EVfDH/wM+7OcT35yEqlPWIFTUnM6Ok3vUVvNCaXetCWZy5y BiJIxrs3m2ukQvY7Cbhcu2EQvVCCrk+9O6Z+sSNmy3kiNCfwt/YLjcC6iTeR8MBrCsn+ TRt3p7h/3FnJYpuId8E0KkqQA1rrcJM6diCJc1316QiSy8KDW8fZJ8kS60ZFHuUkaiRJ YPcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=+/Jn17IkrjHrdzQA6BDiIsJxVjqIL7jQCGVltHf1gCA=; b=hrX7EeE6vclFg73Nllf7oL00mw9fqaxBzHZnec0FOrk1z6xpG00NZmPIuhE3wEPc6S yh4pYrnWkf+IUIi84JFeoscMkGUOU3I73gJ8CT8TZKXhzVBca7lPcRs1xcojQo466Npc PqkoIburhmHzuuM0hPsdYqf8DtDfuLVIR2gUfEY2DnH5rsV1KStdqe2+rUc8ibl3df+P yjoHYUa5GlBqyGBOKc5mwzoTUp9TOi6i/JSfbDfocp3b06UnFWyKgoSPsbKadI49/fJP i3XbQJT73oU8+xGpYaWG9rfWPFutX5+iqWV+7GAyp6SCfF7Lka8P57EAd7Av6d0B3InE NPhQ== X-Gm-Message-State: APjAAAWxNI+VyqJAcOuLDH+ap5o6Jwj8JcfPO/I1EmMZOqm4rmAk23JL GI26BCNELbeinLBMDb3BH9Pya/ZePJA= X-Google-Smtp-Source: APXvYqxrzl0um4jjZmAJJKiZK5LWUkl+9JktuIRBw4UG5B+XpSEXdO83qi4hBYDXmS9yOODdmWBJnw== X-Received: by 2002:a02:3809:: with SMTP id b9mr2246942jaa.138.1553196760147; Thu, 21 Mar 2019 12:32:40 -0700 (PDT) Received: from raichu (toroon0560w-lp140-01-69-159-36-102.dsl.bell.ca. [69.159.36.102]) by smtp.gmail.com with ESMTPSA id n124sm252215itg.2.2019.03.21.12.32.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Mar 2019 12:32:39 -0700 (PDT) Sender: Mark Johnston Date: Thu, 21 Mar 2019 15:32:37 -0400 From: Mark Johnston To: Bruce Evans Cc: rgrimes@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r345359 - in head/sys/cddl/dev/dtrace: amd64 i386 Message-ID: <20190321193237.GF8186@raichu> References: <201903210252.x2L2qMSP022374@repo.freebsd.org> <201903210320.x2L3KIjc058579@gndrsh.dnsmgr.net> <20190321034917.GA8186@raichu> <20190321180738.P1024@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190321180738.P1024@besplex.bde.org> User-Agent: Mutt/1.11.3 (2019-02-01) X-Rspamd-Queue-Id: D5329733AC 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.99)[-0.985,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 19:32:41 -0000 On Thu, Mar 21, 2019 at 10:44:49PM +1100, Bruce Evans wrote: > On Wed, 20 Mar 2019, Mark Johnston wrote: > > > On Wed, Mar 20, 2019 at 08:20:18PM -0700, Rodney W. Grimes wrote: > >>> Author: markj > >>> Date: Thu Mar 21 02:52:22 2019 > >>> New Revision: 345359 > >>> URL: https://svnweb.freebsd.org/changeset/base/345359 > >>> > >>> Log: > >>> Don't attempt to measure TSC skew when running as a VM guest. > >>> > >>> It simply doesn't work in general since VCPUs may migrate between > >>> physical cores. The approach used to measure skew also doesn't > >>> make much sense in a VM. > > I think it simply doesn't work. > > jhb's src/tools/tools/tscdrift/tscdrift.c also simply doesn't work for > measuring drift. It mostly measures IPC latency and jitter from > preemption in attempts to measure skew. It might be possible to > determine the current skew using a statistical analysis of the latency > and a few more measurements (measure latency between each CPU in a > pair instead of only from CPU0 to other CPUs), but it would be better > to do more direct measurements. > > >> "May" is the important aspect here, and to my knowledge both > >> bhyve and Vmware provide a way to pin cpus there should be > >> a way for us to turn this back on if it is desired. Sticking > >> it under the big knob vm_guest is probably not the most flexiable > >> solution. > >> > >> Could we please have someway to force this back on? > > > > Even with pinning the skew computation is bogus in a VM. On an idle > > host running bhyve with pinned vCPUs it gives offsets that are several > > orders of magnitude larger than on the host. I would prefer to see a > > specific reason for wanting the old behaviour before adding a knob. > > The method is bogus (buggy) out of a VM. > > XX static void > XX dtrace_gethrtime_init(void *arg) > XX { > XX struct pcpu *pc; > XX cpuset_t map; > XX int i; > XX #endif > XX > XX /* The current CPU is the reference one. */ > XX sched_pin(); > > It is also necessary to disable interrupts in hardware. Or maybe better > and necessary, detect when they occur and discard related samples. It > is impossible to disable NMIs. Not quite, just carry out the measurement from an NMI handler. :) > Then there are SMIs. Not to mention > virtualization. At best, it gives delays a bit like for SMIs, but longer. > > Since this is init code, perhaps interrupts are already masked in hardware, > but to detect drift in the skews, it is necessary to run a routine like this > quite often. It is worse: on amd64 and i386 dtrace is never compiled into the kernel (as you discovered), so the measurement is done whenever the KLDs happen to be loaded. > XX tsc_skew[curcpu] = 0; > XX CPU_FOREACH(i) { > XX if (i == curcpu) > XX continue; > XX > XX pc = pcpu_find(i); > XX CPU_SETOF(PCPU_GET(cpuid), &map); > XX CPU_SET(pc->pc_cpuid, &map); > XX > XX smp_rendezvous_cpus(map, NULL, > XX dtrace_gethrtime_init_cpu, > XX smp_no_rendezvous_barrier, (void *)(uintptr_t) i); > > Some synchronization is necessary, but this is very heavyweight. Even > the lightweight synchronization in tscdrift.c has an average latency of > about 150-200 cycles on freefall's Xeon: afer fixing bugs in it: > > CPU | TSC skew (min/avg/max/stddev) > ----+------------------------------ > 0 | 0 0 0 0.000 > 1 | 36 65 47913 101.227 # lower latency on same core > 2 | 144 180 52977 139.862 > 3 | 147 180 34077 113.543 > 4 | 135 181 49335 228.104 > 5 | 123 175 33300 91.703 > 6 | 165 188 129825 166.999 > 7 | 165 189 248010 278.321 > > tscdrift measures from CPU0 to CPU_n for each n. After fixing it to > read the TSC on CPU0 before doing an IPC to allow reading the TSC on > CPU_n, this measures mainly the IPC latency. Actually reading the TSC > takes about 24 cycles. The skew appears to be 0 for all CPUs. Anyway, > it is so much smaller than the IPC latency that it can be ignored, provided > it doesn't drift to become non-small, and applications don't try to be > too smart about correcting for the latency. > > The unfixed tscdrift allows the other CPU to read the TSC before reading > it itself. This is more like the above. It still ends up measuring mainly > IPC latency and other bugs in the program, since the read of the TSC on > the same CPU occurs relatively instantly without the other bugs, and out > of order (this possibly earlier than instantly) with the other bugs. The > IPC delay is about the same as above, but it takes more complicated > statistics to prove this. > > XX > XX tsc_skew[i] = tgt_cpu_tsc - hst_cpu_tsc; > > This has even more complicated ordering. The IPC delay depends on the > internals of smp_rendezvous_cpus(). > > It should work better to schedule comparisons of 2 CPUs using a third CPU > (this is possible except with precisely 2 CPUs). 2 CPUs sit waiting for > permission to read their TSC. Another CPU sets a variable to grant > permission. > > I plan to try a variation of this: all CPUs spin reading the TSC and > appending the result atomically to a log buffer. Then analyze the results. > With no skew or interrupts, it is expected that the results are almost > monotonic. Contention causes non-monotonicity only occasionally. The > average non-mononicity should be 0. If there is significant skew, then > the order for the sameples form each pair of CPUs will reverse on almost > every second reading. The skew is the adjustment needed to stop this > reversal. > > Logs of the TSC for a single CPU show that the granularity is about 18 > on freefall's Xeon. I don't know yet if this is more closely related to > the clock rate or the rdtsc latency. The TSC frequency is 3.3GHz. I > recently learned that a common implementation uses a shared clock of > frequency only 100 MHz. With no interpolation of this, the granularity > is 33 cycles. rdtsc itself takes about 18 cycles, so not much is gained > from any interpolation, but some seems to be done. > > On Haswell i4790K at 4 GHz, IIRC rdtsc seemed to take 24 cycles. I haven't > done the test to see if non-multiples of 24 are returned. A 100 MHz clock > would have a granularity of 40 cycles, so there is apparently some > interpolation. > > A commit log message by mav@ says that some Skylakes never return odd values > for rdtsc, and some appear to have a granularity of about 186 (?) cycles. > freefall's Xeon does return odd values for rdtsc. > > XX } > XX sched_unpin(); > XX } > XX ... > XX /* > XX * DTrace needs a high resolution time function which can > XX * be called from a probe context and guaranteed not to have > XX * instrumented with probes itself. > XX * > XX * Returns nanoseconds since boot. > XX */ > > dtrace does too much hand-rolling here, but it has to do something > to handle the 2 problems mentioned in the comment. Other subsystems > handle this worse (*). > > But it shouldn't try harder than the TSC timecounters to handle skew. > The TSC timecounter ignores the problem of skew, but does other things > more carefully. It comes from Solaris/illumos, which uses the following technique to measure skew during boot: AP i: while (!flag) tsc[i] = rdtsc(); BSP: flag = 1; mfence(); tsc = rdtsc(); skew[i] = tsc - tsc[i]; if (skew[i] < 0) skew[i] = -skew[i]; There are some heuristics that attempt to correct for the latency added by the mfence(). I don't think it makes much sense to measure skew on systems with an invariant TSC. If the TSC is not invariant, measuring it once at load time is likely not enough. Based on TSC-invariant systems I looked at, the measured skew is small enough that the erroneous deltas probably don't cause much harm. In VMs, the deltas are large enough that they create noticeable problems. From owner-svn-src-head@freebsd.org Thu Mar 21 19:37:21 2019 Return-Path: Delivered-To: svn-src-head@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 667A5154C974 for ; Thu, 21 Mar 2019 19:37:21 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E61947356A for ; Thu, 21 Mar 2019 19:37:20 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x841.google.com with SMTP id s1so7989662qte.5 for ; Thu, 21 Mar 2019 12:37:20 -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=wEGhVg9YmO1PoViMaXU9Ag27heA5Ik88w1BB5/OCaFg=; b=u+6z7Y6FNL3paxohNG9N2XdAIV2uL/1aqTL/vxKoDmT/Bo8zfDmLSSF8sL4/uuIxSF O1ehLVb9mmb6a4fQtCyv05j83/VjUeEjX+fC2ThN7DRUzC81dzHan5UYY1uUP68P5s8L POLv84NpPNieqj7fXHgwGjtXU6rhOK2/D3T4AK/zasnWdMmPDrBwHb3vHg+7SKUkHZWI iaWx+/7GCmaLjdTcvxx/veNR9AtLCGKiXVPbSyzk/Jfg/rEaYmDTqaOoihiPggAn/ytj mPQX5M9jIA6Aaux241I3JDvia+3oqlmNf0XcykaChHtuWQlfCdaOo7pPrxJQ064BU0Hu NTgw== 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=wEGhVg9YmO1PoViMaXU9Ag27heA5Ik88w1BB5/OCaFg=; b=ay6wBsvN8meUSERUhV94pZSShjN5gyh04rEWAJBEGSPUX9u8F+LvqZgv6k7QNZvVlb ONhRYdYdW0Zcsy6XYpc6aok/VcpgtCyZaowl/nEbMJqBs0mXH2a2JxudxRsLdTCbTQGw u+C+jBTerWE7sOHLCCcbcFV2G6UBJVA3y6UrpfWia0tZwfzqupZS8JV9kroMORz9CFUb +Jp3V/+BQbKpgzTnWhhQEwwN3RV2ibkamJ9ktA3xWVQObkm9MWo166qDGgB9idSHGgqN yF6UL2MOJnjy0kuAY1klqfAk7zVh5sVRFb5YMxuXo6RsF2SytRLDpLhgLhFBi+3Go2G9 b1LQ== X-Gm-Message-State: APjAAAXb/nb+7S8ar9rNrCNcqdNMnicXNfq5OOYE5Dfmh88szE7fSgrc bdVX81jQlZm5BOQclISqRSkpSKlozZsITWvyoR5Wqg== X-Google-Smtp-Source: APXvYqzrHnMKwkV8VxgMRUzEgIKHbmG6rEbRvHzVoG+jnHPzHJFvK+PeyfwwYtSgZEYkAlooSAPyfRuzs1pAf7LsZR0= X-Received: by 2002:a0c:9e9a:: with SMTP id r26mr4617732qvd.57.1553197040049; Thu, 21 Mar 2019 12:37:20 -0700 (PDT) MIME-Version: 1.0 References: <201903210252.x2L2qMSP022374@repo.freebsd.org> <201903210320.x2L3KIjc058579@gndrsh.dnsmgr.net> <20190321034917.GA8186@raichu> <20190321180738.P1024@besplex.bde.org> <20190321193237.GF8186@raichu> In-Reply-To: <20190321193237.GF8186@raichu> From: Warner Losh Date: Thu, 21 Mar 2019 13:37:09 -0600 Message-ID: Subject: Re: svn commit: r345359 - in head/sys/cddl/dev/dtrace: amd64 i386 To: Mark Johnston Cc: Bruce Evans , "Rodney W. Grimes" , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: E61947356A X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.99 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.99)[-0.986,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 19:37:21 -0000 On Thu, Mar 21, 2019 at 1:32 PM Mark Johnston wrote: > On Thu, Mar 21, 2019 at 10:44:49PM +1100, Bruce Evans wrote: > > On Wed, 20 Mar 2019, Mark Johnston wrote: > > > > > On Wed, Mar 20, 2019 at 08:20:18PM -0700, Rodney W. Grimes wrote: > > >>> Author: markj > > >>> Date: Thu Mar 21 02:52:22 2019 > > >>> New Revision: 345359 > > >>> URL: https://svnweb.freebsd.org/changeset/base/345359 > > >>> > > >>> Log: > > >>> Don't attempt to measure TSC skew when running as a VM guest. > > >>> > > >>> It simply doesn't work in general since VCPUs may migrate between > > >>> physical cores. The approach used to measure skew also doesn't > > >>> make much sense in a VM. > > > > I think it simply doesn't work. > > > > jhb's src/tools/tools/tscdrift/tscdrift.c also simply doesn't work for > > measuring drift. It mostly measures IPC latency and jitter from > > preemption in attempts to measure skew. It might be possible to > > determine the current skew using a statistical analysis of the latency > > and a few more measurements (measure latency between each CPU in a > > pair instead of only from CPU0 to other CPUs), but it would be better > > to do more direct measurements. > > > > >> "May" is the important aspect here, and to my knowledge both > > >> bhyve and Vmware provide a way to pin cpus there should be > > >> a way for us to turn this back on if it is desired. Sticking > > >> it under the big knob vm_guest is probably not the most flexiable > > >> solution. > > >> > > >> Could we please have someway to force this back on? > > > > > > Even with pinning the skew computation is bogus in a VM. On an idle > > > host running bhyve with pinned vCPUs it gives offsets that are several > > > orders of magnitude larger than on the host. I would prefer to see a > > > specific reason for wanting the old behaviour before adding a knob. > > > > The method is bogus (buggy) out of a VM. > > > > XX static void > > XX dtrace_gethrtime_init(void *arg) > > XX { > > XX struct pcpu *pc; > > XX cpuset_t map; > > XX int i; > > XX #endif > > XX > > XX /* The current CPU is the reference one. */ > > XX sched_pin(); > > > > It is also necessary to disable interrupts in hardware. Or maybe better > > and necessary, detect when they occur and discard related samples. It > > is impossible to disable NMIs. > > Not quite, just carry out the measurement from an NMI handler. :) > > > Then there are SMIs. Not to mention > > virtualization. At best, it gives delays a bit like for SMIs, but > longer. > > > > Since this is init code, perhaps interrupts are already masked in > hardware, > > but to detect drift in the skews, it is necessary to run a routine like > this > > quite often. > > It is worse: on amd64 and i386 dtrace is never compiled into the kernel > (as you discovered), so the measurement is done whenever the KLDs > happen to be loaded. > > > XX tsc_skew[curcpu] = 0; > > XX CPU_FOREACH(i) { > > XX if (i == curcpu) > > XX continue; > > XX > > XX pc = pcpu_find(i); > > XX CPU_SETOF(PCPU_GET(cpuid), &map); > > XX CPU_SET(pc->pc_cpuid, &map); > > XX > > XX smp_rendezvous_cpus(map, NULL, > > XX dtrace_gethrtime_init_cpu, > > XX smp_no_rendezvous_barrier, (void *)(uintptr_t) i); > > > > Some synchronization is necessary, but this is very heavyweight. Even > > the lightweight synchronization in tscdrift.c has an average latency of > > about 150-200 cycles on freefall's Xeon: afer fixing bugs in it: > > > > CPU | TSC skew (min/avg/max/stddev) > > ----+------------------------------ > > 0 | 0 0 0 0.000 > > 1 | 36 65 47913 101.227 # lower latency on same core > > 2 | 144 180 52977 139.862 > > 3 | 147 180 34077 113.543 > > 4 | 135 181 49335 228.104 > > 5 | 123 175 33300 91.703 > > 6 | 165 188 129825 166.999 > > 7 | 165 189 248010 278.321 > > > > tscdrift measures from CPU0 to CPU_n for each n. After fixing it to > > read the TSC on CPU0 before doing an IPC to allow reading the TSC on > > CPU_n, this measures mainly the IPC latency. Actually reading the TSC > > takes about 24 cycles. The skew appears to be 0 for all CPUs. Anyway, > > it is so much smaller than the IPC latency that it can be ignored, > provided > > it doesn't drift to become non-small, and applications don't try to be > > too smart about correcting for the latency. > > > > The unfixed tscdrift allows the other CPU to read the TSC before reading > > it itself. This is more like the above. It still ends up measuring > mainly > > IPC latency and other bugs in the program, since the read of the TSC on > > the same CPU occurs relatively instantly without the other bugs, and out > > of order (this possibly earlier than instantly) with the other bugs. The > > IPC delay is about the same as above, but it takes more complicated > > statistics to prove this. > > > > XX > > XX tsc_skew[i] = tgt_cpu_tsc - hst_cpu_tsc; > > > > This has even more complicated ordering. The IPC delay depends on the > > internals of smp_rendezvous_cpus(). > > > > It should work better to schedule comparisons of 2 CPUs using a third CPU > > (this is possible except with precisely 2 CPUs). 2 CPUs sit waiting for > > permission to read their TSC. Another CPU sets a variable to grant > > permission. > > > > I plan to try a variation of this: all CPUs spin reading the TSC and > > appending the result atomically to a log buffer. Then analyze the > results. > > With no skew or interrupts, it is expected that the results are almost > > monotonic. Contention causes non-monotonicity only occasionally. The > > average non-mononicity should be 0. If there is significant skew, then > > the order for the sameples form each pair of CPUs will reverse on almost > > every second reading. The skew is the adjustment needed to stop this > > reversal. > > > > Logs of the TSC for a single CPU show that the granularity is about 18 > > on freefall's Xeon. I don't know yet if this is more closely related to > > the clock rate or the rdtsc latency. The TSC frequency is 3.3GHz. I > > recently learned that a common implementation uses a shared clock of > > frequency only 100 MHz. With no interpolation of this, the granularity > > is 33 cycles. rdtsc itself takes about 18 cycles, so not much is gained > > from any interpolation, but some seems to be done. > > > > On Haswell i4790K at 4 GHz, IIRC rdtsc seemed to take 24 cycles. I > haven't > > done the test to see if non-multiples of 24 are returned. A 100 MHz > clock > > would have a granularity of 40 cycles, so there is apparently some > > interpolation. > > > > A commit log message by mav@ says that some Skylakes never return odd > values > > for rdtsc, and some appear to have a granularity of about 186 (?) cycles. > > freefall's Xeon does return odd values for rdtsc. > > > > XX } > > XX sched_unpin(); > > XX } > > XX ... > > XX /* > > XX * DTrace needs a high resolution time function which can > > XX * be called from a probe context and guaranteed not to have > > XX * instrumented with probes itself. > > XX * > > XX * Returns nanoseconds since boot. > > XX */ > > > > dtrace does too much hand-rolling here, but it has to do something > > to handle the 2 problems mentioned in the comment. Other subsystems > > handle this worse (*). > > > > But it shouldn't try harder than the TSC timecounters to handle skew. > > The TSC timecounter ignores the problem of skew, but does other things > > more carefully. > > It comes from Solaris/illumos, which uses the following technique to > measure skew during boot: > > AP i: > while (!flag) > tsc[i] = rdtsc(); > > BSP: > flag = 1; > mfence(); > tsc = rdtsc(); > skew[i] = tsc - tsc[i]; > if (skew[i] < 0) > skew[i] = -skew[i]; > > There are some heuristics that attempt to correct for the latency > added by the mfence(). > > I don't think it makes much sense to measure skew on systems with an > invariant TSC. If the TSC is not invariant, measuring it once at load > time is likely not enough. Based on TSC-invariant systems I looked at, > the measured skew is small enough that the erroneous deltas probably > don't cause much harm. In VMs, the deltas are large enough that they > create noticeable problems. > It's also the variance and delta over time that creates the problems. If they were fixed but large, who cares, but the VM doesn't tick things well enough for them to be that. Warner From owner-svn-src-head@freebsd.org Thu Mar 21 19:52:51 2019 Return-Path: Delivered-To: svn-src-head@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 CAFCC154D60A; Thu, 21 Mar 2019 19:52:51 +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 69A3B75A9E; Thu, 21 Mar 2019 19:52:51 +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 5FFD4DC0B; Thu, 21 Mar 2019 19:52:51 +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 x2LJqpts068991; Thu, 21 Mar 2019 19:52:51 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2LJqoUq068988; Thu, 21 Mar 2019 19:52:50 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201903211952.x2LJqoUq068988@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 21 Mar 2019 19:52:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345382 - in head/sys: amd64/amd64 i386/i386 vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: amd64/amd64 i386/i386 vm X-SVN-Commit-Revision: 345382 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 69A3B75A9E 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.979,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 19:52:52 -0000 Author: markj Date: Thu Mar 21 19:52:50 2019 New Revision: 345382 URL: https://svnweb.freebsd.org/changeset/base/345382 Log: Disallow preemptive creation of wired superpage mappings. There are some unusual cases where a process may cause an mlock()ed range of memory to be unmapped. If the application subsequently faults on that region, the handler may attempt to create a superpage mapping backed by the resident, wired pages. However, the pmap code responsible for creating such a mapping (pmap_enter_pde() on i386 and amd64) does not ensure that a leaf page table page is available if the superpage is later demoted; the demotion operation must therefore perform a non-blocking page allocation and must unmap the entire superpage if the allocation fails. The pmap layer ensures that this can never happen for wired mappings, and so the case described above breaks that invariant. For now, simply ensure that the MI fault handler never attempts to create a wired superpage except via promotion. Reviewed by: kib Reported by: syzbot+292d3b0416c27c131505@syzkaller.appspotmail.com MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D19670 Modified: head/sys/amd64/amd64/pmap.c head/sys/i386/i386/pmap.c head/sys/vm/vm_fault.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Thu Mar 21 16:15:29 2019 (r345381) +++ head/sys/amd64/amd64/pmap.c Thu Mar 21 19:52:50 2019 (r345382) @@ -5308,6 +5308,8 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t pt_entry_t PG_G, PG_RW, PG_V; vm_page_t mt, pdpg; + KASSERT(pmap == kernel_pmap || (newpde & PG_W) == 0, + ("pmap_enter_pde: cannot create wired user mapping")); PG_G = pmap_global_bit(pmap); PG_RW = pmap_rw_bit(pmap); KASSERT((newpde & (pmap_modified_bit(pmap) | PG_RW)) != PG_RW, Modified: head/sys/i386/i386/pmap.c ============================================================================== --- head/sys/i386/i386/pmap.c Thu Mar 21 16:15:29 2019 (r345381) +++ head/sys/i386/i386/pmap.c Thu Mar 21 19:52:50 2019 (r345382) @@ -3882,6 +3882,8 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t va, pd_entry_t rw_assert(&pvh_global_lock, RA_WLOCKED); KASSERT((newpde & (PG_M | PG_RW)) != PG_RW, ("pmap_enter_pde: newpde is missing PG_M")); + KASSERT(pmap == kernel_pmap || (newpde & PG_W) == 0, + ("pmap_enter_pde: cannot create wired user mapping")); PMAP_LOCK_ASSERT(pmap, MA_OWNED); pde = pmap_pde(pmap, va); oldpde = *pde; Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Thu Mar 21 16:15:29 2019 (r345381) +++ head/sys/vm/vm_fault.c Thu Mar 21 19:52:50 2019 (r345382) @@ -294,7 +294,7 @@ vm_fault_soft_fast(struct faultstate *fs, vm_offset_t rounddown2(vaddr, pagesizes[m_super->psind]) >= fs->entry->start && roundup2(vaddr + 1, pagesizes[m_super->psind]) <= fs->entry->end && (vaddr & (pagesizes[m_super->psind] - 1)) == (VM_PAGE_TO_PHYS(m) & - (pagesizes[m_super->psind] - 1)) && + (pagesizes[m_super->psind] - 1)) && !wired && pmap_ps_enabled(fs->map->pmap)) { flags = PS_ALL_VALID; if ((prot & VM_PROT_WRITE) != 0) { @@ -469,7 +469,7 @@ vm_fault_populate(struct faultstate *fs, vm_prot_t pro psind = m->psind; if (psind > 0 && ((vaddr & (pagesizes[psind] - 1)) != 0 || pidx + OFF_TO_IDX(pagesizes[psind]) - 1 > pager_last || - !pmap_ps_enabled(fs->map->pmap))) + !pmap_ps_enabled(fs->map->pmap) || wired)) psind = 0; #else psind = 0; From owner-svn-src-head@freebsd.org Thu Mar 21 20:07:51 2019 Return-Path: Delivered-To: svn-src-head@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 BF68A154DA6B; Thu, 21 Mar 2019 20:07:51 +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 58A87761C1; Thu, 21 Mar 2019 20:07:51 +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 EB5FBDDB8; Thu, 21 Mar 2019 20:07:50 +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 x2LK7oHd074365; Thu, 21 Mar 2019 20:07:50 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2LK7orn074363; Thu, 21 Mar 2019 20:07:50 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201903212007.x2LK7orn074363@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 21 Mar 2019 20:07:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345384 - in head/sys/cddl/dev/dtrace: amd64 i386 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys/cddl/dev/dtrace: amd64 i386 X-SVN-Commit-Revision: 345384 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 58A87761C1 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_SHORT(-0.98)[-0.978,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 20:07:51 -0000 Author: markj Date: Thu Mar 21 20:07:50 2019 New Revision: 345384 URL: https://svnweb.freebsd.org/changeset/base/345384 Log: Use an explicit comparison with VM_GUEST_NO. Reported by: jhb MFC with: r345359 Sponsored by: The FreeBSD Foundation Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c head/sys/cddl/dev/dtrace/i386/dtrace_subr.c Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c ============================================================================== --- head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Thu Mar 21 19:56:33 2019 (r345383) +++ head/sys/cddl/dev/dtrace/amd64/dtrace_subr.c Thu Mar 21 20:07:50 2019 (r345384) @@ -319,7 +319,7 @@ dtrace_gethrtime_init(void *arg) int i; #endif - if (vm_guest) + if (vm_guest != VM_GUEST_NO) return; /* The current CPU is the reference one. */ Modified: head/sys/cddl/dev/dtrace/i386/dtrace_subr.c ============================================================================== --- head/sys/cddl/dev/dtrace/i386/dtrace_subr.c Thu Mar 21 19:56:33 2019 (r345383) +++ head/sys/cddl/dev/dtrace/i386/dtrace_subr.c Thu Mar 21 20:07:50 2019 (r345384) @@ -321,7 +321,7 @@ dtrace_gethrtime_init(void *arg) int i; #endif - if (vm_guest) + if (vm_guest != VM_GUEST_NO) return; /* The current CPU is the reference one. */ From owner-svn-src-head@freebsd.org Thu Mar 21 21:14:26 2019 Return-Path: Delivered-To: svn-src-head@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 BB19D154FA69; Thu, 21 Mar 2019 21:14:26 +0000 (UTC) (envelope-from trasz@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 5E44680CA8; Thu, 21 Mar 2019 21:14:26 +0000 (UTC) (envelope-from trasz@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 42892EA14; Thu, 21 Mar 2019 21:14:26 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2LLEQ3v011326; Thu, 21 Mar 2019 21:14:26 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2LLEQBL011325; Thu, 21 Mar 2019 21:14:26 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201903212114.x2LLEQBL011325@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 21 Mar 2019 21:14:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345385 - head/sys/dev/smartpqi X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/dev/smartpqi X-SVN-Commit-Revision: 345385 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5E44680CA8 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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 21:14:26 -0000 Author: trasz Date: Thu Mar 21 21:14:25 2019 New Revision: 345385 URL: https://svnweb.freebsd.org/changeset/base/345385 Log: Fix smartpqi(4) malloc tag and description to match the driver name. No functional changes. Reviewed by: sbruno MFC after: 2 weeks Sponsored by: Klara Inc. Differential Revision: https://reviews.freebsd.org/D19625 Modified: head/sys/dev/smartpqi/smartpqi_mem.c Modified: head/sys/dev/smartpqi/smartpqi_mem.c ============================================================================== --- head/sys/dev/smartpqi/smartpqi_mem.c Thu Mar 21 20:07:50 2019 (r345384) +++ head/sys/dev/smartpqi/smartpqi_mem.c Thu Mar 21 21:14:25 2019 (r345385) @@ -28,7 +28,7 @@ #include "smartpqi_includes.h" -MALLOC_DEFINE(M_SMARTRAID, "smartraidbuf", "Buffers for the smartraid driver"); +MALLOC_DEFINE(M_SMARTPQI, "smartpqi", "Buffers for the smartpqi(4) driver"); /* * DMA map load callback function @@ -133,7 +133,7 @@ void *os_mem_alloc(pqisrc_softstate_t *softs, size_t /* DBG_FUNC("IN\n"); */ - addr = malloc((unsigned long)size, M_SMARTRAID, + addr = malloc((unsigned long)size, M_SMARTPQI, M_NOWAIT | M_ZERO); /* DBG_FUNC("OUT\n"); */ @@ -149,7 +149,7 @@ void os_mem_free(pqisrc_softstate_t *softs, { /* DBG_FUNC("IN\n"); */ - free((void*)addr, M_SMARTRAID); + free((void*)addr, M_SMARTPQI); /* DBG_FUNC("OUT\n"); */ } From owner-svn-src-head@freebsd.org Thu Mar 21 21:43:24 2019 Return-Path: Delivered-To: svn-src-head@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 CC0AB15506DC; Thu, 21 Mar 2019 21:43:24 +0000 (UTC) (envelope-from jkim@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 6817E81EB9; Thu, 21 Mar 2019 21:43:24 +0000 (UTC) (envelope-from jkim@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 508ADEF5B; Thu, 21 Mar 2019 21:43:24 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2LLhO61026858; Thu, 21 Mar 2019 21:43:24 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2LLhNZA026856; Thu, 21 Mar 2019 21:43:23 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201903212143.x2LLhNZA026856@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Thu, 21 Mar 2019 21:43:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345387 - in head/share: examples/etc mk X-SVN-Group: head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in head/share: examples/etc mk X-SVN-Commit-Revision: 345387 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 6817E81EB9 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.96)[-0.961,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 21:43:25 -0000 Author: jkim Date: Thu Mar 21 21:43:23 2019 New Revision: 345387 URL: https://svnweb.freebsd.org/changeset/base/345387 Log: Catch up with Clang 7.0. MFC after: 3 days Modified: head/share/examples/etc/make.conf head/share/mk/bsd.cpu.mk Modified: head/share/examples/etc/make.conf ============================================================================== --- head/share/examples/etc/make.conf Thu Mar 21 21:41:07 2019 (r345386) +++ head/share/examples/etc/make.conf Thu Mar 21 21:43:23 2019 (r345387) @@ -45,7 +45,8 @@ # Additionally the following CPU types are recognized by clang: # Intel x86 architecture (for both amd64 and i386): # (AMD CPUs) znver1, bdver4, bdver3, bdver2, bdver1, btver2, btver1 -# (Intel CPUs) cannonlake, knm, skylake-avx512, knl, goldmont, +# (Intel CPUs) tremont, goldmont-plus, icelake-server, icelake-client, +# cannonlake, knm, skylake-avx512, knl, goldmont, # skylake, broadwell, haswell, ivybridge, # sandybridge, westmere, nehalem, silvermont, bonnell # Modified: head/share/mk/bsd.cpu.mk ============================================================================== --- head/share/mk/bsd.cpu.mk Thu Mar 21 21:41:07 2019 (r345386) +++ head/share/mk/bsd.cpu.mk Thu Mar 21 21:43:23 2019 (r345387) @@ -31,6 +31,8 @@ MACHINE_CPU = ultrasparc . if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" . if ${CPUTYPE} == "barcelona" CPUTYPE = amdfam10 +. elif ${CPUTYPE} == "skx" +CPUTYPE = skylake-avx512 . elif ${CPUTYPE} == "core-avx2" CPUTYPE = haswell . elif ${CPUTYPE} == "core-avx-i" @@ -199,7 +201,8 @@ MACHINE_CPU = 3dnow mmx k6 k5 i586 MACHINE_CPU = mmx k6 k5 i586 . elif ${CPUTYPE} == "k5" MACHINE_CPU = k5 i586 -. elif ${CPUTYPE} == "cannonlake" || ${CPUTYPE} == "knm" || \ +. elif ${CPUTYPE} == "icelake-server" || ${CPUTYPE} == "icelake-client" || \ + ${CPUTYPE} == "cannonlake" || ${CPUTYPE} == "knm" || \ ${CPUTYPE} == "skylake-avx512" || ${CPUTYPE} == "knl" MACHINE_CPU = avx512 avx2 avx sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586 . elif ${CPUTYPE} == "skylake" || ${CPUTYPE} == "broadwell" || \ @@ -207,7 +210,8 @@ MACHINE_CPU = avx512 avx2 avx sse42 sse41 ssse3 sse3 s MACHINE_CPU = avx2 avx sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586 . elif ${CPUTYPE} == "ivybridge" || ${CPUTYPE} == "sandybridge" MACHINE_CPU = avx sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586 -. elif ${CPUTYPE} == "goldmont" || ${CPUTYPE} == "westmere" || \ +. elif ${CPUTYPE} == "tremont" || ${CPUTYPE} == "goldmont-plus" || \ + ${CPUTYPE} == "goldmont" || ${CPUTYPE} == "westmere" || \ ${CPUTYPE} == "nehalem" || ${CPUTYPE} == "silvermont" MACHINE_CPU = sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586 . elif ${CPUTYPE} == "penryn" @@ -262,7 +266,8 @@ MACHINE_CPU = k8 3dnow sse3 . elif ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || \ ${CPUTYPE} == "athlon-fx" || ${CPUTYPE} == "k8" MACHINE_CPU = k8 3dnow -. elif ${CPUTYPE} == "cannonlake" || ${CPUTYPE} == "knm" || \ +. elif ${CPUTYPE} == "icelake-server" || ${CPUTYPE} == "icelake-client" || \ + ${CPUTYPE} == "cannonlake" || ${CPUTYPE} == "knm" || \ ${CPUTYPE} == "skylake-avx512" || ${CPUTYPE} == "knl" MACHINE_CPU = avx512 avx2 avx sse42 sse41 ssse3 sse3 . elif ${CPUTYPE} == "skylake" || ${CPUTYPE} == "broadwell" || \ @@ -270,7 +275,8 @@ MACHINE_CPU = avx512 avx2 avx sse42 sse41 ssse3 sse3 MACHINE_CPU = avx2 avx sse42 sse41 ssse3 sse3 . elif ${CPUTYPE} == "ivybridge" || ${CPUTYPE} == "sandybridge" MACHINE_CPU = avx sse42 sse41 ssse3 sse3 -. elif ${CPUTYPE} == "goldmont" || ${CPUTYPE} == "westmere" || \ +. elif ${CPUTYPE} == "tremont" || ${CPUTYPE} == "goldmont-plus" || \ + ${CPUTYPE} == "goldmont" || ${CPUTYPE} == "westmere" || \ ${CPUTYPE} == "nehalem" || ${CPUTYPE} == "silvermont" MACHINE_CPU = sse42 sse41 ssse3 sse3 . elif ${CPUTYPE} == "penryn" From owner-svn-src-head@freebsd.org Thu Mar 21 21:45:03 2019 Return-Path: Delivered-To: svn-src-head@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 BE407155079F; Thu, 21 Mar 2019 21:45:03 +0000 (UTC) (envelope-from jkim@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 2F3C5820A9; Thu, 21 Mar 2019 21:45:03 +0000 (UTC) (envelope-from jkim@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 E0C0CEF5D; Thu, 21 Mar 2019 21:45:02 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2LLj2E2026995; Thu, 21 Mar 2019 21:45:02 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2LLj2j5026993; Thu, 21 Mar 2019 21:45:02 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201903212145.x2LLj2j5026993@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Thu, 21 Mar 2019 21:45:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345388 - in head/share: examples/etc mk X-SVN-Group: head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: in head/share: examples/etc mk X-SVN-Commit-Revision: 345388 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2F3C5820A9 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.96)[-0.961,0]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Mar 2019 21:45:04 -0000 Author: jkim Date: Thu Mar 21 21:45:02 2019 New Revision: 345388 URL: https://svnweb.freebsd.org/changeset/base/345388 Log: Catch up with Clang 8.0. Modified: head/share/examples/etc/make.conf head/share/mk/bsd.cpu.mk Modified: head/share/examples/etc/make.conf ============================================================================== --- head/share/examples/etc/make.conf Thu Mar 21 21:43:23 2019 (r345387) +++ head/share/examples/etc/make.conf Thu Mar 21 21:45:02 2019 (r345388) @@ -45,9 +45,9 @@ # Additionally the following CPU types are recognized by clang: # Intel x86 architecture (for both amd64 and i386): # (AMD CPUs) znver1, bdver4, bdver3, bdver2, bdver1, btver2, btver1 -# (Intel CPUs) tremont, goldmont-plus, icelake-server, icelake-client, -# cannonlake, knm, skylake-avx512, knl, goldmont, -# skylake, broadwell, haswell, ivybridge, +# (Intel CPUs) cascadelake, tremont, goldmont-plus, icelake-server, +# icelake-client, cannonlake, knm, skylake-avx512, knl, +# goldmont, skylake, broadwell, haswell, ivybridge, # sandybridge, westmere, nehalem, silvermont, bonnell # # (?= allows to buildworld for a different CPUTYPE.) Modified: head/share/mk/bsd.cpu.mk ============================================================================== --- head/share/mk/bsd.cpu.mk Thu Mar 21 21:43:23 2019 (r345387) +++ head/share/mk/bsd.cpu.mk Thu Mar 21 21:45:02 2019 (r345388) @@ -201,9 +201,10 @@ MACHINE_CPU = 3dnow mmx k6 k5 i586 MACHINE_CPU = mmx k6 k5 i586 . elif ${CPUTYPE} == "k5" MACHINE_CPU = k5 i586 -. elif ${CPUTYPE} == "icelake-server" || ${CPUTYPE} == "icelake-client" || \ - ${CPUTYPE} == "cannonlake" || ${CPUTYPE} == "knm" || \ - ${CPUTYPE} == "skylake-avx512" || ${CPUTYPE} == "knl" +. elif ${CPUTYPE} == "cascadelake" || ${CPUTYPE} == "icelake-server" || \ + ${CPUTYPE} == "icelake-client" || ${CPUTYPE} == "cannonlake" || \ + ${CPUTYPE} == "knm" || ${CPUTYPE} == "skylake-avx512" || \ + ${CPUTYPE} == "knl" MACHINE_CPU = avx512 avx2 avx sse42 sse41 ssse3 sse3 sse2 sse i686 mmx i586 . elif ${CPUTYPE} == "skylake" || ${CPUTYPE} == "broadwell" || \ ${CPUTYPE} == "haswell" @@ -266,9 +267,10 @@ MACHINE_CPU = k8 3dnow sse3 . elif ${CPUTYPE} == "opteron" || ${CPUTYPE} == "athlon64" || \ ${CPUTYPE} == "athlon-fx" || ${CPUTYPE} == "k8" MACHINE_CPU = k8 3dnow -. elif ${CPUTYPE} == "icelake-server" || ${CPUTYPE} == "icelake-client" || \ - ${CPUTYPE} == "cannonlake" || ${CPUTYPE} == "knm" || \ - ${CPUTYPE} == "skylake-avx512" || ${CPUTYPE} == "knl" +. elif ${CPUTYPE} == "cascadelake" || ${CPUTYPE} == "icelake-server" || \ + ${CPUTYPE} == "icelake-client" || ${CPUTYPE} == "cannonlake" || \ + ${CPUTYPE} == "knm" || ${CPUTYPE} == "skylake-avx512" || \ + ${CPUTYPE} == "knl" MACHINE_CPU = avx512 avx2 avx sse42 sse41 ssse3 sse3 . elif ${CPUTYPE} == "skylake" || ${CPUTYPE} == "broadwell" || \ ${CPUTYPE} == "haswell" From owner-svn-src-head@freebsd.org Fri Mar 22 01:30:53 2019 Return-Path: Delivered-To: svn-src-head@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 2E2E11555729; Fri, 22 Mar 2019 01:30:53 +0000 (UTC) (envelope-from cy@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 CAEDD89219; Fri, 22 Mar 2019 01:30:52 +0000 (UTC) (envelope-from cy@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 86A7E194D1; Fri, 22 Mar 2019 01:30:52 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2M1UqMm042375; Fri, 22 Mar 2019 01:30:52 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2M1Uq0p042374; Fri, 22 Mar 2019 01:30:52 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201903220130.x2M1Uq0p042374@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 22 Mar 2019 01:30:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345400 - in head/libexec/rc: . rc.d X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in head/libexec/rc: . rc.d X-SVN-Commit-Revision: 345400 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CAEDD89219 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.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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2019 01:30:53 -0000 Author: cy Date: Fri Mar 22 01:30:51 2019 New Revision: 345400 URL: https://svnweb.freebsd.org/changeset/base/345400 Log: Add rc.d support for ippool(8). I've been using ippool at my site for approximately two years. It's about time this was committed. PR: 218433 MFC after: 2 weeks Added: head/libexec/rc/rc.d/ippool (contents, props changed) Modified: head/libexec/rc/rc.conf Modified: head/libexec/rc/rc.conf ============================================================================== --- head/libexec/rc/rc.conf Thu Mar 21 23:31:10 2019 (r345399) +++ head/libexec/rc/rc.conf Fri Mar 22 01:30:51 2019 (r345400) @@ -196,6 +196,10 @@ ipfilter_program="/sbin/ipf" # where the ipfilter prog ipfilter_rules="/etc/ipf.rules" # rules definition file for ipfilter, see # /usr/src/contrib/ipfilter/rules for examples ipfilter_flags="" # additional flags for ipfilter +ippool_enable="NO" # Set to YES to enable ip filter pools +ippool_program="/sbin/ippool" # where the ippool program lives +ippool_rules="/etc/ippool.tables" # rules definition file for ippool +ippool_flags="" # additional flags for ippool ipnat_enable="NO" # Set to YES to enable ipnat functionality ipnat_program="/sbin/ipnat" # where the ipnat program lives ipnat_rules="/etc/ipnat.rules" # rules definition file for ipnat Added: head/libexec/rc/rc.d/ippool ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/libexec/rc/rc.d/ippool Fri Mar 22 01:30:51 2019 (r345400) @@ -0,0 +1,40 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: ippool +# REQUIRE: FILESYSTEMS +# BEFORE: ipfilter +# KEYWORD: nojail + +. /etc/rc.subr + +name="ippool" +desc="user interface to the IPFilter pools" +rcvar="ippool_enable" +load_rc_config $name +start_cmd="ippool_start" +stop_cmd="${ippool_program} -F" +reload_cmd="ippool_reload" +extra_commands="reload" +required_files="${ippool_rules}" +required_modules="ipl:ipfilter" + +ippool_start() +{ + if [ -r "${ippool_rules}" ]; then + echo "Loading IP Pools." + ${ippool_program} -f ${ippool_rules} ${ippool_flags} + fi +} + +ippool_reload() +{ + echo "Reloading IP Pools." + ${ippool_program} -F + ippool_start +} + + +run_rc_command "$1" From owner-svn-src-head@freebsd.org Fri Mar 22 01:42:28 2019 Return-Path: Delivered-To: svn-src-head@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 4E6271555C7A; Fri, 22 Mar 2019 01:42:28 +0000 (UTC) (envelope-from cy@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 E557B899D2; Fri, 22 Mar 2019 01:42:27 +0000 (UTC) (envelope-from cy@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 D719F19808; Fri, 22 Mar 2019 01:42:27 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2M1gRkb052693; Fri, 22 Mar 2019 01:42:27 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2M1gRI8052692; Fri, 22 Mar 2019 01:42:27 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201903220142.x2M1gRI8052692@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 22 Mar 2019 01:42:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345401 - head/libexec/rc/rc.d X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/libexec/rc/rc.d X-SVN-Commit-Revision: 345401 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E557B899D2 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.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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2019 01:42:28 -0000 Author: cy Date: Fri Mar 22 01:42:27 2019 New Revision: 345401 URL: https://svnweb.freebsd.org/changeset/base/345401 Log: From r345400, connect ippool to the build/install. PR: 218433 MFC after: 2 weeks X-MFC with: r345400 Modified: head/libexec/rc/rc.d/Makefile Modified: head/libexec/rc/rc.d/Makefile ============================================================================== --- head/libexec/rc/rc.d/Makefile Fri Mar 22 01:30:51 2019 (r345400) +++ head/libexec/rc/rc.d/Makefile Fri Mar 22 01:42:27 2019 (r345401) @@ -215,7 +215,8 @@ CONFS+= inetd CONFS+= ipfilter \ ipfs \ ipmon \ - ipnat + ipnat \ + ippool .endif .if ${MK_IPFW} != "no" From owner-svn-src-head@freebsd.org Fri Mar 22 01:43:32 2019 Return-Path: Delivered-To: svn-src-head@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 6AE001555D5A; Fri, 22 Mar 2019 01:43:32 +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 0AC4089C2E; Fri, 22 Mar 2019 01:43:32 +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 DA80A19819; Fri, 22 Mar 2019 01:43:31 +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 x2M1hVhl052954; Fri, 22 Mar 2019 01:43:31 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2M1hVvr052953; Fri, 22 Mar 2019 01:43:31 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201903220143.x2M1hVvr052953@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 22 Mar 2019 01:43:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345402 - head/sys/powerpc/aim X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/aim X-SVN-Commit-Revision: 345402 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0AC4089C2E 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.969,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2019 01:43:32 -0000 Author: jhibbits Date: Fri Mar 22 01:43:31 2019 New Revision: 345402 URL: https://svnweb.freebsd.org/changeset/base/345402 Log: powerpc64: Handle the modern (2.05+) implementaiton of tlbie By happenstance gcc4 puts 'vpn' into r0 in all uses of TLBIE(), but modern gcc does not. Also, the single-argument form of tlbie zeros all unused arguments, making the modern tlbie instruction use r0 as the RS field (LPID). The vpn argument has the bottom 12 bits cleared (the input having been left-shifted by 12 bits), which just so happens, on the POWER9 and previous incarnations, to be the number of LPID bits supported. With those bits being zero, the instruction: tlbie r0, r0 will invalidate the VPN in r0, in LPAR 0 (ignoring the upper bits of r0 for the RS field). One build with gcc8 yields: tlbie r9, r0 with r0 having arbitrary contents, not equal to r9. This leads to strange crashes, behaviors, and panics, due to the requested TLB entry not actually being invalidated. As the moea64_native must work on both old and new, we explicitly zero out r0 so that it can work with only the single argument, built with base gcc and modern gcc. isa3_hashtb takes a different approach, encoding the two-argument form, soas not to explicitly clobber r0, and instead let the compiler decide. Reported by: Brandon Bergren Tested by: Brandon Bergren MFC after: 1 week Modified: head/sys/powerpc/aim/isa3_hashtb.c head/sys/powerpc/aim/moea64_native.c Modified: head/sys/powerpc/aim/isa3_hashtb.c ============================================================================== --- head/sys/powerpc/aim/isa3_hashtb.c Fri Mar 22 01:42:27 2019 (r345401) +++ head/sys/powerpc/aim/isa3_hashtb.c Fri Mar 22 01:43:31 2019 (r345402) @@ -139,7 +139,8 @@ TLBIE(uint64_t vpn) { vpn <<= ADDR_PIDX_SHFT; - __asm __volatile("tlbie %0" :: "r"(vpn) : "memory"); + __asm __volatile(".long 0x7c000264 | (%0 << 11) | (%1 << 21)" + :: "r"(vpn), "r"(0) : "memory"); __asm __volatile("eieio; tlbsync; ptesync" ::: "memory"); } Modified: head/sys/powerpc/aim/moea64_native.c ============================================================================== --- head/sys/powerpc/aim/moea64_native.c Fri Mar 22 01:42:27 2019 (r345401) +++ head/sys/powerpc/aim/moea64_native.c Fri Mar 22 01:43:31 2019 (r345402) @@ -156,7 +156,7 @@ TLBIE(uint64_t vpn) { vpn &= ~(0xffffULL << 48); #ifdef __powerpc64__ - __asm __volatile("tlbie %0" :: "r"(vpn) : "memory"); + __asm __volatile("li 0, 0; tlbie %0" :: "r"(vpn) : "0","memory"); __asm __volatile("eieio; tlbsync; ptesync" ::: "memory"); #else vpn_hi = (uint32_t)(vpn >> 32); From owner-svn-src-head@freebsd.org Fri Mar 22 01:43:56 2019 Return-Path: Delivered-To: svn-src-head@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 285381555D9D; Fri, 22 Mar 2019 01:43:56 +0000 (UTC) (envelope-from cy@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 BA8CE89D70; Fri, 22 Mar 2019 01:43:55 +0000 (UTC) (envelope-from cy@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 AD0991981A; Fri, 22 Mar 2019 01:43:55 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2M1htrr053012; Fri, 22 Mar 2019 01:43:55 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2M1ht7b053011; Fri, 22 Mar 2019 01:43:55 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201903220143.x2M1ht7b053011@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 22 Mar 2019 01:43:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345403 - head/tools/build/mk X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/tools/build/mk X-SVN-Commit-Revision: 345403 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BA8CE89D70 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.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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2019 01:43:56 -0000 Author: cy Date: Fri Mar 22 01:43:55 2019 New Revision: 345403 URL: https://svnweb.freebsd.org/changeset/base/345403 Log: From r345400, remove the ippool rc script when ipfilter is not wanted by the user. PR: 218433 MFC after: 2 weeks X-MFC with: r345400 Modified: head/tools/build/mk/OptionalObsoleteFiles.inc Modified: head/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- head/tools/build/mk/OptionalObsoleteFiles.inc Fri Mar 22 01:43:31 2019 (r345402) +++ head/tools/build/mk/OptionalObsoleteFiles.inc Fri Mar 22 01:43:55 2019 (r345403) @@ -3262,6 +3262,7 @@ OLD_FILES+=etc/rc.d/ipfilter OLD_FILES+=etc/rc.d/ipfs OLD_FILES+=etc/rc.d/ipmon OLD_FILES+=etc/rc.d/ipnat +OLD_FILES+=etc/rc.d/ippool OLD_FILES+=rescue/ipf OLD_FILES+=sbin/ipf OLD_FILES+=sbin/ipfs From owner-svn-src-head@freebsd.org Fri Mar 22 04:57:01 2019 Return-Path: Delivered-To: svn-src-head@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 B918E155A25B; Fri, 22 Mar 2019 04:57:01 +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 B071869BB0; Fri, 22 Mar 2019 04:57:00 +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 x2M4uuQK063551; Thu, 21 Mar 2019 21:56:56 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x2M4uuS6063550; Thu, 21 Mar 2019 21:56:56 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201903220456.x2M4uuS6063550@gndrsh.dnsmgr.net> Subject: Re: svn commit: r345365 - head/bin/date In-Reply-To: To: Warner Losh Date: Thu, 21 Mar 2019 21:56:56 -0700 (PDT) CC: Ian Lepore , Warner Losh , src-committers , svn-src-all , svn-src-head 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: B071869BB0 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.87 / 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.87)[-0.871,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2019 04:57:01 -0000 > On Thu, Mar 21, 2019 at 9:24 AM Ian Lepore wrote: > > > On Thu, 2019-03-21 at 06:47 +0000, Warner Losh wrote: > > > Author: imp > > > Date: Thu Mar 21 06:47:23 2019 > > > New Revision: 345365 > > > URL: https://svnweb.freebsd.org/changeset/base/345365 > > > > > > Log: > > > Remove -n flag, fix setting date / time > > > > > > > IMO, the -n flag should still be accepted, but ignored, to provide > > compatibility with anybody's old scripts or other automation that uses > > date -n, since the new default behavior is exactly what the old -n flag > > provided. > > > > On the other hand, the fact that date(1) has failed to set the date for > > about 3 months shows that it isn't a heavily-used command. > > > > I read this a few hours ago and thought "nope, well, maybe" and set it > aside. I'm still ambivalent. I've never used -n when setting the date in my > entire career. I didn't even know what it was when this bug was brought up. When timed was kicked out of base some people rasied there hands about the fact they used it, perhaps go back to that and ask them about this use of -n and if just defaulting to always doing that is or isnt an issue for them. > so on the one hand it's easy enough to ignore, on the other we have enough > ignore for compatibility junk in the tree... Another item to add to the long list of things to consider in a deprication policy. > Warner -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Fri Mar 22 05:17:14 2019 Return-Path: Delivered-To: svn-src-head@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 93113155A8EB; Fri, 22 Mar 2019 05:17:14 +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 EA40E6A5A4; Fri, 22 Mar 2019 05:17:13 +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 x2M5HBlZ063639; Thu, 21 Mar 2019 22:17:11 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x2M5HBqg063638; Thu, 21 Mar 2019 22:17:11 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201903220517.x2M5HBqg063638@gndrsh.dnsmgr.net> Subject: Re: svn commit: r345400 - in head/libexec/rc: . rc.d In-Reply-To: <201903220130.x2M1Uq0p042374@repo.freebsd.org> To: Cy Schubert Date: Thu, 21 Mar 2019 22:17:11 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@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: EA40E6A5A4 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.89 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.89)[-0.889,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2019 05:17:14 -0000 > Author: cy > Date: Fri Mar 22 01:30:51 2019 > New Revision: 345400 > URL: https://svnweb.freebsd.org/changeset/base/345400 > > Log: > Add rc.d support for ippool(8). > > I've been using ippool at my site for approximately two years. It's > about time this was committed. > > PR: 218433 > MFC after: 2 weeks > > Added: > head/libexec/rc/rc.d/ippool (contents, props changed) > Modified: > head/libexec/rc/rc.conf > > Modified: head/libexec/rc/rc.conf > ============================================================================== > --- head/libexec/rc/rc.conf Thu Mar 21 23:31:10 2019 (r345399) > +++ head/libexec/rc/rc.conf Fri Mar 22 01:30:51 2019 (r345400) > @@ -196,6 +196,10 @@ ipfilter_program="/sbin/ipf" # where the ipfilter prog > ipfilter_rules="/etc/ipf.rules" # rules definition file for ipfilter, see > # /usr/src/contrib/ipfilter/rules for examples > ipfilter_flags="" # additional flags for ipfilter > +ippool_enable="NO" # Set to YES to enable ip filter pools > +ippool_program="/sbin/ippool" # where the ippool program lives > +ippool_rules="/etc/ippool.tables" # rules definition file for ippool > +ippool_flags="" # additional flags for ippool > ipnat_enable="NO" # Set to YES to enable ipnat functionality > ipnat_program="/sbin/ipnat" # where the ipnat program lives > ipnat_rules="/etc/ipnat.rules" # rules definition file for ipnat > > Added: head/libexec/rc/rc.d/ippool > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/libexec/rc/rc.d/ippool Fri Mar 22 01:30:51 2019 (r345400) > @@ -0,0 +1,40 @@ > +#!/bin/sh > +# > +# $FreeBSD$ > +# > + > +# PROVIDE: ippool > +# REQUIRE: FILESYSTEMS > +# BEFORE: ipfilter > +# KEYWORD: nojail > + > +. /etc/rc.subr > + > +name="ippool" > +desc="user interface to the IPFilter pools" > +rcvar="ippool_enable" > +load_rc_config $name > +start_cmd="ippool_start" > +stop_cmd="${ippool_program} -F" > +reload_cmd="ippool_reload" > +extra_commands="reload" > +required_files="${ippool_rules}" > +required_modules="ipl:ipfilter" > + > +ippool_start() > +{ > + if [ -r "${ippool_rules}" ]; then > + echo "Loading IP Pools." > + ${ippool_program} -f ${ippool_rules} ${ippool_flags} > + fi > +} > + > +ippool_reload() > +{ > + echo "Reloading IP Pools." > + ${ippool_program} -F > + ippool_start Couldnt this better be expressed ${stop_cmd} ${start_cmd} > +} > + > + > +run_rc_command "$1" > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Fri Mar 22 06:21:04 2019 Return-Path: Delivered-To: svn-src-head@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 7CBCB155C3A0; Fri, 22 Mar 2019 06:21:04 +0000 (UTC) (envelope-from cperciva@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 1BFD26C5B9; Fri, 22 Mar 2019 06:21:04 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EC1931C699; Fri, 22 Mar 2019 06:21:03 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2M6L3e6098308; Fri, 22 Mar 2019 06:21:03 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2M6L3HD098307; Fri, 22 Mar 2019 06:21:03 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201903220621.x2M6L3HD098307@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Fri, 22 Mar 2019 06:21:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345405 - head/sys/dev/uart X-SVN-Group: head X-SVN-Commit-Author: cperciva X-SVN-Commit-Paths: head/sys/dev/uart X-SVN-Commit-Revision: 345405 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 1BFD26C5B9 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.94)[-0.944,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2019 06:21:04 -0000 Author: cperciva Date: Fri Mar 22 06:21:03 2019 New Revision: 345405 URL: https://svnweb.freebsd.org/changeset/base/345405 Log: Obey SPCR AccessWidth parameter. The "access width" value was hard-coded as 2, indicating 32-bit accesses; instead, use the value specified in the SPCR table. This unbreaks the console on EC2 "A1" family instances. Submitted by: Greg V Modified: head/sys/dev/uart/uart_cpu_arm64.c Modified: head/sys/dev/uart/uart_cpu_arm64.c ============================================================================== --- head/sys/dev/uart/uart_cpu_arm64.c Fri Mar 22 06:02:06 2019 (r345404) +++ head/sys/dev/uart/uart_cpu_arm64.c Fri Mar 22 06:21:03 2019 (r345405) @@ -149,7 +149,7 @@ uart_cpu_acpi_probe(struct uart_class **classp, bus_sp *classp = cd->cd_class; *rclk = 0; - *shiftp = 2; + *shiftp = spcr->SerialPort.AccessWidth - 1; *iowidthp = spcr->SerialPort.BitWidth / 8; out: From owner-svn-src-head@freebsd.org Fri Mar 22 06:28:38 2019 Return-Path: Delivered-To: svn-src-head@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 1D93B155C4BE; Fri, 22 Mar 2019 06:28:38 +0000 (UTC) (envelope-from cperciva@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 B604F6CAAA; Fri, 22 Mar 2019 06:28:37 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F47C1C82D; Fri, 22 Mar 2019 06:28:37 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2M6SbPN002797; Fri, 22 Mar 2019 06:28:37 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2M6SbJh002796; Fri, 22 Mar 2019 06:28:37 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201903220628.x2M6SbJh002796@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Fri, 22 Mar 2019 06:28:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345406 - head/sys/dev/uart X-SVN-Group: head X-SVN-Commit-Author: cperciva X-SVN-Commit-Paths: head/sys/dev/uart X-SVN-Commit-Revision: 345406 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B604F6CAAA 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.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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2019 06:28:38 -0000 Author: cperciva Date: Fri Mar 22 06:28:37 2019 New Revision: 345406 URL: https://svnweb.freebsd.org/changeset/base/345406 Log: Initialize uart_bus_space_mem. This value was being used uninitialized, resulting in predictable issues on systems with memory-mapped UART registers. A case could be made that memmap_bus should be declared in a header rather than being declared in each .c file which needs to refer to it, but that's a broader style question. This commit unbreaks hw.uart.console="mm:..." on ARM64. Submitted by: Greg V Modified: head/sys/dev/uart/uart_cpu_arm64.c Modified: head/sys/dev/uart/uart_cpu_arm64.c ============================================================================== --- head/sys/dev/uart/uart_cpu_arm64.c Fri Mar 22 06:21:03 2019 (r345405) +++ head/sys/dev/uart/uart_cpu_arm64.c Fri Mar 22 06:28:37 2019 (r345406) @@ -65,8 +65,9 @@ __FBSDID("$FreeBSD$"); /* * UART console routines. */ +extern struct bus_space memmap_bus; bus_space_tag_t uart_bus_space_io; -bus_space_tag_t uart_bus_space_mem; +bus_space_tag_t uart_bus_space_mem = &memmap_bus; int uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) From owner-svn-src-head@freebsd.org Fri Mar 22 06:33:27 2019 Return-Path: Delivered-To: svn-src-head@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 687D6155C6B7; Fri, 22 Mar 2019 06:33:27 +0000 (UTC) (envelope-from cperciva@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 077106CEED; Fri, 22 Mar 2019 06:33:27 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D6E581C9CE; Fri, 22 Mar 2019 06:33:26 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2M6XQ78007931; Fri, 22 Mar 2019 06:33:26 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2M6XQCY007930; Fri, 22 Mar 2019 06:33:26 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201903220633.x2M6XQCY007930@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Fri, 22 Mar 2019 06:33:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345407 - head/sys/modules X-SVN-Group: head X-SVN-Commit-Author: cperciva X-SVN-Commit-Paths: head/sys/modules X-SVN-Commit-Revision: 345407 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 077106CEED 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.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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2019 06:33:27 -0000 Author: cperciva Date: Fri Mar 22 06:33:26 2019 New Revision: 345407 URL: https://svnweb.freebsd.org/changeset/base/345407 Log: Build if_ena.ko on arm64. This module provides support for the Amazon Elastic Network Adapter; it was previously only built on x86 architectures, but Amazon EC2 now also has ARM64 instances with this hardware. Submitted by: Greg V Modified: head/sys/modules/Makefile Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Fri Mar 22 06:28:37 2019 (r345406) +++ head/sys/modules/Makefile Fri Mar 22 06:33:26 2019 (r345407) @@ -482,6 +482,7 @@ SUBDIR+= fdt ${MACHINE_CPUARCH} == "i386" SUBDIR+= linprocfs SUBDIR+= linsysfs +_ena= ena .endif .if ${MK_NAND} != "no" || defined(ALL_MODULES) @@ -587,7 +588,6 @@ _cs= cs _dpms= dpms _ed= ed _em= em -_ena= ena _ep= ep _et= et _exca= exca From owner-svn-src-head@freebsd.org Fri Mar 22 06:36:41 2019 Return-Path: Delivered-To: svn-src-head@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 04D18155C754; Fri, 22 Mar 2019 06:36:41 +0000 (UTC) (envelope-from cperciva@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 9B91A6D076; Fri, 22 Mar 2019 06:36:40 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7FDD51C9D1; Fri, 22 Mar 2019 06:36:40 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2M6ae4a008132; Fri, 22 Mar 2019 06:36:40 GMT (envelope-from cperciva@FreeBSD.org) Received: (from cperciva@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2M6aegW008131; Fri, 22 Mar 2019 06:36:40 GMT (envelope-from cperciva@FreeBSD.org) Message-Id: <201903220636.x2M6aegW008131@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cperciva set sender to cperciva@FreeBSD.org using -f From: Colin Percival Date: Fri, 22 Mar 2019 06:36:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345408 - head/sys/arm64/conf X-SVN-Group: head X-SVN-Commit-Author: cperciva X-SVN-Commit-Paths: head/sys/arm64/conf X-SVN-Commit-Revision: 345408 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9B91A6D076 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.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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2019 06:36:41 -0000 Author: cperciva Date: Fri Mar 22 06:36:40 2019 New Revision: 345408 URL: https://svnweb.freebsd.org/changeset/base/345408 Log: Add nvme support to the arm64 GENERIC kernel. Submitted by: Greg V Differential Revision: https://reviews.freebsd.org/D19657 Modified: head/sys/arm64/conf/GENERIC Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Fri Mar 22 06:33:26 2019 (r345407) +++ head/sys/arm64/conf/GENERIC Fri Mar 22 06:36:40 2019 (r345408) @@ -171,6 +171,11 @@ device da # ATA/SCSI peripherals device pass # Passthrough device (direct ATA/SCSI access) +# NVM Express (NVMe) support +device nvme # base NVMe driver +options NVME_USE_NVD=0 # prefer the cam(4) based nda(4) driver +device nvd # expose NVMe namespaces as disks, depends on nvme + # MMC/SD/SDIO Card slot support device sdhci device sdhci_xenon # Marvell Xenon SD/MMC controller From owner-svn-src-head@freebsd.org Fri Mar 22 07:39:29 2019 Return-Path: Delivered-To: svn-src-head@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 820EA155D92D; Fri, 22 Mar 2019 07:39:29 +0000 (UTC) (envelope-from kp@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 216056EAA3; Fri, 22 Mar 2019 07:39:29 +0000 (UTC) (envelope-from kp@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 EE93A1D414; Fri, 22 Mar 2019 07:39:28 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2M7dSqA039532; Fri, 22 Mar 2019 07:39:28 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2M7dSX8039530; Fri, 22 Mar 2019 07:39:28 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201903220739.x2M7dSX8039530@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Fri, 22 Mar 2019 07:39:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345409 - head/tests/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/tests/sys/netpfil/pf X-SVN-Commit-Revision: 345409 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 216056EAA3 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.971,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2019 07:39:29 -0000 Author: kp Date: Fri Mar 22 07:39:28 2019 New Revision: 345409 URL: https://svnweb.freebsd.org/changeset/base/345409 Log: pf tests: Test CVE-2019-5598 Verify that pf correctly drops inconsistent ICMP packets (i.e. where the IP src/dst do not match the IP src/dst in the ICMP packet. Added: head/tests/sys/netpfil/pf/CVE-2019-5598.py (contents, props changed) head/tests/sys/netpfil/pf/icmp.sh (contents, props changed) Modified: head/tests/sys/netpfil/pf/Makefile Added: head/tests/sys/netpfil/pf/CVE-2019-5598.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netpfil/pf/CVE-2019-5598.py Fri Mar 22 07:39:28 2019 (r345409) @@ -0,0 +1,130 @@ +#!/usr/local/bin/python2.7 + +import argparse +import scapy.all as sp +import sys +from sniffer import Sniffer + +def check_icmp_error(args, packet): + ip = packet.getlayer(sp.IP) + if not ip: + return False + if ip.dst != args.to[0]: + return False + + icmp = packet.getlayer(sp.ICMP) + if not icmp: + return False + if icmp.type != 3 or icmp.code != 3: + return False + + return True + +def main(): + parser = argparse.ArgumentParser("CVE-2019-icmp.py", + description="CVE-2019-icmp test tool") + parser.add_argument('--sendif', nargs=1, + required=True, + help='The interface through which the packet will be sent') + parser.add_argument('--recvif', nargs=1, + required=True, + help='The interface on which to check for the packet') + parser.add_argument('--src', nargs=1, + required=True, + help='The source IP address') + parser.add_argument('--to', nargs=1, + required=True, + help='The destination IP address') + + args = parser.parse_args() + + # Send the allowed packet to establish state + udp = sp.Ether() / \ + sp.IP(src=args.src[0], dst=args.to[0]) / \ + sp.UDP(dport=53, sport=1234) + sp.sendp(udp, iface=args.sendif[0], verbose=False) + + # Start sniffing on recvif + sniffer = Sniffer(args, check_icmp_error) + + # Send the bad error packet + icmp_reachable = sp.Ether() / \ + sp.IP(src=args.src[0], dst=args.to[0]) / \ + sp.ICMP(type=3, code=3) / \ + sp.IP(src="4.3.2.1", dst="1.2.3.4") / \ + sp.UDP(dport=53, sport=1234) + sp.sendp(icmp_reachable, iface=args.sendif[0], verbose=False) + + sniffer.join() + if sniffer.foundCorrectPacket: + sys.exit(1) + + sys.exit(0) + +if __name__ == '__main__': + main() +#!/usr/local/bin/python2.7 + +import argparse +import scapy.all as sp +import sys +from sniffer import Sniffer + +def check_icmp_error(args, packet): + ip = packet.getlayer(sp.IP) + if not ip: + return False + if ip.dst != args.to[0]: + return False + + icmp = packet.getlayer(sp.ICMP) + if not icmp: + return False + if icmp.type != 3 or icmp.code != 3: + return False + + return True + +def main(): + parser = argparse.ArgumentParser("CVE-2019-icmp.py", + description="CVE-2019-icmp test tool") + parser.add_argument('--sendif', nargs=1, + required=True, + help='The interface through which the packet will be sent') + parser.add_argument('--recvif', nargs=1, + required=True, + help='The interface on which to check for the packet') + parser.add_argument('--src', nargs=1, + required=True, + help='The source IP address') + parser.add_argument('--to', nargs=1, + required=True, + help='The destination IP address') + + args = parser.parse_args() + + # Send the allowed packet to establish state + udp = sp.Ether() / \ + sp.IP(src=args.src[0], dst=args.to[0]) / \ + sp.UDP(dport=53, sport=1234) + sp.sendp(udp, iface=args.sendif[0], verbose=False) + + # Start sniffing on recvif + sniffer = Sniffer(args, check_icmp_error) + + # Send the bad error packet + icmp_reachable = sp.Ether() / \ + sp.IP(src=args.src[0], dst=args.to[0]) / \ + sp.ICMP(type=3, code=3) / \ + sp.IP(src=args.src[0], dst=args.to[0]) / \ + sp.UDP(dport=53, sport=1234) + sp.sendp(icmp_reachable, iface=args.sendif[0], verbose=False) + + sniffer.join() + if sniffer.foundCorrectPacket: + sys.exit(1) + + sys.exit(0) + +if __name__ == '__main__': + main() Modified: head/tests/sys/netpfil/pf/Makefile ============================================================================== --- head/tests/sys/netpfil/pf/Makefile Fri Mar 22 06:36:40 2019 (r345408) +++ head/tests/sys/netpfil/pf/Makefile Fri Mar 22 07:39:28 2019 (r345409) @@ -16,15 +16,18 @@ ATF_TESTS_SH+= anchor \ route_to \ synproxy \ set_skip \ - pfsync + pfsync \ + icmp ${PACKAGE}FILES+= utils.subr \ echo_inetd.conf \ sniffer.py \ pft_ping.py \ - CVE-2019-5597.py + CVE-2019-5597.py \ + CVE-2019-5598.py ${PACKAGE}FILESMODE_pft_ping.py= 0555 ${PACKAGE}FILESMODE_CVE-2019-5597.py= 0555 +${PACKAGE}FILESMODE_CVE-2019-5598.py= 0555 .include Added: head/tests/sys/netpfil/pf/icmp.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netpfil/pf/icmp.sh Fri Mar 22 07:39:28 2019 (r345409) @@ -0,0 +1,99 @@ +# $FreeBSD$ + +. $(atf_get_srcdir)/utils.subr + +atf_test_case "cve_2019_5598" "cleanup" +cve_2019_5598_head() +{ + atf_set descr 'Test CVE-2019-5598' + atf_set require.user root + atf_set require.progs scapy +} + +cve_2019_5598_body() +{ + pft_init + + epair_in=$(vnet_mkepair) + epair_out=$(vnet_mkepair) + ifconfig ${epair_in}a 192.0.2.1/24 up + ifconfig ${epair_out}a up + + vnet_mkjail alcatraz ${epair_in}b ${epair_out}b + jexec alcatraz ifconfig ${epair_in}b 192.0.2.2/24 up + jexec alcatraz ifconfig ${epair_out}b 198.51.100.2/24 up + jexec alcatraz sysctl net.inet.ip.forwarding=1 + jexec alcatraz arp -s 198.51.100.3 00:01:02:03:04:05 + jexec alcatraz route add default 198.51.100.3 + route add -net 198.51.100.0/24 192.0.2.2 + + jexec alcatraz pfctl -e + pft_set_rules alcatraz "block all" \ + "pass in proto udp to 198.51.100.3 port 53" \ + "pass out proto udp to 198.51.100.3 port 53" + + atf_check -s exit:0 $(atf_get_srcdir)/CVE-2019-icmp.py \ + --sendif ${epair_in}a \ + --recvif ${epair_out}a \ + --src 192.0.2.1 \ + --to 198.51.100.3 +} + +cve_2019_5598_cleanup() +{ + pft_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "cve_2019_5598" +} +# $FreeBSD$ + +. $(atf_get_srcdir)/utils.subr + +atf_test_case "cve_2019_5598" "cleanup" +cve_2019_5598_head() +{ + atf_set descr 'Test CVE-2019-5598' + atf_set require.user root + atf_set require.progs scapy +} + +cve_2019_5598_body() +{ + pft_init + + epair_in=$(vnet_mkepair) + epair_out=$(vnet_mkepair) + ifconfig ${epair_in}a 192.0.2.1/24 up + ifconfig ${epair_out}a up + + vnet_mkjail alcatraz ${epair_in}b ${epair_out}b + jexec alcatraz ifconfig ${epair_in}b 192.0.2.2/24 up + jexec alcatraz ifconfig ${epair_out}b 198.51.100.2/24 up + jexec alcatraz sysctl net.inet.ip.forwarding=1 + jexec alcatraz arp -s 198.51.100.3 00:01:02:03:04:05 + route add -net 198.51.100.0/24 192.0.2.2 + + jexec alcatraz pfctl -e + pft_set_rules alcatraz "block all" \ + "pass in proto udp to 198.51.100.3 port 53" \ + "pass out proto udp to 198.51.100.3 port 53" + + atf_check -s exit:0 $(atf_get_srcdir)/CVE-2019-icmp.py \ + --sendif ${epair_in}a \ + --recvif ${epair_out}a \ + --src 192.0.2.1 \ + --to 198.51.100.3 +} + +cve_2019_5598_cleanup() +{ + pft_cleanup +} + +atf_init_test_cases() +{ + atf_add_test_case "cve_2019_5598" +} From owner-svn-src-head@freebsd.org Fri Mar 22 09:11:46 2019 Return-Path: Delivered-To: svn-src-head@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 C315C1534F45; Fri, 22 Mar 2019 09:11:46 +0000 (UTC) (envelope-from avg@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 64137713BC; Fri, 22 Mar 2019 09:11:46 +0000 (UTC) (envelope-from avg@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 3CA241E381; Fri, 22 Mar 2019 09:11:46 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2M9Bk49089064; Fri, 22 Mar 2019 09:11:46 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2M9BkRX089063; Fri, 22 Mar 2019 09:11:46 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201903220911.x2M9BkRX089063@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 22 Mar 2019 09:11:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345410 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 345410 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 64137713BC 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.94)[-0.945,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2019 09:11:46 -0000 Author: avg Date: Fri Mar 22 09:11:45 2019 New Revision: 345410 URL: https://svnweb.freebsd.org/changeset/base/345410 Log: ZFS vdev_file: use correct value for waitfor parameter of VOP_FSYNC PR: 236475 Reported by: asomers MFC after: 2 weeks Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Fri Mar 22 07:39:28 2019 (r345409) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Fri Mar 22 09:11:45 2019 (r345410) @@ -239,8 +239,13 @@ vdev_file_io_start(zio_t *zio) switch (zio->io_cmd) { case DKIOCFLUSHWRITECACHE: +#ifdef illumos zio->io_error = VOP_FSYNC(vf->vf_vnode, FSYNC | FDSYNC, kcred, NULL); +#else + zio->io_error = VOP_FSYNC(vf->vf_vnode, MNT_WAIT, + kcred, NULL); +#endif break; default: zio->io_error = SET_ERROR(ENOTSUP); From owner-svn-src-head@freebsd.org Fri Mar 22 10:38:23 2019 Return-Path: Delivered-To: svn-src-head@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 4E7CD153F9AD; Fri, 22 Mar 2019 10:38:23 +0000 (UTC) (envelope-from avg@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 E178374638; Fri, 22 Mar 2019 10:38:22 +0000 (UTC) (envelope-from avg@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 8B33E1F29F; Fri, 22 Mar 2019 10:38:22 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2MAcMmJ033890; Fri, 22 Mar 2019 10:38:22 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2MAcMZi033889; Fri, 22 Mar 2019 10:38:22 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201903221038.x2MAcMZi033889@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 22 Mar 2019 10:38:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345411 - head/sys/dev/intpm X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/intpm X-SVN-Commit-Revision: 345411 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E178374638 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_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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2019 10:38:23 -0000 Author: avg Date: Fri Mar 22 10:38:22 2019 New Revision: 345411 URL: https://svnweb.freebsd.org/changeset/base/345411 Log: intpm: change translation of HBA error status to smbus(4) errors PIIX4_SMBHSTSTAT_ERR can be set for several reasons that, unfortunately, cannot be distinguished, but the most typical case is a missing or hung slave (SMB_ENOACK). PIIX4_SMBHSTSTAT_FAIL means failed or killed / aborted transaction, so it's previous mapping to SMB_ENOACK was not ideal. After this change an smb(4) access to a missing slave results in ENXIO rather than EIO. To me, that seems to be more appropriate. MFC after: 3 weeks Modified: head/sys/dev/intpm/intpm.c Modified: head/sys/dev/intpm/intpm.c ============================================================================== --- head/sys/dev/intpm/intpm.c Fri Mar 22 09:11:45 2019 (r345410) +++ head/sys/dev/intpm/intpm.c Fri Mar 22 10:38:22 2019 (r345411) @@ -525,12 +525,19 @@ intsmb_error(device_t dev, int status) { int error = 0; + /* + * PIIX4_SMBHSTSTAT_ERR can mean either of + * - SMB_ENOACK ("Unclaimed cycle"), + * - SMB_ETIMEOUT ("Host device time-out"), + * - SMB_EINVAL ("Illegal command field"). + * SMB_ENOACK seems to be most typical. + */ if (status & PIIX4_SMBHSTSTAT_ERR) - error |= SMB_EBUSERR; + error |= SMB_ENOACK; if (status & PIIX4_SMBHSTSTAT_BUSC) error |= SMB_ECOLLI; if (status & PIIX4_SMBHSTSTAT_FAIL) - error |= SMB_ENOACK; + error |= SMB_EABORT; if (error != 0 && bootverbose) device_printf(dev, "error = %d, status = %#x\n", error, status); From owner-svn-src-head@freebsd.org Fri Mar 22 11:43:12 2019 Return-Path: Delivered-To: svn-src-head@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 BF1411541643; Fri, 22 Mar 2019 11:43:12 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 96C3F7689C; Fri, 22 Mar 2019 11:43:10 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id 7IZlhvmBwLdsa7IZnhqoxe; Fri, 22 Mar 2019 05:43:08 -0600 X-Authority-Analysis: v=2.3 cv=G9Zi7Os5 c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=NTGMnVQrEZIA:10 a=iKhvJSA4AAAA:8 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=Oi4kQeZPSxDP7k8tWo4A:9 a=CjuIK1q_8ugA:10 a=odh9cflL3HIXMm4fY7Wr:22 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 2E470A82; Fri, 22 Mar 2019 04:43:05 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id x2MBh4Eg005877; Fri, 22 Mar 2019 04:43:04 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id x2MBh4Ib005874; Fri, 22 Mar 2019 04:43:04 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201903221143.x2MBh4Ib005874@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: rgrimes@freebsd.org cc: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r345400 - in head/libexec/rc: . rc.d In-Reply-To: Message from "Rodney W. Grimes" of "Thu, 21 Mar 2019 22:17:11 -0700." <201903220517.x2M5HBqg063638@gndrsh.dnsmgr.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 22 Mar 2019 04:43:04 -0700 X-CMAE-Envelope: MS4wfKMRC51X7ZAeXD2Ie9QfyXF7uJhbD3Q6LBuPK/5MsOSydj/Agj/hQKGLkxxtRTru6d0NsymcidCjm6w27JAbs1xLa/x9WAdqssY0azph9UEwbb9b+8Qh Fd+5ub6Nk5xcUnbFpd+3MOXsumY4L/Zh1K8ZecrmXjsspQRDzZWLui5/wVsguLGbUL4FBFpwI9wFVk8nQHN47Dsa9mKu8QYEC6o1NqaXKF4JgqEZOOt+CHd0 EQc6vbxclxFxv6JscZALpk9XV8x7N3K9lL+fk5Tsph7VNKYlGk+i0zW6aJyYfICSvJpx6fpODfGzvuxwjmMF0w== X-Rspamd-Queue-Id: 96C3F7689C X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-4.95 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; REPLYTO_EQ_FROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MX_GOOD(-0.01)[cached: spqr.komquats.com]; NEURAL_HAM_SHORT(-0.91)[-0.912,0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.zen.spamhaus.org : 127.0.0.11]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; MIME_TRACE(0.00)[0:+]; IP_SCORE(-2.32)[ip: (-6.34), ipnet: 64.59.128.0/20(-2.93), asn: 6327(-2.25), country: CA(-0.09)]; RCVD_IN_DNSWL_LOW(-0.10)[12.134.59.64.list.dnswl.org : 127.0.5.1] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2019 11:43:13 -0000 In message <201903220517.x2M5HBqg063638@gndrsh.dnsmgr.net>, "Rodney W. Grimes" writes: > > Author: cy > > Date: Fri Mar 22 01:30:51 2019 > > New Revision: 345400 > > URL: https://svnweb.freebsd.org/changeset/base/345400 > > > > Log: > > Add rc.d support for ippool(8). > > > > I've been using ippool at my site for approximately two years. It's > > about time this was committed. > > > > PR: 218433 > > MFC after: 2 weeks > > > > Added: > > head/libexec/rc/rc.d/ippool (contents, props changed) > > Modified: > > head/libexec/rc/rc.conf > > > > Modified: head/libexec/rc/rc.conf > > =========================================================================== > === > > --- head/libexec/rc/rc.conf Thu Mar 21 23:31:10 2019 (r345399) > > +++ head/libexec/rc/rc.conf Fri Mar 22 01:30:51 2019 (r345400) > > @@ -196,6 +196,10 @@ ipfilter_program="/sbin/ipf" # where the ipfilter pr > og > > ipfilter_rules="/etc/ipf.rules" # rules definition file for ipfilter, s > ee > > # /usr/src/contrib/ipfilter/rules for examples > > ipfilter_flags="" # additional flags for ipfilter > > +ippool_enable="NO" # Set to YES to enable ip filter pools > > +ippool_program="/sbin/ippool" # where the ippool program lives > > +ippool_rules="/etc/ippool.tables" # rules definition file for ippool > > +ippool_flags="" # additional flags for ippool > > ipnat_enable="NO" # Set to YES to enable ipnat functionality > > ipnat_program="/sbin/ipnat" # where the ipnat program lives > > ipnat_rules="/etc/ipnat.rules" # rules definition file for ipnat > > > > Added: head/libexec/rc/rc.d/ippool > > =========================================================================== > === > > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > > +++ head/libexec/rc/rc.d/ippool Fri Mar 22 01:30:51 2019 (r34540 > 0) > > @@ -0,0 +1,40 @@ > > +#!/bin/sh > > +# > > +# $FreeBSD$ > > +# > > + > > +# PROVIDE: ippool > > +# REQUIRE: FILESYSTEMS > > +# BEFORE: ipfilter > > +# KEYWORD: nojail > > + > > +. /etc/rc.subr > > + > > +name="ippool" > > +desc="user interface to the IPFilter pools" > > +rcvar="ippool_enable" > > +load_rc_config $name > > +start_cmd="ippool_start" > > +stop_cmd="${ippool_program} -F" > > +reload_cmd="ippool_reload" > > +extra_commands="reload" > > +required_files="${ippool_rules}" > > +required_modules="ipl:ipfilter" > > + > > +ippool_start() > > +{ > > + if [ -r "${ippool_rules}" ]; then > > + echo "Loading IP Pools." > > + ${ippool_program} -f ${ippool_rules} ${ippool_flags} > > + fi > > +} > > + > > +ippool_reload() > > +{ > > + echo "Reloading IP Pools." > > + ${ippool_program} -F > > + ippool_start > > Couldnt this better be expressed > ${stop_cmd} > ${start_cmd} > Yes. I'll fix that. > > +} > > + > > + > > +run_rc_command "$1" > > > > > > -- > Rod Grimes rgrimes@freebsd.or > g > -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Fri Mar 22 11:46:37 2019 Return-Path: Delivered-To: svn-src-head@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 3F8651541960; Fri, 22 Mar 2019 11:46:37 +0000 (UTC) (envelope-from cy@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 9ADC176BA6; Fri, 22 Mar 2019 11:46:36 +0000 (UTC) (envelope-from cy@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 74DC91FE5D; Fri, 22 Mar 2019 11:46:36 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2MBkaYv070321; Fri, 22 Mar 2019 11:46:36 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2MBkaRJ070320; Fri, 22 Mar 2019 11:46:36 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201903221146.x2MBkaRJ070320@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 22 Mar 2019 11:46:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345412 - head/libexec/rc/rc.d X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/libexec/rc/rc.d X-SVN-Commit-Revision: 345412 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9ADC176BA6 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.947,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2019 11:46:37 -0000 Author: cy Date: Fri Mar 22 11:46:35 2019 New Revision: 345412 URL: https://svnweb.freebsd.org/changeset/base/345412 Log: Use internal command variables for consistent style. Reported by: rgrimes@ MFC after: 13 days X-MFC with: r345400 Modified: head/libexec/rc/rc.d/ippool Modified: head/libexec/rc/rc.d/ippool ============================================================================== --- head/libexec/rc/rc.d/ippool Fri Mar 22 10:38:22 2019 (r345411) +++ head/libexec/rc/rc.d/ippool Fri Mar 22 11:46:35 2019 (r345412) @@ -32,8 +32,8 @@ ippool_start() ippool_reload() { echo "Reloading IP Pools." - ${ippool_program} -F - ippool_start + ${stop_cmd} + ${start_cmd} } From owner-svn-src-head@freebsd.org Fri Mar 22 12:58:52 2019 Return-Path: Delivered-To: svn-src-head@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 CFA3F1545617; Fri, 22 Mar 2019 12:58:52 +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 5981081F57; Fri, 22 Mar 2019 12:58:52 +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 x2MCwoGS065411; Fri, 22 Mar 2019 05:58:50 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x2MCwoqK065410; Fri, 22 Mar 2019 05:58:50 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201903221258.x2MCwoqK065410@gndrsh.dnsmgr.net> Subject: Re: svn commit: r345412 - head/libexec/rc/rc.d In-Reply-To: <201903221146.x2MBkaRJ070320@repo.freebsd.org> To: Cy Schubert Date: Fri, 22 Mar 2019 05:58:50 -0700 (PDT) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@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: 5981081F57 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.976,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2019 12:58:53 -0000 > Author: cy > Date: Fri Mar 22 11:46:35 2019 > New Revision: 345412 > URL: https://svnweb.freebsd.org/changeset/base/345412 > > Log: > Use internal command variables for consistent style. > > Reported by: rgrimes@ > MFC after: 13 days > X-MFC with: r345400 Thank you. > Modified: > head/libexec/rc/rc.d/ippool > > Modified: head/libexec/rc/rc.d/ippool > ============================================================================== > --- head/libexec/rc/rc.d/ippool Fri Mar 22 10:38:22 2019 (r345411) > +++ head/libexec/rc/rc.d/ippool Fri Mar 22 11:46:35 2019 (r345412) > @@ -32,8 +32,8 @@ ippool_start() > ippool_reload() > { > echo "Reloading IP Pools." > - ${ippool_program} -F > - ippool_start > + ${stop_cmd} > + ${start_cmd} > } -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Fri Mar 22 14:21:14 2019 Return-Path: Delivered-To: svn-src-head@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 9B8211547A04; Fri, 22 Mar 2019 14:21:14 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id E534885667; Fri, 22 Mar 2019 14:21:13 +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 mail105.syd.optusnet.com.au (Postfix) with ESMTPS id AD439105DD93; Sat, 23 Mar 2019 01:21:04 +1100 (AEDT) Date: Sat, 23 Mar 2019 01:21:03 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bruce Evans cc: Conrad Meyer , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r345380 - head/lib/libc/gen In-Reply-To: <20190322050731.V3169@besplex.bde.org> Message-ID: <20190323005050.Y2389@besplex.bde.org> References: <201903211445.x2LEj8U0002125@repo.freebsd.org> <20190322050731.V3169@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=UJetJGXy c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=5Q5Ff2_q-dyTL55U5OwA:9 a=CjuIK1q_8ugA:10 X-Rspamd-Queue-Id: E534885667 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.964,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2019 14:21:14 -0000 On Fri, 22 Mar 2019, Bruce Evans wrote: > On Thu, 21 Mar 2019, Conrad Meyer wrote: > >> Log: >> arc4random: Adjust example code to use uniform() API > > This changes the example from correct to broken. > > I see 4 bugs: I see many more (old but related) bugs. > 1. The log message says that the example uses uniform(), but it actually > uses arc4random_uniform(). > 2. This description still says that the example uses arc4random(), but it > actually uses arc4random_uniform(). > 3. RAND_MAX is usually INT_MAX, so adding 1 to it gives undefined behavior. > The previous version carefully converted RAND_MAX to unsigned to get > defined behaviour. > .. > Oops. Since RAND_MAX is now 2 smaller than INT_MAX, adding 1 to it doesn't > cause overflow. So the badness in the current example is just a style bug. > > 4. Another (old) bug in the example is that it says that the #define for > foo4random() produces a drop-in replacement for [both] rand() and > random(). > The maximum value for random() is still 0x7fffffff, so the same #define > doesn't work for both, and it only ever worked accidentally if > RAND_MAX happens to be 0x7fffffff, but RAND_MAX has been 0x7ffffffd since > before this example existed. 5. arc4random() doesn't support seeding or returning a reproducible sequence, so it cannot provide a drop-in replacement for either rand() or random(). 6. arc4random() is limited to 32 bits, but rand() is only limited by the number of bits in an int, so arc4random() cannot even provide a drop-out replacement for rand() on systems with more >= 34 bit ints unless RAND_MAX is restricted to 32 bits. 7. arc4random_uniform()'s arg is named 'upper_bound', but it is actually 1 larger than the upper bound. 8. It is a design error for the arc4random_uniform()'s arg to be 1 larger than the upper bound. This makes arc4random_uniform() harder to use when it works, and impossible to use when the upper bound is UINT32_MAX since the value 1 larger is unrepresentable them. Portable code needs to use messes like: #if RANDFOO_MAX < UINT32_MAX #define randfoo() arc4random_uniform((uint32_t)RANDFOO_MAX + 1) #else if RANDFOO_MAX == UINT32_MAX #define randfoo() arc4random() #else #error "Can't implement drop-out replacement for randfoo() using arc4random()" #endif 9. Casting to unsigned has another bug which I noticed while writing the above. arc4random_uniform() doesn't take args of type unsigned; it takes args of type uint32_t. Casting to unsigned works if unsigned is at least as large as uint32_t or the value is representable in both. This assumption is unportable, but it became portable in POSIX in 2001 (?) when POSIX started requiring 32-bit ints. So using unsigned is just a style bug if arc4random() is only supported on POSIX systems. Casting to either may overflow unless it is conditional on a test like the above. Casting RAND_MAX to unsigned is known to work, since RAND_MAX <= INT_MAX. But arc4random_uniform()'s API converts to uint32_t, so overflow may occur later. Bruce From owner-svn-src-head@freebsd.org Fri Mar 22 15:48:24 2019 Return-Path: Delivered-To: svn-src-head@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 0767E154995E; Fri, 22 Mar 2019 15:48:24 +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 20CA988716; Fri, 22 Mar 2019 15:48:22 +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 4C1663D93F8; Sat, 23 Mar 2019 02:48:19 +1100 (AEDT) Date: Sat, 23 Mar 2019 02:48:18 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Mark Johnston cc: rgrimes@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r345359 - in head/sys/cddl/dev/dtrace: amd64 i386 In-Reply-To: <20190321193237.GF8186@raichu> Message-ID: <20190323013628.U2614@besplex.bde.org> References: <201903210252.x2L2qMSP022374@repo.freebsd.org> <201903210320.x2L3KIjc058579@gndrsh.dnsmgr.net> <20190321034917.GA8186@raichu> <20190321180738.P1024@besplex.bde.org> <20190321193237.GF8186@raichu> 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=UJetJGXy c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=VmXiJ3vLAS_rSwd8VCMA:9 a=PWqCa8tJaKY79Inz:21 a=VyaIJ5dg8WsOghWd:21 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-Rspamd-Queue-Id: 20CA988716 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.94 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.941,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2019 15:48:24 -0000 On Thu, 21 Mar 2019, Mark Johnston wrote: > On Thu, Mar 21, 2019 at 10:44:49PM +1100, Bruce Evans wrote: >> On Wed, 20 Mar 2019, Mark Johnston wrote: >> >>> On Wed, Mar 20, 2019 at 08:20:18PM -0700, Rodney W. Grimes wrote: >>>>> Author: markj >>>>> Date: Thu Mar 21 02:52:22 2019 >>>>> New Revision: 345359 >>>>> URL: https://svnweb.freebsd.org/changeset/base/345359 >>>>> >>>>> Log: >>>>> Don't attempt to measure TSC skew when running as a VM guest. >>>>> >>>>> It simply doesn't work in general since VCPUs may migrate between >>>>> physical cores. The approach used to measure skew also doesn't >>>>> make much sense in a VM. >> >> I think it simply doesn't work. >> ... >> The method is bogus (buggy) out of a VM. >> >> XX static void >> XX dtrace_gethrtime_init(void *arg) >> XX { >> XX struct pcpu *pc; >> XX cpuset_t map; >> XX int i; >> XX #endif >> XX >> XX /* The current CPU is the reference one. */ >> XX sched_pin(); >> >> It is also necessary to disable interrupts in hardware. Or maybe better >> and necessary, detect when they occur and discard related samples. It >> is impossible to disable NMIs. > > Not quite, just carry out the measurement from an NMI handler. :) :-) I can break that by single-stepping it in ddb. That is similar to emulation wit random large stretching of cycles. >> I plan to try a variation of this: all CPUs spin reading the TSC and >> appending the result atomically to a log buffer. Then analyze the results. >> With no skew or interrupts, it is expected that the results are almost >> monotonic. Contention causes non-monotonicity only occasionally. The >> average non-mononicity should be 0. If there is significant skew, then >> the order for the sameples form each pair of CPUs will reverse on almost >> every second reading. The skew is the adjustment needed to stop this >> reversal. I tried this. The free-running method sort of works, but it is better to serialize everything. The result of the serialization is essentially the same as in the fixed tscdrift, though I used a log buffer index instead of a gate variable to synchronize. The method is to calculate the serialization latency in both directions, with each direction using identically code and hopefully identical CPU state after warming up caches. The skew is then the difference of the latency divided by 2. Oops, I forgot to divide by 2. This gives the following output on i4790K: XX | CPUs | latij | latji | skew | nr | XX |---------+----------------+----------------+-----------------+--------| XX 0 <-> 1 72/143/460/ 7 68/143/460/ 5 -316/ 0/416/ 9 524286 latij is latency from CPU i to CPU j. nr is the number of samples (512K rdtsc()s on each CPU in the pair, with a few discards for latencies above 999 cycles discarded. The i4790K was run with interrupts disabled, so I don't know why there were so many discards). The 4 values in each of the 3 middle columns are min/avg/max/sdev. Note: for CPUs on the same core, the latencies are about 120 cycles smaller and the averag skews are very close to 0. This and latencies never being negative show that the method basically works. XX 0 <-> 2 192/263/992/25 192/258/992/16 -724/ 5/748/29 524267 XX 0 <-> 3 192/263/992/25 188/258/992/15 -724/ 5/748/29 524266 XX 0 <-> 4 188/255/964/21 188/273/964/42 -724/-18/752/46 524266 XX 0 <-> 5 188/255/976/20 188/273/976/42 -724/-18/752/45 524274 XX 0 <-> 6 200/281/996/20 200/270/996/14 -728/ 11/752/22 524273 XX 0 <-> 7 200/281/964/20 196/270/964/13 -728/ 10/752/22 524276 There does seem to be some skew. Parts of rest of table collected manually and repeated here for comparison with the above: XX 2 <-> 0 188/258/968/16 192/263/968/25 -768/ -5/760/29 524273 XX 3 <-> 0 188/259/988/15 188/263/988/26 -768/ -5/760/29 524282 XX 4 <-> 0 188/271/996/40 188/255/996/20 -768/ 16/764/45 524275 XX 5 <-> 0 192/271/952/40 188/255/952/20 -768/ 16/768/45 524280 XX 6 <-> 0 196/268/992/16 200/280/992/23 -768/-12/768/27 524276 XX 7 <-> 0 200/268/976/15 196/280/976/22 -768/-12/768/27 524283 The signs of the average skews are reversed perfectly when the direction is reversed, and the values are reversed almost perfectly too. This wasn't so clear on freefall's Xeon with interrupts enabled. Otherwise, the behaviour on freefall is similar. XX 1 <-> 0 72/143/476/10 72/143/476/ 5 -728/ -0/752/11 524286 XX 1 <-> 2 192/263/944/25 192/258/944/15 -728/ 5/752/29 524268 XX 1 <-> 3 192/263/948/25 192/258/948/15 -728/ 5/752/29 524264 XX 1 <-> 4 188/255/996/20 188/274/996/42 -740/-18/760/45 524264 XX 1 <-> 5 188/255/996/21 192/273/996/42 -768/-18/760/45 524272 XX 1 <-> 6 196/280/996/21 196/270/996/14 -768/ 10/760/23 524270 XX 1 <-> 7 196/281/952/20 200/270/952/14 -768/ 11/760/23 524275 XX 2 <-> 0 188/258/968/16 192/263/968/25 -768/ -5/760/29 524273 XX 2 <-> 1 188/258/928/16 192/263/928/25 -768/ -5/760/29 524268 XX 2 <-> 3 72/144/504/ 9 72/144/504/ 5 -768/ 0/760/10 524286 XX 2 <-> 4 184/251/988/17 188/269/988/40 -768/-19/760/43 524275 XX 2 <-> 5 184/251/996/17 184/269/996/40 -768/-18/760/43 524271 XX 2 <-> 6 196/263/904/17 196/266/904/14 -768/ -3/760/22 524278 XX 2 <-> 7 192/264/944/17 200/266/944/14 -768/ -3/760/22 524275 XX 3 <-> 0 188/259/988/15 188/263/988/26 -768/ -5/760/29 524282 XX 3 <-> 1 192/258/996/16 192/263/996/25 -768/ -5/760/29 524270 XX 3 <-> 2 84/143/480/ 8 52/142/480/ 5 -768/ 1/760/ 9 524287 XX 3 <-> 4 184/251/960/17 188/270/960/40 -768/-19/764/43 524273 XX 3 <-> 5 184/251/980/18 188/269/980/40 -768/-19/764/43 524271 XX 3 <-> 6 192/264/940/17 196/266/940/14 -768/ -3/764/21 524276 XX 3 <-> 7 196/263/996/17 200/266/996/14 -768/ -3/764/21 524277 XX 4 <-> 0 188/271/996/40 188/255/996/20 -768/ 16/764/45 524275 XX 4 <-> 1 192/272/968/41 192/255/968/20 -768/ 17/764/45 524279 XX 4 <-> 2 188/268/996/39 188/251/996/16 -768/ 17/768/41 524276 XX 4 <-> 3 188/268/884/38 188/251/884/16 -768/ 16/768/41 524273 XX 4 <-> 5 64/144/640/ 8 52/144/640/ 5 -768/ -1/768/10 524286 XX 4 <-> 6 188/284/880/42 192/258/880/15 -768/ 26/768/44 524282 XX 4 <-> 7 188/284/980/42 184/258/980/15 -768/ 26/768/44 524275 Latencies even seem to be transitive. According to the above, CPU0 is 16-18 cycles behind CPUs 4-5 and 10-12 cycles ahead of CPUs 6-7. 26 in the above is consistent with this (CPU 4 is 25 cycles ahead of CPUs 6-7). XX 5 <-> 0 192/271/952/40 188/255/952/20 -768/ 16/768/45 524280 XX 5 <-> 1 192/271/988/40 184/255/988/20 -768/ 16/768/45 524261 XX 5 <-> 2 188/268/884/39 188/251/884/16 -768/ 17/768/41 524275 XX 5 <-> 3 188/269/972/39 188/251/972/16 -768/ 17/768/41 524273 XX 5 <-> 4 72/143/512/ 8 52/142/512/ 5 -768/ 1/768/10 524287 XX 5 <-> 6 188/282/956/41 192/258/956/15 -768/ 24/768/44 524276 XX 5 <-> 7 188/283/812/42 192/258/812/15 -768/ 25/768/44 524269 XX 6 <-> 0 196/268/992/16 200/280/992/23 -768/-12/768/27 524276 XX 6 <-> 1 200/268/984/16 200/280/984/23 -768/-12/768/27 524266 XX 6 <-> 2 196/266/864/15 196/265/864/16 -768/ 1/768/21 524273 XX 6 <-> 3 196/266/940/15 196/266/940/16 -768/ 0/768/21 524275 XX 6 <-> 4 192/259/964/16 192/287/964/44 -768/-28/768/46 524277 XX 6 <-> 5 188/259/992/16 196/287/992/44 -768/-28/768/47 524274 XX 6 <-> 7 88/143/732/ 8 52/143/732/ 6 -768/ -0/768/10 524287 XX 7 <-> 0 200/268/976/15 196/280/976/22 -768/-12/768/27 524283 XX 7 <-> 1 196/268/996/16 196/279/996/22 -768/-11/768/27 524277 XX 7 <-> 2 196/266/976/15 196/265/976/16 -768/ 1/768/21 524272 XX 7 <-> 3 196/266/988/15 196/265/988/16 -768/ 0/768/21 524266 XX 7 <-> 4 188/259/860/16 196/287/860/44 -768/-28/768/46 524269 XX 7 <-> 5 188/259/928/16 200/287/928/44 -768/-28/768/47 524283 XX 7 <-> 6 72/144/992/ 8 52/142/992/ 5 -852/ 1/768/ 9 524287 > ... > I don't think it makes much sense to measure skew on systems with an > invariant TSC. If the TSC is not invariant, measuring it once at load > time is likely not enough. Based on TSC-invariant systems I looked at, > the measured skew is small enough that the erroneous deltas probably > don't cause much harm. In VMs, the deltas are large enough that they > create noticeable problems. I agree, but dtrace always does it. On a Turion2 system with a non- invariant TSC that is unusable as a timecounter, dtrace init produces: tsc_skew[0] = 0 tsc_skew[1] = -397099 (decimal) and the above program produces garbage (NaNs for division of 0 by 0) due to all latencies being too large to use. After usingall latencies, it gives: | CPUs | latij | latji | skew | nr | |---------+----------------+----------------+-----------------+--------| 0 <-> 1 -1259586/-1259530/1262126/123 1260084/1260136/1262126/126 -2521678/-2519667/ 2/130 524287 1 <-> 0 1260089/1260144/-1257494/122 -1259603/-1259538/-1257494/126 -2521678/2519683/2521496/131 524287 The large latencies and skews don't change noticeably on repeated runs. They are about 1260k. This is very different from the 397k seen by dtrace init. The above output was produced by: XX /** pthread and cpu management parts copied from tscdrift.c. */ XX XX /*- XX * Copyright (c) 2014 Advanced Computing Technologies LLC XX * Written by: John H. Baldwin XX * All rights reserved. XX * XX * Redistribution and use in source and binary forms, with or without XX * modification, are permitted provided that the following conditions XX * are met: XX * 1. Redistributions of source code must retain the above copyright XX * notice, this list of conditions and the following disclaimer. XX * 2. Redistributions in binary form must reproduce the above copyright XX * notice, this list of conditions and the following disclaimer in the XX * documentation and/or other materials provided with the distribution. XX * XX * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND XX * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE XX * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE XX * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE XX * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL XX * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS XX * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) XX * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT XX * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY XX * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF XX * SUCH DAMAGE. XX */ XX XX #include XX #include XX XX #include XX #include XX XX #include XX #include XX #include XX #include XX #include XX #include XX #include XX #include XX #include XX XX #define LOGSIZE 0x100000 XX XX static volatile u_int nready; XX static int ncpu; XX static volatile uint64_t tsc_log[LOGSIZE]; XX static volatile uint tsc_loghead; XX XX /* Bind the current thread to the specified CPU. */ XX static void XX bind_cpu(int cpu) XX { XX cpuset_t set; XX XX CPU_ZERO(&set); XX CPU_SET(cpu, &set); XX if (cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, -1, sizeof(set), XX &set) < 0) XX err(1, "cpuset_setaffinity(%d)", cpu); XX } XX XX static void * XX action(void *arg) XX { XX int cpu, fd, head, master; XX XX cpu = (intptr_t)arg; XX master = cpu & 0x80000000; XX cpu &= 0x7fffffff; XX bind_cpu(cpu); XX XX fd = open("/dev/io", O_RDONLY); XX XX /* Attempt to fault in everything before disabling interrupts. */ XX memset((void *)tsc_log, 0, sizeof(tsc_log)); XX XX /* Start logging on all CPUs at almost the same time. */ XX atomic_add_int(&nready, 1); XX while (atomic_load_int(&nready) < 2) XX ; XX XX /* If possible, run throughout with interrupts disabled. */ XX if (fd != -1) XX disable_intr(); XX XX head = master ? 0 : 1; XX for (;;) { XX if (head >= LOGSIZE) XX break; XX while (atomic_load_acq_int(&tsc_loghead) != head) XX ; XX __asm __volatile("lfence"); XX tsc_log[head] = rdtsc(); XX atomic_store_rel_int(&tsc_loghead, head + 1); XX head += 2; XX } XX if (fd != -1) XX enable_intr(); XX return (NULL); XX } XX XX int XX main(int argc, char **argv) XX { XX cpuset_t all_cpus; XX pthread_t *children; XX double avlatij, avlatji, avskew, sdlatij, sdlatji, sdskew; XX double sumlatijsq, sumlatjisq, sumskewsq; XX int *cpus; XX intmax_t latij, latji, maxlatij, maxlatji, minlatij, minlatji; XX intmax_t sumlatij, sumlatji; XX intmax_t skew, maxskew, minskew; XX int error, i, j, nr, r; XX XX /* XX * Find all the CPUs this program is eligible to run on and use XX * this as our global set. This means you can use cpuset to XX * restrict this program to only run on a subset of CPUs. XX */ XX if (cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, XX sizeof(all_cpus), &all_cpus) < 0) XX err(1, "cpuset_getaffinity"); XX for (ncpu = 0, i = 0; i < CPU_SETSIZE; i++) XX if (CPU_ISSET(i, &all_cpus)) XX ncpu++; XX cpus = calloc(ncpu, sizeof(*cpus)); XX children = calloc(ncpu, sizeof(*children)); XX for (i = 0, j = 0; i < CPU_SETSIZE; i++) XX if (CPU_ISSET(i, &all_cpus)) { XX assert(j < ncpu); XX cpus[j] = i; XX j++; XX } XX XX printf( XX "| CPUs | latij | latji | skew | nr |\n"); XX printf( XX "|---------+----------------+----------------+-----------------+--------|\n"); XX for (i = 0; i < ncpu; i++) { XX for (j = 0; j < ncpu; j++) { XX if (j == i) XX continue; XX atomic_store_rel_int(&nready, 0); XX atomic_store_rel_int(&tsc_loghead, 0); XX error = pthread_create(&children[j], NULL, action, XX (void *)(intptr_t)cpus[j]); XX if (error) XX errc(1, error, "pthread_create"); XX action((void *)(intptr_t)(0x80000000 | cpus[i])); XX error = pthread_join(children[j], NULL); XX if (error) XX errc(1, error, "pthread_join"); XX XX nr = 0; XX maxlatij = maxlatji = INTMAX_MIN; XX minlatij = minlatji = INTMAX_MAX; XX sumlatij = sumlatji = 0; XX sumlatijsq = sumlatjisq = sumskewsq = 0; XX for (r = 0; r < LOGSIZE - 2; r += 2) { XX latij = tsc_log[r + 1] - tsc_log[r]; XX latji = tsc_log[r + 2] - tsc_log[r + 1]; XX #if 1 /* XXX discard samples which appear to have been preempted */ XX if (latij > 999 || latji > 999) XX continue; XX #endif XX if (maxlatij < latij) XX maxlatij = latij; XX if (minlatij > latij) XX minlatij = latij; XX if (maxlatji < latji) XX maxlatji = latji; XX if (minlatji > latji) XX minlatji = latji; XX sumlatij += latij; XX sumlatji += latji; XX sumlatijsq += latij * latij; XX sumlatjisq += latji * latji; XX skew = latij - latji; XX if (maxskew < skew) XX maxskew = skew; XX if (minskew > skew) XX minskew = skew; XX sumskewsq += skew * skew; XX nr++; XX } XX avlatij = (double)sumlatij / nr; XX sdlatij = sqrt(sumlatijsq / nr - avlatij * avlatij); XX avlatji = (double)sumlatji / nr; XX sdlatji = sqrt(sumlatjisq / nr - avlatji * avlatji); XX avskew = avlatij - avlatji; XX sdskew = sqrt(sumskewsq / nr - avskew * avskew); XX printf( XX "%2d <-> %2d %3jd/%3.0f/%3jd/%2.0f %3jd/%3.0f/%3jd/%2.0f %4jd/%3.0f/%3jd/%2.0f %6d\n", XX cpus[i], cpus[j], XX minlatij, avlatij, maxlatji, sdlatij, XX minlatji, avlatji, maxlatji, sdlatji, XX minskew, avskew, maxskew, sdskew, nr); XX } XX } XX } Unfortunately, the measured skews change a lot. Some runs gave CPUs 2-3 at skew average distance -105 from CPU 0, but CPUs 4-7 at distance +-0, And that is with 512K samples. I expected averaging over a few hundred samples would be enough. Bruce From owner-svn-src-head@freebsd.org Fri Mar 22 17:37:15 2019 Return-Path: Delivered-To: svn-src-head@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 513FB154C290; Fri, 22 Mar 2019 17:37:15 +0000 (UTC) (envelope-from mhorne@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 EA17F8C432; Fri, 22 Mar 2019 17:37:14 +0000 (UTC) (envelope-from mhorne@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 AB8AE23A48; Fri, 22 Mar 2019 17:37:14 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2MHbEEx054856; Fri, 22 Mar 2019 17:37:14 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2MHbExO054854; Fri, 22 Mar 2019 17:37:14 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201903221737.x2MHbExO054854@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Fri, 22 Mar 2019 17:37:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345417 - in head: share/misc usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: in head: share/misc usr.bin/calendar/calendars X-SVN-Commit-Revision: 345417 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EA17F8C432 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_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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2019 17:37:15 -0000 Author: mhorne Date: Fri Mar 22 17:37:14 2019 New Revision: 345417 URL: https://svnweb.freebsd.org/changeset/base/345417 Log: Update mentor and calendar files Add an entry for myself (mhorne) to these files. Approved by: markj Modified: head/share/misc/committers-src.dot head/usr.bin/calendar/calendars/calendar.freebsd Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Fri Mar 22 16:19:37 2019 (r345416) +++ head/share/misc/committers-src.dot Fri Mar 22 17:37:14 2019 (r345417) @@ -254,6 +254,7 @@ maxim [label="Maxim Konovalov\nmaxim@FreeBSD.org\n2002 mdf [label="Matthew Fleming\nmdf@FreeBSD.org\n2010/06/04"] mdodd [label="Matthew N. Dodd\nmdodd@FreeBSD.org\n1999/07/27"] melifaro [label="Alexander V. Chernikov\nmelifaro@FreeBSD.org\n2011/10/04"] +mhorne [label="Mitchell Horne\nmhorne@FreeBSD.org\n2019/03/20"] miwi [label="Martin Wilke\nmiwi@FreeBSD.org\n2011/02/18\n2018/06/14"] mizhka [label="Michael Zhilin\nmizhka@FreeBSD.org\n2016/07/19"] mjacob [label="Matt Jacob\nmjacob@FreeBSD.org\n1997/08/13"] @@ -693,6 +694,7 @@ marcel -> sjg markj -> cem markj -> lwhsu +markj -> mhorne markj -> rlibby markm -> jasone Modified: head/usr.bin/calendar/calendars/calendar.freebsd ============================================================================== --- head/usr.bin/calendar/calendars/calendar.freebsd Fri Mar 22 16:19:37 2019 (r345416) +++ head/usr.bin/calendar/calendars/calendar.freebsd Fri Mar 22 17:37:14 2019 (r345417) @@ -35,6 +35,7 @@ 01/19 Marcelo S. Araujo born in Joinville, Santa Catarina, Brazil, 1981 01/20 Poul-Henning Kamp born in Korsoer, Denmark, 1966 01/21 Mahdi Mokhtari born in Tehran, Iran, 1995 +01/21 Mitchell Horne born in Toronto, Ontario, Canada, 1997 01/22 Johann Visagie born in Cape Town, South Africa, 1970 01/23 Hideyuki KURASHINA born in Niigata, Japan, 1982 01/24 Fabien Thomas born in Avignon, France, 1971 From owner-svn-src-head@freebsd.org Fri Mar 22 17:44:48 2019 Return-Path: Delivered-To: svn-src-head@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 1EFEF154C85F; Fri, 22 Mar 2019 17:44:48 +0000 (UTC) (envelope-from avg@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 B78288CAB2; Fri, 22 Mar 2019 17:44:47 +0000 (UTC) (envelope-from avg@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 8798D23C1A; Fri, 22 Mar 2019 17:44:47 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2MHilFE060149; Fri, 22 Mar 2019 17:44:47 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2MHiljQ060148; Fri, 22 Mar 2019 17:44:47 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201903221744.x2MHiljQ060148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 22 Mar 2019 17:44:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345418 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 345418 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B78288CAB2 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_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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2019 17:44:48 -0000 Author: avg Date: Fri Mar 22 17:44:47 2019 New Revision: 345418 URL: https://svnweb.freebsd.org/changeset/base/345418 Log: Revert r345410, VOP_FSYNC change in ZFS vdev_file I overlooked the fact that that VOP_FSYNC() call is not a FreeBSD VFS call, but a macro that provides an illumos-compatible wrapper for the FreeBSD operation. PR: 236475 Reported by: lwhsu Pointyhat to: avg Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Fri Mar 22 17:37:14 2019 (r345417) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c Fri Mar 22 17:44:47 2019 (r345418) @@ -239,13 +239,8 @@ vdev_file_io_start(zio_t *zio) switch (zio->io_cmd) { case DKIOCFLUSHWRITECACHE: -#ifdef illumos zio->io_error = VOP_FSYNC(vf->vf_vnode, FSYNC | FDSYNC, kcred, NULL); -#else - zio->io_error = VOP_FSYNC(vf->vf_vnode, MNT_WAIT, - kcred, NULL); -#endif break; default: zio->io_error = SET_ERROR(ENOTSUP); From owner-svn-src-head@freebsd.org Fri Mar 22 21:31:23 2019 Return-Path: Delivered-To: svn-src-head@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 059FF1552362; Fri, 22 Mar 2019 21:31:23 +0000 (UTC) (envelope-from sobomax@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 9195F94426; Fri, 22 Mar 2019 21:31:22 +0000 (UTC) (envelope-from sobomax@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 6E2D5261DE; Fri, 22 Mar 2019 21:31:22 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2MLVMOQ080849; Fri, 22 Mar 2019 21:31:22 GMT (envelope-from sobomax@FreeBSD.org) Received: (from sobomax@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2MLVM46080847; Fri, 22 Mar 2019 21:31:22 GMT (envelope-from sobomax@FreeBSD.org) Message-Id: <201903222131.x2MLVM46080847@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sobomax set sender to sobomax@FreeBSD.org using -f From: Maxim Sobolev Date: Fri, 22 Mar 2019 21:31:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345425 - head/sys/fs/tmpfs X-SVN-Group: head X-SVN-Commit-Author: sobomax X-SVN-Commit-Paths: head/sys/fs/tmpfs X-SVN-Commit-Revision: 345425 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 9195F94426 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.950,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2019 21:31:23 -0000 Author: sobomax Date: Fri Mar 22 21:31:21 2019 New Revision: 345425 URL: https://svnweb.freebsd.org/changeset/base/345425 Log: Make it possible to update TMPFS mount point from read-only to read-write and vice versa. Reviewed by: delphij Approved by: delphij MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D19682 Modified: head/sys/fs/tmpfs/tmpfs.h head/sys/fs/tmpfs/tmpfs_vfsops.c Modified: head/sys/fs/tmpfs/tmpfs.h ============================================================================== --- head/sys/fs/tmpfs/tmpfs.h Fri Mar 22 19:43:50 2019 (r345424) +++ head/sys/fs/tmpfs/tmpfs.h Fri Mar 22 21:31:21 2019 (r345425) @@ -325,6 +325,11 @@ LIST_HEAD(tmpfs_node_list, tmpfs_node); */ struct tmpfs_mount { /* + * Original value of the "size" parameter, for reference purposes, + * mostly. + */ + off_t tm_size_max; + /* * Maximum number of memory pages available for use by the file * system, set during mount time. This variable must never be * used directly as it may be bigger than the current amount of Modified: head/sys/fs/tmpfs/tmpfs_vfsops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vfsops.c Fri Mar 22 19:43:50 2019 (r345424) +++ head/sys/fs/tmpfs/tmpfs_vfsops.c Fri Mar 22 21:31:21 2019 (r345425) @@ -88,7 +88,7 @@ static const char *tmpfs_opts[] = { }; static const char *tmpfs_updateopts[] = { - "from", "export", NULL + "from", "export", "size", NULL }; static int @@ -134,6 +134,8 @@ tmpfs_node_fini(void *mem, int size) mtx_destroy(&node->tn_interlock); } +#define TMPFS_SC(mp) ((struct tmpfs_mount *)(mp)->mnt_data) + static int tmpfs_mount(struct mount *mp) { @@ -141,7 +143,7 @@ tmpfs_mount(struct mount *mp) sizeof(struct tmpfs_dirent) + sizeof(struct tmpfs_node)); struct tmpfs_mount *tmp; struct tmpfs_node *root; - int error; + int error, flags; bool nonc; /* Size counters. */ u_quad_t pages; @@ -161,9 +163,41 @@ tmpfs_mount(struct mount *mp) /* Only support update mounts for certain options. */ if (vfs_filteropt(mp->mnt_optnew, tmpfs_updateopts) != 0) return (EOPNOTSUPP); - if (vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) != - ((struct tmpfs_mount *)mp->mnt_data)->tm_ronly) - return (EOPNOTSUPP); + if (vfs_getopt_size(mp->mnt_optnew, "size", &size_max) == 0) { + /* + * On-the-fly resizing is not supported (yet). We still + * need to have "size" listed as "supported", otherwise + * trying to update fs that is listed in fstab with size + * parameter, say trying to change rw to ro or vice + * versa, would cause vfs_filteropt() to bail. + */ + if (size_max != TMPFS_SC(mp)->tm_size_max) + return (EOPNOTSUPP); + } + if (vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) && + !(TMPFS_SC(mp)->tm_ronly)) { + /* RW -> RO */ + error = VFS_SYNC(mp, MNT_WAIT); + if (error) + return (error); + flags = WRITECLOSE; + if (mp->mnt_flag & MNT_FORCE) + flags |= FORCECLOSE; + error = vflush(mp, 0, flags, curthread); + if (error) + return (error); + TMPFS_SC(mp)->tm_ronly = 1; + MNT_ILOCK(mp); + mp->mnt_flag |= MNT_RDONLY; + MNT_IUNLOCK(mp); + } else if (!vfs_flagopt(mp->mnt_optnew, "ro", NULL, 0) && + TMPFS_SC(mp)->tm_ronly) { + /* RO -> RW */ + TMPFS_SC(mp)->tm_ronly = 0; + MNT_ILOCK(mp); + mp->mnt_flag &= ~MNT_RDONLY; + MNT_IUNLOCK(mp); + } return (0); } @@ -229,6 +263,7 @@ tmpfs_mount(struct mount *mp) tmp->tm_maxfilesize = maxfilesize > 0 ? maxfilesize : OFF_MAX; LIST_INIT(&tmp->tm_nodes_used); + tmp->tm_size_max = size_max; tmp->tm_pages_max = pages; tmp->tm_pages_used = 0; new_unrhdr64(&tmp->tm_ino_unr, 2); From owner-svn-src-head@freebsd.org Fri Mar 22 22:14:16 2019 Return-Path: Delivered-To: svn-src-head@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 D3510155329A; Fri, 22 Mar 2019 22:14:15 +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 7742395E3C; Fri, 22 Mar 2019 22:14:15 +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 560CA26A01; Fri, 22 Mar 2019 22:14:15 +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 x2MMEFXh002471; Fri, 22 Mar 2019 22:14:15 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2MMEEQT002468; Fri, 22 Mar 2019 22:14:14 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201903222214.x2MMEEQT002468@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Fri, 22 Mar 2019 22:14:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345426 - in head/sys: conf powerpc/aim X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys: conf powerpc/aim X-SVN-Commit-Revision: 345426 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7742395E3C 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.957,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2019 22:14:16 -0000 Author: jhibbits Date: Fri Mar 22 22:14:14 2019 New Revision: 345426 URL: https://svnweb.freebsd.org/changeset/base/345426 Log: powerpc: Re-merge isa3 HPT with moea64 native HPT r345402 fixed the bug that led to the split of the ISA 3.0 HPT handling from the existing manager. The cause of the bug was gcc moving the register holding VPN to a different register (not r0), which triggered bizarre behaviors. With the fix, things work, so they can be re-merged. No performance lost with the merge. Deleted: head/sys/powerpc/aim/isa3_hashtb.c Modified: head/sys/conf/files.powerpc head/sys/powerpc/aim/aim_machdep.c head/sys/powerpc/aim/moea64_native.c Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Fri Mar 22 21:31:21 2019 (r345425) +++ head/sys/conf/files.powerpc Fri Mar 22 22:14:14 2019 (r345426) @@ -103,7 +103,6 @@ libkern/qdivrem.c optional powerpc | powerpcspe libkern/ucmpdi2.c optional powerpc | powerpcspe libkern/udivdi3.c optional powerpc | powerpcspe libkern/umoddi3.c optional powerpc | powerpcspe -powerpc/aim/isa3_hashtb.c optional aim powerpc64 powerpc/aim/locore.S optional aim no-obj powerpc/aim/aim_machdep.c optional aim powerpc/aim/mmu_oea.c optional aim powerpc Modified: head/sys/powerpc/aim/aim_machdep.c ============================================================================== --- head/sys/powerpc/aim/aim_machdep.c Fri Mar 22 21:31:21 2019 (r345425) +++ head/sys/powerpc/aim/aim_machdep.c Fri Mar 22 22:14:14 2019 (r345426) @@ -421,9 +421,7 @@ aim_cpu_init(vm_offset_t toc) * in case the platform module had a better idea of what we * should do. */ - if (cpu_features2 & PPC_FEATURE2_ARCH_3_00) - pmap_mmu_install(MMU_TYPE_P9H, BUS_PROBE_GENERIC); - else if (cpu_features & PPC_FEATURE_64) + if (cpu_features & PPC_FEATURE_64) pmap_mmu_install(MMU_TYPE_G5, BUS_PROBE_GENERIC); else pmap_mmu_install(MMU_TYPE_OEA, BUS_PROBE_GENERIC); Modified: head/sys/powerpc/aim/moea64_native.c ============================================================================== --- head/sys/powerpc/aim/moea64_native.c Fri Mar 22 21:31:21 2019 (r345425) +++ head/sys/powerpc/aim/moea64_native.c Fri Mar 22 22:14:14 2019 (r345426) @@ -134,7 +134,8 @@ __FBSDID("$FreeBSD$"); /* POWER9 only permits a 64k partition table size. */ #define PART_SIZE 0x10000 -static int moea64_crop_tlbie; +static bool moea64_crop_tlbie; +static bool moea64_need_lock; static __inline void TLBIE(uint64_t vpn) { @@ -149,14 +150,26 @@ TLBIE(uint64_t vpn) { vpn <<= ADDR_PIDX_SHFT; /* Hobo spinlock: we need stronger guarantees than mutexes provide */ - while (!atomic_cmpset_int(&tlbie_lock, 0, 1)); - isync(); /* Flush instruction queue once lock acquired */ + if (moea64_need_lock) { + while (!atomic_cmpset_int(&tlbie_lock, 0, 1)); + isync(); /* Flush instruction queue once lock acquired */ + } if (moea64_crop_tlbie) vpn &= ~(0xffffULL << 48); #ifdef __powerpc64__ - __asm __volatile("li 0, 0; tlbie %0" :: "r"(vpn) : "0","memory"); + /* + * Explicitly clobber r0. The tlbie instruction has two forms: an old + * one used by PowerISA 2.03 and prior, and a newer one used by PowerISA + * 2.06 (maybe 2.05?) and later. We need to support both, and it just + * so happens that since we use 4k pages we can simply zero out r0, and + * clobber it, and the assembler will interpret the single-operand form + * of tlbie as having RB set, and everything else as 0. The RS operand + * in the newer form is in the same position as the L(page size) bit of + * the old form, so a slong as RS is 0, we're good on both sides. + */ + __asm __volatile("li 0, 0 \n tlbie %0" :: "r"(vpn) : "r0", "memory"); __asm __volatile("eieio; tlbsync; ptesync" ::: "memory"); #else vpn_hi = (uint32_t)(vpn >> 32); @@ -183,7 +196,8 @@ TLBIE(uint64_t vpn) { #endif /* No barriers or special ops -- taken care of by ptesync above */ - tlbie_lock = 0; + if (moea64_need_lock) + tlbie_lock = 0; } #define DISABLE_TRANS(msr) msr = mfmsr(); mtmsr(msr & ~PSL_DR) @@ -195,6 +209,8 @@ TLBIE(uint64_t vpn) { static volatile struct lpte *moea64_pteg_table; static struct rwlock moea64_eviction_lock; +static volatile struct pate *moea64_part_table; + /* * PTE calls. */ @@ -409,9 +425,14 @@ moea64_cpu_bootstrap_native(mmu_t mmup, int ap) * Install page table */ - __asm __volatile ("ptesync; mtsdr1 %0; isync" - :: "r"(((uintptr_t)moea64_pteg_table & ~DMAP_BASE_ADDRESS) - | (uintptr_t)(flsl(moea64_pteg_mask >> 11)))); + if (cpu_features2 & PPC_FEATURE2_ARCH_3_00) + mtspr(SPR_PTCR, + ((uintptr_t)moea64_part_table & ~DMAP_BASE_ADDRESS) | + flsl((PART_SIZE >> 12) - 1)); + else + __asm __volatile ("ptesync; mtsdr1 %0; isync" + :: "r"(((uintptr_t)moea64_pteg_table & ~DMAP_BASE_ADDRESS) + | (uintptr_t)(flsl(moea64_pteg_mask >> 11)))); tlbia(); } @@ -427,13 +448,18 @@ moea64_bootstrap_native(mmu_t mmup, vm_offset_t kernel moea64_early_bootstrap(mmup, kernelstart, kernelend); switch (mfpvr() >> 16) { + case IBMPOWER9: + moea64_need_lock = false; + break; case IBMPOWER4: case IBMPOWER4PLUS: case IBM970: case IBM970FX: case IBM970GX: case IBM970MP: - moea64_crop_tlbie = true; + moea64_crop_tlbie = true; + default: + moea64_need_lock = true; } /* * Allocate PTEG table. @@ -463,9 +489,23 @@ moea64_bootstrap_native(mmu_t mmup, vm_offset_t kernel if (hw_direct_map) moea64_pteg_table = (struct lpte *)PHYS_TO_DMAP((vm_offset_t)moea64_pteg_table); + /* Allocate partition table (ISA 3.0). */ + if (cpu_features2 & PPC_FEATURE2_ARCH_3_00) { + moea64_part_table = + (struct pate *)moea64_bootstrap_alloc(PART_SIZE, PART_SIZE); + if (hw_direct_map) + moea64_part_table = + (struct pate *)PHYS_TO_DMAP((vm_offset_t)moea64_part_table); + } DISABLE_TRANS(msr); bzero(__DEVOLATILE(void *, moea64_pteg_table), moea64_pteg_count * sizeof(struct lpteg)); + if (cpu_features2 & PPC_FEATURE2_ARCH_3_00) { + bzero(__DEVOLATILE(void *, moea64_part_table), PART_SIZE); + moea64_part_table[0].pagetab = + (DMAP_TO_PHYS((vm_offset_t)moea64_pteg_table)) | + (uintptr_t)(flsl((moea64_pteg_count - 1) >> 11)); + } ENABLE_TRANS(msr); CTR1(KTR_PMAP, "moea64_bootstrap: PTEG table at %p", moea64_pteg_table); @@ -512,7 +552,7 @@ tlbia(void) TLBSYNC(); - for (; i < 0x200000; i += 0x00001000) { + for (; i < 0x400000; i += 0x00001000) { #ifdef __powerpc64__ __asm __volatile("tlbiel %0" :: "r"(i)); #else From owner-svn-src-head@freebsd.org Sat Mar 23 01:07:52 2019 Return-Path: Delivered-To: svn-src-head@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 2A6491557005; Sat, 23 Mar 2019 01:07:52 +0000 (UTC) (envelope-from kp@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 C4B0B6D081; Sat, 23 Mar 2019 01:07:51 +0000 (UTC) (envelope-from kp@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 9EB3D75E; Sat, 23 Mar 2019 01:07:51 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2N17pQj091973; Sat, 23 Mar 2019 01:07:51 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2N17pdC091972; Sat, 23 Mar 2019 01:07:51 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201903230107.x2N17pdC091972@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sat, 23 Mar 2019 01:07:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345430 - head/tests/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/tests/sys/netpfil/pf X-SVN-Commit-Revision: 345430 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C4B0B6D081 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.961,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2019 01:07:52 -0000 Author: kp Date: Sat Mar 23 01:07:51 2019 New Revision: 345430 URL: https://svnweb.freebsd.org/changeset/base/345430 Log: pf tests: Fix accidental duplication of content Also use the correct name for the scapy test script. Modified: head/tests/sys/netpfil/pf/icmp.sh Modified: head/tests/sys/netpfil/pf/icmp.sh ============================================================================== --- head/tests/sys/netpfil/pf/icmp.sh Sat Mar 23 00:22:29 2019 (r345429) +++ head/tests/sys/netpfil/pf/icmp.sh Sat Mar 23 01:07:51 2019 (r345430) @@ -32,56 +32,7 @@ cve_2019_5598_body() "pass in proto udp to 198.51.100.3 port 53" \ "pass out proto udp to 198.51.100.3 port 53" - atf_check -s exit:0 $(atf_get_srcdir)/CVE-2019-icmp.py \ - --sendif ${epair_in}a \ - --recvif ${epair_out}a \ - --src 192.0.2.1 \ - --to 198.51.100.3 -} - -cve_2019_5598_cleanup() -{ - pft_cleanup -} - -atf_init_test_cases() -{ - atf_add_test_case "cve_2019_5598" -} -# $FreeBSD$ - -. $(atf_get_srcdir)/utils.subr - -atf_test_case "cve_2019_5598" "cleanup" -cve_2019_5598_head() -{ - atf_set descr 'Test CVE-2019-5598' - atf_set require.user root - atf_set require.progs scapy -} - -cve_2019_5598_body() -{ - pft_init - - epair_in=$(vnet_mkepair) - epair_out=$(vnet_mkepair) - ifconfig ${epair_in}a 192.0.2.1/24 up - ifconfig ${epair_out}a up - - vnet_mkjail alcatraz ${epair_in}b ${epair_out}b - jexec alcatraz ifconfig ${epair_in}b 192.0.2.2/24 up - jexec alcatraz ifconfig ${epair_out}b 198.51.100.2/24 up - jexec alcatraz sysctl net.inet.ip.forwarding=1 - jexec alcatraz arp -s 198.51.100.3 00:01:02:03:04:05 - route add -net 198.51.100.0/24 192.0.2.2 - - jexec alcatraz pfctl -e - pft_set_rules alcatraz "block all" \ - "pass in proto udp to 198.51.100.3 port 53" \ - "pass out proto udp to 198.51.100.3 port 53" - - atf_check -s exit:0 $(atf_get_srcdir)/CVE-2019-icmp.py \ + atf_check -s exit:0 $(atf_get_srcdir)/CVE-2019-5598.py \ --sendif ${epair_in}a \ --recvif ${epair_out}a \ --src 192.0.2.1 \ From owner-svn-src-head@freebsd.org Sat Mar 23 02:48:49 2019 Return-Path: Delivered-To: svn-src-head@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 E843A155B1C4; Sat, 23 Mar 2019 02:48:48 +0000 (UTC) (envelope-from mw@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 8790371441; Sat, 23 Mar 2019 02:48:48 +0000 (UTC) (envelope-from mw@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 6498D1C69; Sat, 23 Mar 2019 02:48:48 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2N2mmIL047238; Sat, 23 Mar 2019 02:48:48 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2N2mm7g047236; Sat, 23 Mar 2019 02:48:48 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201903230248.x2N2mm7g047236@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Sat, 23 Mar 2019 02:48:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345432 - in head/sys/dev: etherswitch/e6000sw neta X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: in head/sys/dev: etherswitch/e6000sw neta X-SVN-Commit-Revision: 345432 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8790371441 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.98)[-0.976,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2019 02:48:49 -0000 Author: mw Date: Sat Mar 23 02:48:47 2019 New Revision: 345432 URL: https://svnweb.freebsd.org/changeset/base/345432 Log: Update mvneta/e6000sw for new DSA Device Tree Bindings In the latest Linux kernel revisions the DSA (Distributed Switch Architecture) device tree binding was changed. Instead of the top level dsa@ node, the switch and its ports is represented as a child node of the mdio bus. With that other modifications were added, such as relation with the ethernet port of the SoC. Adjust e6000sw etherswitch and mvneta drivers to that. Tested on Armada 3720 EspressoBin and Armada 388 Clearfog Pro boards. Submitted by: Bert JW Regeer Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D19036 Modified: head/sys/dev/etherswitch/e6000sw/e6000sw.c head/sys/dev/neta/if_mvneta.c Modified: head/sys/dev/etherswitch/e6000sw/e6000sw.c ============================================================================== --- head/sys/dev/etherswitch/e6000sw/e6000sw.c Sat Mar 23 02:17:07 2019 (r345431) +++ head/sys/dev/etherswitch/e6000sw/e6000sw.c Sat Mar 23 02:48:47 2019 (r345432) @@ -45,8 +45,8 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include +#include #include "e6000swreg.h" #include "etherswitch_if.h" @@ -92,6 +92,8 @@ static etherswitch_info_t etherswitch_info = { static void e6000sw_identify(driver_t *, device_t); static int e6000sw_probe(device_t); +static int e6000sw_parse_fixed_link(e6000sw_softc_t *, phandle_t, uint32_t); +static int e6000sw_parse_ethernet(e6000sw_softc_t *, phandle_t, uint32_t); static int e6000sw_attach(device_t); static int e6000sw_detach(device_t); static int e6000sw_readphy(device_t, int, int); @@ -197,15 +199,17 @@ e6000sw_probe(device_t dev) { e6000sw_softc_t *sc; const char *description; - phandle_t dsa_node, switch_node; + phandle_t switch_node; - dsa_node = fdt_find_compatible(OF_finddevice("/"), - "marvell,dsa", 0); - switch_node = OF_child(dsa_node); + switch_node = ofw_bus_find_compatible(OF_finddevice("/"), + "marvell,mv88e6085"); if (switch_node == 0) return (ENXIO); + if (bootverbose) + device_printf(dev, "Found switch_node: 0x%x\n", switch_node); + sc = device_get_softc(dev); sc->dev = dev; sc->node = switch_node; @@ -214,8 +218,12 @@ e6000sw_probe(device_t dev) sizeof(sc->sw_addr)) < 0) return (ENXIO); - if (!OF_hasprop(sc->node, "single-chip-addressing") && - (sc->sw_addr != 0 && (sc->sw_addr % 2) == 0)) + /* + * According to the Linux source code, all of the Switch IDs we support + * are multi_chip capable, and should go into multi-chip mode if the + * sw_addr != 0. + */ + if (!OF_hasprop(sc->node, "single-chip-addressing") && sc->sw_addr != 0) sc->multi_chip = true; /* @@ -262,11 +270,58 @@ e6000sw_probe(device_t dev) } static int -e6000sw_parse_child_fdt(e6000sw_softc_t *sc, phandle_t child, int *pport) +e6000sw_parse_fixed_link(e6000sw_softc_t *sc, phandle_t node, uint32_t port) { - char *name, *portlabel; int speed; phandle_t fixed_link; + + fixed_link = ofw_bus_find_child(node, "fixed-link"); + + if (fixed_link != 0) { + sc->fixed_mask |= (1 << port); + + if (OF_getencprop(fixed_link, "speed", &speed, sizeof(speed))> 0) { + if (speed == 2500 && + (MVSWITCH(sc, MV88E6141) || + MVSWITCH(sc, MV88E6341))) + sc->fixed25_mask |= (1 << port); + } else { + device_printf(sc->dev, + "Port %d has a fixed-link node without a speed " + "property\n", port); + + return (ENXIO); + } + } + + return (0); +} + +static int +e6000sw_parse_ethernet(e6000sw_softc_t *sc, phandle_t port_handle, uint32_t port) { + phandle_t switch_eth, switch_eth_handle; + + if (OF_getencprop(port_handle, "ethernet", (void*)&switch_eth_handle, + sizeof(switch_eth_handle)) > 0) { + if (switch_eth_handle > 0) { + switch_eth = OF_node_from_xref(switch_eth_handle); + + device_printf(sc->dev, "CPU port at %d\n", port); + sc->cpuports_mask |= (1 << port); + + return (e6000sw_parse_fixed_link(sc, switch_eth, port)); + } else + device_printf(sc->dev, + "Port %d has ethernet property but it points " + "to an invalid location\n", port); + } + + return (0); +} + +static int +e6000sw_parse_child_fdt(e6000sw_softc_t *sc, phandle_t child, int *pport) +{ uint32_t port; if (pport == NULL) @@ -278,32 +333,12 @@ e6000sw_parse_child_fdt(e6000sw_softc_t *sc, phandle_t return (ENXIO); *pport = port; - if (OF_getprop_alloc(child, "label", (void **)&portlabel) > 0) { - if (strncmp(portlabel, "cpu", 3) == 0) { - device_printf(sc->dev, "CPU port at %d\n", port); - sc->cpuports_mask |= (1 << port); - sc->fixed_mask |= (1 << port); - } - free(portlabel, M_OFWPROP); - } + if (e6000sw_parse_fixed_link(sc, child, port) != 0) + return (ENXIO); - fixed_link = OF_child(child); - if (fixed_link != 0 && - OF_getprop_alloc(fixed_link, "name", (void **)&name) > 0) { - if (strncmp(name, "fixed-link", 10) == 0) { - /* Assume defaults: 1g - full-duplex. */ - sc->fixed_mask |= (1 << port); - if (OF_getencprop(fixed_link, "speed", &speed, - sizeof(speed)) > 0) { - if (speed == 2500 && - (MVSWITCH(sc, MV88E6141) || - MVSWITCH(sc, MV88E6341))) { - sc->fixed25_mask |= (1 << port); - } - } - } - free(name, M_OFWPROP); - } + if (e6000sw_parse_ethernet(sc, child, port) != 0) + return (ENXIO); + if ((sc->fixed_mask & (1 << port)) != 0) device_printf(sc->dev, "fixed port at %d\n", port); else @@ -354,7 +389,7 @@ static int e6000sw_attach(device_t dev) { e6000sw_softc_t *sc; - phandle_t child; + phandle_t child, ports; int err, port; uint32_t reg; @@ -371,7 +406,15 @@ e6000sw_attach(device_t dev) E6000SW_LOCK(sc); e6000sw_setup(dev, sc); - for (child = OF_child(sc->node); child != 0; child = OF_peer(child)) { + ports = ofw_bus_find_child(sc->node, "ports"); + + if (ports == 0) { + device_printf(dev, "failed to parse DTS: no ports found for " + "switch\n"); + return (ENXIO); + } + + for (child = OF_child(ports); child != 0; child = OF_peer(child)) { err = e6000sw_parse_child_fdt(sc, child, &port); if (err != 0) { device_printf(sc->dev, "failed to parse DTS\n"); Modified: head/sys/dev/neta/if_mvneta.c ============================================================================== --- head/sys/dev/neta/if_mvneta.c Sat Mar 23 02:17:07 2019 (r345431) +++ head/sys/dev/neta/if_mvneta.c Sat Mar 23 02:48:47 2019 (r345432) @@ -189,6 +189,7 @@ STATIC void mvneta_clear_mib(struct mvneta_softc *); STATIC void mvneta_update_mib(struct mvneta_softc *); /* Switch */ +STATIC boolean_t mvneta_find_ethernet_prop_switch(phandle_t, phandle_t); STATIC boolean_t mvneta_has_switch(device_t); #define mvneta_sc_lock(sc) mtx_lock(&sc->mtx) @@ -412,25 +413,41 @@ mvneta_get_mac_address(struct mvneta_softc *sc, uint8_ } STATIC boolean_t -mvneta_has_switch(device_t self) +mvneta_find_ethernet_prop_switch(phandle_t ethernet, phandle_t node) { - phandle_t node, switch_node, switch_eth, switch_eth_handle; + boolean_t ret; + phandle_t child, switch_eth_handle, switch_eth; - node = ofw_bus_get_node(self); - switch_node = - ofw_bus_find_compatible(OF_finddevice("/"), "marvell,dsa"); - switch_eth = 0; + for (child = OF_child(node); child != 0; child = OF_peer(child)) { + if (OF_getencprop(child, "ethernet", (void*)&switch_eth_handle, + sizeof(switch_eth_handle)) > 0) { + if (switch_eth_handle > 0) { + switch_eth = OF_node_from_xref( + switch_eth_handle); - OF_getencprop(switch_node, "dsa,ethernet", - (void*)&switch_eth_handle, sizeof(switch_eth_handle)); + if (switch_eth == ethernet) + return (true); + } + } - if (switch_eth_handle > 0) - switch_eth = OF_node_from_xref(switch_eth_handle); + ret = mvneta_find_ethernet_prop_switch(ethernet, child); + if (ret != 0) + return (ret); + } - /* Return true if dsa,ethernet cell points to us */ - return (node == switch_eth); + return (false); } +STATIC boolean_t +mvneta_has_switch(device_t self) +{ + phandle_t node; + + node = ofw_bus_get_node(self); + + return mvneta_find_ethernet_prop_switch(node, OF_finddevice("/")); +} + STATIC int mvneta_dma_create(struct mvneta_softc *sc) { @@ -799,6 +816,8 @@ mvneta_attach(device_t self) if_link_state_change(sc->ifp, LINK_STATE_UP); if (mvneta_has_switch(self)) { + if (bootverbose) + device_printf(self, "This device is attached to a switch\n"); child = device_add_child(sc->dev, "mdio", -1); if (child == NULL) { ether_ifdetach(sc->ifp); From owner-svn-src-head@freebsd.org Sat Mar 23 02:53:48 2019 Return-Path: Delivered-To: svn-src-head@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 9819B155B6EF; Sat, 23 Mar 2019 02:53:48 +0000 (UTC) (envelope-from mw@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 35648719E7; Sat, 23 Mar 2019 02:53:48 +0000 (UTC) (envelope-from mw@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 C05A71E36; Sat, 23 Mar 2019 02:53:47 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2N2rls9052211; Sat, 23 Mar 2019 02:53:47 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2N2rlB4052210; Sat, 23 Mar 2019 02:53:47 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201903230253.x2N2rlB4052210@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Sat, 23 Mar 2019 02:53:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345433 - head/sys/arm64/conf X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/arm64/conf X-SVN-Commit-Revision: 345433 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 35648719E7 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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2019 02:53:48 -0000 Author: mw Date: Sat Mar 23 02:53:47 2019 New Revision: 345433 URL: https://svnweb.freebsd.org/changeset/base/345433 Log: Enable etherswitchcfg and e6000sw driver in arm64 build After latest binding update, this patch enables usage of the switch on Armada 3720 EspressoBin, so compile it by default with arm64 GENERIC. A patch was extracted from https://reviews.freebsd.org/D19036 Submitted by: Bert JW Regeer Reviewed by: manu Modified: head/sys/arm64/conf/GENERIC Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Sat Mar 23 02:48:47 2019 (r345432) +++ head/sys/arm64/conf/GENERIC Sat Mar 23 02:53:47 2019 (r345433) @@ -163,6 +163,11 @@ device vnic # Cavium ThunderX NIC device al_eth # Annapurna Alpine Ethernet NIC device dwc_rk # Rockchip Designware +# Etherswitch devices +device etherswitch # Enable etherswitch support +device miiproxy # Required for etherswitch +device e6000sw # Marvell mv88e6085 based switches + # Block devices device ahci device scbus From owner-svn-src-head@freebsd.org Sat Mar 23 04:00:16 2019 Return-Path: Delivered-To: svn-src-head@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 C1A32155D55C; Sat, 23 Mar 2019 04:00:16 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail.allbsd.org (mx-int.allbsd.org [IPv6:2001:2f0:104:e002::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mail.allbsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2BD9A747CB; Sat, 23 Mar 2019 04:00:16 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from mail-d.allbsd.org ([IPv6:2409:11:a740:4700:58:65ff:fe00:b0b]) (authenticated bits=56) by mail.allbsd.org (8.15.2/8.15.2) with ESMTPSA id x2N3xhlq074382 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) (Client CN "/CN=mail.allbsd.org", Issuer "/C=US/O=Let's+20Encrypt/CN=Let's+20Encrypt+20Authority+20X3"); Sat, 23 Mar 2019 12:59:58 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from alph.d.allbsd.org ([IPv6:2409:11:a740:4700:16:ceff:fe34:2700]) by mail-d.allbsd.org (8.15.2/8.15.2) with ESMTPS id x2N3xcTw017142 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 23 Mar 2019 12:59:38 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [[UNIX: localhost]]) (authenticated bits=0) by alph.d.allbsd.org (8.15.2/8.15.2) with ESMTPA id x2N3xa2A017139; Sat, 23 Mar 2019 12:59:38 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Sat, 23 Mar 2019 12:58:53 +0900 (JST) Message-Id: <20190323.125853.93885646440204179.hrs@allbsd.org> To: cy@FreeBSD.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r345400 - in head/libexec/rc: . rc.d From: Hiroki Sato In-Reply-To: <201903220130.x2M1Uq0p042374@repo.freebsd.org> References: <201903220130.x2M1Uq0p042374@repo.freebsd.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Sat_Mar_23_12_58_53_2019_110)--" Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.6.2 (mail.allbsd.org [IPv6:2001:2f0:104:e001:0:0:0:41]); Sat, 23 Mar 2019 13:00:08 +0900 (JST) X-Spam-Status: No, score=-96.4 required=13.0 tests=CONTENT_TYPE_PRESENT, QENCPTR1,RCVD_IN_AHBL,RCVD_IN_AHBL_PROXY,RCVD_IN_AHBL_SPAM,RDNS_NONE, SPF_SOFTFAIL,UNPARSEABLE_RELAY,USER_IN_WHITELIST autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mx.allbsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2019 04:00:17 -0000 ----Security_Multipart(Sat_Mar_23_12_58_53_2019_110)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cy Schubert wrote in <201903220130.x2M1Uq0p042374@repo.freebsd.org>: cy> Author: cy cy> Date: Fri Mar 22 01:30:51 2019 cy> New Revision: 345400 cy> URL: https://svnweb.freebsd.org/changeset/base/345400 cy> cy> Log: cy> Add rc.d support for ippool(8). cy> cy> I've been using ippool at my site for approximately two years. It's cy> about time this was committed. cy> cy> PR: 218433 cy> MFC after: 2 weeks cy> Added: head/libexec/rc/rc.d/ippool cy> ============================================================================== cy> --- /dev/null 00:00:00 1970 (empty, because file is newly added) cy> +++ head/libexec/rc/rc.d/ippool Fri Mar 22 01:30:51 2019 (r345400) cy> @@ -0,0 +1,40 @@ cy> +#!/bin/sh cy> +# cy> +# $FreeBSD$ cy> +# cy> + cy> +# PROVIDE: ippool cy> +# REQUIRE: FILESYSTEMS cy> +# BEFORE: ipfilter cy> +# KEYWORD: nojail cy> + cy> +. /etc/rc.subr cy> + cy> +name="ippool" cy> +desc="user interface to the IPFilter pools" cy> +rcvar="ippool_enable" cy> +load_rc_config $name cy> +start_cmd="ippool_start" cy> +stop_cmd="${ippool_program} -F" cy> +reload_cmd="ippool_reload" cy> +extra_commands="reload" cy> +required_files="${ippool_rules}" cy> +required_modules="ipl:ipfilter" cy> + cy> +ippool_start() cy> +{ cy> + if [ -r "${ippool_rules}" ]; then cy> + echo "Loading IP Pools." cy> + ${ippool_program} -f ${ippool_rules} ${ippool_flags} cy> + fi This conditional is redundant. $required_files will check readability of $ippool_rules. And if you want to add a flag, use of precmd is the right way like the following: ---- start_precmd="ippool_start_precmd" ippool_start_precmd() { rc_flags="-f ${ippool_rules} ${rc_flags}" } ---- -- Hiroki ----Security_Multipart(Sat_Mar_23_12_58_53_2019_110)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iEYEABECAAYFAlyVrv0ACgkQTyzT2CeTzy3KRgCeNS2SVXbMaxnNW943I/GeilIK RxIAoIKzy+RLkcZrKxapM1oiYNbajFMi =Ay7D -----END PGP SIGNATURE----- ----Security_Multipart(Sat_Mar_23_12_58_53_2019_110)---- From owner-svn-src-head@freebsd.org Sat Mar 23 02:17:08 2019 Return-Path: Delivered-To: svn-src-head@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 B8932155A0C1; Sat, 23 Mar 2019 02:17:08 +0000 (UTC) (envelope-from oshogbo@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 5C34A7022A; Sat, 23 Mar 2019 02:17:08 +0000 (UTC) (envelope-from oshogbo@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 1D50E1715; Sat, 23 Mar 2019 02:17:08 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2N2H7Nq031714; Sat, 23 Mar 2019 02:17:07 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2N2H726031713; Sat, 23 Mar 2019 02:17:07 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201903230217.x2N2H726031713@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Sat, 23 Mar 2019 02:17:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345431 - head/contrib/elftoolchain/strings X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: head/contrib/elftoolchain/strings X-SVN-Commit-Revision: 345431 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5C34A7022A 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.975,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2019 02:17:09 -0000 Author: oshogbo Date: Sat Mar 23 02:17:07 2019 New Revision: 345431 URL: https://svnweb.freebsd.org/changeset/base/345431 Log: strings: return an error code and the char value separately If we returning 32 bits value it's hard to distinguish if the returned value is a valid one or if its an error (in case of EOF). For that reason separate exit code of the function from the returned character. Reported by: cem, se Modified: head/contrib/elftoolchain/strings/strings.c Modified: head/contrib/elftoolchain/strings/strings.c ============================================================================== --- head/contrib/elftoolchain/strings/strings.c Sat Mar 23 01:07:51 2019 (r345430) +++ head/contrib/elftoolchain/strings/strings.c Sat Mar 23 02:17:07 2019 (r345431) @@ -84,7 +84,7 @@ static struct option strings_longopts[] = { { NULL, 0, NULL, 0 } }; -long getcharacter(FILE *); +int getcharacter(FILE *, long *); int handle_file(const char *); int handle_elf(const char *, FILE *); int handle_binary(const char *, FILE *, size_t); @@ -291,42 +291,43 @@ handle_elf(const char *name, FILE *pfile) * Retrieves a character from input stream based on the encoding * type requested. */ -long -getcharacter(FILE *pfile) +int +getcharacter(FILE *pfile, long *rt) { - long rt; int i, c; char buf[4]; for(i = 0; i < encoding_size; i++) { c = getc(pfile); if (c == EOF) - return (EOF); + return (-1); buf[i] = c; } - rt = EOF; switch (encoding) { case ENCODING_7BIT: case ENCODING_8BIT: - rt = buf[0]; + *rt = buf[0]; break; case ENCODING_16BIT_BIG: - rt = (buf[0] << 8) | buf[1]; + *rt = (buf[0] << 8) | buf[1]; break; case ENCODING_16BIT_LITTLE: - rt = buf[0] | (buf[1] << 8); - break; + *rt = buf[0] | (buf[1] << 8); + break; case ENCODING_32BIT_BIG: - rt = ((long) buf[0] << 24) | ((long) buf[1] << 16) | + *rt = ((long) buf[0] << 24) | ((long) buf[1] << 16) | ((long) buf[2] << 8) | buf[3]; break; case ENCODING_32BIT_LITTLE: - rt = buf[0] | ((long) buf[1] << 8) | ((long) buf[2] << 16) | + *rt = buf[0] | ((long) buf[1] << 8) | ((long) buf[2] << 16) | ((long) buf[3] << 24); break; + default: + return (-1); } - return (rt); + + return (0); } /* @@ -357,8 +358,7 @@ find_strings(const char *name, FILE *pfile, off_t offs start_off = cur_off; memset(obuf, 0, min_len + 1); for(i = 0; i < min_len; i++) { - c = getcharacter(pfile); - if (c == EOF) + if (getcharacter(pfile, &c) < 0) goto _exit1; if (PRINTABLE(c)) { obuf[i] = c; @@ -400,15 +400,16 @@ find_strings(const char *name, FILE *pfile, off_t offs if ((offset + size) && (cur_off >= offset + size)) break; - c = getcharacter(pfile); - cur_off += encoding_size; - if (!PRINTABLE(c) || c == EOF) + if (getcharacter(pfile, &c) < 0) break; + cur_off += encoding_size; if (encoding == ENCODING_8BIT && (uint8_t)c > 127) { putchar(c); continue; } + if (!PRINTABLE(c)) + break; putchar(c); } putchar('\n'); From owner-svn-src-head@freebsd.org Sat Mar 23 04:32:11 2019 Return-Path: Delivered-To: svn-src-head@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 4F99B155E56E; Sat, 23 Mar 2019 04:32:11 +0000 (UTC) (envelope-from cy@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 EAC3D75C72; Sat, 23 Mar 2019 04:32:10 +0000 (UTC) (envelope-from cy@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 8B7BE30B8; Sat, 23 Mar 2019 04:32:10 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2N4WAEf005764; Sat, 23 Mar 2019 04:32:10 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2N4WAg9005763; Sat, 23 Mar 2019 04:32:10 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201903230432.x2N4WAg9005763@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 23 Mar 2019 04:32:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345437 - head/libexec/rc/rc.d X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/libexec/rc/rc.d X-SVN-Commit-Revision: 345437 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EAC3D75C72 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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2019 04:32:11 -0000 Author: cy Date: Sat Mar 23 04:32:10 2019 New Revision: 345437 URL: https://svnweb.freebsd.org/changeset/base/345437 Log: The check for $ippool_rules in start_cmd is tautological. Reported by: hrs@ MFC after: 13 days X-MFC with: r345400 Modified: head/libexec/rc/rc.d/ippool Modified: head/libexec/rc/rc.d/ippool ============================================================================== --- head/libexec/rc/rc.d/ippool Sat Mar 23 03:37:08 2019 (r345436) +++ head/libexec/rc/rc.d/ippool Sat Mar 23 04:32:10 2019 (r345437) @@ -14,19 +14,16 @@ name="ippool" desc="user interface to the IPFilter pools" rcvar="ippool_enable" load_rc_config $name -start_cmd="ippool_start" +start_precmd="ippool_start_precmd" stop_cmd="${ippool_program} -F" reload_cmd="ippool_reload" extra_commands="reload" required_files="${ippool_rules}" required_modules="ipl:ipfilter" -ippool_start() +ippool_start_precmd() { - if [ -r "${ippool_rules}" ]; then - echo "Loading IP Pools." - ${ippool_program} -f ${ippool_rules} ${ippool_flags} - fi + rc_flags="-f ${ippool_rules} ${rc_flags}" } ippool_reload() From owner-svn-src-head@freebsd.org Sat Mar 23 03:23:22 2019 Return-Path: Delivered-To: svn-src-head@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 2C0DF155C7FA; Sat, 23 Mar 2019 03:23:22 +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 C1A4773243; Sat, 23 Mar 2019 03:23:21 +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 97D052414; Sat, 23 Mar 2019 03:23:21 +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 x2N3NLwe068854; Sat, 23 Mar 2019 03:23:21 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2N3NKCo068847; Sat, 23 Mar 2019 03:23:20 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201903230323.x2N3NKCo068847@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sat, 23 Mar 2019 03:23:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345435 - in head/sys: conf powerpc/include powerpc/powernv powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys: conf powerpc/include powerpc/powernv powerpc/powerpc X-SVN-Commit-Revision: 345435 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C1A4773243 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.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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2019 03:23:22 -0000 Author: jhibbits Date: Sat Mar 23 03:23:20 2019 New Revision: 345435 URL: https://svnweb.freebsd.org/changeset/base/345435 Log: powernv: Add Hypervisor Maintenance Interrupt handler Attempting to build www/firefox on POWER9 resulted in a HMI exception being thrown, a fatal trap currently. This is typically caused by timer facility errors, but examination of the Hypervisor Maintenance Exception Register (HMER) yielded only that an exception had recovered, with no information of the actual exception cause. When an HMI occurs, OPAL_HANDLE_HMI or OPAL_HANDLE_HMI2 must be called to handle the exception at the firmware level. If the exception is handled, we can continue. This adds only the preliminary handler, enough to prevent package building from panicking. An enhancement in the future is to use the flags returned by OPAL_HANDLE_HMI2 to print more useful error messages, and log maintenance events. Reviewed by: luporl MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D19634 Added: head/sys/powerpc/powernv/opal_hmi.c (contents, props changed) Modified: head/sys/conf/files.powerpc head/sys/powerpc/include/spr.h head/sys/powerpc/include/trap.h head/sys/powerpc/powernv/opal.h head/sys/powerpc/powerpc/interrupt.c Modified: head/sys/conf/files.powerpc ============================================================================== --- head/sys/conf/files.powerpc Sat Mar 23 03:10:23 2019 (r345434) +++ head/sys/conf/files.powerpc Sat Mar 23 03:23:20 2019 (r345435) @@ -192,6 +192,7 @@ powerpc/powernv/opal_async.c optional powernv powerpc/powernv/opal_console.c optional powernv powerpc/powernv/opal_dev.c optional powernv powerpc/powernv/opal_flash.c optional powernv +powerpc/powernv/opal_hmi.c optional powernv powerpc/powernv/opal_i2c.c optional iicbus fdt powernv powerpc/powernv/opal_i2cm.c optional iicbus fdt powernv powerpc/powernv/opal_pci.c optional powernv pci Modified: head/sys/powerpc/include/spr.h ============================================================================== --- head/sys/powerpc/include/spr.h Sat Mar 23 03:10:23 2019 (r345434) +++ head/sys/powerpc/include/spr.h Sat Mar 23 03:23:20 2019 (r345435) @@ -242,6 +242,8 @@ #define LPCR_PECE_ME (1ULL << 12) /* Machine Check and Hypervisor */ /* Maintenance exceptions */ #define SPR_LPID 0x13f /* Logical Partitioning Control */ +#define SPR_HMER 0x150 /* Hypervisor Maintenance Exception Register */ +#define SPR_HMEER 0x151 /* Hypervisor Maintenance Exception Enable Register */ #define SPR_PTCR 0x1d0 /* Partition Table Control Register */ #define SPR_SPEFSCR 0x200 /* ..8 Signal Processing Engine FSCR. */ Modified: head/sys/powerpc/include/trap.h ============================================================================== --- head/sys/powerpc/include/trap.h Sat Mar 23 03:10:23 2019 (r345434) +++ head/sys/powerpc/include/trap.h Sat Mar 23 03:23:20 2019 (r345435) @@ -153,6 +153,7 @@ #ifndef LOCORE struct trapframe; struct pcb; +extern int (*hmi_handler)(struct trapframe *); void trap(struct trapframe *); int ppc_instr_emulate(struct trapframe *, struct pcb *); #endif Modified: head/sys/powerpc/powernv/opal.h ============================================================================== --- head/sys/powerpc/powernv/opal.h Sat Mar 23 03:10:23 2019 (r345434) +++ head/sys/powerpc/powernv/opal.h Sat Mar 23 03:23:20 2019 (r345435) @@ -71,8 +71,10 @@ int opal_call(uint64_t token, ...); #define OPAL_PCI_MAP_PE_DMA_WINDOW_REAL 45 #define OPAL_RETURN_CPU 69 #define OPAL_REINIT_CPUS 70 +#define OPAL_CHECK_TOKEN 80 #define OPAL_CHECK_ASYNC_COMPLETION 86 #define OPAL_SENSOR_READ 88 +#define OPAL_HANDLE_HMI 98 #define OPAL_IPMI_SEND 107 #define OPAL_IPMI_RECV 108 #define OPAL_I2C_REQUEST 109 @@ -102,6 +104,7 @@ int opal_call(uint64_t token, ...); #define OPAL_SENSOR_GROUP_CLEAR 156 #define OPAL_SENSOR_READ_U64 162 #define OPAL_SENSOR_GROUP_ENABLE 163 +#define OPAL_HANDLE_HMI2 166 /* For OPAL_PCI_SET_PE */ #define OPAL_UNMAP_PE 0 @@ -133,6 +136,15 @@ int opal_call(uint64_t token, ...); #define OPAL_EMPTY -16 #define OPAL_XIVE_PROVISIONING -31 #define OPAL_XIVE_FREE_ACTIVE -32 + +#define OPAL_TOKEN_ABSENT 0 +#define OPAL_TOKEN_PRESENT 1 + +#define OPAL_HMI_FLAGS_TB_RESYNC (1ull << 0) +#define OPAL_HMI_FLAGS_DEC_LOST (1ull << 1) +#define OPAL_HMI_FLAGS_HDEC_LOST (1ull << 2) +#define OPAL_HMI_FLAGS_TOD_TB_FAIL (1ull << 3) +#define OPAL_HMI_FLAGS_NEW_EVENT (1ull << 63) #define OPAL_XIVE_XICS_MODE_EMU 0 #define OPAL_XIVE_XICS_MODE_EXP 1 Added: head/sys/powerpc/powernv/opal_hmi.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/powerpc/powernv/opal_hmi.c Sat Mar 23 03:23:20 2019 (r345435) @@ -0,0 +1,97 @@ +/*- + * Copyright (c) 2019 Justin Hibbits + * + * 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 ``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 BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include "opal.h" + +static int +opal_hmi_handler2(struct trapframe *frame) +{ + int64_t flags; + int err; + + err = opal_call(OPAL_HANDLE_HMI2, vtophys(&flags)); + + /* XXX: At some point, handle the flags outvar. */ + if (err == OPAL_SUCCESS) { + mtspr(SPR_HMER, 0); + return (0); + } + + printf("HMI handler failed! OPAL error code: %d\n", err); + + return (-1); +} + +static int +opal_hmi_handler(struct trapframe *frame) +{ + int err; + + err = opal_call(OPAL_HANDLE_HMI); + + if (err == OPAL_SUCCESS) { + mtspr(SPR_HMER, 0); + return (0); + } + + printf("HMI handler failed! OPAL error code: %d\n", err); + + return (-1); +} + +static void +opal_setup_hmi(void *data) +{ + /* This only works for OPAL, so first make sure we have it. */ + if (opal_check() != 0) + return; + + if (opal_call(OPAL_CHECK_TOKEN, OPAL_HANDLE_HMI2) == OPAL_TOKEN_PRESENT) + hmi_handler = opal_hmi_handler2; + else if (opal_call(OPAL_CHECK_TOKEN, OPAL_HANDLE_HMI) == OPAL_TOKEN_PRESENT) + hmi_handler = opal_hmi_handler; + else { + printf("Warning: No OPAL HMI handler found.\n"); + return; + } + + if (bootverbose) + printf("Installed OPAL HMI handler.\n"); +} + +SYSINIT(opal_setup_hmi, SI_SUB_HYPERVISOR, SI_ORDER_ANY, opal_setup_hmi, NULL); Modified: head/sys/powerpc/powerpc/interrupt.c ============================================================================== --- head/sys/powerpc/powerpc/interrupt.c Sat Mar 23 03:10:23 2019 (r345434) +++ head/sys/powerpc/powerpc/interrupt.c Sat Mar 23 03:23:20 2019 (r345435) @@ -32,6 +32,7 @@ */ #include "opt_hwpmc_hooks.h" +#include "opt_platform.h" #include /* RCS ID & Copyright macro defns */ @@ -68,6 +69,10 @@ #include "pic_if.h" +#ifdef POWERNV +int (*hmi_handler)(struct trapframe *); +#endif + /* * A very short dispatch, to try and maximise assembler code use * between all exception types. Maybe 'true' interrupts should go @@ -117,6 +122,13 @@ powerpc_interrupt(struct trapframe *framep) pmc_hook(PCPU_GET(curthread), PMC_FN_USER_CALLCHAIN, framep); critical_exit(); break; +#endif + +#ifdef POWERNV + case EXC_HMI: + if (hmi_handler != 0 && hmi_handler(framep) == 0) + break; + /* If no handler, or failure to handle, just drop to trap. */ #endif default: From owner-svn-src-head@freebsd.org Sat Mar 23 05:13:54 2019 Return-Path: Delivered-To: svn-src-head@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 3E3A8155F6D7; Sat, 23 Mar 2019 05:13:54 +0000 (UTC) (envelope-from mw@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 D8D5A772C4; Sat, 23 Mar 2019 05:13:53 +0000 (UTC) (envelope-from mw@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 B40EB3978; Sat, 23 Mar 2019 05:13:53 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2N5DrAB026734; Sat, 23 Mar 2019 05:13:53 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2N5DqoC026727; Sat, 23 Mar 2019 05:13:52 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201903230513.x2N5DqoC026727@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Sat, 23 Mar 2019 05:13:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345438 - in head/sys: conf dev/random dev/tpm sys X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: in head/sys: conf dev/random dev/tpm sys X-SVN-Commit-Revision: 345438 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D8D5A772C4 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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2019 05:13:54 -0000 Author: mw Date: Sat Mar 23 05:13:51 2019 New Revision: 345438 URL: https://svnweb.freebsd.org/changeset/base/345438 Log: Allow using TPM as entropy source. TPM has a built-in RNG, with its own entropy source. The driver was extended to harvest 16 random bytes from TPM every 10 seconds. A new build option "TPM_HARVEST" was introduced - for now, however, it is not enabled by default in the GENERIC config. Submitted by: Kornel Duleba Reviewed by: markm, delphij Approved by: secteam Obtained from: Semihalf Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D19620 Modified: head/sys/conf/options head/sys/dev/random/random_harvestq.c head/sys/dev/tpm/tpm20.c head/sys/dev/tpm/tpm20.h head/sys/dev/tpm/tpm_crb.c head/sys/dev/tpm/tpm_tis.c head/sys/sys/random.h Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Sat Mar 23 04:32:10 2019 (r345437) +++ head/sys/conf/options Sat Mar 23 05:13:51 2019 (r345438) @@ -983,6 +983,9 @@ RANDOM_LOADABLE opt_global.h RANDOM_ENABLE_UMA opt_global.h RANDOM_ENABLE_ETHER opt_global.h +# This options turns TPM into entropy source. +TPM_HARVEST opt_tpm.h + # BHND(4) driver BHND_LOGLEVEL opt_global.h Modified: head/sys/dev/random/random_harvestq.c ============================================================================== --- head/sys/dev/random/random_harvestq.c Sat Mar 23 04:32:10 2019 (r345437) +++ head/sys/dev/random/random_harvestq.c Sat Mar 23 05:13:51 2019 (r345438) @@ -330,6 +330,7 @@ static const char *random_source_descr[ENTROPYSOURCE] [RANDOM_PURE_BROADCOM] = "PURE_BROADCOM", [RANDOM_PURE_CCP] = "PURE_CCP", [RANDOM_PURE_DARN] = "PURE_DARN", + [RANDOM_PURE_TPM] = "PURE_TPM", /* "ENTROPYSOURCE" */ }; Modified: head/sys/dev/tpm/tpm20.c ============================================================================== --- head/sys/dev/tpm/tpm20.c Sat Mar 23 04:32:10 2019 (r345437) +++ head/sys/dev/tpm/tpm20.c Sat Mar 23 05:13:51 2019 (r345438) @@ -28,13 +28,27 @@ #include __FBSDID("$FreeBSD$"); +#include + #include "tpm20.h" +#define TPM_HARVEST_SIZE 16 +/* + * Perform a harvest every 10 seconds. + * Since discrete TPMs are painfully slow + * we don't want to execute this too often + * as the chip is likely to be used by others too. + */ +#define TPM_HARVEST_INTERVAL 10000000 + MALLOC_DECLARE(M_TPM20); MALLOC_DEFINE(M_TPM20, "tpm_buffer", "buffer for tpm 2.0 driver"); static void tpm20_discard_buffer(void *arg); -static int tpm20_save_state(device_t dev, bool suspend); +#ifdef TPM_HARVEST +static void tpm20_harvest(void *arg); +#endif +static int tpm20_save_state(device_t dev, bool suspend); static d_open_t tpm20_open; static d_close_t tpm20_close; @@ -175,6 +189,11 @@ tpm20_init(struct tpm_sc *sc) sx_init(&sc->dev_lock, "TPM driver lock"); cv_init(&sc->buf_cv, "TPM buffer cv"); callout_init(&sc->discard_buffer_callout, 1); +#ifdef TPM_HARVEST + sc->harvest_ticks = TPM_HARVEST_INTERVAL / tick; + callout_init(&sc->harvest_callout, 1); + callout_reset(&sc->harvest_callout, 0, tpm20_harvest, sc); +#endif sc->pending_data_length = 0; make_dev_args_init(&args); @@ -195,6 +214,10 @@ void tpm20_release(struct tpm_sc *sc) { +#ifdef TPM_HARVEST + callout_drain(&sc->harvest_callout); +#endif + if (sc->buf != NULL) free(sc->buf, M_TPM20); @@ -216,6 +239,57 @@ tpm20_shutdown(device_t dev) { return (tpm20_save_state(dev, false)); } + +#ifdef TPM_HARVEST + +/* + * Get TPM_HARVEST_SIZE random bytes and add them + * into system entropy pool. + */ +static void +tpm20_harvest(void *arg) +{ + struct tpm_sc *sc; + unsigned char entropy[TPM_HARVEST_SIZE]; + uint16_t entropy_size; + int result; + uint8_t cmd[] = { + 0x80, 0x01, /* TPM_ST_NO_SESSIONS tag*/ + 0x00, 0x00, 0x00, 0x0c, /* cmd length */ + 0x00, 0x00, 0x01, 0x7b, /* cmd TPM_CC_GetRandom */ + 0x00, TPM_HARVEST_SIZE /* number of bytes requested */ + }; + + + sc = arg; + sx_xlock(&sc->dev_lock); + + memcpy(sc->buf, cmd, sizeof(cmd)); + result = sc->transmit(sc, sizeof(cmd)); + if (result != 0) { + sx_xunlock(&sc->dev_lock); + return; + } + + /* Ignore response size */ + sc->pending_data_length = 0; + + /* The number of random bytes we got is placed right after the header */ + entropy_size = (uint16_t) sc->buf[TPM_HEADER_SIZE + 1]; + if (entropy_size > 0) { + entropy_size = MIN(entropy_size, TPM_HARVEST_SIZE); + memcpy(entropy, + sc->buf + TPM_HEADER_SIZE + sizeof(uint16_t), + entropy_size); + } + + sx_xunlock(&sc->dev_lock); + if (entropy_size > 0) + random_harvest_queue(entropy, entropy_size, RANDOM_PURE_TPM); + + callout_reset(&sc->harvest_callout, sc->harvest_ticks, tpm20_harvest, sc); +} +#endif /* TPM_HARVEST */ static int tpm20_save_state(device_t dev, bool suspend) Modified: head/sys/dev/tpm/tpm20.h ============================================================================== --- head/sys/dev/tpm/tpm20.h Sat Mar 23 04:32:10 2019 (r345437) +++ head/sys/dev/tpm/tpm20.h Sat Mar 23 05:13:51 2019 (r345438) @@ -55,6 +55,8 @@ __FBSDID("$FreeBSD$"); #include #include "opt_acpi.h" +#include "opt_tpm.h" + #define BIT(x) (1 << (x)) /* Timeouts in us */ @@ -120,6 +122,10 @@ struct tpm_sc { size_t pending_data_length; struct callout discard_buffer_callout; +#ifdef TPM_HARVEST + struct callout harvest_callout; + int harvest_ticks; +#endif int (*transmit)(struct tpm_sc *, size_t); }; Modified: head/sys/dev/tpm/tpm_crb.c ============================================================================== --- head/sys/dev/tpm/tpm_crb.c Sat Mar 23 04:32:10 2019 (r345437) +++ head/sys/dev/tpm/tpm_crb.c Sat Mar 23 05:13:51 2019 (r345438) @@ -165,7 +165,8 @@ tpmcrb_attach(device_t dev) return (ENXIO); if(!tpmcrb_request_locality(sc, 0)) { - tpmcrb_detach(dev); + bus_release_resource(dev, SYS_RES_MEMORY, + sc->mem_rid, sc->mem_res); return (ENXIO); } @@ -231,12 +232,12 @@ tpmcrb_detach(device_t dev) struct tpm_sc *sc; sc = device_get_softc(dev); + tpm20_release(sc); if (sc->mem_res != NULL) bus_release_resource(dev, SYS_RES_MEMORY, sc->mem_rid, sc->mem_res); - tpm20_release(sc); return (0); } Modified: head/sys/dev/tpm/tpm_tis.c ============================================================================== --- head/sys/dev/tpm/tpm_tis.c Sat Mar 23 04:32:10 2019 (r345437) +++ head/sys/dev/tpm/tpm_tis.c Sat Mar 23 05:13:51 2019 (r345438) @@ -162,6 +162,7 @@ tpmtis_detach(device_t dev) struct tpm_sc *sc; sc = device_get_softc(dev); + tpm20_release(sc); if (sc->intr_cookie != NULL) bus_teardown_intr(dev, sc->irq_res, sc->intr_cookie); @@ -174,7 +175,6 @@ tpmtis_detach(device_t dev) bus_release_resource(dev, SYS_RES_MEMORY, sc->mem_rid, sc->mem_res); - tpm20_release(sc); return (0); } Modified: head/sys/sys/random.h ============================================================================== --- head/sys/sys/random.h Sat Mar 23 04:32:10 2019 (r345437) +++ head/sys/sys/random.h Sat Mar 23 05:13:51 2019 (r345438) @@ -87,6 +87,7 @@ enum random_entropy_source { RANDOM_PURE_BROADCOM, RANDOM_PURE_CCP, RANDOM_PURE_DARN, + RANDOM_PURE_TPM, ENTROPYSOURCE }; _Static_assert(ENTROPYSOURCE <= 32, From owner-svn-src-head@freebsd.org Sat Mar 23 04:33:26 2019 Return-Path: Delivered-To: svn-src-head@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 BE81B155E5E3; Sat, 23 Mar 2019 04:33:26 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4962675F3B; Sat, 23 Mar 2019 04:33:25 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id 7YLLh3BrJLdsa7YLMhtYZG; Fri, 22 Mar 2019 22:33:17 -0600 X-Authority-Analysis: v=2.3 cv=G9Zi7Os5 c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=NTGMnVQrEZIA:10 a=Wi8YH2NmAAAA:8 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=TU3Kt4leLilQqZbvHCoA:9 a=CjuIK1q_8ugA:10 a=dHv3ApjLk2iqpRL9FmoU:22 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id B1434107; Fri, 22 Mar 2019 21:33:14 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id x2N4XEjR013862; Fri, 22 Mar 2019 21:33:14 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id x2N4XEni013859; Fri, 22 Mar 2019 21:33:14 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201903230433.x2N4XEni013859@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Hiroki Sato cc: cy@FreeBSD.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r345400 - in head/libexec/rc: . rc.d In-Reply-To: Message from Hiroki Sato of "Sat, 23 Mar 2019 12:58:53 +0900." <20190323.125853.93885646440204179.hrs@allbsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 22 Mar 2019 21:33:14 -0700 X-CMAE-Envelope: MS4wfJ2dYZArhCduDKUNINTaas/IZZNlJVkZx7RwmGsjvxq82izLtArHGRgBHeaUj1xok0cNYlbugwkv+fvmjYAthFmiR+7/xGrUUDMcRxgr45Q+HP/3tE/k 5VC6yI3h6xd8JtTtDwxRj5yODjfKOhQSEoSCy6EIavvR/UW5yxUIl6jeKRNvzpPCrQF2i7BFiWxBTNbb1KMdhkG/rs8NByyRjMuakBHNcVU1Wsg6kj2tqvQr QU0j6bH4QFvUpn9qE6VBlEoYCRisK23XNeuE385xgHx9ZXoXkkxaO45S/EK7qE/OCYA9eOjOJPD+NCXsF7AQVA== X-Rspamd-Queue-Id: 4962675F3B X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-4.96 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.zen.spamhaus.org : 127.0.0.11]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; MV_CASE(0.50)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; REPLYTO_EQ_FROM(0.00)[]; IP_SCORE(-2.37)[ip: (-6.54), ipnet: 64.59.128.0/20(-2.94), asn: 6327(-2.26), country: CA(-0.09)]; MX_GOOD(-0.01)[cached: spqr.komquats.com]; NEURAL_HAM_SHORT(-0.88)[-0.880,0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; RCVD_TLS_LAST(0.00)[]; RCVD_IN_DNSWL_LOW(-0.10)[13.134.59.64.list.dnswl.org : 127.0.5.1] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2019 04:33:27 -0000 In message <20190323.125853.93885646440204179.hrs@allbsd.org>, Hiroki Sato writ es: > ----Security_Multipart(Sat_Mar_23_12_58_53_2019_110)-- > Content-Type: Text/Plain; charset=us-ascii > Content-Transfer-Encoding: 7bit > > Cy Schubert wrote > in <201903220130.x2M1Uq0p042374@repo.freebsd.org>: > > cy> Author: cy > cy> Date: Fri Mar 22 01:30:51 2019 > cy> New Revision: 345400 > cy> URL: https://svnweb.freebsd.org/changeset/base/345400 > cy> > cy> Log: > cy> Add rc.d support for ippool(8). > cy> > cy> I've been using ippool at my site for approximately two years. It's > cy> about time this was committed. > cy> > cy> PR: 218433 > cy> MFC after: 2 weeks > > cy> Added: head/libexec/rc/rc.d/ippool > cy> ========================================================================= > ===== > cy> --- /dev/null 00:00:00 1970 (empty, because file is newly added) > cy> +++ head/libexec/rc/rc.d/ippool Fri Mar 22 01:30:51 2019 (r34540 > 0) > cy> @@ -0,0 +1,40 @@ > cy> +#!/bin/sh > cy> +# > cy> +# $FreeBSD$ > cy> +# > cy> + > cy> +# PROVIDE: ippool > cy> +# REQUIRE: FILESYSTEMS > cy> +# BEFORE: ipfilter > cy> +# KEYWORD: nojail > cy> + > cy> +. /etc/rc.subr > cy> + > cy> +name="ippool" > cy> +desc="user interface to the IPFilter pools" > cy> +rcvar="ippool_enable" > cy> +load_rc_config $name > cy> +start_cmd="ippool_start" > cy> +stop_cmd="${ippool_program} -F" > cy> +reload_cmd="ippool_reload" > cy> +extra_commands="reload" > cy> +required_files="${ippool_rules}" > cy> +required_modules="ipl:ipfilter" > cy> + > cy> +ippool_start() > cy> +{ > cy> + if [ -r "${ippool_rules}" ]; then > cy> + echo "Loading IP Pools." > cy> + ${ippool_program} -f ${ippool_rules} ${ippool_flags} > cy> + fi > > This conditional is redundant. $required_files will check > readability of $ippool_rules. > > And if you want to add a flag, use of precmd is the right way like > the following: > > ---- > start_precmd="ippool_start_precmd" > > ippool_start_precmd() > { > rc_flags="-f ${ippool_rules} ${rc_flags}" > } > ---- Thanks for this. Fixed. -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Sat Mar 23 09:56:42 2019 Return-Path: Delivered-To: svn-src-head@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 4927E15467C7; Sat, 23 Mar 2019 09:56:42 +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 E295A88405; Sat, 23 Mar 2019 09:56:41 +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 D50386B63; Sat, 23 Mar 2019 09:56:41 +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 x2N9uffi071033; Sat, 23 Mar 2019 09:56:41 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2N9ufoW071032; Sat, 23 Mar 2019 09:56:41 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201903230956.x2N9ufoW071032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 23 Mar 2019 09:56:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345441 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 345441 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E295A88405 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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2019 09:56:42 -0000 Author: tuexen Date: Sat Mar 23 09:56:41 2019 New Revision: 345441 URL: https://svnweb.freebsd.org/changeset/base/345441 Log: Fix a KASSERT() in tcp_output(). When checking the length of the headers at this point, the IP level options have not been added to the mbuf chain. So don't take them into account. Reported by: syzbot+16025fff7ee5f7c5957b@syzkaller.appspotmail.com Reported by: syzbot+adb5836b8a9ff621b2aa@syzkaller.appspotmail.com Reported by: syzbot+d25a5352bcdf40acdbb8@syzkaller.appspotmail.com Reviewed by: rrs@ MFC after: 3 days Sponsored by: Netflix, Inc. Modified: head/sys/netinet/tcp_output.c Modified: head/sys/netinet/tcp_output.c ============================================================================== --- head/sys/netinet/tcp_output.c Sat Mar 23 07:07:44 2019 (r345440) +++ head/sys/netinet/tcp_output.c Sat Mar 23 09:56:41 2019 (r345441) @@ -1284,15 +1284,9 @@ send: m->m_pkthdr.tso_segsz = tp->t_maxseg - optlen; } -#if defined(IPSEC) || defined(IPSEC_SUPPORT) - KASSERT(len + hdrlen + ipoptlen - ipsec_optlen == m_length(m, NULL), - ("%s: mbuf chain shorter than expected: %d + %u + %u - %u != %u", - __func__, len, hdrlen, ipoptlen, ipsec_optlen, m_length(m, NULL))); -#else - KASSERT(len + hdrlen + ipoptlen == m_length(m, NULL), - ("%s: mbuf chain shorter than expected: %d + %u + %u != %u", - __func__, len, hdrlen, ipoptlen, m_length(m, NULL))); -#endif + KASSERT(len + hdrlen == m_length(m, NULL), + ("%s: mbuf chain shorter than expected: %d + %u != %u", + __func__, len, hdrlen, m_length(m, NULL))); #ifdef TCP_HHOOK /* Run HHOOK_TCP_ESTABLISHED_OUT helper hooks. */ From owner-svn-src-head@freebsd.org Sat Mar 23 10:13:02 2019 Return-Path: Delivered-To: svn-src-head@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 887FD15477F5; Sat, 23 Mar 2019 10:13:02 +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 28D3689345; Sat, 23 Mar 2019 10:13:02 +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 F3D896EF4; Sat, 23 Mar 2019 10:13:01 +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 x2NAD1HS081562; Sat, 23 Mar 2019 10:13:01 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2NAD1Ud081560; Sat, 23 Mar 2019 10:13:01 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201903231013.x2NAD1Ud081560@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 23 Mar 2019 10:13:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345442 - in head: . share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head: . share/man/man4 X-SVN-Commit-Revision: 345442 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 28D3689345 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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2019 10:13:02 -0000 Author: kib Date: Sat Mar 23 10:13:01 2019 New Revision: 345442 URL: https://svnweb.freebsd.org/changeset/base/345442 Log: Add UPDATING note for geom_uzip(4)/xz, and bump geom_uzip(4) man page date. Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/UPDATING head/share/man/man4/geom_uzip.4 Modified: head/UPDATING ============================================================================== --- head/UPDATING Sat Mar 23 09:56:41 2019 (r345441) +++ head/UPDATING Sat Mar 23 10:13:01 2019 (r345442) @@ -43,6 +43,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: prerequisites and upgrading, if you are not already using clang 3.5.0 or higher. +20190226: + geom_uzip(4) depends on the new module xz. If geom_uzip is statically + compiled into your custom kernel, add 'device xz' statement to the + kernel config. + 20190219: drm and drm2 have been removed from the tree. Please see https://wiki.freebsd.org/Graphics for the latest information on Modified: head/share/man/man4/geom_uzip.4 ============================================================================== --- head/share/man/man4/geom_uzip.4 Sat Mar 23 09:56:41 2019 (r345441) +++ head/share/man/man4/geom_uzip.4 Sat Mar 23 10:13:01 2019 (r345442) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 9, 2006 +.Dd February 26, 2019 .Dt GEOM_UZIP 4 .Os .Sh NAME From owner-svn-src-head@freebsd.org Sat Mar 23 13:41:15 2019 Return-Path: Delivered-To: svn-src-head@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 2AE5B1550925; Sat, 23 Mar 2019 13:41:15 +0000 (UTC) (envelope-from trasz@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 C6C906ADAE; Sat, 23 Mar 2019 13:41:14 +0000 (UTC) (envelope-from trasz@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 9DEDC9187; Sat, 23 Mar 2019 13:41:14 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2NDfEXB091615; Sat, 23 Mar 2019 13:41:14 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2NDfEqZ091614; Sat, 23 Mar 2019 13:41:14 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201903231341.x2NDfEqZ091614@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 23 Mar 2019 13:41:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345448 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 345448 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C6C906ADAE 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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2019 13:41:15 -0000 Author: trasz Date: Sat Mar 23 13:41:14 2019 New Revision: 345448 URL: https://svnweb.freebsd.org/changeset/base/345448 Log: Remove trunc_page_ps() and round_page_ps() macros. This completes the undoing of r100384. Reviewed by: kib MFC after: 2 weeks Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D19680 Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Sat Mar 23 11:51:12 2019 (r345447) +++ head/sys/kern/imgact_elf.c Sat Mar 23 13:41:14 2019 (r345448) @@ -158,9 +158,7 @@ SYSCTL_INT(ASLR_NODE_OID, OID_AUTO, honor_sbrk, CTLFLA static Elf_Brandinfo *elf_brand_list[MAX_BRANDS]; -#define trunc_page_ps(va, ps) rounddown2(va, ps) -#define round_page_ps(va, ps) roundup2(va, ps) -#define aligned(a, t) (trunc_page_ps((u_long)(a), sizeof(t)) == (u_long)(a)) +#define aligned(a, t) (rounddown2((u_long)(a), sizeof(t)) == (u_long)(a)) static const char FREEBSD_ABI_VENDOR[] = "FreeBSD"; @@ -568,8 +566,8 @@ __elfN(load_section)(struct image_params *imgp, vm_oof object = imgp->object; map = &imgp->proc->p_vmspace->vm_map; - map_addr = trunc_page_ps((vm_offset_t)vmaddr, PAGE_SIZE); - file_addr = trunc_page_ps(offset, PAGE_SIZE); + map_addr = trunc_page((vm_offset_t)vmaddr); + file_addr = trunc_page(offset); /* * We have two choices. We can either clear the data in the last page @@ -580,9 +578,9 @@ __elfN(load_section)(struct image_params *imgp, vm_oof if (filsz == 0) map_len = 0; else if (memsz > filsz) - map_len = trunc_page_ps(offset + filsz, PAGE_SIZE) - file_addr; + map_len = trunc_page(offset + filsz) - file_addr; else - map_len = round_page_ps(offset + filsz, PAGE_SIZE) - file_addr; + map_len = round_page(offset + filsz) - file_addr; if (map_len != 0) { /* cow flags: don't dump readonly sections in core */ @@ -611,11 +609,10 @@ __elfN(load_section)(struct image_params *imgp, vm_oof * segment in the file is extended to provide bss. It's a neat idea * to try and save a page, but it's a pain in the behind to implement. */ - copy_len = filsz == 0 ? 0 : (offset + filsz) - trunc_page_ps(offset + - filsz, PAGE_SIZE); - map_addr = trunc_page_ps((vm_offset_t)vmaddr + filsz, PAGE_SIZE); - map_len = round_page_ps((vm_offset_t)vmaddr + memsz, PAGE_SIZE) - - map_addr; + copy_len = filsz == 0 ? 0 : (offset + filsz) - trunc_page(offset + + filsz); + map_addr = trunc_page((vm_offset_t)vmaddr + filsz); + map_len = round_page((vm_offset_t)vmaddr + memsz) - map_addr; /* This had damn well better be true! */ if (map_len != 0) { @@ -631,8 +628,7 @@ __elfN(load_section)(struct image_params *imgp, vm_oof return (EIO); /* send the page fragment to user space */ - off = trunc_page_ps(offset + filsz, PAGE_SIZE) - - trunc_page(offset + filsz); + off = trunc_page(offset + filsz) - trunc_page(offset + filsz); error = copyout((caddr_t)sf_buf_kva(sf) + off, (caddr_t)map_addr, copy_len); vm_imgact_unmap_page(sf); From owner-svn-src-head@freebsd.org Sat Mar 23 14:10:06 2019 Return-Path: Delivered-To: svn-src-head@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 D47521551D73; Sat, 23 Mar 2019 14:10:06 +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 5DF216C147; Sat, 23 Mar 2019 14:10:06 +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 387949682; Sat, 23 Mar 2019 14:10:06 +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 x2NEA6Ip004587; Sat, 23 Mar 2019 14:10:06 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2NEA6R3004586; Sat, 23 Mar 2019 14:10:06 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201903231410.x2NEA6R3004586@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 23 Mar 2019 14:10:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345449 - head/contrib/llvm/lib/Target/ARM X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm/lib/Target/ARM X-SVN-Commit-Revision: 345449 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5DF216C147 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.933,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2019 14:10:07 -0000 Author: dim Date: Sat Mar 23 14:10:05 2019 New Revision: 345449 URL: https://svnweb.freebsd.org/changeset/base/345449 Log: Pull in r356809 from upstream llvm trunk (by Eli Friedman): [ARM] Don't form "ands" when it isn't scheduled correctly. In r322972/r323136, the iteration here was changed to catch cases at the beginning of a basic block... but we accidentally deleted an important safety check. Restore that check to the way it was. Fixes https://bugs.llvm.org/show_bug.cgi?id=41116 Differential Revision: https://reviews.llvm.org/D59680 This should fix "Assertion failed: (LiveCPSR && "CPSR liveness tracking is wrong!"), function UpdateCPSRUse" errors when building the devel/xwpe port for armv7. PR: 236062, 236568 MFC after: 1 month X-MFC-With: r344779 Modified: head/contrib/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp Modified: head/contrib/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp ============================================================================== --- head/contrib/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp Sat Mar 23 13:41:14 2019 (r345448) +++ head/contrib/llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp Sat Mar 23 14:10:05 2019 (r345449) @@ -2824,7 +2824,15 @@ bool ARMBaseInstrInfo::optimizeCompareInstr( // change. We can't do this transformation. return false; - } while (I != B); + if (I == B) { + // In some cases, we scan the use-list of an instruction for an AND; + // that AND is in the same BB, but may not be scheduled before the + // corresponding TST. In that case, bail out. + // + // FIXME: We could try to reschedule the AND. + return false; + } + } while (true); // Return false if no candidates exist. if (!MI && !SubAdd) From owner-svn-src-head@freebsd.org Sat Mar 23 15:41:33 2019 Return-Path: Delivered-To: svn-src-head@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 89141155401E; Sat, 23 Mar 2019 15:41:33 +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 2D8036EC5A; Sat, 23 Mar 2019 15:41:33 +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 0694BA649; Sat, 23 Mar 2019 15:41:33 +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 x2NFfWT0052424; Sat, 23 Mar 2019 15:41:32 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2NFfWWE052423; Sat, 23 Mar 2019 15:41:32 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201903231541.x2NFfWWE052423@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sat, 23 Mar 2019 15:41:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345450 - in head: libexec/rc/rc.d share/man/man5 X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in head: libexec/rc/rc.d share/man/man5 X-SVN-Commit-Revision: 345450 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2D8036EC5A 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.971,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2019 15:41:33 -0000 Author: ae Date: Sat Mar 23 15:41:32 2019 New Revision: 345450 URL: https://svnweb.freebsd.org/changeset/base/345450 Log: Add ability to automatically load ipfw_nat64, ipfw_nptv6 and ipfw_pmod modules by declaring corresponding variables in rc.conf. Also document them in rc.conf(5). Submitted by: Dries Michiels Differential Revision: https://reviews.freebsd.org/D19673 Modified: head/libexec/rc/rc.d/ipfw head/share/man/man5/rc.conf.5 Modified: head/libexec/rc/rc.d/ipfw ============================================================================== --- head/libexec/rc/rc.d/ipfw Sat Mar 23 14:10:05 2019 (r345449) +++ head/libexec/rc/rc.d/ipfw Sat Mar 23 15:41:32 2019 (r345450) @@ -34,6 +34,15 @@ ipfw_prestart() if checkyesno firewall_nat_enable; then required_modules="$required_modules ipfw_nat" fi + if checkyesno firewall_nat64_enable; then + required_modules="$required_modules ipfw_nat64" + fi + if checkyesno firewall_nptv6_enable; then + required_modules="$required_modules ipfw_nptv6" + fi + if checkyesno firewall_pmod_enable; then + required_modules="$required_modules ipfw_pmod" + fi } ipfw_start() Modified: head/share/man/man5/rc.conf.5 ============================================================================== --- head/share/man/man5/rc.conf.5 Sat Mar 23 14:10:05 2019 (r345449) +++ head/share/man/man5/rc.conf.5 Sat Mar 23 15:41:32 2019 (r345450) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 19, 2018 +.Dd March 21, 2019 .Dt RC.CONF 5 .Os .Sh NAME @@ -573,9 +573,11 @@ equivalent of .Va natd_enable . Setting this to .Dq Li YES -enables kernel NAT. +will automatically load the +.Xr ipfw 8 +NAT kernel module if .Va firewall_enable -must also be set to +is also set to .Dq Li YES . .It Va firewall_nat_interface .Pq Vt str @@ -588,6 +590,36 @@ kernel NAT should run. .It Va firewall_nat_flags .Pq Vt str Additional configuration parameters for kernel NAT should be placed here. +.It Va firewall_nat64_enable +.Pq Vt bool +Setting this to +.Dq Li YES +will automatically load the +.Xr ipfw 8 +NAT64 kernel module if +.Va firewall_enable +is also set to +.Dq Li YES . +.It Va firewall_nptv6_enable +.Pq Vt bool +Setting this to +.Dq Li YES +will automatically load the +.Xr ipfw 8 +NPTv6 kernel module if +.Va firewall_enable +is also set to +.Dq Li YES . +.It Va firewall_pmod_enable +.Pq Vt bool +Setting this to +.Dq Li YES +will automatically load the +.Xr ipfw 8 +pmod kernel module if +.Va firewall_enable +is also set to +.Dq Li YES . .It Va dummynet_enable .Pq Vt bool Setting this to From owner-svn-src-head@freebsd.org Sat Mar 23 16:36:20 2019 Return-Path: Delivered-To: svn-src-head@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 E4D111555AEA; Sat, 23 Mar 2019 16:36:19 +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 85C8070A27; Sat, 23 Mar 2019 16:36:19 +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 59F1DB045; Sat, 23 Mar 2019 16:36:19 +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 x2NGaJem082949; Sat, 23 Mar 2019 16:36:19 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2NGaJ2d082948; Sat, 23 Mar 2019 16:36:19 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201903231636.x2NGaJ2d082948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 23 Mar 2019 16:36:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345452 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 345452 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 85C8070A27 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.951,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2019 16:36:20 -0000 Author: kib Date: Sat Mar 23 16:36:18 2019 New Revision: 345452 URL: https://svnweb.freebsd.org/changeset/base/345452 Log: ASLR: check for max_addr after applying randomization, not before. Otherwise resulting address from vm_map_find() migh not satisfy the upper limit. For instance, it could affect MAP_32BIT flag from 64bit processes. Found by: Doug Moore Reviewed by: alc, Doug Moore Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D19688 Modified: head/sys/vm/vm_map.c Modified: head/sys/vm/vm_map.c ============================================================================== --- head/sys/vm/vm_map.c Sat Mar 23 16:30:50 2019 (r345451) +++ head/sys/vm/vm_map.c Sat Mar 23 16:36:18 2019 (r345452) @@ -1673,11 +1673,12 @@ again: (max_addr == 0 || max_addr > MAP_32BIT_MAX_ADDR) ? aslr_pages_rnd_64[pidx] : aslr_pages_rnd_32[pidx]; if (vm_map_findspace(map, curr_min_addr, length + - gap * pagesizes[pidx], addr) || - (max_addr != 0 && *addr + length > max_addr)) + gap * pagesizes[pidx], addr)) goto again; /* And randomize the start address. */ *addr += (arc4random() % gap) * pagesizes[pidx]; + if (max_addr != 0 && *addr + length > max_addr) + goto again; } else if (vm_map_findspace(map, curr_min_addr, length, addr) || (max_addr != 0 && *addr + length > max_addr)) { if (cluster) { From owner-svn-src-head@freebsd.org Sat Mar 23 18:06:05 2019 Return-Path: Delivered-To: svn-src-head@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 26D47155812E; Sat, 23 Mar 2019 18:06:05 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 0EE6874604; Sat, 23 Mar 2019 18:05:55 +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 mail105.syd.optusnet.com.au (Postfix) with ESMTPS id 63714105EE54; Sun, 24 Mar 2019 05:05:46 +1100 (AEDT) Date: Sun, 24 Mar 2019 05:05:44 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Bruce Evans cc: Mark Johnston , rgrimes@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r345359 - in head/sys/cddl/dev/dtrace: amd64 i386 In-Reply-To: <20190323013628.U2614@besplex.bde.org> Message-ID: <20190324035947.D3250@besplex.bde.org> References: <201903210252.x2L2qMSP022374@repo.freebsd.org> <201903210320.x2L3KIjc058579@gndrsh.dnsmgr.net> <20190321034917.GA8186@raichu> <20190321180738.P1024@besplex.bde.org> <20190321193237.GF8186@raichu> <20190323013628.U2614@besplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=FNpr/6gs c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=uO4SHyysRNJVmH2cgHIA:9 a=CjuIK1q_8ugA:10 a=CWzGh4xsABIA:10 a=IjZwj45LgO3ly-622nXo:22 X-Rspamd-Queue-Id: 0EE6874604 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of brde@optusnet.com.au designates 211.29.132.249 as permitted sender) smtp.mailfrom=brde@optusnet.com.au X-Spamd-Result: default: False [-5.22 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_COUNT_TWO(0.00)[2]; 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]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[extmail.optusnet.com.au]; NEURAL_HAM_SHORT(-0.56)[-0.557,0]; IP_SCORE(-2.36)[ip: (-5.39), ipnet: 211.28.0.0/14(-3.53), asn: 4804(-2.82), country: AU(-0.04)]; FREEMAIL_TO(0.00)[optusnet.com.au]; RCVD_NO_TLS_LAST(0.10)[]; RCVD_IN_DNSWL_LOW(-0.10)[249.132.29.211.list.dnswl.org : 127.0.5.1]; 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:+]; FROM_EQ_ENVFROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2019 18:06:05 -0000 On Sat, 23 Mar 2019, Bruce Evans wrote: I now have an almost perfect skew measuring program. It has a variance of about 2 cycles. Output on i4790k (only for CPU 0 vs CPU [1-7], since nothing different happens for the general CPU i vs CPU j comparison): XX (min/avg/max/sd) XX | CPUs | latij | latji | skew | nr | XX |---------+----------------+----------------+-----------------+--------| XX 0 <-> 1 128/145/152/ 3 132/145/156/ 3 -12/ -0/ 6/ 2 239 XX 0 <-> 2 216/222/224/ 2 216/218/220/ 2 -2/ 2/ 4/ 1 239 XX 0 <-> 3 216/222/224/ 2 216/218/220/ 2 -2/ 2/ 4/ 1 239 XX 0 <-> 4 220/224/228/ 4 220/224/228/ 4 -4/ 0/ 4/ 3 239 XX 0 <-> 5 224/225/228/ 2 220/223/228/ 3 -2/ 1/ 2/ 2 239 XX 0 <-> 6 220/226/232/ 2 224/227/232/ 2 -4/ -1/ 2/ 1 239 XX 0 <-> 7 224/226/228/ 2 224/227/228/ 2 -2/ -1/ 0/ 1 239 The main bug in the previous version was that it measured mainly the variance of IPC latency due to cache misses. Cache misses apparently sometimes cost 1400 cycles on i4790k. This was shown by a max vs min diference of about 1400 cycles for latij and latji (the min was about 200 as above, but the max was about 1600). In the above, the difference between the max and the min for latij is at most 24. The larger ranges (though no larger variances) for the 0 <-> 1 case are probably not accidental. This case shares a core. Masking interrupts should prevent HTT contention in the other cases. This depends on disabling interrupts or the system being fairly idle. With interrupts enabled and the system not idle, on freefall's Xeon: XX | CPUs | latij | latji | skew | nr | XX |---------+----------------+----------------+-----------------+--------| XX 0 <-> 1 422/482/514/15 423/480/502/12 -39/ 1/ 20/10 239 XX 0 <-> 2 679/691/1340/43 732/744/746/ 5 -33/-27/304/22 238 XX 0 <-> 3 679/688/707/ 8 732/744/746/ 5 -33/-28/-12/ 6 239 XX 0 <-> 4 713/737/753/ 5 726/726/726/ 0 -6/ 5/ 13/ 3 239 XX 0 <-> 5 726/738/964/15 726/726/726/ 0 0/ 6/119/ 8 238 XX 0 <-> 6 686/695/713/13 765/768/778/ 5 -45/-36/-26/ 7 239 XX 0 <-> 7 686/696/713/12 765/768/779/ 5 -46/-36/-26/ 7 239 I just noticed that the minimum latencies exploded from 180-220 in previous versions to 679-726 here. Another run gave the old latencies: XX | CPUs | latij | latji | skew | nr | XX |---------+----------------+----------------+-----------------+--------| XX 0 <-> 1 114/133/150/ 4 120/133/147/ 2 -9/ -0/ 9/ 2 239 XX 0 <-> 2 216/220/222/ 3 213/216/225/ 3 -4/ 2/ 4/ 3 239 XX 0 <-> 3 216/220/222/ 3 213/216/219/ 3 -1/ 2/ 4/ 3 239 XX 0 <-> 4 204/224/234/12 201/220/231/13 -13/ 2/ 16/11 239 XX 0 <-> 5 204/224/234/12 201/220/231/13 -13/ 2/ 16/11 239 XX 0 <-> 6 219/232/246/13 228/229/231/ 1 -6/ 1/ 9/ 7 239 XX 0 <-> 7 219/232/246/13 228/230/231/ 1 -6/ 1/ 9/ 7 239 The skews of -27 through -36 in the first run are probably real. I think rdtsc uses a common 100 MHz clock. Differences of 1 cycle in that give differences of 33 cycles for rdtsc. Apparently the firmware doesn't do a good job of hiding this granularity. The error of 1 cycle at 100 MHz persists for many TSC cycles (for more like 4000 samples than the 239 used here), and across most CPU pairs in a run. i4790K shows the same behaviour of skews of 1 cycle at 100 MHz, but less often (once in every 10-20 runs): XX | CPUs | latij | latji | skew | nr | XX |---------+----------------+----------------+-----------------+--------| XX 0 <-> 1 116/146/156/ 5 128/145/152/ 4 -16/ 1/ 12/ 3 239 XX 0 <-> 2 172/182/280/ 7 256/261/596/24 -206/-39/ 8/12 237 XX 0 <-> 3 176/182/184/ 3 256/258/260/ 2 -42/-38/-36/ 2 239 The TSC frequency is 4.08 GHz, so an error of 1 cycle at 100 MHz is 40.8 rdtsc cycles. XX 0 <-> 4 220/223/228/ 2 220/225/232/ 4 -4/ -1/ 4/ 2 239 XX 0 <-> 5 220/223/228/ 3 224/225/228/ 2 -2/ -1/ 2/ 1 239 XX 0 <-> 6 220/226/228/ 2 224/227/228/ 2 -4/ -1/ 2/ 1 239 XX 0 <-> 7 220/226/232/ 2 224/227/232/ 2 -4/ -1/ 2/ 1 239 Now full output to show many more skews near 41: XX 1 <-> 0 140/145/152/ 2 132/148/156/ 3 -4/ -2/ 8/ 2 239 XX 1 <-> 2 172/185/228/ 9 256/261/552/19 -184/-38/-16/11 239 XX 1 <-> 3 180/182/184/ 2 256/258/260/ 2 -40/-38/-36/ 2 239 XX 1 <-> 4 220/223/224/ 2 220/225/232/ 4 -4/ -1/ 2/ 2 239 XX 1 <-> 5 220/223/228/ 2 220/225/232/ 4 -4/ -1/ 4/ 2 239 XX 1 <-> 6 220/226/232/ 3 224/227/232/ 2 -4/ -1/ 2/ 1 239 XX 1 <-> 7 220/226/232/ 3 224/228/232/ 2 -6/ -1/ 4/ 2 239 XX 2 <-> 0 256/258/260/ 2 180/182/184/ 2 36/ 38/ 40/ 1 239 XX 2 <-> 1 256/258/260/ 2 176/182/184/ 2 36/ 38/ 42/ 2 239 XX 2 <-> 3 148/149/152/ 2 140/144/148/ 3 0/ 3/ 6/ 2 239 XX 2 <-> 4 244/253/256/ 4 168/173/180/ 2 34/ 40/ 42/ 2 239 XX 2 <-> 5 244/252/256/ 4 172/173/176/ 2 36/ 40/ 42/ 2 239 XX 2 <-> 6 248/254/260/ 3 172/176/180/ 2 36/ 39/ 42/ 2 239 XX 2 <-> 7 244/254/260/ 4 172/177/180/ 3 32/ 38/ 42/ 3 239 XX 3 <-> 0 256/258/260/ 2 176/182/184/ 2 36/ 38/ 42/ 2 239 XX 3 <-> 1 256/258/260/ 2 180/182/184/ 2 36/ 38/ 40/ 1 239 XX 3 <-> 2 140/145/152/ 3 144/148/152/ 2 -4/ -2/ 4/ 2 239 XX 3 <-> 4 244/253/256/ 4 168/173/180/ 2 34/ 40/ 42/ 2 239 XX 3 <-> 5 244/253/256/ 4 168/173/180/ 2 34/ 40/ 42/ 2 239 XX 3 <-> 6 248/254/260/ 3 172/176/180/ 2 36/ 39/ 42/ 2 239 XX 3 <-> 7 248/254/260/ 3 172/176/180/ 2 36/ 39/ 42/ 2 239 XX 4 <-> 0 220/224/228/ 2 220/224/228/ 2 -2/ -0/ 2/ 1 239 XX 4 <-> 1 220/225/228/ 3 220/223/228/ 3 -2/ 1/ 4/ 2 239 XX 4 <-> 2 168/173/180/ 2 244/253/256/ 4 -44/-40/-34/ 2 239 XX 4 <-> 3 168/173/180/ 2 244/253/256/ 4 -44/-40/-34/ 2 239 XX 4 <-> 5 128/145/152/ 3 140/145/152/ 2 -8/ -0/ 6/ 2 239 XX 4 <-> 6 212/218/220/ 3 212/218/220/ 3 -4/ 0/ 4/ 3 239 XX 4 <-> 7 212/220/224/ 3 208/216/220/ 3 -4/ 2/ 4/ 2 239 XX 5 <-> 0 220/225/228/ 3 220/223/228/ 3 -4/ 1/ 4/ 3 239 XX 5 <-> 1 220/224/228/ 2 220/224/228/ 2 -2/ -0/ 2/ 1 239 XX 5 <-> 2 168/173/180/ 2 244/253/256/ 4 -44/-40/-34/ 2 239 XX 5 <-> 3 168/173/180/ 2 244/253/256/ 4 -44/-40/-34/ 2 239 XX 5 <-> 4 144/146/148/ 2 144/151/156/ 4 -6/ -3/ 2/ 2 239 XX 5 <-> 6 212/220/224/ 3 208/216/220/ 3 -4/ 2/ 4/ 2 239 XX 5 <-> 7 212/218/220/ 3 212/218/220/ 3 -4/ 0/ 4/ 3 239 XX 6 <-> 0 224/227/232/ 2 220/226/232/ 2 -2/ 1/ 6/ 2 239 XX 6 <-> 1 224/227/232/ 2 220/226/232/ 2 -2/ 1/ 6/ 2 239 XX 6 <-> 2 172/177/180/ 3 244/254/260/ 4 -42/-38/-32/ 3 239 XX 6 <-> 3 172/177/180/ 3 244/254/260/ 4 -42/-38/-32/ 3 239 XX 6 <-> 4 208/216/220/ 3 216/220/224/ 2 -4/ -2/ 2/ 2 239 XX 6 <-> 5 212/218/220/ 3 212/218/220/ 3 -4/ -0/ 4/ 2 239 XX 6 <-> 7 128/147/152/ 4 128/145/156/ 4 -10/ 1/ 6/ 3 239 XX 7 <-> 0 224/227/232/ 2 220/226/228/ 2 -2/ 1/ 6/ 2 239 XX 7 <-> 1 224/227/232/ 2 220/226/228/ 2 -2/ 1/ 6/ 2 239 XX 7 <-> 2 172/176/180/ 2 248/254/260/ 3 -42/-39/-34/ 2 239 XX 7 <-> 3 172/177/180/ 3 244/254/260/ 4 -42/-38/-32/ 3 239 XX 7 <-> 4 208/216/220/ 3 216/220/224/ 2 -4/ -2/ 2/ 2 239 XX 7 <-> 5 212/218/220/ 3 212/218/220/ 3 -4/ -0/ 4/ 2 239 XX 7 <-> 6 132/145/152/ 3 116/147/152/ 4 -8/ -1/ 14/ 2 239 The error of ~41 cycles showed up in 24 out of 56 independent samples (independent except for being sequential, but spread over at least 100k TSC cycles. The variance for all these ~41 cycle skews is the same 2 or 3 as for the small skews, so I think the large skews are not measurement errors. This output was produced by: XX /* pthread and cpu management parts copied from tscdrift.c. */ XX XX /*- XX * Copyright (c) 2014 Advanced Computing Technologies LLC XX * Written by: John H. Baldwin XX * All rights reserved. XX * XX * Redistribution and use in source and binary forms, with or without XX * modification, are permitted provided that the following conditions XX * are met: XX * 1. Redistributions of source code must retain the above copyright XX * notice, this list of conditions and the following disclaimer. XX * 2. Redistributions in binary form must reproduce the above copyright XX * notice, this list of conditions and the following disclaimer in the XX * documentation and/or other materials provided with the distribution. XX * XX * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND XX * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE XX * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE XX * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE XX * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL XX * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS XX * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) XX * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT XX * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY XX * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF XX * SUCH DAMAGE. XX */ XX XX #include XX #include XX XX #include XX #include XX XX #include XX #include XX #include XX #include XX #include XX #include XX #include XX #include XX #include XX XX /* LOGSIZE should be small enough for everything to fit in L1. */ XX #define LOGSIZE 0x100 XX XX static int ncpu; XX /* XX * The sepatrate log buffers are to reduce cache contention. This is not XX * so important with everything in L1. XX */ XX static uint64_t tsc_log_master[LOGSIZE] __aligned(PAGE_SIZE); XX static uint64_t tsc_log_slave[LOGSIZE] __aligned(PAGE_SIZE); XX static volatile u_int tsc_loghead; The main fixes are here. By keeping LOGSIZE significantly less than 4K, the working set is smaller than 32K so fits in L1. Alignment to PAGE_SIZE and separate log buffers are refinements of this. There are a few more smaller refinements and some bug fixes. XX XX /* Bind the current thread to the specified CPU. */ XX static void XX bind_cpu(int cpu) XX { XX cpuset_t set; XX XX CPU_ZERO(&set); XX CPU_SET(cpu, &set); XX if (cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, -1, sizeof(set), XX &set) < 0) XX err(1, "cpuset_setaffinity(%d)", cpu); XX } XX XX static void * XX action(void *arg) XX { XX uint64_t *logp; XX int fd, head, master; XX XX master = (intptr_t)arg; XX logp = master ? tsc_log_master : tsc_log_slave; XX XX /* Attempt to fault in everything before disabling interrupts. */ XX memset(logp, 0, sizeof(tsc_log_master)); XX XX /* XX * Wait for the master to bind to its (necessarily different) CPU XX * before disabling interrupts. XX */ XX while (atomic_load_acq_int(&tsc_loghead) == -1) XX ; XX XX /* If possible, run the main loop with interrupts disabled. */ XX if ((fd = open("/dev/io", O_RDONLY)) != -1) XX disable_intr(); XX XX /* Attempt to cache everything again after possible preemption. */ XX memset(logp, 0, sizeof(tsc_log_master)); The last line is a refinement. XX XX /* XX * (head % 1) selects the log buffer (0 = master) and (head / 2) is XX * the index in this buffer. XX */ XX for (head = master ? 0 : 1; head < 2 * LOGSIZE; head += 2) { XX while (atomic_load_acq_int(&tsc_loghead) != head) XX ; XX __asm __volatile("lfence"); XX logp[head / 2] = rdtsc(); XX __asm __volatile("sfence"); /* This reduces variance. */ This reduces the variance from about 4 cycles to 2. XX atomic_store_rel_int(&tsc_loghead, head + 1); XX } The serialization takes longer than I like -- over 200 cycles and it doesn't even have a single cache miss for writing to the log buffer. The fences don't add much to the latency. XX XX if (fd != -1) { XX enable_intr(); XX close(fd); XX } XX return (NULL); XX } XX XX int XX main(int argc, char **argv) XX { XX cpuset_t all_cpus; XX pthread_t *children; XX double avlatij, avlatji, avskew, sdlatij, sdlatji, sdskew; XX double sumlatijsq, sumlatjisq, sumskewsq; XX int *cpus; XX intmax_t latij, latji, maxlatij, maxlatji, minlatij, minlatji; XX intmax_t sumlatij, sumlatji; XX intmax_t maxskew, minskew, skew; XX int fd, error, i, j, nr, r; XX XX /* XX * Find all the CPUs this program is eligible to run on and use XX * this as our global set. This means you can use cpuset to XX * restrict this program to only run on a subset of CPUs. XX */ XX if (cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1, XX sizeof(all_cpus), &all_cpus) < 0) XX err(1, "cpuset_getaffinity"); XX for (ncpu = 0, i = 0; i < CPU_SETSIZE; i++) XX if (CPU_ISSET(i, &all_cpus)) XX ncpu++; XX cpus = calloc(ncpu, sizeof(*cpus)); XX children = calloc(ncpu, sizeof(*children)); XX for (i = 0, j = 0; i < CPU_SETSIZE; i++) XX if (CPU_ISSET(i, &all_cpus)) { XX assert(j < ncpu); XX cpus[j] = i; XX j++; XX } XX if ((fd = open("/dev/io", O_RDONLY)) != -1) XX close(fd); XX XX printf( XX "| CPUs | latij | latji | skew | nr |\n"); XX printf( XX "|---------+----------------+----------------+-----------------+--------|\n"); XX for (i = 0; i < ncpu; i++) { XX for (j = 0; j < ncpu; j++) { XX if (j == i) XX continue; XX bind_cpu(cpus[j]); XX atomic_store_rel_int(&tsc_loghead, -1); XX error = pthread_create(&children[j], NULL, action, XX (void *)(intptr_t)0); XX if (error) XX errc(1, error, "pthread_create"); XX bind_cpu(cpus[i]); XX atomic_store_rel_int(&tsc_loghead, 0); XX action((void *)(intptr_t)1); XX error = pthread_join(children[j], NULL); XX if (error) XX errc(1, error, "pthread_join"); XX XX nr = 0; XX maxlatij = maxlatji = maxskew = INTMAX_MIN; XX minlatij = minlatji = minskew = INTMAX_MAX; XX sumlatij = sumlatji = 0; XX sumlatijsq = sumlatjisq = sumskewsq = 0; XX /* Skip early entries to let caches warm up. */ The r == 0 entries also have high variance for synchronization. XX for (r = 16; r < LOGSIZE - 1; r++) { XX latij = tsc_log_slave[r] - tsc_log_master[r]; XX latji = tsc_log_master[r + 1] - XX tsc_log_slave[r]; I tried discarding samples lying on cache line boundaries. This helps for buffers too large to fit in L1, but doesn't give such a low variance as with no cache misses at all. XX /* XX * XXX: discard samples that appear to have XX * been preempted. XX */ XX if (fd == -1 && (latij > 1999 || latji > 1999)) XX continue; The distribution of latencies on freefall is usually many about 200 cycles, then many below 1000 cycles for cache misses, then nothing between 1000 and 3000 cycles, then a few for context switches going up to not much more than 30000 cycles. So above 1999 usually means above 999 and the 3-column formatting usually works. XX if (maxlatij < latij) XX maxlatij = latij; XX if (minlatij > latij) XX minlatij = latij; XX if (maxlatji < latji) XX maxlatji = latji; XX if (minlatji > latji) XX minlatji = latji; XX sumlatij += latij; XX sumlatji += latji; XX sumlatijsq += latij * latij; XX sumlatjisq += latji * latji; XX skew = latij - latji; XX if (maxskew < skew) XX maxskew = skew; XX if (minskew > skew) XX minskew = skew; XX sumskewsq += skew * skew; XX nr++; XX } XX avlatij = (double)sumlatij / nr; XX sdlatij = sqrt(sumlatijsq / nr - avlatij * avlatij); XX avlatji = (double)sumlatji / nr; XX sdlatji = sqrt(sumlatjisq / nr - avlatji * avlatji); XX avskew = avlatij - avlatji; XX sdskew = sqrt(sumskewsq / nr - avskew * avskew); XX printf( XX "%2d <-> %2d %3jd/%3.0f/%3jd/%2.0f %3jd/%3.0f/%3jd/%2.0f %4jd/%3.0f/%3jd/%2.0f %6d\n", XX cpus[i], cpus[j], XX minlatij, avlatij, maxlatij, sdlatij, XX minlatji, avlatji, maxlatji, sdlatji, XX minskew / 2, avskew / 2, maxskew / 2, sdskew / 2, XX nr); XX } XX } XX } Bruce From owner-svn-src-head@freebsd.org Sat Mar 23 18:32:25 2019 Return-Path: Delivered-To: svn-src-head@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 F33CD1559169; Sat, 23 Mar 2019 18:32:24 +0000 (UTC) (envelope-from imp@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 90BB075B89; Sat, 23 Mar 2019 18:32:24 +0000 (UTC) (envelope-from imp@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 68DAAC671; Sat, 23 Mar 2019 18:32:24 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2NIWOEJ045637; Sat, 23 Mar 2019 18:32:24 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2NIWODK045636; Sat, 23 Mar 2019 18:32:24 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201903231832.x2NIWODK045636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 23 Mar 2019 18:32:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345455 - head/sys/mips/conf X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/mips/conf X-SVN-Commit-Revision: 345455 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 90BB075B89 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.969,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2019 18:32:25 -0000 Author: imp Date: Sat Mar 23 18:32:24 2019 New Revision: 345455 URL: https://svnweb.freebsd.org/changeset/base/345455 Log: Add device xz. This was somehow missed in the last round. Submitted by: Brandon Bergren Modified: head/sys/mips/conf/DIR-825C1 Modified: head/sys/mips/conf/DIR-825C1 ============================================================================== --- head/sys/mips/conf/DIR-825C1 Sat Mar 23 16:46:33 2019 (r345454) +++ head/sys/mips/conf/DIR-825C1 Sat Mar 23 18:32:24 2019 (r345455) @@ -44,6 +44,7 @@ device geom_map # uzip - to boot natively from flash options GEOM_UZIP options GEOM_PART_GPT +device xz # yes, this board has a PCI connected atheros device options AR71XX_ATH_EEPROM From owner-svn-src-head@freebsd.org Sat Mar 23 18:32:29 2019 Return-Path: Delivered-To: svn-src-head@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 80F8C155918B; Sat, 23 Mar 2019 18:32:29 +0000 (UTC) (envelope-from imp@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 262A575B9F; Sat, 23 Mar 2019 18:32:29 +0000 (UTC) (envelope-from imp@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 F31F2C677; Sat, 23 Mar 2019 18:32:28 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2NIWSS7046416; Sat, 23 Mar 2019 18:32:28 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2NIWShX046415; Sat, 23 Mar 2019 18:32:28 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201903231832.x2NIWShX046415@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 23 Mar 2019 18:32:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345456 - head/sys/mips/conf X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/mips/conf X-SVN-Commit-Revision: 345456 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 262A575B9F 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.969,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2019 18:32:29 -0000 Author: imp Date: Sat Mar 23 18:32:28 2019 New Revision: 345456 URL: https://svnweb.freebsd.org/changeset/base/345456 Log: Remove duplicate options. Modified: head/sys/mips/conf/DIR-825C1 Modified: head/sys/mips/conf/DIR-825C1 ============================================================================== --- head/sys/mips/conf/DIR-825C1 Sat Mar 23 18:32:24 2019 (r345455) +++ head/sys/mips/conf/DIR-825C1 Sat Mar 23 18:32:28 2019 (r345456) @@ -46,11 +46,6 @@ options GEOM_UZIP options GEOM_PART_GPT device xz -# yes, this board has a PCI connected atheros device -options AR71XX_ATH_EEPROM -device firmware # Used by the above -options ATH_EEPROM_FIRMWARE - # Boot off of the rootfs, as defined in the geom_map setup. options ROOTDEVNAME=\"ufs:map/rootfs.uzip\" From owner-svn-src-head@freebsd.org Sat Mar 23 18:53:42 2019 Return-Path: Delivered-To: svn-src-head@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 C41391559A08; Sat, 23 Mar 2019 18:53:42 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CC28276F44; Sat, 23 Mar 2019 18:53:41 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x2NIrX54099591 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 23 Mar 2019 20:53:36 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x2NIrX54099591 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x2NIrWsa099590; Sat, 23 Mar 2019 20:53:32 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 23 Mar 2019 20:53:32 +0200 From: Konstantin Belousov To: Warner Losh Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r345455 - head/sys/mips/conf Message-ID: <20190323185332.GN1923@kib.kiev.ua> References: <201903231832.x2NIWODK045636@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201903231832.x2NIWODK045636@repo.freebsd.org> User-Agent: Mutt/1.11.4 (2019-03-13) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2019 18:53:42 -0000 On Sat, Mar 23, 2019 at 06:32:24PM +0000, Warner Losh wrote: > Author: imp > Date: Sat Mar 23 18:32:24 2019 > New Revision: 345455 > URL: https://svnweb.freebsd.org/changeset/base/345455 > > Log: > Add device xz. This was somehow missed in the last round. Because the config has #NO_UNIVERSE comment. > > Submitted by: Brandon Bergren > > Modified: > head/sys/mips/conf/DIR-825C1 > > Modified: head/sys/mips/conf/DIR-825C1 > ============================================================================== > --- head/sys/mips/conf/DIR-825C1 Sat Mar 23 16:46:33 2019 (r345454) > +++ head/sys/mips/conf/DIR-825C1 Sat Mar 23 18:32:24 2019 (r345455) > @@ -44,6 +44,7 @@ device geom_map > # uzip - to boot natively from flash > options GEOM_UZIP > options GEOM_PART_GPT > +device xz > > # yes, this board has a PCI connected atheros device > options AR71XX_ATH_EEPROM From owner-svn-src-head@freebsd.org Sat Mar 23 18:56:45 2019 Return-Path: Delivered-To: svn-src-head@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 0D1721559B36 for ; Sat, 23 Mar 2019 18:56:45 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A626C770E9 for ; Sat, 23 Mar 2019 18:56:44 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x831.google.com with SMTP id t28so6175556qte.6 for ; Sat, 23 Mar 2019 11:56:44 -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=/igzfUg9M8WyLVUiAKD++xznXpJyk2lOJ2lC6pjBKlI=; b=b7eAHvIbmffv/Vj1fFaLQxMSOnJlY4mXbmiUzMPHYXJbnOyktcM1ecP5kuztUNpjOR DMRmb6pUD6d6R9ynRzwy4vich3lc1j8nFpBELcPflMQ6nvXKKTgNzVnozSiWDzlWVWRg m3hGlHwhacffvPsfoGMDsatPcEoUrMPJAGAouQ/amebyw/Ai+9MOxSI+KNuQOyyKu9f+ Upi5BNWIStl7WzODBZjCjnqwv2jNdSef7zEiC9tcOczMTgRjUaOPgAYis/pZV7kNSDjO w8RpsTE5WI43qhBpqB+pHsaJ5pGD4Nl2ieKIZecwttySMKE+gdXAAh0koHZwkBUuxvV7 ZGNA== 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=/igzfUg9M8WyLVUiAKD++xznXpJyk2lOJ2lC6pjBKlI=; b=Nm6eeqX9JILt+mBv9gXJHyrRt2IzwlPJXOt3Ut5Z1E+RNfgKWA76fuGjlObBlSFuas 1G5SP7tHbVePk/byzDa2HXhY8erh1XQ5zcHCPqBrv1bUt1kws2wCODy/D8mbW1NKhnac 2Qs/f0ENrd46NY8JerEYezHIvGP8NjNHTyAM+2b/hpxHHGsfTMqJlj4VT1n0zuI30Bfv Q74LViLdSJLX5msXd1IQpRmJovrzjeqfp5XFRR+lcPFfsciQ6XUC/SucZ4dZr/kEzios i0QczAC8Wq3Jwr63AsBAWD/MYYZBBRiW+vkgwZHK4CO20gXzfA+gxD1TTp8DovdADmEV pbAw== X-Gm-Message-State: APjAAAU6jd2umF0eTsoGV3MN0c448onSoyNJ/BQxf17f+DookilPQX6V u8Fe4zBWvnTUdO/6C+yK4VRniOejiHgSgJGllX7IOA== X-Google-Smtp-Source: APXvYqzzFu8fi2Y/mZe+xIgNQAzk39r/P3D5ItOt12HBrwihBs8KwVtj0gqbhiELsEX2PemKYkWR2hEppyKWIJzhjGQ= X-Received: by 2002:ac8:2b2e:: with SMTP id 43mr13835441qtu.33.1553367404042; Sat, 23 Mar 2019 11:56:44 -0700 (PDT) MIME-Version: 1.0 References: <201903231832.x2NIWODK045636@repo.freebsd.org> <20190323185332.GN1923@kib.kiev.ua> In-Reply-To: <20190323185332.GN1923@kib.kiev.ua> From: Warner Losh Date: Sat, 23 Mar 2019 12:56:33 -0600 Message-ID: Subject: Re: svn commit: r345455 - head/sys/mips/conf To: Konstantin Belousov Cc: Warner Losh , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: A626C770E9 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.94 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.94)[-0.944,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2019 18:56:45 -0000 On Sat, Mar 23, 2019 at 12:53 PM Konstantin Belousov wrote: > On Sat, Mar 23, 2019 at 06:32:24PM +0000, Warner Losh wrote: > > Author: imp > > Date: Sat Mar 23 18:32:24 2019 > > New Revision: 345455 > > URL: https://svnweb.freebsd.org/changeset/base/345455 > > > > Log: > > Add device xz. This was somehow missed in the last round. > Because the config has #NO_UNIVERSE comment. > That's a flaw in the NO_UNIVERSE comment. We have dozens of kernels that are mostly useless to build most of the time... except for the exact change you made where you really did want to build them all to make sure.... :( I'll hack together something to allow testing everything and fix what might be broken. A FreeBSD user reported this to me. Thanks for the explanation... I didn't mean to cast any aspersions with what I see now as a poorly worded commit message... Warner > > > > Submitted by: Brandon Bergren > > > > Modified: > > head/sys/mips/conf/DIR-825C1 > > > > Modified: head/sys/mips/conf/DIR-825C1 > > > ============================================================================== > > --- head/sys/mips/conf/DIR-825C1 Sat Mar 23 16:46:33 2019 > (r345454) > > +++ head/sys/mips/conf/DIR-825C1 Sat Mar 23 18:32:24 2019 > (r345455) > > @@ -44,6 +44,7 @@ device geom_map > > # uzip - to boot natively from flash > > options GEOM_UZIP > > options GEOM_PART_GPT > > +device xz > > > > # yes, this board has a PCI connected atheros device > > options AR71XX_ATH_EEPROM > From owner-svn-src-head@freebsd.org Sat Mar 23 19:53:16 2019 Return-Path: Delivered-To: svn-src-head@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 677BE155B642; Sat, 23 Mar 2019 19:53:16 +0000 (UTC) (envelope-from rpokala@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 0671181198; Sat, 23 Mar 2019 19:53:16 +0000 (UTC) (envelope-from rpokala@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 D28CAD445; Sat, 23 Mar 2019 19:53:15 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2NJrFxA088948; Sat, 23 Mar 2019 19:53:15 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2NJrFNc088946; Sat, 23 Mar 2019 19:53:15 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201903231953.x2NJrFNc088946@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Sat, 23 Mar 2019 19:53:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345457 - in head: lib/libc/gen sys/kern X-SVN-Group: head X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: in head: lib/libc/gen sys/kern X-SVN-Commit-Revision: 345457 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0671181198 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.970,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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2019 19:53:16 -0000 Author: rpokala Date: Sat Mar 23 19:53:15 2019 New Revision: 345457 URL: https://svnweb.freebsd.org/changeset/base/345457 Log: Add descriptions for sysctls in kern_mib.c and sysctl.3 which lack them. r343532 noted the difference between "hw.realmem" and "hw.physmem", which I was previously unaware of. I discovered that neither sysctl had a description visible via `sysctl -d', so I found where they were defined and added suitable descriptions. While in the file, I went ahead and added descriptions for all the others which lacked them. I also updated sysctl.3 accordingly Reviewed by: kib, bcr MFC after: 1 weeks Sponsored by: Panasas Differential Revision: https://reviews.freebsd.org/D19007 Modified: head/lib/libc/gen/sysctl.3 head/sys/kern/kern_mib.c Modified: head/lib/libc/gen/sysctl.3 ============================================================================== --- head/lib/libc/gen/sysctl.3 Sat Mar 23 18:32:28 2019 (r345456) +++ head/lib/libc/gen/sysctl.3 Sat Mar 23 19:53:15 2019 (r345457) @@ -28,7 +28,7 @@ .\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95 .\" $FreeBSD$ .\" -.Dd October 22, 2017 +.Dd March 22, 2019 .Dt SYSCTL 3 .Os .Sh NAME @@ -284,6 +284,7 @@ privilege may change the value. .It Dv HW_FLOATINGPT Ta integer Ta no .It Dv HW_MACHINE_ARCH Ta string Ta no .It Dv HW_REALMEM Ta integer Ta no +.It Dv HW_AVAILPAGES Ta integer Ta no .El .Bl -tag -width 6n .It Li HW_MACHINE @@ -295,9 +296,10 @@ The number of cpus. .It Li HW_BYTEORDER The byteorder (4321 or 1234). .It Li HW_PHYSMEM -The bytes of physical memory. +Amount of physical memory (in bytes), minus the amount used by the kernel, +pre-loaded modules, and (on x86) the dcons buffer. .It Li HW_USERMEM -The bytes of non-kernel memory. +Amount of memory (in bytes) which is not wired. .It Li HW_PAGESIZE The software page size. .\".It Fa HW_DISKNAMES @@ -307,7 +309,13 @@ Nonzero if the floating point support is in hardware. .It Li HW_MACHINE_ARCH The machine dependent architecture type. .It Li HW_REALMEM -The bytes of real memory. +Amount of memory (in bytes) reported by the firmware. +That value is sometimes not sane; in that case, the kernel reports the max +memory address instead. +.It Li HW_AVAILPAGES +The same value as +.Li HW_PHYSMEM , +measured in pages rather than bytes. .El .Ss CTL_KERN The string and integer information available for the CTL_KERN level Modified: head/sys/kern/kern_mib.c ============================================================================== --- head/sys/kern/kern_mib.c Sat Mar 23 18:32:28 2019 (r345456) +++ head/sys/kern/kern_mib.c Sat Mar 23 19:53:15 2019 (r345457) @@ -187,7 +187,8 @@ sysctl_hw_physmem(SYSCTL_HANDLER_ARGS) return (sysctl_handle_long(oidp, &val, 0, req)); } SYSCTL_PROC(_hw, HW_PHYSMEM, physmem, CTLTYPE_ULONG | CTLFLAG_RD, - 0, 0, sysctl_hw_physmem, "LU", ""); + 0, 0, sysctl_hw_physmem, "LU", + "Amount of physical memory (in bytes)"); static int sysctl_hw_realmem(SYSCTL_HANDLER_ARGS) @@ -201,7 +202,8 @@ sysctl_hw_realmem(SYSCTL_HANDLER_ARGS) return (sysctl_handle_long(oidp, &val, 0, req)); } SYSCTL_PROC(_hw, HW_REALMEM, realmem, CTLTYPE_ULONG | CTLFLAG_RD, - 0, 0, sysctl_hw_realmem, "LU", ""); + 0, 0, sysctl_hw_realmem, "LU", + "Amount of memory (in bytes) reported by the firmware"); static int sysctl_hw_usermem(SYSCTL_HANDLER_ARGS) @@ -216,9 +218,11 @@ sysctl_hw_usermem(SYSCTL_HANDLER_ARGS) return (sysctl_handle_long(oidp, &val, 0, req)); } SYSCTL_PROC(_hw, HW_USERMEM, usermem, CTLTYPE_ULONG | CTLFLAG_RD, - 0, 0, sysctl_hw_usermem, "LU", ""); + 0, 0, sysctl_hw_usermem, "LU", + "Amount of memory (in bytes) which is not wired"); -SYSCTL_LONG(_hw, OID_AUTO, availpages, CTLFLAG_RD, &physmem, 0, ""); +SYSCTL_LONG(_hw, OID_AUTO, availpages, CTLFLAG_RD, &physmem, 0, + "Amount of physical memory (in pages)"); u_long pagesizes[MAXPAGESIZES] = { PAGE_SIZE }; From owner-svn-src-head@freebsd.org Sat Mar 23 21:37:01 2019 Return-Path: Delivered-To: svn-src-head@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 AD426155D871; Sat, 23 Mar 2019 21:37:01 +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 533FC83F10; Sat, 23 Mar 2019 21:37:01 +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 466B4E565; Sat, 23 Mar 2019 21:37:01 +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 x2NLb1mI041625; Sat, 23 Mar 2019 21:37:01 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2NLb01A041619; Sat, 23 Mar 2019 21:37:00 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201903232137.x2NLb01A041619@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 23 Mar 2019 21:37:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345458 - in head: share/man/man4 sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in head: share/man/man4 sys/netinet X-SVN-Commit-Revision: 345458 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 533FC83F10 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.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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2019 21:37:01 -0000 Author: tuexen Date: Sat Mar 23 21:36:59 2019 New Revision: 345458 URL: https://svnweb.freebsd.org/changeset/base/345458 Log: Add sysctl variable net.inet.tcp.rexmit_initial for setting RTO.Initial used by TCP. Reviewed by: rrs@, 0mp@ Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D19355 Modified: head/share/man/man4/tcp.4 head/sys/netinet/tcp_subr.c head/sys/netinet/tcp_syncache.c head/sys/netinet/tcp_timer.c head/sys/netinet/tcp_timer.h Modified: head/share/man/man4/tcp.4 ============================================================================== --- head/share/man/man4/tcp.4 Sat Mar 23 19:53:15 2019 (r345457) +++ head/share/man/man4/tcp.4 Sat Mar 23 21:36:59 2019 (r345458) @@ -34,7 +34,7 @@ .\" From: @(#)tcp.4 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd August 6, 2018 +.Dd March 23, 2019 .Dt TCP 4 .Os .Sh NAME @@ -459,7 +459,7 @@ The actual limit applied to a session's reassembly que the system-calculated automatic limit and the user-specified .Va reass.maxqueuelen limit. -.It Va rexmit_min , rexmit_slop +.It Va rexmit_initial , rexmit_min , rexmit_slop Adjust the retransmit timer calculation for .Tn TCP . The slop is @@ -481,6 +481,7 @@ code. For this reason, we use 200ms of slop and a near-0 minimum, which gives us an effective minimum of 200ms (similar to .Tn Linux ) . +The initial value is used before an RTT measurement has been performed. .It Va initcwnd_segments Enable the ability to specify initial congestion window in number of segments. The default value is 10 as suggested by RFC 6928. Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Sat Mar 23 19:53:15 2019 (r345457) +++ head/sys/netinet/tcp_subr.c Sat Mar 23 21:36:59 2019 (r345458) @@ -1065,6 +1065,9 @@ tcp_init(void) tcp_keepintvl = TCPTV_KEEPINTVL; tcp_maxpersistidle = TCPTV_KEEP_IDLE; tcp_msl = TCPTV_MSL; + tcp_rexmit_initial = TCPTV_RTOBASE; + if (tcp_rexmit_initial < 1) + tcp_rexmit_initial = 1; tcp_rexmit_min = TCPTV_MIN; if (tcp_rexmit_min < 1) tcp_rexmit_min = 1; @@ -1645,9 +1648,9 @@ tcp_newtcpcb(struct inpcb *inp) * reasonable initial retransmit time. */ tp->t_srtt = TCPTV_SRTTBASE; - tp->t_rttvar = ((TCPTV_RTOBASE - TCPTV_SRTTBASE) << TCP_RTTVAR_SHIFT) / 4; + tp->t_rttvar = ((tcp_rexmit_initial - TCPTV_SRTTBASE) << TCP_RTTVAR_SHIFT) / 4; tp->t_rttmin = tcp_rexmit_min; - tp->t_rxtcur = TCPTV_RTOBASE; + tp->t_rxtcur = tcp_rexmit_initial; tp->snd_cwnd = TCP_MAXWIN << TCP_MAX_WINSHIFT; tp->snd_ssthresh = TCP_MAXWIN << TCP_MAX_WINSHIFT; tp->t_rcvtime = ticks; Modified: head/sys/netinet/tcp_syncache.c ============================================================================== --- head/sys/netinet/tcp_syncache.c Sat Mar 23 19:53:15 2019 (r345457) +++ head/sys/netinet/tcp_syncache.c Sat Mar 23 21:36:59 2019 (r345458) @@ -155,10 +155,10 @@ static int syncookie_cmp(struct in_conninfo *inc, str /* * Transmit the SYN,ACK fewer times than TCP_MAXRXTSHIFT specifies. * 3 retransmits corresponds to a timeout with default values of - * TCPTV_RTOBASE * ( 1 + - * tcp_backoff[1] + - * tcp_backoff[2] + - * tcp_backoff[3]) + 3 * tcp_rexmit_slop, + * tcp_rexmit_initial * ( 1 + + * tcp_backoff[1] + + * tcp_backoff[2] + + * tcp_backoff[3]) + 3 * tcp_rexmit_slop, * 1000 ms * (1 + 2 + 4 + 8) + 3 * 200 ms = 15600 ms, * the odds are that the user has given up attempting to connect by then. */ @@ -424,9 +424,10 @@ syncache_timeout(struct syncache *sc, struct syncache_ int rexmt; if (sc->sc_rxmits == 0) - rexmt = TCPTV_RTOBASE; + rexmt = tcp_rexmit_initial; else - TCPT_RANGESET(rexmt, TCPTV_RTOBASE * tcp_backoff[sc->sc_rxmits], + TCPT_RANGESET(rexmt, + tcp_rexmit_initial * tcp_backoff[sc->sc_rxmits], tcp_rexmit_min, TCPTV_REXMTMAX); sc->sc_rxttime = ticks + rexmt; sc->sc_rxmits++; Modified: head/sys/netinet/tcp_timer.c ============================================================================== --- head/sys/netinet/tcp_timer.c Sat Mar 23 19:53:15 2019 (r345457) +++ head/sys/netinet/tcp_timer.c Sat Mar 23 21:36:59 2019 (r345458) @@ -110,6 +110,11 @@ int tcp_msl; SYSCTL_PROC(_net_inet_tcp, OID_AUTO, msl, CTLTYPE_INT|CTLFLAG_RW, &tcp_msl, 0, sysctl_msec_to_ticks, "I", "Maximum segment lifetime"); +int tcp_rexmit_initial; +SYSCTL_PROC(_net_inet_tcp, OID_AUTO, rexmit_initial, CTLTYPE_INT|CTLFLAG_RW, + &tcp_rexmit_initial, 0, sysctl_msec_to_ticks, "I", + "Initial Retransmission Timeout"); + int tcp_rexmit_min; SYSCTL_PROC(_net_inet_tcp, OID_AUTO, rexmit_min, CTLTYPE_INT|CTLFLAG_RW, &tcp_rexmit_min, 0, sysctl_msec_to_ticks, "I", @@ -668,7 +673,7 @@ tcp_timer_rexmt(void * xtp) TCPSTAT_INC(tcps_rexmttimeo); if ((tp->t_state == TCPS_SYN_SENT) || (tp->t_state == TCPS_SYN_RECEIVED)) - rexmt = TCPTV_RTOBASE * tcp_backoff[tp->t_rxtshift]; + rexmt = tcp_rexmit_initial * tcp_backoff[tp->t_rxtshift]; else rexmt = TCP_REXMTVAL(tp) * tcp_backoff[tp->t_rxtshift]; TCPT_RANGESET(tp->t_rxtcur, rexmt, Modified: head/sys/netinet/tcp_timer.h ============================================================================== --- head/sys/netinet/tcp_timer.h Sat Mar 23 19:53:15 2019 (r345457) +++ head/sys/netinet/tcp_timer.h Sat Mar 23 21:36:59 2019 (r345458) @@ -194,6 +194,7 @@ extern int tcp_keepintvl; /* time between keepalive p extern int tcp_keepcnt; /* number of keepalives */ extern int tcp_delacktime; /* time before sending a delayed ACK */ extern int tcp_maxpersistidle; +extern int tcp_rexmit_initial; extern int tcp_rexmit_min; extern int tcp_rexmit_slop; extern int tcp_msl; From owner-svn-src-head@freebsd.org Sat Mar 23 22:46:30 2019 Return-Path: Delivered-To: svn-src-head@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 5AD84155F419; Sat, 23 Mar 2019 22:46:30 +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 ED4B986219; Sat, 23 Mar 2019 22:46:29 +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 C8EC6F1B7; Sat, 23 Mar 2019 22:46:29 +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 x2NMkT3n077990; Sat, 23 Mar 2019 22:46:29 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2NMkT6x077989; Sat, 23 Mar 2019 22:46:29 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201903232246.x2NMkT6x077989@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 23 Mar 2019 22:46:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345460 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 345460 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: ED4B986219 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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2019 22:46:30 -0000 Author: tuexen Date: Sat Mar 23 22:46:29 2019 New Revision: 345460 URL: https://svnweb.freebsd.org/changeset/base/345460 Log: Limit the number of bytes which can be queued for SCTP sockets. This is joint work with rrs@. Reported by: syzbot+307f167f9bc214f095bc@syzkaller.appspotmail.com MFC after: 1 week Modified: head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sat Mar 23 22:44:11 2019 (r345459) +++ head/sys/netinet/sctp_output.c Sat Mar 23 22:46:29 2019 (r345460) @@ -13026,12 +13026,7 @@ sctp_lower_sosend(struct socket *so, /* Calculate the maximum we can send */ inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * SCTP_DATA_CHUNK_OVERHEAD(stcb)); if (SCTP_SB_LIMIT_SND(so) > inqueue_bytes) { - if (non_blocking) { - /* we already checked for non-blocking above. */ - max_len = sndlen; - } else { - max_len = SCTP_SB_LIMIT_SND(so) - inqueue_bytes; - } + max_len = SCTP_SB_LIMIT_SND(so) - inqueue_bytes; } else { max_len = 0; } From owner-svn-src-head@freebsd.org Sat Mar 23 22:56:05 2019 Return-Path: Delivered-To: svn-src-head@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 33F78155F8EC; Sat, 23 Mar 2019 22:56:05 +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 C7F76867E3; Sat, 23 Mar 2019 22:56:04 +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 8798AF374; Sat, 23 Mar 2019 22:56:04 +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 x2NMu485083201; Sat, 23 Mar 2019 22:56:04 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2NMu4ht083200; Sat, 23 Mar 2019 22:56:04 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201903232256.x2NMu4ht083200@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sat, 23 Mar 2019 22:56:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345461 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 345461 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C7F76867E3 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_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-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2019 22:56:05 -0000 Author: tuexen Date: Sat Mar 23 22:56:03 2019 New Revision: 345461 URL: https://svnweb.freebsd.org/changeset/base/345461 Log: Limit the size of messages sent on 1-to-many style SCTP sockets with the SCTP_SENDALL flag. Allow also only one operation per SCTP endpoint. This fixes an issue found by running syzkaller and is joint work with rrs@. MFC after: 1 week Modified: head/sys/netinet/sctp.h head/sys/netinet/sctp_output.c Modified: head/sys/netinet/sctp.h ============================================================================== --- head/sys/netinet/sctp.h Sat Mar 23 22:46:29 2019 (r345460) +++ head/sys/netinet/sctp.h Sat Mar 23 22:56:03 2019 (r345461) @@ -491,6 +491,7 @@ struct sctp_error_auth_invalid_hmac { * time */ #define SCTP_SAT_NETWORK_BURST_INCR 2 /* how many times to multiply maxburst * in sat */ +#define SCTP_MAX_SENDALL_LIMIT 1024 /* Data Chuck Specific Flags */ #define SCTP_DATA_FRAG_MASK 0x03 @@ -516,6 +517,7 @@ struct sctp_error_auth_invalid_hmac { #define SCTP_PCB_FLAGS_BOUNDALL 0x00000004 #define SCTP_PCB_FLAGS_ACCEPTING 0x00000008 #define SCTP_PCB_FLAGS_UNBOUND 0x00000010 +#define SCTP_PCB_FLAGS_SND_ITERATOR_UP 0x00000020 #define SCTP_PCB_FLAGS_CLOSE_IP 0x00040000 #define SCTP_PCB_FLAGS_WAS_CONNECTED 0x00080000 #define SCTP_PCB_FLAGS_WAS_ABORTED 0x00100000 Modified: head/sys/netinet/sctp_output.c ============================================================================== --- head/sys/netinet/sctp_output.c Sat Mar 23 22:46:29 2019 (r345460) +++ head/sys/netinet/sctp_output.c Sat Mar 23 22:56:03 2019 (r345461) @@ -6804,6 +6804,10 @@ sctp_sendall_completes(void *ptr, uint32_t val SCTP_UN */ /* now free everything */ + if (ca->inp) { + /* Lets clear the flag to allow others to run. */ + ca->inp->sctp_flags &= ~SCTP_PCB_FLAGS_SND_ITERATOR_UP; + } sctp_m_freem(ca->m); SCTP_FREE(ca, SCTP_M_COPYAL); } @@ -6857,6 +6861,14 @@ sctp_sendall(struct sctp_inpcb *inp, struct uio *uio, int ret; struct sctp_copy_all *ca; + if (inp->sctp_flags & SCTP_PCB_FLAGS_SND_ITERATOR_UP) { + /* There is another. */ + return (EBUSY); + } + if (uio->uio_resid > SCTP_MAX_SENDALL_LIMIT) { + /* You must be less than the max! */ + return (EMSGSIZE); + } SCTP_MALLOC(ca, struct sctp_copy_all *, sizeof(struct sctp_copy_all), SCTP_M_COPYAL); if (ca == NULL) { @@ -6893,6 +6905,7 @@ sctp_sendall(struct sctp_inpcb *inp, struct uio *uio, ca->sndlen += SCTP_BUF_LEN(mat); } } + inp->sctp_flags |= SCTP_PCB_FLAGS_SND_ITERATOR_UP; ret = sctp_initiate_iterator(NULL, sctp_sendall_iterator, NULL, SCTP_PCB_ANY_FLAGS, SCTP_PCB_ANY_FEATURES, SCTP_ASOC_ANY_STATE,