From owner-svn-src-stable-12@freebsd.org Sun Jan 27 12:39:37 2019 Return-Path: Delivered-To: svn-src-stable-12@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 B9EE314A9AE7; Sun, 27 Jan 2019 12:39:36 +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 600B295D89; Sun, 27 Jan 2019 12:39:36 +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 4829580E7; Sun, 27 Jan 2019 12:39:36 +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 x0RCdatM079132; Sun, 27 Jan 2019 12:39:36 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0RCdZHN079127; Sun, 27 Jan 2019 12:39:35 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201901271239.x0RCdZHN079127@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sun, 27 Jan 2019 12:39:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343488 - stable/12/sys/net80211 X-SVN-Group: stable-12 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: stable/12/sys/net80211 X-SVN-Commit-Revision: 343488 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 600B295D89 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)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jan 2019 12:39:37 -0000 Author: avos Date: Sun Jan 27 12:39:35 2019 New Revision: 343488 URL: https://svnweb.freebsd.org/changeset/base/343488 Log: MFC r343213: net80211: resolve ioctl <-> detach race for ieee80211com structure Since r287197 ieee80211com is a part of drivers softc; as a result, after detach all pointers to it (iv_ic, ni_ic) are invalid. Most possible users (tasks, interrupt handlers) are blocked / removed when device is stopped; however, ioctl handlers were not tracked and may crash if ieee80211com structure is accessed. Since ieee80211com pointer access from ieee80211vap structure is not protected by lock (constant after interface creation) and used in many other places just use reference counting for ioctl handlers; on detach set 'detached' flag and wait until reference counter goes to 0. For KBI stability the last element of iv_spare[] array was reused. Modified: stable/12/sys/net80211/ieee80211.c stable/12/sys/net80211/ieee80211_freebsd.c stable/12/sys/net80211/ieee80211_freebsd.h stable/12/sys/net80211/ieee80211_ioctl.c stable/12/sys/net80211/ieee80211_var.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net80211/ieee80211.c ============================================================================== --- stable/12/sys/net80211/ieee80211.c Sun Jan 27 11:52:16 2019 (r343487) +++ stable/12/sys/net80211/ieee80211.c Sun Jan 27 12:39:35 2019 (r343488) @@ -405,8 +405,10 @@ ieee80211_ifdetach(struct ieee80211com *ic) * The VAP is responsible for setting and clearing * the VIMAGE context. */ - while ((vap = TAILQ_FIRST(&ic->ic_vaps)) != NULL) + while ((vap = TAILQ_FIRST(&ic->ic_vaps)) != NULL) { + ieee80211_com_vdetach(vap); ieee80211_vap_destroy(vap); + } ieee80211_waitfor_parent(ic); ieee80211_sysctl_detach(ic); Modified: stable/12/sys/net80211/ieee80211_freebsd.c ============================================================================== --- stable/12/sys/net80211/ieee80211_freebsd.c Sun Jan 27 11:52:16 2019 (r343487) +++ stable/12/sys/net80211/ieee80211_freebsd.c Sun Jan 27 12:39:35 2019 (r343488) @@ -307,6 +307,55 @@ ieee80211_sysctl_vdetach(struct ieee80211vap *vap) } } +#define MS(_v, _f) (((_v) & _f##_M) >> _f##_S) +int +ieee80211_com_vincref(struct ieee80211vap *vap) +{ + uint32_t ostate; + + ostate = atomic_fetchadd_32(&vap->iv_com_state, IEEE80211_COM_REF_ADD); + + if (ostate & IEEE80211_COM_DETACHED) { + atomic_subtract_32(&vap->iv_com_state, IEEE80211_COM_REF_ADD); + return (ENETDOWN); + } + + if (MS(ostate, IEEE80211_COM_REF) == IEEE80211_COM_REF_MAX) { + atomic_subtract_32(&vap->iv_com_state, IEEE80211_COM_REF_ADD); + return (EOVERFLOW); + } + + return (0); +} + +void +ieee80211_com_vdecref(struct ieee80211vap *vap) +{ + uint32_t ostate; + + ostate = atomic_fetchadd_32(&vap->iv_com_state, -IEEE80211_COM_REF_ADD); + + KASSERT(MS(ostate, IEEE80211_COM_REF) != 0, + ("com reference counter underflow")); + + (void) ostate; +} + +void +ieee80211_com_vdetach(struct ieee80211vap *vap) +{ + int sleep_time; + + sleep_time = msecs_to_ticks(250); + if (sleep_time == 0) + sleep_time = 1; + + atomic_set_32(&vap->iv_com_state, IEEE80211_COM_DETACHED); + while (MS(atomic_load_32(&vap->iv_com_state), IEEE80211_COM_REF) != 0) + pause("comref", sleep_time); +} +#undef MS + int ieee80211_node_dectestref(struct ieee80211_node *ni) { Modified: stable/12/sys/net80211/ieee80211_freebsd.h ============================================================================== --- stable/12/sys/net80211/ieee80211_freebsd.h Sun Jan 27 11:52:16 2019 (r343487) +++ stable/12/sys/net80211/ieee80211_freebsd.h Sun Jan 27 12:39:35 2019 (r343488) @@ -224,6 +224,11 @@ typedef struct mtx ieee80211_rt_lock_t; */ #include +struct ieee80211vap; +int ieee80211_com_vincref(struct ieee80211vap *); +void ieee80211_com_vdecref(struct ieee80211vap *); +void ieee80211_com_vdetach(struct ieee80211vap *); + #define ieee80211_node_initref(_ni) \ do { ((_ni)->ni_refcnt = 1); } while (0) #define ieee80211_node_incref(_ni) \ @@ -235,7 +240,6 @@ int ieee80211_node_dectestref(struct ieee80211_node *n #define ieee80211_node_refcnt(_ni) (_ni)->ni_refcnt struct ifqueue; -struct ieee80211vap; void ieee80211_drain_ifq(struct ifqueue *); void ieee80211_flush_ifq(struct ifqueue *, struct ieee80211vap *); Modified: stable/12/sys/net80211/ieee80211_ioctl.c ============================================================================== --- stable/12/sys/net80211/ieee80211_ioctl.c Sun Jan 27 11:52:16 2019 (r343487) +++ stable/12/sys/net80211/ieee80211_ioctl.c Sun Jan 27 12:39:35 2019 (r343488) @@ -3480,10 +3480,14 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t { struct ieee80211vap *vap = ifp->if_softc; struct ieee80211com *ic = vap->iv_ic; - int error = 0, wait = 0; + int error = 0, wait = 0, ic_used; struct ifreq *ifr; struct ifaddr *ifa; /* XXX */ + ic_used = (cmd != SIOCSIFMTU && cmd != SIOCG80211STATS); + if (ic_used && (error = ieee80211_com_vincref(vap)) != 0) + return (error); + switch (cmd) { case SIOCSIFFLAGS: IEEE80211_LOCK(ic); @@ -3620,5 +3624,9 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t error = ether_ioctl(ifp, cmd, data); break; } + + if (ic_used) + ieee80211_com_vdecref(vap); + return (error); } Modified: stable/12/sys/net80211/ieee80211_var.h ============================================================================== --- stable/12/sys/net80211/ieee80211_var.h Sun Jan 27 11:52:16 2019 (r343487) +++ stable/12/sys/net80211/ieee80211_var.h Sun Jan 27 12:39:35 2019 (r343488) @@ -562,7 +562,9 @@ struct ieee80211vap { const struct wmeParams *wme_params); struct task iv_wme_task; /* deferred VAP WME update */ - uint64_t iv_spare[6]; + uint64_t iv_spare[5]; + uint32_t iv_com_state; /* com usage / detached flag */ + uint32_t iv_spare1; }; MALLOC_DECLARE(M_80211_VAP); @@ -684,6 +686,12 @@ MALLOC_DECLARE(M_80211_VAP); #define IEEE80211_FVHT_USEVHT160 0x000000010 /* CONF: Use VHT160 */ #define IEEE80211_VFHT_BITS \ "\20\1VHT\2VHT40\3VHT80\4VHT80P80\5VHT160" + +#define IEEE80211_COM_DETACHED 0x00000001 /* ieee80211_ifdetach called */ +#define IEEE80211_COM_REF_ADD 0x00000002 /* add / remove reference */ +#define IEEE80211_COM_REF_M 0xfffffffe /* reference counter bits */ +#define IEEE80211_COM_REF_S 1 +#define IEEE80211_COM_REF_MAX (IEEE80211_COM_REF_M >> IEEE80211_COM_REF_S) int ic_printf(struct ieee80211com *, const char *, ...) __printflike(2, 3); void ieee80211_ifattach(struct ieee80211com *); From owner-svn-src-stable-12@freebsd.org Sun Jan 27 11:52:17 2019 Return-Path: Delivered-To: svn-src-stable-12@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 86DE814A6990; Sun, 27 Jan 2019 11:52:17 +0000 (UTC) (envelope-from bcr@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 28C6493B8B; Sun, 27 Jan 2019 11:52:17 +0000 (UTC) (envelope-from bcr@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 07E3E78E6; Sun, 27 Jan 2019 11:52:17 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x0RBqGQf057777; Sun, 27 Jan 2019 11:52:16 GMT (envelope-from bcr@FreeBSD.org) Received: (from bcr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0RBqGC5057776; Sun, 27 Jan 2019 11:52:16 GMT (envelope-from bcr@FreeBSD.org) Message-Id: <201901271152.x0RBqGC5057776@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcr set sender to bcr@FreeBSD.org using -f From: Benedict Reuschling Date: Sun, 27 Jan 2019 11:52:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343487 - stable/12/usr.bin/fortune/datfiles X-SVN-Group: stable-12 X-SVN-Commit-Author: bcr X-SVN-Commit-Paths: stable/12/usr.bin/fortune/datfiles X-SVN-Commit-Revision: 343487 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 28C6493B8B 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-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jan 2019 11:52:17 -0000 Author: bcr (doc committer) Date: Sun Jan 27 11:52:16 2019 New Revision: 343487 URL: https://svnweb.freebsd.org/changeset/base/343487 Log: Add ZFS usage tips to freebsd-tips. Add a bunch of examples on how to use ZFS features like: - listing available space, - setting and displaying a userquota, - displaying pool I/O statistics and pool history, - displaying the compression ratio for a dataset, - various list options (sorting, removing headers), - performing a dry-run of a snapshot delete, - removing a range of snapshots, - setting a custom property, - preventing removal of a snapshot with ZFS holds, - permission sets for zfs send/receive. Additionally, clarify the existing examples a bit when it comes to displaying space by mentioning UFS explicitly. Other examples include displaying I/O in top(1), querying sysctl(8) for active CPUs and available RAM. Mention systat(1) and its options, too. While here, reformat the example to upload a dmesg(8) a bit to wrap properly. Thanks to Allan Jude for his help with some of the ZFS examples. Reviewed by: dru,allanjude Approved by: allanjude (earlier version) Relnotes: yes (ZFS examples in freebsd-tips) Differential Revision: https://reviews.freebsd.org/D18541 Modified: stable/12/usr.bin/fortune/datfiles/freebsd-tips Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/fortune/datfiles/freebsd-tips ============================================================================== --- stable/12/usr.bin/fortune/datfiles/freebsd-tips Sun Jan 27 02:31:42 2019 (r343486) +++ stable/12/usr.bin/fortune/datfiles/freebsd-tips Sun Jan 27 11:52:16 2019 (r343487) @@ -270,12 +270,12 @@ To see how long it takes a command to run, type the wo command name. -- Dru % -To see how much disk space is left on your partitions, use +To see how much disk space is left on your UFS partitions, use df -h -- Dru % -To see the 10 largest files on a directory or partition, use +To see the 10 largest files on a directory or UFS partition, use du -h /partition_or_directory_name | sort -rh | head -- Dru @@ -554,9 +554,241 @@ Use "sysrc name=value" to add an entry and "sysrc -x n -- Lars Engels % -You can upload the dmesg of your system to help developers get an overview of commonly used hardware and peripherals for FreeBSD. -Use the curl package to upload it in one command: +You can upload the dmesg of your system to help developers get an overview of commonly +used hardware and peripherals for FreeBSD. Use the curl package to upload it like this: curl -v -d "nickname=$USER" -d "description=FreeBSD/$(uname -m) on \ $(kenv smbios.system.maker) $(kenv smbios.system.product)" -d "do=addd" \ --data-urlencode 'dmesg@/var/run/dmesg.boot' http://dmesgd.nycbug.org/index.cgi +% +Want to know how much memory (in bytes) your machine has available? Let +sysctl(8) tell you with the following command: + +sysctl hw.physmem + +The number of active CPUs is displayed using this command: + +sysctl hw.ncpu + + -- Benedict Reuschling +% +When using ZFS as the file system the "df" command will display confusing +values. Use the built-in "zfs list" command to get an overview of space usage: + +zfs list -o space + + -- Benedict Reuschling +% +To learn more about what your system is doing, take a look at systat(1). For +example, to get an overview of I/O happening in the system, run: + +systat -iostat + +Other values are icmp, icmp6, ifstat, ip, ip6, netstat, pigs, sctp, swap, tcp, +vmstat, or zarc. You can switch between displays using : and exit +back to your shell by typing + +:quit + + -- Benedict Reuschling +% +To set a quota of 10 GB for the user named foo on a ZFS dataset, run the +following command: + +# zfs set userquota@foo=10G pool/home/foo + +The zfs userspace command can display the quota and current space usage: + +# zfs userspace pool/home/foo + +To unset a quota, assign "none" as the value. + -- Benedict Reuschling +% +ZFS can display I/O statistics for a given pool using the iostat subcommand. +By default, it will display one line of current activity. To display stats +every 5 seconds run the following command (cancel with CTRL+C): + +zpool iostat 5 + +To view individual disk activities, specify the -v parameter: + +zpool iostat -v + +Of course, both can be combined. For more options, see zpool(8). + -- Benedict Reuschling +% +FreeBSD's top(1) utility displays CPU statistics by default. +To display I/O activity for each process instead, run top like this: + +top -m io + + -- Benedict Reuschling +% +ZFS keeps a history of commands run against a specific pool using the +history subcommand to zpool: + +zpool history + +More details are available using the -i and -l parameters. Note that ZFS +will not keep the complete pool history forever and will remove older +events in favor of never ones. + -- Benedict Reuschling +% +To display the compression ratio for the ZFS dataset /var/log on the pool +mypool, run the following command: + +zfs get refcompressratio mypool/var/log + +The refcompressratio will only display the compression ratio for that specific +dataset, not the descendant datasets. To include the child datasets, the +command looks like this: + +zfs get compressratio mypool/var + + -- Benedict Reuschling +% +You can limit the depth of the displayed datasets in the "zfs list" output +using the -d parameter. To display only the first level of datasets below +mypool/usr and not the ones deeper than those, run this command: + +zfs list -d 1 mypool/usr + + -- Benedict Reuschling +% +The "zfs list" command can be filtered in multiple ways. To display just +the dataset name, use the -o parameter: + +zfs list -o name mypool/usr + +More columns and their order can be defined by separating them with commas: + +zfs list -o mountpoint,name,avail + + -- Benedict Reuschling +% +The output of "zfs list" can be sorted by a specific column using -s. To +sort the datasets by the "used" column in ascending order, run this command: + +zfs list -s used + +To sort in descending order instead, use -S: + +zfs list -S used + + -- Benedict Reuschling +% +To make the "zfs list" output more script-friendly, you can suppress the +output of the headers for each column by passing the -H parameter: + +zfs list -H + +Another helpful option for script writers is -p, which displays the numbers +in non-rounded, exact values: + +zfs list -p + + -- Benedict Reuschling +% +Before deleting a dataset or snapshot, perform a dry run using the -n +parameter. This is to make sure you really want to delete just that +dataset/snapshot and not any dependent ones. ZFS will display the resulting +action when -n is combined with the -v option without actually performing +it: + +zfs destroy -rvn mypool@mysnap + +Once you are sure this is exactly what you intend to do, remove the -n +parameter to execute the destroy operation. + -- Benedict Reuschling +% +You can delete a range of ZFS snapshots (a-z) in multiple ways. +The following will delete d and all earlier snapshots: + +zfs destroy mypool/data@%d + +To delete d and all later snapshots: + +zfs destroy mypool/data@d% + +To delete all dataset snapshots: + +zfs destroy mypool/data@% + +Make sure to let ZFS perform a dry run (-n option) first and display (-v) what +it would do to confirm that the delete operation is removing exactly what you +intended. + -- Benedict Reuschling +% +To set a custom ZFS property on the mypool pool, you need to provide it +using the "key1:key2=value" syntax, where the colon (:) is used as the +separator and identifier from the built-in ZFS properties: + +# zfs set warranty:expires=2038-01-19 mypool + +The custom property is applied to all datasets and can be queried like any +built-in properties using zfs get: + +zfs get warranty:expires mypool + +To reset the value of a custom property, use the inherit subcommand: + +# zfs inherit warranty:expires mypool + +Removing a custom property from a pool is done using the -r flag to the +"zfs inherit" command: + +# zfs inherit -r warranty:expires mypool + + -- Benedict Reuschling +% +To delete a range of ZFS snapshots, use the % (percent) character after the +full path to the first snapshot that should be included. For example, to +simulate deleting snapshots a through (including) d, use this command: + +# zfs destroy -rvn mypool/tmp@a%d + +Once you are sure that this is what you want, remove the -n option: + +# zfs destroy -rv mypool/tmp@a%d + + -- Benedict Reuschling +% +You can prevent the removal of a ZFS snapshot by using the hold subcommand. +For example, to prevent the snapshot called milestone from deletion, run the +following command: + +# zfs hold milestone_hold mypool/projects@my_milestone + +The "zfs holds" command will list all current snapshots that are protected +this way (-r for a recursive list): + +# zfs holds -r mypool + +The TIMESTAMP column in the output of the above command is from when the +hold was created, not the snapshot it holds. The "zfs destroy" command will +echo a "dataset is busy" message on the console when it encounters a hold. +Use "zfs release" to release the hold on the snapshot: + +# zfs release milestone_hold mypool/projects@my_milestone + + -- Benedict Reuschling +% +A user "sender" needs the following permissions set to send a ZFS dataset: + +# zfs allow -u sender send,snapshot txpool + +On the receiving side, the user "receiver" requires these permissions: + +# zfs allow -u receiver compression,mountpoint,mount,create,receive rxpool + + -- Benedict Reuschling +% +Don't let your zpool fill up completely by creating a dataset with +reservation. + +# zfs create -o refreservation=<5% of total pool space> /reserved + +You can always shrink the reserve if you need the space, but your pool will +always have space left this way. + + -- Benedict Reuschling % From owner-svn-src-stable-12@freebsd.org Sun Jan 27 14:03:39 2019 Return-Path: Delivered-To: svn-src-stable-12@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 4248D14AD472; Sun, 27 Jan 2019 14:03:39 +0000 (UTC) (envelope-from nyan@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 DCE936AD68; Sun, 27 Jan 2019 14:03:38 +0000 (UTC) (envelope-from nyan@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 CE1A69077; Sun, 27 Jan 2019 14:03:38 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x0RE3cKO026760; Sun, 27 Jan 2019 14:03:38 GMT (envelope-from nyan@FreeBSD.org) Received: (from nyan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0RE3cY9026759; Sun, 27 Jan 2019 14:03:38 GMT (envelope-from nyan@FreeBSD.org) Message-Id: <201901271403.x0RE3cY9026759@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nyan set sender to nyan@FreeBSD.org using -f From: Takahashi Yoshihiro Date: Sun, 27 Jan 2019 14:03:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343492 - stable/12/usr.bin/ruptime X-SVN-Group: stable-12 X-SVN-Commit-Author: nyan X-SVN-Commit-Paths: stable/12/usr.bin/ruptime X-SVN-Commit-Revision: 343492 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DCE936AD68 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]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jan 2019 14:03:39 -0000 Author: nyan Date: Sun Jan 27 14:03:38 2019 New Revision: 343492 URL: https://svnweb.freebsd.org/changeset/base/343492 Log: MFC: r342965 Fix indentation in ruptime command output for hosts in the "down" state. PR: 234239 Modified: stable/12/usr.bin/ruptime/ruptime.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/ruptime/ruptime.c ============================================================================== --- stable/12/usr.bin/ruptime/ruptime.c Sun Jan 27 13:58:06 2019 (r343491) +++ stable/12/usr.bin/ruptime/ruptime.c Sun Jan 27 14:03:38 2019 (r343492) @@ -264,7 +264,7 @@ ruptime(const char *host, int aflg, int (*cmp)(const v hsp = &hs[i]; wd = &hsp->hs_wd; if (ISDOWN(hsp)) { - (void)printf("%-*.*s%s\n", + (void)printf("%-*.*s %s\n", hostnamewidth, hostnamewidth, wd->wd_hostname, interval(now - hsp->hs_wd.wd_recvtime, "down")); continue; From owner-svn-src-stable-12@freebsd.org Sun Jan 27 13:56:45 2019 Return-Path: Delivered-To: svn-src-stable-12@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 1E8DD14ACF68; Sun, 27 Jan 2019 13:56:45 +0000 (UTC) (envelope-from nyan@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 B52046A60F; Sun, 27 Jan 2019 13:56:44 +0000 (UTC) (envelope-from nyan@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 A15F28EC7; Sun, 27 Jan 2019 13:56:44 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x0RDuiXs021582; Sun, 27 Jan 2019 13:56:44 GMT (envelope-from nyan@FreeBSD.org) Received: (from nyan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0RDuimr021581; Sun, 27 Jan 2019 13:56:44 GMT (envelope-from nyan@FreeBSD.org) Message-Id: <201901271356.x0RDuimr021581@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nyan set sender to nyan@FreeBSD.org using -f From: Takahashi Yoshihiro Date: Sun, 27 Jan 2019 13:56:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343490 - stable/12/usr.bin/bc X-SVN-Group: stable-12 X-SVN-Commit-Author: nyan X-SVN-Commit-Paths: stable/12/usr.bin/bc X-SVN-Commit-Revision: 343490 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B52046A60F 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)[-0.999,0]; NEURAL_HAM_SHORT(-0.95)[-0.951,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jan 2019 13:56:45 -0000 Author: nyan Date: Sun Jan 27 13:56:44 2019 New Revision: 343490 URL: https://svnweb.freebsd.org/changeset/base/343490 Log: MFC: r342964 Sync with OpenBSD. bc.y: Rev 1.50 - write parse errors to stderr, prompted by Martijn Dekker - we're only interactive if stdout en stderr are a tty as well as stdin PR: 234430 Obtained from: OpenBSD Modified: stable/12/usr.bin/bc/bc.y Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/bc/bc.y ============================================================================== --- stable/12/usr.bin/bc/bc.y Sun Jan 27 13:03:48 2019 (r343489) +++ stable/12/usr.bin/bc/bc.y Sun Jan 27 13:56:44 2019 (r343490) @@ -996,7 +996,7 @@ yyerror(const char *s) putchar('\\'); putchar(*p); } - fputs("]pc\n", stdout); + fputs("]ec\n", stdout); free(str); } @@ -1173,7 +1173,8 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; - interactive = isatty(STDIN_FILENO); + interactive = isatty(STDIN_FILENO) && isatty(STDOUT_FILENO) && + isatty(STDERR_FILENO); for (i = 0; i < argc; i++) sargv[sargc++] = argv[i]; From owner-svn-src-stable-12@freebsd.org Sun Jan 27 13:06:44 2019 Return-Path: Delivered-To: svn-src-stable-12@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 C45C414AADFF; Sun, 27 Jan 2019 13:06:44 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.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 03BC697111; Sun, 27 Jan 2019 13:06:43 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x0RD6etG098720; Sun, 27 Jan 2019 05:06:40 -0800 (PST) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id x0RD6eMf098719; Sun, 27 Jan 2019 05:06:40 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201901271306.x0RD6eMf098719@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r343487 - stable/12/usr.bin/fortune/datfiles In-Reply-To: <201901271152.x0RBqGC5057776@repo.freebsd.org> To: Benedict Reuschling Date: Sun, 27 Jan 2019 05:06:40 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 03BC697111 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]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jan 2019 13:06:45 -0000 > Author: bcr (doc committer) > Date: Sun Jan 27 11:52:16 2019 > New Revision: 343487 > URL: https://svnweb.freebsd.org/changeset/base/343487 > > Log: > Add ZFS usage tips to freebsd-tips. > > Add a bunch of examples on how to use ZFS features like: > - listing available space, > - setting and displaying a userquota, > - displaying pool I/O statistics and pool history, > - displaying the compression ratio for a dataset, > - various list options (sorting, removing headers), > - performing a dry-run of a snapshot delete, > - removing a range of snapshots, > - setting a custom property, > - preventing removal of a snapshot with ZFS holds, > - permission sets for zfs send/receive. > > Additionally, clarify the existing examples a bit when > it comes to displaying space by mentioning UFS explicitly. > Other examples include displaying I/O in top(1), querying > sysctl(8) for active CPUs and available RAM. Mention systat(1) > and its options, too. > While here, reformat the example to upload a dmesg(8) a bit > to wrap properly. > > Thanks to Allan Jude for his help with some of the ZFS examples. > > Reviewed by: dru,allanjude > Approved by: allanjude (earlier version) > Relnotes: yes (ZFS examples in freebsd-tips) > Differential Revision: https://reviews.freebsd.org/D18541 I provided feedback in that review that seems to have not been incorporated, though that input was post ^/head commit it could of been incorporate before MFC. Do you plan to do anything with the input? I have inlined most of it below. > Modified: > stable/12/usr.bin/fortune/datfiles/freebsd-tips > Directory Properties: > stable/12/ (props changed) > > Modified: stable/12/usr.bin/fortune/datfiles/freebsd-tips > ============================================================================== > --- stable/12/usr.bin/fortune/datfiles/freebsd-tips Sun Jan 27 02:31:42 2019 (r343486) > +++ stable/12/usr.bin/fortune/datfiles/freebsd-tips Sun Jan 27 11:52:16 2019 (r343487) > @@ -270,12 +270,12 @@ To see how long it takes a command to run, type the wo > command name. > -- Dru > % > -To see how much disk space is left on your partitions, use > +To see how much disk space is left on your UFS partitions, use > > df -h > -- Dru > % > -To see the 10 largest files on a directory or partition, use > +To see the 10 largest files on a directory or UFS partition, use This is poor english, it should read to see the 10 largest files in a directory or on a UFS partiion, use > > du -h /partition_or_directory_name | sort -rh | head > -- Dru > @@ -554,9 +554,241 @@ Use "sysrc name=value" to add an entry and "sysrc -x n > > -- Lars Engels > % > -You can upload the dmesg of your system to help developers get an overview of commonly used hardware and peripherals for FreeBSD. > -Use the curl package to upload it in one command: > +You can upload the dmesg of your system to help developers get an overview of commonly > +used hardware and peripherals for FreeBSD. Use the curl package to upload it like this: > curl -v -d "nickname=$USER" -d "description=FreeBSD/$(uname -m) on \ > $(kenv smbios.system.maker) $(kenv smbios.system.product)" -d "do=addd" \ > --data-urlencode 'dmesg@/var/run/dmesg.boot' http://dmesgd.nycbug.org/index.cgi > +% > +Want to know how much memory (in bytes) your machine has available? Let > +sysctl(8) tell you with the following command: > + > +sysctl hw.physmem This one may be slighly confusing as to what available means here, this is boot time memory available for the system to use, it is not your currently available for use memory (free memory). > + > +The number of active CPUs is displayed using this command: > + > +sysctl hw.ncpu > + > + -- Benedict Reuschling > +% > +When using ZFS as the file system the "df" command will display confusing > +values. Use the built-in "zfs list" command to get an overview of space usage: This one really needs to explain what df is actually displaying, not just label it confusing since it differs from what UFS displays. > + > +zfs list -o space > + > + -- Benedict Reuschling > +% > +To learn more about what your system is doing, take a look at systat(1). For > +example, to get an overview of I/O happening in the system, run: > + > +systat -iostat I would strongly encorage systat -vmstat for the example, much more informative than boring iostat :-) > + > +Other values are icmp, icmp6, ifstat, ip, ip6, netstat, pigs, sctp, swap, tcp, > +vmstat, or zarc. You can switch between displays using : and exit > +back to your shell by typing > + > +:quit > + > + -- Benedict Reuschling > +% > +To set a quota of 10 GB for the user named foo on a ZFS dataset, run the > +following command: > + > +# zfs set userquota@foo=10G pool/home/foo > + > +The zfs userspace command can display the quota and current space usage: > + > +# zfs userspace pool/home/foo > + > +To unset a quota, assign "none" as the value. > + -- Benedict Reuschling > +% > +ZFS can display I/O statistics for a given pool using the iostat subcommand. > +By default, it will display one line of current activity. To display stats > +every 5 seconds run the following command (cancel with CTRL+C): > + > +zpool iostat 5 > + > +To view individual disk activities, specify the -v parameter: > + > +zpool iostat -v > + > +Of course, both can be combined. For more options, see zpool(8). > + -- Benedict Reuschling > +% > +FreeBSD's top(1) utility displays CPU statistics by default. > +To display I/O activity for each process instead, run top like this: > + > +top -m io > + > + -- Benedict Reuschling > +% > +ZFS keeps a history of commands run against a specific pool using the > +history subcommand to zpool: > + > +zpool history > + > +More details are available using the -i and -l parameters. Note that ZFS > +will not keep the complete pool history forever and will remove older > +events in favor of never ones. > + -- Benedict Reuschling > +% > +To display the compression ratio for the ZFS dataset /var/log on the pool > +mypool, run the following command: > + > +zfs get refcompressratio mypool/var/log > + > +The refcompressratio will only display the compression ratio for that specific > +dataset, not the descendant datasets. To include the child datasets, the > +command looks like this: > + > +zfs get compressratio mypool/var > + > + -- Benedict Reuschling > +% > +You can limit the depth of the displayed datasets in the "zfs list" output > +using the -d parameter. To display only the first level of datasets below > +mypool/usr and not the ones deeper than those, run this command: > + > +zfs list -d 1 mypool/usr > + > + -- Benedict Reuschling > +% > +The "zfs list" command can be filtered in multiple ways. To display just > +the dataset name, use the -o parameter: > + > +zfs list -o name mypool/usr > + > +More columns and their order can be defined by separating them with commas: > + > +zfs list -o mountpoint,name,avail > + > + -- Benedict Reuschling > +% > +The output of "zfs list" can be sorted by a specific column using -s. To > +sort the datasets by the "used" column in ascending order, run this command: > + > +zfs list -s used > + > +To sort in descending order instead, use -S: > + > +zfs list -S used > + > + -- Benedict Reuschling > +% > +To make the "zfs list" output more script-friendly, you can suppress the > +output of the headers for each column by passing the -H parameter: > + > +zfs list -H > + > +Another helpful option for script writers is -p, which displays the numbers > +in non-rounded, exact values: > + > +zfs list -p > + > + -- Benedict Reuschling > +% > +Before deleting a dataset or snapshot, perform a dry run using the -n > +parameter. This is to make sure you really want to delete just that > +dataset/snapshot and not any dependent ones. ZFS will display the resulting > +action when -n is combined with the -v option without actually performing > +it: > + > +zfs destroy -rvn mypool@mysnap > + > +Once you are sure this is exactly what you intend to do, remove the -n > +parameter to execute the destroy operation. > + -- Benedict Reuschling > +% > +You can delete a range of ZFS snapshots (a-z) in multiple ways. > +The following will delete d and all earlier snapshots: > + > +zfs destroy mypool/data@%d > + > +To delete d and all later snapshots: > + > +zfs destroy mypool/data@d% > + > +To delete all dataset snapshots: > + > +zfs destroy mypool/data@% > + > +Make sure to let ZFS perform a dry run (-n option) first and display (-v) what > +it would do to confirm that the delete operation is removing exactly what you > +intended. > + -- Benedict Reuschling > +% > +To set a custom ZFS property on the mypool pool, you need to provide it > +using the "key1:key2=value" syntax, where the colon (:) is used as the > +separator and identifier from the built-in ZFS properties: > + > +# zfs set warranty:expires=2038-01-19 mypool > + > +The custom property is applied to all datasets and can be queried like any > +built-in properties using zfs get: > + > +zfs get warranty:expires mypool > + > +To reset the value of a custom property, use the inherit subcommand: > + > +# zfs inherit warranty:expires mypool > + > +Removing a custom property from a pool is done using the -r flag to the > +"zfs inherit" command: > + > +# zfs inherit -r warranty:expires mypool > + > + -- Benedict Reuschling > +% > +To delete a range of ZFS snapshots, use the % (percent) character after the > +full path to the first snapshot that should be included. For example, to > +simulate deleting snapshots a through (including) d, use this command: > + > +# zfs destroy -rvn mypool/tmp@a%d > + > +Once you are sure that this is what you want, remove the -n option: > + > +# zfs destroy -rv mypool/tmp@a%d > + > + -- Benedict Reuschling > +% > +You can prevent the removal of a ZFS snapshot by using the hold subcommand. > +For example, to prevent the snapshot called milestone from deletion, run the > +following command: > + > +# zfs hold milestone_hold mypool/projects@my_milestone > + > +The "zfs holds" command will list all current snapshots that are protected > +this way (-r for a recursive list): > + > +# zfs holds -r mypool > + > +The TIMESTAMP column in the output of the above command is from when the > +hold was created, not the snapshot it holds. The "zfs destroy" command will > +echo a "dataset is busy" message on the console when it encounters a hold. > +Use "zfs release" to release the hold on the snapshot: > + > +# zfs release milestone_hold mypool/projects@my_milestone > + > + -- Benedict Reuschling > +% > +A user "sender" needs the following permissions set to send a ZFS dataset: > + > +# zfs allow -u sender send,snapshot txpool > + > +On the receiving side, the user "receiver" requires these permissions: > + > +# zfs allow -u receiver compression,mountpoint,mount,create,receive rxpool > + > + -- Benedict Reuschling > +% > +Don't let your zpool fill up completely by creating a dataset with > +reservation. > + > +# zfs create -o refreservation=<5% of total pool space> /reserved > + > +You can always shrink the reserve if you need the space, but your pool will > +always have space left this way. > + > + -- Benedict Reuschling > % > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-stable-12@freebsd.org Sun Jan 27 14:52:22 2019 Return-Path: Delivered-To: svn-src-stable-12@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 030A914AF267; Sun, 27 Jan 2019 14:52:22 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from mxout1bln1.prossl.de (mxout1bln1.prossl.de [91.233.87.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7D6606CCD8; Sun, 27 Jan 2019 14:52:21 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from Voyager.fritz.box (p57A61F9A.dip0.t-ipconnect.de [87.166.31.154]) (authenticated bits=0) by mx1bln1.prossl.de (8.15.2/8.14.9) with ESMTPSA id x0REqIdu009505 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 27 Jan 2019 15:52:18 +0100 Subject: Re: svn commit: r343487 - stable/12/usr.bin/fortune/datfiles To: rgrimes@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org References: <201901271306.x0RD6eMf098719@pdx.rh.CN85.dnsmgr.net> From: Benedict Reuschling Openpgp: preference=signencrypt Autocrypt: addr=bcr@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFr4feYBCACdrnRpuvW/d/PeKuFu54ifaGhG+yFf3wnWaQX8hTCvySbv6A24Owot6cyU vhjdsifZ9iRQ82Likl+6OxI9qBXR9N+WCv1ut46q+mL50YLnYRejRCz8vEmVunlyVDKjsBY5 DtjsaRXMJ/D56wh3ROd9VYjrDHWobu+bg9D7RIv0kCyoPd0JsYRFXISgt4IocWVLT8ciWqiT Pp3m37BPrtXhR3EDOnHmGWPf6SuolvveqyOlpdguD3LAkFJDLeq3isnMaLXUhcsTqBTBLdOT 6EJHBYCcq39izNVC88JsVBmEuByhpb0LaXrBFQWhUG5RyecROAqrx+DWhcZnxayCtr3NABEB AAG0N0JlbmVkaWN0IFJldXNjaGxpbmcgKHd3dy5mcmVlYnNkLm9yZykgPGJjckBGcmVlQlNE Lm9yZz6JAVQEEwEKAD4CGwMFCwkIBwMFFQoJCAsFFgIDAQACHgECF4AWIQRTQnZtbeuE5dPj 3Pah0MHTBYXRWAUCWviOpwUJA8J3wQAKCRCh0MHTBYXRWJfJB/9qxBylB2KlA5EkdhyOp9cO O8kGpx301Rg6I/IUDACmDRvZckthpaUlNJ/RBYtid12o9A9kIhabdEaZfoBcV+ehyq3iSnff 9U+YlXkQ0iOflujWfgyMKNmaseWAPl6aCYc4gUsRH6YTVJFANPdofAIghEFLeY4jPsfkCIPP SAzUK1kQDtsHc5zwTYltqiKRBxQe1Y8WftitRp4LkTkR2wxWggp5oS6yKzh0kRir+U+5pFWZ 9g4ZQGxqodp8fKHI1IsJvs921UArjbmtLmDbrd28SK96i5ck4xga6mPf7ShhE9haYy1A+cbK fDhwizaJUl/H3jjXXbPv1MuIsvo+qEKVuQENBFr4f7wBCACxULIM5UFaEyZwAojYMXwIF/QW zq20MXaQXjn2JxJp04VaQHCL794ZrNtvkTvyqxYVFCKjvJHPXsT4zKuglMSTi83choejs7DJ 4YNmBBJKDHbugAcb5OgdTaT+ztUGl1VL4S3iEvWJwBAOUuzd9TTC/4GhYnUJR7A0CeEZnPfF av2K+d8BZ8x/XryFgQo3Wi5FnOekwls4v1wzzJE4ssaW4p357fmXRG2Czzytzf/W3I2/VWFm 2J8P8TIzSoJq+girktqhH+dYwbDeWkldWj6egcMdpVzJ89ottXARQYeu6YFSHnmHHnBhX2hV z+K2WkVLqYwj7XdBQAtPxIk8VlMBABEBAAGJAnIEGAEKACYCGwIWIQRTQnZtbeuE5dPj3Pah 0MHTBYXRWAUCWviOsgUJA8J19gFAwHQgBBkBCgAdFiEEwXonQDvNfP/33IoBVXQ7/QHhjTUF Alr4f7wACgkQVXQ7/QHhjTWg7Qf/WzBvcfskO8HBHfmLEE5zJRIOgogl6kVwvwR6PjihhMFC iBeH2fGz8nTtkouSttcbMnLnmV0qVv/r5FgIohTlEimaQUh7LgQKiql2SdYVpF1ha/3NHerR 1Rc0OGW+eliseI9b9/OKkY1AOaRM98HGJZB6TO2iKf2wiJDjr1RdlN2VcCST+ksG2Ehc3RvZ UTY1Kw5i9BOKsTsiQkrpCsrZ2/0tqvwv7efYJ0FOHfm0WbmvAlfdpxqsWmtgdsa0m/ItBtpo zIhlZs8/BlOmDK5571bAmWOV0apXSgp6OTmeQkpIsJKjwj/JwOhzvfkxZv03Js4+51xKjotT ma8XGjnJKgkQodDB0wWF0Vj+Wwf/f5cEjvLmq+Xw0KYjPA8oqk9L5a4Z9J/BdeH630koZ2wP YUwUsF/rFfdZf7jHvJJas1I0ctsutvhlgu4Elb7kJrfNRMSXUXe8ucdPS/cH9M/y9e7flW3i c/Ik14rV1Z1E9ME0CtDzfUtS3BfhyxpgmHbQmgPv/NkCE8Zu+nU/1QInpi7ZrDWWyJOCndcm R4kZpP0MJ0OCTWGDkDtJG4zIRQKeJKscqolWo7yu3GiG/Fr9W5cfr3IIo9xp8UQ06idbjjSV jItrSmL/HoZYQ7DSGCsQObC6snbkdeWRSaz/TCzEth5O0NGgA37apNaF3TZTbxRWcMG9uICc oGpDIZeCe7kBDQRa+IBQAQgA2EV0IFUgcJEpznzSxRhKajgLUmP/CJkUrXRipRrR0PqeXEH2 dF1+T8JObDVBN33oXwbXfIvBUhEw2uWsAHDW8OqzUsCTUxdy3ehVHkxHw1deXfvYf5VTtSli QsVIEJ0LZtD3V0idDnfGAhWqbMubBtF2tj1I6P2Py+RlU1pMD4B4g8zcWU+H4H39tpLkd9c/ kTemaX6QwRNW42L8+tDjL4pUogf8/tweMOj9LDOWVTqE2lipWxCH0uTEj8G8kSMLCyGgjxni MFDpjJLu3ETBZMevA+HNWS80RGbT2byu0FbeqXdRV3/+PL3MUY3mOs91bVgxpULG3aDcEmWd IJzNgQARAQABiQE8BBgBCgAmAhsMFiEEU0J2bW3rhOXT49z2odDB0wWF0VgFAlr4jsAFCQPC dXAACgkQodDB0wWF0VgnUQf/T1Z0SBj8YdepF91TTQnvH21USuyEsWCIX8d2xrUqGdVnwlIS fllS3SKTZQJdFhqQtEEYrKRhUDHrPt5Sm0NBisiD+lLcRajv7si4Xj8/ZY/gFjt7RrraYv5D Yb1BjSzsY4YEtq55jDknGufmBpannhnLFFlltt12Sa+xVgZMOl3g8zMjQkiPMtesw1DMDy9N lPB2WlbBVQlkzNHMifpIEiqc+ckZJavYabl/Nsv/kbMFGTizdIllN2EML6l9/KUC3Iw0OWB9 pnge7j3cX7+6sv4ypu65B/XMb4h/4HvXs4D2NW0HIIWtPA50fjjPSJs2JHJt9qVkI7/rNNNL byRcKQ== Organization: The FreeBSD Project Message-ID: <1cc6abbf-8e63-59af-f677-f1d7baf100d7@FreeBSD.org> Date: Sun, 27 Jan 2019 15:52:19 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <201901271306.x0RD6eMf098719@pdx.rh.CN85.dnsmgr.net> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="d2PExWdHaCcFxPEhdbv9OiKqNTkULeb89" X-Null-Tag: 8f98db18d0e531870240c7e771e25b45 X-Rspamd-Queue-Id: 7D6606CCD8 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.929,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jan 2019 14:52:22 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --d2PExWdHaCcFxPEhdbv9OiKqNTkULeb89 Content-Type: multipart/mixed; boundary="hqouf3mMHUhLjcMD6bRtiQ5BgudlDxFNY"; protected-headers="v1" From: Benedict Reuschling To: rgrimes@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Message-ID: <1cc6abbf-8e63-59af-f677-f1d7baf100d7@FreeBSD.org> Subject: Re: svn commit: r343487 - stable/12/usr.bin/fortune/datfiles References: <201901271306.x0RD6eMf098719@pdx.rh.CN85.dnsmgr.net> In-Reply-To: <201901271306.x0RD6eMf098719@pdx.rh.CN85.dnsmgr.net> --hqouf3mMHUhLjcMD6bRtiQ5BgudlDxFNY Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Am 27.01.19 um 14:06 schrieb Rodney W. Grimes: >> Author: bcr (doc committer) >> Date: Sun Jan 27 11:52:16 2019 >> New Revision: 343487 >> URL: https://svnweb.freebsd.org/changeset/base/343487 >> >> Log: >> Add ZFS usage tips to freebsd-tips. >> =20 >> Add a bunch of examples on how to use ZFS features like: >> - listing available space, >> - setting and displaying a userquota, >> - displaying pool I/O statistics and pool history, >> - displaying the compression ratio for a dataset, >> - various list options (sorting, removing headers), >> - performing a dry-run of a snapshot delete, >> - removing a range of snapshots, >> - setting a custom property, >> - preventing removal of a snapshot with ZFS holds, >> - permission sets for zfs send/receive. >> =20 >> Additionally, clarify the existing examples a bit when >> it comes to displaying space by mentioning UFS explicitly. >> Other examples include displaying I/O in top(1), querying >> sysctl(8) for active CPUs and available RAM. Mention systat(1) >> and its options, too. >> While here, reformat the example to upload a dmesg(8) a bit >> to wrap properly. >> =20 >> Thanks to Allan Jude for his help with some of the ZFS examples. >> =20 >> Reviewed by: dru,allanjude >> Approved by: allanjude (earlier version) >> Relnotes: yes (ZFS examples in freebsd-tips) >> Differential Revision: https://reviews.freebsd.org/D18541 >=20 > I provided feedback in that review that seems to have > not been incorporated, though that input was post ^/head > commit it could of been incorporate before MFC. Do you > plan to do anything with the input? >=20 > I have inlined most of it below. >=20 Hi Rod, I've opened a new review to address the issues you've raised here: https://reviews.freebsd.org/D18993 Regards, Benedict --hqouf3mMHUhLjcMD6bRtiQ5BgudlDxFNY-- --d2PExWdHaCcFxPEhdbv9OiKqNTkULeb89 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCgAdFiEEwXonQDvNfP/33IoBVXQ7/QHhjTUFAlxNxaMACgkQVXQ7/QHh jTXhzQf9Em9UGmaaht9imUZ+xKIrjrl1uy4AltPDmHoBHPj7F58Sp8V4EtHReLd2 FgfR0wXiiovoMF+ge5FXJF9ASLtAk6Ts0E8BpQ5tmltIDZ0olYoHcrzp+TGmIYya kx+I0ZiRGAoUW0hqSLQ5996Rn4aMlqc0405XuDEsxULX4+TMortX6tR2qmTd5Hu8 qoQOxkB8oc7FR3yJhLLDgoVFcWfwe4KnLw0jSuPVgm4tmD71dsx/y0zQvnnEg4DF Ry1pODlNnQweJaiA493W+uBwKb6qzhzFgw/9oLDPexZJMNTO5Gh0I6/fDybcURZ+ qIrvPW/1kBcCIi8BKa4fhyE8/VnelQ== =cCaS -----END PGP SIGNATURE----- --d2PExWdHaCcFxPEhdbv9OiKqNTkULeb89-- From owner-svn-src-stable-12@freebsd.org Sun Jan 27 19:04:05 2019 Return-Path: Delivered-To: svn-src-stable-12@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 649A814B8E94; Sun, 27 Jan 2019 19:04:05 +0000 (UTC) (envelope-from marius@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 15DB67783D; Sun, 27 Jan 2019 19:04:05 +0000 (UTC) (envelope-from marius@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 E5080C512; Sun, 27 Jan 2019 19:04:04 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x0RJ44Iv085116; Sun, 27 Jan 2019 19:04:04 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0RJ4264085105; Sun, 27 Jan 2019 19:04:02 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201901271904.x0RJ4264085105@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 27 Jan 2019 19:04:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343503 - in stable/12/sys: arm/broadcom/bcm2835 arm/nvidia arm/ti dev/sdhci X-SVN-Group: stable-12 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: in stable/12/sys: arm/broadcom/bcm2835 arm/nvidia arm/ti dev/sdhci X-SVN-Commit-Revision: 343503 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 15DB67783D 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.976,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jan 2019 19:04:06 -0000 Author: marius Date: Sun Jan 27 19:04:02 2019 New Revision: 343503 URL: https://svnweb.freebsd.org/changeset/base/343503 Log: MFC: r342634 o Don't allocate resources for SDMA in sdhci(4) if the controller or the front-end doesn't support SDMA or the latter implements a platform- specific transfer method instead. While at it, factor out allocation and freeing of SDMA resources to sdhci_dma_{alloc,free}() in order to keep the code more readable when adding support for ADMA variants. o Base the size of the SDMA bounce buffer on MAXPHYS up to the maximum of 512 KiB instead of using a fixed 4-KiB-buffer. With the default MAXPHYS of 128 KiB and depending on the controller and medium, this reduces the number of SDHCI interrupts by a factor of ~16 to ~32 on sequential reads while an increase of throughput of up to ~84 % was seen. Front-ends for broken controllers that only support an SDMA buffer boundary of a specific size may set SDHCI_QUIRK_BROKEN_SDMA_BOUNDARY and supply a size via struct sdhci_slot. According to Linux, only Qualcomm MSM-type SDHCI controllers are affected by this, though. Requested by: Shreyank Amartya (unconditional bump to 512 KiB) o Introduce a SDHCI_DEPEND macro for specifying the dependency of the front-end modules on the sdhci(4) one and bump the module version of sdhci(4) to 2 via an also newly introduced SDHCI_VERSION in order to ensure that all components are in sync WRT struct sdhci_slot. o In sdhci(4): - Make pointers const were applicable, - replace a few device_printf(9) calls with slot_printf() for consistency, and - sync some local functions with their prototypes WRT static. Modified: stable/12/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c stable/12/sys/arm/broadcom/bcm2835/bcm2835_sdhost.c stable/12/sys/arm/nvidia/tegra_sdhci.c stable/12/sys/arm/ti/ti_sdhci.c stable/12/sys/dev/sdhci/fsl_sdhci.c stable/12/sys/dev/sdhci/sdhci.c stable/12/sys/dev/sdhci/sdhci.h stable/12/sys/dev/sdhci/sdhci_acpi.c stable/12/sys/dev/sdhci/sdhci_fdt.c stable/12/sys/dev/sdhci/sdhci_pci.c stable/12/sys/dev/sdhci/sdhci_xenon.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c ============================================================================== --- stable/12/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Sun Jan 27 18:53:36 2019 (r343502) +++ stable/12/sys/arm/broadcom/bcm2835/bcm2835_sdhci.c Sun Jan 27 19:04:02 2019 (r343503) @@ -683,7 +683,7 @@ static driver_t bcm_sdhci_driver = { DRIVER_MODULE(sdhci_bcm, simplebus, bcm_sdhci_driver, bcm_sdhci_devclass, NULL, NULL); -MODULE_DEPEND(sdhci_bcm, sdhci, 1, 1, 1); +SDHCI_DEPEND(sdhci_bcm); #ifndef MMCCAM MMC_DECLARE_BRIDGE(sdhci_bcm); #endif Modified: stable/12/sys/arm/broadcom/bcm2835/bcm2835_sdhost.c ============================================================================== --- stable/12/sys/arm/broadcom/bcm2835/bcm2835_sdhost.c Sun Jan 27 18:53:36 2019 (r343502) +++ stable/12/sys/arm/broadcom/bcm2835/bcm2835_sdhost.c Sun Jan 27 19:04:02 2019 (r343503) @@ -1287,7 +1287,7 @@ static driver_t bcm_sdhost_driver = { DRIVER_MODULE(sdhost_bcm, simplebus, bcm_sdhost_driver, bcm_sdhost_devclass, NULL, NULL); -MODULE_DEPEND(sdhost_bcm, sdhci, 1, 1, 1); +SDHCI_DEPEND(sdhost_bcm); #ifndef MMCCAM MMC_DECLARE_BRIDGE(sdhost_bcm); #endif Modified: stable/12/sys/arm/nvidia/tegra_sdhci.c ============================================================================== --- stable/12/sys/arm/nvidia/tegra_sdhci.c Sun Jan 27 18:53:36 2019 (r343502) +++ stable/12/sys/arm/nvidia/tegra_sdhci.c Sun Jan 27 19:04:02 2019 (r343503) @@ -465,7 +465,7 @@ static DEFINE_CLASS_0(sdhci, tegra_sdhci_driver, tegra sizeof(struct tegra_sdhci_softc)); DRIVER_MODULE(sdhci_tegra, simplebus, tegra_sdhci_driver, tegra_sdhci_devclass, NULL, NULL); -MODULE_DEPEND(sdhci_tegra, sdhci, 1, 1, 1); +SDHCI_DEPEND(sdhci_tegra); #ifndef MMCCAM MMC_DECLARE_BRIDGE(sdhci); #endif Modified: stable/12/sys/arm/ti/ti_sdhci.c ============================================================================== --- stable/12/sys/arm/ti/ti_sdhci.c Sun Jan 27 18:53:36 2019 (r343502) +++ stable/12/sys/arm/ti/ti_sdhci.c Sun Jan 27 19:04:02 2019 (r343503) @@ -755,7 +755,7 @@ static driver_t ti_sdhci_driver = { DRIVER_MODULE(sdhci_ti, simplebus, ti_sdhci_driver, ti_sdhci_devclass, NULL, NULL); -MODULE_DEPEND(sdhci_ti, sdhci, 1, 1, 1); +SDHCI_DEPEND(sdhci_ti); #ifndef MMCCAM MMC_DECLARE_BRIDGE(sdhci_ti); Modified: stable/12/sys/dev/sdhci/fsl_sdhci.c ============================================================================== --- stable/12/sys/dev/sdhci/fsl_sdhci.c Sun Jan 27 18:53:36 2019 (r343502) +++ stable/12/sys/dev/sdhci/fsl_sdhci.c Sun Jan 27 19:04:02 2019 (r343503) @@ -1005,7 +1005,7 @@ static driver_t fsl_sdhci_driver = { DRIVER_MODULE(sdhci_fsl, simplebus, fsl_sdhci_driver, fsl_sdhci_devclass, NULL, NULL); -MODULE_DEPEND(sdhci_fsl, sdhci, 1, 1, 1); +SDHCI_DEPEND(sdhci_fsl); #ifndef MMCCAM MMC_DECLARE_BRIDGE(sdhci_fsl); Modified: stable/12/sys/dev/sdhci/sdhci.c ============================================================================== --- stable/12/sys/dev/sdhci/sdhci.c Sun Jan 27 18:53:36 2019 (r343502) +++ stable/12/sys/dev/sdhci/sdhci.c Sun Jan 27 19:04:02 2019 (r343503) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -108,19 +109,20 @@ static void sdhci_retune(void *arg); static void sdhci_set_clock(struct sdhci_slot *slot, uint32_t clock); static void sdhci_set_power(struct sdhci_slot *slot, u_char power); static void sdhci_set_transfer_mode(struct sdhci_slot *slot, - struct mmc_data *data); + const struct mmc_data *data); static void sdhci_start(struct sdhci_slot *slot); static void sdhci_timeout(void *arg); static void sdhci_start_command(struct sdhci_slot *slot, struct mmc_command *cmd); -static void sdhci_start_data(struct sdhci_slot *slot, struct mmc_data *data); +static void sdhci_start_data(struct sdhci_slot *slot, + const struct mmc_data *data); static void sdhci_write_block_pio(struct sdhci_slot *slot); static void sdhci_transfer_pio(struct sdhci_slot *slot); #ifdef MMCCAM /* CAM-related */ static void sdhci_cam_action(struct cam_sim *sim, union ccb *ccb); -static int sdhci_cam_get_possible_host_clock(struct sdhci_slot *slot, +static int sdhci_cam_get_possible_host_clock(const struct sdhci_slot *slot, int proposed_clock); static void sdhci_cam_handle_mmcio(struct cam_sim *sim, union ccb *ccb); static void sdhci_cam_poll(struct cam_sim *sim); @@ -130,12 +132,14 @@ static int sdhci_cam_update_ios(struct sdhci_slot *slo #endif /* helper routines */ +static int sdhci_dma_alloc(struct sdhci_slot *slot); +static void sdhci_dma_free(struct sdhci_slot *slot); static void sdhci_dumpregs(struct sdhci_slot *slot); static void sdhci_getaddr(void *arg, bus_dma_segment_t *segs, int nsegs, int error); -static int slot_printf(struct sdhci_slot *slot, const char * fmt, ...) +static int slot_printf(const struct sdhci_slot *slot, const char * fmt, ...) __printflike(2, 3); -static uint32_t sdhci_tuning_intmask(struct sdhci_slot *slot); +static uint32_t sdhci_tuning_intmask(const struct sdhci_slot *slot); #define SDHCI_LOCK(_slot) mtx_lock(&(_slot)->mtx) #define SDHCI_UNLOCK(_slot) mtx_unlock(&(_slot)->mtx) @@ -179,7 +183,7 @@ sdhci_getaddr(void *arg, bus_dma_segment_t *segs, int } static int -slot_printf(struct sdhci_slot *slot, const char * fmt, ...) +slot_printf(const struct sdhci_slot *slot, const char * fmt, ...) { va_list ap; int retval; @@ -290,7 +294,7 @@ sdhci_reset(struct sdhci_slot *slot, uint8_t mask) } static uint32_t -sdhci_tuning_intmask(struct sdhci_slot *slot) +sdhci_tuning_intmask(const struct sdhci_slot *slot) { uint32_t intmask; @@ -737,55 +741,94 @@ sdhci_card_poll(void *arg) sdhci_card_poll, slot); } -int -sdhci_init_slot(device_t dev, struct sdhci_slot *slot, int num) +static int +sdhci_dma_alloc(struct sdhci_slot *slot) { - kobjop_desc_t kobj_desc; - kobj_method_t *kobj_method; - uint32_t caps, caps2, freq, host_caps; int err; - SDHCI_LOCK_INIT(slot); + if (!(slot->quirks & SDHCI_QUIRK_BROKEN_SDMA_BOUNDARY)) { + if (MAXPHYS <= 1024 * 4) + slot->sdma_boundary = SDHCI_BLKSZ_SDMA_BNDRY_4K; + else if (MAXPHYS <= 1024 * 8) + slot->sdma_boundary = SDHCI_BLKSZ_SDMA_BNDRY_8K; + else if (MAXPHYS <= 1024 * 16) + slot->sdma_boundary = SDHCI_BLKSZ_SDMA_BNDRY_16K; + else if (MAXPHYS <= 1024 * 32) + slot->sdma_boundary = SDHCI_BLKSZ_SDMA_BNDRY_32K; + else if (MAXPHYS <= 1024 * 64) + slot->sdma_boundary = SDHCI_BLKSZ_SDMA_BNDRY_64K; + else if (MAXPHYS <= 1024 * 128) + slot->sdma_boundary = SDHCI_BLKSZ_SDMA_BNDRY_128K; + else if (MAXPHYS <= 1024 * 256) + slot->sdma_boundary = SDHCI_BLKSZ_SDMA_BNDRY_256K; + else + slot->sdma_boundary = SDHCI_BLKSZ_SDMA_BNDRY_512K; + } + slot->sdma_bbufsz = SDHCI_SDMA_BNDRY_TO_BBUFSZ(slot->sdma_boundary); - slot->num = num; - slot->bus = dev; - - /* Allocate DMA tag. */ - err = bus_dma_tag_create(bus_get_dma_tag(dev), - DMA_BLOCK_SIZE, 0, BUS_SPACE_MAXADDR_32BIT, - BUS_SPACE_MAXADDR, NULL, NULL, - DMA_BLOCK_SIZE, 1, DMA_BLOCK_SIZE, - BUS_DMA_ALLOCNOW, NULL, NULL, - &slot->dmatag); + /* + * Allocate the DMA tag for an SDMA bounce buffer. + * Note that the SDHCI specification doesn't state any alignment + * constraint for the SDMA system address. However, controllers + * typically ignore the SDMA boundary bits in SDHCI_DMA_ADDRESS when + * forming the actual address of data, requiring the SDMA buffer to + * be aligned to the SDMA boundary. + */ + err = bus_dma_tag_create(bus_get_dma_tag(slot->bus), slot->sdma_bbufsz, + 0, BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, + slot->sdma_bbufsz, 1, slot->sdma_bbufsz, BUS_DMA_ALLOCNOW, + NULL, NULL, &slot->dmatag); if (err != 0) { - device_printf(dev, "Can't create DMA tag\n"); - SDHCI_LOCK_DESTROY(slot); + slot_printf(slot, "Can't create DMA tag for SDMA\n"); return (err); } - /* Allocate DMA memory. */ + /* Allocate DMA memory for the SDMA bounce buffer. */ err = bus_dmamem_alloc(slot->dmatag, (void **)&slot->dmamem, BUS_DMA_NOWAIT, &slot->dmamap); if (err != 0) { - device_printf(dev, "Can't alloc DMA memory\n"); + slot_printf(slot, "Can't alloc DMA memory for SDMA\n"); bus_dma_tag_destroy(slot->dmatag); - SDHCI_LOCK_DESTROY(slot); return (err); } - /* Map the memory. */ + /* Map the memory of the SDMA bounce buffer. */ err = bus_dmamap_load(slot->dmatag, slot->dmamap, - (void *)slot->dmamem, DMA_BLOCK_SIZE, - sdhci_getaddr, &slot->paddr, 0); + (void *)slot->dmamem, slot->sdma_bbufsz, sdhci_getaddr, + &slot->paddr, 0); if (err != 0 || slot->paddr == 0) { - device_printf(dev, "Can't load DMA memory\n"); + slot_printf(slot, "Can't load DMA memory for SDMA\n"); bus_dmamem_free(slot->dmatag, slot->dmamem, slot->dmamap); bus_dma_tag_destroy(slot->dmatag); - SDHCI_LOCK_DESTROY(slot); if (err) return (err); else return (EFAULT); } + return (0); +} + +static void +sdhci_dma_free(struct sdhci_slot *slot) +{ + + bus_dmamap_unload(slot->dmatag, slot->dmamap); + bus_dmamem_free(slot->dmatag, slot->dmamem, slot->dmamap); + bus_dma_tag_destroy(slot->dmatag); +} + +int +sdhci_init_slot(device_t dev, struct sdhci_slot *slot, int num) +{ + kobjop_desc_t kobj_desc; + kobj_method_t *kobj_method; + uint32_t caps, caps2, freq, host_caps; + int err; + + SDHCI_LOCK_INIT(slot); + + slot->num = num; + slot->bus = dev; + slot->version = (RD2(slot, SDHCI_HOST_VERSION) >> SDHCI_SPEC_VER_SHIFT) & SDHCI_SPEC_VER_MASK; if (slot->quirks & SDHCI_QUIRK_MISSING_CAPS) { @@ -801,12 +844,8 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, if (slot->version >= SDHCI_SPEC_300) { if ((caps & SDHCI_SLOTTYPE_MASK) != SDHCI_SLOTTYPE_REMOVABLE && (caps & SDHCI_SLOTTYPE_MASK) != SDHCI_SLOTTYPE_EMBEDDED) { - device_printf(dev, + slot_printf(slot, "Driver doesn't support shared bus slots\n"); - bus_dmamap_unload(slot->dmatag, slot->dmamap); - bus_dmamem_free(slot->dmatag, slot->dmamem, - slot->dmamap); - bus_dma_tag_destroy(slot->dmatag); SDHCI_LOCK_DESTROY(slot); return (ENXIO); } else if ((caps & SDHCI_SLOTTYPE_MASK) == @@ -830,7 +869,7 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, */ if (slot->max_clk == 0) { slot->max_clk = SDHCI_DEFAULT_MAX_FREQ * 1000000; - device_printf(dev, "Hardware doesn't specify base clock " + slot_printf(slot, "Hardware doesn't specify base clock " "frequency, using %dMHz as default.\n", SDHCI_DEFAULT_MAX_FREQ); } @@ -851,7 +890,7 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, * max timeout, but still mention it. */ if (slot->timeout_clk == 0) { - device_printf(dev, "Hardware doesn't specify timeout clock " + slot_printf(slot, "Hardware doesn't specify timeout clock " "frequency, setting BROKEN_TIMEOUT quirk.\n"); slot->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; } @@ -867,7 +906,7 @@ sdhci_init_slot(device_t dev, struct sdhci_slot *slot, if ((caps & SDHCI_CAN_VDD_180) && (slot->opt & SDHCI_SLOT_EMBEDDED)) slot->host.host_ocr |= MMC_OCR_LOW_VOLTAGE; if (slot->host.host_ocr == 0) { - device_printf(dev, "Hardware doesn't report any " + slot_printf(slot, "Hardware doesn't report any " "support voltages.\n"); } @@ -953,7 +992,7 @@ no_tuning: slot->retune_count = (caps2 & SDHCI_RETUNE_CNT_MASK) >> SDHCI_RETUNE_CNT_SHIFT; if (slot->retune_count > 0xb) { - device_printf(dev, "Unknown re-tuning count " + slot_printf(slot, "Unknown re-tuning count " "%x, using 1 sec\n", slot->retune_count); slot->retune_count = 1; } else if (slot->retune_count != 0) @@ -1012,6 +1051,19 @@ no_tuning: if (slot->opt & SDHCI_PLATFORM_TRANSFER) slot->opt &= ~SDHCI_HAVE_DMA; + if (slot->opt & SDHCI_HAVE_DMA) { + err = sdhci_dma_alloc(slot); + if (err != 0) { + if (slot->opt & SDHCI_TUNING_SUPPORTED) { + free(slot->tune_req, M_DEVBUF); + free(slot->tune_cmd, M_DEVBUF); + free(slot->tune_data, M_DEVBUF); + } + SDHCI_LOCK_DESTROY(slot); + return (err); + } + } + if (bootverbose || sdhci_debug) { slot_printf(slot, "%uMHz%s %s VDD:%s%s%s VCCQ: 3.3V%s%s DRV: B%s%s%s %s %s\n", @@ -1109,9 +1161,8 @@ sdhci_cleanup_slot(struct sdhci_slot *slot) SDHCI_LOCK(slot); sdhci_reset(slot, SDHCI_RESET_ALL); SDHCI_UNLOCK(slot); - bus_dmamap_unload(slot->dmatag, slot->dmamap); - bus_dmamem_free(slot->dmatag, slot->dmamem, slot->dmamap); - bus_dma_tag_destroy(slot->dmatag); + if (slot->opt & SDHCI_HAVE_DMA) + sdhci_dma_free(slot); if (slot->opt & SDHCI_TUNING_SUPPORTED) { free(slot->tune_req, M_DEVBUF); free(slot->tune_cmd, M_DEVBUF); @@ -1175,7 +1226,7 @@ sdhci_generic_get_card_present(device_t brdev __unused void sdhci_generic_set_uhs_timing(device_t brdev __unused, struct sdhci_slot *slot) { - struct mmc_ios *ios; + const struct mmc_ios *ios; uint16_t hostctrl2; if (slot->version < SDHCI_SPEC_300) @@ -1308,7 +1359,7 @@ int sdhci_generic_tune(device_t brdev __unused, device_t reqdev, bool hs400) { struct sdhci_slot *slot = device_get_ivars(reqdev); - struct mmc_ios *ios = &slot->host.ios; + const struct mmc_ios *ios = &slot->host.ios; struct mmc_command *tune_cmd; struct mmc_data *tune_data; uint32_t opcode; @@ -1564,7 +1615,7 @@ sdhci_timeout(void *arg) } static void -sdhci_set_transfer_mode(struct sdhci_slot *slot, struct mmc_data *data) +sdhci_set_transfer_mode(struct sdhci_slot *slot, const struct mmc_data *data) { uint16_t mode; @@ -1766,9 +1817,9 @@ sdhci_finish_command(struct sdhci_slot *slot) } static void -sdhci_start_data(struct sdhci_slot *slot, struct mmc_data *data) +sdhci_start_data(struct sdhci_slot *slot, const struct mmc_data *data) { - uint32_t target_timeout, current_timeout; + uint32_t blkcnt, blksz, current_timeout, sdma_bbufsz, target_timeout; uint8_t div; if (data == NULL && (slot->curcmd->flags & MMC_RSP_BUSY) == 0) { @@ -1804,7 +1855,7 @@ sdhci_start_data(struct sdhci_slot *slot, struct mmc_d /* Use DMA if possible. */ if ((slot->opt & SDHCI_HAVE_DMA)) slot->flags |= SDHCI_USE_DMA; - /* If data is small, broken DMA may return zeroes instead of data, */ + /* If data is small, broken DMA may return zeroes instead of data. */ if ((slot->quirks & SDHCI_QUIRK_BROKEN_TIMINGS) && (data->len <= 512)) slot->flags &= ~SDHCI_USE_DMA; @@ -1814,20 +1865,22 @@ sdhci_start_data(struct sdhci_slot *slot, struct mmc_d slot->flags &= ~SDHCI_USE_DMA; /* Load DMA buffer. */ if (slot->flags & SDHCI_USE_DMA) { + sdma_bbufsz = slot->sdma_bbufsz; if (data->flags & MMC_DATA_READ) bus_dmamap_sync(slot->dmatag, slot->dmamap, BUS_DMASYNC_PREREAD); else { - memcpy(slot->dmamem, data->data, - (data->len < DMA_BLOCK_SIZE) ? - data->len : DMA_BLOCK_SIZE); + memcpy(slot->dmamem, data->data, ulmin(data->len, + sdma_bbufsz)); bus_dmamap_sync(slot->dmatag, slot->dmamap, BUS_DMASYNC_PREWRITE); } WR4(slot, SDHCI_DMA_ADDRESS, slot->paddr); - /* Interrupt aggregation: Mask border interrupt - * for the last page and unmask else. */ - if (data->len == DMA_BLOCK_SIZE) + /* + * Interrupt aggregation: Mask border interrupt for the last + * bounce buffer and unmask otherwise. + */ + if (data->len == sdma_bbufsz) slot->intmask &= ~SDHCI_INT_DMA_END; else slot->intmask |= SDHCI_INT_DMA_END; @@ -1835,16 +1888,15 @@ sdhci_start_data(struct sdhci_slot *slot, struct mmc_d } /* Current data offset for both PIO and DMA. */ slot->offset = 0; - /* Set block size and request IRQ on 4K border. */ - WR2(slot, SDHCI_BLOCK_SIZE, SDHCI_MAKE_BLKSZ(DMA_BOUNDARY, - (data->len < 512) ? data->len : 512)); + /* Set block size and request border interrupts on the SDMA boundary. */ + blksz = SDHCI_MAKE_BLKSZ(slot->sdma_boundary, ulmin(data->len, 512)); + WR2(slot, SDHCI_BLOCK_SIZE, blksz); /* Set block count. */ - WR2(slot, SDHCI_BLOCK_COUNT, (data->len + 511) / 512); - + blkcnt = howmany(data->len, 512); + WR2(slot, SDHCI_BLOCK_COUNT, blkcnt); if (__predict_false(sdhci_debug > 1)) - slot_printf(slot, "Block size: %02x, count %lu\n", - (unsigned int)SDHCI_MAKE_BLKSZ(DMA_BOUNDARY, (data->len < 512) ? data->len : 512), - (unsigned long)(data->len + 511) / 512); + slot_printf(slot, "Blk size: 0x%08x | Blk cnt: 0x%08x\n", + blksz, blkcnt); } void @@ -1868,7 +1920,7 @@ sdhci_finish_data(struct sdhci_slot *slot) bus_dmamap_sync(slot->dmatag, slot->dmamap, BUS_DMASYNC_POSTREAD); memcpy((u_char*)data->data + slot->offset, slot->dmamem, - (left < DMA_BLOCK_SIZE) ? left : DMA_BLOCK_SIZE); + ulmin(left, slot->sdma_bbufsz)); } else bus_dmamap_sync(slot->dmatag, slot->dmamap, BUS_DMASYNC_POSTWRITE); @@ -1892,15 +1944,14 @@ sdhci_finish_data(struct sdhci_slot *slot) static void sdhci_start(struct sdhci_slot *slot) { - union ccb *ccb; + union ccb *ccb; + struct ccb_mmcio *mmcio; ccb = slot->ccb; if (ccb == NULL) return; - struct ccb_mmcio *mmcio; mmcio = &ccb->mmcio; - if (!(slot->flags & CMD_STARTED)) { slot->flags |= CMD_STARTED; sdhci_start_command(slot, &mmcio->cmd); @@ -1932,7 +1983,7 @@ sdhci_start(struct sdhci_slot *slot) static void sdhci_start(struct sdhci_slot *slot) { - struct mmc_request *req; + const struct mmc_request *req; req = slot->req; if (req == NULL) @@ -2061,6 +2112,7 @@ sdhci_data_irq(struct sdhci_slot *slot, uint32_t intma { struct mmc_data *data; size_t left; + uint32_t sdma_bbufsz; if (!slot->curcmd) { slot_printf(slot, "Got data interrupt 0x%08x, but " @@ -2115,6 +2167,7 @@ sdhci_data_irq(struct sdhci_slot *slot, uint32_t intma /* Handle DMA border. */ if (intmask & SDHCI_INT_DMA_END) { data = slot->curcmd->data; + sdma_bbufsz = slot->sdma_bbufsz; /* Unload DMA buffer ... */ left = data->len - slot->offset; @@ -2122,26 +2175,28 @@ sdhci_data_irq(struct sdhci_slot *slot, uint32_t intma bus_dmamap_sync(slot->dmatag, slot->dmamap, BUS_DMASYNC_POSTREAD); memcpy((u_char*)data->data + slot->offset, slot->dmamem, - (left < DMA_BLOCK_SIZE) ? left : DMA_BLOCK_SIZE); + ulmin(left, sdma_bbufsz)); } else { bus_dmamap_sync(slot->dmatag, slot->dmamap, BUS_DMASYNC_POSTWRITE); } /* ... and reload it again. */ - slot->offset += DMA_BLOCK_SIZE; + slot->offset += sdma_bbufsz; left = data->len - slot->offset; if (data->flags & MMC_DATA_READ) { bus_dmamap_sync(slot->dmatag, slot->dmamap, BUS_DMASYNC_PREREAD); } else { memcpy(slot->dmamem, (u_char*)data->data + slot->offset, - (left < DMA_BLOCK_SIZE)? left : DMA_BLOCK_SIZE); + ulmin(left, sdma_bbufsz)); bus_dmamap_sync(slot->dmatag, slot->dmamap, BUS_DMASYNC_PREWRITE); } - /* Interrupt aggregation: Mask border interrupt - * for the last page. */ - if (left == DMA_BLOCK_SIZE) { + /* + * Interrupt aggregation: Mask border interrupt for the last + * bounce buffer. + */ + if (left == sdma_bbufsz) { slot->intmask &= ~SDHCI_INT_DMA_END; WR4(slot, SDHCI_SIGNAL_ENABLE, slot->intmask); } @@ -2264,7 +2319,7 @@ int sdhci_generic_read_ivar(device_t bus, device_t child, int which, uintptr_t *result) { - struct sdhci_slot *slot = device_get_ivars(child); + const struct sdhci_slot *slot = device_get_ivars(child); switch (which) { default: @@ -2427,6 +2482,7 @@ sdhci_generic_write_ivar(device_t bus, device_t child, void sdhci_start_slot(struct sdhci_slot *slot) { + if ((slot->devq = cam_simq_alloc(1)) == NULL) { goto fail; } @@ -2586,7 +2642,8 @@ sdhci_cam_poll(struct cam_sim *sim) } static int -sdhci_cam_get_possible_host_clock(struct sdhci_slot *slot, int proposed_clock) +sdhci_cam_get_possible_host_clock(const struct sdhci_slot *slot, + int proposed_clock) { int max_clock, clock, i; @@ -2613,15 +2670,14 @@ sdhci_cam_get_possible_host_clock(struct sdhci_slot *s return clock; } -int +static int sdhci_cam_settran_settings(struct sdhci_slot *slot, union ccb *ccb) { struct mmc_ios *ios; - struct mmc_ios *new_ios; - struct ccb_trans_settings_mmc *cts; + const struct mmc_ios *new_ios; + const struct ccb_trans_settings_mmc *cts; ios = &slot->host.ios; - cts = &ccb->cts.proto_specific.mmc; new_ios = &cts->ios; @@ -2659,7 +2715,7 @@ sdhci_cam_settran_settings(struct sdhci_slot *slot, un return (sdhci_cam_update_ios(slot)); } -int +static int sdhci_cam_update_ios(struct sdhci_slot *slot) { struct mmc_ios *ios = &slot->host.ios; @@ -2701,10 +2757,10 @@ sdhci_cam_update_ios(struct sdhci_slot *slot) return (0); } -int +static int sdhci_cam_request(struct sdhci_slot *slot, union ccb *ccb) { - struct ccb_mmcio *mmcio; + const struct ccb_mmcio *mmcio; mmcio = &ccb->mmcio; @@ -2739,4 +2795,4 @@ sdhci_cam_request(struct sdhci_slot *slot, union ccb * } #endif /* MMCCAM */ -MODULE_VERSION(sdhci, 1); +MODULE_VERSION(sdhci, SDHCI_VERSION); Modified: stable/12/sys/dev/sdhci/sdhci.h ============================================================================== --- stable/12/sys/dev/sdhci/sdhci.h Sun Jan 27 18:53:36 2019 (r343502) +++ stable/12/sys/dev/sdhci/sdhci.h Sun Jan 27 19:04:02 2019 (r343503) @@ -32,8 +32,8 @@ #include "opt_mmccam.h" -#define DMA_BLOCK_SIZE 4096 -#define DMA_BOUNDARY 0 /* DMA reload every 4K */ +/* Macro for sizing the SDMA bounce buffer on the SDMA buffer boundary. */ +#define SDHCI_SDMA_BNDRY_TO_BBUFSZ(bndry) (4096 * (1 << bndry)) /* Controller doesn't honor resets unless we touch the clock register */ #define SDHCI_QUIRK_CLOCK_BEFORE_RESET (1 << 0) @@ -95,6 +95,8 @@ #define SDHCI_QUIRK_BROKEN_AUTO_STOP (1 << 28) /* Controller supports eMMC HS400 mode if SDHCI_CAN_SDR104 is set. */ #define SDHCI_QUIRK_MMC_HS400_IF_CAN_SDR104 (1 << 29) +/* SDMA boundary in SDHCI_BLOCK_SIZE broken - use front-end supplied value. */ +#define SDHCI_QUIRK_BROKEN_SDMA_BOUNDARY (1 << 30) /* * Controller registers @@ -102,6 +104,14 @@ #define SDHCI_DMA_ADDRESS 0x00 #define SDHCI_BLOCK_SIZE 0x04 +#define SDHCI_BLKSZ_SDMA_BNDRY_4K 0x00 +#define SDHCI_BLKSZ_SDMA_BNDRY_8K 0x01 +#define SDHCI_BLKSZ_SDMA_BNDRY_16K 0x02 +#define SDHCI_BLKSZ_SDMA_BNDRY_32K 0x03 +#define SDHCI_BLKSZ_SDMA_BNDRY_64K 0x04 +#define SDHCI_BLKSZ_SDMA_BNDRY_128K 0x05 +#define SDHCI_BLKSZ_SDMA_BNDRY_256K 0x06 +#define SDHCI_BLKSZ_SDMA_BNDRY_512K 0x07 #define SDHCI_MAKE_BLKSZ(dma, blksz) (((dma & 0x7) << 12) | (blksz & 0xFFF)) #define SDHCI_BLOCK_COUNT 0x06 @@ -362,6 +372,8 @@ struct sdhci_slot { bus_dmamap_t dmamap; u_char *dmamem; bus_addr_t paddr; /* DMA buffer address */ + uint32_t sdma_bbufsz; /* SDMA bounce buffer size */ + uint8_t sdma_boundary; /* SDMA boundary */ struct task card_task; /* Card presence check task */ struct timeout_task card_delayed_task;/* Card insert delayed task */ @@ -433,5 +445,10 @@ uint32_t sdhci_generic_min_freq(device_t brdev, struct bool sdhci_generic_get_card_present(device_t brdev, struct sdhci_slot *slot); void sdhci_generic_set_uhs_timing(device_t brdev, struct sdhci_slot *slot); void sdhci_handle_card_present(struct sdhci_slot *slot, bool is_present); + +#define SDHCI_VERSION 2 + +#define SDHCI_DEPEND(name) \ + MODULE_DEPEND(name, sdhci, SDHCI_VERSION, SDHCI_VERSION, SDHCI_VERSION); #endif /* __SDHCI_H__ */ Modified: stable/12/sys/dev/sdhci/sdhci_acpi.c ============================================================================== --- stable/12/sys/dev/sdhci/sdhci_acpi.c Sun Jan 27 18:53:36 2019 (r343502) +++ stable/12/sys/dev/sdhci/sdhci_acpi.c Sun Jan 27 19:04:02 2019 (r343503) @@ -456,7 +456,7 @@ static devclass_t sdhci_acpi_devclass; DRIVER_MODULE(sdhci_acpi, acpi, sdhci_acpi_driver, sdhci_acpi_devclass, NULL, NULL); -MODULE_DEPEND(sdhci_acpi, sdhci, 1, 1, 1); +SDHCI_DEPEND(sdhci_acpi); #ifndef MMCCAM MMC_DECLARE_BRIDGE(sdhci_acpi); Modified: stable/12/sys/dev/sdhci/sdhci_fdt.c ============================================================================== --- stable/12/sys/dev/sdhci/sdhci_fdt.c Sun Jan 27 18:53:36 2019 (r343502) +++ stable/12/sys/dev/sdhci/sdhci_fdt.c Sun Jan 27 19:04:02 2019 (r343503) @@ -80,6 +80,7 @@ struct sdhci_fdt_softc { u_int quirks; /* Chip specific quirks */ u_int caps; /* If we override SDHCI_CAPABILITIES */ uint32_t max_clk; /* Max possible freq */ + uint8_t sdma_boundary; /* If we override the SDMA boundary */ struct resource *irq_res; /* IRQ resource */ void *intrhand; /* Interrupt handle */ @@ -206,7 +207,9 @@ sdhci_fdt_probe(device_t dev) device_set_desc(dev, "generic fdt SDHCI controller"); break; case SDHCI_FDT_QUALCOMM: - sc->quirks = SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE; + sc->quirks = SDHCI_QUIRK_ALL_SLOTS_NON_REMOVABLE | + SDHCI_QUIRK_BROKEN_SDMA_BOUNDARY; + sc->sdma_boundary = SDHCI_BLKSZ_SDMA_BNDRY_4K; device_set_desc(dev, "Qualcomm FDT SDHCI controller"); break; case SDHCI_FDT_XLNX_ZY7: @@ -271,6 +274,7 @@ sdhci_fdt_attach(device_t dev) slot->quirks = sc->quirks; slot->caps = sc->caps; slot->max_clk = sc->max_clk; + slot->sdma_boundary = sc->sdma_boundary; if (sdhci_init_slot(dev, slot, i) != 0) continue; @@ -353,7 +357,7 @@ static devclass_t sdhci_fdt_devclass; DRIVER_MODULE(sdhci_fdt, simplebus, sdhci_fdt_driver, sdhci_fdt_devclass, NULL, NULL); -MODULE_DEPEND(sdhci_fdt, sdhci, 1, 1, 1); +SDHCI_DEPEND(sdhci_fdt); #ifndef MMCCAM MMC_DECLARE_BRIDGE(sdhci_fdt); #endif Modified: stable/12/sys/dev/sdhci/sdhci_pci.c ============================================================================== --- stable/12/sys/dev/sdhci/sdhci_pci.c Sun Jan 27 18:53:36 2019 (r343502) +++ stable/12/sys/dev/sdhci/sdhci_pci.c Sun Jan 27 19:04:02 2019 (r343503) @@ -526,7 +526,7 @@ static devclass_t sdhci_pci_devclass; DRIVER_MODULE(sdhci_pci, pci, sdhci_pci_driver, sdhci_pci_devclass, NULL, NULL); -MODULE_DEPEND(sdhci_pci, sdhci, 1, 1, 1); +SDHCI_DEPEND(sdhci_pci); #ifndef MMCCAM MMC_DECLARE_BRIDGE(sdhci_pci); Modified: stable/12/sys/dev/sdhci/sdhci_xenon.c ============================================================================== --- stable/12/sys/dev/sdhci/sdhci_xenon.c Sun Jan 27 18:53:36 2019 (r343502) +++ stable/12/sys/dev/sdhci/sdhci_xenon.c Sun Jan 27 19:04:02 2019 (r343503) @@ -545,7 +545,7 @@ static devclass_t sdhci_xenon_devclass; DRIVER_MODULE(sdhci_xenon, simplebus, sdhci_xenon_driver, sdhci_xenon_devclass, NULL, NULL); -MODULE_DEPEND(sdhci_xenon, sdhci, 1, 1, 1); +SDHCI_DEPEND(sdhci_xenon); #ifndef MMCCAM MMC_DECLARE_BRIDGE(sdhci_xenon); #endif From owner-svn-src-stable-12@freebsd.org Mon Jan 28 00:51:28 2019 Return-Path: Delivered-To: svn-src-stable-12@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 E585214C3315; Mon, 28 Jan 2019 00:51:27 +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 8A52B8DC21; Mon, 28 Jan 2019 00:51:27 +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 7B42418126; Mon, 28 Jan 2019 00:51:27 +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 x0S0pRkB074066; Mon, 28 Jan 2019 00:51:27 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0S0pRS9074065; Mon, 28 Jan 2019 00:51:27 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201901280051.x0S0pRS9074065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Mon, 28 Jan 2019 00:51:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343506 - in stable: 10/sbin/ifconfig 11/sbin/ifconfig 12/sbin/ifconfig X-SVN-Group: stable-12 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: in stable: 10/sbin/ifconfig 11/sbin/ifconfig 12/sbin/ifconfig X-SVN-Commit-Revision: 343506 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8A52B8DC21 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)[-0.999,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2019 00:51:28 -0000 Author: avos Date: Mon Jan 28 00:51:26 2019 New Revision: 343506 URL: https://svnweb.freebsd.org/changeset/base/343506 Log: MFC r343341: ifconfig: drop unused macros from ifieee80211.c Modified: stable/12/sbin/ifconfig/ifieee80211.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sbin/ifconfig/ifieee80211.c stable/11/sbin/ifconfig/ifieee80211.c Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/12/sbin/ifconfig/ifieee80211.c ============================================================================== --- stable/12/sbin/ifconfig/ifieee80211.c Sun Jan 27 19:05:18 2019 (r343505) +++ stable/12/sbin/ifconfig/ifieee80211.c Mon Jan 28 00:51:26 2019 (r343506) @@ -1527,9 +1527,6 @@ getmodeflags(const char *val) return flags; } -#define IEEE80211_CHAN_HTA (IEEE80211_CHAN_HT|IEEE80211_CHAN_5GHZ) -#define IEEE80211_CHAN_HTG (IEEE80211_CHAN_HT|IEEE80211_CHAN_2GHZ) - #define _APPLY(_flags, _base, _param, _v) do { \ if (_flags & IEEE80211_CHAN_HT) { \ if ((_flags & (IEEE80211_CHAN_5GHZ|IEEE80211_CHAN_2GHZ)) == 0) {\ @@ -1719,8 +1716,6 @@ DECL_CMD_FUNC(set80211maxretry, val, d) } #undef _APPLY_RATE #undef _APPLY -#undef IEEE80211_CHAN_HTA -#undef IEEE80211_CHAN_HTG static DECL_CMD_FUNC(set80211fragthreshold, val, d) From owner-svn-src-stable-12@freebsd.org Mon Jan 28 00:58:02 2019 Return-Path: Delivered-To: svn-src-stable-12@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 5B44414C37B1; Mon, 28 Jan 2019 00:58:02 +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 F14B38E2E5; Mon, 28 Jan 2019 00:58:01 +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 CD47B1817D; Mon, 28 Jan 2019 00:58:01 +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 x0S0w19k075224; Mon, 28 Jan 2019 00:58:01 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0S0w1Sq075223; Mon, 28 Jan 2019 00:58:01 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201901280058.x0S0w1Sq075223@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Mon, 28 Jan 2019 00:58:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343507 - in stable: 11/sys/dev/iwn 12/sys/dev/iwn X-SVN-Group: stable-12 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: in stable: 11/sys/dev/iwn 12/sys/dev/iwn X-SVN-Commit-Revision: 343507 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F14B38E2E5 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.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2019 00:58:02 -0000 Author: avos Date: Mon Jan 28 00:58:01 2019 New Revision: 343507 URL: https://svnweb.freebsd.org/changeset/base/343507 Log: MFC r343235: iwn(4): drop return code from iwn_*attach functions (they cannot fail) While here, add missing trace 'end' marker in iwn5000_attach(). Modified: stable/12/sys/dev/iwn/if_iwn.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/dev/iwn/if_iwn.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/dev/iwn/if_iwn.c ============================================================================== --- stable/12/sys/dev/iwn/if_iwn.c Mon Jan 28 00:51:26 2019 (r343506) +++ stable/12/sys/dev/iwn/if_iwn.c Mon Jan 28 00:58:01 2019 (r343507) @@ -131,8 +131,8 @@ static const struct iwn_ident iwn_ident_table[] = { static int iwn_probe(device_t); static int iwn_attach(device_t); -static int iwn4965_attach(struct iwn_softc *, uint16_t); -static int iwn5000_attach(struct iwn_softc *, uint16_t); +static void iwn4965_attach(struct iwn_softc *, uint16_t); +static void iwn5000_attach(struct iwn_softc *, uint16_t); static int iwn_config_specific(struct iwn_softc *, uint16_t); static void iwn_radiotap_attach(struct iwn_softc *); static void iwn_sysctlattach(struct iwn_softc *); @@ -489,14 +489,9 @@ iwn_attach(device_t dev) * Let's set those up first. */ if (sc->hw_type == IWN_HW_REV_TYPE_4965) - error = iwn4965_attach(sc, pci_get_device(dev)); + iwn4965_attach(sc, pci_get_device(dev)); else - error = iwn5000_attach(sc, pci_get_device(dev)); - if (error != 0) { - device_printf(dev, "could not attach device, error %d\n", - error); - goto fail; - } + iwn5000_attach(sc, pci_get_device(dev)); /* * Next, let's setup the various parameters of each NIC. @@ -1218,12 +1213,13 @@ iwn_config_specific(struct iwn_softc *sc, uint16_t pid return 0; } -static int +static void iwn4965_attach(struct iwn_softc *sc, uint16_t pid) { struct iwn_ops *ops = &sc->ops; DPRINTF(sc, IWN_DEBUG_TRACE, "->%s begin\n", __func__); + ops->load_firmware = iwn4965_load_firmware; ops->read_eeprom = iwn4965_read_eeprom; ops->post_alive = iwn4965_post_alive; @@ -1258,11 +1254,9 @@ iwn4965_attach(struct iwn_softc *sc, uint16_t pid) sc->sc_flags |= IWN_FLAG_BTCOEX; DPRINTF(sc, IWN_DEBUG_TRACE, "%s: end\n",__func__); - - return 0; } -static int +static void iwn5000_attach(struct iwn_softc *sc, uint16_t pid) { struct iwn_ops *ops = &sc->ops; @@ -1297,7 +1291,7 @@ iwn5000_attach(struct iwn_softc *sc, uint16_t pid) sc->reset_noise_gain = IWN5000_PHY_CALIB_RESET_NOISE_GAIN; sc->noise_gain = IWN5000_PHY_CALIB_NOISE_GAIN; - return 0; + DPRINTF(sc, IWN_DEBUG_TRACE, "%s: end\n",__func__); } /* From owner-svn-src-stable-12@freebsd.org Mon Jan 28 01:09:24 2019 Return-Path: Delivered-To: svn-src-stable-12@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 6A79014C3BFB; Mon, 28 Jan 2019 01:09:24 +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 0C6B08E95D; Mon, 28 Jan 2019 01:09:24 +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 EF59318336; Mon, 28 Jan 2019 01:09: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 x0S19NBq080282; Mon, 28 Jan 2019 01:09:23 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0S19NXR080281; Mon, 28 Jan 2019 01:09:23 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201901280109.x0S19NXR080281@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Mon, 28 Jan 2019 01:09:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343508 - stable/12/sys/net80211 X-SVN-Group: stable-12 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: stable/12/sys/net80211 X-SVN-Commit-Revision: 343508 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0C6B08E95D 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)[-0.999,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-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2019 01:09:24 -0000 Author: avos Date: Mon Jan 28 01:09:23 2019 New Revision: 343508 URL: https://svnweb.freebsd.org/changeset/base/343508 Log: MFC r343340: net80211: fix channel list construction for non-auto operating mode. Change the way how channel list mode <-> desired mode match is done: - Match channel list mode for next non-auto desired modes: * 11b: 11g, 11ng, 11acg; * 11a: 11na, 11ac - Add pre-defined channels only when one of the next conditions met: * the desired channel mode is 'auto' or * the desired channel and selected channel list modes are exactly the same or * the previous rule (11g / 11n / 11ac promotion) applies. Before r275875 construction work properly for all except 11ng / 11na / 11acg / 11ac modes - these were broken at all (i.e., the scan list was empty); after r275875 all checks were removed, so scan table was populated by all device-compatible channels (desired mode was ignored). For example, if I will set 'ifconfig wlan0 mode 11ng' for RTL8821AU: - pre-r275875: nothing, scan will not work; - after r275875: both 11ng and 11na bands were scanned; also, since 11b channel list was used, 14th channel was scanned too. - after this change: only 11ng - 1-13 channels - are used for scanning. Modified: stable/12/sys/net80211/ieee80211_scan_sta.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net80211/ieee80211_scan_sta.c ============================================================================== --- stable/12/sys/net80211/ieee80211_scan_sta.c Mon Jan 28 00:58:01 2019 (r343507) +++ stable/12/sys/net80211/ieee80211_scan_sta.c Mon Jan 28 01:09:23 2019 (r343508) @@ -472,6 +472,8 @@ static const u_int chanflags[IEEE80211_MODE_MAX] = { /* check legacy */ [IEEE80211_MODE_11NA] = IEEE80211_CHAN_A, [IEEE80211_MODE_11NG] = IEEE80211_CHAN_G, + [IEEE80211_MODE_VHT_5GHZ] = IEEE80211_CHAN_A, + [IEEE80211_MODE_VHT_2GHZ] = IEEE80211_CHAN_G, }; static void @@ -618,32 +620,48 @@ makescanlist(struct ieee80211_scan_state *ss, struct i */ for (scan = table; scan->list != NULL; scan++) { mode = scan->mode; - if (vap->iv_des_mode != IEEE80211_MODE_AUTO) { + + switch (mode) { + case IEEE80211_MODE_11B: + if (vap->iv_des_mode == IEEE80211_MODE_11B) + break; + /* - * If a desired mode was specified, scan only - * channels that satisfy that constraint. + * The scan table marks 2.4Ghz channels as b + * so if the desired mode is 11g / 11ng / 11acg, + * then use the 11b channel list but upgrade the mode. + * + * NB: 11b -> AUTO lets add_channels upgrade an + * 11b channel to 11g if available. */ - if (vap->iv_des_mode != mode) { - /* - * The scan table marks 2.4Ghz channels as b - * so if the desired mode is 11g, then use - * the 11b channel list but upgrade the mode. - */ - if (vap->iv_des_mode == IEEE80211_MODE_11G) { - if (mode == IEEE80211_MODE_11G) /* Skip the G check */ - continue; - else if (mode == IEEE80211_MODE_11B) - mode = IEEE80211_MODE_11G; /* upgrade */ - } + if (vap->iv_des_mode == IEEE80211_MODE_AUTO || + vap->iv_des_mode == IEEE80211_MODE_11G || + vap->iv_des_mode == IEEE80211_MODE_11NG || + vap->iv_des_mode == IEEE80211_MODE_VHT_2GHZ) { + mode = vap->iv_des_mode; + break; } - } else { + + continue; + case IEEE80211_MODE_11A: + /* Use 11a channel list for 11na / 11ac modes */ + if (vap->iv_des_mode == IEEE80211_MODE_11NA || + vap->iv_des_mode == IEEE80211_MODE_VHT_5GHZ) { + mode = vap->iv_des_mode; + break; + } + + /* FALLTHROUGH */ + default: /* - * This lets add_channels upgrade an 11b channel - * to 11g if available. + * If a desired mode was specified, scan only + * channels that satisfy that constraint. */ - if (mode == IEEE80211_MODE_11B) - mode = IEEE80211_MODE_AUTO; + if (vap->iv_des_mode != IEEE80211_MODE_AUTO && + vap->iv_des_mode != mode) + continue; } + #ifdef IEEE80211_F_XR /* XR does not operate on turbo channels */ if ((vap->iv_flags & IEEE80211_F_XR) && From owner-svn-src-stable-12@freebsd.org Mon Jan 28 01:19:45 2019 Return-Path: Delivered-To: svn-src-stable-12@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 2A22C14C437F; Mon, 28 Jan 2019 01:19:45 +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 C37348F162; Mon, 28 Jan 2019 01:19:44 +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 B92BE184EA; Mon, 28 Jan 2019 01:19:44 +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 x0S1JiL0085711; Mon, 28 Jan 2019 01:19:44 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0S1Ji3S085710; Mon, 28 Jan 2019 01:19:44 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201901280119.x0S1Ji3S085710@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Mon, 28 Jan 2019 01:19:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343510 - in stable: 11/sys/net80211 12/sys/net80211 X-SVN-Group: stable-12 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: in stable: 11/sys/net80211 12/sys/net80211 X-SVN-Commit-Revision: 343510 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: C37348F162 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)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2019 01:19:45 -0000 Author: avos Date: Mon Jan 28 01:19:43 2019 New Revision: 343510 URL: https://svnweb.freebsd.org/changeset/base/343510 Log: MFC r343342: net80211: turn channel mode check into assertion. There is may be only 11b channel (since chanflags[] table maps MODE_AUTO to the corresponding 11b channel flags). Modified: stable/12/sys/net80211/ieee80211_scan_sta.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/net80211/ieee80211_scan_sta.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/net80211/ieee80211_scan_sta.c ============================================================================== --- stable/12/sys/net80211/ieee80211_scan_sta.c Mon Jan 28 01:12:20 2019 (r343509) +++ stable/12/sys/net80211/ieee80211_scan_sta.c Mon Jan 28 01:19:43 2019 (r343510) @@ -496,12 +496,15 @@ add_channels(struct ieee80211vap *vap, if (c == NULL || isexcluded(vap, c)) continue; if (mode == IEEE80211_MODE_AUTO) { + KASSERT(IEEE80211_IS_CHAN_B(c), + ("%s: wrong channel for 'auto' mode %u / %u\n", + __func__, c->ic_freq, c->ic_flags)); + /* * XXX special-case 11b/g channels so we select * the g channel if both are present. */ - if (IEEE80211_IS_CHAN_B(c) && - (cg = find11gchannel(ic, i, c->ic_freq)) != NULL) + if ((cg = find11gchannel(ic, i, c->ic_freq)) != NULL) c = cg; } ss->ss_chans[ss->ss_last++] = c; From owner-svn-src-stable-12@freebsd.org Mon Jan 28 01:28:18 2019 Return-Path: Delivered-To: svn-src-stable-12@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 C843414C4744; Mon, 28 Jan 2019 01:28:18 +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 5EFE48F799; Mon, 28 Jan 2019 01:28:18 +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 4733D186A6; Mon, 28 Jan 2019 01:28:18 +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 x0S1SI9r091078; Mon, 28 Jan 2019 01:28:18 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0S1SIhu091077; Mon, 28 Jan 2019 01:28:18 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201901280128.x0S1SIhu091077@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Mon, 28 Jan 2019 01:28:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343511 - stable/12/sys/dev/usb/wlan X-SVN-Group: stable-12 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: stable/12/sys/dev/usb/wlan X-SVN-Commit-Revision: 343511 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5EFE48F799 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)[-0.999,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-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2019 01:28:19 -0000 Author: avos Date: Mon Jan 28 01:28:17 2019 New Revision: 343511 URL: https://svnweb.freebsd.org/changeset/base/343511 Log: MFC r343234: run(4): add more length checks in Rx path. - Discard frames that are bigger than MCLBYTES (to prevent buffer overrun). - Check buffer length before accessing its contents. - Fix len <-> dmalen check - the last includes Rx Wireless information structure size. - Fix out-of-bounds read during Rx node search for ACK / CTS frames (monitor mode only). While here: - Mark few suspicious places with comments. - Move common cleanup to the function end. Modified: stable/12/sys/dev/usb/wlan/if_run.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/usb/wlan/if_run.c ============================================================================== --- stable/12/sys/dev/usb/wlan/if_run.c Mon Jan 28 01:19:43 2019 (r343510) +++ stable/12/sys/dev/usb/wlan/if_run.c Mon Jan 28 01:28:17 2019 (r343511) @@ -2824,69 +2824,80 @@ run_rx_frame(struct run_softc *sc, struct mbuf *m, uin uint8_t ant, rssi; int8_t nf; - rxwi = mtod(m, struct rt2860_rxwi *); - len = le16toh(rxwi->len) & 0xfff; rxwisize = sizeof(struct rt2860_rxwi); if (sc->mac_ver == 0x5592) rxwisize += sizeof(uint64_t); else if (sc->mac_ver == 0x3593) rxwisize += sizeof(uint32_t); - if (__predict_false(len > dmalen)) { - m_freem(m); - counter_u64_add(ic->ic_ierrors, 1); + + if (__predict_false(dmalen < + rxwisize + sizeof(struct ieee80211_frame_ack))) { RUN_DPRINTF(sc, RUN_DEBUG_RECV, + "payload is too short: dma length %u < %zu\n", + dmalen, rxwisize + sizeof(struct ieee80211_frame_ack)); + goto fail; + } + + rxwi = mtod(m, struct rt2860_rxwi *); + len = le16toh(rxwi->len) & 0xfff; + + if (__predict_false(len > dmalen - rxwisize)) { + RUN_DPRINTF(sc, RUN_DEBUG_RECV, "bad RXWI length %u > %u\n", len, dmalen); - return; + goto fail; } + /* Rx descriptor is located at the end */ rxd = (struct rt2870_rxd *)(mtod(m, caddr_t) + dmalen); flags = le32toh(rxd->flags); if (__predict_false(flags & (RT2860_RX_CRCERR | RT2860_RX_ICVERR))) { - m_freem(m); - counter_u64_add(ic->ic_ierrors, 1); RUN_DPRINTF(sc, RUN_DEBUG_RECV, "%s error.\n", (flags & RT2860_RX_CRCERR)?"CRC":"ICV"); - return; + goto fail; } + if (flags & RT2860_RX_L2PAD) { + /* + * XXX OpenBSD removes padding between header + * and payload here... + */ + RUN_DPRINTF(sc, RUN_DEBUG_RECV, + "received RT2860_RX_L2PAD frame\n"); + len += 2; + } + m->m_data += rxwisize; - m->m_pkthdr.len = m->m_len -= rxwisize; + m->m_pkthdr.len = m->m_len = len; wh = mtod(m, struct ieee80211_frame *); + /* XXX wrong for monitor mode */ if (wh->i_fc[1] & IEEE80211_FC1_PROTECTED) { wh->i_fc[1] &= ~IEEE80211_FC1_PROTECTED; m->m_flags |= M_WEP; } - if (flags & RT2860_RX_L2PAD) { - RUN_DPRINTF(sc, RUN_DEBUG_RECV, - "received RT2860_RX_L2PAD frame\n"); - len += 2; - } + if (len >= sizeof(struct ieee80211_frame_min)) { + ni = ieee80211_find_rxnode(ic, + mtod(m, struct ieee80211_frame_min *)); + } else + ni = NULL; - ni = ieee80211_find_rxnode(ic, - mtod(m, struct ieee80211_frame_min *)); - if (__predict_false(flags & RT2860_RX_MICERR)) { /* report MIC failures to net80211 for TKIP */ if (ni != NULL) ieee80211_notify_michael_failure(ni->ni_vap, wh, rxwi->keyidx); - m_freem(m); - counter_u64_add(ic->ic_ierrors, 1); RUN_DPRINTF(sc, RUN_DEBUG_RECV, "MIC error. Someone is lying.\n"); - return; + goto fail; } ant = run_maxrssi_chain(sc, rxwi); rssi = rxwi->rssi[ant]; nf = run_rssi2dbm(sc, rssi, ant); - m->m_pkthdr.len = m->m_len = len; - if (__predict_false(ieee80211_radiotap_active(ic))) { struct run_rx_radiotap_header *tap = &sc->sc_rxtap; uint16_t phy; @@ -2934,6 +2945,12 @@ run_rx_frame(struct run_softc *sc, struct mbuf *m, uin } else { (void)ieee80211_input_all(ic, m, rssi, nf); } + + return; + +fail: + m_freem(m); + counter_u64_add(ic->ic_ierrors, 1); } static void @@ -2943,7 +2960,7 @@ run_bulk_rx_callback(struct usb_xfer *xfer, usb_error_ struct ieee80211com *ic = &sc->sc_ic; struct mbuf *m = NULL; struct mbuf *m0; - uint32_t dmalen; + uint32_t dmalen, mbuf_len; uint16_t rxwisize; int xferlen; @@ -3049,6 +3066,14 @@ tr_setup: break; } + mbuf_len = dmalen + sizeof(struct rt2870_rxd); + if (__predict_false(mbuf_len > MCLBYTES)) { + RUN_DPRINTF(sc, RUN_DEBUG_RECV_DESC | RUN_DEBUG_USB, + "payload is too big: mbuf_len %u\n", mbuf_len); + counter_u64_add(ic->ic_ierrors, 1); + break; + } + /* copy aggregated frames to another mbuf */ m0 = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); if (__predict_false(m0 == NULL)) { @@ -3058,14 +3083,13 @@ tr_setup: break; } m_copydata(m, 4 /* skip 32-bit DMA-len header */, - dmalen + sizeof(struct rt2870_rxd), mtod(m0, caddr_t)); - m0->m_pkthdr.len = m0->m_len = - dmalen + sizeof(struct rt2870_rxd); + mbuf_len, mtod(m0, caddr_t)); + m0->m_pkthdr.len = m0->m_len = mbuf_len; run_rx_frame(sc, m0, dmalen); /* update data ptr */ - m->m_data += dmalen + 8; - m->m_pkthdr.len = m->m_len -= dmalen + 8; + m->m_data += mbuf_len + 4; + m->m_pkthdr.len = m->m_len -= mbuf_len + 4; } /* make sure we free the source buffer, if any */ From owner-svn-src-stable-12@freebsd.org Mon Jan 28 01:36:57 2019 Return-Path: Delivered-To: svn-src-stable-12@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 0109F14C499F; Mon, 28 Jan 2019 01:36:57 +0000 (UTC) (envelope-from pfg@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 96A138FBEC; Mon, 28 Jan 2019 01:36:56 +0000 (UTC) (envelope-from pfg@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 7A30818860; Mon, 28 Jan 2019 01:36:56 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x0S1auLj096024; Mon, 28 Jan 2019 01:36:56 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0S1aust096023; Mon, 28 Jan 2019 01:36:56 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201901280136.x0S1aust096023@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 28 Jan 2019 01:36:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343512 - stable/12/sys/fs/ext2fs X-SVN-Group: stable-12 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: stable/12/sys/fs/ext2fs X-SVN-Commit-Revision: 343512 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 96A138FBEC 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)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.961,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2019 01:36:57 -0000 Author: pfg Date: Mon Jan 28 01:36:55 2019 New Revision: 343512 URL: https://svnweb.freebsd.org/changeset/base/343512 Log: MFC r343459: ext2fs: Add some extra consistency checks for the superblock. Maliciously formed, or badly corrupted, filesystems can cause kernel panics. In general, such acts of foot-shooting can only be accomplished by root, but in a world with VM images that is moving towards automated mounts it is important to have some form of prevention. Reported by: Christopher Krah, Thomas Barabosch, and Jan-Niclas Hilgert of Fraunhofer FKIE. Incidentaly this should also fix a memory corruption issue reported by Dr Silvio Cesare of InfoSect. Huge thanks to all reseachers for making us aware of the issue. admbug: 872, 891 Reviewed by: fsu Obtained from: NetBSD (with minor changes) Modified: stable/12/sys/fs/ext2fs/ext2_vfsops.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/fs/ext2fs/ext2_vfsops.c ============================================================================== --- stable/12/sys/fs/ext2fs/ext2_vfsops.c Mon Jan 28 01:28:17 2019 (r343511) +++ stable/12/sys/fs/ext2fs/ext2_vfsops.c Mon Jan 28 01:36:55 2019 (r343512) @@ -416,7 +416,16 @@ compute_sb_data(struct vnode *devvp, struct ext2fs *es es->e3fs_desc_size); return (EINVAL); } + /* Check for block size = 1K|2K|4K */ + if (es->e2fs_log_bsize > 2) { + printf("ext2fs: bad block size: %d\n", es->e2fs_log_bsize); + return (EINVAL); + } /* Check for group size */ + if (fs->e2fs_bpg == 0) { + printf("ext2fs: zero blocks per group\n"); + return (EINVAL); + } if (fs->e2fs_bpg != fs->e2fs_bsize * 8) { printf("ext2fs: non-standard group size unsupported %d\n", fs->e2fs_bpg); @@ -424,7 +433,21 @@ compute_sb_data(struct vnode *devvp, struct ext2fs *es } fs->e2fs_ipb = fs->e2fs_bsize / EXT2_INODE_SIZE(fs); + if (fs->e2fs_ipg == 0) { + printf("ext2fs: zero inodes per group\n"); + return (EINVAL); + } fs->e2fs_itpg = fs->e2fs_ipg / fs->e2fs_ipb; + /* Check for block consistency */ + if (es->e2fs_first_dblock >= fs->e2fs_bcount) { + printf("ext2fs: invalid first data block\n"); + return (EINVAL); + } + if (fs->e2fs_rbcount > fs->e2fs_bcount || + fs->e2fs_fbcount > fs->e2fs_bcount) { + printf("ext2fs: invalid block count\n"); + return (EINVAL); + } /* s_resuid / s_resgid ? */ fs->e2fs_gcount = howmany(fs->e2fs_bcount - es->e2fs_first_dblock, EXT2_BLOCKS_PER_GROUP(fs)); From owner-svn-src-stable-12@freebsd.org Mon Jan 28 01:47:18 2019 Return-Path: Delivered-To: svn-src-stable-12@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 3AA4D14C4CF3; Mon, 28 Jan 2019 01:47:18 +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 A8BEA68200; Mon, 28 Jan 2019 01:47:17 +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 816AE18A08; Mon, 28 Jan 2019 01:47:17 +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 x0S1lHtU001416; Mon, 28 Jan 2019 01:47:17 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0S1lHXw001415; Mon, 28 Jan 2019 01:47:17 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201901280147.x0S1lHXw001415@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Mon, 28 Jan 2019 01:47:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343514 - stable/12/sys/dev/usb/wlan X-SVN-Group: stable-12 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: stable/12/sys/dev/usb/wlan X-SVN-Commit-Revision: 343514 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A8BEA68200 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.960,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2019 01:47:18 -0000 Author: avos Date: Mon Jan 28 01:47:16 2019 New Revision: 343514 URL: https://svnweb.freebsd.org/changeset/base/343514 Log: MFC r343238: urtw(4): add length checks in Rx path. - Check if buffer can contain Rx descriptor before accessing it. - Verify upper / lower bounds for frame length. - Do not pass too short frames into ieee80211_find_rxnode(). While here: - Move cleanup to the function end. - Reuse IEEE80211_IS_DATA() macro. Modified: stable/12/sys/dev/usb/wlan/if_urtw.c stable/12/sys/dev/usb/wlan/if_urtwvar.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/usb/wlan/if_urtw.c ============================================================================== --- stable/12/sys/dev/usb/wlan/if_urtw.c Mon Jan 28 01:37:36 2019 (r343513) +++ stable/12/sys/dev/usb/wlan/if_urtw.c Mon Jan 28 01:47:16 2019 (r343514) @@ -3933,21 +3933,18 @@ urtw_rxeof(struct usb_xfer *xfer, struct urtw_data *da usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); - if (actlen < (int)URTW_MIN_RXBUFSZ) { - counter_u64_add(ic->ic_ierrors, 1); - return (NULL); - } - if (sc->sc_flags & URTW_RTL8187B) { struct urtw_8187b_rxhdr *rx; + if (actlen < sizeof(*rx) + IEEE80211_ACK_LEN) + goto fail; + rx = (struct urtw_8187b_rxhdr *)(data->buf + (actlen - (sizeof(struct urtw_8187b_rxhdr)))); flen = le32toh(rx->flag) & 0xfff; - if (flen > actlen) { - counter_u64_add(ic->ic_ierrors, 1); - return (NULL); - } + if (flen > actlen - sizeof(*rx)) + goto fail; + rate = (le32toh(rx->flag) >> URTW_RX_FLAG_RXRATE_SHIFT) & 0xf; /* XXX correct? */ rssi = rx->rssi & URTW_RX_RSSI_MASK; @@ -3955,13 +3952,14 @@ urtw_rxeof(struct usb_xfer *xfer, struct urtw_data *da } else { struct urtw_8187l_rxhdr *rx; + if (actlen < sizeof(*rx) + IEEE80211_ACK_LEN) + goto fail; + rx = (struct urtw_8187l_rxhdr *)(data->buf + (actlen - (sizeof(struct urtw_8187l_rxhdr)))); flen = le32toh(rx->flag) & 0xfff; - if (flen > actlen) { - counter_u64_add(ic->ic_ierrors, 1); - return (NULL); - } + if (flen > actlen - sizeof(*rx)) + goto fail; rate = (le32toh(rx->flag) >> URTW_RX_FLAG_RXRATE_SHIFT) & 0xf; /* XXX correct? */ @@ -3969,11 +3967,12 @@ urtw_rxeof(struct usb_xfer *xfer, struct urtw_data *da noise = rx->noise; } + if (flen < IEEE80211_ACK_LEN) + goto fail; + mnew = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); - if (mnew == NULL) { - counter_u64_add(ic->ic_ierrors, 1); - return (NULL); - } + if (mnew == NULL) + goto fail; m = data->m; data->m = mnew; @@ -3992,13 +3991,17 @@ urtw_rxeof(struct usb_xfer *xfer, struct urtw_data *da } wh = mtod(m, struct ieee80211_frame *); - if ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_DATA) + if (IEEE80211_IS_DATA(wh)) sc->sc_currate = (rate > 0) ? rate : sc->sc_currate; *rssi_p = rssi; *nf_p = noise; /* XXX correct? */ return (m); + +fail: + counter_u64_add(ic->ic_ierrors, 1); + return (NULL); } static void @@ -4006,7 +4009,6 @@ urtw_bulk_rx_callback(struct usb_xfer *xfer, usb_error { struct urtw_softc *sc = usbd_xfer_softc(xfer); struct ieee80211com *ic = &sc->sc_ic; - struct ieee80211_frame *wh; struct ieee80211_node *ni; struct mbuf *m = NULL; struct urtw_data *data; @@ -4044,9 +4046,13 @@ setup: */ URTW_UNLOCK(sc); if (m != NULL) { - wh = mtod(m, struct ieee80211_frame *); - ni = ieee80211_find_rxnode(ic, - (struct ieee80211_frame_min *)wh); + if (m->m_pkthdr.len >= + sizeof(struct ieee80211_frame_min)) { + ni = ieee80211_find_rxnode(ic, + mtod(m, struct ieee80211_frame_min *)); + } else + ni = NULL; + if (ni != NULL) { (void) ieee80211_input(ni, m, rssi, nf); /* node is no longer needed */ Modified: stable/12/sys/dev/usb/wlan/if_urtwvar.h ============================================================================== --- stable/12/sys/dev/usb/wlan/if_urtwvar.h Mon Jan 28 01:37:36 2019 (r343513) +++ stable/12/sys/dev/usb/wlan/if_urtwvar.h Mon Jan 28 01:47:16 2019 (r343514) @@ -47,10 +47,6 @@ struct urtw_data { }; typedef STAILQ_HEAD(, urtw_data) urtw_datahead; -/* XXX not correct.. */ -#define URTW_MIN_RXBUFSZ \ - (sizeof(struct ieee80211_frame_min)) - #define URTW_RX_DATA_LIST_COUNT 4 #define URTW_TX_DATA_LIST_COUNT 16 #define URTW_RX_MAXSIZE 0x9c4 From owner-svn-src-stable-12@freebsd.org Mon Jan 28 02:26:07 2019 Return-Path: Delivered-To: svn-src-stable-12@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 D1F7214C5BB1; Mon, 28 Jan 2019 02:26:06 +0000 (UTC) (envelope-from pfg@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 777D86B194; Mon, 28 Jan 2019 02:26:06 +0000 (UTC) (envelope-from pfg@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 68DDE190ED; Mon, 28 Jan 2019 02:26:06 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x0S2Q6iA022232; Mon, 28 Jan 2019 02:26:06 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0S2Q5JA022230; Mon, 28 Jan 2019 02:26:05 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201901280226.x0S2Q5JA022230@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 28 Jan 2019 02:26:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343519 - in stable/12: include lib/libc/net X-SVN-Group: stable-12 X-SVN-Commit-Author: pfg X-SVN-Commit-Paths: in stable/12: include lib/libc/net X-SVN-Commit-Revision: 343519 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 777D86B194 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_LONG(-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] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2019 02:26:07 -0000 Author: pfg Date: Mon Jan 28 02:26:05 2019 New Revision: 343519 URL: https://svnweb.freebsd.org/changeset/base/343519 Log: MFC r342379, r342383: gai_strerror() - Update string error messages according to RFC 3493. Error messages in gai_strerror(3) vary largely among OSs. For new software we largely replaced the obsoleted EAI_NONAME and with EAI_NODATA but we never updated the corresponding message to better match the intended use. We also have references to ai_flags and ai_family which are not very descriptive for non-developer end users. Bring new error messages based on informational RFC 3493, which has obsoleted RFC 2553, and make them consistent among the header and manpage. Modified: stable/12/include/netdb.h stable/12/lib/libc/net/gai_strerror.3 stable/12/lib/libc/net/gai_strerror.c Directory Properties: stable/12/ (props changed) Modified: stable/12/include/netdb.h ============================================================================== --- stable/12/include/netdb.h Mon Jan 28 02:15:41 2019 (r343518) +++ stable/12/include/netdb.h Mon Jan 28 02:26:05 2019 (r343519) @@ -159,24 +159,24 @@ struct addrinfo { #define NO_ADDRESS NO_DATA /* no address, look for MX record */ /* - * Error return codes from getaddrinfo() + * Error return codes from gai_strerror(3), see RFC 3493. */ #if 0 -/* obsoleted */ +/* Obsoleted on RFC 2553bis-02 */ #define EAI_ADDRFAMILY 1 /* address family for hostname not supported */ #endif -#define EAI_AGAIN 2 /* temporary failure in name resolution */ -#define EAI_BADFLAGS 3 /* invalid value for ai_flags */ +#define EAI_AGAIN 2 /* name could not be resolved at this time */ +#define EAI_BADFLAGS 3 /* flags parameter had an invalid value */ #define EAI_FAIL 4 /* non-recoverable failure in name resolution */ -#define EAI_FAMILY 5 /* ai_family not supported */ +#define EAI_FAMILY 5 /* address family not recognized */ #define EAI_MEMORY 6 /* memory allocation failure */ #if 0 -/* obsoleted */ +/* Obsoleted on RFC 2553bis-02 */ #define EAI_NODATA 7 /* no address associated with hostname */ #endif -#define EAI_NONAME 8 /* hostname nor servname provided, or not known */ -#define EAI_SERVICE 9 /* servname not supported for ai_socktype */ -#define EAI_SOCKTYPE 10 /* ai_socktype not supported */ +#define EAI_NONAME 8 /* name does not resolve */ +#define EAI_SERVICE 9 /* service not recognized for socket type */ +#define EAI_SOCKTYPE 10 /* intended socket type was not recognized */ #define EAI_SYSTEM 11 /* system error returned in errno */ #define EAI_BADHINTS 12 /* invalid value for hints */ #define EAI_PROTOCOL 13 /* resolved protocol is unknown */ Modified: stable/12/lib/libc/net/gai_strerror.3 ============================================================================== --- stable/12/lib/libc/net/gai_strerror.3 Mon Jan 28 02:15:41 2019 (r343518) +++ stable/12/lib/libc/net/gai_strerror.3 Mon Jan 28 02:26:05 2019 (r343519) @@ -18,7 +18,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 21, 2006 +.Dd December 23, 2018 .Dt GAI_STRERROR 3 .Os .Sh NAME @@ -44,38 +44,30 @@ The following error codes and their meaning are define .Pp .Bl -tag -width ".Dv EAI_BADFLAGS" -offset indent -compact .It Dv EAI_AGAIN -temporary failure in name resolution +Name could not be resolved at this time .It Dv EAI_BADFLAGS -invalid value for -.Fa ai_flags +flags parameter had an invalid value .It Dv EAI_BADHINTS invalid value for .Fa hints .It Dv EAI_FAIL -non-recoverable failure in name resolution +Non-recoverable failure in name resolution .It Dv EAI_FAMILY -.Fa ai_family -not supported +Address family was not recognized .It Dv EAI_MEMORY -memory allocation failure +Memory allocation failure .It Dv EAI_NONAME -.Fa hostname -or -.Fa servname -not provided, or not known +Name does not resolve .It Dv EAI_OVERFLOW argument buffer overflow .It Dv EAI_PROTOCOL -resolved protocol is unknown +Resolved protocol is unknown .It Dv EAI_SERVICE -.Fa servname -not supported for -.Fa ai_socktype +Service was not recognized for socket type .It Dv EAI_SOCKTYPE -.Fa ai_socktype -not supported +Intended socket type was not recognized .It Dv EAI_SYSTEM -system error returned in +System error returned in .Va errno .El .Sh RETURN VALUES @@ -90,3 +82,8 @@ is out of range, an implementation-specific error mess .Sh SEE ALSO .Xr getaddrinfo 3 , .Xr getnameinfo 3 +.Sh STANDARDS +.Bl -tag -width ".It RFC 2743" +.It RFC 3493 +Basic Socket Interface Extensions for IPv6 +.El Modified: stable/12/lib/libc/net/gai_strerror.c ============================================================================== --- stable/12/lib/libc/net/gai_strerror.c Mon Jan 28 02:15:41 2019 (r343518) +++ stable/12/lib/libc/net/gai_strerror.c Mon Jan 28 02:26:05 2019 (r343519) @@ -45,19 +45,19 @@ __FBSDID("$FreeBSD$"); #include "un-namespace.h" /* Entries EAI_ADDRFAMILY (1) and EAI_NODATA (7) are obsoleted, but left */ -/* for backward compatibility with userland code prior to 2553bis-02 */ +/* for backwards compatibility with userland code prior to RFC2553bis-02 */ static const char *ai_errlist[] = { "Success", /* 0 */ - "Address family for hostname not supported", /* 1 */ - "Temporary failure in name resolution", /* EAI_AGAIN */ - "Invalid value for ai_flags", /* EAI_BADFLAGS */ + "Address family for hostname not supported", /* 1: Obsolete */ + "Name could not be resolved at this time", /* EAI_AGAIN */ + "Flags parameter had an invalid value", /* EAI_BADFLAGS */ "Non-recoverable failure in name resolution", /* EAI_FAIL */ - "ai_family not supported", /* EAI_FAMILY */ + "Address family not recognized", /* EAI_FAMILY */ "Memory allocation failure", /* EAI_MEMORY */ - "No address associated with hostname", /* 7 */ - "hostname nor servname provided, or not known", /* EAI_NONAME */ - "servname not supported for ai_socktype", /* EAI_SERVICE */ - "ai_socktype not supported", /* EAI_SOCKTYPE */ + "No address associated with hostname", /* 7: Obsolete*/ + "Name does not resolve", /* EAI_NONAME */ + "Service was not recognized for socket type", /* EAI_SERVICE */ + "Intended socket type was not recognized", /* EAI_SOCKTYPE */ "System error returned in errno", /* EAI_SYSTEM */ "Invalid value for hints", /* EAI_BADHINTS */ "Resolved protocol is unknown", /* EAI_PROTOCOL */ From owner-svn-src-stable-12@freebsd.org Mon Jan 28 09:18:29 2019 Return-Path: Delivered-To: svn-src-stable-12@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 8613414ACC42; Mon, 28 Jan 2019 09:18:29 +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 2B47281C3D; Mon, 28 Jan 2019 09:18:29 +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 17CAB1D7CF; Mon, 28 Jan 2019 09:18:29 +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 x0S9IS2m037505; Mon, 28 Jan 2019 09:18:28 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0S9IS9O037504; Mon, 28 Jan 2019 09:18:28 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201901280918.x0S9IS9O037504@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Mon, 28 Jan 2019 09:18:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343521 - stable/12/sys/dev/netmap X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/12/sys/dev/netmap X-SVN-Commit-Revision: 343521 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2B47281C3D 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]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2019 09:18:29 -0000 Author: vmaffione Date: Mon Jan 28 09:18:28 2019 New Revision: 343521 URL: https://svnweb.freebsd.org/changeset/base/343521 Log: MFC r343413 netmap: fix crash with monitors and VALE ports Crash report described here: https://github.com/luigirizzo/netmap/issues/583 Fixed by providing dummy sync callback in case it is missing. Modified: stable/12/sys/dev/netmap/netmap_monitor.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/netmap/netmap_monitor.c ============================================================================== --- stable/12/sys/dev/netmap/netmap_monitor.c Mon Jan 28 08:36:10 2019 (r343520) +++ stable/12/sys/dev/netmap/netmap_monitor.c Mon Jan 28 09:18:28 2019 (r343521) @@ -259,11 +259,20 @@ static int netmap_monitor_parent_txsync(struct netmap_ static int netmap_monitor_parent_rxsync(struct netmap_kring *, int); static int netmap_monitor_parent_notify(struct netmap_kring *, int); +static int +nm_monitor_dummycb(struct netmap_kring *kring, int flags) +{ + (void)kring; + (void)flags; + return 0; +} + static void nm_monitor_intercept_callbacks(struct netmap_kring *kring) { ND("intercept callbacks on %s", kring->name); - kring->mon_sync = kring->nm_sync; + kring->mon_sync = kring->nm_sync != NULL ? + kring->nm_sync : nm_monitor_dummycb; kring->mon_notify = kring->nm_notify; if (kring->tx == NR_TX) { kring->nm_sync = netmap_monitor_parent_txsync; From owner-svn-src-stable-12@freebsd.org Mon Jan 28 09:45:31 2019 Return-Path: Delivered-To: svn-src-stable-12@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 8777D14ADB95; Mon, 28 Jan 2019 09:45:31 +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 3688683480; Mon, 28 Jan 2019 09:45:31 +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 DBF231DD30; Mon, 28 Jan 2019 09:45:30 +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 x0S9jUY9053992; Mon, 28 Jan 2019 09:45:30 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0S9jTrp053983; Mon, 28 Jan 2019 09:45:29 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201901280945.x0S9jTrp053983@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 28 Jan 2019 09:45:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343523 - in stable/12/sys: dev/pci kern sys x86/x86 X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/12/sys: dev/pci kern sys x86/x86 X-SVN-Commit-Revision: 343523 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3688683480 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.962,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2019 09:45:31 -0000 Author: avg Date: Mon Jan 28 09:45:28 2019 New Revision: 343523 URL: https://svnweb.freebsd.org/changeset/base/343523 Log: MFC r342170: add support for marking interrupt handlers as suspended The goal of this change is to fix a problem with PCI shared interrupts during suspend and resume. Modified: stable/12/sys/dev/pci/pci.c stable/12/sys/kern/bus_if.m stable/12/sys/kern/kern_intr.c stable/12/sys/kern/subr_bus.c stable/12/sys/kern/subr_rman.c stable/12/sys/sys/bus.h stable/12/sys/sys/interrupt.h stable/12/sys/sys/rman.h stable/12/sys/x86/x86/nexus.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/pci/pci.c ============================================================================== --- stable/12/sys/dev/pci/pci.c Mon Jan 28 09:27:28 2019 (r343522) +++ stable/12/sys/dev/pci/pci.c Mon Jan 28 09:45:28 2019 (r343523) @@ -4457,6 +4457,7 @@ int pci_suspend_child(device_t dev, device_t child) { struct pci_devinfo *dinfo; + struct resource_list_entry *rle; int error; dinfo = device_get_ivars(child); @@ -4473,8 +4474,20 @@ pci_suspend_child(device_t dev, device_t child) if (error) return (error); - if (pci_do_power_suspend) + if (pci_do_power_suspend) { + /* + * Make sure this device's interrupt handler is not invoked + * in the case the device uses a shared interrupt that can + * be raised by some other device. + * This is applicable only to regular (legacy) PCI interrupts + * as MSI/MSI-X interrupts are never shared. + */ + rle = resource_list_find(&dinfo->resources, + SYS_RES_IRQ, 0); + if (rle != NULL && rle->res != NULL) + (void)bus_suspend_intr(child, rle->res); pci_set_power_child(dev, child, PCI_POWERSTATE_D3); + } return (0); } @@ -4483,6 +4496,7 @@ int pci_resume_child(device_t dev, device_t child) { struct pci_devinfo *dinfo; + struct resource_list_entry *rle; if (pci_do_power_resume) pci_set_power_child(dev, child, PCI_POWERSTATE_D0); @@ -4493,6 +4507,16 @@ pci_resume_child(device_t dev, device_t child) pci_cfg_save(child, dinfo, 1); bus_generic_resume_child(dev, child); + + /* + * Allow interrupts only after fully resuming the driver and hardware. + */ + if (pci_do_power_suspend) { + /* See pci_suspend_child for details. */ + rle = resource_list_find(&dinfo->resources, SYS_RES_IRQ, 0); + if (rle != NULL && rle->res != NULL) + (void)bus_resume_intr(child, rle->res); + } return (0); } Modified: stable/12/sys/kern/bus_if.m ============================================================================== --- stable/12/sys/kern/bus_if.m Mon Jan 28 09:27:28 2019 (r343522) +++ stable/12/sys/kern/bus_if.m Mon Jan 28 09:45:28 2019 (r343523) @@ -472,6 +472,44 @@ METHOD int teardown_intr { }; /** + * @brief Suspend an interrupt handler + * + * This method is used to mark a handler as suspended in the case + * that the associated device is powered down and cannot be a source + * for the, typically shared, interrupt. + * The value of @p _irq must be the interrupt resource passed + * to a previous call to BUS_SETUP_INTR(). + * + * @param _dev the parent device of @p _child + * @param _child the device which allocated the resource + * @param _irq the resource representing the interrupt + */ +METHOD int suspend_intr { + device_t _dev; + device_t _child; + struct resource *_irq; +} DEFAULT bus_generic_suspend_intr; + +/** + * @brief Resume an interrupt handler + * + * This method is used to clear suspended state of a handler when + * the associated device is powered up and can be an interrupt source + * again. + * The value of @p _irq must be the interrupt resource passed + * to a previous call to BUS_SETUP_INTR(). + * + * @param _dev the parent device of @p _child + * @param _child the device which allocated the resource + * @param _irq the resource representing the interrupt + */ +METHOD int resume_intr { + device_t _dev; + device_t _child; + struct resource *_irq; +} DEFAULT bus_generic_resume_intr; + +/** * @brief Define a resource which can be allocated with * BUS_ALLOC_RESOURCE(). * Modified: stable/12/sys/kern/kern_intr.c ============================================================================== --- stable/12/sys/kern/kern_intr.c Mon Jan 28 09:27:28 2019 (r343522) +++ stable/12/sys/kern/kern_intr.c Mon Jan 28 09:45:28 2019 (r343523) @@ -721,6 +721,28 @@ intr_event_barrier(struct intr_event *ie) atomic_thread_fence_acq(); } +static void +intr_handler_barrier(struct intr_handler *handler) +{ + struct intr_event *ie; + + ie = handler->ih_event; + mtx_assert(&ie->ie_lock, MA_OWNED); + KASSERT((handler->ih_flags & IH_DEAD) == 0, + ("update for a removed handler")); + + if (ie->ie_thread == NULL) { + intr_event_barrier(ie); + return; + } + if ((handler->ih_flags & IH_CHANGED) == 0) { + handler->ih_flags |= IH_CHANGED; + intr_event_schedule_thread(ie); + } + while ((handler->ih_flags & IH_CHANGED) != 0) + msleep(handler, &ie->ie_lock, 0, "ih_barr", 0); +} + /* * Sleep until an ithread finishes executing an interrupt handler. * @@ -842,6 +864,49 @@ intr_event_remove_handler(void *cookie) return (0); } +int +intr_event_suspend_handler(void *cookie) +{ + struct intr_handler *handler = (struct intr_handler *)cookie; + struct intr_event *ie; + + if (handler == NULL) + return (EINVAL); + ie = handler->ih_event; + KASSERT(ie != NULL, + ("interrupt handler \"%s\" has a NULL interrupt event", + handler->ih_name)); + mtx_lock(&ie->ie_lock); + handler->ih_flags |= IH_SUSP; + intr_handler_barrier(handler); + mtx_unlock(&ie->ie_lock); + return (0); +} + +int +intr_event_resume_handler(void *cookie) +{ + struct intr_handler *handler = (struct intr_handler *)cookie; + struct intr_event *ie; + + if (handler == NULL) + return (EINVAL); + ie = handler->ih_event; + KASSERT(ie != NULL, + ("interrupt handler \"%s\" has a NULL interrupt event", + handler->ih_name)); + + /* + * intr_handler_barrier() acts not only as a barrier, + * it also allows to check for any pending interrupts. + */ + mtx_lock(&ie->ie_lock); + handler->ih_flags &= ~IH_SUSP; + intr_handler_barrier(handler); + mtx_unlock(&ie->ie_lock); + return (0); +} + static int intr_event_schedule_thread(struct intr_event *ie) { @@ -1016,10 +1081,21 @@ intr_event_execute_handlers(struct proc *p, struct int */ ihp = ih; + if ((ih->ih_flags & IH_CHANGED) != 0) { + mtx_lock(&ie->ie_lock); + ih->ih_flags &= ~IH_CHANGED; + wakeup(ih); + mtx_unlock(&ie->ie_lock); + } + /* Skip filter only handlers */ if (ih->ih_handler == NULL) continue; + /* Skip suspended handlers */ + if ((ih->ih_flags & IH_SUSP) != 0) + continue; + /* * For software interrupt threads, we only execute * handlers that have their need flag set. Hardware @@ -1178,8 +1254,9 @@ intr_event_handle(struct intr_event *ie, struct trapfr struct intr_handler *ih; struct trapframe *oldframe; struct thread *td; - int ret, thread; int phase; + int ret; + bool filter, thread; td = curthread; @@ -1198,7 +1275,8 @@ intr_event_handle(struct intr_event *ie, struct trapfr * a trapframe as its argument. */ td->td_intr_nesting_level++; - thread = 0; + filter = false; + thread = false; ret = 0; critical_enter(); oldframe = td->td_intr_frame; @@ -1214,8 +1292,10 @@ intr_event_handle(struct intr_event *ie, struct trapfr atomic_thread_fence_seq_cst(); CK_SLIST_FOREACH(ih, &ie->ie_handlers, ih_next) { + if ((ih->ih_flags & IH_SUSP) != 0) + continue; if (ih->ih_filter == NULL) { - thread = 1; + thread = true; continue; } CTR4(KTR_INTR, "%s: exec %p(%p) for %s", __func__, @@ -1230,24 +1310,25 @@ intr_event_handle(struct intr_event *ie, struct trapfr (ret & ~(FILTER_SCHEDULE_THREAD | FILTER_HANDLED)) == 0), ("%s: incorrect return value %#x from %s", __func__, ret, ih->ih_name)); + filter = filter || ret == FILTER_HANDLED; - /* + /* * Wrapper handler special handling: * - * in some particular cases (like pccard and pccbb), + * in some particular cases (like pccard and pccbb), * the _real_ device handler is wrapped in a couple of * functions - a filter wrapper and an ithread wrapper. - * In this case (and just in this case), the filter wrapper + * In this case (and just in this case), the filter wrapper * could ask the system to schedule the ithread and mask * the interrupt source if the wrapped handler is composed * of just an ithread handler. * - * TODO: write a generic wrapper to avoid people rolling - * their own + * TODO: write a generic wrapper to avoid people rolling + * their own. */ if (!thread) { if (ret == FILTER_SCHEDULE_THREAD) - thread = 1; + thread = true; } } atomic_add_rel_int(&ie->ie_active[phase], -1); @@ -1271,6 +1352,11 @@ intr_event_handle(struct intr_event *ie, struct trapfr } critical_exit(); td->td_intr_nesting_level--; +#ifdef notyet + /* The interrupt is not aknowledged by any filter and has no ithread. */ + if (!thread && !filter) + return (EINVAL); +#endif return (0); } Modified: stable/12/sys/kern/subr_bus.c ============================================================================== --- stable/12/sys/kern/subr_bus.c Mon Jan 28 09:27:28 2019 (r343522) +++ stable/12/sys/kern/subr_bus.c Mon Jan 28 09:45:28 2019 (r343523) @@ -4047,6 +4047,36 @@ bus_generic_teardown_intr(device_t dev, device_t child } /** + * @brief Helper function for implementing BUS_SUSPEND_INTR(). + * + * This simple implementation of BUS_SUSPEND_INTR() simply calls the + * BUS_SUSPEND_INTR() method of the parent of @p dev. + */ +int +bus_generic_suspend_intr(device_t dev, device_t child, struct resource *irq) +{ + /* Propagate up the bus hierarchy until someone handles it. */ + if (dev->parent) + return (BUS_SUSPEND_INTR(dev->parent, child, irq)); + return (EINVAL); +} + +/** + * @brief Helper function for implementing BUS_RESUME_INTR(). + * + * This simple implementation of BUS_RESUME_INTR() simply calls the + * BUS_RESUME_INTR() method of the parent of @p dev. + */ +int +bus_generic_resume_intr(device_t dev, device_t child, struct resource *irq) +{ + /* Propagate up the bus hierarchy until someone handles it. */ + if (dev->parent) + return (BUS_RESUME_INTR(dev->parent, child, irq)); + return (EINVAL); +} + +/** * @brief Helper function for implementing BUS_ADJUST_RESOURCE(). * * This simple implementation of BUS_ADJUST_RESOURCE() simply calls the @@ -4611,6 +4641,34 @@ bus_teardown_intr(device_t dev, struct resource *r, vo if (dev->parent == NULL) return (EINVAL); return (BUS_TEARDOWN_INTR(dev->parent, dev, r, cookie)); +} + +/** + * @brief Wrapper function for BUS_SUSPEND_INTR(). + * + * This function simply calls the BUS_SUSPEND_INTR() method of the + * parent of @p dev. + */ +int +bus_suspend_intr(device_t dev, struct resource *r) +{ + if (dev->parent == NULL) + return (EINVAL); + return (BUS_SUSPEND_INTR(dev->parent, dev, r)); +} + +/** + * @brief Wrapper function for BUS_RESUME_INTR(). + * + * This function simply calls the BUS_RESUME_INTR() method of the + * parent of @p dev. + */ +int +bus_resume_intr(device_t dev, struct resource *r) +{ + if (dev->parent == NULL) + return (EINVAL); + return (BUS_RESUME_INTR(dev->parent, dev, r)); } /** Modified: stable/12/sys/kern/subr_rman.c ============================================================================== --- stable/12/sys/kern/subr_rman.c Mon Jan 28 09:27:28 2019 (r343522) +++ stable/12/sys/kern/subr_rman.c Mon Jan 28 09:45:28 2019 (r343523) @@ -94,6 +94,7 @@ struct resource_i { rman_res_t r_end; /* index of the last entry (inclusive) */ u_int r_flags; void *r_virtual; /* virtual address of this resource */ + void *r_irq_cookie; /* interrupt cookie for this (interrupt) resource */ device_t r_dev; /* device which has allocated this resource */ struct rman *r_rm; /* resource manager from whence this came */ int r_rid; /* optional rid for this resource. */ @@ -866,6 +867,20 @@ rman_get_virtual(struct resource *r) { return (r->__r_i->r_virtual); +} + +void +rman_set_irq_cookie(struct resource *r, void *c) +{ + + r->__r_i->r_irq_cookie = c; +} + +void * +rman_get_irq_cookie(struct resource *r) +{ + + return (r->__r_i->r_irq_cookie); } void Modified: stable/12/sys/sys/bus.h ============================================================================== --- stable/12/sys/sys/bus.h Mon Jan 28 09:27:28 2019 (r343522) +++ stable/12/sys/sys/bus.h Mon Jan 28 09:45:28 2019 (r343523) @@ -485,6 +485,10 @@ int bus_generic_suspend(device_t dev); int bus_generic_suspend_child(device_t dev, device_t child); int bus_generic_teardown_intr(device_t dev, device_t child, struct resource *irq, void *cookie); +int bus_generic_suspend_intr(device_t dev, device_t child, + struct resource *irq); +int bus_generic_resume_intr(device_t dev, device_t child, + struct resource *irq); int bus_generic_unmap_resource(device_t dev, device_t child, int type, struct resource *r, struct resource_map *map); @@ -535,6 +539,8 @@ int bus_setup_intr(device_t dev, struct resource *r, i driver_filter_t filter, driver_intr_t handler, void *arg, void **cookiep); int bus_teardown_intr(device_t dev, struct resource *r, void *cookie); +int bus_suspend_intr(device_t dev, struct resource *r); +int bus_resume_intr(device_t dev, struct resource *r); int bus_bind_intr(device_t dev, struct resource *r, int cpu); int bus_describe_intr(device_t dev, struct resource *irq, void *cookie, const char *fmt, ...) __printflike(4, 5); Modified: stable/12/sys/sys/interrupt.h ============================================================================== --- stable/12/sys/sys/interrupt.h Mon Jan 28 09:27:28 2019 (r343522) +++ stable/12/sys/sys/interrupt.h Mon Jan 28 09:45:28 2019 (r343523) @@ -62,6 +62,8 @@ struct intr_handler { #define IH_EXCLUSIVE 0x00000002 /* Exclusive interrupt. */ #define IH_ENTROPY 0x00000004 /* Device is a good entropy source. */ #define IH_DEAD 0x00000008 /* Handler should be removed. */ +#define IH_SUSP 0x00000010 /* Device is powered down. */ +#define IH_CHANGED 0x40000000 /* Handler state is changed. */ #define IH_MPSAFE 0x80000000 /* Handler does not need Giant. */ /* @@ -184,6 +186,8 @@ int intr_event_describe_handler(struct intr_event *ie, int intr_event_destroy(struct intr_event *ie); int intr_event_handle(struct intr_event *ie, struct trapframe *frame); int intr_event_remove_handler(void *cookie); +int intr_event_suspend_handler(void *cookie); +int intr_event_resume_handler(void *cookie); int intr_getaffinity(int irq, int mode, void *mask); void *intr_handler_source(void *cookie); int intr_setaffinity(int irq, int mode, void *mask); Modified: stable/12/sys/sys/rman.h ============================================================================== --- stable/12/sys/sys/rman.h Mon Jan 28 09:27:28 2019 (r343522) +++ stable/12/sys/sys/rman.h Mon Jan 28 09:45:28 2019 (r343523) @@ -131,6 +131,7 @@ bus_space_tag_t rman_get_bustag(struct resource *); rman_res_t rman_get_end(struct resource *); device_t rman_get_device(struct resource *); u_int rman_get_flags(struct resource *); +void *rman_get_irq_cookie(struct resource *); void rman_get_mapping(struct resource *, struct resource_map *); int rman_get_rid(struct resource *); rman_res_t rman_get_size(struct resource *); @@ -155,6 +156,7 @@ void rman_set_bushandle(struct resource *_r, bus_space void rman_set_bustag(struct resource *_r, bus_space_tag_t _t); void rman_set_device(struct resource *_r, device_t _dev); void rman_set_end(struct resource *_r, rman_res_t _end); +void rman_set_irq_cookie(struct resource *_r, void *_c); void rman_set_mapping(struct resource *, struct resource_map *); void rman_set_rid(struct resource *_r, int _rid); void rman_set_start(struct resource *_r, rman_res_t _start); Modified: stable/12/sys/x86/x86/nexus.c ============================================================================== --- stable/12/sys/x86/x86/nexus.c Mon Jan 28 09:27:28 2019 (r343522) +++ stable/12/sys/x86/x86/nexus.c Mon Jan 28 09:45:28 2019 (r343523) @@ -124,6 +124,8 @@ static int nexus_setup_intr(device_t, device_t, struct void **); static int nexus_teardown_intr(device_t, device_t, struct resource *, void *); +static int nexus_suspend_intr(device_t, device_t, struct resource *); +static int nexus_resume_intr(device_t, device_t, struct resource *); static struct resource_list *nexus_get_reslist(device_t dev, device_t child); static int nexus_set_resource(device_t, device_t, int, int, rman_res_t, rman_res_t); @@ -161,6 +163,8 @@ static device_method_t nexus_methods[] = { DEVMETHOD(bus_unmap_resource, nexus_unmap_resource), DEVMETHOD(bus_setup_intr, nexus_setup_intr), DEVMETHOD(bus_teardown_intr, nexus_teardown_intr), + DEVMETHOD(bus_suspend_intr, nexus_suspend_intr), + DEVMETHOD(bus_resume_intr, nexus_resume_intr), #ifdef SMP DEVMETHOD(bus_bind_intr, nexus_bind_intr), #endif @@ -595,6 +599,8 @@ nexus_setup_intr(device_t bus, device_t child, struct error = intr_add_handler(device_get_nameunit(child), rman_get_start(irq), filter, ihand, arg, flags, cookiep, domain); + if (error == 0) + rman_set_irq_cookie(irq, *cookiep); return (error); } @@ -602,7 +608,24 @@ nexus_setup_intr(device_t bus, device_t child, struct static int nexus_teardown_intr(device_t dev, device_t child, struct resource *r, void *ih) { - return (intr_remove_handler(ih)); + int error; + + error = intr_remove_handler(ih); + if (error == 0) + rman_set_irq_cookie(r, NULL); + return (error); +} + +static int +nexus_suspend_intr(device_t dev, device_t child, struct resource *irq) +{ + return (intr_event_suspend_handler(rman_get_irq_cookie(irq))); +} + +static int +nexus_resume_intr(device_t dev, device_t child, struct resource *irq) +{ + return (intr_event_resume_handler(rman_get_irq_cookie(irq))); } #ifdef SMP From owner-svn-src-stable-12@freebsd.org Mon Jan 28 14:35:00 2019 Return-Path: Delivered-To: svn-src-stable-12@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 BA97A14B5CE1; Mon, 28 Jan 2019 14:35:00 +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 5BC788EAE4; Mon, 28 Jan 2019 14:35:00 +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 4A7712106E; Mon, 28 Jan 2019 14:35:00 +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 x0SEZ0lp018295; Mon, 28 Jan 2019 14:35:00 GMT (envelope-from gallatin@FreeBSD.org) Received: (from gallatin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0SEZ08L018294; Mon, 28 Jan 2019 14:35:00 GMT (envelope-from gallatin@FreeBSD.org) Message-Id: <201901281435.x0SEZ08L018294@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gallatin set sender to gallatin@FreeBSD.org using -f From: Andrew Gallatin Date: Mon, 28 Jan 2019 14:35:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343526 - stable/12/sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: gallatin X-SVN-Commit-Paths: stable/12/sys/net X-SVN-Commit-Revision: 343526 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5BC788EAE4 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.93)[-0.927,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2019 14:35:00 -0000 Author: gallatin Date: Mon Jan 28 14:34:59 2019 New Revision: 343526 URL: https://svnweb.freebsd.org/changeset/base/343526 Log: MFC r343430 Fix an iflib driver unload panic introduced in r343085 The new loop to sync and unload descriptors was indexed by "i", rather than "j". The panic was caused by "i" being advanced rather than "j", and eventually becoming out of bounds. Reviewed by: kib Sponsored by: Netflix Modified: stable/12/sys/net/iflib.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/iflib.c ============================================================================== --- stable/12/sys/net/iflib.c Mon Jan 28 12:45:31 2019 (r343525) +++ stable/12/sys/net/iflib.c Mon Jan 28 14:34:59 2019 (r343526) @@ -2192,17 +2192,17 @@ iflib_rx_sds_free(iflib_rxq_t rxq) fl = &rxq->ifr_fl[i]; if (fl->ifl_desc_tag != NULL) { if (fl->ifl_sds.ifsd_map != NULL) { - for (j = 0; j < fl->ifl_size; i++) { - if (fl->ifl_sds.ifsd_map[i] == + for (j = 0; j < fl->ifl_size; j++) { + if (fl->ifl_sds.ifsd_map[j] == NULL) - continue; + continue; bus_dmamap_sync( fl->ifl_desc_tag, - fl->ifl_sds.ifsd_map[i], + fl->ifl_sds.ifsd_map[j], BUS_DMASYNC_POSTREAD); bus_dmamap_unload( fl->ifl_desc_tag, - fl->ifl_sds.ifsd_map[i]); + fl->ifl_sds.ifsd_map[j]); } } bus_dma_tag_destroy(fl->ifl_desc_tag); From owner-svn-src-stable-12@freebsd.org Mon Jan 28 16:14:54 2019 Return-Path: Delivered-To: svn-src-stable-12@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 B946314B7C1C; Mon, 28 Jan 2019 16:14:54 +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 5EE346B9E5; Mon, 28 Jan 2019 16:14:54 +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 4FB76221B0; Mon, 28 Jan 2019 16:14:54 +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 x0SGEs3L078922; Mon, 28 Jan 2019 16:14:54 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0SGErMq078921; Mon, 28 Jan 2019 16:14:53 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201901281614.x0SGErMq078921@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 28 Jan 2019 16:14:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343527 - in stable/12/sys/riscv: include riscv X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12/sys/riscv: include riscv X-SVN-Commit-Revision: 343527 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 5EE346B9E5 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.949,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2019 16:14:55 -0000 Author: markj Date: Mon Jan 28 16:14:53 2019 New Revision: 343527 URL: https://svnweb.freebsd.org/changeset/base/343527 Log: MFC r343274, r343275: Optimize RISC-V copyin(9)/copyout(9) routines. Modified: stable/12/sys/riscv/include/riscvreg.h stable/12/sys/riscv/riscv/copyinout.S Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/riscv/include/riscvreg.h ============================================================================== --- stable/12/sys/riscv/include/riscvreg.h Mon Jan 28 14:34:59 2019 (r343526) +++ stable/12/sys/riscv/include/riscvreg.h Mon Jan 28 16:14:53 2019 (r343527) @@ -155,7 +155,8 @@ #define SATP_MODE_SV39 (8ULL << SATP_MODE_S) #define SATP_MODE_SV48 (9ULL << SATP_MODE_S) -#define XLEN 8 +#define XLEN __riscv_xlen +#define XLEN_BYTES (XLEN / 8) #define INSN_SIZE 4 #define INSN_C_SIZE 2 Modified: stable/12/sys/riscv/riscv/copyinout.S ============================================================================== --- stable/12/sys/riscv/riscv/copyinout.S Mon Jan 28 14:34:59 2019 (r343526) +++ stable/12/sys/riscv/riscv/copyinout.S Mon Jan 28 16:14:53 2019 (r343527) @@ -1,5 +1,6 @@ /*- * Copyright (c) 2015-2018 Ruslan Bukin + * Copyright (c) 2019 Mitchell Horne * All rights reserved. * * Portions of this software were developed by SRI International and the @@ -52,60 +53,94 @@ copyio_fault_nopcb: END(copyio_fault) /* + * copycommon - common copy routine + * + * a0 - Source address + * a1 - Destination address + * a2 - Size of copy + */ + .macro copycommon + la a6, copyio_fault /* Get the handler address */ + SET_FAULT_HANDLER(a6, a7) /* Set the handler */ + ENTER_USER_ACCESS(a7) + + li t2, XLEN_BYTES + blt a2, t2, 3f /* Byte-copy if len < XLEN_BYTES */ + + /* + * Compare lower bits of src and dest. + * If they are aligned with each other, we can do word copy. + */ + andi t0, a0, (XLEN_BYTES-1) /* Low bits of src */ + andi t1, a1, (XLEN_BYTES-1) /* Low bits of dest */ + bne t0, t1, 3f /* Misaligned. Go to byte copy */ + beqz t0, 2f /* Already word-aligned, skip ahead */ + + /* Byte copy until the first word-aligned address */ +1: lb a4, 0(a0) /* Load byte from src */ + addi a0, a0, 1 + sb a4, 0(a1) /* Store byte in dest */ + addi a1, a1, 1 + addi a2, a2, -1 /* len-- */ + andi t0, a0, (XLEN_BYTES-1) + bnez t0, 1b + + /* Copy words */ +2: ld a4, 0(a0) /* Load word from src */ + addi a0, a0, XLEN_BYTES + sd a4, 0(a1) /* Store word in dest */ + addi a1, a1, XLEN_BYTES + addi a2, a2, -XLEN_BYTES /* len -= XLEN_BYTES */ + bgeu a2, t2, 2b /* Again if len >= XLEN_BYTES */ + + /* Check if we're finished */ + beqz a2, 4f + + /* Copy any remaining bytes */ +3: lb a4, 0(a0) /* Load byte from src */ + addi a0, a0, 1 + sb a4, 0(a1) /* Store byte in dest */ + addi a1, a1, 1 + addi a2, a2, -1 /* len-- */ + bnez a2, 3b + +4: EXIT_USER_ACCESS(a7) + SET_FAULT_HANDLER(x0, a7) /* Clear the handler */ + .endm + +/* * Copies from a kernel to user address * * int copyout(const void *kaddr, void *udaddr, size_t len) */ ENTRY(copyout) - beqz a2, 2f /* If len == 0 then skip loop */ + beqz a2, copyout_end /* If len == 0 then skip loop */ add a3, a1, a2 li a4, VM_MAXUSER_ADDRESS bgt a3, a4, copyio_fault_nopcb - la a6, copyio_fault /* Get the handler address */ - SET_FAULT_HANDLER(a6, a7) /* Set the handler */ - ENTER_USER_ACCESS(a7) + copycommon -1: lb a4, 0(a0) /* Load from kaddr */ - addi a0, a0, 1 - sb a4, 0(a1) /* Store in uaddr */ - addi a1, a1, 1 - addi a2, a2, -1 /* len-- */ - bnez a2, 1b - - EXIT_USER_ACCESS(a7) - SET_FAULT_HANDLER(x0, a7) /* Clear the handler */ - -2: li a0, 0 /* return 0 */ +copyout_end: + li a0, 0 /* return 0 */ ret END(copyout) /* * Copies from a user to kernel address * - * int copyin(const void *uaddr, void *kdaddr, size_t len) + * int copyin(const void *uaddr, void *kaddr, size_t len) */ ENTRY(copyin) - beqz a2, 2f /* If len == 0 then skip loop */ + beqz a2, copyin_end /* If len == 0 then skip loop */ add a3, a0, a2 li a4, VM_MAXUSER_ADDRESS bgt a3, a4, copyio_fault_nopcb - la a6, copyio_fault /* Get the handler address */ - SET_FAULT_HANDLER(a6, a7) /* Set the handler */ - ENTER_USER_ACCESS(a7) + copycommon -1: lb a4, 0(a0) /* Load from uaddr */ - addi a0, a0, 1 - sb a4, 0(a1) /* Store in kaddr */ - addi a1, a1, 1 - addi a2, a2, -1 /* len-- */ - bnez a2, 1b - - EXIT_USER_ACCESS(a7) - SET_FAULT_HANDLER(x0, a7) /* Clear the handler */ - -2: li a0, 0 /* return 0 */ +copyin_end: + li a0, 0 /* return 0 */ ret END(copyin) From owner-svn-src-stable-12@freebsd.org Mon Jan 28 16:18:18 2019 Return-Path: Delivered-To: svn-src-stable-12@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 1748314B7EFA; Mon, 28 Jan 2019 16:18:18 +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 B19766BD3A; Mon, 28 Jan 2019 16:18:17 +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 A85BD221B3; Mon, 28 Jan 2019 16:18:17 +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 x0SGIHF0079114; Mon, 28 Jan 2019 16:18:17 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0SGIHZd079113; Mon, 28 Jan 2019 16:18:17 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201901281618.x0SGIHZd079113@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 28 Jan 2019 16:18:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343528 - stable/12/usr.bin/cmp/tests X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/usr.bin/cmp/tests X-SVN-Commit-Revision: 343528 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B19766BD3A 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.949,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2019 16:18:18 -0000 Author: markj Date: Mon Jan 28 16:18:17 2019 New Revision: 343528 URL: https://svnweb.freebsd.org/changeset/base/343528 Log: MFC r343247: Fix cmp(1) tests for "special" mode. Modified: stable/12/usr.bin/cmp/tests/cmp_test2.sh Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/cmp/tests/cmp_test2.sh ============================================================================== --- stable/12/usr.bin/cmp/tests/cmp_test2.sh Mon Jan 28 16:14:53 2019 (r343527) +++ stable/12/usr.bin/cmp/tests/cmp_test2.sh Mon Jan 28 16:18:17 2019 (r343528) @@ -31,11 +31,10 @@ special_head() { special_body() { echo 0123456789abcdef > a echo 0123456789abcdeg > b - cat a | atf_check -s exit:0 cmp a - - cat a | atf_check -s exit:0 cmp - a - cat b | atf_check -s not-exit:0 cmp a - - cat b | atf_check -s not-exit:0 cmp - a - true + atf_check -s exit:0 -o empty -e empty -x "cat a | cmp a -" + atf_check -s exit:0 -o empty -e empty -x "cat a | cmp - a" + atf_check -s exit:1 -o not-empty -e empty -x "cat b | cmp a -" + atf_check -s exit:1 -o not-empty -e empty -x "cat b | cmp - a" } atf_test_case symlink From owner-svn-src-stable-12@freebsd.org Mon Jan 28 21:46:07 2019 Return-Path: Delivered-To: svn-src-stable-12@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 8067914C0968; Mon, 28 Jan 2019 21:46:07 +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 260BC814E2; Mon, 28 Jan 2019 21:46:07 +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 026C525A24; Mon, 28 Jan 2019 21:46:07 +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 x0SLk6e6053390; Mon, 28 Jan 2019 21:46:06 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0SLk6E9053385; Mon, 28 Jan 2019 21:46:06 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201901282146.x0SLk6E9053385@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Mon, 28 Jan 2019 21:46:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343537 - in stable/12/sbin: newfs tunefs X-SVN-Group: stable-12 X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: in stable/12/sbin: newfs tunefs X-SVN-Commit-Revision: 343537 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 260BC814E2 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.975,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Jan 2019 21:46:07 -0000 Author: mckusick Date: Mon Jan 28 21:46:05 2019 New Revision: 343537 URL: https://svnweb.freebsd.org/changeset/base/343537 Log: MFC of 343449 and 343483 Update tunefs to allow '_' in label names. Update tunefs and newfs error messages to note that '_' is allowed in label names. Sponsored by: Netflix Modified: stable/12/sbin/newfs/newfs.8 stable/12/sbin/newfs/newfs.c stable/12/sbin/tunefs/tunefs.8 stable/12/sbin/tunefs/tunefs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/newfs/newfs.8 ============================================================================== --- stable/12/sbin/newfs/newfs.8 Mon Jan 28 21:36:45 2019 (r343536) +++ stable/12/sbin/newfs/newfs.8 Mon Jan 28 21:46:05 2019 (r343537) @@ -89,6 +89,7 @@ See for details. .It Fl L Ar volname Add a volume label to the new file system. +Legal characters are alphanumerics and underscores. .It Fl N Cause the file system parameters to be printed out without really creating the file system. Modified: stable/12/sbin/newfs/newfs.c ============================================================================== --- stable/12/sbin/newfs/newfs.c Mon Jan 28 21:36:45 2019 (r343536) +++ stable/12/sbin/newfs/newfs.c Mon Jan 28 21:46:05 2019 (r343537) @@ -155,7 +155,8 @@ main(int argc, char *argv[]) while (isalnum(volumelabel[++i]) || volumelabel[i] == '_'); if (volumelabel[i] != '\0') { - errx(1, "bad volume label. Valid characters are alphanumerics."); + errx(1, "bad volume label. Valid characters " + "are alphanumerics and underscores."); } if (strlen(volumelabel) >= MAXVOLLEN) { errx(1, "bad volume label. Length is longer than %d.", Modified: stable/12/sbin/tunefs/tunefs.8 ============================================================================== --- stable/12/sbin/tunefs/tunefs.8 Mon Jan 28 21:36:45 2019 (r343536) +++ stable/12/sbin/tunefs/tunefs.8 Mon Jan 28 21:46:05 2019 (r343537) @@ -112,6 +112,7 @@ By default sets it to half of the space reserved to minfree. .It Fl L Ar volname Add/modify an optional file system volume label. +Legal characters are alphanumerics and underscores. .It Fl l Cm enable | disable Turn on/off MAC multilabel flag. .It Fl m Ar minfree Modified: stable/12/sbin/tunefs/tunefs.c ============================================================================== --- stable/12/sbin/tunefs/tunefs.c Mon Jan 28 21:36:45 2019 (r343536) +++ stable/12/sbin/tunefs/tunefs.c Mon Jan 28 21:46:05 2019 (r343537) @@ -189,11 +189,10 @@ main(int argc, char *argv[]) name = "volume label"; Lvalue = optarg; i = -1; - while (isalnum(Lvalue[++i])); + while (isalnum(Lvalue[++i]) || Lvalue[i] == '_'); if (Lvalue[i] != '\0') { - errx(10, - "bad %s. Valid characters are alphanumerics.", - name); + errx(10, "bad %s. Valid characters are " + "alphanumerics and underscores.", name); } if (strlen(Lvalue) >= MAXVOLLEN) { errx(10, "bad %s. Length is longer than %d.", From owner-svn-src-stable-12@freebsd.org Tue Jan 29 03:06:26 2019 Return-Path: Delivered-To: svn-src-stable-12@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 3D79D14A89B0; Tue, 29 Jan 2019 03:06:26 +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 D3B488ECF0; Tue, 29 Jan 2019 03:06:25 +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 C9097164D; Tue, 29 Jan 2019 03:06:25 +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 x0T36P9R048728; Tue, 29 Jan 2019 03:06:25 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0T36PIQ048727; Tue, 29 Jan 2019 03:06:25 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201901290306.x0T36PIQ048727@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Tue, 29 Jan 2019 03:06:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343540 - in stable: 11/share/man/man4 12/share/man/man4 X-SVN-Group: stable-12 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: in stable: 11/share/man/man4 12/share/man/man4 X-SVN-Commit-Revision: 343540 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D3B488ECF0 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)[-0.999,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2019 03:06:26 -0000 Author: avos Date: Tue Jan 29 03:06:25 2019 New Revision: 343540 URL: https://svnweb.freebsd.org/changeset/base/343540 Log: MFC r343472: otus(4): fix a typo in man page (802.11 -> 802.11n) Modified: stable/12/share/man/man4/otus.4 Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/share/man/man4/otus.4 Directory Properties: stable/11/ (props changed) Modified: stable/12/share/man/man4/otus.4 ============================================================================== --- stable/12/share/man/man4/otus.4 Tue Jan 29 00:49:12 2019 (r343539) +++ stable/12/share/man/man4/otus.4 Tue Jan 29 03:06:25 2019 (r343540) @@ -166,4 +166,4 @@ and ported by The .Nm driver only supports 802.11a/b/g operations. -802.11 operation is not supported at this time. +802.11n operation is not supported at this time. From owner-svn-src-stable-12@freebsd.org Tue Jan 29 07:47:58 2019 Return-Path: Delivered-To: svn-src-stable-12@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 DDF6414AF9FF; Tue, 29 Jan 2019 07:47:58 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7CF7C70C03; Tue, 29 Jan 2019 07:47:58 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 602E548AA; Tue, 29 Jan 2019 07:47:58 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x0T7lw2d093970; Tue, 29 Jan 2019 07:47:58 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0T7lwYv093969; Tue, 29 Jan 2019 07:47:58 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201901290747.x0T7lwYv093969@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Tue, 29 Jan 2019 07:47:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343544 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: delphij X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 343544 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7CF7C70C03 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.948,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2019 07:47:59 -0000 Author: delphij Date: Tue Jan 29 07:47:57 2019 New Revision: 343544 URL: https://svnweb.freebsd.org/changeset/base/343544 Log: MFC r343038: Use TD_IS_IDLETHREAD instead of unrolled version. Modified: stable/12/sys/kern/kern_ktr.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_ktr.c ============================================================================== --- stable/12/sys/kern/kern_ktr.c Tue Jan 29 04:08:49 2019 (r343543) +++ stable/12/sys/kern/kern_ktr.c Tue Jan 29 07:47:57 2019 (r343544) @@ -341,7 +341,7 @@ ktr_tracepoint(uint64_t mask, const char *file, int li #ifdef KTR_ALQ if (ktr_alq_enabled) { if (td->td_critnest == 0 && - (td->td_flags & TDF_IDLETD) == 0 && + (TD_IS_IDLETHREAD(td)) == 0 && td != ald_thread) { if (ktr_alq_max && ktr_alq_cnt > ktr_alq_max) goto done; From owner-svn-src-stable-12@freebsd.org Tue Jan 29 17:49:38 2019 Return-Path: Delivered-To: svn-src-stable-12@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 CE6CC14C553A; Tue, 29 Jan 2019 17:49:38 +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 75FCF91918; Tue, 29 Jan 2019 17:49:38 +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 6B058B155; Tue, 29 Jan 2019 17:49:38 +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 x0THncTN017782; Tue, 29 Jan 2019 17:49:38 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0THncHI017781; Tue, 29 Jan 2019 17:49:38 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201901291749.x0THncHI017781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 29 Jan 2019 17:49:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343553 - stable/12/sys/netpfil/pf X-SVN-Group: stable-12 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/12/sys/netpfil/pf X-SVN-Commit-Revision: 343553 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 75FCF91918 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)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2019 17:49:39 -0000 Author: kp Date: Tue Jan 29 17:49:38 2019 New Revision: 343553 URL: https://svnweb.freebsd.org/changeset/base/343553 Log: MFC r343295: pf: Validate psn_len in DIOCGETSRCNODES psn_len is controlled by user space, but we allocated memory based on it. Check how much memory we might need at most (i.e. how many source nodes we have) and limit the allocation to that. Reported by: markj Modified: stable/12/sys/netpfil/pf/pf_ioctl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- stable/12/sys/netpfil/pf/pf_ioctl.c Tue Jan 29 14:31:41 2019 (r343552) +++ stable/12/sys/netpfil/pf/pf_ioctl.c Tue Jan 29 17:49:38 2019 (r343553) @@ -3577,14 +3577,18 @@ DIOCCHANGEADDR_error: struct pf_src_node *n, *p, *pstore; uint32_t i, nr = 0; + for (i = 0, sh = V_pf_srchash; i <= pf_srchashmask; + i++, sh++) { + PF_HASHROW_LOCK(sh); + LIST_FOREACH(n, &sh->nodes, entry) + nr++; + PF_HASHROW_UNLOCK(sh); + } + + psn->psn_len = min(psn->psn_len, + sizeof(struct pf_src_node) * nr); + if (psn->psn_len == 0) { - for (i = 0, sh = V_pf_srchash; i <= pf_srchashmask; - i++, sh++) { - PF_HASHROW_LOCK(sh); - LIST_FOREACH(n, &sh->nodes, entry) - nr++; - PF_HASHROW_UNLOCK(sh); - } psn->psn_len = sizeof(struct pf_src_node) * nr; break; } From owner-svn-src-stable-12@freebsd.org Tue Jan 29 17:52:43 2019 Return-Path: Delivered-To: svn-src-stable-12@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 567CA14C57FD; Tue, 29 Jan 2019 17:52:43 +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 EADEC91EB1; Tue, 29 Jan 2019 17:52:42 +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 DB52DB327; Tue, 29 Jan 2019 17:52:42 +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 x0THqgoq022710; Tue, 29 Jan 2019 17:52:42 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0THqg9t022709; Tue, 29 Jan 2019 17:52:42 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201901291752.x0THqg9t022709@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 29 Jan 2019 17:52:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343555 - stable/12/tests/sys/netpfil/pf/ioctl X-SVN-Group: stable-12 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/12/tests/sys/netpfil/pf/ioctl X-SVN-Commit-Revision: 343555 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: EADEC91EB1 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.957,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2019 17:52:43 -0000 Author: kp Date: Tue Jan 29 17:52:42 2019 New Revision: 343555 URL: https://svnweb.freebsd.org/changeset/base/343555 Log: MFC r343297: pf tests: Check size validation in DIOCGETSRCNODES Ensure that invalid sizes for DIOCGETSRCNODES do not cause panics. Modified: stable/12/tests/sys/netpfil/pf/ioctl/validation.c Directory Properties: stable/12/ (props changed) Modified: stable/12/tests/sys/netpfil/pf/ioctl/validation.c ============================================================================== --- stable/12/tests/sys/netpfil/pf/ioctl/validation.c Tue Jan 29 17:49:39 2019 (r343554) +++ stable/12/tests/sys/netpfil/pf/ioctl/validation.c Tue Jan 29 17:52:42 2019 (r343555) @@ -753,6 +753,38 @@ ATF_TC_CLEANUP(commit, tc) COMMON_CLEANUP(); } +ATF_TC_WITH_CLEANUP(getsrcnodes); +ATF_TC_HEAD(getsrcnodes, tc) +{ + atf_tc_set_md_var(tc, "require.user", "root"); +} + +ATF_TC_BODY(getsrcnodes, tc) +{ + struct pfioc_src_nodes psn; + + COMMON_HEAD(); + + bzero(&psn, sizeof(psn)); + + psn.psn_len = -1; + if (ioctl(dev, DIOCGETSRCNODES, &psn) != 0) + atf_tc_fail("request with size -1 failed"); + + psn.psn_len = 1 << 30; + if (ioctl(dev, DIOCGETSRCNODES, &psn) != 0) + atf_tc_fail("request with size << 30 failed"); + + psn.psn_len = 1 << 31; + if (ioctl(dev, DIOCGETSRCNODES, &psn) != 0) + atf_tc_fail("request with size << 30 failed"); +} + +ATF_TC_CLEANUP(getsrcnodes, tc) +{ + COMMON_CLEANUP(); +} + ATF_TP_ADD_TCS(tp) { ATF_TP_ADD_TC(tp, addtables); @@ -772,6 +804,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_ADD_TC(tp, cxbegin); ATF_TP_ADD_TC(tp, cxrollback); ATF_TP_ADD_TC(tp, commit); + ATF_TP_ADD_TC(tp, getsrcnodes); return (atf_no_error()); } From owner-svn-src-stable-12@freebsd.org Tue Jan 29 18:06:37 2019 Return-Path: Delivered-To: svn-src-stable-12@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 BF0CF14C5D9C; Tue, 29 Jan 2019 18:06:36 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 650AC926FC; Tue, 29 Jan 2019 18:06:36 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 594DAB4DE; Tue, 29 Jan 2019 18:06:36 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x0TI6aSL027873; Tue, 29 Jan 2019 18:06:36 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0TI6ald027872; Tue, 29 Jan 2019 18:06:36 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201901291806.x0TI6ald027872@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 29 Jan 2019 18:06:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343556 - stable/12/sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/12/sys/net X-SVN-Commit-Revision: 343556 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 650AC926FC 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.957,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2019 18:06:37 -0000 Author: brooks Date: Tue Jan 29 18:06:35 2019 New Revision: 343556 URL: https://svnweb.freebsd.org/changeset/base/343556 Log: MFC r343305: Rework CASE_IOC_IFGROUPREQ() to require a case before the macro. This is more compatible with formatting tools and looks more normal. Reported by: jhb (on a different review) Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D18442 Modified: stable/12/sys/net/if.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/if.c ============================================================================== --- stable/12/sys/net/if.c Tue Jan 29 17:52:42 2019 (r343555) +++ stable/12/sys/net/if.c Tue Jan 29 18:06:35 2019 (r343556) @@ -168,14 +168,14 @@ struct ifmediareq32 { #define SIOCGIFXMEDIA32 _IOC_NEWTYPE(SIOCGIFXMEDIA, struct ifmediareq32) #define _CASE_IOC_IFGROUPREQ_32(cmd) \ - case _IOC_NEWTYPE((cmd), struct ifgroupreq32): + _IOC_NEWTYPE((cmd), struct ifgroupreq32): case #else /* !COMPAT_FREEBSD32 */ #define _CASE_IOC_IFGROUPREQ_32(cmd) #endif /* !COMPAT_FREEBSD32 */ #define CASE_IOC_IFGROUPREQ(cmd) \ _CASE_IOC_IFGROUPREQ_32(cmd) \ - case (cmd) + (cmd) union ifreq_union { struct ifreq ifr; @@ -2892,7 +2892,7 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, error = if_gethwaddr(ifp, ifr); break; - CASE_IOC_IFGROUPREQ(SIOCAIFGROUP): + case CASE_IOC_IFGROUPREQ(SIOCAIFGROUP): error = priv_check(td, PRIV_NET_ADDIFGROUP); if (error) return (error); @@ -2901,12 +2901,12 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, caddr_t data, return (error); break; - CASE_IOC_IFGROUPREQ(SIOCGIFGROUP): + case CASE_IOC_IFGROUPREQ(SIOCGIFGROUP): if ((error = if_getgroup((struct ifgroupreq *)data, ifp))) return (error); break; - CASE_IOC_IFGROUPREQ(SIOCDIFGROUP): + case CASE_IOC_IFGROUPREQ(SIOCDIFGROUP): error = priv_check(td, PRIV_NET_DELIFGROUP); if (error) return (error); @@ -3061,7 +3061,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, s error = if_clone_list((struct if_clonereq *)data); goto out_noref; - CASE_IOC_IFGROUPREQ(SIOCGIFGMEMB): + case CASE_IOC_IFGROUPREQ(SIOCGIFGMEMB): error = if_getgroupmembers((struct ifgroupreq *)data); goto out_noref; From owner-svn-src-stable-12@freebsd.org Tue Jan 29 18:08:48 2019 Return-Path: Delivered-To: svn-src-stable-12@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 D10E814C5E8D; Tue, 29 Jan 2019 18:08:47 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7812D9288D; Tue, 29 Jan 2019 18:08:47 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B98DB4E2; Tue, 29 Jan 2019 18:08:47 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x0TI8l3U028014; Tue, 29 Jan 2019 18:08:47 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0TI8kFL028012; Tue, 29 Jan 2019 18:08:46 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201901291808.x0TI8kFL028012@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 29 Jan 2019 18:08:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343557 - stable/12/share/man/man9 X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/12/share/man/man9 X-SVN-Commit-Revision: 343557 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7812D9288D 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.957,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Jan 2019 18:08:48 -0000 Author: brooks Date: Tue Jan 29 18:08:46 2019 New Revision: 343557 URL: https://svnweb.freebsd.org/changeset/base/343557 Log: MFC r343366: Remove documentation for the nonexistant cred_update_thread(9). This was a tangential change submitted as part of D18930. Submitted by: jack@gandi.net Modified: stable/12/share/man/man9/Makefile stable/12/share/man/man9/ucred.9 Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man9/Makefile ============================================================================== --- stable/12/share/man/man9/Makefile Tue Jan 29 18:06:35 2019 (r343556) +++ stable/12/share/man/man9/Makefile Tue Jan 29 18:08:46 2019 (r343557) @@ -2093,8 +2093,7 @@ MLINKS+=timeout.9 callout.9 \ timeout.9 callout_stop.9 \ timeout.9 callout_when.9 \ timeout.9 untimeout.9 -MLINKS+=ucred.9 cred_update_thread.9 \ - ucred.9 crcopy.9 \ +MLINKS+=ucred.9 crcopy.9 \ ucred.9 crcopysafe.9 \ ucred.9 crdup.9 \ ucred.9 crfree.9 \ Modified: stable/12/share/man/man9/ucred.9 ============================================================================== --- stable/12/share/man/man9/ucred.9 Tue Jan 29 18:06:35 2019 (r343556) +++ stable/12/share/man/man9/ucred.9 Tue Jan 29 18:08:46 2019 (r343557) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 27, 2017 +.Dd January 23, 2019 .Dt UCRED 9 .Os .Sh NAME @@ -36,8 +36,7 @@ .Nm crfree , .Nm crcopy , .Nm crdup , -.Nm cru2x , -.Nm cred_update_thread +.Nm cru2x .Nd "functions related to user credentials" .Sh SYNOPSIS .In sys/param.h @@ -58,8 +57,6 @@ .Fn crsetgroups "struct ucred *cr" "int ngrp" "gid_t *groups" .Ft void .Fn cru2x "struct ucred *cr" "struct xucred *xcr" -.Ft void -.Fn cred_update_thread "struct thread *td" .Sh DESCRIPTION The .Nm @@ -147,11 +144,6 @@ the former (e.g., .Va cr_version ) . .Pp -The -.Fn cred_update_thread -function sets the credentials of -.Fa td -to that of its process, freeing its old credential if required. .Sh RETURN VALUES .Fn crget , .Fn crhold , From owner-svn-src-stable-12@freebsd.org Wed Jan 30 02:39:09 2019 Return-Path: Delivered-To: svn-src-stable-12@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 63B0514B0C9C; Wed, 30 Jan 2019 02:39:09 +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 0792D760EB; Wed, 30 Jan 2019 02:39:09 +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 ED42118EBA; Wed, 30 Jan 2019 02:39:08 +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 x0U2d8wr092603; Wed, 30 Jan 2019 02:39:08 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0U2d8qj092602; Wed, 30 Jan 2019 02:39:08 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201901300239.x0U2d8qj092602@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Wed, 30 Jan 2019 02:39:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343568 - in stable: 10/contrib/ipfilter/man 11/contrib/ipfilter/man 12/contrib/ipfilter/man X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 10/contrib/ipfilter/man 11/contrib/ipfilter/man 12/contrib/ipfilter/man X-SVN-Commit-Revision: 343568 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0792D760EB 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.938,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jan 2019 02:39:09 -0000 Author: cy Date: Wed Jan 30 02:39:08 2019 New Revision: 343568 URL: https://svnweb.freebsd.org/changeset/base/343568 Log: MFC r343486: Fix a typo. Modified: stable/12/contrib/ipfilter/man/ipnat.5 Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/10/contrib/ipfilter/man/ipnat.5 stable/11/contrib/ipfilter/man/ipnat.5 Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/12/contrib/ipfilter/man/ipnat.5 ============================================================================== --- stable/12/contrib/ipfilter/man/ipnat.5 Wed Jan 30 02:07:13 2019 (r343567) +++ stable/12/contrib/ipfilter/man/ipnat.5 Wed Jan 30 02:39:08 2019 (r343568) @@ -104,7 +104,7 @@ map le0 10.0.0.0/8 -> 192.168.55.0/24 portmap tcp/udp In this instance, the word "auto" tells IPFilter to calculate a private range of port numbers for each address on the LHS to use without fear of them being trampled by others. This can lead to problems if there are -connections being generated mire quickly than IPFilter can expire them. +connections being generated more quickly than IPFilter can expire them. In this instance, and if we want to get away from a private range of port numbers, we can say: .nf From owner-svn-src-stable-12@freebsd.org Wed Jan 30 11:56:11 2019 Return-Path: Delivered-To: svn-src-stable-12@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 8280214BD972; Wed, 30 Jan 2019 11:56:11 +0000 (UTC) (envelope-from marius@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 28B7B8EB41; Wed, 30 Jan 2019 11:56:11 +0000 (UTC) (envelope-from marius@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 1C3D71EDD9; Wed, 30 Jan 2019 11:56:11 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x0UBuAeA084592; Wed, 30 Jan 2019 11:56:10 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0UBuAbS084591; Wed, 30 Jan 2019 11:56:10 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201901301156.x0UBuAbS084591@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Wed, 30 Jan 2019 11:56:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343575 - stable/12/sys/net X-SVN-Group: stable-12 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/12/sys/net X-SVN-Commit-Revision: 343575 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 28B7B8EB41 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)[-0.999,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-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jan 2019 11:56:11 -0000 Author: marius Date: Wed Jan 30 11:56:10 2019 New Revision: 343575 URL: https://svnweb.freebsd.org/changeset/base/343575 Log: MFC: r343481 - In _iflib_fl_refill(), don't mark an RX buffer as available in the corresponding bitmap before adding an mbuf has actually succeeded. Previously, m_gethdr(M_NOWAIT, ...) failing caused a "hole" in the RX ring but not in its bitmap. One implication of such a hole was that in a subsequent call to _iflib_fl_refill() with the RX buffer accounting still indicating another reclaimable buffer, bit_ffc(3) nevertheless returned -1 in frag_idx which in turn caused havoc when used as an index. Thus, additionally assert that frag_idx is 0 or greater. Another possible consequence of a hole in the RX ring was a NULL- dereference when trying to use the unallocated mbuf, for example in iflib_rxd_pkt_get(). This bug was introduced with r341095, MFCed to stable/12 in r343304. While at it, make the variable declarations in _iflib_fl_refill() conform to style(9) and remove redundant checks already performed by bit_ffc{,_at}(3). - In iflib_queues_alloc(), don't pass redundant M_ZERO to bit_alloc(3). Reported and tested by: pho Modified: stable/12/sys/net/iflib.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/net/iflib.c ============================================================================== --- stable/12/sys/net/iflib.c Wed Jan 30 11:40:12 2019 (r343574) +++ stable/12/sys/net/iflib.c Wed Jan 30 11:56:10 2019 (r343575) @@ -1916,27 +1916,27 @@ _rxq_refill_cb(void *arg, bus_dma_segment_t *segs, int static void _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int count) { + struct if_rxd_update iru; + struct rxq_refill_cb_arg cb_arg; struct mbuf *m; - int idx, frag_idx = fl->ifl_fragidx; - int pidx = fl->ifl_pidx; caddr_t cl, *sd_cl; struct mbuf **sd_m; - struct if_rxd_update iru; - struct rxq_refill_cb_arg cb_arg; bus_dmamap_t *sd_map; - int n, i = 0; bus_addr_t bus_addr, *sd_ba; - int err; + int err, frag_idx, i, idx, n, pidx; qidx_t credits; sd_m = fl->ifl_sds.ifsd_m; sd_map = fl->ifl_sds.ifsd_map; sd_cl = fl->ifl_sds.ifsd_cl; sd_ba = fl->ifl_sds.ifsd_ba; + pidx = fl->ifl_pidx; idx = pidx; + frag_idx = fl->ifl_fragidx; credits = fl->ifl_credits; - n = count; + i = 0; + n = count; MPASS(n > 0); MPASS(credits + n <= fl->ifl_size); @@ -1958,9 +1958,11 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun * * If the cluster is still set then we know a minimum sized packet was received */ - bit_ffc_at(fl->ifl_rx_bitmap, frag_idx, fl->ifl_size, &frag_idx); - if ((frag_idx < 0) || (frag_idx >= fl->ifl_size)) - bit_ffc(fl->ifl_rx_bitmap, fl->ifl_size, &frag_idx); + bit_ffc_at(fl->ifl_rx_bitmap, frag_idx, fl->ifl_size, + &frag_idx); + if (frag_idx < 0) + bit_ffc(fl->ifl_rx_bitmap, fl->ifl_size, &frag_idx); + MPASS(frag_idx >= 0); if ((cl = sd_cl[frag_idx]) == NULL) { if ((cl = m_cljget(NULL, M_NOWAIT, fl->ifl_buf_size)) == NULL) break; @@ -1990,12 +1992,12 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun bus_addr = sd_ba[frag_idx]; } - bit_set(fl->ifl_rx_bitmap, frag_idx); MPASS(sd_m[frag_idx] == NULL); if ((m = m_gethdr(M_NOWAIT, MT_NOINIT)) == NULL) { break; } sd_m[frag_idx] = m; + bit_set(fl->ifl_rx_bitmap, frag_idx); #if MEMORY_LOGGING fl->ifl_m_enqueued++; #endif @@ -2020,7 +2022,6 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun fl->ifl_pidx = idx; fl->ifl_credits = credits; } - } if (i) { @@ -4890,7 +4891,6 @@ iflib_device_deregister(if_ctx_t ctx) for (j = 0, fl = rxq->ifr_fl; j < rxq->ifr_nfl; j++, fl++) free(fl->ifl_rx_bitmap, M_IFLIB); - } tqg = qgroup_if_config_tqg; if (ctx->ifc_admin_task.gt_uniq != NULL) @@ -5298,7 +5298,8 @@ iflib_queues_alloc(if_ctx_t ctx) } for (j = 0, fl = rxq->ifr_fl; j < rxq->ifr_nfl; j++, fl++) - fl->ifl_rx_bitmap = bit_alloc(fl->ifl_size, M_IFLIB, M_WAITOK|M_ZERO); + fl->ifl_rx_bitmap = bit_alloc(fl->ifl_size, M_IFLIB, + M_WAITOK); } /* TXQs */ From owner-svn-src-stable-12@freebsd.org Wed Jan 30 23:48:12 2019 Return-Path: Delivered-To: svn-src-stable-12@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 1776C1332C52; Wed, 30 Jan 2019 23:48:12 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B281D8A6FA; Wed, 30 Jan 2019 23:48:11 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 90088267C6; Wed, 30 Jan 2019 23:48:11 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x0UNmBdg058973; Wed, 30 Jan 2019 23:48:11 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0UNmBCm058971; Wed, 30 Jan 2019 23:48:11 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201901302348.x0UNmBCm058971@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 30 Jan 2019 23:48:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343597 - in stable/12/sys: compat/freebsd32 kern X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in stable/12/sys: compat/freebsd32 kern X-SVN-Commit-Revision: 343597 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: B281D8A6FA 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]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jan 2019 23:48:12 -0000 Author: brooks Date: Wed Jan 30 23:48:10 2019 New Revision: 343597 URL: https://svnweb.freebsd.org/changeset/base/343597 Log: Regen after r343596: enable ppoll in capability mode. PR: 232495 Modified: stable/12/sys/compat/freebsd32/freebsd32_sysent.c stable/12/sys/kern/init_sysent.c Modified: stable/12/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- stable/12/sys/compat/freebsd32/freebsd32_sysent.c Wed Jan 30 23:47:21 2019 (r343596) +++ stable/12/sys/compat/freebsd32/freebsd32_sysent.c Wed Jan 30 23:48:10 2019 (r343597) @@ -624,7 +624,7 @@ struct sysent freebsd32_sysent[] = { #else { AS(freebsd32_procctl_args), (sy_call_t *)freebsd32_procctl, AUE_PROCCTL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 544 = freebsd32_procctl */ #endif - { AS(freebsd32_ppoll_args), (sy_call_t *)freebsd32_ppoll, AUE_POLL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 545 = freebsd32_ppoll */ + { AS(freebsd32_ppoll_args), (sy_call_t *)freebsd32_ppoll, AUE_POLL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 545 = freebsd32_ppoll */ { AS(freebsd32_futimens_args), (sy_call_t *)freebsd32_futimens, AUE_FUTIMES, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 546 = freebsd32_futimens */ { AS(freebsd32_utimensat_args), (sy_call_t *)freebsd32_utimensat, AUE_FUTIMESAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 547 = freebsd32_utimensat */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 548 = obsolete numa_getaffinity */ Modified: stable/12/sys/kern/init_sysent.c ============================================================================== --- stable/12/sys/kern/init_sysent.c Wed Jan 30 23:47:21 2019 (r343596) +++ stable/12/sys/kern/init_sysent.c Wed Jan 30 23:48:10 2019 (r343597) @@ -594,7 +594,7 @@ struct sysent sysent[] = { { AS(pipe2_args), (sy_call_t *)sys_pipe2, AUE_PIPE, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 542 = pipe2 */ { AS(aio_mlock_args), (sy_call_t *)sys_aio_mlock, AUE_AIO_MLOCK, NULL, 0, 0, 0, SY_THR_STATIC }, /* 543 = aio_mlock */ { AS(procctl_args), (sy_call_t *)sys_procctl, AUE_PROCCTL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 544 = procctl */ - { AS(ppoll_args), (sy_call_t *)sys_ppoll, AUE_POLL, NULL, 0, 0, 0, SY_THR_STATIC }, /* 545 = ppoll */ + { AS(ppoll_args), (sy_call_t *)sys_ppoll, AUE_POLL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 545 = ppoll */ { AS(futimens_args), (sy_call_t *)sys_futimens, AUE_FUTIMES, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 546 = futimens */ { AS(utimensat_args), (sy_call_t *)sys_utimensat, AUE_FUTIMESAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 547 = utimensat */ { 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0, 0, SY_THR_ABSENT }, /* 548 = obsolete numa_getaffinity */ From owner-svn-src-stable-12@freebsd.org Wed Jan 30 23:47:23 2019 Return-Path: Delivered-To: svn-src-stable-12@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 0E56A1332C39; Wed, 30 Jan 2019 23:47:23 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A36288A5FA; Wed, 30 Jan 2019 23:47:22 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 91524267C1; Wed, 30 Jan 2019 23:47:22 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x0UNlMk5058872; Wed, 30 Jan 2019 23:47:22 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0UNlMBi058870; Wed, 30 Jan 2019 23:47:22 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201901302347.x0UNlMBi058870@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 30 Jan 2019 23:47:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343596 - in stable/12/sys: compat/freebsd32 kern X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in stable/12/sys: compat/freebsd32 kern X-SVN-Commit-Revision: 343596 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A36288A5FA 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.938,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jan 2019 23:47:23 -0000 Author: brooks Date: Wed Jan 30 23:47:21 2019 New Revision: 343596 URL: https://svnweb.freebsd.org/changeset/base/343596 Log: MFC r340129, r340195, r340198 r340129: capsicum: allow ppoll(2) in capability mode We already allow to use poll(2). There is no reason to disallow ppoll(2). PR: 232495 Submitted by: Stefan Grundmann Reviewed by: cem, oshogbo r340195: capsicum: Add ppoll and freebsd32_ppoll to compat32. PR: 232495 Pointed out by: brooks r340198: Remove ppoll. freebsd32 doesn't define a ppoll syscall. Reported by: jhb Modified: stable/12/sys/compat/freebsd32/capabilities.conf stable/12/sys/kern/capabilities.conf Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/freebsd32/capabilities.conf ============================================================================== --- stable/12/sys/compat/freebsd32/capabilities.conf Wed Jan 30 23:38:42 2019 (r343595) +++ stable/12/sys/compat/freebsd32/capabilities.conf Wed Jan 30 23:47:21 2019 (r343596) @@ -204,6 +204,7 @@ pdkill freebsd32_pipe pipe2 poll +freebsd32_ppoll freebsd32_posix_fallocate freebsd32_pread freebsd32_preadv Modified: stable/12/sys/kern/capabilities.conf ============================================================================== --- stable/12/sys/kern/capabilities.conf Wed Jan 30 23:38:42 2019 (r343595) +++ stable/12/sys/kern/capabilities.conf Wed Jan 30 23:47:21 2019 (r343596) @@ -486,9 +486,9 @@ pipe2 ## ## Allow poll(2), which will be scoped by capability rights. -## XXXRW: We don't yet do that scoping. ## poll +ppoll ## ## Allow I/O-related file descriptors, subject to capability rights. From owner-svn-src-stable-12@freebsd.org Wed Jan 30 23:36:04 2019 Return-Path: Delivered-To: svn-src-stable-12@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 415641332A34; Wed, 30 Jan 2019 23:36:04 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D397C8A0E9; Wed, 30 Jan 2019 23:36:03 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A79822661C; Wed, 30 Jan 2019 23:36:03 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x0UNa3ic053782; Wed, 30 Jan 2019 23:36:03 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0UNa3Tv053781; Wed, 30 Jan 2019 23:36:03 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201901302336.x0UNa3Tv053781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 30 Jan 2019 23:36:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343594 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 343594 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D397C8A0E9 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.938,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Jan 2019 23:36:04 -0000 Author: brooks Date: Wed Jan 30 23:36:02 2019 New Revision: 343594 URL: https://svnweb.freebsd.org/changeset/base/343594 Log: MFC r340242: Add a top-level make target to rebuild all sysent files. The sysent target is useful when changing makesyscalls.sh, when making paired changes to syscalls.master files, or in a future where freebsd32 sysent entries are built from the default syscalls.master. Reviewed by: bdrewery Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D17899 Modified: stable/12/Makefile stable/12/Makefile.inc1 Directory Properties: stable/12/ (props changed) Modified: stable/12/Makefile ============================================================================== --- stable/12/Makefile Wed Jan 30 21:46:12 2019 (r343593) +++ stable/12/Makefile Wed Jan 30 23:36:02 2019 (r343594) @@ -33,6 +33,7 @@ # targets - Print a list of supported TARGET/TARGET_ARCH pairs # for world and kernel targets. # toolchains - Build a toolchain for all world and kernel targets. +# sysent - (Re)build syscall entries from syscalls.master. # xdev - xdev-build + xdev-install for the architecture # specified with TARGET and TARGET_ARCH. # xdev-build - Build cross-development tools. @@ -136,6 +137,7 @@ TGTS= all all-man buildenv buildenvvars buildkernel bu reinstallkernel reinstallkernel.debug \ installworld kernel-toolchain libraries maninstall \ obj objlink showconfig tags toolchain update \ + sysent \ _worldtmp _legacy _bootstrap-tools _cleanobj _obj \ _build-tools _build-metadata _cross-tools _includes _libraries \ build32 distribute32 install32 buildsoft distributesoft installsoft \ Modified: stable/12/Makefile.inc1 ============================================================================== --- stable/12/Makefile.inc1 Wed Jan 30 21:46:12 2019 (r343593) +++ stable/12/Makefile.inc1 Wed Jan 30 23:36:02 2019 (r343594) @@ -1415,6 +1415,18 @@ packageworld: .PHONY . endif .endfor +_sysent_dirs= sys/kern +_sysent_dirs+= sys/compat/freebsd32 +_sysent_dirs+= sys/i386/ibcs2 +_sysent_dirs+= sys/amd64/linux \ + sys/amd64/linux32 \ + sys/arm64/linux \ + sys/i386/linux +sysent: .PHONY +.for _dir in ${_sysent_dirs} + ${_+_}${MAKE} -C ${.CURDIR}/${_dir} sysent +.endfor + # # reinstall # From owner-svn-src-stable-12@freebsd.org Thu Jan 31 07:08:38 2019 Return-Path: Delivered-To: svn-src-stable-12@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 A04EE1348EB3; Thu, 31 Jan 2019 07:08:38 +0000 (UTC) (envelope-from araujo@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 432FD73C77; Thu, 31 Jan 2019 07:08:38 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2BE0B3D94; Thu, 31 Jan 2019 07:08:38 +0000 (UTC) (envelope-from araujo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x0V78c9f090992; Thu, 31 Jan 2019 07:08:38 GMT (envelope-from araujo@FreeBSD.org) Received: (from araujo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0V78cla090991; Thu, 31 Jan 2019 07:08:38 GMT (envelope-from araujo@FreeBSD.org) Message-Id: <201901310708.x0V78cla090991@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: araujo set sender to araujo@FreeBSD.org using -f From: Marcelo Araujo Date: Thu, 31 Jan 2019 07:08:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343602 - stable/12/usr.sbin/bhyve X-SVN-Group: stable-12 X-SVN-Commit-Author: araujo X-SVN-Commit-Paths: stable/12/usr.sbin/bhyve X-SVN-Commit-Revision: 343602 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 432FD73C77 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.960,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)[-0.999,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jan 2019 07:08:38 -0000 Author: araujo Date: Thu Jan 31 07:08:37 2019 New Revision: 343602 URL: https://svnweb.freebsd.org/changeset/base/343602 Log: MFC r343077: Fix broken uart on Win2016 guest. Obtained from: Joyent (commit/2bf1a940afbd1382faff159e7c93c72779ca10f4) Modified: stable/12/usr.sbin/bhyve/uart_emul.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.sbin/bhyve/uart_emul.c ============================================================================== --- stable/12/usr.sbin/bhyve/uart_emul.c Thu Jan 31 05:20:11 2019 (r343601) +++ stable/12/usr.sbin/bhyve/uart_emul.c Thu Jan 31 07:08:37 2019 (r343602) @@ -431,6 +431,13 @@ uart_write(struct uart_softc *sc, int offset, uint8_t sc->thre_int_pending = true; break; case REG_IER: + /* Assert an interrupt if re-enabling the THRE intr, since we + * always report THRE as active in the status register. + */ + if ((sc->ier & IER_ETXRDY) == 0 && + (value & IER_ETXRDY) != 0) { + sc->thre_int_pending = true; + } /* * Apply mask so that bits 4-7 are 0 * Also enables bits 0-3 only if they're 1 From owner-svn-src-stable-12@freebsd.org Thu Jan 31 11:36:29 2019 Return-Path: Delivered-To: svn-src-stable-12@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 D4FFB1359310; Thu, 31 Jan 2019 11:36:29 +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 7505288C1E; Thu, 31 Jan 2019 11:36:29 +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 688206CCF; Thu, 31 Jan 2019 11:36:29 +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 x0VBaT3B032674; Thu, 31 Jan 2019 11:36:29 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0VBaT41032673; Thu, 31 Jan 2019 11:36:29 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201901311136.x0VBaT41032673@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Thu, 31 Jan 2019 11:36:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343605 - in stable: 10/sys/geom/uzip 11/sys/geom/uzip 12/sys/geom/uzip X-SVN-Group: stable-12 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: in stable: 10/sys/geom/uzip 11/sys/geom/uzip 12/sys/geom/uzip X-SVN-Commit-Revision: 343605 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 7505288C1E 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)[-0.999,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jan 2019 11:36:30 -0000 Author: avos Date: Thu Jan 31 11:36:28 2019 New Revision: 343605 URL: https://svnweb.freebsd.org/changeset/base/343605 Log: MFC r343473: geom_uzip(4): move NULL pointer KASSERT check before it is dereferenced PR: 203499 Submitted by: MFC r343475: geom_uzip(4): set 'gp != NULL' assertion on top of the function There was yet another access to this variable in g_trace() few lines upper. PR: 203499 Reported by: cem Modified: stable/12/sys/geom/uzip/g_uzip.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/geom/uzip/g_uzip.c stable/11/sys/geom/uzip/g_uzip.c Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/12/sys/geom/uzip/g_uzip.c ============================================================================== --- stable/12/sys/geom/uzip/g_uzip.c Thu Jan 31 11:12:31 2019 (r343604) +++ stable/12/sys/geom/uzip/g_uzip.c Thu Jan 31 11:36:28 2019 (r343605) @@ -886,6 +886,7 @@ g_uzip_destroy_geom(struct gctl_req *req, struct g_cla { struct g_provider *pp; + KASSERT(gp != NULL, ("NULL geom")); g_trace(G_T_TOPOLOGY, "%s(%s, %s)", __func__, mp->name, gp->name); g_topology_assert(); @@ -895,7 +896,6 @@ g_uzip_destroy_geom(struct gctl_req *req, struct g_cla return (ENXIO); } - KASSERT(gp != NULL, ("NULL geom")); pp = LIST_FIRST(&gp->provider); KASSERT(pp != NULL, ("NULL provider")); if (pp->acr > 0 || pp->acw > 0 || pp->ace > 0) From owner-svn-src-stable-12@freebsd.org Thu Jan 31 16:43:36 2019 Return-Path: Delivered-To: svn-src-stable-12@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 AD6AC14AFA7B; Thu, 31 Jan 2019 16:43:36 +0000 (UTC) (envelope-from tsoome@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 50D2596730; Thu, 31 Jan 2019 16:43:36 +0000 (UTC) (envelope-from tsoome@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 4380AA1D5; Thu, 31 Jan 2019 16:43:36 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x0VGha7G097321; Thu, 31 Jan 2019 16:43:36 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0VGhaPL097320; Thu, 31 Jan 2019 16:43:36 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201901311643.x0VGhaPL097320@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Thu, 31 Jan 2019 16:43:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343612 - stable/12/stand/libsa/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: stable/12/stand/libsa/zfs X-SVN-Commit-Revision: 343612 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 50D2596730 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.982,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jan 2019 16:43:36 -0000 Author: tsoome Date: Thu Jan 31 16:43:35 2019 New Revision: 343612 URL: https://svnweb.freebsd.org/changeset/base/343612 Log: MFC r343123: loader should ignore active multi_vdev_crash_dump feature on zpool Since the loader zfs reader does not need to read the dump zvol, we can just enable the feature. illumos issue #9051 https://www.illumos.org/issues/9051 Modified: stable/12/stand/libsa/zfs/zfsimpl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/libsa/zfs/zfsimpl.c ============================================================================== --- stable/12/stand/libsa/zfs/zfsimpl.c Thu Jan 31 16:21:09 2019 (r343611) +++ stable/12/stand/libsa/zfs/zfsimpl.c Thu Jan 31 16:43:35 2019 (r343612) @@ -62,6 +62,7 @@ static const char *features_for_read[] = { "org.illumos:sha512", "org.illumos:skein", "org.zfsonlinux:large_dnode", + "com.joyent:multi_vdev_crash_dump", NULL }; From owner-svn-src-stable-12@freebsd.org Thu Jan 31 17:07:01 2019 Return-Path: Delivered-To: svn-src-stable-12@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 E347D14B0703; Thu, 31 Jan 2019 17:07:00 +0000 (UTC) (envelope-from tsoome@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 87D11974F5; Thu, 31 Jan 2019 17:07:00 +0000 (UTC) (envelope-from tsoome@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 7246DA546; Thu, 31 Jan 2019 17:07:00 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x0VH70oC007835; Thu, 31 Jan 2019 17:07:00 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0VH70jX007831; Thu, 31 Jan 2019 17:07:00 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201901311707.x0VH70jX007831@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Thu, 31 Jan 2019 17:07:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343615 - stable/12/stand/libsa X-SVN-Group: stable-12 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: stable/12/stand/libsa X-SVN-Commit-Revision: 343615 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 87D11974F5 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)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.982,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jan 2019 17:07:01 -0000 Author: tsoome Date: Thu Jan 31 17:06:59 2019 New Revision: 343615 URL: https://svnweb.freebsd.org/changeset/base/343615 Log: MFC r343124: libsa: add asprintf() asprintf() is a nice tool for string processing. Modified: stable/12/stand/libsa/printf.c stable/12/stand/libsa/stand.h Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/libsa/printf.c ============================================================================== --- stable/12/stand/libsa/printf.c Thu Jan 31 17:04:55 2019 (r343614) +++ stable/12/stand/libsa/printf.c Thu Jan 31 17:06:59 2019 (r343615) @@ -122,6 +122,34 @@ snprint_func(int ch, void *arg) } int +asprintf(char **buf, const char *cfmt, ...) +{ + int retval; + struct print_buf arg; + va_list ap; + + *buf = NULL; + va_start(ap, cfmt); + retval = kvprintf(cfmt, NULL, NULL, 10, ap); + va_end(ap); + if (retval <= 0) + return (-1); + + arg.size = retval + 1; + arg.buf = *buf = malloc(arg.size); + if (*buf == NULL) + return (-1); + + va_start(ap, cfmt); + retval = kvprintf(cfmt, &snprint_func, &arg, 10, ap); + va_end(ap); + + if (arg.size >= 1) + *(arg.buf)++ = 0; + return (retval); +} + +int snprintf(char *buf, size_t size, const char *cfmt, ...) { int retval; Modified: stable/12/stand/libsa/stand.h ============================================================================== --- stable/12/stand/libsa/stand.h Thu Jan 31 17:04:55 2019 (r343614) +++ stable/12/stand/libsa/stand.h Thu Jan 31 17:06:59 2019 (r343615) @@ -268,6 +268,7 @@ extern void *reallocf(void *ptr, size_t size); extern void mallocstats(void); extern int printf(const char *fmt, ...) __printflike(1, 2); +extern int asprintf(char **buf, const char *cfmt, ...) __printflike(2, 3); extern int sprintf(char *buf, const char *cfmt, ...) __printflike(2, 3); extern int snprintf(char *buf, size_t size, const char *cfmt, ...) __printflike(3, 4); extern int vprintf(const char *fmt, __va_list); From owner-svn-src-stable-12@freebsd.org Thu Jan 31 22:06:50 2019 Return-Path: Delivered-To: svn-src-stable-12@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 A9FCD14B9450; Thu, 31 Jan 2019 22:06:50 +0000 (UTC) (envelope-from sef@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 4B71573CC3; Thu, 31 Jan 2019 22:06:47 +0000 (UTC) (envelope-from sef@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 3CF65DBD7; Thu, 31 Jan 2019 22:06:47 +0000 (UTC) (envelope-from sef@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x0VM6lau065758; Thu, 31 Jan 2019 22:06:47 GMT (envelope-from sef@FreeBSD.org) Received: (from sef@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x0VM6lBD065757; Thu, 31 Jan 2019 22:06:47 GMT (envelope-from sef@FreeBSD.org) Message-Id: <201901312206.x0VM6lBD065757@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sef set sender to sef@FreeBSD.org using -f From: Sean Eric Fagan Date: Thu, 31 Jan 2019 22:06:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343623 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: sef X-SVN-Commit-Paths: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 343623 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4B71573CC3 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)[-0.999,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-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jan 2019 22:06:50 -0000 Author: sef Date: Thu Jan 31 22:06:46 2019 New Revision: 343623 URL: https://svnweb.freebsd.org/changeset/base/343623 Log: MFC r342928: Change ZFS quotas to return EINVAL when not present (matches man page). Approved by: mav Reviewed by: markj PR: 234413 Sponsored by: iXsystems Inc Reported by: Emrion Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Jan 31 21:53:03 2019 (r343622) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Thu Jan 31 22:06:46 2019 (r343623) @@ -144,7 +144,7 @@ zfs_getquota(zfsvfs_t *zfsvfs, uid_t id, int isgroup, quotaobj = isgroup ? zfsvfs->z_groupquota_obj : zfsvfs->z_userquota_obj; if (quotaobj == 0 || zfsvfs->z_replay) { - error = ENOENT; + error = EINVAL; goto done; } (void)sprintf(buf, "%llx", (longlong_t)id); From owner-svn-src-stable-12@freebsd.org Fri Feb 1 00:36:16 2019 Return-Path: Delivered-To: svn-src-stable-12@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 E291D14BDB8E; Fri, 1 Feb 2019 00:36:15 +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 8240A83B35; Fri, 1 Feb 2019 00:36:15 +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 73794F5C3; Fri, 1 Feb 2019 00:36:15 +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 x110aFeo047217; Fri, 1 Feb 2019 00:36:15 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x110aEpM047214; Fri, 1 Feb 2019 00:36:14 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201902010036.x110aEpM047214@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 1 Feb 2019 00:36:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343637 - in stable/12/sys/x86: include x86 X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in stable/12/sys/x86: include x86 X-SVN-Commit-Revision: 343637 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8240A83B35 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.976,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Feb 2019 00:36:16 -0000 Author: kib Date: Fri Feb 1 00:36:14 2019 New Revision: 343637 URL: https://svnweb.freebsd.org/changeset/base/343637 Log: MFC r343146: x86 busdma: fix mis-use of bus_addr_t where vm_paddr_t is assumed. Modified: stable/12/sys/x86/include/busdma_impl.h stable/12/sys/x86/x86/busdma_bounce.c stable/12/sys/x86/x86/busdma_machdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/x86/include/busdma_impl.h ============================================================================== --- stable/12/sys/x86/include/busdma_impl.h Fri Feb 1 00:34:18 2019 (r343636) +++ stable/12/sys/x86/include/busdma_impl.h Fri Feb 1 00:36:14 2019 (r343637) @@ -87,7 +87,7 @@ struct bus_dma_impl { }; void bus_dma_dflt_lock(void *arg, bus_dma_lock_op_t op); -int bus_dma_run_filter(struct bus_dma_tag_common *dmat, bus_addr_t paddr); +int bus_dma_run_filter(struct bus_dma_tag_common *dmat, vm_paddr_t paddr); int common_bus_dma_tag_create(struct bus_dma_tag_common *parent, bus_size_t alignment, bus_addr_t boundary, bus_addr_t lowaddr, bus_addr_t highaddr, Modified: stable/12/sys/x86/x86/busdma_bounce.c ============================================================================== --- stable/12/sys/x86/x86/busdma_bounce.c Fri Feb 1 00:34:18 2019 (r343636) +++ stable/12/sys/x86/x86/busdma_bounce.c Fri Feb 1 00:36:14 2019 (r343637) @@ -139,7 +139,7 @@ static int alloc_bounce_pages(bus_dma_tag_t dmat, u_in static int reserve_bounce_pages(bus_dma_tag_t dmat, bus_dmamap_t map, int commit); static bus_addr_t add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, - vm_offset_t vaddr, bus_addr_t addr1, bus_addr_t addr2, bus_size_t size); + vm_offset_t vaddr, vm_paddr_t addr1, vm_paddr_t addr2, bus_size_t size); static void free_bounce_page(bus_dma_tag_t dmat, struct bounce_page *bpage); static void _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map, pmap_t pmap, void *buf, bus_size_t buflen, int flags); @@ -507,7 +507,7 @@ static void _bus_dmamap_count_phys(bus_dma_tag_t dmat, bus_dmamap_t map, vm_paddr_t buf, bus_size_t buflen, int flags) { - bus_addr_t curaddr; + vm_paddr_t curaddr; bus_size_t sgsize; if (map != &nobounce_dmamap && map->pagesneeded == 0) { @@ -536,7 +536,7 @@ _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap { vm_offset_t vaddr; vm_offset_t vendaddr; - bus_addr_t paddr; + vm_paddr_t paddr; bus_size_t sg_len; if (map != &nobounce_dmamap && map->pagesneeded == 0) { @@ -643,12 +643,19 @@ _bus_dmamap_reserve_pages(bus_dma_tag_t dmat, bus_dmam * Add a single contiguous physical range to the segment list. */ static int -_bus_dmamap_addseg(bus_dma_tag_t dmat, bus_dmamap_t map, bus_addr_t curaddr, +_bus_dmamap_addseg(bus_dma_tag_t dmat, bus_dmamap_t map, vm_paddr_t curaddr, bus_size_t sgsize, bus_dma_segment_t *segs, int *segp) { bus_addr_t baddr, bmask; int seg; + KASSERT(curaddr <= BUS_SPACE_MAXADDR, + ("ds_addr %#jx > BUS_SPACE_MAXADDR %#jx; dmat %p fl %#x low %#jx " + "hi %#jx", + (uintmax_t)curaddr, (uintmax_t)BUS_SPACE_MAXADDR, + dmat, dmat->bounce_flags, (uintmax_t)dmat->common.lowaddr, + (uintmax_t)dmat->common.highaddr)); + /* * Make sure we don't cross any boundaries. */ @@ -695,7 +702,7 @@ bounce_bus_dmamap_load_phys(bus_dma_tag_t dmat, bus_dm int *segp) { bus_size_t sgsize; - bus_addr_t curaddr; + vm_paddr_t curaddr; int error; if (map == NULL) @@ -747,7 +754,7 @@ bounce_bus_dmamap_load_buffer(bus_dma_tag_t dmat, bus_ int *segp) { bus_size_t sgsize, max_sgsize; - bus_addr_t curaddr; + vm_paddr_t curaddr; vm_offset_t kvaddr, vaddr; int error; @@ -1194,7 +1201,7 @@ reserve_bounce_pages(bus_dma_tag_t dmat, bus_dmamap_t static bus_addr_t add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, vm_offset_t vaddr, - bus_addr_t addr1, bus_addr_t addr2, bus_size_t size) + vm_paddr_t addr1, vm_paddr_t addr2, bus_size_t size) { struct bounce_zone *bz; struct bounce_page *bpage; Modified: stable/12/sys/x86/x86/busdma_machdep.c ============================================================================== --- stable/12/sys/x86/x86/busdma_machdep.c Fri Feb 1 00:34:18 2019 (r343636) +++ stable/12/sys/x86/x86/busdma_machdep.c Fri Feb 1 00:36:14 2019 (r343637) @@ -99,14 +99,15 @@ bus_dma_dflt_lock(void *arg, bus_dma_lock_op_t op) * to check for a match, if there is no filter callback then assume a match. */ int -bus_dma_run_filter(struct bus_dma_tag_common *tc, bus_addr_t paddr) +bus_dma_run_filter(struct bus_dma_tag_common *tc, vm_paddr_t paddr) { int retval; retval = 0; do { - if (((paddr > tc->lowaddr && paddr <= tc->highaddr) || - ((paddr & (tc->alignment - 1)) != 0)) && + if ((paddr >= BUS_SPACE_MAXADDR || + (paddr > tc->lowaddr && paddr <= tc->highaddr) || + (paddr & (tc->alignment - 1)) != 0) && (tc->filter == NULL || (*tc->filter)(tc->filterarg, paddr) != 0)) retval = 1; From owner-svn-src-stable-12@freebsd.org Fri Feb 1 00:37:56 2019 Return-Path: Delivered-To: svn-src-stable-12@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 ED79914BDC90; Fri, 1 Feb 2019 00:37:55 +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 950AF83DA2; Fri, 1 Feb 2019 00:37:55 +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 83E8BF5C4; Fri, 1 Feb 2019 00:37:55 +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 x110btqP047343; Fri, 1 Feb 2019 00:37:55 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x110bt3G047342; Fri, 1 Feb 2019 00:37:55 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201902010037.x110bt3G047342@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 1 Feb 2019 00:37:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343638 - stable/12/sys/x86/x86 X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/x86/x86 X-SVN-Commit-Revision: 343638 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 950AF83DA2 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]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Feb 2019 00:37:56 -0000 Author: kib Date: Fri Feb 1 00:37:55 2019 New Revision: 343638 URL: https://svnweb.freebsd.org/changeset/base/343638 Log: MFC r343147: i386/PAE busdma: allow more bounce pages. Modified: stable/12/sys/x86/x86/busdma_bounce.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/x86/x86/busdma_bounce.c ============================================================================== --- stable/12/sys/x86/x86/busdma_bounce.c Fri Feb 1 00:36:14 2019 (r343637) +++ stable/12/sys/x86/x86/busdma_bounce.c Fri Feb 1 00:37:55 2019 (r343638) @@ -57,7 +57,7 @@ __FBSDID("$FreeBSD$"); #include #ifdef __i386__ -#define MAX_BPAGES 512 +#define MAX_BPAGES (Maxmem > atop(0x100000000ULL) ? 8192 : 512) #else #define MAX_BPAGES 8192 #endif From owner-svn-src-stable-12@freebsd.org Fri Feb 1 02:43:15 2019 Return-Path: Delivered-To: svn-src-stable-12@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 3639814C0546; Fri, 1 Feb 2019 02:43:15 +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 CD10B87530; Fri, 1 Feb 2019 02:43:14 +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 C24CF18B7F; Fri, 1 Feb 2019 02:43:14 +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 x112hE5x014041; Fri, 1 Feb 2019 02:43:14 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x112hEBo014040; Fri, 1 Feb 2019 02:43:14 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201902010243.x112hEBo014040@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Fri, 1 Feb 2019 02:43:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343639 - in stable: 10/share/man/man4 11/share/man/man4 12/share/man/man4 X-SVN-Group: stable-12 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: in stable: 10/share/man/man4 11/share/man/man4 12/share/man/man4 X-SVN-Commit-Revision: 343639 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CD10B87530 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.98)[-0.984,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Feb 2019 02:43:15 -0000 Author: avos Date: Fri Feb 1 02:43:13 2019 New Revision: 343639 URL: https://svnweb.freebsd.org/changeset/base/343639 Log: MFC r343495: wlan.4: improve wording PR: 218075 Submitted by: Aaron Taylor Modified: stable/12/share/man/man4/wlan.4 Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/10/share/man/man4/wlan.4 stable/11/share/man/man4/wlan.4 Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/12/share/man/man4/wlan.4 ============================================================================== --- stable/12/share/man/man4/wlan.4 Fri Feb 1 00:37:55 2019 (r343638) +++ stable/12/share/man/man4/wlan.4 Fri Feb 1 02:43:13 2019 (r343639) @@ -167,9 +167,8 @@ was used to be compatible with .Pp Mesh stations follow the 802.11s Draft 3.0 specification which is not ratified and subject to change. -Beware that this specification is incompatible with earlier drafts; -and stations implementing earlier drafts (e.g. Linux) -may not interoperate. +Be aware that this specification is incompatible with earlier drafts. +Stations implementing earlier drafts (e.g., Linux) may be incompatible. .Sh SEE ALSO .Xr an 4 , .Xr ath 4 , From owner-svn-src-stable-12@freebsd.org Fri Feb 1 03:01:20 2019 Return-Path: Delivered-To: svn-src-stable-12@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 593EA14C0E76; Fri, 1 Feb 2019 03:01:20 +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 F3FB18845B; Fri, 1 Feb 2019 03:01:19 +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 E9BFE18DDB; Fri, 1 Feb 2019 03:01:19 +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 x1131J0S020448; Fri, 1 Feb 2019 03:01:19 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1131Jqd020447; Fri, 1 Feb 2019 03:01:19 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201902010301.x1131Jqd020447@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Fri, 1 Feb 2019 03:01:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343640 - stable/12/sbin/devd X-SVN-Group: stable-12 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: stable/12/sbin/devd X-SVN-Commit-Revision: 343640 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: F3FB18845B 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.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Feb 2019 03:01:20 -0000 Author: avos Date: Fri Feb 1 03:01:19 2019 New Revision: 343640 URL: https://svnweb.freebsd.org/changeset/base/343640 Log: MFC r343497: Unbreak devd.conf(5) regex after r343249 PR: 235239 Submitted by: Helge Oldach Modified: stable/12/sbin/devd/devd.conf Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/devd/devd.conf ============================================================================== --- stable/12/sbin/devd/devd.conf Fri Feb 1 02:43:13 2019 (r343639) +++ stable/12/sbin/devd/devd.conf Fri Feb 1 03:01:19 2019 (r343640) @@ -42,7 +42,7 @@ options { # notify 0 { match "system" "IFNET"; - match "subsystem" "(?!usbus[0-9]+|?!wlan[0-9]+)"; + match "subsystem" "!(usbus|wlan)[0-9]+"; match "type" "ATTACH"; action "/etc/pccard_ether $subsystem start"; }; From owner-svn-src-stable-12@freebsd.org Fri Feb 1 03:26:11 2019 Return-Path: Delivered-To: svn-src-stable-12@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 9520E14C1CE8; Fri, 1 Feb 2019 03:26:11 +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 3B66089857; Fri, 1 Feb 2019 03:26:11 +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 230D5192D7; Fri, 1 Feb 2019 03:26:11 +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 x113QB6b035918; Fri, 1 Feb 2019 03:26:11 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x113QBB8035917; Fri, 1 Feb 2019 03:26:11 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201902010326.x113QBB8035917@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Fri, 1 Feb 2019 03:26:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343643 - in stable: 10/sys/dev/pcf 11/sys/dev/pcf 12/sys/dev/pcf X-SVN-Group: stable-12 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: in stable: 10/sys/dev/pcf 11/sys/dev/pcf 12/sys/dev/pcf X-SVN-Commit-Revision: 343643 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3B66089857 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.960,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Feb 2019 03:26:11 -0000 Author: avos Date: Fri Feb 1 03:26:10 2019 New Revision: 343643 URL: https://svnweb.freebsd.org/changeset/base/343643 Log: MFC r343496: pcf(4): fix parentheses in if condition PR: 210709 Submitted by: David Binderman Modified: stable/12/sys/dev/pcf/pcf_isa.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/10/sys/dev/pcf/pcf_isa.c stable/11/sys/dev/pcf/pcf_isa.c Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/12/sys/dev/pcf/pcf_isa.c ============================================================================== --- stable/12/sys/dev/pcf/pcf_isa.c Fri Feb 1 03:09:11 2019 (r343642) +++ stable/12/sys/dev/pcf/pcf_isa.c Fri Feb 1 03:26:10 2019 (r343643) @@ -111,7 +111,7 @@ pcf_isa_probe(device_t dev) /* The port address must be explicitly specified */ bus_get_resource(dev, SYS_RES_IOPORT, rid, &start, &count); - if ((error = resource_int_value(PCF_NAME, 0, "port", &port) != 0)) + if ((error = resource_int_value(PCF_NAME, 0, "port", &port)) != 0) return (error); /* Probe is only successful for the specified base io */ From owner-svn-src-stable-12@freebsd.org Fri Feb 1 06:19:13 2019 Return-Path: Delivered-To: svn-src-stable-12@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 64F1F14C3A69; Fri, 1 Feb 2019 06:19:13 +0000 (UTC) (envelope-from tsoome@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 05F676EE3A; Fri, 1 Feb 2019 06:19:13 +0000 (UTC) (envelope-from tsoome@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 EB9A11AFEE; Fri, 1 Feb 2019 06:19:12 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x116JCZR024041; Fri, 1 Feb 2019 06:19:12 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x116JCmn024040; Fri, 1 Feb 2019 06:19:12 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201902010619.x116JCmn024040@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Fri, 1 Feb 2019 06:19:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343644 - stable/12/stand/mips/beri/boot2 X-SVN-Group: stable-12 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: stable/12/stand/mips/beri/boot2 X-SVN-Commit-Revision: 343644 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 05F676EE3A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.82 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.82)[-0.820,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Feb 2019 06:19:13 -0000 Author: tsoome Date: Fri Feb 1 06:19:12 2019 New Revision: 343644 URL: https://svnweb.freebsd.org/changeset/base/343644 Log: MFC r343225: Unbreak mip64 build after r328437 Add exit and getchar functions to beri/boot2 code. They are required by panic_action functin introduced in r328437 Modified: stable/12/stand/mips/beri/boot2/boot2.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/mips/beri/boot2/boot2.c ============================================================================== --- stable/12/stand/mips/beri/boot2/boot2.c Fri Feb 1 03:26:10 2019 (r343643) +++ stable/12/stand/mips/beri/boot2/boot2.c Fri Feb 1 06:19:12 2019 (r343644) @@ -651,3 +651,19 @@ xgetc(int fn) return 0; } } + +int +getchar(void) +{ + + return xgetc(0); +} + +void +exit(int code) +{ + + printf("error: loader exit\n"); + while (1); + __unreachable(); +} From owner-svn-src-stable-12@freebsd.org Fri Feb 1 09:08:21 2019 Return-Path: Delivered-To: svn-src-stable-12@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 0A89814C3A2E; Fri, 1 Feb 2019 09:08:21 +0000 (UTC) (envelope-from hselasky@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 8F61F82B42; Fri, 1 Feb 2019 09:08:20 +0000 (UTC) (envelope-from hselasky@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 8652F1CC5E; Fri, 1 Feb 2019 09:08:20 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1198KZ1011543; Fri, 1 Feb 2019 09:08:20 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1198JQp011538; Fri, 1 Feb 2019 09:08:19 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201902010908.x1198JQp011538@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 1 Feb 2019 09:08:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343650 - stable/12/sys/netinet6 X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/netinet6 X-SVN-Commit-Revision: 343650 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8F61F82B42 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.87 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.87)[-0.873,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Feb 2019 09:08:21 -0000 Author: hselasky Date: Fri Feb 1 09:08:19 2019 New Revision: 343650 URL: https://svnweb.freebsd.org/changeset/base/343650 Log: MFC r343395: Fix refcounting leaks in IPv6 MLD code leading to loss of IPv6 connectivity. Looking at past changes in this area like r337866, some refcounting bugs have been introduced, one by one. For example like calling in6m_disconnect() and in6m_rele_locked() in mld_v1_process_group_timer() where previously no disconnect nor refcount decrement was done. Calling in6m_disconnect() when it shouldn't causes IPv6 solitation to no longer work, because all the multicast addresses receiving the solitation messages are now deleted from the network interface. This patch reverts some recent changes while improving the MLD refcounting and concurrency model after the MLD code was converted to using EPOCH(9). List changes: - All CK_STAILQ_FOREACH() macros are now properly enclosed into EPOCH(9) sections. This simplifies assertion of locking inside in6m_ifmultiaddr_get_inm(). - Corrected bad use of in6m_disconnect() leading to loss of IPv6 connectivity for MLD v1. - Factored out checks for valid inm structure into in6m_ifmultiaddr_get_inm(). PR: 233535 Differential Revision: https://reviews.freebsd.org/D18887 Reviewed by: bz (net) Tested by: ae Sponsored by: Mellanox Technologies Modified: stable/12/sys/netinet6/in6_ifattach.c stable/12/sys/netinet6/in6_mcast.c stable/12/sys/netinet6/in6_var.h stable/12/sys/netinet6/mld6.c stable/12/sys/netinet6/mld6_var.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet6/in6_ifattach.c ============================================================================== --- stable/12/sys/netinet6/in6_ifattach.c Fri Feb 1 09:07:27 2019 (r343649) +++ stable/12/sys/netinet6/in6_ifattach.c Fri Feb 1 09:08:19 2019 (r343650) @@ -852,36 +852,15 @@ in6_tmpaddrtimer(void *arg) static void in6_purgemaddrs(struct ifnet *ifp) { - struct in6_multi_head purgeinms; - struct in6_multi *inm; - struct ifmultiaddr *ifma, *next; + struct in6_multi_head inmh; - SLIST_INIT(&purgeinms); + SLIST_INIT(&inmh); IN6_MULTI_LOCK(); IN6_MULTI_LIST_LOCK(); - IF_ADDR_WLOCK(ifp); - /* - * Extract list of in6_multi associated with the detaching ifp - * which the PF_INET6 layer is about to release. - */ - restart: - CK_STAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) { - if (ifma->ifma_addr->sa_family != AF_INET6 || - ifma->ifma_protospec == NULL) - continue; - inm = (struct in6_multi *)ifma->ifma_protospec; - in6m_disconnect(inm); - in6m_rele_locked(&purgeinms, inm); - if (__predict_false(ifma6_restart)) { - ifma6_restart = false; - goto restart; - } - } - IF_ADDR_WUNLOCK(ifp); - mld_ifdetach(ifp); + mld_ifdetach(ifp, &inmh); IN6_MULTI_LIST_UNLOCK(); IN6_MULTI_UNLOCK(); - in6m_release_list_deferred(&purgeinms); + in6m_release_list_deferred(&inmh); /* * Make sure all multicast deletions invoking if_ioctl() are Modified: stable/12/sys/netinet6/in6_mcast.c ============================================================================== --- stable/12/sys/netinet6/in6_mcast.c Fri Feb 1 09:07:27 2019 (r343649) +++ stable/12/sys/netinet6/in6_mcast.c Fri Feb 1 09:08:19 2019 (r343650) @@ -190,7 +190,6 @@ static SYSCTL_NODE(_net_inet6_ip6_mcast, OID_AUTO, fil CTLFLAG_RD | CTLFLAG_MPSAFE, sysctl_ip6_mcast_filters, "Per-interface stack-wide source filters"); -int ifma6_restart = 0; #ifdef KTR /* * Inline function which wraps assertions for a valid ifp. @@ -405,6 +404,7 @@ static int in6_getmulti(struct ifnet *ifp, const struct in6_addr *group, struct in6_multi **pinm) { + struct epoch_tracker et; struct sockaddr_in6 gsin6; struct ifmultiaddr *ifma; struct in6_multi *inm; @@ -420,7 +420,10 @@ in6_getmulti(struct ifnet *ifp, const struct in6_addr IN6_MULTI_LOCK_ASSERT(); IN6_MULTI_LIST_LOCK(); IF_ADDR_WLOCK(ifp); + NET_EPOCH_ENTER(et); inm = in6m_lookup_locked(ifp, group); + NET_EPOCH_EXIT(et); + if (inm != NULL) { /* * If we already joined this group, just bump the @@ -593,7 +596,7 @@ in6m_release_wait(void) } void -in6m_disconnect(struct in6_multi *inm) +in6m_disconnect_locked(struct in6_multi_head *inmh, struct in6_multi *inm) { struct ifnet *ifp; struct ifaddr *ifa; @@ -601,10 +604,12 @@ in6m_disconnect(struct in6_multi *inm) struct in6_multi_mship *imm, *imm_tmp; struct ifmultiaddr *ifma, *ll_ifma; - ifp = inm->in6m_ifp; + IN6_MULTI_LIST_LOCK_ASSERT(); + ifp = inm->in6m_ifp; if (ifp == NULL) - return; + return; /* already called */ + inm->in6m_ifp = NULL; IF_ADDR_WLOCK_ASSERT(ifp); ifma = inm->in6m_ifma; @@ -623,7 +628,6 @@ in6m_disconnect(struct in6_multi *inm) MPASS(ll_ifma->ifma_llifma == NULL); MPASS(ll_ifma->ifma_ifp == ifp); if (--ll_ifma->ifma_refcount == 0) { - ifma6_restart = true; if (ll_ifma->ifma_flags & IFMA_F_ENQUEUED) { CK_STAILQ_REMOVE(&ifp->if_multiaddrs, ll_ifma, ifmultiaddr, ifma_link); ll_ifma->ifma_flags &= ~IFMA_F_ENQUEUED; @@ -641,28 +645,12 @@ in6m_disconnect(struct in6_multi *inm) if (inm == imm->i6mm_maddr) { LIST_REMOVE(imm, i6mm_chain); free(imm, M_IP6MADDR); + in6m_rele_locked(inmh, inm); } } } } -void -in6m_release_deferred(struct in6_multi *inm) -{ - struct in6_multi_head tmp; - - IN6_MULTI_LIST_LOCK_ASSERT(); - KASSERT(inm->in6m_refcount > 0, ("refcount == %d inm: %p", inm->in6m_refcount, inm)); - if (--inm->in6m_refcount == 0) { - MPASS(inm->in6m_ifp == NULL); - SLIST_INIT(&tmp); - inm->in6m_ifma->ifma_protospec = NULL; - MPASS(inm->in6m_ifma->ifma_llifma == NULL); - SLIST_INSERT_HEAD(&tmp, inm, in6m_nrele); - in6m_release_list_deferred(&tmp); - } -} - static void in6m_release_task(void *arg __unused) { @@ -1262,6 +1250,7 @@ in6_joingroup_locked(struct ifnet *ifp, const struct i /*const*/ struct in6_mfilter *imf, struct in6_multi **pinm, const int delay) { + struct in6_multi_head inmh; struct in6_mfilter timf; struct in6_multi *inm; struct ifmultiaddr *ifma; @@ -1323,6 +1312,7 @@ in6_joingroup_locked(struct ifnet *ifp, const struct i } out_in6m_release: + SLIST_INIT(&inmh); if (error) { CTR2(KTR_MLD, "%s: dropping ref on %p", __func__, inm); IF_ADDR_RLOCK(ifp); @@ -1332,13 +1322,14 @@ out_in6m_release: break; } } - in6m_disconnect(inm); - in6m_release_deferred(inm); + in6m_disconnect_locked(&inmh, inm); + in6m_rele_locked(&inmh, inm); IF_ADDR_RUNLOCK(ifp); } else { *pinm = inm; } IN6_MULTI_LIST_UNLOCK(); + in6m_release_list_deferred(&inmh); return (error); } @@ -1372,6 +1363,7 @@ in6_leavegroup(struct in6_multi *inm, /*const*/ struct int in6_leavegroup_locked(struct in6_multi *inm, /*const*/ struct in6_mfilter *imf) { + struct in6_multi_head inmh; struct in6_mfilter timf; struct ifnet *ifp; int error; @@ -1421,13 +1413,15 @@ in6_leavegroup_locked(struct in6_multi *inm, /*const*/ CTR2(KTR_MLD, "%s: dropping ref on %p", __func__, inm); if (ifp) IF_ADDR_WLOCK(ifp); - if (inm->in6m_refcount == 1 && inm->in6m_ifp != NULL) - in6m_disconnect(inm); - in6m_release_deferred(inm); + + SLIST_INIT(&inmh); + if (inm->in6m_refcount == 1) + in6m_disconnect_locked(&inmh, inm); + in6m_rele_locked(&inmh, inm); if (ifp) IF_ADDR_WUNLOCK(ifp); IN6_MULTI_LIST_UNLOCK(); - + in6m_release_list_deferred(&inmh); return (error); } @@ -1941,6 +1935,7 @@ in6p_lookup_mcast_ifp(const struct inpcb *in6p, static int in6p_join_group(struct inpcb *inp, struct sockopt *sopt) { + struct in6_multi_head inmh; struct group_source_req gsr; sockunion_t *gsa, *ssa; struct ifnet *ifp; @@ -1951,6 +1946,7 @@ in6p_join_group(struct inpcb *inp, struct sockopt *sop size_t idx; int error, is_new; + SLIST_INIT(&inmh); ifp = NULL; imf = NULL; lims = NULL; @@ -2227,7 +2223,7 @@ out_im6o_free: inm = imo->im6o_membership[idx]; if (inm != NULL) { IN6_MULTI_LIST_LOCK(); - in6m_release_deferred(inm); + in6m_rele_locked(&inmh, inm); IN6_MULTI_LIST_UNLOCK(); } imo->im6o_membership[idx] = NULL; @@ -2236,6 +2232,7 @@ out_im6o_free: out_in6p_locked: INP_WUNLOCK(inp); + in6m_release_list_deferred(&inmh); return (error); } @@ -2879,10 +2876,9 @@ sysctl_ip6_mcast_filters(SYSCTL_HANDLER_ARGS) IN6_MULTI_LIST_LOCK(); IF_ADDR_RLOCK(ifp); CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_INET6 || - ifma->ifma_protospec == NULL) + inm = in6m_ifmultiaddr_get_inm(ifma); + if (inm == NULL) continue; - inm = (struct in6_multi *)ifma->ifma_protospec; if (!IN6_ARE_ADDR_EQUAL(&inm->in6m_addr, &mcaddr)) continue; fmode = inm->in6m_st[1].iss_fmode; Modified: stable/12/sys/netinet6/in6_var.h ============================================================================== --- stable/12/sys/netinet6/in6_var.h Fri Feb 1 09:07:27 2019 (r343649) +++ stable/12/sys/netinet6/in6_var.h Fri Feb 1 09:08:19 2019 (r343650) @@ -645,6 +645,7 @@ struct in6_multi { /* New fields for MLDv2 follow. */ struct mld_ifsoftc *in6m_mli; /* MLD info */ SLIST_ENTRY(in6_multi) in6m_nrele; /* to-be-released by MLD */ + SLIST_ENTRY(in6_multi) in6m_defer; /* deferred MLDv1 */ struct ip6_msource_tree in6m_srcs; /* tree of sources */ u_long in6m_nsrc; /* # of tree entries */ @@ -670,8 +671,8 @@ struct in6_multi { } in6m_st[2]; /* state at t0, t1 */ }; -void in6m_disconnect(struct in6_multi *inm); -extern int ifma6_restart; +void in6m_disconnect_locked(struct in6_multi_head *inmh, struct in6_multi *inm); + /* * Helper function to derive the filter mode on a source entry * from its internal counters. Predicates are: @@ -713,13 +714,25 @@ extern struct sx in6_multi_sx; #define IN6_MULTI_LOCK_ASSERT() sx_assert(&in6_multi_sx, SA_XLOCKED) #define IN6_MULTI_UNLOCK_ASSERT() sx_assert(&in6_multi_sx, SA_XUNLOCKED) +/* + * Get the in6_multi pointer from a ifmultiaddr. + * Returns NULL if ifmultiaddr is no longer valid. + */ +static __inline struct in6_multi * +in6m_ifmultiaddr_get_inm(struct ifmultiaddr *ifma) +{ + NET_EPOCH_ASSERT(); + + return ((ifma->ifma_addr->sa_family != AF_INET6 || + (ifma->ifma_flags & IFMA_F_ENQUEUED) == 0) ? NULL : + ifma->ifma_protospec); +} + /* * Look up an in6_multi record for an IPv6 multicast address * on the interface ifp. * If no record found, return NULL. - * - * SMPng: The IN6_MULTI_LOCK and IF_ADDR_LOCK on ifp must be held. */ static __inline struct in6_multi * in6m_lookup_locked(struct ifnet *ifp, const struct in6_addr *mcaddr) @@ -727,18 +740,14 @@ in6m_lookup_locked(struct ifnet *ifp, const struct in6 struct ifmultiaddr *ifma; struct in6_multi *inm; - inm = NULL; - CK_STAILQ_FOREACH(ifma, &((ifp)->if_multiaddrs), ifma_link) { - if (ifma->ifma_addr->sa_family == AF_INET6) { - inm = (struct in6_multi *)ifma->ifma_protospec; - if (inm == NULL) - continue; - if (IN6_ARE_ADDR_EQUAL(&inm->in6m_addr, mcaddr)) - break; - inm = NULL; - } + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + inm = in6m_ifmultiaddr_get_inm(ifma); + if (inm == NULL) + continue; + if (IN6_ARE_ADDR_EQUAL(&inm->in6m_addr, mcaddr)) + return (inm); } - return (inm); + return (NULL); } /* @@ -808,7 +817,6 @@ void in6m_clear_recorded(struct in6_multi *); void in6m_commit(struct in6_multi *); void in6m_print(const struct in6_multi *); int in6m_record_source(struct in6_multi *, const struct in6_addr *); -void in6m_release_deferred(struct in6_multi *); void in6m_release_list_deferred(struct in6_multi_head *); void in6m_release_wait(void); void ip6_freemoptions(struct ip6_moptions *); Modified: stable/12/sys/netinet6/mld6.c ============================================================================== --- stable/12/sys/netinet6/mld6.c Fri Feb 1 09:07:27 2019 (r343649) +++ stable/12/sys/netinet6/mld6.c Fri Feb 1 09:08:19 2019 (r343650) @@ -110,7 +110,7 @@ static void mli_delete_locked(const struct ifnet *); static void mld_dispatch_packet(struct mbuf *); static void mld_dispatch_queue(struct mbufq *, int); static void mld_final_leave(struct in6_multi *, struct mld_ifsoftc *); -static void mld_fasttimo_vnet(void); +static void mld_fasttimo_vnet(struct in6_multi_head *inmh); static int mld_handle_state_change(struct in6_multi *, struct mld_ifsoftc *); static int mld_initial_join(struct in6_multi *, struct mld_ifsoftc *, @@ -537,45 +537,48 @@ out: * XXX This routine is also bitten by unlocked ifma_protospec access. */ void -mld_ifdetach(struct ifnet *ifp) +mld_ifdetach(struct ifnet *ifp, struct in6_multi_head *inmh) { + struct epoch_tracker et; struct mld_ifsoftc *mli; - struct ifmultiaddr *ifma, *next; + struct ifmultiaddr *ifma; struct in6_multi *inm; - struct in6_multi_head inmh; CTR3(KTR_MLD, "%s: called for ifp %p(%s)", __func__, ifp, if_name(ifp)); - SLIST_INIT(&inmh); IN6_MULTI_LIST_LOCK_ASSERT(); MLD_LOCK(); mli = MLD_IFINFO(ifp); - if (mli->mli_version == MLD_VERSION_2) { - IF_ADDR_WLOCK(ifp); - restart: - CK_STAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) { - if (ifma->ifma_addr->sa_family != AF_INET6 || - ifma->ifma_protospec == NULL) - continue; - inm = (struct in6_multi *)ifma->ifma_protospec; + IF_ADDR_WLOCK(ifp); + /* + * Extract list of in6_multi associated with the detaching ifp + * which the PF_INET6 layer is about to release. + */ + NET_EPOCH_ENTER(et); + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + inm = in6m_ifmultiaddr_get_inm(ifma); + if (inm == NULL) + continue; + in6m_disconnect_locked(inmh, inm); + + if (mli->mli_version == MLD_VERSION_2) { + in6m_clear_recorded(inm); + + /* + * We need to release the final reference held + * for issuing the INCLUDE {}. + */ if (inm->in6m_state == MLD_LEAVING_MEMBER) { - in6m_disconnect(inm); - in6m_rele_locked(&inmh, inm); - ifma->ifma_protospec = NULL; + inm->in6m_state = MLD_NOT_MEMBER; + in6m_rele_locked(inmh, inm); } - in6m_clear_recorded(inm); - if (__predict_false(ifma6_restart)) { - ifma6_restart = false; - goto restart; - } } - IF_ADDR_WUNLOCK(ifp); } - + NET_EPOCH_EXIT(et); + IF_ADDR_WUNLOCK(ifp); MLD_UNLOCK(); - in6m_release_list_deferred(&inmh); } /* @@ -708,10 +711,9 @@ mld_v1_input_query(struct ifnet *ifp, const struct ip6 CTR2(KTR_MLD, "process v1 general query on ifp %p(%s)", ifp, if_name(ifp)); CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_INET6 || - ifma->ifma_protospec == NULL) + inm = in6m_ifmultiaddr_get_inm(ifma); + if (inm == NULL) continue; - inm = (struct in6_multi *)ifma->ifma_protospec; mld_v1_update_group(inm, timer); } } else { @@ -1320,15 +1322,19 @@ mld_input(struct mbuf *m, int off, int icmp6len) void mld_fasttimo(void) { + struct in6_multi_head inmh; VNET_ITERATOR_DECL(vnet_iter); + SLIST_INIT(&inmh); + VNET_LIST_RLOCK_NOSLEEP(); VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); - mld_fasttimo_vnet(); + mld_fasttimo_vnet(&inmh); CURVNET_RESTORE(); } VNET_LIST_RUNLOCK_NOSLEEP(); + in6m_release_list_deferred(&inmh); } /* @@ -1337,15 +1343,15 @@ mld_fasttimo(void) * VIMAGE: Assume caller has set up our curvnet. */ static void -mld_fasttimo_vnet(void) +mld_fasttimo_vnet(struct in6_multi_head *inmh) { + struct epoch_tracker et; struct mbufq scq; /* State-change packets */ struct mbufq qrq; /* Query response packets */ struct ifnet *ifp; struct mld_ifsoftc *mli; - struct ifmultiaddr *ifma, *next; - struct in6_multi *inm, *tinm; - struct in6_multi_head inmh; + struct ifmultiaddr *ifma; + struct in6_multi *inm; int uri_fasthz; uri_fasthz = 0; @@ -1360,7 +1366,6 @@ mld_fasttimo_vnet(void) !V_state_change_timers_running6) return; - SLIST_INIT(&inmh); IN6_MULTI_LIST_LOCK(); MLD_LOCK(); @@ -1406,25 +1411,20 @@ mld_fasttimo_vnet(void) } IF_ADDR_WLOCK(ifp); - restart: - CK_STAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) { - if (ifma->ifma_addr->sa_family != AF_INET6 || - ifma->ifma_protospec == NULL) + NET_EPOCH_ENTER(et); + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + inm = in6m_ifmultiaddr_get_inm(ifma); + if (inm == NULL) continue; - inm = (struct in6_multi *)ifma->ifma_protospec; switch (mli->mli_version) { case MLD_VERSION_1: - mld_v1_process_group_timer(&inmh, inm); + mld_v1_process_group_timer(inmh, inm); break; case MLD_VERSION_2: - mld_v2_process_group_timers(&inmh, &qrq, + mld_v2_process_group_timers(inmh, &qrq, &scq, inm, uri_fasthz); break; } - if (__predict_false(ifma6_restart)) { - ifma6_restart = false; - goto restart; - } } IF_ADDR_WUNLOCK(ifp); @@ -1438,9 +1438,8 @@ mld_fasttimo_vnet(void) * IF_ADDR_LOCK internally as well as * ip6_output() to transmit a packet. */ - SLIST_FOREACH_SAFE(inm, &inmh, in6m_nrele, tinm) { - SLIST_REMOVE_HEAD(&inmh, - in6m_nrele); + while ((inm = SLIST_FIRST(inmh)) != NULL) { + SLIST_REMOVE_HEAD(inmh, in6m_defer); (void)mld_v1_transmit_report(inm, MLD_LISTENER_REPORT); } @@ -1448,14 +1447,9 @@ mld_fasttimo_vnet(void) case MLD_VERSION_2: mld_dispatch_queue(&qrq, 0); mld_dispatch_queue(&scq, 0); - - /* - * Free the in_multi reference(s) for - * this lifecycle. - */ - in6m_release_list_deferred(&inmh); break; } + NET_EPOCH_EXIT(et); } out_locked: @@ -1495,8 +1489,7 @@ mld_v1_process_group_timer(struct in6_multi_head *inmh case MLD_REPORTING_MEMBER: if (report_timer_expired) { inm->in6m_state = MLD_IDLE_MEMBER; - in6m_disconnect(inm); - in6m_rele_locked(inmh, inm); + SLIST_INSERT_HEAD(inmh, inm, in6m_defer); } break; case MLD_G_QUERY_PENDING_MEMBER: @@ -1620,7 +1613,7 @@ mld_v2_process_group_timers(struct in6_multi_head *inm if (inm->in6m_state == MLD_LEAVING_MEMBER && inm->in6m_scrv == 0) { inm->in6m_state = MLD_NOT_MEMBER; - in6m_disconnect(inm); + in6m_disconnect_locked(inmh, inm); in6m_rele_locked(inmh, inm); } } @@ -1665,10 +1658,11 @@ mld_set_version(struct mld_ifsoftc *mli, const int ver static void mld_v2_cancel_link_timers(struct mld_ifsoftc *mli) { - struct ifmultiaddr *ifma, *next; + struct epoch_tracker et; + struct in6_multi_head inmh; + struct ifmultiaddr *ifma; struct ifnet *ifp; struct in6_multi *inm; - struct in6_multi_head inmh; CTR3(KTR_MLD, "%s: cancel v2 timers on ifp %p(%s)", __func__, mli->mli_ifp, if_name(mli->mli_ifp)); @@ -1691,12 +1685,11 @@ mld_v2_cancel_link_timers(struct mld_ifsoftc *mli) ifp = mli->mli_ifp; IF_ADDR_WLOCK(ifp); - restart: - CK_STAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) { - if (ifma->ifma_addr->sa_family != AF_INET6 || - ifma->ifma_protospec == NULL) + NET_EPOCH_ENTER(et); + CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + inm = in6m_ifmultiaddr_get_inm(ifma); + if (inm == NULL) continue; - inm = (struct in6_multi *)ifma->ifma_protospec; switch (inm->in6m_state) { case MLD_NOT_MEMBER: case MLD_SILENT_MEMBER: @@ -1711,9 +1704,7 @@ mld_v2_cancel_link_timers(struct mld_ifsoftc *mli) * version, we need to release the final * reference held for issuing the INCLUDE {}. */ - in6m_disconnect(inm); in6m_rele_locked(&inmh, inm); - ifma->ifma_protospec = NULL; /* FALLTHROUGH */ case MLD_G_QUERY_PENDING_MEMBER: case MLD_SG_QUERY_PENDING_MEMBER: @@ -1729,11 +1720,8 @@ mld_v2_cancel_link_timers(struct mld_ifsoftc *mli) mbufq_drain(&inm->in6m_scq); break; } - if (__predict_false(ifma6_restart)) { - ifma6_restart = false; - goto restart; - } } + NET_EPOCH_EXIT(et); IF_ADDR_WUNLOCK(ifp); in6m_release_list_deferred(&inmh); } @@ -1906,6 +1894,14 @@ mld_change_state(struct in6_multi *inm, const int dela error = 0; /* + * Check if the in6_multi has already been disconnected. + */ + if (inm->in6m_ifp == NULL) { + CTR1(KTR_MLD, "%s: inm is disconnected", __func__); + return (0); + } + + /* * Try to detect if the upper layer just asked us to change state * for an interface which has now gone away. */ @@ -2015,6 +2011,7 @@ mld_initial_join(struct in6_multi *inm, struct mld_ifs if (mli->mli_version == MLD_VERSION_2 && inm->in6m_state == MLD_LEAVING_MEMBER) { inm->in6m_refcount--; + MPASS(inm->in6m_refcount > 0); } inm->in6m_state = MLD_REPORTING_MEMBER; @@ -3018,11 +3015,9 @@ mld_v2_dispatch_general_query(struct mld_ifsoftc *mli) IF_ADDR_RLOCK(ifp); CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_INET6 || - ifma->ifma_protospec == NULL) + inm = in6m_ifmultiaddr_get_inm(ifma); + if (inm == NULL) continue; - - inm = (struct in6_multi *)ifma->ifma_protospec; KASSERT(ifp == inm->in6m_ifp, ("%s: inconsistent ifp", __func__)); Modified: stable/12/sys/netinet6/mld6_var.h ============================================================================== --- stable/12/sys/netinet6/mld6_var.h Fri Feb 1 09:07:27 2019 (r343649) +++ stable/12/sys/netinet6/mld6_var.h Fri Feb 1 09:08:19 2019 (r343650) @@ -160,12 +160,13 @@ struct mld_ifsoftc { #define MLD_IFINFO(ifp) \ (((struct in6_ifextra *)(ifp)->if_afdata[AF_INET6])->mld_ifinfo) +struct in6_multi_head; int mld_change_state(struct in6_multi *, const int); struct mld_ifsoftc * mld_domifattach(struct ifnet *); void mld_domifdetach(struct ifnet *); void mld_fasttimo(void); -void mld_ifdetach(struct ifnet *); +void mld_ifdetach(struct ifnet *, struct in6_multi_head *); int mld_input(struct mbuf *, int, int); void mld_slowtimo(void); From owner-svn-src-stable-12@freebsd.org Fri Feb 1 09:05:42 2019 Return-Path: Delivered-To: svn-src-stable-12@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 8F19014C36DF; Fri, 1 Feb 2019 09:05:42 +0000 (UTC) (envelope-from hselasky@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 337BC82753; Fri, 1 Feb 2019 09:05:42 +0000 (UTC) (envelope-from hselasky@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 285261CC56; Fri, 1 Feb 2019 09:05:42 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1195g16011213; Fri, 1 Feb 2019 09:05:42 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1195gAb011212; Fri, 1 Feb 2019 09:05:42 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201902010905.x1195gAb011212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 1 Feb 2019 09:05:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343647 - stable/12/sys/netinet6 X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/netinet6 X-SVN-Commit-Revision: 343647 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 337BC82753 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.87 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.87)[-0.874,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Feb 2019 09:05:42 -0000 Author: hselasky Date: Fri Feb 1 09:05:41 2019 New Revision: 343647 URL: https://svnweb.freebsd.org/changeset/base/343647 Log: MFC r343392: Fix duplicate acquiring of refcount when joining IPv6 multicast groups. This was observed by starting and stopping rpcbind(8) multiple times. PR: 233535 Differential Revision: https://reviews.freebsd.org/D18887 Reviewed by: bz (net) Tested by: ae Sponsored by: Mellanox Technologies Modified: stable/12/sys/netinet6/in6_mcast.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet6/in6_mcast.c ============================================================================== --- stable/12/sys/netinet6/in6_mcast.c Fri Feb 1 08:10:26 2019 (r343646) +++ stable/12/sys/netinet6/in6_mcast.c Fri Feb 1 09:05:41 2019 (r343647) @@ -2178,7 +2178,10 @@ in6p_join_group(struct inpcb *inp, struct sockopt *sop IN6_MULTI_UNLOCK(); goto out_im6o_free; } - in6m_acquire(inm); + /* + * NOTE: Refcount from in6_joingroup_locked() + * is protecting membership. + */ imo->im6o_membership[idx] = inm; } else { CTR1(KTR_MLD, "%s: merge inm state", __func__); From owner-svn-src-stable-12@freebsd.org Fri Feb 1 09:06:41 2019 Return-Path: Delivered-To: svn-src-stable-12@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 DD37A14C3814; Fri, 1 Feb 2019 09:06:40 +0000 (UTC) (envelope-from hselasky@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 8273E828C2; Fri, 1 Feb 2019 09:06:40 +0000 (UTC) (envelope-from hselasky@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 7829E1CC5A; Fri, 1 Feb 2019 09:06:40 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1196eYB011323; Fri, 1 Feb 2019 09:06:40 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1196elg011322; Fri, 1 Feb 2019 09:06:40 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201902010906.x1196elg011322@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 1 Feb 2019 09:06:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343648 - stable/12/sys/netinet6 X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/netinet6 X-SVN-Commit-Revision: 343648 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8273E828C2 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.87 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.87)[-0.874,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Feb 2019 09:06:41 -0000 Author: hselasky Date: Fri Feb 1 09:06:40 2019 New Revision: 343648 URL: https://svnweb.freebsd.org/changeset/base/343648 Log: MFC r343393: Add debugging sysctl to disable incoming MLD v2 messages similar to the existing sysctl for MLD v1 messages. PR: 233535 Differential Revision: https://reviews.freebsd.org/D18887 Reviewed by: bz (net) Tested by: ae Sponsored by: Mellanox Technologies Modified: stable/12/sys/netinet6/mld6.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet6/mld6.c ============================================================================== --- stable/12/sys/netinet6/mld6.c Fri Feb 1 09:05:41 2019 (r343647) +++ stable/12/sys/netinet6/mld6.c Fri Feb 1 09:06:40 2019 (r343648) @@ -243,6 +243,10 @@ static int mld_v1enable = 1; SYSCTL_INT(_net_inet6_mld, OID_AUTO, v1enable, CTLFLAG_RWTUN, &mld_v1enable, 0, "Enable fallback to MLDv1"); +static int mld_v2enable = 1; +SYSCTL_INT(_net_inet6_mld, OID_AUTO, v2enable, CTLFLAG_RWTUN, + &mld_v2enable, 0, "Enable MLDv2"); + static int mld_use_allow = 1; SYSCTL_INT(_net_inet6_mld, OID_AUTO, use_allow, CTLFLAG_RWTUN, &mld_use_allow, 0, "Use ALLOW/BLOCK for RFC 4604 SSM joins/leaves"); @@ -816,7 +820,12 @@ mld_v2_input_query(struct ifnet *ifp, const struct ip6 char ip6tbuf[INET6_ADDRSTRLEN]; #endif - is_general_query = 0; + if (!mld_v2enable) { + CTR3(KTR_MLD, "ignore v2 query src %s on ifp %p(%s)", + ip6_sprintf(ip6tbuf, &ip6->ip6_src), + ifp, if_name(ifp)); + return (0); + } /* * RFC3810 Section 6.2: MLD queries must originate from @@ -828,6 +837,8 @@ mld_v2_input_query(struct ifnet *ifp, const struct ip6 ifp, if_name(ifp)); return (0); } + + is_general_query = 0; CTR2(KTR_MLD, "input v2 query on ifp %p(%s)", ifp, if_name(ifp)); From owner-svn-src-stable-12@freebsd.org Fri Feb 1 09:07:28 2019 Return-Path: Delivered-To: svn-src-stable-12@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 9011614C390A; Fri, 1 Feb 2019 09:07:28 +0000 (UTC) (envelope-from hselasky@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 3039182A0A; Fri, 1 Feb 2019 09:07:28 +0000 (UTC) (envelope-from hselasky@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 266901CC5C; Fri, 1 Feb 2019 09:07:28 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x1197SBj011429; Fri, 1 Feb 2019 09:07:28 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x1197RV8011426; Fri, 1 Feb 2019 09:07:27 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201902010907.x1197RV8011426@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 1 Feb 2019 09:07:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343649 - stable/12/sys/netinet6 X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/netinet6 X-SVN-Commit-Revision: 343649 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 3039182A0A X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.87 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.87)[-0.874,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Feb 2019 09:07:28 -0000 Author: hselasky Date: Fri Feb 1 09:07:27 2019 New Revision: 343649 URL: https://svnweb.freebsd.org/changeset/base/343649 Log: MFC r343394: When detaching a network interface drain the workqueue freeing the inm's because the destructor will access the if_ioctl() callback in the ifnet pointer which is about to be freed. This prevents use-after-free. PR: 233535 Differential Revision: https://reviews.freebsd.org/D18887 Reviewed by: bz (net) Tested by: ae Sponsored by: Mellanox Technologies Modified: stable/12/sys/netinet6/in6_ifattach.c stable/12/sys/netinet6/in6_mcast.c stable/12/sys/netinet6/in6_var.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet6/in6_ifattach.c ============================================================================== --- stable/12/sys/netinet6/in6_ifattach.c Fri Feb 1 09:06:40 2019 (r343648) +++ stable/12/sys/netinet6/in6_ifattach.c Fri Feb 1 09:07:27 2019 (r343649) @@ -882,6 +882,13 @@ in6_purgemaddrs(struct ifnet *ifp) IN6_MULTI_LIST_UNLOCK(); IN6_MULTI_UNLOCK(); in6m_release_list_deferred(&purgeinms); + + /* + * Make sure all multicast deletions invoking if_ioctl() are + * completed before returning. Else we risk accessing a freed + * ifnet structure pointer. + */ + in6m_release_wait(); } void Modified: stable/12/sys/netinet6/in6_mcast.c ============================================================================== --- stable/12/sys/netinet6/in6_mcast.c Fri Feb 1 09:06:40 2019 (r343648) +++ stable/12/sys/netinet6/in6_mcast.c Fri Feb 1 09:07:27 2019 (r343649) @@ -585,6 +585,14 @@ in6m_release_list_deferred(struct in6_multi_head *inmh } void +in6m_release_wait(void) +{ + + /* Wait for all jobs to complete. */ + gtaskqueue_drain_all(free_gtask.gt_taskqueue); +} + +void in6m_disconnect(struct in6_multi *inm) { struct ifnet *ifp; Modified: stable/12/sys/netinet6/in6_var.h ============================================================================== --- stable/12/sys/netinet6/in6_var.h Fri Feb 1 09:06:40 2019 (r343648) +++ stable/12/sys/netinet6/in6_var.h Fri Feb 1 09:07:27 2019 (r343649) @@ -810,6 +810,7 @@ void in6m_print(const struct in6_multi *); int in6m_record_source(struct in6_multi *, const struct in6_addr *); void in6m_release_deferred(struct in6_multi *); void in6m_release_list_deferred(struct in6_multi_head *); +void in6m_release_wait(void); void ip6_freemoptions(struct ip6_moptions *); int ip6_getmoptions(struct inpcb *, struct sockopt *); int ip6_setmoptions(struct inpcb *, struct sockopt *); From owner-svn-src-stable-12@freebsd.org Fri Feb 1 09:18:46 2019 Return-Path: Delivered-To: svn-src-stable-12@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 1079614C4F46; Fri, 1 Feb 2019 09:18:46 +0000 (UTC) (envelope-from hselasky@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 A9237833B7; Fri, 1 Feb 2019 09:18:45 +0000 (UTC) (envelope-from hselasky@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 A04621CE1C; Fri, 1 Feb 2019 09:18:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x119IjQN017090; Fri, 1 Feb 2019 09:18:45 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x119IjP1017088; Fri, 1 Feb 2019 09:18:45 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201902010918.x119IjP1017088@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 1 Feb 2019 09:18:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343651 - stable/12/sys/netinet6 X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: stable/12/sys/netinet6 X-SVN-Commit-Revision: 343651 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A9237833B7 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.95)[-0.945,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Feb 2019 09:18:46 -0000 Author: hselasky Date: Fri Feb 1 09:18:44 2019 New Revision: 343651 URL: https://svnweb.freebsd.org/changeset/base/343651 Log: Build fix for missing NET_EPOCH_XXX() dependencies after r343650. This patch is to be reverted when the relevant changes are MFC'ed. This is a direct commit. Sponsored by: Mellanox Technologies Modified: stable/12/sys/netinet6/in6_mcast.c stable/12/sys/netinet6/in6_var.h stable/12/sys/netinet6/mld6.c Modified: stable/12/sys/netinet6/in6_mcast.c ============================================================================== --- stable/12/sys/netinet6/in6_mcast.c Fri Feb 1 09:08:19 2019 (r343650) +++ stable/12/sys/netinet6/in6_mcast.c Fri Feb 1 09:18:44 2019 (r343651) @@ -420,9 +420,9 @@ in6_getmulti(struct ifnet *ifp, const struct in6_addr IN6_MULTI_LOCK_ASSERT(); IN6_MULTI_LIST_LOCK(); IF_ADDR_WLOCK(ifp); - NET_EPOCH_ENTER(et); + NET_EPOCH_ENTER_ET(et); inm = in6m_lookup_locked(ifp, group); - NET_EPOCH_EXIT(et); + NET_EPOCH_EXIT_ET(et); if (inm != NULL) { /* Modified: stable/12/sys/netinet6/in6_var.h ============================================================================== --- stable/12/sys/netinet6/in6_var.h Fri Feb 1 09:08:19 2019 (r343650) +++ stable/12/sys/netinet6/in6_var.h Fri Feb 1 09:18:44 2019 (r343651) @@ -722,8 +722,6 @@ static __inline struct in6_multi * in6m_ifmultiaddr_get_inm(struct ifmultiaddr *ifma) { - NET_EPOCH_ASSERT(); - return ((ifma->ifma_addr->sa_family != AF_INET6 || (ifma->ifma_flags & IFMA_F_ENQUEUED) == 0) ? NULL : ifma->ifma_protospec); Modified: stable/12/sys/netinet6/mld6.c ============================================================================== --- stable/12/sys/netinet6/mld6.c Fri Feb 1 09:08:19 2019 (r343650) +++ stable/12/sys/netinet6/mld6.c Fri Feb 1 09:18:44 2019 (r343651) @@ -556,7 +556,7 @@ mld_ifdetach(struct ifnet *ifp, struct in6_multi_head * Extract list of in6_multi associated with the detaching ifp * which the PF_INET6 layer is about to release. */ - NET_EPOCH_ENTER(et); + NET_EPOCH_ENTER_ET(et); CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { inm = in6m_ifmultiaddr_get_inm(ifma); if (inm == NULL) @@ -576,7 +576,7 @@ mld_ifdetach(struct ifnet *ifp, struct in6_multi_head } } } - NET_EPOCH_EXIT(et); + NET_EPOCH_EXIT_ET(et); IF_ADDR_WUNLOCK(ifp); MLD_UNLOCK(); } @@ -1411,7 +1411,7 @@ mld_fasttimo_vnet(struct in6_multi_head *inmh) } IF_ADDR_WLOCK(ifp); - NET_EPOCH_ENTER(et); + NET_EPOCH_ENTER_ET(et); CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { inm = in6m_ifmultiaddr_get_inm(ifma); if (inm == NULL) @@ -1449,7 +1449,7 @@ mld_fasttimo_vnet(struct in6_multi_head *inmh) mld_dispatch_queue(&scq, 0); break; } - NET_EPOCH_EXIT(et); + NET_EPOCH_EXIT_ET(et); } out_locked: @@ -1685,7 +1685,7 @@ mld_v2_cancel_link_timers(struct mld_ifsoftc *mli) ifp = mli->mli_ifp; IF_ADDR_WLOCK(ifp); - NET_EPOCH_ENTER(et); + NET_EPOCH_ENTER_ET(et); CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { inm = in6m_ifmultiaddr_get_inm(ifma); if (inm == NULL) @@ -1721,7 +1721,7 @@ mld_v2_cancel_link_timers(struct mld_ifsoftc *mli) break; } } - NET_EPOCH_EXIT(et); + NET_EPOCH_EXIT_ET(et); IF_ADDR_WUNLOCK(ifp); in6m_release_list_deferred(&inmh); } From owner-svn-src-stable-12@freebsd.org Fri Feb 1 10:05:52 2019 Return-Path: Delivered-To: svn-src-stable-12@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 A782414CEA78; Fri, 1 Feb 2019 10:05:52 +0000 (UTC) (envelope-from hselasky@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 0D6768564E; Fri, 1 Feb 2019 10:05:52 +0000 (UTC) (envelope-from hselasky@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 83BBE1D698; Fri, 1 Feb 2019 10:05:51 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x11A5pBq042701; Fri, 1 Feb 2019 10:05:51 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x11A5pZq042700; Fri, 1 Feb 2019 10:05:51 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201902011005.x11A5pZq042700@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 1 Feb 2019 10:05:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343654 - in stable/12/sys/compat/linuxkpi/common: include/linux src X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/compat/linuxkpi/common: include/linux src X-SVN-Commit-Revision: 343654 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0D6768564E 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_LONG(-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] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Feb 2019 10:05:53 -0000 Author: hselasky Date: Fri Feb 1 10:05:50 2019 New Revision: 343654 URL: https://svnweb.freebsd.org/changeset/base/343654 Log: MFC r343451: Add full support for PCI_ANY_ID when matching PCI IDs in the LinuxKPI. Sponsored by: Mellanox Technologies Modified: stable/12/sys/compat/linuxkpi/common/include/linux/pci.h stable/12/sys/compat/linuxkpi/common/src/linux_pci.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/compat/linuxkpi/common/include/linux/pci.h ============================================================================== --- stable/12/sys/compat/linuxkpi/common/include/linux/pci.h Fri Feb 1 10:04:54 2019 (r343653) +++ stable/12/sys/compat/linuxkpi/common/include/linux/pci.h Fri Feb 1 10:05:50 2019 (r343654) @@ -71,7 +71,7 @@ struct pci_device_id { #define PCI_BASE_CLASS_BRIDGE 0x06 #define PCI_CLASS_BRIDGE_ISA 0x0601 -#define PCI_ANY_ID (-1) +#define PCI_ANY_ID -1U #define PCI_VENDOR_ID_APPLE 0x106b #define PCI_VENDOR_ID_ASUSTEK 0x1043 #define PCI_VENDOR_ID_ATI 0x1002 Modified: stable/12/sys/compat/linuxkpi/common/src/linux_pci.c ============================================================================== --- stable/12/sys/compat/linuxkpi/common/src/linux_pci.c Fri Feb 1 10:04:54 2019 (r343653) +++ stable/12/sys/compat/linuxkpi/common/src/linux_pci.c Fri Feb 1 10:05:50 2019 (r343654) @@ -82,14 +82,21 @@ linux_pci_find(device_t dev, const struct pci_device_i struct pci_driver *pdrv; uint16_t vendor; uint16_t device; + uint16_t subvendor; + uint16_t subdevice; vendor = pci_get_vendor(dev); device = pci_get_device(dev); + subvendor = pci_get_subvendor(dev); + subdevice = pci_get_subdevice(dev); spin_lock(&pci_lock); list_for_each_entry(pdrv, &pci_drivers, links) { for (id = pdrv->id_table; id->vendor != 0; id++) { - if (vendor == id->vendor && device == id->device) { + if (vendor == id->vendor && + (PCI_ANY_ID == id->device || device == id->device) && + (PCI_ANY_ID == id->subvendor || subvendor == id->subvendor) && + (PCI_ANY_ID == id->subdevice || subdevice == id->subdevice)) { *idp = id; spin_unlock(&pci_lock); return (pdrv); @@ -145,8 +152,8 @@ linux_pci_attach(device_t dev) pdev->dev.bsddev = dev; INIT_LIST_HEAD(&pdev->dev.irqents); pdev->devfn = PCI_DEVFN(pci_get_slot(dev), pci_get_function(dev)); - pdev->device = id->device; - pdev->vendor = id->vendor; + pdev->device = dinfo->cfg.device; + pdev->vendor = dinfo->cfg.vendor; pdev->subsystem_vendor = dinfo->cfg.subvendor; pdev->subsystem_device = dinfo->cfg.subdevice; pdev->class = pci_get_class(dev); From owner-svn-src-stable-12@freebsd.org Fri Feb 1 10:04:54 2019 Return-Path: Delivered-To: svn-src-stable-12@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 497B914CE679; Fri, 1 Feb 2019 10:04:54 +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 D9A4C85296; Fri, 1 Feb 2019 10:04: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 70EF51D694; Fri, 1 Feb 2019 10:04: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 x11A4rON042527; Fri, 1 Feb 2019 10:04:53 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x11A4rkL042526; Fri, 1 Feb 2019 10:04:53 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201902011004.x11A4rkL042526@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Fri, 1 Feb 2019 10:04:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343652 - stable/12/sys/netpfil/pf X-SVN-Group: stable-12 X-SVN-Commit-Author: kp X-SVN-Commit-Paths: stable/12/sys/netpfil/pf X-SVN-Commit-Revision: 343652 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: D9A4C85296 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_LONG(-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] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Feb 2019 10:04:54 -0000 Author: kp Date: Fri Feb 1 10:04:53 2019 New Revision: 343652 URL: https://svnweb.freebsd.org/changeset/base/343652 Log: MFC r343418: pf: Fix use-after-free of counters When cleaning up a vnet we free the counters in V_pf_default_rule and V_pf_status from shutdown_pf(), but we can still use them later, for example through pf_purge_expired_src_nodes(). Free them as the very last operation, as they rely on nothing else themselves. PR: 235097 Modified: stable/12/sys/netpfil/pf/pf_ioctl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- stable/12/sys/netpfil/pf/pf_ioctl.c Fri Feb 1 09:18:44 2019 (r343651) +++ stable/12/sys/netpfil/pf/pf_ioctl.c Fri Feb 1 10:04:53 2019 (r343652) @@ -3989,20 +3989,6 @@ shutdown_pf(void) /* status does not use malloced mem so no need to cleanup */ /* fingerprints and interfaces have their own cleanup code */ - - /* Free counters last as we updated them during shutdown. */ - counter_u64_free(V_pf_default_rule.states_cur); - counter_u64_free(V_pf_default_rule.states_tot); - counter_u64_free(V_pf_default_rule.src_nodes); - - for (int i = 0; i < PFRES_MAX; i++) - counter_u64_free(V_pf_status.counters[i]); - for (int i = 0; i < LCNT_MAX; i++) - counter_u64_free(V_pf_status.lcounters[i]); - for (int i = 0; i < FCNT_MAX; i++) - counter_u64_free(V_pf_status.fcounters[i]); - for (int i = 0; i < SCNT_MAX; i++) - counter_u64_free(V_pf_status.scounters[i]); } while(0); return (error); @@ -4232,6 +4218,20 @@ pf_unload_vnet(void) pf_cleanup(); if (IS_DEFAULT_VNET(curvnet)) pf_mtag_cleanup(); + + /* Free counters last as we updated them during shutdown. */ + counter_u64_free(V_pf_default_rule.states_cur); + counter_u64_free(V_pf_default_rule.states_tot); + counter_u64_free(V_pf_default_rule.src_nodes); + + for (int i = 0; i < PFRES_MAX; i++) + counter_u64_free(V_pf_status.counters[i]); + for (int i = 0; i < LCNT_MAX; i++) + counter_u64_free(V_pf_status.lcounters[i]); + for (int i = 0; i < FCNT_MAX; i++) + counter_u64_free(V_pf_status.fcounters[i]); + for (int i = 0; i < SCNT_MAX; i++) + counter_u64_free(V_pf_status.scounters[i]); } static void From owner-svn-src-stable-12@freebsd.org Fri Feb 1 10:08:35 2019 Return-Path: Delivered-To: svn-src-stable-12@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 8340514CF13B; Fri, 1 Feb 2019 10:08:35 +0000 (UTC) (envelope-from hselasky@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 2359685AE5; Fri, 1 Feb 2019 10:08:35 +0000 (UTC) (envelope-from hselasky@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 1240D1D69B; Fri, 1 Feb 2019 10:08:35 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x11A8YGL042930; Fri, 1 Feb 2019 10:08:34 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x11A8YR0042928; Fri, 1 Feb 2019 10:08:34 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201902011008.x11A8YR0042928@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 1 Feb 2019 10:08:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343656 - in stable/12/sys/dev/usb: . quirk X-SVN-Group: stable-12 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/12/sys/dev/usb: . quirk X-SVN-Commit-Revision: 343656 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2359685AE5 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)[-0.999,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Feb 2019 10:08:35 -0000 Author: hselasky Date: Fri Feb 1 10:08:34 2019 New Revision: 343656 URL: https://svnweb.freebsd.org/changeset/base/343656 Log: MFC r343453: Add new USB quirk. PR: 235202 Differential Revision: https://reviews.freebsd.org/D18917 Sponsored by: Mellanox Technologies Modified: stable/12/sys/dev/usb/quirk/usb_quirk.c stable/12/sys/dev/usb/usbdevs Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- stable/12/sys/dev/usb/quirk/usb_quirk.c Fri Feb 1 10:06:49 2019 (r343655) +++ stable/12/sys/dev/usb/quirk/usb_quirk.c Fri Feb 1 10:08:34 2019 (r343656) @@ -141,6 +141,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK USB_QUIRK(CORSAIR, K70_RGB, 0x0000, 0xffff, UQ_KBD_BOOTPROTO), /* Quirk for Corsair STRAFE Gaming keyboard */ USB_QUIRK(CORSAIR, STRAFE, 0x0000, 0xffff, UQ_KBD_BOOTPROTO), + USB_QUIRK(CORSAIR, STRAFE2, 0x0000, 0xffff, UQ_KBD_BOOTPROTO), /* umodem(4) device quirks */ USB_QUIRK(METRICOM, RICOCHET_GS, 0x100, 0x100, UQ_ASSUME_CM_OVER_DATA), USB_QUIRK(SANYO, SCP4900, 0x000, 0x000, UQ_ASSUME_CM_OVER_DATA), Modified: stable/12/sys/dev/usb/usbdevs ============================================================================== --- stable/12/sys/dev/usb/usbdevs Fri Feb 1 10:06:49 2019 (r343655) +++ stable/12/sys/dev/usb/usbdevs Fri Feb 1 10:08:34 2019 (r343656) @@ -1572,7 +1572,8 @@ product COREGA FETHER_USB_TXC 0x9601 FEther USB-TXC product CORSAIR K60 0x0a60 Corsair Vengeance K60 keyboard product CORSAIR K70 0x1b09 Corsair Vengeance K70 keyboard product CORSAIR K70_RGB 0x1b13 Corsair K70 RGB Keyboard -product CORSAIR STRAFE 0x1b15 Cossair STRAFE Gaming keyboard +product CORSAIR STRAFE 0x1b15 Corsair STRAFE Gaming keyboard +product CORSAIR STRAFE2 0x1b44 Corsair STRAFE Gaming keyboard /* Creative products */ product CREATIVE NOMAD_II 0x1002 Nomad II MP3 player From owner-svn-src-stable-12@freebsd.org Fri Feb 1 12:22:49 2019 Return-Path: Delivered-To: svn-src-stable-12@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 2CBB914AF2CD; Fri, 1 Feb 2019 12:22:49 +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 BCB898B4E8; Fri, 1 Feb 2019 12:22:48 +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 A2B5A1EE12; Fri, 1 Feb 2019 12:22:48 +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 x11CMmGB015102; Fri, 1 Feb 2019 12:22:48 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x11CMmAv015101; Fri, 1 Feb 2019 12:22:48 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201902011222.x11CMmAv015101@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Fri, 1 Feb 2019 12:22:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343659 - stable/12/sys/dev/virtio/network X-SVN-Group: stable-12 X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: stable/12/sys/dev/virtio/network X-SVN-Commit-Revision: 343659 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: BCB898B4E8 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.973,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Feb 2019 12:22:49 -0000 Author: vmaffione Date: Fri Feb 1 12:22:48 2019 New Revision: 343659 URL: https://svnweb.freebsd.org/changeset/base/343659 Log: MFC r343552 vtnet: fix typo in vtnet_free_taskqueues Because of a typo, the code was mistakenly resetting the vtnrx_vq pointer rather than vtntx_tq. Reviewed by: bryanv Differential Revision: https://reviews.freebsd.org/D19015 Modified: stable/12/sys/dev/virtio/network/if_vtnet.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- stable/12/sys/dev/virtio/network/if_vtnet.c Fri Feb 1 10:09:54 2019 (r343658) +++ stable/12/sys/dev/virtio/network/if_vtnet.c Fri Feb 1 12:22:48 2019 (r343659) @@ -2748,7 +2748,7 @@ vtnet_free_taskqueues(struct vtnet_softc *sc) rxq = &sc->vtnet_rxqs[i]; if (rxq->vtnrx_tq != NULL) { taskqueue_free(rxq->vtnrx_tq); - rxq->vtnrx_vq = NULL; + rxq->vtnrx_tq = NULL; } txq = &sc->vtnet_txqs[i]; From owner-svn-src-stable-12@freebsd.org Fri Feb 1 18:19:34 2019 Return-Path: Delivered-To: svn-src-stable-12@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 C488814BC5A6; Fri, 1 Feb 2019 18:19:34 +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 687A9738F0; Fri, 1 Feb 2019 18:19:34 +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 58BCD2298B; Fri, 1 Feb 2019 18:19:34 +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 x11IJYDr000299; Fri, 1 Feb 2019 18:19:34 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x11IJYPs000298; Fri, 1 Feb 2019 18:19:34 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201902011819.x11IJYPs000298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 1 Feb 2019 18:19:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343664 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 343664 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 687A9738F0 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.959,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Feb 2019 18:19:35 -0000 Author: markj Date: Fri Feb 1 18:19:33 2019 New Revision: 343664 URL: https://svnweb.freebsd.org/changeset/base/343664 Log: MFC r343353: Correct uma_prealloc()'s use of domainset iterators after r339925. Modified: stable/12/sys/vm/uma_core.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/uma_core.c ============================================================================== --- stable/12/sys/vm/uma_core.c Fri Feb 1 16:07:49 2019 (r343663) +++ stable/12/sys/vm/uma_core.c Fri Feb 1 18:19:33 2019 (r343664) @@ -236,7 +236,7 @@ static void *pcpu_page_alloc(uma_zone_t, vm_size_t, in static void *startup_alloc(uma_zone_t, vm_size_t, int, uint8_t *, int); static void page_free(void *, vm_size_t, uint8_t); static void pcpu_page_free(void *, vm_size_t, uint8_t); -static uma_slab_t keg_alloc_slab(uma_keg_t, uma_zone_t, int, int); +static uma_slab_t keg_alloc_slab(uma_keg_t, uma_zone_t, int, int, int); static void cache_drain(uma_zone_t); static void bucket_drain(uma_zone_t, uma_bucket_t); static void bucket_cache_drain(uma_zone_t zone); @@ -1050,20 +1050,22 @@ zone_drain(uma_zone_t zone) * otherwise the keg will be left unlocked. * * Arguments: - * wait Shall we wait? + * flags Wait flags for the item initialization routine + * aflags Wait flags for the slab allocation * * Returns: * The slab that was allocated or NULL if there is no memory and the * caller specified M_NOWAIT. */ static uma_slab_t -keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int domain, int wait) +keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int domain, int flags, + int aflags) { uma_alloc allocf; uma_slab_t slab; unsigned long size; uint8_t *mem; - uint8_t flags; + uint8_t sflags; int i; KASSERT(domain >= 0 && domain < vm_ndomains, @@ -1076,7 +1078,7 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom slab = NULL; mem = NULL; if (keg->uk_flags & UMA_ZONE_OFFPAGE) { - slab = zone_alloc_item(keg->uk_slabzone, NULL, domain, wait); + slab = zone_alloc_item(keg->uk_slabzone, NULL, domain, aflags); if (slab == NULL) goto out; } @@ -1089,16 +1091,16 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom */ if ((keg->uk_flags & UMA_ZONE_MALLOC) == 0) - wait |= M_ZERO; + aflags |= M_ZERO; else - wait &= ~M_ZERO; + aflags &= ~M_ZERO; if (keg->uk_flags & UMA_ZONE_NODUMP) - wait |= M_NODUMP; + aflags |= M_NODUMP; /* zone is passed for legacy reasons. */ size = keg->uk_ppera * PAGE_SIZE; - mem = allocf(zone, size, domain, &flags, wait); + mem = allocf(zone, size, domain, &sflags, aflags); if (mem == NULL) { if (keg->uk_flags & UMA_ZONE_OFFPAGE) zone_free_item(keg->uk_slabzone, slab, NULL, SKIP_NONE); @@ -1118,7 +1120,7 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom slab->us_keg = keg; slab->us_data = mem; slab->us_freecount = keg->uk_ipers; - slab->us_flags = flags; + slab->us_flags = sflags; slab->us_domain = domain; BIT_FILL(SLAB_SETSIZE, &slab->us_free); #ifdef INVARIANTS @@ -1128,7 +1130,7 @@ keg_alloc_slab(uma_keg_t keg, uma_zone_t zone, int dom if (keg->uk_init != NULL) { for (i = 0; i < keg->uk_ipers; i++) if (keg->uk_init(slab->us_data + (keg->uk_rsize * i), - keg->uk_size, wait) != 0) + keg->uk_size, flags) != 0) break; if (i != keg->uk_ipers) { keg_free_slab(keg, slab, i); @@ -2770,7 +2772,7 @@ restart: msleep(keg, &keg->uk_lock, PVM, "keglimit", 0); continue; } - slab = keg_alloc_slab(keg, zone, domain, aflags); + slab = keg_alloc_slab(keg, zone, domain, flags, aflags); /* * If we got a slab here it's safe to mark it partially used * and return. We assume that the caller is going to remove @@ -3665,7 +3667,7 @@ uma_prealloc(uma_zone_t zone, int items) uma_domain_t dom; uma_slab_t slab; uma_keg_t keg; - int domain, flags, slabs; + int aflags, domain, slabs; keg = zone_first_keg(zone); if (keg == NULL) @@ -3674,17 +3676,27 @@ uma_prealloc(uma_zone_t zone, int items) slabs = items / keg->uk_ipers; if (slabs * keg->uk_ipers < items) slabs++; - flags = M_WAITOK; - vm_domainset_iter_policy_ref_init(&di, &keg->uk_dr, &domain, &flags); while (slabs-- > 0) { - slab = keg_alloc_slab(keg, zone, domain, flags); - if (slab == NULL) - return; - MPASS(slab->us_keg == keg); - dom = &keg->uk_domain[slab->us_domain]; - LIST_INSERT_HEAD(&dom->ud_free_slab, slab, us_link); - if (vm_domainset_iter_policy(&di, &domain) != 0) - break; + aflags = M_NOWAIT; + vm_domainset_iter_policy_ref_init(&di, &keg->uk_dr, &domain, + &aflags); + for (;;) { + slab = keg_alloc_slab(keg, zone, domain, M_WAITOK, + aflags); + if (slab != NULL) { + MPASS(slab->us_keg == keg); + dom = &keg->uk_domain[slab->us_domain]; + LIST_INSERT_HEAD(&dom->ud_free_slab, slab, + us_link); + break; + } + KEG_LOCK(keg); + if (vm_domainset_iter_policy(&di, &domain) != 0) { + KEG_UNLOCK(keg); + vm_wait_doms(&keg->uk_dr.dr_policy->ds_mask); + KEG_LOCK(keg); + } + } } KEG_UNLOCK(keg); } From owner-svn-src-stable-12@freebsd.org Sat Feb 2 04:19:36 2019 Return-Path: Delivered-To: svn-src-stable-12@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 7608214D2BE4; Sat, 2 Feb 2019 04:19:36 +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 16C4E6D22B; Sat, 2 Feb 2019 04:19:36 +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 08B69154C; Sat, 2 Feb 2019 04:19:36 +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 x124JZQ6022521; Sat, 2 Feb 2019 04:19:35 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x124JZO9022520; Sat, 2 Feb 2019 04:19:35 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201902020419.x124JZO9022520@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sat, 2 Feb 2019 04:19:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343675 - stable/12/libexec/rc X-SVN-Group: stable-12 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: stable/12/libexec/rc X-SVN-Commit-Revision: 343675 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 16C4E6D22B X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.92)[-0.920,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Feb 2019 04:19:36 -0000 Author: avos Date: Sat Feb 2 04:19:35 2019 New Revision: 343675 URL: https://svnweb.freebsd.org/changeset/base/343675 Log: MFC r343499: rc(8): do not stop dhclient(8) when wpa_supplicant(8) / hostapd(8) is used They will stop it automatically ('Interface wlan0 is down, dhclient exiting'); use /etc/rc.d/dhclient stop command only when none of them is used. Modified: stable/12/libexec/rc/network.subr Directory Properties: stable/12/ (props changed) Modified: stable/12/libexec/rc/network.subr ============================================================================== --- stable/12/libexec/rc/network.subr Sat Feb 2 04:15:16 2019 (r343674) +++ stable/12/libexec/rc/network.subr Sat Feb 2 04:19:35 2019 (r343675) @@ -257,9 +257,7 @@ ifconfig_down() elif hostapif $1; then /etc/rc.d/hostapd stop $1 _cfg=0 - fi - - if dhcpif $1; then + elif dhcpif $1; then /etc/rc.d/dhclient stop $1 _cfg=0 fi From owner-svn-src-stable-12@freebsd.org Sat Feb 2 04:27:49 2019 Return-Path: Delivered-To: svn-src-stable-12@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 473AE14D30AE; Sat, 2 Feb 2019 04:27:49 +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 E11256D8C0; Sat, 2 Feb 2019 04:27:48 +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 B7A0A1706; Sat, 2 Feb 2019 04:27:48 +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 x124RmhA027768; Sat, 2 Feb 2019 04:27:48 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x124RmtI027765; Sat, 2 Feb 2019 04:27:48 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201902020427.x124RmtI027765@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sat, 2 Feb 2019 04:27:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343677 - in stable/12: share/man/man4 sys/dev/rtwn/usb sys/dev/usb X-SVN-Group: stable-12 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/dev/rtwn/usb sys/dev/usb X-SVN-Commit-Revision: 343677 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: E11256D8C0 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.92 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; NEURAL_HAM_SHORT(-0.92)[-0.924,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Feb 2019 04:27:49 -0000 Author: avos Date: Sat Feb 2 04:27:47 2019 New Revision: 343677 URL: https://svnweb.freebsd.org/changeset/base/343677 Log: MFC r343518: rtwn_usb(4): add new USB id. Submitted and tested by: Github issue: https://github.com/s3erios/rtwn/issues/4 Modified: stable/12/share/man/man4/rtwn_usb.4 stable/12/sys/dev/rtwn/usb/rtwn_usb_attach.h stable/12/sys/dev/usb/usbdevs Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/rtwn_usb.4 ============================================================================== --- stable/12/share/man/man4/rtwn_usb.4 Sat Feb 2 04:21:00 2019 (r343676) +++ stable/12/share/man/man4/rtwn_usb.4 Sat Feb 2 04:27:47 2019 (r343677) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd January 7, 2019 +.Dd February 2, 2019 .Dt RTWN_USB 4 .Os .Sh NAME @@ -80,6 +80,7 @@ based USB wireless network adapters, including: .It "Edimax EW-7811Un" Ta RTL8188CUS Ta USB 2.0 .It "Edimax EW-7811UTC" Ta RTL8821AU Ta USB 2.0 .It "Edimax EW-7822UAC" Ta RTL8812AU Ta USB 3.0 +.It "EDUP EP-AC1620" Ta RTL8821AU Ta USB 2.0 .It "Elecom WDC-150SU2M" Ta RTL8188EU Ta USB 2.0 .It "EnGenius EUB1200AC" Ta RTL8812AU Ta USB 3.0 .It "Hawking HD65U" Ta RTL8821AU Ta USB 2.0 Modified: stable/12/sys/dev/rtwn/usb/rtwn_usb_attach.h ============================================================================== --- stable/12/sys/dev/rtwn/usb/rtwn_usb_attach.h Sat Feb 2 04:21:00 2019 (r343676) +++ stable/12/sys/dev/rtwn/usb/rtwn_usb_attach.h Sat Feb 2 04:27:47 2019 (r343677) @@ -157,7 +157,8 @@ static const STRUCT_USB_HOST_ID rtwn_devs[] = { RTWN_RTL8821AU_DEV(HAWKING, HD65U), RTWN_RTL8821AU_DEV(MELCO, WIU2433DM), RTWN_RTL8821AU_DEV(NETGEAR, A6100), - RTWN_RTL8821AU_DEV(REALTEK, RTL8821AU) + RTWN_RTL8821AU_DEV(REALTEK, RTL8821AU_1), + RTWN_RTL8821AU_DEV(REALTEK, RTL8821AU_2) #undef RTWN_RTL8821AU_DEV }; Modified: stable/12/sys/dev/usb/usbdevs ============================================================================== --- stable/12/sys/dev/usb/usbdevs Sat Feb 2 04:21:00 2019 (r343676) +++ stable/12/sys/dev/usb/usbdevs Sat Feb 2 04:27:47 2019 (r343677) @@ -3926,6 +3926,7 @@ product REALTEK DUMMY 0x0000 Dummy product product REALTEK USB20CRW 0x0158 USB20CRW Card Reader product REALTEK RTL8188ETV 0x0179 RTL8188ETV product REALTEK RTL8188CTV 0x018a RTL8188CTV +product REALTEK RTL8821AU_2 0x0811 RTL8821AU product REALTEK RTL8188RU_2 0x317f RTL8188RU product REALTEK USBKR100 0x8150 USBKR100 USB Ethernet product REALTEK RTL8152 0x8152 RTL8152 USB Ethernet @@ -3956,7 +3957,7 @@ product REALTEK RTL8187B_2 0x8198 RTL8187B Wireless Ad product REALTEK RTL8712 0x8712 RTL8712 product REALTEK RTL8713 0x8713 RTL8713 product REALTEK RTL8188CU_COMBO 0x8754 RTL8188CU -product REALTEK RTL8821AU 0xa811 RTL8821AU +product REALTEK RTL8821AU_1 0xa811 RTL8821AU product REALTEK RTL8723BU 0xb720 RTL8723BU product REALTEK RTL8192SU 0xc512 RTL8192SU product REALTEK RTL8812AU 0x8812 RTL8812AU Wireless Adapter From owner-svn-src-stable-12@freebsd.org Sat Feb 2 16:57:51 2019 Return-Path: Delivered-To: svn-src-stable-12@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 1498514C376F; Sat, 2 Feb 2019 16:57:51 +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 A74FC8EA65; Sat, 2 Feb 2019 16:57:50 +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 97E9499CD; Sat, 2 Feb 2019 16:57:50 +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 x12GvoKk021255; Sat, 2 Feb 2019 16:57:50 GMT (envelope-from avos@FreeBSD.org) Received: (from avos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x12GvoIO021254; Sat, 2 Feb 2019 16:57:50 GMT (envelope-from avos@FreeBSD.org) Message-Id: <201902021657.x12GvoIO021254@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avos set sender to avos@FreeBSD.org using -f From: Andriy Voskoboinyk Date: Sat, 2 Feb 2019 16:57:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343685 - in stable: 10/tools/build/mk 11/tools/build/mk 12/tools/build/mk X-SVN-Group: stable-12 X-SVN-Commit-Author: avos X-SVN-Commit-Paths: in stable: 10/tools/build/mk 11/tools/build/mk 12/tools/build/mk X-SVN-Commit-Revision: 343685 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A74FC8EA65 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.957,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Feb 2019 16:57:51 -0000 Author: avos Date: Sat Feb 2 16:57:49 2019 New Revision: 343685 URL: https://svnweb.freebsd.org/changeset/base/343685 Log: MFC r343502: Remove RADIUS-related files when WITHOUT_RADIUS_SUPPORT=true is set in src.conf(5) PR: 234041 Modified: stable/12/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/10/tools/build/mk/OptionalObsoleteFiles.inc stable/11/tools/build/mk/OptionalObsoleteFiles.inc Directory Properties: stable/10/ (props changed) stable/11/ (props changed) Modified: stable/12/tools/build/mk/OptionalObsoleteFiles.inc ============================================================================== --- stable/12/tools/build/mk/OptionalObsoleteFiles.inc Sat Feb 2 16:23:45 2019 (r343684) +++ stable/12/tools/build/mk/OptionalObsoleteFiles.inc Sat Feb 2 16:57:49 2019 (r343685) @@ -7287,6 +7287,54 @@ OLD_FILES+=usr/share/man/man8/quotaon.8.gz OLD_FILES+=usr/share/man/man8/repquota.8.gz .endif +.if ${MK_RADIUS_SUPPORT} == no +OLD_FILES+=usr/lib/libradius.a +OLD_FILES+=usr/lib/libradius.so +OLD_LIBS+=usr/lib/libradius.so.4 +OLD_FILES+=usr/lib/libradius_p.a +OLD_FILES+=usr/lib/pam_radius.so +OLD_LIBS+=usr/lib/pam_radius.so.6 +OLD_FILES+=usr/include/radlib.h +OLD_FILES+=usr/include/radlib_vs.h +OLD_FILES+=usr/share/man/man3/libradius.3.gz +OLD_FILES+=usr/share/man/man3/rad_acct_open.3.gz +OLD_FILES+=usr/share/man/man3/rad_add_server.3.gz +OLD_FILES+=usr/share/man/man3/rad_add_server_ex.3.gz +OLD_FILES+=usr/share/man/man3/rad_auth_open.3.gz +OLD_FILES+=usr/share/man/man3/rad_bind_to.3.gz +OLD_FILES+=usr/share/man/man3/rad_close.3.gz +OLD_FILES+=usr/share/man/man3/rad_config.3.gz +OLD_FILES+=usr/share/man/man3/rad_continue_send_request.3.gz +OLD_FILES+=usr/share/man/man3/rad_create_request.3.gz +OLD_FILES+=usr/share/man/man3/rad_create_response.3.gz +OLD_FILES+=usr/share/man/man3/rad_cvt_addr.3.gz +OLD_FILES+=usr/share/man/man3/rad_cvt_int.3.gz +OLD_FILES+=usr/share/man/man3/rad_cvt_string.3.gz +OLD_FILES+=usr/share/man/man3/rad_demangle.3.gz +OLD_FILES+=usr/share/man/man3/rad_demangle_mppe_key.3.gz +OLD_FILES+=usr/share/man/man3/rad_get_attr.3.gz +OLD_FILES+=usr/share/man/man3/rad_get_vendor_attr.3.gz +OLD_FILES+=usr/share/man/man3/rad_init_send_request.3.gz +OLD_FILES+=usr/share/man/man3/rad_put_addr.3.gz +OLD_FILES+=usr/share/man/man3/rad_put_attr.3.gz +OLD_FILES+=usr/share/man/man3/rad_put_int.3.gz +OLD_FILES+=usr/share/man/man3/rad_put_message_authentic.3.gz +OLD_FILES+=usr/share/man/man3/rad_put_string.3.gz +OLD_FILES+=usr/share/man/man3/rad_put_vendor_addr.3.gz +OLD_FILES+=usr/share/man/man3/rad_put_vendor_attr.3.gz +OLD_FILES+=usr/share/man/man3/rad_put_vendor_int.3.gz +OLD_FILES+=usr/share/man/man3/rad_put_vendor_string.3.gz +OLD_FILES+=usr/share/man/man3/rad_receive_request.3.gz +OLD_FILES+=usr/share/man/man3/rad_request_authenticator.3.gz +OLD_FILES+=usr/share/man/man3/rad_send_request.3.gz +OLD_FILES+=usr/share/man/man3/rad_send_response.3.gz +OLD_FILES+=usr/share/man/man3/rad_server_open.3.gz +OLD_FILES+=usr/share/man/man3/rad_server_secret.3.gz +OLD_FILES+=usr/share/man/man3/rad_strerror.3.gz +OLD_FILES+=usr/share/man/man5/radius.conf.5.gz +OLD_FILES+=usr/share/man/man8/pam_radius.8.gz +.endif + .if ${MK_RBOOTD} == no OLD_FILES+=usr/libexec/rbootd OLD_FILES+=usr/share/man/man8/rbootd.8.gz From owner-svn-src-stable-12@freebsd.org Sat Feb 2 17:40:46 2019 Return-Path: Delivered-To: svn-src-stable-12@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 BE05C14C5740; Sat, 2 Feb 2019 17:40: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 2F46D90FA9; Sat, 2 Feb 2019 17:40:45 +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 206EEA0DA; Sat, 2 Feb 2019 17:40:45 +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 x12HejmA043340; Sat, 2 Feb 2019 17:40:45 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x12Hehsq043333; Sat, 2 Feb 2019 17:40:43 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201902021740.x12Hehsq043333@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sat, 2 Feb 2019 17:40:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343686 - in stable/12/sys/netpfil/ipfw: . nat64 nptv6 X-SVN-Group: stable-12 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in stable/12/sys/netpfil/ipfw: . nat64 nptv6 X-SVN-Commit-Revision: 343686 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 2F46D90FA9 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.952,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Feb 2019 17:40:46 -0000 Author: ae Date: Sat Feb 2 17:40:43 2019 New Revision: 343686 URL: https://svnweb.freebsd.org/changeset/base/343686 Log: MFC r341471: Reimplement how net.inet.ip.fw.dyn_keep_states works. Turning on of this feature allows to keep dynamic states when parent rule is deleted. But it worked only when the default rule is "allow from any to any". Now when rule with dynamic opcode is going to be deleted, and net.inet.ip.fw.dyn_keep_states is enabled, existing states will reference named objects corresponding to this rule, and also reference the rule. And when ipfw_dyn_lookup_state() will find state for deleted parent rule, it will return the pointer to the deleted rule, that is still valid. This implementation doesn't support O_LIMIT_PARENT rules. The refcnt field was added to struct ip_fw to keep reference, also next pointer added to be able iterate rules and not damage the content when deleted rules are chained. Named objects are referenced only when states are going to be deleted to be able reuse kidx of named objects when new parent rules will be installed. ipfw_dyn_get_count() function was modified and now it also looks into dynamic states and constructs maps of existing named objects. This is needed to correctly export orphaned states into userland. ipfw_free_rule() was changed to be global, since now dynamic state can free rule, when it is expired and references counters becomes 1. External actions subsystem also modified, since external actions can be deregisterd and instances can be destroyed. In these cases deleted rules, that are referenced by orphaned states, must be modified to prevent access to freed memory. ipfw_dyn_reset_eaction(), ipfw_reset_eaction_instance() functions added for these purposes. Obtained from: Yandex LLC Sponsored by: Yandex LLC Differential Revision: https://reviews.freebsd.org/D17532 Modified: stable/12/sys/netpfil/ipfw/ip_fw_dynamic.c stable/12/sys/netpfil/ipfw/ip_fw_eaction.c stable/12/sys/netpfil/ipfw/ip_fw_private.h stable/12/sys/netpfil/ipfw/ip_fw_sockopt.c stable/12/sys/netpfil/ipfw/nat64/nat64lsn_control.c stable/12/sys/netpfil/ipfw/nat64/nat64stl_control.c stable/12/sys/netpfil/ipfw/nptv6/nptv6.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netpfil/ipfw/ip_fw_dynamic.c ============================================================================== --- stable/12/sys/netpfil/ipfw/ip_fw_dynamic.c Sat Feb 2 16:57:49 2019 (r343685) +++ stable/12/sys/netpfil/ipfw/ip_fw_dynamic.c Sat Feb 2 17:40:43 2019 (r343686) @@ -122,6 +122,12 @@ __FBSDID("$FreeBSD$"); (d)->bcnt_ ## dir += pktlen; \ } while (0) +#define DYN_REFERENCED 0x01 +/* + * DYN_REFERENCED flag is used to show that state keeps reference to named + * object, and this reference should be released when state becomes expired. + */ + struct dyn_data { void *parent; /* pointer to parent rule */ uint32_t chain_id; /* cached ruleset id */ @@ -129,7 +135,8 @@ struct dyn_data { uint32_t hashval; /* hash value used for hash resize */ uint16_t fibnum; /* fib used to send keepalives */ - uint8_t _pad[3]; + uint8_t _pad[2]; + uint8_t flags; /* internal flags */ uint8_t set; /* parent rule set number */ uint16_t rulenum; /* parent rule number */ uint32_t ruleid; /* parent rule id */ @@ -1399,20 +1406,29 @@ ipfw_dyn_lookup_state(const struct ip_fw_args *args, c * should be deleted by dyn_expire_states(). * * In case when dyn_keep_states is enabled, return - * pointer to default rule and corresponding f_pos - * value. - * XXX: In this case we lose the cache efficiency, - * since f_pos is not cached, because it seems - * there is no easy way to atomically switch - * all fields related to parent rule of given - * state. + * pointer to deleted rule and f_pos value + * corresponding to penultimate rule. + * When we have enabled V_dyn_keep_states, states + * that become orphaned will get the DYN_REFERENCED + * flag and rule will keep around. So we can return + * it. But since it is not in the rules map, we need + * return such f_pos value, so after the state + * handling if the search will continue, the next rule + * will be the last one - the default rule. */ if (V_layer3_chain.map[data->f_pos] == rule) { data->chain_id = V_layer3_chain.id; info->f_pos = data->f_pos; } else if (V_dyn_keep_states != 0) { - rule = V_layer3_chain.default_rule; - info->f_pos = V_layer3_chain.n_rules - 1; + /* + * The original rule pointer is still usable. + * So, we return it, but f_pos need to be + * changed to point to the penultimate rule. + */ + MPASS(V_layer3_chain.n_rules > 1); + data->chain_id = V_layer3_chain.id; + data->f_pos = V_layer3_chain.n_rules - 2; + info->f_pos = data->f_pos; } else { rule = NULL; info->direction = MATCH_NONE; @@ -2112,40 +2128,102 @@ dyn_match_range(uint16_t rulenum, uint8_t set, const i return (1); } +static void +dyn_acquire_rule(struct ip_fw_chain *ch, struct dyn_data *data, + struct ip_fw *rule, uint16_t kidx) +{ + struct dyn_state_obj *obj; + + /* + * Do not acquire reference twice. + * This can happen when rule deletion executed for + * the same range, but different ruleset id. + */ + if (data->flags & DYN_REFERENCED) + return; + + IPFW_UH_WLOCK_ASSERT(ch); + MPASS(kidx != 0); + + data->flags |= DYN_REFERENCED; + /* Reference the named object */ + obj = SRV_OBJECT(ch, kidx); + obj->no.refcnt++; + MPASS(obj->no.etlv == IPFW_TLV_STATE_NAME); + + /* Reference the parent rule */ + rule->refcnt++; +} + +static void +dyn_release_rule(struct ip_fw_chain *ch, struct dyn_data *data, + struct ip_fw *rule, uint16_t kidx) +{ + struct dyn_state_obj *obj; + + IPFW_UH_WLOCK_ASSERT(ch); + MPASS(kidx != 0); + + obj = SRV_OBJECT(ch, kidx); + if (obj->no.refcnt == 1) + dyn_destroy(ch, &obj->no); + else + obj->no.refcnt--; + + if (--rule->refcnt == 1) + ipfw_free_rule(rule); +} + +/* + * We do not keep O_LIMIT_PARENT states when V_dyn_keep_states is enabled. + * O_LIMIT state is created when new connection is going to be established + * and there is no matching state. So, since the old parent rule was deleted + * we can't create new states with old parent, and thus we can not account + * new connections with already established connections, and can not do + * proper limiting. + */ static int -dyn_match_ipv4_state(struct dyn_ipv4_state *s, const ipfw_range_tlv *rt) +dyn_match_ipv4_state(struct ip_fw_chain *ch, struct dyn_ipv4_state *s, + const ipfw_range_tlv *rt) { + struct ip_fw *rule; + int ret; if (s->type == O_LIMIT_PARENT) return (dyn_match_range(s->limit->rulenum, s->limit->set, rt)); - if (s->type == O_LIMIT) - return (dyn_match_range(s->data->rulenum, s->data->set, rt)); + ret = dyn_match_range(s->data->rulenum, s->data->set, rt); + if (ret == 0 || V_dyn_keep_states == 0) + return (ret); - if (V_dyn_keep_states == 0 && - dyn_match_range(s->data->rulenum, s->data->set, rt)) - return (1); - + rule = s->data->parent; + if (s->type == O_LIMIT) + rule = ((struct dyn_ipv4_state *)rule)->limit->parent; + dyn_acquire_rule(ch, s->data, rule, s->kidx); return (0); } #ifdef INET6 static int -dyn_match_ipv6_state(struct dyn_ipv6_state *s, const ipfw_range_tlv *rt) +dyn_match_ipv6_state(struct ip_fw_chain *ch, struct dyn_ipv6_state *s, + const ipfw_range_tlv *rt) { + struct ip_fw *rule; + int ret; if (s->type == O_LIMIT_PARENT) return (dyn_match_range(s->limit->rulenum, s->limit->set, rt)); - if (s->type == O_LIMIT) - return (dyn_match_range(s->data->rulenum, s->data->set, rt)); + ret = dyn_match_range(s->data->rulenum, s->data->set, rt); + if (ret == 0 || V_dyn_keep_states == 0) + return (ret); - if (V_dyn_keep_states == 0 && - dyn_match_range(s->data->rulenum, s->data->set, rt)) - return (1); - + rule = s->data->parent; + if (s->type == O_LIMIT) + rule = ((struct dyn_ipv6_state *)rule)->limit->parent; + dyn_acquire_rule(ch, s->data, rule, s->kidx); return (0); } #endif @@ -2155,7 +2233,7 @@ dyn_match_ipv6_state(struct dyn_ipv6_state *s, const i * @rt can be used to specify the range of states for deletion. */ static void -dyn_expire_states(struct ip_fw_chain *chain, ipfw_range_tlv *rt) +dyn_expire_states(struct ip_fw_chain *ch, ipfw_range_tlv *rt) { struct dyn_ipv4_slist expired_ipv4; #ifdef INET6 @@ -2163,8 +2241,11 @@ dyn_expire_states(struct ip_fw_chain *chain, ipfw_rang struct dyn_ipv6_state *s6, *s6n, *s6p; #endif struct dyn_ipv4_state *s4, *s4n, *s4p; + void *rule; int bucket, removed, length, max_length; + IPFW_UH_WLOCK_ASSERT(ch); + /* * Unlink expired states from each bucket. * With acquired bucket lock iterate entries of each lists: @@ -2189,7 +2270,8 @@ dyn_expire_states(struct ip_fw_chain *chain, ipfw_rang while (s != NULL) { \ next = CK_SLIST_NEXT(s, entry); \ if ((TIME_LEQ((s)->exp, time_uptime) && extra) || \ - (rt != NULL && dyn_match_ ## af ## _state(s, rt))) {\ + (rt != NULL && \ + dyn_match_ ## af ## _state(ch, s, rt))) { \ if (prev != NULL) \ CK_SLIST_REMOVE_AFTER(prev, entry); \ else \ @@ -2201,6 +2283,14 @@ dyn_expire_states(struct ip_fw_chain *chain, ipfw_rang DYN_COUNT_DEC(dyn_parent_count); \ else { \ DYN_COUNT_DEC(dyn_count); \ + if (s->data->flags & DYN_REFERENCED) { \ + rule = s->data->parent; \ + if (s->type == O_LIMIT) \ + rule = ((__typeof(s)) \ + rule)->limit->parent;\ + dyn_release_rule(ch, s->data, \ + rule, s->kidx); \ + } \ if (s->type == O_LIMIT) { \ s = s->data->parent; \ DPARENT_COUNT_DEC(s->limit); \ @@ -2685,6 +2775,42 @@ ipfw_expire_dyn_states(struct ip_fw_chain *chain, ipfw } /* + * Pass through all states and reset eaction for orphaned rules. + */ +void +ipfw_dyn_reset_eaction(struct ip_fw_chain *ch, uint16_t eaction_id, + uint16_t default_id, uint16_t instance_id) +{ +#ifdef INET6 + struct dyn_ipv6_state *s6; +#endif + struct dyn_ipv4_state *s4; + struct ip_fw *rule; + uint32_t bucket; + +#define DYN_RESET_EACTION(s, h, b) \ + CK_SLIST_FOREACH(s, &V_dyn_ ## h[b], entry) { \ + if ((s->data->flags & DYN_REFERENCED) == 0) \ + continue; \ + rule = s->data->parent; \ + if (s->type == O_LIMIT) \ + rule = ((__typeof(s))rule)->limit->parent; \ + ipfw_reset_eaction(ch, rule, eaction_id, \ + default_id, instance_id); \ + } + + IPFW_UH_WLOCK_ASSERT(ch); + if (V_dyn_count == 0) + return; + for (bucket = 0; bucket < V_curr_dyn_buckets; bucket++) { + DYN_RESET_EACTION(s4, ipv4, bucket); +#ifdef INET6 + DYN_RESET_EACTION(s6, ipv6, bucket); +#endif + } +} + +/* * Returns size of dynamic states in legacy format */ int @@ -2696,11 +2822,40 @@ ipfw_dyn_len(void) /* * Returns number of dynamic states. + * Marks every named object index used by dynamic states with bit in @bmask. + * Returns number of named objects accounted in bmask via @nocnt. * Used by dump format v1 (current). */ uint32_t -ipfw_dyn_get_count(void) +ipfw_dyn_get_count(uint32_t *bmask, int *nocnt) { +#ifdef INET6 + struct dyn_ipv6_state *s6; +#endif + struct dyn_ipv4_state *s4; + uint32_t bucket; + +#define DYN_COUNT_OBJECTS(s, h, b) \ + CK_SLIST_FOREACH(s, &V_dyn_ ## h[b], entry) { \ + MPASS(s->kidx != 0); \ + if (ipfw_mark_object_kidx(bmask, IPFW_TLV_STATE_NAME, \ + s->kidx) != 0) \ + (*nocnt)++; \ + } + + IPFW_UH_RLOCK_ASSERT(&V_layer3_chain); + + /* No need to pass through all the buckets. */ + *nocnt = 0; + if (V_dyn_count + V_dyn_parent_count == 0) + return (0); + + for (bucket = 0; bucket < V_curr_dyn_buckets; bucket++) { + DYN_COUNT_OBJECTS(s4, ipv4, bucket); +#ifdef INET6 + DYN_COUNT_OBJECTS(s6, ipv6, bucket); +#endif + } return (V_dyn_count + V_dyn_parent_count); } Modified: stable/12/sys/netpfil/ipfw/ip_fw_eaction.c ============================================================================== --- stable/12/sys/netpfil/ipfw/ip_fw_eaction.c Sat Feb 2 16:57:49 2019 (r343685) +++ stable/12/sys/netpfil/ipfw/ip_fw_eaction.c Sat Feb 2 17:40:43 2019 (r343686) @@ -252,11 +252,10 @@ destroy_eaction_obj(struct ip_fw_chain *ch, struct nam * Resets all eaction opcodes to default handlers. */ static void -reset_eaction_obj(struct ip_fw_chain *ch, uint16_t eaction_id) +reset_eaction_rules(struct ip_fw_chain *ch, uint16_t eaction_id, + uint16_t instance_id, bool reset_rules) { struct named_object *no; - struct ip_fw *rule; - ipfw_insn *cmd; int i; IPFW_UH_WLOCK_ASSERT(ch); @@ -267,35 +266,32 @@ reset_eaction_obj(struct ip_fw_chain *ch, uint16_t eac panic("Default external action handler is not found"); if (eaction_id == no->kidx) panic("Wrong eaction_id"); - EACTION_DEBUG("replace id %u with %u", eaction_id, no->kidx); + + EACTION_DEBUG("Going to replace id %u with %u", eaction_id, no->kidx); IPFW_WLOCK(ch); - for (i = 0; i < ch->n_rules; i++) { - rule = ch->map[i]; - cmd = ACTION_PTR(rule); - if (cmd->opcode != O_EXTERNAL_ACTION) - continue; - if (cmd->arg1 != eaction_id) - continue; - cmd->arg1 = no->kidx; /* Set to default id */ - /* - * XXX: we only bump refcount on default_eaction. - * Refcount on the original object will be just - * ignored on destroy. But on default_eaction it - * will be decremented on rule deletion. - */ - no->refcnt++; - /* - * Since named_object related to this instance will be - * also destroyed, truncate the chain of opcodes to - * remove the rest of cmd chain just after O_EXTERNAL_ACTION - * opcode. - */ - if (rule->act_ofs < rule->cmd_len - 1) { - EACTION_DEBUG("truncate rule %d: len %u -> %u", - rule->rulenum, rule->cmd_len, rule->act_ofs + 1); - rule->cmd_len = rule->act_ofs + 1; + /* + * Reset eaction objects only if it is referenced by rules. + * But always reset objects for orphaned dynamic states. + */ + if (reset_rules) { + for (i = 0; i < ch->n_rules; i++) { + /* + * Refcount on the original object will be just + * ignored on destroy. Refcount on default_eaction + * will be decremented on rule deletion, thus we + * need to reference default_eaction object. + */ + if (ipfw_reset_eaction(ch, ch->map[i], eaction_id, + no->kidx, instance_id) != 0) + no->refcnt++; } } + /* + * Reset eaction opcodes for orphaned dynamic states. + * Since parent rules are already deleted, we don't need to + * reference named object of default_eaction. + */ + ipfw_dyn_reset_eaction(ch, eaction_id, no->kidx, instance_id); IPFW_WUNLOCK(ch); } @@ -368,12 +364,71 @@ ipfw_del_eaction(struct ip_fw_chain *ch, uint16_t eact IPFW_UH_WUNLOCK(ch); return (EINVAL); } - if (no->refcnt > 1) - reset_eaction_obj(ch, eaction_id); + reset_eaction_rules(ch, eaction_id, 0, (no->refcnt > 1)); EACTION_DEBUG("External action '%s' with id %u unregistered", no->name, eaction_id); destroy_eaction_obj(ch, no); IPFW_UH_WUNLOCK(ch); + return (0); +} + +int +ipfw_reset_eaction(struct ip_fw_chain *ch, struct ip_fw *rule, + uint16_t eaction_id, uint16_t default_id, uint16_t instance_id) +{ + ipfw_insn *cmd, *icmd; + + IPFW_UH_WLOCK_ASSERT(ch); + IPFW_WLOCK_ASSERT(ch); + + cmd = ACTION_PTR(rule); + if (cmd->opcode != O_EXTERNAL_ACTION || + cmd->arg1 != eaction_id) + return (0); + + if (instance_id != 0 && rule->act_ofs < rule->cmd_len - 1) { + icmd = cmd + 1; + if (icmd->opcode != O_EXTERNAL_INSTANCE || + icmd->arg1 != instance_id) + return (0); + /* FALLTHROUGH */ + } + + cmd->arg1 = default_id; /* Set to default id */ + /* + * Since named_object related to this instance will be + * also destroyed, truncate the chain of opcodes to + * remove the rest of cmd chain just after O_EXTERNAL_ACTION + * opcode. + */ + if (rule->act_ofs < rule->cmd_len - 1) { + EACTION_DEBUG("truncate rule %d: len %u -> %u", + rule->rulenum, rule->cmd_len, rule->act_ofs + 1); + rule->cmd_len = rule->act_ofs + 1; + } + /* + * Return 1 when reset successfully happened. + */ + return (1); +} + +/* + * This function should be called before external action instance is + * destroyed. It will reset eaction_id to default_id for rules, where + * eaction has instance with id == kidx. + */ +int +ipfw_reset_eaction_instance(struct ip_fw_chain *ch, uint16_t eaction_id, + uint16_t kidx) +{ + struct named_object *no; + + IPFW_UH_WLOCK_ASSERT(ch); + no = ipfw_objhash_lookup_kidx(CHAIN_TO_SRV(ch), eaction_id); + if (no == NULL || no->etlv != IPFW_TLV_EACTION) + return (EINVAL); + + reset_eaction_rules(ch, eaction_id, kidx, 0); return (0); } Modified: stable/12/sys/netpfil/ipfw/ip_fw_private.h ============================================================================== --- stable/12/sys/netpfil/ipfw/ip_fw_private.h Sat Feb 2 16:57:49 2019 (r343685) +++ stable/12/sys/netpfil/ipfw/ip_fw_private.h Sat Feb 2 17:40:43 2019 (r343686) @@ -146,6 +146,9 @@ enum { /* * Function definitions. */ +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); @@ -156,6 +159,7 @@ void ipfw_nat_destroy(void); /* In ip_fw_log.c */ struct ip; struct ip_fw_chain; + void ipfw_bpf_init(int); void ipfw_bpf_uninit(int); void ipfw_bpf_mtap2(void *, u_int, struct mbuf *); @@ -168,6 +172,7 @@ VNET_DECLARE(int, verbose_limit); #define V_verbose_limit VNET(verbose_limit) /* In ip_fw_dynamic.c */ +struct sockopt_data; enum { /* result for matching dynamic rules */ MATCH_REVERSE = 0, @@ -177,19 +182,6 @@ enum { /* result for matching dynamic rules */ }; /* - * The lock for dynamic rules is only used once outside the file, - * and only to release the result of lookup_dyn_rule(). - * Eventually we may implement it with a callback on the function. - */ -struct ip_fw_chain; -struct sockopt_data; -int ipfw_is_dyn_rule(struct ip_fw *rule); -void ipfw_expire_dyn_states(struct ip_fw_chain *, ipfw_range_tlv *); - -struct tcphdr; -struct mbuf *ipfw_send_pkt(struct mbuf *, struct ipfw_flow_id *, - u_int32_t, u_int32_t, int); -/* * Macro to determine that we need to do or redo dynamic state lookup. * direction == MATCH_UNKNOWN means that this is first lookup, then we need * to do lookup. @@ -219,13 +211,17 @@ struct ip_fw *ipfw_dyn_lookup_state(const struct ip_fw const void *ulp, int pktlen, const ipfw_insn *cmd, struct ipfw_dyn_info *info); +int ipfw_is_dyn_rule(struct ip_fw *rule); +void ipfw_expire_dyn_states(struct ip_fw_chain *, ipfw_range_tlv *); void ipfw_get_dynamic(struct ip_fw_chain *chain, char **bp, const char *ep); int ipfw_dump_states(struct ip_fw_chain *chain, struct sockopt_data *sd); void ipfw_dyn_init(struct ip_fw_chain *); /* per-vnet initialization */ void ipfw_dyn_uninit(int); /* per-vnet deinitialization */ int ipfw_dyn_len(void); -uint32_t ipfw_dyn_get_count(void); +uint32_t ipfw_dyn_get_count(uint32_t *, int *); +void ipfw_dyn_reset_eaction(struct ip_fw_chain *ch, uint16_t eaction_id, + uint16_t default_id, uint16_t instance_id); /* common variables */ VNET_DECLARE(int, fw_one_pass); @@ -280,7 +276,9 @@ struct ip_fw { uint32_t id; /* rule id */ uint32_t cached_id; /* used by jump_fast */ uint32_t cached_pos; /* used by jump_fast */ + uint32_t refcnt; /* number of references */ + struct ip_fw *next; /* linked list of deleted rules */ ipfw_insn cmd[1]; /* storage for commands */ }; @@ -650,7 +648,6 @@ void ipfw_init_skipto_cache(struct ip_fw_chain *chain) void ipfw_destroy_skipto_cache(struct ip_fw_chain *chain); int ipfw_find_rule(struct ip_fw_chain *chain, uint32_t key, uint32_t id); int ipfw_ctl3(struct sockopt *sopt); -int ipfw_chk(struct ip_fw_args *args); int ipfw_add_protected_rule(struct ip_fw_chain *chain, struct ip_fw *rule, int locked); void ipfw_reap_add(struct ip_fw_chain *chain, struct ip_fw **head, @@ -659,7 +656,9 @@ void ipfw_reap_rules(struct ip_fw *head); void ipfw_init_counters(void); void ipfw_destroy_counters(void); struct ip_fw *ipfw_alloc_rule(struct ip_fw_chain *chain, size_t rulesize); +void ipfw_free_rule(struct ip_fw *rule); int ipfw_match_range(struct ip_fw *rule, ipfw_range_tlv *rt); +int ipfw_mark_object_kidx(uint32_t *bmask, uint16_t etlv, uint16_t kidx); typedef int (sopt_handler_f)(struct ip_fw_chain *ch, ip_fw3_opheader *op3, struct sockopt_data *sd); @@ -758,6 +757,10 @@ uint16_t ipfw_add_eaction(struct ip_fw_chain *ch, ipfw int ipfw_del_eaction(struct ip_fw_chain *ch, uint16_t eaction_id); int ipfw_run_eaction(struct ip_fw_chain *ch, struct ip_fw_args *args, ipfw_insn *cmd, int *done); +int ipfw_reset_eaction(struct ip_fw_chain *ch, struct ip_fw *rule, + uint16_t eaction_id, uint16_t default_id, uint16_t instance_id); +int ipfw_reset_eaction_instance(struct ip_fw_chain *ch, uint16_t eaction_id, + uint16_t instance_id); /* In ip_fw_table.c */ struct table_info; Modified: stable/12/sys/netpfil/ipfw/ip_fw_sockopt.c ============================================================================== --- stable/12/sys/netpfil/ipfw/ip_fw_sockopt.c Sat Feb 2 16:57:49 2019 (r343685) +++ stable/12/sys/netpfil/ipfw/ip_fw_sockopt.c Sat Feb 2 17:40:43 2019 (r343686) @@ -161,8 +161,6 @@ static int set_legacy_obj_kidx(struct ip_fw_chain *ch, struct ip_fw_rule0 *rule); static struct opcode_obj_rewrite *find_op_rw(ipfw_insn *cmd, uint16_t *puidx, uint8_t *ptype); -static int mark_object_kidx(struct ip_fw_chain *ch, struct ip_fw *rule, - uint32_t *bmask); static int ref_rule_objects(struct ip_fw_chain *ch, struct ip_fw *rule, struct rule_check_info *ci, struct obj_idx *oib, struct tid_info *ti); static int ref_opcode_object(struct ip_fw_chain *ch, ipfw_insn *cmd, @@ -209,14 +207,23 @@ ipfw_alloc_rule(struct ip_fw_chain *chain, size_t rule rule = malloc(rulesize, M_IPFW, M_WAITOK | M_ZERO); rule->cntr = uma_zalloc_pcpu(V_ipfw_cntr_zone, M_WAITOK | M_ZERO); + rule->refcnt = 1; return (rule); } -static void -free_rule(struct ip_fw *rule) +void +ipfw_free_rule(struct ip_fw *rule) { + /* + * We don't release refcnt here, since this function + * can be called without any locks held. The caller + * must release reference under IPFW_UH_WLOCK, and then + * call this function if refcount becomes 1. + */ + if (rule->refcnt > 1) + return; uma_zfree_pcpu(V_ipfw_cntr_zone, rule->cntr); free(rule, M_IPFW); } @@ -827,7 +834,7 @@ ipfw_reap_add(struct ip_fw_chain *chain, struct ip_fw /* Unlink rule from everywhere */ unref_rule_objects(chain, rule); - *((struct ip_fw **)rule) = *head; + rule->next = *head; *head = rule; } @@ -842,8 +849,8 @@ ipfw_reap_rules(struct ip_fw *head) struct ip_fw *rule; while ((rule = head) != NULL) { - head = *((struct ip_fw **)head); - free_rule(rule); + head = head->next; + ipfw_free_rule(rule); } } @@ -2187,6 +2194,7 @@ struct dump_args { uint32_t rsize; /* rules size */ uint32_t tcount; /* number of tables */ int rcounters; /* counters */ + uint32_t *bmask; /* index bitmask of used named objects */ }; void @@ -2223,6 +2231,49 @@ export_objhash_ntlv(struct namedobj_instance *ni, uint return (0); } +static int +export_named_objects(struct namedobj_instance *ni, struct dump_args *da, + struct sockopt_data *sd) +{ + int error, i; + + for (i = 0; i < IPFW_TABLES_MAX && da->tcount > 0; i++) { + if ((da->bmask[i / 32] & (1 << (i % 32))) == 0) + continue; + if ((error = export_objhash_ntlv(ni, i, sd)) != 0) + return (error); + da->tcount--; + } + return (0); +} + +static int +dump_named_objects(struct ip_fw_chain *ch, struct dump_args *da, + struct sockopt_data *sd) +{ + ipfw_obj_ctlv *ctlv; + int error; + + MPASS(da->tcount > 0); + /* Header first */ + ctlv = (ipfw_obj_ctlv *)ipfw_get_sopt_space(sd, sizeof(*ctlv)); + if (ctlv == NULL) + return (ENOMEM); + ctlv->head.type = IPFW_TLV_TBLNAME_LIST; + ctlv->head.length = da->tcount * sizeof(ipfw_obj_ntlv) + + sizeof(*ctlv); + ctlv->count = da->tcount; + ctlv->objsize = sizeof(ipfw_obj_ntlv); + + /* Dump table names first (if any) */ + error = export_named_objects(ipfw_get_table_objhash(ch), da, sd); + if (error != 0) + return (error); + /* Then dump another named objects */ + da->bmask += IPFW_TABLES_MAX / 32; + return (export_named_objects(CHAIN_TO_SRV(ch), da, sd)); +} + /* * Dumps static rules with table TLVs in buffer @sd. * @@ -2230,52 +2281,13 @@ export_objhash_ntlv(struct namedobj_instance *ni, uint */ static int dump_static_rules(struct ip_fw_chain *chain, struct dump_args *da, - uint32_t *bmask, struct sockopt_data *sd) + struct sockopt_data *sd) { - int error; - int i, l; - uint32_t tcount; ipfw_obj_ctlv *ctlv; struct ip_fw *krule; - struct namedobj_instance *ni; caddr_t dst; + int i, l; - /* Dump table names first (if any) */ - if (da->tcount > 0) { - /* Header first */ - ctlv = (ipfw_obj_ctlv *)ipfw_get_sopt_space(sd, sizeof(*ctlv)); - if (ctlv == NULL) - return (ENOMEM); - ctlv->head.type = IPFW_TLV_TBLNAME_LIST; - ctlv->head.length = da->tcount * sizeof(ipfw_obj_ntlv) + - sizeof(*ctlv); - ctlv->count = da->tcount; - ctlv->objsize = sizeof(ipfw_obj_ntlv); - } - - i = 0; - tcount = da->tcount; - ni = ipfw_get_table_objhash(chain); - while (tcount > 0) { - if ((bmask[i / 32] & (1 << (i % 32))) == 0) { - i++; - continue; - } - - /* Jump to shared named object bitmask */ - if (i >= IPFW_TABLES_MAX) { - ni = CHAIN_TO_SRV(chain); - i -= IPFW_TABLES_MAX; - bmask += IPFW_TABLES_MAX / 32; - } - - if ((error = export_objhash_ntlv(ni, i, sd)) != 0) - return (error); - - i++; - tcount--; - } - /* Dump rules */ ctlv = (ipfw_obj_ctlv *)ipfw_get_sopt_space(sd, sizeof(*ctlv)); if (ctlv == NULL) @@ -2300,27 +2312,41 @@ dump_static_rules(struct ip_fw_chain *chain, struct du return (0); } +int +ipfw_mark_object_kidx(uint32_t *bmask, uint16_t etlv, uint16_t kidx) +{ + uint32_t bidx; + + /* + * Maintain separate bitmasks for table and non-table objects. + */ + bidx = (etlv == IPFW_TLV_TBL_NAME) ? 0: IPFW_TABLES_MAX / 32; + bidx += kidx / 32; + if ((bmask[bidx] & (1 << (kidx % 32))) != 0) + return (0); + + bmask[bidx] |= 1 << (kidx % 32); + return (1); +} + /* * Marks every object index used in @rule with bit in @bmask. * Used to generate bitmask of referenced tables/objects for given ruleset * or its part. - * - * Returns number of newly-referenced objects. */ -static int -mark_object_kidx(struct ip_fw_chain *ch, struct ip_fw *rule, - uint32_t *bmask) +static void +mark_rule_objects(struct ip_fw_chain *ch, struct ip_fw *rule, + struct dump_args *da) { struct opcode_obj_rewrite *rw; ipfw_insn *cmd; - int bidx, cmdlen, l, count; + int cmdlen, l; uint16_t kidx; uint8_t subtype; l = rule->cmd_len; cmd = rule->cmd; cmdlen = 0; - count = 0; for ( ; l > 0 ; l -= cmdlen, cmd += cmdlen) { cmdlen = F_LEN(cmd); @@ -2328,21 +2354,9 @@ mark_object_kidx(struct ip_fw_chain *ch, struct ip_fw if (rw == NULL) continue; - bidx = kidx / 32; - /* - * Maintain separate bitmasks for table and - * non-table objects. - */ - if (rw->etlv != IPFW_TLV_TBL_NAME) - bidx += IPFW_TABLES_MAX / 32; - - if ((bmask[bidx] & (1 << (kidx % 32))) == 0) - count++; - - bmask[bidx] |= 1 << (kidx % 32); + if (ipfw_mark_object_kidx(da->bmask, rw->etlv, kidx)) + da->tcount++; } - - return (count); } /* @@ -2366,13 +2380,12 @@ static int dump_config(struct ip_fw_chain *chain, ip_fw3_opheader *op3, struct sockopt_data *sd) { + struct dump_args da; ipfw_cfg_lheader *hdr; struct ip_fw *rule; size_t sz, rnum; - uint32_t hdr_flags; + uint32_t hdr_flags, *bmask; int error, i; - struct dump_args da; - uint32_t *bmask; hdr = (ipfw_cfg_lheader *)ipfw_get_sopt_header(sd, sizeof(*hdr)); if (hdr == NULL) @@ -2380,9 +2393,15 @@ dump_config(struct ip_fw_chain *chain, ip_fw3_opheader error = 0; bmask = NULL; - /* Allocate needed state. Note we allocate 2xspace mask, for table&srv */ - if (hdr->flags & IPFW_CFG_GET_STATIC) - bmask = malloc(IPFW_TABLES_MAX / 4, M_TEMP, M_WAITOK | M_ZERO); + memset(&da, 0, sizeof(da)); + /* + * Allocate needed state. + * Note we allocate 2xspace mask, for table & srv + */ + if (hdr->flags & (IPFW_CFG_GET_STATIC | IPFW_CFG_GET_STATES)) + da.bmask = bmask = malloc( + sizeof(uint32_t) * IPFW_TABLES_MAX * 2 / 32, M_TEMP, + M_WAITOK | M_ZERO); IPFW_UH_RLOCK(chain); @@ -2391,9 +2410,6 @@ dump_config(struct ip_fw_chain *chain, ip_fw3_opheader * Prepare used tables bitmask. */ sz = sizeof(ipfw_cfg_lheader); - memset(&da, 0, sizeof(da)); - - da.b = 0; da.e = chain->n_rules; if (hdr->end_rule != 0) { @@ -2412,24 +2428,25 @@ dump_config(struct ip_fw_chain *chain, ip_fw3_opheader da.rsize += RULEUSIZE1(rule) + sizeof(ipfw_obj_tlv); da.rcount++; /* Update bitmask of used objects for given range */ - da.tcount += mark_object_kidx(chain, rule, bmask); + mark_rule_objects(chain, rule, &da); } /* Add counters if requested */ if (hdr->flags & IPFW_CFG_GET_COUNTERS) { da.rsize += sizeof(struct ip_fw_bcounter) * da.rcount; da.rcounters = 1; } - - if (da.tcount > 0) - sz += da.tcount * sizeof(ipfw_obj_ntlv) + - sizeof(ipfw_obj_ctlv); sz += da.rsize + sizeof(ipfw_obj_ctlv); } - if (hdr->flags & IPFW_CFG_GET_STATES) - sz += ipfw_dyn_get_count() * sizeof(ipfw_obj_dyntlv) + - sizeof(ipfw_obj_ctlv); + if (hdr->flags & IPFW_CFG_GET_STATES) { + sz += sizeof(ipfw_obj_ctlv) + + ipfw_dyn_get_count(bmask, &i) * sizeof(ipfw_obj_dyntlv); + da.tcount += i; + } + if (da.tcount > 0) + sz += da.tcount * sizeof(ipfw_obj_ntlv) + + sizeof(ipfw_obj_ctlv); /* * Fill header anyway. @@ -2447,8 +2464,14 @@ dump_config(struct ip_fw_chain *chain, ip_fw3_opheader } /* STAGE2: Store actual data */ + if (da.tcount > 0) { + error = dump_named_objects(chain, &da, sd); + if (error != 0) + goto cleanup; + } + if (hdr_flags & IPFW_CFG_GET_STATIC) { - error = dump_static_rules(chain, &da, bmask, sd); + error = dump_static_rules(chain, &da, sd); if (error != 0) goto cleanup; } @@ -3027,7 +3050,7 @@ add_rules(struct ip_fw_chain *chain, ip_fw3_opheader * if ((error = commit_rules(chain, cbuf, rtlv->count)) != 0) { /* Free allocate krules */ for (i = 0, ci = cbuf; i < rtlv->count; i++, ci++) - free_rule(ci->krule); + ipfw_free_rule(ci->krule); } if (cbuf != NULL && cbuf != &rci) @@ -3851,7 +3874,7 @@ ipfw_ctl(struct sockopt *sopt) import_rule0(&ci); error = commit_rules(chain, &ci, 1); if (error != 0) - free_rule(ci.krule); + ipfw_free_rule(ci.krule); else if (sopt->sopt_dir == SOPT_GET) { if (is7) { error = convert_rule_to_7(rule); Modified: stable/12/sys/netpfil/ipfw/nat64/nat64lsn_control.c ============================================================================== --- stable/12/sys/netpfil/ipfw/nat64/nat64lsn_control.c Sat Feb 2 16:57:49 2019 (r343685) +++ stable/12/sys/netpfil/ipfw/nat64/nat64lsn_control.c Sat Feb 2 17:40:43 2019 (r343686) @@ -256,6 +256,7 @@ nat64lsn_destroy(struct ip_fw_chain *ch, ip_fw3_ophead return (EBUSY); } + ipfw_reset_eaction_instance(ch, V_nat64lsn_eid, cfg->no.kidx); SRV_OBJECT(ch, cfg->no.kidx) = NULL; nat64lsn_detach_config(ch, cfg); IPFW_UH_WUNLOCK(ch); Modified: stable/12/sys/netpfil/ipfw/nat64/nat64stl_control.c ============================================================================== --- stable/12/sys/netpfil/ipfw/nat64/nat64stl_control.c Sat Feb 2 16:57:49 2019 (r343685) +++ stable/12/sys/netpfil/ipfw/nat64/nat64stl_control.c Sat Feb 2 17:40:43 2019 (r343686) @@ -342,6 +342,7 @@ nat64stl_destroy(struct ip_fw_chain *ch, ip_fw3_ophead return (EBUSY); } + ipfw_reset_eaction_instance(ch, V_nat64stl_eid, cfg->no.kidx); SRV_OBJECT(ch, cfg->no.kidx) = NULL; nat64stl_detach_config(ch, cfg); IPFW_UH_WUNLOCK(ch); Modified: stable/12/sys/netpfil/ipfw/nptv6/nptv6.c ============================================================================== --- stable/12/sys/netpfil/ipfw/nptv6/nptv6.c Sat Feb 2 16:57:49 2019 (r343685) +++ stable/12/sys/netpfil/ipfw/nptv6/nptv6.c Sat Feb 2 17:40:43 2019 (r343686) @@ -746,6 +746,7 @@ nptv6_destroy(struct ip_fw_chain *ch, ip_fw3_opheader return (EBUSY); } + ipfw_reset_eaction_instance(ch, V_nptv6_eid, cfg->no.kidx); SRV_OBJECT(ch, cfg->no.kidx) = NULL; ipfw_objhash_del(CHAIN_TO_SRV(ch), &cfg->no); ipfw_objhash_free_idx(CHAIN_TO_SRV(ch), cfg->no.kidx); From owner-svn-src-stable-12@freebsd.org Sat Feb 2 17:42:19 2019 Return-Path: Delivered-To: svn-src-stable-12@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 6764614C5925; Sat, 2 Feb 2019 17:42:19 +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 0B5AD91204; Sat, 2 Feb 2019 17:42:19 +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 F21CCA257; Sat, 2 Feb 2019 17:42: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 x12HgIdu047375; Sat, 2 Feb 2019 17:42:18 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x12HgHar047366; Sat, 2 Feb 2019 17:42:17 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201902021742.x12HgHar047366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Sat, 2 Feb 2019 17:42:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r343687 - in stable/12: sbin/ipfw sys/netinet sys/netpfil/ipfw X-SVN-Group: stable-12 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: in stable/12: sbin/ipfw sys/netinet sys/netpfil/ipfw X-SVN-Commit-Revision: 343687 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0B5AD91204 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.949,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-stable-12@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 12-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Feb 2019 17:42:19 -0000 Author: ae Date: Sat Feb 2 17:42:17 2019 New Revision: 343687 URL: https://svnweb.freebsd.org/changeset/base/343687 Log: MFC r341472: Add ability to request listing and deleting only for dynamic states. This can be useful, when net.inet.ip.fw.dyn_keep_states is enabled, but after rules reloading some state must be deleted. Added new flag '-D' for such purpose. Retire '-e' flag, since there can not be expired states in the meaning that this flag historically had. Also add "verbose" mode for listing of dynamic states, it can be enabled with '-v' flag and adds additional information to states list. This can be useful for debugging. Obtained from: Yandex LLC Sponsored by: Yandex LLC Modified: stable/12/sbin/ipfw/ipfw.8 stable/12/sbin/ipfw/ipfw2.c stable/12/sbin/ipfw/ipfw2.h stable/12/sbin/ipfw/main.c stable/12/sys/netinet/ip_fw.h stable/12/sys/netpfil/ipfw/ip_fw_dynamic.c stable/12/sys/netpfil/ipfw/ip_fw_sockopt.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/ipfw/ipfw.8 ============================================================================== --- stable/12/sbin/ipfw/ipfw.8 Sat Feb 2 17:40:43 2019 (r343686) +++ stable/12/sbin/ipfw/ipfw.8 Sat Feb 2 17:42:17 2019 (r343687) @@ -1,7 +1,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 13, 2018 +.Dd December 4, 2018 .Dt IPFW 8 .Os .Sh NAME @@ -310,10 +310,9 @@ i.e., omitting the "ip from any to any" string when this does not carry any additional information. .It Fl d When listing, show dynamic rules in addition to static ones. -.It Fl e -When listing and -.Fl d -is specified, also show expired dynamic rules. +.It Fl D +When listing, show only dynamic states. +When deleting, delete only dynamic states. .It Fl f Run without prompting for confirmation for commands that can cause problems if misused, i.e., Modified: stable/12/sbin/ipfw/ipfw2.c ============================================================================== --- stable/12/sbin/ipfw/ipfw2.c Sat Feb 2 17:40:43 2019 (r343686) +++ stable/12/sbin/ipfw/ipfw2.c Sat Feb 2 17:42:17 2019 (r343687) @@ -2245,10 +2245,9 @@ show_dyn_state(struct cmdline_opts *co, struct format_ uint16_t rulenum; char buf[INET6_ADDRSTRLEN]; - if (!co->do_expired) { - if (!d->expire && !(d->dyn_type == O_LIMIT_PARENT)) - return; - } + if (d->expire == 0 && d->dyn_type != O_LIMIT_PARENT) + return; + bcopy(&d->rule, &rulenum, sizeof(rulenum)); bprintf(bp, "%05d", rulenum); if (fo->pcwidth > 0 || fo->bcwidth > 0) { @@ -2290,6 +2289,33 @@ show_dyn_state(struct cmdline_opts *co, struct format_ if (d->kidx != 0) bprintf(bp, " :%s", object_search_ctlv(fo->tstate, d->kidx, IPFW_TLV_STATE_NAME)); + +#define BOTH_SYN (TH_SYN | (TH_SYN << 8)) +#define BOTH_FIN (TH_FIN | (TH_FIN << 8)) + if (co->verbose) { + bprintf(bp, " state 0x%08x%s", d->state, + d->state ? " ": ","); + if (d->state & IPFW_DYN_ORPHANED) + bprintf(bp, "ORPHANED,"); + if ((d->state & BOTH_SYN) == BOTH_SYN) + bprintf(bp, "BOTH_SYN,"); + else { + if (d->state & TH_SYN) + bprintf(bp, "F_SYN,"); + if (d->state & (TH_SYN << 8)) + bprintf(bp, "R_SYN,"); + } + if ((d->state & BOTH_FIN) == BOTH_FIN) + bprintf(bp, "BOTH_FIN,"); + else { + if (d->state & TH_FIN) + bprintf(bp, "F_FIN,"); + if (d->state & (TH_FIN << 8)) + bprintf(bp, "R_FIN,"); + } + bprintf(bp, " f_ack 0x%x, r_ack 0x%x", d->ack_fwd, + d->ack_rev); + } } static int @@ -2693,7 +2719,8 @@ ipfw_list(int ac, char *av[], int show_counters) cfg = NULL; sfo.show_counters = show_counters; sfo.show_time = co.do_time; - sfo.flags = IPFW_CFG_GET_STATIC; + if (co.do_dynamic != 2) + sfo.flags |= IPFW_CFG_GET_STATIC; if (co.do_dynamic != 0) sfo.flags |= IPFW_CFG_GET_STATES; if ((sfo.show_counters | sfo.show_time) != 0) @@ -2738,17 +2765,15 @@ ipfw_show_config(struct cmdline_opts *co, struct forma fo->set_mask = cfg->set_mask; ctlv = (ipfw_obj_ctlv *)(cfg + 1); + if (ctlv->head.type == IPFW_TLV_TBLNAME_LIST) { + object_sort_ctlv(ctlv); + fo->tstate = ctlv; + readsz += ctlv->head.length; + ctlv = (ipfw_obj_ctlv *)((caddr_t)ctlv + ctlv->head.length); + } if (cfg->flags & IPFW_CFG_GET_STATIC) { /* We've requested static rules */ - if (ctlv->head.type == IPFW_TLV_TBLNAME_LIST) { - object_sort_ctlv(ctlv); - fo->tstate = ctlv; - readsz += ctlv->head.length; - ctlv = (ipfw_obj_ctlv *)((caddr_t)ctlv + - ctlv->head.length); - } - if (ctlv->head.type == IPFW_TLV_RULE_LIST) { rbase = (ipfw_obj_tlv *)(ctlv + 1); rcnt = ctlv->count; @@ -2775,10 +2800,12 @@ ipfw_show_config(struct cmdline_opts *co, struct forma if (ac == 0) { fo->first = 0; fo->last = IPFW_DEFAULT_RULE; - list_static_range(co, fo, &bp, rbase, rcnt); + if (cfg->flags & IPFW_CFG_GET_STATIC) + list_static_range(co, fo, &bp, rbase, rcnt); if (co->do_dynamic && dynsz > 0) { - printf("## Dynamic rules (%d %zu):\n", fo->dcnt, dynsz); + printf("## Dynamic rules (%d %zu):\n", fo->dcnt, + dynsz); list_dyn_range(co, fo, &bp, dynbase, dynsz); } @@ -2798,6 +2825,9 @@ ipfw_show_config(struct cmdline_opts *co, struct forma continue; } + if ((cfg->flags & IPFW_CFG_GET_STATIC) == 0) + continue; + if (list_static_range(co, fo, &bp, rbase, rcnt) == 0) { /* give precedence to other error(s) */ if (exitval == EX_OK) @@ -3311,6 +3341,8 @@ ipfw_delete(char *av[]) rt.flags |= IPFW_RCFLAG_SET; } } + if (co.do_dynamic == 2) + rt.flags |= IPFW_RCFLAG_DYNAMIC; i = do_range_cmd(IP_FW_XDEL, &rt); if (i != 0) { exitval = EX_UNAVAILABLE; @@ -3318,7 +3350,8 @@ ipfw_delete(char *av[]) continue; warn("rule %u: setsockopt(IP_FW_XDEL)", rt.start_rule); - } else if (rt.new_set == 0 && do_set == 0) { + } else if (rt.new_set == 0 && do_set == 0 && + co.do_dynamic != 2) { exitval = EX_UNAVAILABLE; if (co.do_quiet) continue; Modified: stable/12/sbin/ipfw/ipfw2.h ============================================================================== --- stable/12/sbin/ipfw/ipfw2.h Sat Feb 2 17:40:43 2019 (r343686) +++ stable/12/sbin/ipfw/ipfw2.h Sat Feb 2 17:42:17 2019 (r343687) @@ -37,8 +37,6 @@ struct cmdline_opts { int do_quiet; /* Be quiet in add and flush */ int do_pipe; /* this cmd refers to a pipe/queue/sched */ int do_nat; /* this cmd refers to a nat config */ - int do_dynamic; /* display dynamic rules */ - int do_expired; /* display expired dynamic rules */ int do_compact; /* show rules in compact mode */ int do_force; /* do not ask for confirmation */ int show_sets; /* display the set each rule belongs to */ @@ -48,6 +46,8 @@ struct cmdline_opts { /* The options below can have multiple values. */ + int do_dynamic; /* 1 - display dynamic rules */ + /* 2 - display/delete only dynamic rules */ int do_sort; /* field to sort results (0 = no) */ /* valid fields are 1 and above */ Modified: stable/12/sbin/ipfw/main.c ============================================================================== --- stable/12/sbin/ipfw/main.c Sat Feb 2 17:40:43 2019 (r343686) +++ stable/12/sbin/ipfw/main.c Sat Feb 2 17:42:17 2019 (r343687) @@ -262,7 +262,7 @@ ipfw_main(int oldac, char **oldav) save_av = av; optind = optreset = 1; /* restart getopt() */ - while ((ch = getopt(ac, av, "abcdefhinNp:qs:STtv")) != -1) + while ((ch = getopt(ac, av, "abcdDefhinNp:qs:STtv")) != -1) switch (ch) { case 'a': do_acct = 1; @@ -281,8 +281,12 @@ ipfw_main(int oldac, char **oldav) co.do_dynamic = 1; break; + case 'D': + co.do_dynamic = 2; + break; + case 'e': - co.do_expired = 1; + /* nop for compatibility */ break; case 'f': Modified: stable/12/sys/netinet/ip_fw.h ============================================================================== --- stable/12/sys/netinet/ip_fw.h Sat Feb 2 17:40:43 2019 (r343686) +++ stable/12/sys/netinet/ip_fw.h Sat Feb 2 17:42:17 2019 (r343687) @@ -708,6 +708,7 @@ struct _ipfw_dyn_rule { u_int32_t state; /* state of this rule (typically a * combination of TCP flags) */ +#define IPFW_DYN_ORPHANED 0x40000 /* state's parent rule was deleted */ u_int32_t ack_fwd; /* most recent ACKs in forward */ u_int32_t ack_rev; /* and reverse directions (used */ /* to generate keepalives) */ @@ -938,9 +939,10 @@ typedef struct _ipfw_range_tlv { #define IPFW_RCFLAG_RANGE 0x01 /* rule range is set */ #define IPFW_RCFLAG_ALL 0x02 /* match ALL rules */ #define IPFW_RCFLAG_SET 0x04 /* match rules in given set */ +#define IPFW_RCFLAG_DYNAMIC 0x08 /* match only dynamic states */ /* User-settable flags */ #define IPFW_RCFLAG_USER (IPFW_RCFLAG_RANGE | IPFW_RCFLAG_ALL | \ - IPFW_RCFLAG_SET) + IPFW_RCFLAG_SET | IPFW_RCFLAG_DYNAMIC) /* Internally used flags */ #define IPFW_RCFLAG_DEFAULT 0x0100 /* Do not skip defaul rule */ Modified: stable/12/sys/netpfil/ipfw/ip_fw_dynamic.c ============================================================================== --- stable/12/sys/netpfil/ipfw/ip_fw_dynamic.c Sat Feb 2 17:40:43 2019 (r343686) +++ stable/12/sys/netpfil/ipfw/ip_fw_dynamic.c Sat Feb 2 17:42:17 2019 (r343687) @@ -2110,7 +2110,11 @@ dyn_free_states(struct ip_fw_chain *chain) } /* - * Returns 1 when state is matched by specified range, otherwise returns 0. + * Returns: + * 0 when state is not matched by specified range; + * 1 when state is matched by specified range; + * 2 when state is matched by specified range and requested deletion of + * dynamic states. */ static int dyn_match_range(uint16_t rulenum, uint8_t set, const ipfw_range_tlv *rt) @@ -2118,13 +2122,18 @@ dyn_match_range(uint16_t rulenum, uint8_t set, const i MPASS(rt != NULL); /* flush all states */ - if (rt->flags & IPFW_RCFLAG_ALL) + if (rt->flags & IPFW_RCFLAG_ALL) { + if (rt->flags & IPFW_RCFLAG_DYNAMIC) + return (2); /* forced */ return (1); + } if ((rt->flags & IPFW_RCFLAG_SET) != 0 && set != rt->set) return (0); if ((rt->flags & IPFW_RCFLAG_RANGE) != 0 && (rulenum < rt->start_rule || rulenum > rt->end_rule)) return (0); + if (rt->flags & IPFW_RCFLAG_DYNAMIC) + return (2); return (1); } @@ -2194,7 +2203,7 @@ dyn_match_ipv4_state(struct ip_fw_chain *ch, struct dy s->limit->set, rt)); ret = dyn_match_range(s->data->rulenum, s->data->set, rt); - if (ret == 0 || V_dyn_keep_states == 0) + if (ret == 0 || V_dyn_keep_states == 0 || ret > 1) return (ret); rule = s->data->parent; @@ -2217,7 +2226,7 @@ dyn_match_ipv6_state(struct ip_fw_chain *ch, struct dy s->limit->set, rt)); ret = dyn_match_range(s->data->rulenum, s->data->set, rt); - if (ret == 0 || V_dyn_keep_states == 0) + if (ret == 0 || V_dyn_keep_states == 0 || ret > 1) return (ret); rule = s->data->parent; @@ -2939,9 +2948,12 @@ dyn_export_data(const struct dyn_data *data, uint16_t memcpy((char *)&dst->rule + sizeof(data->rulenum), &data->set, sizeof(data->set)); + dst->state = data->state; + if (data->flags & DYN_REFERENCED) + dst->state |= IPFW_DYN_ORPHANED; + /* unused fields */ dst->parent = NULL; - dst->state = data->state; dst->ack_fwd = data->ack_fwd; dst->ack_rev = data->ack_rev; dst->count = 0; Modified: stable/12/sys/netpfil/ipfw/ip_fw_sockopt.c ============================================================================== --- stable/12/sys/netpfil/ipfw/ip_fw_sockopt.c Sat Feb 2 17:40:43 2019 (r343686) +++ stable/12/sys/netpfil/ipfw/ip_fw_sockopt.c Sat Feb 2 17:42:17 2019 (r343687) @@ -1033,6 +1033,16 @@ delete_range(struct ip_fw_chain *chain, ipfw_range_tlv end = ipfw_find_rule(chain, rt->end_rule, UINT32_MAX); } + if (rt->flags & IPFW_RCFLAG_DYNAMIC) { + /* + * Requested deleting only for dynamic states. + */ + *ndel = 0; + ipfw_expire_dyn_states(chain, rt); + IPFW_UH_WUNLOCK(chain); + return (0); + } + /* Allocate new map of the same size */ map = get_map(chain, 0, 1 /* locked */); if (map == NULL) { @@ -2402,7 +2412,6 @@ dump_config(struct ip_fw_chain *chain, ip_fw3_opheader da.bmask = bmask = malloc( sizeof(uint32_t) * IPFW_TABLES_MAX * 2 / 32, M_TEMP, M_WAITOK | M_ZERO); - IPFW_UH_RLOCK(chain); /*