From owner-svn-src-stable-10@freebsd.org Tue Sep 5 17:32:17 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 33531E1492A; Tue, 5 Sep 2017 17:32:17 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B2267D844; Tue, 5 Sep 2017 17:32:15 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v85HWFwV073066; Tue, 5 Sep 2017 17:32:15 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v85HWFEE073065; Tue, 5 Sep 2017 17:32:15 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201709051732.v85HWFEE073065@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 5 Sep 2017 17:32:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r323189 - stable/10/lib/libcompiler_rt X-SVN-Group: stable-10 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: stable/10/lib/libcompiler_rt X-SVN-Commit-Revision: 323189 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Sep 2017 17:32:17 -0000 Author: dim Date: Tue Sep 5 17:32:14 2017 New Revision: 323189 URL: https://svnweb.freebsd.org/changeset/base/323189 Log: MFC r323001: In compiler-rt, a few assembler implementations for i386 floating point conversion functions use SSE2 instructions, but these are not guarded by #ifdef __SSE2__, and there is no implementation using general purpose registers. For these functions, use the generic C variants instead, otherwise they will cause SIGILL on older processors. Approved by: re (kib) Reported by: bsdpr@phoe.frmug.org PR: 221733 MFC r323014: Follow-up to r323001: if the actually selected CPUTYPE is capable of SSE2 instructions, we can use them. Suggested by: jkim PR: 221733 Modified: stable/10/lib/libcompiler_rt/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libcompiler_rt/Makefile ============================================================================== --- stable/10/lib/libcompiler_rt/Makefile Tue Sep 5 17:12:12 2017 (r323188) +++ stable/10/lib/libcompiler_rt/Makefile Tue Sep 5 17:32:14 2017 (r323189) @@ -65,15 +65,9 @@ SRCF= absvdi2 \ fixunsxfti \ fixxfdi \ fixxfti \ - floatdidf \ - floatdisf \ - floatdixf \ floattidf \ floattisf \ floattixf \ - floatundidf \ - floatundisf \ - floatundixf \ floatunsidf \ floatunsisf \ floatuntidf \ @@ -125,6 +119,23 @@ SRCF= absvdi2 \ udivti3 \ umoddi3 \ umodti3 + +# Avoid using SSE2 instructions on i386, if unsupported. +.if ${MACHINE_CPUARCH} == "i386" && empty(MACHINE_CPU:Msse2) +SRCS+= floatdidf.c +SRCS+= floatdisf.c +SRCS+= floatdixf.c +SRCS+= floatundidf.c +SRCS+= floatundisf.c +SRCS+= floatundixf.c +.else +SRCF+= floatdidf +SRCF+= floatdisf +SRCF+= floatdixf +SRCF+= floatundidf +SRCF+= floatundisf +SRCF+= floatundixf +.endif # These are already shipped by libc.a on arm and mips .if ${MACHINE_CPUARCH} != "arm" && ${MACHINE_CPUARCH} != "mips" From owner-svn-src-stable-10@freebsd.org Wed Sep 6 15:33:27 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0CC01E0840F; Wed, 6 Sep 2017 15:33:27 +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 mx1.freebsd.org (Postfix) with ESMTPS id DF34F778DD; Wed, 6 Sep 2017 15:33:25 +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 v86FXOhW015871; Wed, 6 Sep 2017 15:33:24 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v86FXNRc015857; Wed, 6 Sep 2017 15:33:23 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201709061533.v86FXNRc015857@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 6 Sep 2017 15:33:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r323223 - in stable/10: share/man/man4 sys/conf sys/dev/mlx5/mlx5_ib sys/modules sys/modules/mlx5ib X-SVN-Group: stable-10 X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: in stable/10: share/man/man4 sys/conf sys/dev/mlx5/mlx5_ib sys/modules sys/modules/mlx5ib X-SVN-Commit-Revision: 323223 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Sep 2017 15:33:27 -0000 Author: hselasky Date: Wed Sep 6 15:33:23 2017 New Revision: 323223 URL: https://svnweb.freebsd.org/changeset/base/323223 Log: MFC r322810 and r322830: Add new mlx5ib(4) driver to the kernel source tree which supports Remote DMA over Converged Ethernet, RoCE, for the ConnectX-4 series of PCI express network cards. There is currently no user-space support and this driver only supports kernel side non-routable RoCE V1. The krping kernel module can be used to test this driver. Full user-space support including RoCE V2 will be added as part of the ongoing upgrade to ibcore from Linux 4.9. Otherwise this driver is feature equivalent to mlx4ib(4). The mlx5ib(4) kernel module will only be built when WITH_OFED=YES is specified. Approved by: re (marius) Sponsored by: Mellanox Technologies Added: stable/10/share/man/man4/mlx5ib.4 - copied unchanged from r322810, head/share/man/man4/mlx5ib.4 stable/10/sys/dev/mlx5/mlx5_ib/ - copied from r322810, head/sys/dev/mlx5/mlx5_ib/ stable/10/sys/modules/mlx5ib/ - copied from r322810, head/sys/modules/mlx5ib/ Modified: stable/10/share/man/man4/Makefile stable/10/sys/conf/files stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib.h stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_ah.c stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_doorbell.c stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_mad.c stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c stable/10/sys/modules/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/Makefile ============================================================================== --- stable/10/share/man/man4/Makefile Wed Sep 6 15:07:53 2017 (r323222) +++ stable/10/share/man/man4/Makefile Wed Sep 6 15:33:23 2017 (r323223) @@ -868,6 +868,7 @@ MAN+= iscsi_initiator.4 .if ${MK_OFED} != "no" MAN+= mlx4ib.4 +MAN+= mlx5ib.4 .endif .if ${MK_TESTS} != "no" Copied: stable/10/share/man/man4/mlx5ib.4 (from r322810, head/share/man/man4/mlx5ib.4) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/share/man/man4/mlx5ib.4 Wed Sep 6 15:33:23 2017 (r323223, copy of r322810, head/share/man/man4/mlx5ib.4) @@ -0,0 +1,124 @@ +.\" Copyright (c) 2017 Mellanox Technologies +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd August 23, 2017 +.Dt MLX5IB 4 +.Os +.Sh NAME +.Nm mlx5ib +.Nd "Mellanox ConnectX-4 and ConnectX-4 LX based 100Gb, 50Gb, 40Gb, 25Gb and 10Gb network adapter driver" +.Sh SYNOPSIS +To compile this driver into the kernel, +place these lines in your kernel configuration file: +.Bd -ragged -offset indent +.Cd "options COMPAT_LINUXKPI" +.Cd "device mlx5" +.Cd "device mlx5ib" +.Ed +.Pp +To load the driver as a module at run-time, +run this command as root: +.Bd -literal -offset indent +kldload mlx5ib +.Ed +.Pp +To load the driver as a +module at boot time, place this line in +.Xr loader.conf 5 : +.Bd -literal -offset indent +mlx5ib_load="YES" +.Ed +.Sh DESCRIPTION +The +.Nm +driver provides support for infiniband and Remote DMA over Converged Ethernet, +RoCE, for PCI Express network adapters based on ConnectX-4 and ConnectX-4 LX. +.br +For further hardware information and questions related to hardware +requirements, see +.Pa http://www.mellanox.com/ . +.Pp +For more information on configuring this device, see +.Xr ifconfig 8 . +.Sh HARDWARE +The +.Nm +driver supports 100Gb, 50Gb, 40Gb, 25Gb and 10Gb network adapters. +ConnectX-4 supports: 10/20/25/40/50/56/100Gb/s speeds. +ConnectX-4 LX supports: 10/25/40/50Gb/s speeds (and reduced power consumption): +.Pp +.Bl -bullet -compact +.It +Mellanox MCX455A-ECAT +.It +Mellanox MCX456A-ECAT +.It +Mellanox MCX415A-CCAT +.It +Mellanox MCX416A-CCAT +.It +Mellanox MCX455A-FCAT +.It +Mellanox MCX456A-FCAT +.It +Mellanox MCX415A-BCAT +.It +Mellanox MCX416A-BCAT +.It +Mellanox MCX4131A-GCAT +.It +Mellanox MCX4131A-BCAT +.It +Mellanox MCX4121A-ACAT +.It +Mellanox MCX4111A-ACAT +.It +Mellanox MCX4121A-XCAT +.It +Mellanox MCX4111A-XCAT +.El +.Sh SUPPORT +For general information and support, +go to the Mellanox support website at: +.Pa http://www.mellanox.com/ . +.Pp +If an issue is identified with this driver with a supported adapter, +email all the specific information related to the issue to +.Aq Mt freebsd-drivers@mellanox.com . +.Sh SEE ALSO +.Xr mlx5en 4 , +.Xr ifconfig 8 +.Sh HISTORY +The +.Nm +device driver first appeared in +.Fx 12.x . +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An Mellanox Technologies . Modified: stable/10/sys/conf/files ============================================================================== --- stable/10/sys/conf/files Wed Sep 6 15:07:53 2017 (r323222) +++ stable/10/sys/conf/files Wed Sep 6 15:33:23 2017 (r323223) @@ -3933,6 +3933,27 @@ ofed/drivers/net/mlx4/en_tx.c optional mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" +dev/mlx5/mlx5_ib/mlx5_ib_ah.c optional mlx5ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx5/mlx5_ib/mlx5_ib_cq.c optional mlx5ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx5/mlx5_ib/mlx5_ib_doorbell.c optional mlx5ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx5/mlx5_ib/mlx5_ib_mad.c optional mlx5ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx5/mlx5_ib/mlx5_ib_main.c optional mlx5ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx5/mlx5_ib/mlx5_ib_mem.c optional mlx5ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx5/mlx5_ib/mlx5_ib_mr.c optional mlx5ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx5/mlx5_ib/mlx5_ib_qp.c optional mlx5ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx5/mlx5_ib/mlx5_ib_roce.c optional mlx5ib pci ofed \ + compile-with "${OFED_C}" +dev/mlx5/mlx5_ib/mlx5_ib_srq.c optional mlx5ib pci ofed \ + compile-with "${OFED_C}" + dev/mlx5/mlx5_core/mlx5_alloc.c optional mlx5 pci \ compile-with "${OFED_C}" dev/mlx5/mlx5_core/mlx5_cmd.c optional mlx5 pci \ Modified: stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib.h ============================================================================== --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib.h Wed Aug 23 12:09:37 2017 (r322810) +++ stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib.h Wed Sep 6 15:33:23 2017 (r323223) @@ -653,6 +653,7 @@ void mlx5_ib_free_srq_wqe(struct mlx5_ib_srq *srq, int int mlx5_MAD_IFC(struct mlx5_ib_dev *dev, int ignore_mkey, int ignore_bkey, u8 port, struct ib_wc *in_wc, struct ib_grh *in_grh, void *in_mad, void *response_mad); +int mlx5_ib_resolve_grh(const struct ib_ah_attr *ah_attr, u8 *mac, int *is_mcast); struct ib_ah *create_ib_ah(struct mlx5_ib_dev *dev, struct ib_ah_attr *ah_attr, struct mlx5_ib_ah *ah, enum rdma_link_layer ll); struct ib_ah *mlx5_ib_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr); @@ -681,13 +682,13 @@ int mlx5_ib_post_recv(struct ib_qp *ibqp, struct ib_re struct ib_recv_wr **bad_wr); void *mlx5_get_send_wqe(struct mlx5_ib_qp *qp, int n); struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev, - struct ib_cq_init_attr *attr, + int entries, int vector, struct ib_ucontext *context, struct ib_udata *udata); int mlx5_ib_destroy_cq(struct ib_cq *cq); int mlx5_ib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc); int mlx5_ib_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags); -int mlx5_ib_modify_cq(struct ib_cq *cq, struct ib_cq_attr *attr, int cq_attr_mask); +int mlx5_ib_modify_cq(struct ib_cq *cq, u16 cq_count, u16 cq_period); int mlx5_ib_resize_cq(struct ib_cq *ibcq, int entries, struct ib_udata *udata); struct ib_mr *mlx5_ib_get_dma_mr(struct ib_pd *pd, int acc); struct ib_mr *mlx5_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, Modified: stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_ah.c ============================================================================== --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_ah.c Wed Aug 23 12:09:37 2017 (r322810) +++ stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_ah.c Wed Sep 6 15:33:23 2017 (r323223) @@ -29,6 +29,27 @@ #define IPV6_DEFAULT_HOPLIMIT 64 +int mlx5_ib_resolve_grh(const struct ib_ah_attr *ah_attr, u8 *mac, int *is_mcast) +{ + struct in6_addr in6; + + if (is_mcast != NULL) + *is_mcast = 0; + + memcpy(&in6, ah_attr->grh.dgid.raw, sizeof in6); + if (rdma_link_local_addr(&in6)) { + rdma_get_ll_mac(&in6, mac); + } else if (rdma_is_multicast_addr(&in6)) { + rdma_get_mcast_mac(&in6, mac); + if (is_mcast != NULL) + *is_mcast = 1; + } else { + return -EINVAL; + } + return 0; +} + + struct ib_ah *create_ib_ah(struct mlx5_ib_dev *dev, struct ib_ah_attr *ah_attr, struct mlx5_ib_ah *ah, enum rdma_link_layer ll) @@ -54,7 +75,7 @@ struct ib_ah *create_ib_ah(struct mlx5_ib_dev *dev, if (err) return ERR_PTR(err); - memcpy(ah->av.rmac, ah_attr->dmac, sizeof(ah_attr->dmac)); + mlx5_ib_resolve_grh(ah_attr, ah->av.rmac, NULL); ah->av.udp_sport = mlx5_get_roce_udp_sport( dev, ah_attr->port_num, Modified: stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c ============================================================================== --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Wed Aug 23 12:09:37 2017 (r322810) +++ stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_cq.c Wed Sep 6 15:33:23 2017 (r323223) @@ -25,6 +25,7 @@ * $FreeBSD$ */ +#include #include #include #include @@ -822,15 +823,13 @@ static void destroy_cq_kernel(struct mlx5_ib_dev *dev, } struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev, - struct ib_cq_init_attr *attr, + int entries, int vector, struct ib_ucontext *context, struct ib_udata *udata) { struct mlx5_create_cq_mbox_in *cqb = NULL; struct mlx5_ib_dev *dev = to_mdev(ibdev); struct mlx5_ib_cq *cq; - int entries = attr->cqe; - int vector = attr->comp_vector; int uninitialized_var(index); int uninitialized_var(inlen); int cqe_size; @@ -1006,13 +1005,11 @@ void mlx5_ib_cq_clean(struct mlx5_ib_cq *cq, u32 qpn, spin_unlock_irq(&cq->lock); } -int mlx5_ib_modify_cq(struct ib_cq *cq, struct ib_cq_attr *attr, int cq_attr_mask) +int mlx5_ib_modify_cq(struct ib_cq *cq, u16 cq_count, u16 cq_period) { struct mlx5_modify_cq_mbox_in *in; struct mlx5_ib_dev *dev = to_mdev(cq->device); struct mlx5_ib_cq *mcq = to_mcq(cq); - u16 cq_count = attr->moderation.cq_count; - u16 cq_period = attr->moderation.cq_period; int err; u32 fsel = 0; @@ -1022,7 +1019,7 @@ int mlx5_ib_modify_cq(struct ib_cq *cq, struct ib_cq_a return -ENOMEM; in->cqn = cpu_to_be32(mcq->mcq.cqn); - if (cq_attr_mask & IB_CQ_MODERATION) { + if (1) { if (MLX5_CAP_GEN(dev->mdev, cq_moderation)) { fsel |= (MLX5_CQ_MODIFY_PERIOD | MLX5_CQ_MODIFY_COUNT); if (cq_period & 0xf000) { Modified: stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_doorbell.c ============================================================================== --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_doorbell.c Wed Aug 23 12:09:37 2017 (r322810) +++ stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_doorbell.c Wed Sep 6 15:33:23 2017 (r323223) @@ -25,6 +25,7 @@ * $FreeBSD$ */ +#include #include #include #include @@ -42,6 +43,7 @@ int mlx5_ib_db_map_user(struct mlx5_ib_ucontext *conte struct mlx5_db *db) { struct mlx5_ib_user_db_page *page; + struct ib_umem_chunk *chunk; int err = 0; mutex_lock(&context->db_page_mutex); @@ -69,7 +71,9 @@ int mlx5_ib_db_map_user(struct mlx5_ib_ucontext *conte list_add(&page->list, &context->db_page_list); found: - db->dma = sg_dma_address(page->umem->sg_head.sgl) + (virt & ~PAGE_MASK); + chunk = list_entry(page->umem->chunk_list.next, + struct ib_umem_chunk, list); + db->dma = sg_dma_address(chunk->page_list) + (virt & ~PAGE_MASK); db->u.user_page = page; ++page->refcnt; Modified: stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_mad.c ============================================================================== --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_mad.c Wed Aug 23 12:09:37 2017 (r322810) +++ stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_mad.c Wed Sep 6 15:33:23 2017 (r323223) @@ -31,6 +31,25 @@ #include "mlx5_ib.h" #include +#define MAX_U32 0xffffffffULL +#define MAX_U16 0xffffUL + +/* Counters should be saturate once they reach their maximum value */ +#define ASSIGN_32BIT_COUNTER(counter, value) do { \ + if ((value) > MAX_U32) \ + counter = cpu_to_be32(MAX_U32); \ + else \ + counter = cpu_to_be32(value); \ +} while (0) + +/* Counters should be saturate once they reach their maximum value */ +#define ASSIGN_16BIT_COUNTER(counter, value) do { \ + if ((value) > MAX_U16) \ + counter = cpu_to_be16(MAX_U16); \ + else \ + counter = cpu_to_be16(value); \ +} while (0) + enum { MLX5_IB_VENDOR_CLASS1 = 0x9, MLX5_IB_VENDOR_CLASS2 = 0xa Modified: stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c ============================================================================== --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Aug 23 12:09:37 2017 (r322810) +++ stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c Wed Sep 6 15:33:23 2017 (r323223) @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -47,16 +48,17 @@ #include "mlx5_ib.h" #include -#include #define DRIVER_NAME "mlx5_ib" #define DRIVER_VERSION "3.2-rc1" #define DRIVER_RELDATE "May 2016" +#undef MODULE_VERSION +#include + MODULE_AUTHOR("Eli Cohen "); MODULE_DESCRIPTION("Mellanox Connect-IB HCA IB driver"); MODULE_LICENSE("Dual BSD/GPL"); -MODULE_DEPEND(mlx5ib, linuxkpi, 1, 1, 1); MODULE_DEPEND(mlx5ib, mlx5, 1, 1, 1); MODULE_DEPEND(mlx5ib, ibcore, 1, 1, 1); MODULE_VERSION(mlx5ib, 1); @@ -856,7 +858,7 @@ static struct ib_ucontext *mlx5_ib_alloc_ucontext(stru else if (reqlen == sizeof(struct mlx5_ib_alloc_ucontext_req_v2)) ver = 2; else { - mlx5_ib_err(dev, "request malformed, reqlen: %ld\n", reqlen); + mlx5_ib_err(dev, "request malformed, reqlen: %ld\n", (long)reqlen); return ERR_PTR(-EINVAL); } @@ -1573,7 +1575,6 @@ static int create_dev_resources(struct mlx5_ib_resourc struct ib_srq_init_attr attr; struct mlx5_ib_dev *dev; int ret = 0; - struct ib_cq_init_attr cq_attr = { .cqe = 1 }; dev = container_of(devr, struct mlx5_ib_dev, devr); @@ -1586,7 +1587,7 @@ static int create_dev_resources(struct mlx5_ib_resourc devr->p0->uobject = NULL; atomic_set(&devr->p0->usecnt, 0); - devr->c0 = mlx5_ib_create_cq(&dev->ib_dev, &cq_attr, NULL, NULL); + devr->c0 = mlx5_ib_create_cq(&dev->ib_dev, 1, 0, NULL, NULL); if (IS_ERR(devr->c0)) { ret = PTR_ERR(devr->c0); goto error1; @@ -2098,7 +2099,6 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev) dev->ib_dev.query_device = mlx5_ib_query_device; dev->ib_dev.query_port = mlx5_ib_query_port; dev->ib_dev.get_link_layer = mlx5_ib_port_link_layer; - dev->ib_dev.get_netdev = mlx5_ib_get_netdev; dev->ib_dev.query_gid = mlx5_ib_query_gid; dev->ib_dev.query_pkey = mlx5_ib_query_pkey; dev->ib_dev.modify_device = mlx5_ib_modify_device; Modified: stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c ============================================================================== --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c Wed Aug 23 12:09:37 2017 (r322810) +++ stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c Wed Sep 6 15:33:23 2017 (r323223) @@ -29,6 +29,8 @@ #include #include "mlx5_ib.h" +CTASSERT(sizeof(uintptr_t) == sizeof(unsigned long)); + /* @umem: umem object to scan * @addr: ib virtual address requested by the user * @count: number of PAGE_SIZE pages covered by umem @@ -40,9 +42,10 @@ void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, int *count, int *shift, int *ncont, int *order) { - uintptr_t tmp; + struct ib_umem_chunk *chunk; + unsigned long tmp; unsigned long m; - int i, k; + int i, j, k; u64 base = 0; int p = 0; int skip; @@ -50,7 +53,6 @@ void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr u64 len; u64 pfn; struct scatterlist *sg; - int entry; unsigned long page_shift = ilog2(umem->page_size); addr = addr >> page_shift; @@ -60,7 +62,9 @@ void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr mask = skip - 1; i = 0; - for_each_sg(umem->sg_head.sgl, sg, umem->nmap, entry) { + list_for_each_entry(chunk, &umem->chunk_list, list) { + for (j = 0; j < chunk->nmap; j++) { + sg = chunk->page_list + j; len = sg_dma_len(sg) >> page_shift; pfn = sg_dma_address(sg) >> page_shift; for (k = 0; k < len; k++) { @@ -85,6 +89,7 @@ void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr p++; i++; } + } } if (i) { @@ -124,17 +129,19 @@ static void __mlx5_ib_populate_pas(struct mlx5_ib_dev __be64 *pas, int access_flags) { unsigned long umem_page_shift = ilog2(umem->page_size); + struct ib_umem_chunk *chunk; int shift = page_shift - umem_page_shift; int mask = (1 << shift) - 1; - int i, k; + int i, j, k; u64 cur = 0; u64 base; int len; struct scatterlist *sg; - int entry; i = 0; - for_each_sg(umem->sg_head.sgl, sg, umem->nmap, entry) { + list_for_each_entry(chunk, &umem->chunk_list, list) { + for (j = 0; j < chunk->nmap; j++) { + sg = chunk->page_list + j; len = sg_dma_len(sg) >> umem_page_shift; base = sg_dma_address(sg); for (k = 0; k < len; k++) { @@ -152,6 +159,7 @@ static void __mlx5_ib_populate_pas(struct mlx5_ib_dev (base + (k << umem_page_shift))); i++; } + } } } Modified: stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c ============================================================================== --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c Wed Aug 23 12:09:37 2017 (r322810) +++ stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_mr.c Wed Sep 6 15:33:23 2017 (r323223) @@ -25,7 +25,7 @@ * $FreeBSD$ */ - +#include #include #include #include Modified: stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c ============================================================================== --- head/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Wed Aug 23 12:09:37 2017 (r322810) +++ stable/10/sys/dev/mlx5/mlx5_ib/mlx5_ib_qp.c Wed Sep 6 15:33:23 2017 (r323223) @@ -1591,7 +1591,9 @@ static int mlx5_set_path(struct mlx5_ib_dev *dev, cons &gid_type); if (err) return err; - memcpy(path->rmac, ah->dmac, sizeof(ah->dmac)); + err = mlx5_ib_resolve_grh(ah, path->rmac, NULL); + if (err) + return err; path->udp_sport = mlx5_get_roce_udp_sport(dev, port, ah->grh.sgid_index, 0); @@ -2079,20 +2081,14 @@ int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp enum ib_qp_state cur_state, new_state; int err = -EINVAL; int port; - enum rdma_link_layer ll = IB_LINK_LAYER_UNSPECIFIED; mutex_lock(&qp->mutex); cur_state = attr_mask & IB_QP_CUR_STATE ? attr->cur_qp_state : qp->state; new_state = attr_mask & IB_QP_STATE ? attr->qp_state : cur_state; - if (!(cur_state == new_state && cur_state == IB_QPS_RESET)) { - port = attr_mask & IB_QP_PORT ? attr->port_num : qp->port; - ll = dev->ib_dev.get_link_layer(&dev->ib_dev, port); - } - if (!ignored_ts_check(ibqp->qp_type) && - !ib_modify_qp_is_ok(cur_state, new_state, ibqp->qp_type, attr_mask, ll)) + !ib_modify_qp_is_ok(cur_state, new_state, ibqp->qp_type, attr_mask)) goto out; if ((attr_mask & IB_QP_PORT) && Modified: stable/10/sys/modules/Makefile ============================================================================== --- stable/10/sys/modules/Makefile Wed Sep 6 15:07:53 2017 (r323222) +++ stable/10/sys/modules/Makefile Wed Sep 6 15:33:23 2017 (r323223) @@ -225,6 +225,7 @@ SUBDIR= \ ${_mlxen} \ ${_mlx5} \ ${_mlx5en} \ + ${_mlx5ib} \ ${_mly} \ mmc \ mmcsd \ @@ -762,6 +763,7 @@ _mly= mly .if ${MK_OFED} != "no" || defined(ALL_MODULES) _mlx4= mlx4 _mlx4ib= mlx4ib +_mlx5ib= mlx5ib _mlxen= mlxen _mthca= mthca .endif From owner-svn-src-stable-10@freebsd.org Wed Sep 6 17:09:04 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE5CBE0CA92; Wed, 6 Sep 2017 17:09:04 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (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 269C56C48F; Wed, 6 Sep 2017 17:09:04 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1dpdos-0008ku-NA; Wed, 06 Sep 2017 20:08:54 +0300 Date: Wed, 6 Sep 2017 20:08:54 +0300 From: Slawa Olhovchenkov To: Marius Strobl Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r323081 - stable/10/sys/conf Message-ID: <20170906170854.GC9110@zxy.spb.ru> References: <201709010016.v810G3YB099686@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201709010016.v810G3YB099686@repo.freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Sep 2017 17:09:05 -0000 On Fri, Sep 01, 2017 at 12:16:03AM +0000, Marius Strobl wrote: > Author: marius > Date: Fri Sep 1 00:16:03 2017 > New Revision: 323081 > URL: https://svnweb.freebsd.org/changeset/base/323081 > > Log: > Update stable/10 to BETA3 in preparation for 10.4-BETA3 builds. > > Approved by: re (implicit) > > Modified: > stable/10/sys/conf/newvers.sh NETAMP still not working on ix card. From owner-svn-src-stable-10@freebsd.org Wed Sep 6 19:04:15 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4653EE11883; Wed, 6 Sep 2017 19:04:15 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "alchemy.franken.de", Issuer "alchemy.franken.de" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 84CA0647D8; Wed, 6 Sep 2017 19:04:14 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.15.2/8.15.2/ALCHEMY.FRANKEN.DE) with ESMTPS id v86J4BNK051976 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 6 Sep 2017 21:04:11 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.15.2/8.15.2/Submit) id v86J4AJK051975; Wed, 6 Sep 2017 21:04:10 +0200 (CEST) (envelope-from marius) Date: Wed, 6 Sep 2017 21:04:10 +0200 From: Marius Strobl To: Slawa Olhovchenkov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: Re: svn commit: r323081 - stable/10/sys/conf Message-ID: <20170906190410.GD95883@alchemy.franken.de> References: <201709010016.v810G3YB099686@repo.freebsd.org> <20170906170854.GC9110@zxy.spb.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170906170854.GC9110@zxy.spb.ru> User-Agent: Mutt/1.5.24 (2015-08-30) X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Sep 2017 19:04:15 -0000 On Wed, Sep 06, 2017 at 08:08:54PM +0300, Slawa Olhovchenkov wrote: > On Fri, Sep 01, 2017 at 12:16:03AM +0000, Marius Strobl wrote: > > > Author: marius > > Date: Fri Sep 1 00:16:03 2017 > > New Revision: 323081 > > URL: https://svnweb.freebsd.org/changeset/base/323081 > > > > Log: > > Update stable/10 to BETA3 in preparation for 10.4-BETA3 builds. > > > > Approved by: re (implicit) > > > > Modified: > > stable/10/sys/conf/newvers.sh > > NETAMP still not working on ix card. Yeah, erj@ intended to update ixgbe(4) in stable/10 but apparently has dropped the ball on it. I've no idea whether that update would actually fix netmap(4) support, though; regarding that problem he said that at Intel, they don't have much capability or time for netmap(4) testing. Marius From owner-svn-src-stable-10@freebsd.org Wed Sep 6 20:01:21 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 606FCE14106; Wed, 6 Sep 2017 20:01:21 +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 mx1.freebsd.org (Postfix) with ESMTPS id C7E367158E; Wed, 6 Sep 2017 20:01:20 +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 v86K1JV8024733; Wed, 6 Sep 2017 20:01:19 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v86K1Jri024732; Wed, 6 Sep 2017 20:01:19 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201709062001.v86K1Jri024732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Wed, 6 Sep 2017 20:01:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r323231 - stable/10/sys/contrib/ipfilter/netinet X-SVN-Group: stable-10 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: stable/10/sys/contrib/ipfilter/netinet X-SVN-Commit-Revision: 323231 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Sep 2017 20:01:21 -0000 Author: cy Date: Wed Sep 6 20:01:19 2017 New Revision: 323231 URL: https://svnweb.freebsd.org/changeset/base/323231 Log: MFC r322073: Fix matchcing of NATed ICMP queries (resolving NATed MTU discovery). Approved by: re (kib) Modified: stable/10/sys/contrib/ipfilter/netinet/ip_nat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/contrib/ipfilter/netinet/ip_nat.c ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/ip_nat.c Wed Sep 6 17:19:48 2017 (r323230) +++ stable/10/sys/contrib/ipfilter/netinet/ip_nat.c Wed Sep 6 20:01:19 2017 (r323231) @@ -4105,13 +4105,8 @@ ipf_nat_inlookup(fin, flags, p, src, mapdst) dport = htons(fin->fin_data[1]); break; case IPPROTO_ICMP : - if (flags & IPN_ICMPERR) { - sport = fin->fin_data[1]; - dport = 0; - } else { - dport = fin->fin_data[1]; - sport = 0; - } + sport = 0; + dport = fin->fin_data[1]; break; default : sport = 0; @@ -4431,8 +4426,6 @@ ipf_nat_outlookup(fin, flags, p, src, dst) ifp = fin->fin_ifp; sflags = flags & IPN_TCPUDPICMP; - sport = 0; - dport = 0; switch (p) { @@ -4442,12 +4435,12 @@ ipf_nat_outlookup(fin, flags, p, src, dst) dport = htons(fin->fin_data[1]); break; case IPPROTO_ICMP : - if (flags & IPN_ICMPERR) - sport = fin->fin_data[1]; - else - dport = fin->fin_data[1]; + sport = 0; + dport = fin->fin_data[1]; break; default : + sport = 0; + dport = 0; break; } From owner-svn-src-stable-10@freebsd.org Thu Sep 7 19:23:10 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 99237E0A227; Thu, 7 Sep 2017 19:23:10 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0EC27F3E3; Thu, 7 Sep 2017 19:23:09 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v87JN8T6001712; Thu, 7 Sep 2017 19:23:08 GMT (envelope-from gordon@FreeBSD.org) Received: (from gordon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v87JN89l001711; Thu, 7 Sep 2017 19:23:08 GMT (envelope-from gordon@FreeBSD.org) Message-Id: <201709071923.v87JN89l001711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gordon set sender to gordon@FreeBSD.org using -f From: Gordon Tetlow Date: Thu, 7 Sep 2017 19:23:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r323281 - in stable: 10/contrib/file/src 11/contrib/file/src X-SVN-Group: stable-10 X-SVN-Commit-Author: gordon X-SVN-Commit-Paths: in stable: 10/contrib/file/src 11/contrib/file/src X-SVN-Commit-Revision: 323281 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Sep 2017 19:23:10 -0000 Author: gordon Date: Thu Sep 7 19:23:08 2017 New Revision: 323281 URL: https://svnweb.freebsd.org/changeset/base/323281 Log: MFC r323278: Fix an incorrectly used conditional causing buffer overflow. Reported by: Thomas Jarosch of Intra2net AG Reviewed by: emaste, jhb Approved by: re (marius) Security: CVE-2017-1000249 Modified: stable/10/contrib/file/src/readelf.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/file/src/readelf.c Directory Properties: stable/11/ (props changed) Modified: stable/10/contrib/file/src/readelf.c ============================================================================== --- stable/10/contrib/file/src/readelf.c Thu Sep 7 19:15:31 2017 (r323280) +++ stable/10/contrib/file/src/readelf.c Thu Sep 7 19:23:08 2017 (r323281) @@ -509,7 +509,7 @@ do_bid_note(struct magic_set *ms, unsigned char *nbuf, size_t noff, size_t doff, int *flags) { if (namesz == 4 && strcmp((char *)&nbuf[noff], "GNU") == 0 && - type == NT_GNU_BUILD_ID && (descsz >= 4 || descsz <= 20)) { + type == NT_GNU_BUILD_ID && (descsz >= 4 && descsz <= 20)) { uint8_t desc[20]; const char *btype; uint32_t i; From owner-svn-src-stable-10@freebsd.org Thu Sep 7 23:28:37 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B1E2FE17208; Thu, 7 Sep 2017 23:28:37 +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 mx1.freebsd.org (Postfix) with ESMTPS id 07BC4709A7; Thu, 7 Sep 2017 23:28:36 +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 v87NSafG000792; Thu, 7 Sep 2017 23:28:36 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v87NSapG000791; Thu, 7 Sep 2017 23:28:36 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201709072328.v87NSapG000791@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Thu, 7 Sep 2017 23:28:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r323291 - stable/10/bin/date X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/10/bin/date X-SVN-Commit-Revision: 323291 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Sep 2017 23:28:37 -0000 Author: marius Date: Thu Sep 7 23:28:35 2017 New Revision: 323291 URL: https://svnweb.freebsd.org/changeset/base/323291 Log: MFC: r321293 date: avoid crash on invalid time PR: 220828 Approved by: re (kib) Modified: stable/10/bin/date/date.c Directory Properties: stable/10/ (props changed) Modified: stable/10/bin/date/date.c ============================================================================== --- stable/10/bin/date/date.c Thu Sep 7 21:43:39 2017 (r323290) +++ stable/10/bin/date/date.c Thu Sep 7 23:28:35 2017 (r323291) @@ -85,7 +85,7 @@ main(int argc, char *argv[]) int set_timezone; struct vary *v; const struct vary *badv; - struct tm lt; + struct tm *lt; struct stat sb; v = NULL; @@ -174,8 +174,10 @@ main(int argc, char *argv[]) if (*argv && **argv == '+') format = *argv + 1; - lt = *localtime(&tval); - badv = vary_apply(v, <); + lt = localtime(&tval); + if (lt == NULL) + errx(1, "invalid time"); + badv = vary_apply(v, lt); if (badv) { fprintf(stderr, "%s: Cannot apply date adjustment\n", badv->arg); @@ -191,7 +193,7 @@ main(int argc, char *argv[]) */ setlocale(LC_TIME, "C"); - (void)strftime(buf, sizeof(buf), format, <); + (void)strftime(buf, sizeof(buf), format, lt); (void)printf("%s\n", buf); if (fflush(stdout)) err(1, "stdout"); @@ -210,6 +212,8 @@ setthetime(const char *fmt, const char *p, int jflag, int century; lt = localtime(&tval); + if (lt == NULL) + errx(1, "invalid time"); lt->tm_isdst = -1; /* divine correct DST */ if (fmt != NULL) { From owner-svn-src-stable-10@freebsd.org Fri Sep 8 00:11:37 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1EC5E199D3; Fri, 8 Sep 2017 00:11:37 +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 mx1.freebsd.org (Postfix) with ESMTPS id 446EC7DDAB; Fri, 8 Sep 2017 00:11:37 +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 v880BaKd017710; Fri, 8 Sep 2017 00:11:36 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v880BZuw017707; Fri, 8 Sep 2017 00:11:35 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201709080011.v880BZuw017707@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Fri, 8 Sep 2017 00:11:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r323293 - stable/10/sys/dev/e1000 X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/10/sys/dev/e1000 X-SVN-Commit-Revision: 323293 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Sep 2017 00:11:38 -0000 Author: marius Date: Fri Sep 8 00:11:35 2017 New Revision: 323293 URL: https://svnweb.freebsd.org/changeset/base/323293 Log: - Ever since the workaround for the silicon bug of TSO4 causing MAC hangs was committed in r295133 (MFCed to stable/10 in r295287), CSUM_TSO gets always disabled by em(4) on the first invocation of em_init_locked() as at that point no link is established, yet. In turn, this causes CSUM_TSO also to be off when em(4) is used as a parent device for vlan(4), i. e. besides IFCAP_TSO4, IFCAP_VLAN_HWTSO effectively doesn't work either. In head an attempt to fix this was made with r308345, but that revision had several problems on its own. One of which was that r308345 caused IFCAP_TSO4 to also be cleared from both the interface capability and capability enable bits. Thus, once a link switched from gigabit to a lower speed, TSO no longer could be enabled, even not via ifconfig(8). So this change moves the aforementioned WAR to em_update_link_status() like r308345 did, but only alters the hardware assist bits accordingly, leaving IFCAP_TSO4 flags alone. Still, this isn't the only problem r308345 had. Another one is that there just is no way to atomically flush TSO-using descriptors already queued at the point in time a link speed switch to below GbE occurs. Thus, such in-flight descriptors still may hang the MAC. Moreover, at least currently there also is no way of triggering a reconfiguration of vlan(4) when the state of IFCAP_VLAN_HWTSO support changes at runtime, causing vlan(4) to continue employing TSO. Last but not least, testing shows that - despite all the WARs for TSO-related silicon bugs in em(4) - at least 82579 still may hang at gigabit speed with IFCAP_TSO4 enabled. Therefore, this change further removes IFCAP_TSO4 and IFCAP_VLAN_HWTSO from interface capability enable bits as set by em(4). While at it, the use of CSUM_TCP is replaced with CSUM_IP_TSO as em(4) only implements support for IFCAP_TSO4 but not IFCAP_TSO6 (although in principle available with a subset of the supported MACs). At the bottom line, this change allows IFCAP_TSO4 and IFCAP_VLAN_HWTSO to be used again with em(4), but these hardware offloading capabilities now need to be explicitly enabled via ifconfig(8). Beware that it's only considered safe to do so (and also only may work) in environments where the link speed is not to be expected to change from GbE. Moreover, em(4) appears to still be missing some more TSO workarounds for at least some models, specifically the 82579 (I could not find an errata sheet and "specification update" respectively for these latter, though, and the generic ICH8 one doesn't list any TSO related bugs). - Let igb_tso_setup() handle EtherType protocols that are unsupported or for which support hasn't been compiled in gracefully instead of calling panic(9). - Make em_allocate_{legacy,msix}() and lem_allocate_irq() match their prototypes WRT static. This is a direct commit to stable/10 as corresponding code is no longer present in head. Approved by: re (gjb, kib) Modified: stable/10/sys/dev/e1000/if_em.c stable/10/sys/dev/e1000/if_igb.c stable/10/sys/dev/e1000/if_lem.c Modified: stable/10/sys/dev/e1000/if_em.c ============================================================================== --- stable/10/sys/dev/e1000/if_em.c Fri Sep 8 00:11:10 2017 (r323292) +++ stable/10/sys/dev/e1000/if_em.c Fri Sep 8 00:11:35 2017 (r323293) @@ -371,11 +371,6 @@ MODULE_DEPEND(em, ether, 1, 1, 1); #define MAX_INTS_PER_SEC 8000 #define DEFAULT_ITR (1000000000/(MAX_INTS_PER_SEC * 256)) -/* Allow common code without TSO */ -#ifndef CSUM_TSO -#define CSUM_TSO 0 -#endif - #define TSO_WORKAROUND 4 static SYSCTL_NODE(_hw, OID_AUTO, em, CTLFLAG_RD, 0, "EM driver parameters"); @@ -1406,18 +1401,10 @@ em_init_locked(struct adapter *adapter) E1000_WRITE_REG(&adapter->hw, E1000_VET, ETHERTYPE_VLAN); /* Set hardware offload abilities */ - ifp->if_hwassist = 0; if (ifp->if_capenable & IFCAP_TXCSUM) ifp->if_hwassist |= (CSUM_TCP | CSUM_UDP); - /* - ** There have proven to be problems with TSO when not - ** at full gigabit speed, so disable the assist automatically - ** when at lower speeds. -jfv - */ - if (ifp->if_capenable & IFCAP_TSO4) { - if (adapter->link_speed == SPEED_1000) - ifp->if_hwassist |= CSUM_TSO; - } + else + ifp->if_hwassist &= ~(CSUM_TCP | CSUM_UDP); /* Configure for OS presence */ em_init_manageability(adapter); @@ -1933,7 +1920,7 @@ em_xmit(struct tx_ring *txr, struct mbuf **m_headp) bool do_tso, tso_desc, remap = TRUE; m_head = *m_headp; - do_tso = (m_head->m_pkthdr.csum_flags & CSUM_TSO); + do_tso = m_head->m_pkthdr.csum_flags & CSUM_IP_TSO; tso_desc = FALSE; ip_off = poff = 0; @@ -2120,7 +2107,7 @@ retry: m_head = *m_headp; /* Do hardware assists */ - if (m_head->m_pkthdr.csum_flags & CSUM_TSO) { + if (m_head->m_pkthdr.csum_flags & CSUM_IP_TSO) { em_tso_setup(txr, m_head, ip_off, ip, tp, &txd_upper, &txd_lower); /* we need to make a final sentinel transmit desc */ @@ -2465,6 +2452,19 @@ em_update_link_status(struct adapter *adapter) if (link_check && (adapter->link_active == 0)) { e1000_get_speed_and_duplex(hw, &adapter->link_speed, &adapter->link_duplex); + + /* + ** There have proven to be problems with TSO when not at full + ** gigabit speed, so disable the assist automatically when at + ** lower speeds. -jfv + */ + if (ifp->if_capenable & IFCAP_TSO4) { + if (adapter->link_speed == SPEED_1000) + ifp->if_hwassist |= CSUM_IP_TSO; + else + ifp->if_hwassist &= ~CSUM_IP_TSO; + } + /* Check if we must disable SPEED_MODE bit on PCI-E */ if ((adapter->link_speed != SPEED_1000) && ((hw->mac.type == e1000_82571) || @@ -2601,7 +2601,7 @@ em_allocate_pci_resources(struct adapter *adapter) * Setup the Legacy or MSI Interrupt handler * **********************************************************************/ -int +static int em_allocate_legacy(struct adapter *adapter) { device_t dev = adapter->dev; @@ -2658,7 +2658,7 @@ em_allocate_legacy(struct adapter *adapter) * for TX, RX, and Link. * **********************************************************************/ -int +static int em_allocate_msix(struct adapter *adapter) { device_t dev = adapter->dev; @@ -3270,11 +3270,9 @@ em_setup_interface(device_t dev, struct adapter *adapt ether_ifattach(ifp, adapter->hw.mac.addr); - ifp->if_capabilities = ifp->if_capenable = 0; + ifp->if_capabilities = IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM; + ifp->if_capenable = ifp->if_capabilities; - - ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM; - ifp->if_capabilities |= IFCAP_TSO4; /* * Tell the upper layer(s) we * support full VLAN capability @@ -3283,7 +3281,26 @@ em_setup_interface(device_t dev, struct adapter *adapt ifp->if_capabilities |= IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_HWTSO | IFCAP_VLAN_MTU; - ifp->if_capenable = ifp->if_capabilities; + ifp->if_capenable |= IFCAP_VLAN_HWTAGGING + | IFCAP_VLAN_MTU; + + /* + * We don't enable IFCAP_{TSO4,VLAN_HWTSO} by default because: + * - Although the silicon bug of TSO only working at gigabit speed is + * worked around in em_update_link_status() by selectively setting + * CSUM_IP_TSO, we cannot atomically flush already queued TSO-using + * descriptors. Thus, such descriptors may still cause the MAC to + * hang and, consequently, TSO is only safe to be used in setups + * where the link isn't expected to switch from gigabit to lower + * speeds. + * - Similarly, there's currently no way to trigger a reconfiguration + * of vlan(4) when the state of IFCAP_VLAN_HWTSO support changes at + * runtime. Therefore, IFCAP_VLAN_HWTSO also only is safe to use + * when link speed changes are not to be expected. + * - Despite all the workarounds for TSO-related silicon bugs, at + * least 82579 still may hang at gigabit speed with IFCAP_TSO4. + */ + ifp->if_capabilities |= IFCAP_TSO4 | IFCAP_VLAN_HWTSO; /* ** Don't turn this on by default, if vlans are Modified: stable/10/sys/dev/e1000/if_igb.c ============================================================================== --- stable/10/sys/dev/e1000/if_igb.c Fri Sep 8 00:11:10 2017 (r323292) +++ stable/10/sys/dev/e1000/if_igb.c Fri Sep 8 00:11:35 2017 (r323293) @@ -3737,9 +3737,10 @@ igb_tso_setup(struct tx_ring *txr, struct mbuf *mp, break; #endif default: - panic("%s: CSUM_TSO but no supported IP version (0x%04x)", - __func__, ntohs(eh_type)); - break; + device_printf(adapter->dev, + "CSUM_TSO but no supported IP version (0x%04x)", + ntohs(eh_type)); + return (ENXIO); } ctxd = txr->next_avail_desc; Modified: stable/10/sys/dev/e1000/if_lem.c ============================================================================== --- stable/10/sys/dev/e1000/if_lem.c Fri Sep 8 00:11:10 2017 (r323292) +++ stable/10/sys/dev/e1000/if_lem.c Fri Sep 8 00:11:35 2017 (r323293) @@ -2336,7 +2336,7 @@ lem_allocate_pci_resources(struct adapter *adapter) * Setup the Legacy or MSI Interrupt handler * **********************************************************************/ -int +static int lem_allocate_irq(struct adapter *adapter) { device_t dev = adapter->dev; From owner-svn-src-stable-10@freebsd.org Fri Sep 8 00:12:00 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 990A9E19A99; Fri, 8 Sep 2017 00:12:00 +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 mx1.freebsd.org (Postfix) with ESMTPS id 4657D7DF1C; Fri, 8 Sep 2017 00:12:00 +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 v880BxsD020736; Fri, 8 Sep 2017 00:11:59 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v880BxZB020735; Fri, 8 Sep 2017 00:11:59 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201709080011.v880BxZB020735@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Fri, 8 Sep 2017 00:11:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r323294 - stable/10/sys/conf X-SVN-Group: stable-10 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/10/sys/conf X-SVN-Commit-Revision: 323294 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Sep 2017 00:12:00 -0000 Author: marius Date: Fri Sep 8 00:11:58 2017 New Revision: 323294 URL: https://svnweb.freebsd.org/changeset/base/323294 Log: Update stable/10 to BETA4 in preparation for 10.4-BETA4 builds. Approved by: re (implicit) Modified: stable/10/sys/conf/newvers.sh Modified: stable/10/sys/conf/newvers.sh ============================================================================== --- stable/10/sys/conf/newvers.sh Fri Sep 8 00:11:35 2017 (r323293) +++ stable/10/sys/conf/newvers.sh Fri Sep 8 00:11:58 2017 (r323294) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="10.4" -BRANCH="BETA3" +BRANCH="BETA4" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-stable-10@freebsd.org Fri Sep 8 20:41:50 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E34DE09933; Fri, 8 Sep 2017 20:41:50 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46ABF6A2CB; Fri, 8 Sep 2017 20:41:50 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v88KfnPC022072; Fri, 8 Sep 2017 20:41:49 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v88KfnAT022071; Fri, 8 Sep 2017 20:41:49 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201709082041.v88KfnAT022071@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 8 Sep 2017 20:41:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r323331 - stable/10/sys/cddl/contrib/opensolaris/common/zfs X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/10/sys/cddl/contrib/opensolaris/common/zfs X-SVN-Commit-Revision: 323331 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Sep 2017 20:41:50 -0000 Author: emaste Date: Fri Sep 8 20:41:49 2017 New Revision: 323331 URL: https://svnweb.freebsd.org/changeset/base/323331 Log: MFC r323002: zfs: do not advertise unsupported hash algorithms illumos 4185 ("add new cryptographic checksums to ZFS: SHA-512, Skein, Edon-R") was intentionally merged only partially in r289422, without adding support for skein, sha512 and edonr on FreeBSD. Support for skein and sha512 was added later on (in head), but none of these are supported in stable/10. Prior to this commit zfs(8) correctly rejected these algorithms, but with an error message that claimed support: fk@r500 ~ $zfs set checksum=edonr tank cannot set property for 'tank': 'checksum' must be one of 'on | off | fletcher2 | fletcher4 | sha256 | sha512 | skein | edonr' (This commit removes sha512 and skein in addition to edonr from the merge of head's r323002.) PR: 204055 Submitted by: Fabian Keil Approved by: re (kib) Obtained from: ElectroBSD Modified: stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c ============================================================================== --- stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c Fri Sep 8 20:20:35 2017 (r323330) +++ stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c Fri Sep 8 20:41:49 2017 (r323331) @@ -241,12 +241,12 @@ zfs_prop_init(void) zprop_register_index(ZFS_PROP_CHECKSUM, "checksum", ZIO_CHECKSUM_DEFAULT, PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME, - "on | off | fletcher2 | fletcher4 | sha256 | sha512 | " - "skein | edonr", "CHECKSUM", checksum_table); + "on | off | fletcher2 | fletcher4 | sha256", + "CHECKSUM", checksum_table); zprop_register_index(ZFS_PROP_DEDUP, "dedup", ZIO_CHECKSUM_OFF, PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME, - "on | off | verify | sha256[,verify], sha512[,verify], " - "skein[,verify], edonr,verify", "DEDUP", dedup_table); + "on | off | verify | sha256[,verify]", + "DEDUP", dedup_table); zprop_register_index(ZFS_PROP_COMPRESSION, "compression", ZIO_COMPRESS_DEFAULT, PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME, From owner-svn-src-stable-10@freebsd.org Fri Sep 8 21:02:16 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF681E0A792; Fri, 8 Sep 2017 21:02:16 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B0C346AB76; Fri, 8 Sep 2017 21:02:16 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v88L2FEB028660; Fri, 8 Sep 2017 21:02:15 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v88L2FnM028658; Fri, 8 Sep 2017 21:02:15 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201709082102.v88L2FnM028658@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 8 Sep 2017 21:02:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r323332 - in stable/10/usr.sbin/pw: . tests X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in stable/10/usr.sbin/pw: . tests X-SVN-Commit-Revision: 323332 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Sep 2017 21:02:17 -0000 Author: emaste Date: Fri Sep 8 21:02:15 2017 New Revision: 323332 URL: https://svnweb.freebsd.org/changeset/base/323332 Log: MFC r322678: pw useradd: Validate the user name before creating the entry Previouly it was possible to create users with spaces in the name with: pw useradd -u 1234 -g 1234 -n 'test user' The "-g 1234" is relevant, without it the name was already rejected as expected: [fk@test ~]$ sudo pw useradd -u 1234 -n 'test user' pw: invalid character ` ' at position 4 in userid/group name Bug unintentionally found with a salt config without explicit name entry: test user: user.present: - uid: 1234 - gid: 1234 - fullname: Test user - shell: /usr/local/bin/bash - home: /home/test - groups: - wheel - salt "Luckily" salt modules rarely bother with input validation either ... PR: 221416 Submitted by: Fabian Keil Approved by: re (kib) Obtained from: ElectroBSD Modified: stable/10/usr.sbin/pw/pw_user.c stable/10/usr.sbin/pw/tests/pw_useradd_test.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/pw/pw_user.c ============================================================================== --- stable/10/usr.sbin/pw/pw_user.c Fri Sep 8 20:41:49 2017 (r323331) +++ stable/10/usr.sbin/pw/pw_user.c Fri Sep 8 21:02:15 2017 (r323332) @@ -1204,7 +1204,7 @@ pw_user_add(int argc, char **argv, char *arg1) if (arg1[strspn(arg1, "0123456789")] == '\0') id = pw_checkid(arg1, UID_MAX); else - name = arg1; + name = pw_checkname(arg1, 0); } while ((ch = getopt(argc, argv, args)) != -1) { @@ -1216,7 +1216,7 @@ pw_user_add(int argc, char **argv, char *arg1) quiet = true; break; case 'n': - name = optarg; + name = pw_checkname(optarg, 0); break; case 'u': userid = optarg; Modified: stable/10/usr.sbin/pw/tests/pw_useradd_test.sh ============================================================================== --- stable/10/usr.sbin/pw/tests/pw_useradd_test.sh Fri Sep 8 20:41:49 2017 (r323331) +++ stable/10/usr.sbin/pw/tests/pw_useradd_test.sh Fri Sep 8 21:02:15 2017 (r323332) @@ -176,6 +176,43 @@ user_add_name_too_long_body() { ${PW} useradd name_very_vert_very_very_very_long } +atf_test_case user_add_name_with_spaces +user_add_name_with_spaces_body() { + populate_etc_skel + atf_check -s exit:65 -e match:"invalid character" \ + ${PW} useradd 'test user' + atf_check -s exit:1 -o empty grep "^test user:.*" $HOME/master.passwd + # Try again with -n which uses a slightly different code path. + atf_check -s exit:65 -e match:"invalid character" \ + ${PW} useradd -n 'test user' + atf_check -s exit:1 -o empty grep "^test user:.*" $HOME/master.passwd +} + +atf_test_case user_add_name_with_spaces_and_gid_specified +user_add_name_with_spaces_and_gid_specified_body() { + populate_etc_skel + gid=12345 + user_name="test user" + # pw useradd should fail because of the space in the user + # name, not because the group doesn't exist. + atf_check -s exit:65 -e match:"invalid character" \ + ${PW} useradd "${user_name}" -g ${gid} + atf_check -s exit:1 -o empty grep "^${user_name}:.*" $HOME/master.passwd + # Try again with -n which uses a slightly different code path. + atf_check -s exit:65 -e match:"invalid character" \ + ${PW} useradd -n "${user_name}" -g ${gid} + atf_check -s exit:1 -o empty grep "^${user_name}:.*" $HOME/master.passwd + # Make sure the user isn't added even if the group exists + atf_check -s exit:0 ${PW} groupadd blafasel -g ${gid} + atf_check -s exit:65 -e match:"invalid character" \ + ${PW} useradd "${user_name}" -g ${gid} + atf_check -s exit:1 -o empty grep "^${user_name}:.*" $HOME/master.passwd + # Try again with the -n option. + atf_check -s exit:65 -e match:"invalid character" \ + ${PW} useradd -n "${user_name}" -g ${gid} + atf_check -s exit:1 -o empty grep "^${user_name}:.*" $HOME/master.passwd +} + atf_test_case user_add_expiration user_add_expiration_body() { populate_etc_skel @@ -415,6 +452,8 @@ atf_init_test_cases() { atf_add_test_case user_add_password_expiration_date_month atf_add_test_case user_add_password_expiration_date_relative atf_add_test_case user_add_name_too_long + atf_add_test_case user_add_name_with_spaces + atf_add_test_case user_add_name_with_spaces_and_gid_specified atf_add_test_case user_add_expiration atf_add_test_case user_add_invalid_user_entry atf_add_test_case user_add_invalid_group_entry From owner-svn-src-stable-10@freebsd.org Fri Sep 8 21:16:25 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1459CE0B2DC; Fri, 8 Sep 2017 21:16:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D43936B212; Fri, 8 Sep 2017 21:16:24 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v88LGNwC035048; Fri, 8 Sep 2017 21:16:23 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v88LGNQ8035046; Fri, 8 Sep 2017 21:16:23 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201709082116.v88LGNQ8035046@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 8 Sep 2017 21:16:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r323333 - in stable/10/usr.sbin/pw: . tests X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in stable/10/usr.sbin/pw: . tests X-SVN-Commit-Revision: 323333 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Sep 2017 21:16:25 -0000 Author: emaste Date: Fri Sep 8 21:16:23 2017 New Revision: 323333 URL: https://svnweb.freebsd.org/changeset/base/323333 Log: MFC r322677: pw usermod: handle empty secondary group lists (-G '') "pw usermod someuser -G ''" is supposed make sure that someuser doesn't have any secondary group memberships. Previouly it was a nop because split_groups() only intitialised "groups" if at least one group was specified. As a result the existing secondary group memberships were kept. PR: 221417 Submitted by: Fabian Keil Approved by: re (kib) Obtained from: ElectroBSD Relnotes: yes Modified: stable/10/usr.sbin/pw/pw_user.c stable/10/usr.sbin/pw/tests/pw_usermod_test.sh Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/pw/pw_user.c ============================================================================== --- stable/10/usr.sbin/pw/pw_user.c Fri Sep 8 21:02:15 2017 (r323332) +++ stable/10/usr.sbin/pw/pw_user.c Fri Sep 8 21:16:23 2017 (r323333) @@ -1089,10 +1089,10 @@ split_groups(StringList **groups, char *groupsstr) char *p; char tok[] = ", \t"; + if (*groups == NULL) + *groups = sl_init(); for (p = strtok(groupsstr, tok); p != NULL; p = strtok(NULL, tok)) { grp = group_from_name_or_id(p); - if (*groups == NULL) - *groups = sl_init(); sl_add(*groups, newstr(grp->gr_name)); } } Modified: stable/10/usr.sbin/pw/tests/pw_usermod_test.sh ============================================================================== --- stable/10/usr.sbin/pw/tests/pw_usermod_test.sh Fri Sep 8 21:02:15 2017 (r323332) +++ stable/10/usr.sbin/pw/tests/pw_usermod_test.sh Fri Sep 8 21:16:23 2017 (r323333) @@ -128,6 +128,9 @@ user_mod_nogroups_body() { atf_check -s exit:0 ${PW} usermod foo -G test3,test4 atf_check -s exit:0 -o inline:"test3\ntest4\n" \ awk -F\: '$4 == "foo" { print $1 }' ${HOME}/group + atf_check -s exit:0 ${PW} usermod foo -G "" + atf_check -s exit:0 -o empty \ + awk -F\: '$4 == "foo" { print $1 }' ${HOME}/group } atf_test_case user_mod_rename From owner-svn-src-stable-10@freebsd.org Sat Sep 9 01:23:31 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A81E5E178C4; Sat, 9 Sep 2017 01:23:31 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7526172CB4; Sat, 9 Sep 2017 01:23:31 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v891NUrR036972; Sat, 9 Sep 2017 01:23:30 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v891NUi9036971; Sat, 9 Sep 2017 01:23:30 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201709090123.v891NUi9036971@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sat, 9 Sep 2017 01:23:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r323337 - stable/10/usr.sbin/bsdinstall/scripts X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/10/usr.sbin/bsdinstall/scripts X-SVN-Commit-Revision: 323337 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Sep 2017 01:23:31 -0000 Author: emaste Date: Sat Sep 9 01:23:30 2017 New Revision: 323337 URL: https://svnweb.freebsd.org/changeset/base/323337 Log: MFC r322374: bsdinstall: record DHCP config after obtaining lease Previously we added an ifconfig_$INTERFACE line to rc.conf for each unsuccessful DCHP attempt. PR: 219515 Approved by: re (marius) Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bsdinstall/scripts/netconfig_ipv4 ============================================================================== --- stable/10/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Sat Sep 9 00:33:19 2017 (r323336) +++ stable/10/usr.sbin/bsdinstall/scripts/netconfig_ipv4 Sat Sep 9 01:23:30 2017 (r323337) @@ -48,8 +48,6 @@ esac dialog --backtitle 'FreeBSD Installer' --title 'Network Configuration' --yesno 'Would you like to use DHCP to configure this interface?' 0 0 if [ $? -eq $DIALOG_OK ]; then - echo ifconfig_$INTERFACE=\"${IFCONFIG_PREFIX}DHCP\" >> $BSDINSTALL_TMPETC/._rc.conf.net - if [ ! -z $BSDINSTALL_CONFIGCURRENT ]; then dialog --backtitle 'FreeBSD Installer' --infobox "Acquiring DHCP lease..." 0 0 err=$( dhclient $INTERFACE 2>&1 ) @@ -59,6 +57,7 @@ if [ $? -eq $DIALOG_OK ]; then exec $0 ${INTERFACE} "${IFCONFIG_PREFIX}" fi fi + echo ifconfig_$INTERFACE=\"${IFCONFIG_PREFIX}DHCP\" >> $BSDINSTALL_TMPETC/._rc.conf.net exit 0 fi From owner-svn-src-stable-10@freebsd.org Sat Sep 9 14:30:17 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2A55E19AB2; Sat, 9 Sep 2017 14:30:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BF93B6B208; Sat, 9 Sep 2017 14:30:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v89EUGD1056452; Sat, 9 Sep 2017 14:30:16 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v89EUGnV056451; Sat, 9 Sep 2017 14:30:16 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201709091430.v89EUGnV056451@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Sat, 9 Sep 2017 14:30:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r323366 - stable/10/sys/compat/linux X-SVN-Group: stable-10 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/10/sys/compat/linux X-SVN-Commit-Revision: 323366 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Sep 2017 14:30:18 -0000 Author: emaste Date: Sat Sep 9 14:30:16 2017 New Revision: 323366 URL: https://svnweb.freebsd.org/changeset/base/323366 Log: MFC r320069: Add ZFS to Linux statfs ftype PR: 220086 Approved by: re (gjb) Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/compat/linux/linux_stats.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/compat/linux/linux_stats.c ============================================================================== --- stable/10/sys/compat/linux/linux_stats.c Sat Sep 9 13:18:32 2017 (r323365) +++ stable/10/sys/compat/linux/linux_stats.c Sat Sep 9 14:30:16 2017 (r323366) @@ -351,6 +351,7 @@ struct l_statfs { #define LINUX_NTFS_SUPER_MAGIC 0x5346544EL #define LINUX_PROC_SUPER_MAGIC 0x9fa0L #define LINUX_UFS_SUPER_MAGIC 0x00011954L /* XXX - UFS_MAGIC in Linux */ +#define LINUX_ZFS_SUPER_MAGIC 0x2FC12FC1 #define LINUX_DEVFS_SUPER_MAGIC 0x1373L #define LINUX_SHMFS_MAGIC 0x01021994 @@ -360,6 +361,7 @@ bsd_to_linux_ftype(const char *fstypename) int i; static struct {const char *bsd_name; long linux_type;} b2l_tbl[] = { {"ufs", LINUX_UFS_SUPER_MAGIC}, + {"zfs", LINUX_ZFS_SUPER_MAGIC}, {"cd9660", LINUX_ISOFS_SUPER_MAGIC}, {"nfs", LINUX_NFS_SUPER_MAGIC}, {"ext2fs", LINUX_EXT2_SUPER_MAGIC},